ad_qry_depreciationasset1_c.pas

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

PAS
134
字号
unit Ad_Qry_DepreciationAsset1_C;


Interface

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

Type
  TFrm_Ad_Qry_DepreciationAsset1_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_FmButtonClick(Sender: TObject);
    procedure ExtEdt_DeptCode_FmKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Frm_Ad_Qry_DepreciationAsset1_C: TFrm_Ad_Qry_DepreciationAsset1_C;

implementation
uses Ad_Qry_DepreciationAsset1,Sys_Global;

{$R *.DFM}

procedure TFrm_Ad_Qry_DepreciationAsset1_C.btn_okClick(Sender: TObject);
var
  sqltext:String;
begin
  inherited;
  sqltext:='select Ad_Depreciation_Dept.DeptCode,Dept.DeptName,Ad_Depreciation_Dept.DeptCode+'' ''+Dept.DeptName DeptFlag '+
        ',Ad_Depreciation_Dept.AssetCode,Ad_AssetCard.AssetName,Ad_Depreciation_Dept.AssetCode+'' ''+Ad_AssetCard.AssetName AssetFlag '+
        ',Ad_Depreciation_Dept.DepreciationMonth,Sum(Depreciation) SumDepreciation '+
        ' ,Sum(Depreciation)/ '+
        '(Select Sum(Depreciation) from Ad_Depreciation_Dept '+
        ' Where DepreciationMonth Between '''+Medt_Month_Fm.Text+''' And '''+Medt_Month_To.Text+''' '+
        ' And AssetCode Between '''+ExtEdt_DeptCode_Fm.Text+''' And '''+ExtEdt_DeptCode_To.Text+''' )*100 SDepreciation '+
        ' from Ad_Depreciation_Dept,Dept,Ad_AssetCard '+
        ' Where DepreciationMonth Between '''+Medt_Month_Fm.Text+''' And '''+Medt_Month_To.Text+''' '+
        ' And Ad_Depreciation_Dept.AssetCode Between '''+ExtEdt_DeptCode_Fm.Text+''' And '''+ExtEdt_DeptCode_To.Text+''' '+
        ' And Ad_Depreciation_Dept.DeptCode=Dept.DeptCode '+
        ' And Ad_Depreciation_Dept.AssetCode=Ad_AssetCard.AssetCode '+
        ' Group By Ad_Depreciation_Dept.AssetCode,Ad_AssetCard.AssetName,Ad_Depreciation_Dept.DeptCode,Dept.DeptName,Ad_Depreciation_Dept.DepreciationMonth ';
  with  Frm_Ad_Qry_DepreciationAsset1.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_DepreciationAsset1_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_DepreciationAsset1_C.ExtEdt_DeptCode_ToExit(Sender: TObject);
begin
  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.clear;
  AdoQry_Tmp.SQL.Text := ' select AssetCode,AssetName from Ad_AssetCard '
                        +'   Where  AssetCode = '''+ExtEdt_DeptCode_Fm.Text +''' ';
  AdoQry_Tmp.Open;
  if AdoQry_Tmp.Eof Then
  begin
    Edt_DeptName_to.Text :='';
  end Else
     Edt_DeptName_to.Text := AdoQry_Tmp.fieldbyname('AssetName').AsString;
end;

procedure TFrm_Ad_Qry_DepreciationAsset1_C.ExtEdt_DeptCode_FmExit(Sender: TObject);
begin
  inherited;
  AdoQry_Tmp.Close;
  AdoQry_Tmp.SQL.clear;
  AdoQry_Tmp.SQL.Text := ' select AssetCode,AssetName from Ad_AssetCard '
                        +'   Where  AssetCode = '''+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('AssetName').AsString;
end;

procedure TFrm_Ad_Qry_DepreciationAsset1_C.ExtEdt_DeptCode_FmButtonClick(
  Sender: TObject);
begin
  inherited;
  CommOnHint(Sender,AdoQry_Tmp,'AssetName','固定资产名称','AssetCode',
             '固定资产编号',' Ad_AssetCard ');

end;

procedure TFrm_Ad_Qry_DepreciationAsset1_C.ExtEdt_DeptCode_FmKeyDown(
  Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  inherited;
   If key=120 Then
  CommOnHint(Sender,AdoQry_Tmp,'AssetName','固定资产名称','AssetCode',
             '固定资产编号',' Ad_AssetCard ');

end;

end.

⌨️ 快捷键说明

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