ad_qry_totaldepreciationsubject_c.pas

来自「一个MRPII系统源代码版本」· PAS 代码 · 共 128 行

PAS
128
字号
unit Ad_Qry_TotalDepreciationSubject_C;


Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Condition, Db, AdODB, StdCtrls, ExtEdit, Mask, linkedit;

Type
  TFrm_Ad_Qry_TotalDepreciationSubject_C = Class(TFrm_Base_Condition)
    Lbl_VendorName: TLabel;
    Label2: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Medt_Month_Fm: TMaskEdit;
    Lbl_Operator_Name_Fm: TLabel;
    Lbl_Operator_Name_To: TLabel;
    ExtEdt_DeptCode_Fm: TLinkEdit;
    ExtEdt_DeptCode_To: TLinkEdit;
    Edt_DeptName_Fm: TEdit;
    Edt_DeptName_to: TEdit;
    Medt_Month_To: TMaskEdit;
    Label1: TLabel;
    procedure btn_okClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ExtEdt_DeptCode_ToExit(Sender: TObject);
    procedure ExtEdt_DeptCode_FmExit(Sender: TObject);
    procedure ExtEdt_DeptCode_FmKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure ExtEdt_DeptCode_FmButtonClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Frm_Ad_Qry_TotalDepreciationSubject_C: TFrm_Ad_Qry_TotalDepreciationSubject_C;

implementation
uses Ad_Qry_TotalDepreciationSubject,Sys_Global;

{$R *.DFM}

procedure TFrm_Ad_Qry_TotalDepreciationSubject_C.btn_okClick(Sender: TObject);
var
  sqltext:String;
begin
  inherited;
  sqltext:='select Ad_Depreciation_Subject.KMCode,Gl_AccountSubject.KmName,Ad_Depreciation_Subject.KMCode+'' ''+Gl_AccountSubject.KmName KmFlag,Sum(Depreciation) SumDepreciation '+
           ' ,Sum(Depreciation)/(Select Sum(Depreciation) from Ad_Depreciation_Subject Where DepreciationMonth Between '''+Medt_Month_Fm.Text+''' And '''+Medt_Month_To.Text+''' And KmCode Between '''+ExtEdt_DeptCode_Fm.Text+''' And '''+ExtEdt_DeptCode_To.Text+''' )*100 SDepreciation '+
           ' from Ad_Depreciation_Subject,Gl_AccountSubject '+
           ' Where Ad_Depreciation_Subject.KmCode Between '''+ExtEdt_DeptCode_Fm.Text+''' And '''+ExtEdt_DeptCode_To.Text+''' '+
           ' And DepreciationMonth Between '''+Medt_Month_Fm.Text+''' And '''+Medt_Month_To.Text+''' '+
           ' And Ad_Depreciation_Subject.KmCode=Gl_AccountSubject.KmCode '+
           ' Group By Ad_Depreciation_Subject.KmCode,Gl_AccountSubject.KmName ';
  with  Frm_Ad_Qry_TotalDepreciationSubject.AdoQry_Main do
  begin
    Close;
    sql.clear;
    sql.Add(sqltext);
    open;
  end;
  ConditionHint:='计旧月份从'+Medt_Month_Fm.Text+' 到'+Medt_Month_To.Text+' 费用科目代码从 '+ExtEdt_DeptCode_Fm.Text+'到'+ExtEdt_DeptCode_To.Text;
  self.ModalResult:=mrOk;
  ModalResult:=mrOk;
end;

procedure TFrm_Ad_Qry_TotalDepreciationSubject_C.FormCreate(Sender: TObject);
begin
  inherited;
  ExtEdt_DeptCode_Fm.Text:='';
  ExtEdt_DeptCode_To.Text:='ZZZZZ';
  Medt_Month_Fm.Text:=formatdatetime('yyyy.mm',now);
  Medt_Month_To.Text:=formatdatetime('yyyy.mm',now);
end;

procedure TFrm_Ad_Qry_TotalDepreciationSubject_C.ExtEdt_DeptCode_ToExit(Sender: TObject);
begin
  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.clear;
  AdoQry_Tmp.SQL.Text := ' Select KmCode,KmName from Gl_AccountSubject '
                        +'   Where  KmCode = '''+ExtEdt_DeptCode_To.Text +''' ';
  AdoQry_Tmp.Open;
  if AdoQry_Tmp.Eof Then
  begin
    Edt_DeptName_to.Text :='';
  end Else
     Edt_DeptName_to.Text := AdoQry_Tmp.fieldbyname('KmName').AsString;
end;

procedure TFrm_Ad_Qry_TotalDepreciationSubject_C.ExtEdt_DeptCode_FmExit(Sender: TObject);
begin
  inherited;
  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.clear;
  AdoQry_Tmp.SQL.Text := ' Select KmCode,KmName from Gl_AccountSubject '
                        +'   Where  KmCode = '''+ExtEdt_DeptCode_Fm.Text +''' ';
  AdoQry_Tmp.Open;
  if AdoQry_Tmp.Eof Then
  begin
    Edt_DeptName_Fm.Text :='';
  end Else
     Edt_DeptName_Fm.Text := AdoQry_Tmp.fieldbyname('KmName').AsString;
end;

procedure TFrm_Ad_Qry_TotalDepreciationSubject_C.ExtEdt_DeptCode_FmKeyDown(
  Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  inherited;
  If key=120 Then
  CommOnHint(Sender,AdoQry_Tmp,'KmName','费用科目名称','KmCode',
             '费用科目代码',' Gl_AccountSubject ');

end;

procedure TFrm_Ad_Qry_TotalDepreciationSubject_C.ExtEdt_DeptCode_FmButtonClick(
  Sender: TObject);
begin
  inherited;
  CommOnHint(Sender,AdoQry_Tmp,'KmName','费用科目名称','KmCode',
             '费用科目代码',' Gl_AccountSubject ');

end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?