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

📄 usc.pas

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

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
  Tfrmscrep = class(Tfrmbasereport)
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    Label17: TLabel;
    wwDBDateTimePicker3: TwwDBDateTimePicker;
    CheckBox1: TCheckBox;
    procedure spbtnprintClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure search;
    procedure RadioButton2Click(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmscrep: Tfrmscrep;

implementation
 uses global;
{$R *.dfm}

procedure  Tfrmscrep.search;
begin
    if billno.text<>'' then
    begin
    adoquery1.SQL.add(' and b.fsaleno =:fsaleno');
    adoquery1.Parameters.ParamByName('fsaleno').Value:=billno.Text;   //订单号
    end;
    if wwdbedit3.text<>'' then
    begin
    adoquery1.SQL.add(' and b.frefno =:frefno');
    adoquery1.Parameters.ParamByName('frefno').Value:=wwdbedit3.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.fcode 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 wwdbedit4.text<>'' then
    begin
    adoquery1.SQL.add(' and b.fsaleer=:fsaleer');
    adoquery1.Parameters.ParamByName('fsaleer').Value:=wwdbedit4.text;//负责人
    end;
    if wwdbedit5.text<>'' then
    begin
    adoquery1.SQL.add(' and b.fprovider =:fprovider');
    adoquery1.Parameters.ParamByName('fprovider').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 wwDBLookupCombo1.Text<>'' then
    begin
    adoquery1.SQL.add(' and b.fsalestore =:fsalestore');
    adoquery1.Parameters.ParamByName('fsalestore').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 checkbox1.Checked then 
    adoquery1.SQL.Add(' and a.fqty<0')
end;
procedure Tfrmscrep.spbtnprintClick(Sender: TObject);
begin
  inherited;
    adoquery1.SQL.Clear;
    adoquery1.SQL.Add('select b.fsaleno,b.fprovider,b.fdelivdate,b.fnote as note2,b.fcreauser,c.fcode,c.fname,c.funit,c.ftype,a.fqty,');
//    adoquery1.sql.add('b.fsaleno,b.fsalestore,b.fsaleer,');
    adoquery1.sql.add('a.fprice,a.total,a.fnote');
    adoquery1.SQL.add('   from Tscsub a,Tsc  b ,titem c');
    adoquery1.SQL.add('  where a.fresid=b.fresid  and c.fid=a.fitemid');
    search;         ///调用过程

    adoquery1.Open;


end;

procedure Tfrmscrep.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:=80;          
end;

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

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

end.

⌨️ 快捷键说明

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