⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sfc_monthsumqrybcp_d.pas

📁 一个MRPII系统源代码版本
💻 PAS
字号:
unit Sfc_MonthSumQrybcp_D;

Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Qry, Menus, ExtPrintReport, Db, ActnList, AdODB, Grids, DBGridEh,
  StdCtrls, ExtCtrls, ComCtrls, ToolWin;

Type
  TFrm_Sfc_MonthSumQrybcp_D = Class(TFrm_Base_Qry)
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    AdoQry_MainItemCode: TStringField;
    AdoQry_MainItemName: TStringField;
    AdoQry_MainInvoutqty: TFloatField;
    AdoQry_MainInvoutAmount: TFloatField;
    procedure AdoQueryAfterOpen(DataSet: TDataSet);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure showfilter(lb:string);
  end;

var
  Frm_Sfc_MonthSumQrybcp_D: TFrm_Sfc_MonthSumQrybcp_D;

implementation

{$R *.DFM}
procedure TFrm_Sfc_MonthSumQrybcp_D.Showfilter(lb:string);
begin
  Lbl_Condition.Caption:=lb;
  AmountFields:='InvoutAmount,';
  with AdoQry_Main do
  begin
    Close;
    sql.text:='select #MonthSumQry1.ItemCode,Item.ItemName,#MonthSumQry1.Invoutqty, '+
              'round(#MonthSumQry1.InvoutAmount,2) as InvoutAmount from #MonthSumQry1 '+
              'left join Item on Item.ItemCode=#MonthSumQry1.ItemCode '+
              'where #MonthSumQry1.ItemCode not in (select ItemCode from #sonqty)';
    open;
  end;

end;


procedure TFrm_Sfc_MonthSumQrybcp_D.AdoQueryAfterOpen(DataSet: TDataSet);
var
  sql_txt:string;
  i:integer;
  sumAmounts,sumAmountr:real;
begin
  sumAmounts:=0;
  sumAmountr:=0;
  //计算汇总金额
  If Not AdoQry_Main.IsEmpty then
  begin
    AdoQry_Main.DisableControls;
    AdoQry_Main.First;
    for I:=0 to AdoQry_Main.RecordCount-1 do
    begin
      SumAmounts:=SumAmounts+AdoQry_Main.fieldbyname('Invoutqty').asFloat;
      SumAmountr:=SumAmountr+AdoQry_Main.fieldbyname('InvoutAmount').asFloat;
      AdoQry_Main.next;
    end;
    AdoQry_Main.First;
    AdoQry_Main.enableControls;
  end;
  edit1.text:=FormatFloat('#.##',SumAmounts);
  edit2.text:=FormatFloat('#.##',SumAmountr);
end;

end.

⌨️ 快捷键说明

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