dfm_xsgyhand.pas

来自「仓库管理系统 仓库管理系统」· PAS 代码 · 共 215 行

PAS
215
字号
unit dfm_xsgyhand;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Db, DBTables, Grids, DBGrids, ExtCtrls, DBCtrls, ppCtrls, ppDB, ppModule,
  daDatMod, ppBands, ppPrnabl, ppClass, ppProd, ppReport, ppComm, ppRelatv,
  ppCache, ppDBPipe, ppDBBDE, StdCtrls, Buttons, ComCtrls, ppVar;

type
  Tdfmxhgyhand = class(TForm)
    Panel1: TPanel;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    Table1: TTable;
    DBNavigator1: TDBNavigator;
    BitBtn2: TBitBtn;
    ppBDEPipeline1: TppBDEPipeline;
    ppReport1: TppReport;
    ppHeaderBand1: TppHeaderBand;
    ppDetailBand1: TppDetailBand;
    ppFooterBand1: TppFooterBand;
    ppLabel1: TppLabel;
    ppLabel2: TppLabel;
    ppLabel3: TppLabel;
    ppLabel4: TppLabel;
    ppLabel5: TppLabel;
    ppLabel6: TppLabel;
    ppLabel7: TppLabel;
    ppLabel8: TppLabel;
    ppLine1: TppLine;
    ppLine2: TppLine;
    ppLine3: TppLine;
    ppDBText1: TppDBText;
    ppDBText2: TppDBText;
    ppDBText3: TppDBText;
    ppSummaryBand1: TppSummaryBand;
    ppDBText5: TppDBText;
    ppDBText6: TppDBText;
    ppDBText7: TppDBText;
    ppLabel9: TppLabel;
    ppDBCalc1: TppDBCalc;
    ppDBCalc2: TppDBCalc;
    ppDBCalc4: TppDBCalc;
    ppDBCalc5: TppDBCalc;
    ppDBCalc6: TppDBCalc;
    ppLabel10: TppLabel;
    Panel2: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    DateTimePicker1: TDateTimePicker;
    DateTimePicker2: TDateTimePicker;
    BitBtn1: TBitBtn;
    qrystyle: TQuery;
    dsqrystyle: TDataSource;
    dssumstyle: TDataSource;
    sumstyle: TQuery;
    dstgybb: TDataSource;
    tbltgybb: TTable;
    dsvshopgy: TDataSource;
    tblvshopgy: TTable;
    ppDBText8: TppDBText;
    ppDBText9: TppDBText;
    ppDBText11: TppDBText;
    ppDBCalc7: TppDBCalc;
    ppDBCalc8: TppDBCalc;
    ppDBCalc3: TppDBCalc;
    ppLine5: TppLine;
    ppLine6: TppLine;
    ppLine4: TppLine;
    ppLine7: TppLine;
    ppLine8: TppLine;
    ppLine9: TppLine;
    ppLine10: TppLine;
    ppLine11: TppLine;
    ppLine12: TppLine;
    ppLine13: TppLine;
    ppLine14: TppLine;
    ppLine15: TppLine;
    ppLine16: TppLine;
    ppLine17: TppLine;
    ppLine18: TppLine;
    ppLine19: TppLine;
    ppLine20: TppLine;
    ppLine21: TppLine;
    ppLine22: TppLine;
    ppLine23: TppLine;
    ppLine24: TppLine;
    ppLine25: TppLine;
    ppLine26: TppLine;
    ppLine27: TppLine;
    ppLine28: TppLine;
    ppDBText4: TppDBText;
    ppLine29: TppLine;
    ppDBText10: TppDBText;
    ppDBCalc9: TppDBCalc;
    ppLine30: TppLine;
    ppDBCalc10: TppDBCalc;
    ppVariable1: TppVariable;
    ppLabel11: TppLabel;
    ppVariable2: TppVariable;
    ppLabel12: TppLabel;
    ppVariable3: TppVariable;
    procedure DBGrid1ColExit(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure ppVariable1Calc(Sender: TObject; var Value: Variant);
    procedure ppVariable2Calc(Sender: TObject; var Value: Variant);
    procedure FormCreate(Sender: TObject);
    procedure ppVariable3Calc(Sender: TObject; var Value: Variant);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  dfmxhgyhand: Tdfmxhgyhand;

implementation

uses chHeadUnit;

{$R *.DFM}

procedure Tdfmxhgyhand.DBGrid1ColExit(Sender: TObject);
begin
{  with table1 do
  begin
    FieldByName ('hjqty').asinteger:=FieldByName ('xaqty').asinteger+FieldByName ('cdqty').asinteger+FieldByName ('bjqty').asinteger+FieldByName ('kfqty').asinteger;
    FieldByName ('sasal').asfloat:= FieldByName ('hjqty').asinteger*FieldByName ('uprice').asinteger;
  end;}
end;

procedure Tdfmxhgyhand.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  action:=cafree;
end;

procedure Tdfmxhgyhand.BitBtn2Click(Sender: TObject);
begin
  ppReport1.print;
end;

procedure Tdfmxhgyhand.BitBtn1Click(Sender: TObject);
begin
  tblvshopgy.Active :=false;
  tbltgybb.EmptyTable;
    with qrystyle do
    begin
      close;
      SQL.clear;
      sql.Add('insert t_gybb(SASTOR, SASTYL, SAQTY, sasal )');
      SQL.add('SELECT SASTOR, SASTYL, SAQTY=sum(tsaqty), sasal=sum(tsasal) FROM dbo.V_STYLE Dbo_v_style');
      SQL.Add('where sadate>=:vsdate and sadate<=:vedate');
      SQL.Add('group by SASTOR,SASTYL');
      SQL.Add('order by SASTOR,SASTYL');
//    ParamByName ('viasku').asstring:=trim(combobox2.text)+'%';
      ParamByName ('vsdate').asdate :=DateTimePicker1.date;
      ParamByName ('vedate').asdate :=DateTimePicker2.date;
      ExecSQL;
    end;
    with sumstyle do
    begin
      close;
      SQL.clear;
      SQL.add('SELECT ttsaqty=sum(tsaqty), ttsasal=sum(tsasal) FROM dbo.V_STYLE Dbo_v_style');
      SQL.Add('where sadate>=:vsdate and sadate<=:vedate');
      ParamByName ('vsdate').asdate :=DateTimePicker1.date;
      ParamByName ('vedate').asdate :=DateTimePicker2.date;
      open;
    end;
    tblvshopgy.Active :=true;
end;

{procedure Tdfmxhgyhand.ppDBCalc9Calc(Sender: TObject);
begin
  ppDBCalc9:=ppDBText8.text+ppDBText9.text+ppDBText11.Text;
end;}

procedure Tdfmxhgyhand.FormShow(Sender: TObject);
begin
  DateTimePicker1.DateTime:=date();
  DateTimePicker2.DateTime:=date();
end;

procedure Tdfmxhgyhand.ppVariable1Calc(Sender: TObject;
  var Value: Variant);
begin
  value:=datetostr(DateTimePicker1.date);
end;

procedure Tdfmxhgyhand.ppVariable2Calc(Sender: TObject;
  var Value: Variant);
begin
  value:=datetostr(DateTimePicker2.date);
end;

procedure Tdfmxhgyhand.FormCreate(Sender: TObject);
begin
//  tblvshopgy.Active :=false;
end;

procedure Tdfmxhgyhand.ppVariable3Calc(Sender: TObject;
  var Value: Variant);
begin
  value:=g_uInfo.fuserName
end;

end.

⌨️ 快捷键说明

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