📄 ad_qry_totaldepreciationtype_c.pas
字号:
unit Ad_Qry_TotalDepreciationType_C;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Condition, Db, AdODB, StdCtrls, ExtEdit, Mask, linkedit;
Type
TFrm_Ad_Qry_TotalDepreciationType_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_TotalDepreciationType_C: TFrm_Ad_Qry_TotalDepreciationType_C;
implementation
uses Ad_Qry_TotalDepreciationType,Sys_Global;
{$R *.DFM}
procedure TFrm_Ad_Qry_TotalDepreciationType_C.btn_okClick(Sender: TObject);
var
sqltext:String;
begin
inherited;
sqltext:='select Ad_AssetType.AssetTypeCode,Ad_AssetType.AssetTypeName '+
',Ad_AssetType.AssetTypeCode+'' ''+Ad_AssetType.AssetTypeName AssetTypeFlag '+
',Sum(Depreciation) SumDepreciation ,Sum(Depreciation)/ '+
'(Select Sum(Depreciation) from Ad_Depreciation,Ad_AssetCard,Ad_AssetType '+
' Where DepreciationMonth Between '''+Medt_Month_Fm.Text+''' And '''+Medt_Month_To.Text+''' '+
' And Ad_AssetCard.AssetTypeCode Between '''+ExtEdt_DeptCode_Fm.Text+''' And '''+ExtEdt_DeptCode_To.Text+''' '+
' And Ad_Depreciation.AssetCode=Ad_AssetCard.AssetCode '+
' And Ad_AssetCard.AssetTypeCode=Ad_AssetType.AssetTypeCode '+
' )*100 SDepreciation '+
'from Ad_Depreciation,Ad_AssetCard,Ad_AssetType '+
'Where Ad_AssetCard.AssetTypeCode 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.AssetCode=Ad_AssetCard.AssetCode '+
'And Ad_AssetCard.AssetTypeCode=Ad_AssetType.AssetTypeCode '+
'Group By Ad_AssetType.AssetTypeCode,Ad_AssetType.AssetTypeName ';
with Frm_Ad_Qry_TotalDepreciationType.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_TotalDepreciationType_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_TotalDepreciationType_C.ExtEdt_DeptCode_ToExit(Sender: TObject);
begin
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := ' Select AssetTypeCode,AssetTypeName from Ad_AssetType '
+' Where AssetTypeCode = '''+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('AssetTypeName').AsString;
end;
procedure TFrm_Ad_Qry_TotalDepreciationType_C.ExtEdt_DeptCode_FmExit(Sender: TObject);
begin
inherited;
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := ' Select AssetTypeCode,AssetTypeName from Ad_AssetType '
+' Where AssetTypeCode = '''+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('AssetTypeName').AsString;
end;
procedure TFrm_Ad_Qry_TotalDepreciationType_C.ExtEdt_DeptCode_FmKeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
If key=120 Then
CommOnHint(Sender,AdoQry_Tmp,'AssetTypeName','固定资产类别名称','AssetTypeCode',
'固定资产类别代码',' Ad_AssetType ');
end;
procedure TFrm_Ad_Qry_TotalDepreciationType_C.ExtEdt_DeptCode_FmButtonClick(
Sender: TObject);
begin
inherited;
CommOnHint(Sender,AdoQry_Tmp,'AssetTypeName','固定资产类别名称','AssetTypeCode',
'固定资产类别代码',' Ad_AssetType ');
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -