ad_qry_totaldepreciationdept_c.pas
来自「一个MRPII系统源代码版本」· PAS 代码 · 共 103 行
PAS
103 行
unit Ad_Qry_TotalDepreciationDept_C;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Condition, Db, AdODB, StdCtrls, ExtEdit, Mask, linkedit;
Type
TFrm_Ad_Qry_TotalDepreciationDept_C = Class(TFrm_Base_Condition)
Lbl_VendorName: TLabel;
Label2: TLabel;
Label4: TLabel;
Label5: TLabel;
Medt_Month: 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;
procedure btn_okClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ExtEdt_DeptCode_ToExit(Sender: TObject);
procedure ExtEdt_DeptCode_FmExit(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frm_Ad_Qry_TotalDepreciationDept_C: TFrm_Ad_Qry_TotalDepreciationDept_C;
implementation
uses Ad_Qry_TotalDepreciationDept,Sys_Global;
{$R *.DFM}
procedure TFrm_Ad_Qry_TotalDepreciationDept_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,Sum(Depreciation) SumDepreciation '+
' ,Sum(Depreciation)/(Select Sum(Depreciation) from Ad_Depreciation_Dept Where DepreciationMonth='''+Medt_Month.Text+''' And DeptCode Between '''+ExtEdt_DeptCode_Fm.Text+''' And '''+ExtEdt_DeptCode_To.Text+''' )*100 SDepreciation '+
' from Ad_Depreciation_Dept,Dept '+
' Where Ad_Depreciation_Dept.DeptCode Between '''+ExtEdt_DeptCode_Fm.Text+''' And '''+ExtEdt_DeptCode_To.Text+''' '+
' And DepreciationMonth='''+Medt_Month.Text+''' '+
' And Ad_Depreciation_Dept.DeptCode=Dept.DeptCode '+
' Group By Ad_Depreciation_Dept.DeptCode,Dept.DeptName ';
with Frm_Ad_Qry_TotalDepreciationDept.AdoQry_Main do
begin
Close;
sql.clear;
sql.Add(sqltext);
open;
end;
ConditionHint:='计旧月份等于'+Medt_Month.Text+' 部门代码从 '+ExtEdt_DeptCode_Fm.Text+'到'+ExtEdt_DeptCode_To.Text;
self.ModalResult:=mrOk;
ModalResult:=mrOk;
end;
procedure TFrm_Ad_Qry_TotalDepreciationDept_C.FormCreate(Sender: TObject);
begin
inherited;
ExtEdt_DeptCode_Fm.Text:='';
ExtEdt_DeptCode_To.Text:='ZZZZZ';
Medt_Month.Text:=formatdatetime('yyyy.mm',now);
end;
procedure TFrm_Ad_Qry_TotalDepreciationDept_C.ExtEdt_DeptCode_ToExit(Sender: TObject);
begin
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := ' Select DeptName,DeptCode From Dept '
+' Where DeptCode = '''+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('DeptName').AsString;
end;
procedure TFrm_Ad_Qry_TotalDepreciationDept_C.ExtEdt_DeptCode_FmExit(Sender: TObject);
begin
inherited;
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := ' Select DeptName,DeptCode From Dept '
+' Where DeptCode = '''+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('DeptName').AsString;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?