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

📄 ustorerep.~pas

📁 在打沙场用的最简单
💻 ~PAS
字号:
unit ustorerep;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ubasereport, DBClient, DB, DBTables, Grids, wwdblook,
  wwdbdatetimepicker, StdCtrls, Mask, wwdbedit, Buttons, ExtCtrls,common,MDIbaseinfo,
  ADODB, DBGridEh;

type
  Tfrmstorerep = class(Tfrmbasereport)
    Label17: TLabel;
    wwDBDateTimePicker3: TwwDBDateTimePicker;
    CheckBox1: TCheckBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    procedure spbtnprintClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure search;
    procedure RadioButton1Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmstorerep: Tfrmstorerep;

implementation
uses global;
{$R *.dfm}

procedure Tfrmstorerep.search;
begin
    if billno.text<>'' then
    begin
    adoquery1.SQL.add(' and b.pno =:pno');
    adoquery1.Parameters.ParamByName('pno').Value:=billno.Text;   //采购号
    end;
    if refno.text<>'' then
    begin
    adoquery1.SQL.add(' and b.frefno =:frefno');
    adoquery1.Parameters.ParamByName('frefno').Value:=refno.text;   //进货编号
    end;
    if edit1.text<>'' then
    begin
    adoquery1.SQL.add(' and c.fcode =:fcode');
    adoquery1.Parameters.ParamByName('fcode').Value:=edit1.text;
    end;
    if edit2.text<>'' then
    begin
    adoquery1.SQL.add(' and c.fname like :fname');
    adoquery1.Parameters.ParamByName('fname').Value:='%' + edit2.text+ '%';
    end;
    if edit3.text<>'' then
    begin
    adoquery1.SQL.add(' and c.ftype like :ftype');
    adoquery1.Parameters.ParamByName('ftype').value:='%'+edit3.text+'%';
    end;
    if wwDBLookupCombo1.Text<>'' then
    begin
    adoquery1.SQL.add(' and b.fpurstore =:fpurstore');
    adoquery1.Parameters.ParamByName('fpurstore').Value:=wwDBLookupCombo1.Text;
    end;
    adoquery1.SQL.add(' and b.fdelivdate >=:fdelivdate1 and b.fdelivdate <=:fdelivdate2');
    adoquery1.Parameters.ParamByName('fdelivdate1').Value:=wwDBDateTimePicker2.Date;
    adoquery1.Parameters.ParamByName('fdelivdate2').Value:=wwDBDateTimePicker3.Date;
    if wwdbedit4.text<>'' then
    begin
    adoquery1.SQL.add(' and b.fcreauser =:fcreauser');
    adoquery1.Parameters.ParamByName('fcreauser').Value:=wwdbedit4.text;
    end;
    if wwdbedit5.text<>'' then
    begin
    adoquery1.SQL.add(' and b.bc =:bc');
    adoquery1.Parameters.ParamByName('bc').Value:=wwdbedit5.text;
    end;

    if wwdbedit8.text<>'' then
    begin
    adoquery1.SQL.add(' and b.fnote =:fnote');
    adoquery1.Parameters.ParamByName('fnote').Value:=wwdbedit8.text;
    end;
    if checkbox1.Checked then

    adoquery1.SQL.add(' and a.fqty<0');
end;
procedure Tfrmstorerep.spbtnprintClick(Sender: TObject);
var
i:integer;
begin
  inherited;
    adoquery1.SQL.Clear;
    adoquery1.SQL.Add('select b.frefno, b.pno,b.fpurer,b.fpurstore,b.fprovider,b.fnote as note2,b.fdelivdate,b.fcreauser,b.fcreadate,');
    adoquery1.sql.add('c.fcode,c.fname,c.funit,c.ftype,a.fqty,a.fprice,total,a.fnote');
    adoquery1.SQL.add('   from Tstoresub a,Tstore  b ,titem c');
    adoquery1.SQL.add('  where a.fresid=b.fresid  and c.fid=a.fitemid');
    search;
    adoquery1.Open;
end;

procedure Tfrmstorerep.FormCreate(Sender: TObject);
var
i:integer;
begin
  inherited;
  wwdbdatetimepicker2.Date:=date;
  wwdbdatetimepicker3.Date:=date;  
  for i:=0 to  dbgrideh1.Columns.Count-1 do
  dbgrideh1.Columns[i].Width:=64;
end;

procedure Tfrmstorerep.RadioButton1Click(Sender: TObject);
begin
  inherited;
    adoquery1.SQL.Clear;
    adoquery1.SQL.Add('select  b.fprovider,c.ftype,sum(a.fqty) fqty,');
    adoquery1.sql.add('sum(a.total) total');
    adoquery1.SQL.add('   from Tstoresub a,Tstore  b ,titem c');
    adoquery1.SQL.add('  where a.fresid=b.fresid  and c.fid=a.fitemid');
    search;
    adoquery1.SQL.add(' group by     b.fprovider,c.ftype');
    adoquery1.Open;
end;

procedure Tfrmstorerep.RadioButton2Click(Sender: TObject);
begin
  inherited;
    adoquery1.SQL.Clear;
    adoquery1.SQL.Add('select  b.fprovider,c.fcode,c.funit,c.ftype,sum(a.fqty) fqty,');
    adoquery1.sql.add('sum(a.total) total');
    adoquery1.SQL.add('   from Tstoresub a,Tstore  b ,titem c');
    adoquery1.SQL.add('  where a.fresid=b.fresid  and c.fid=a.fitemid');
    search;
    adoquery1.SQL.add(' group by     b.fprovider,c.fcode,c.funit,c.ftype');
    adoquery1.Open;
end;

end.

⌨️ 快捷键说明

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