📄 fzyxx.pas
字号:
unit Fzyxx;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Fbase, StdCtrls, Buttons, ComCtrls;
type
TF_zyxx = class(TF_base)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
DateTimePicker1: TDateTimePicker;
Label3: TLabel;
Label4: TLabel;
DateTimePicker2: TDateTimePicker;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure FormShow(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
F_zyxx: TF_zyxx;
implementation
uses Fzct,Fghdw,Fjsr, Fjhtj, Fxstj, Fxsphb;
{$R *.dfm}
procedure TF_zyxx.FormShow(Sender: TObject);
begin
inherited;
F_zct.wf:=5;
if F_zct.jt=3 then
begin
label1.Visible:=False;
Label2.Visible:=False;
Edit1.Visible:=False;
Edit2.Visible:=False;
speedbutton1.Visible:=False;
Speedbutton2.Visible:=False;
datetimepicker1.Top:=50;
label3.Top:=50;
end;
datetimepicker1.Date:=now;
datetimepicker2.Date:=now;
end;
procedure TF_zyxx.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
inherited;
F_zct.wf:=0;
end;
procedure TF_zyxx.SpeedButton1Click(Sender: TObject);
begin
inherited;
Application.CreateForm(TF_ghdw, F_ghdw);
F_ghdw.ShowModal;
F_ghdw.Free;
end;
procedure TF_zyxx.SpeedButton2Click(Sender: TObject);
begin
inherited;
Application.CreateForm(TF_jsr, F_jsr);
F_jsr.ShowModal;
F_jsr.Free;
end;
procedure TF_zyxx.BitBtn1Click(Sender: TObject);
var
gcol:integer;
mone,quit:real;
begin
inherited;
mone:=0; //合计金额
quit:=0; //合计数量
if F_zct.jt=1 then //进货统计代码
begin
with F_jhtj.ADOQuery1 do
begin
close;
SQL.Clear;
SQL.Add('select b.aa,b.fname,sum(b.cc) as cc,sum(b.dd) as bb from tb_warehouse_main a ');
SQL.Add('join (select billcode, tradecode aa,fullname fname,sum(qty) cc,sum(tsum) dd from tb_warehouse_detailed group by tradecode,fullname,billcode ) b ');
SQL.Add('on a.units like '+'''%'+Trim(Edit1.Text)+'%'''+' and a.handle like '+'''%'+Trim(Edit2.Text)+'%'''+' where a.billcode=b.billcode and billdate>=:done and billdate<=:dtwo group by fname,aa ');
parameters.ParamByName('done').Value:=datetimepicker1.Date;
parameters.ParamByName('dtwo').Value:=datetimepicker2.Date;
open;
end;
if F_jhtj.ADOQuery1.RecordCount=0 then
Application.MessageBox('无记录','提示',mb_ok);
F_jhtj.Panel1.Caption:='统计日期:'+datetostr(datetimepicker1.Date)+' 至 '+datetostr(datetimepicker2.Date);
for gcol:=1 to F_jhtj.ADOQuery1.RecordCount do
begin
mone:=mone+F_jhtj.ADOQuery1.Fields[3].AsFloat;
quit:=quit+F_jhtj.ADOQuery1.Fields[2].AsFloat;
F_jhtj.ADOQuery1.Next;
end;
F_jhtj.StatusBar1.Panels[1].Text:='数量:'+floattostr(quit);
F_jhtj.StatusBar1.Panels[2].Text:='金额:'+floattostr(mone);
Close;
end;
if F_zct.jt=2 then
begin
with F_xstj.ADOQuery1 do //销售单统计代码
begin
close;
SQL.Clear;
SQL.Add('select b.aa,b.fname,sum(b.cc) as cc,sum(b.dd) as bb from tb_sell_main a ');
SQL.Add('join (select billcode,fullname fname,tradecode aa,sum(qty) cc,sum(tsum) dd from tb_sell_detailed group by tradecode,billcode,fullname)b');
SQL.Add('on a.units like '+'''%'+Trim(Edit1.Text)+'%'''+' and a.handle like '+'''%'+Trim(Edit2.Text)+'%'''+' where a.billcode=b.billcode and billdate>= '+''''+datetostr(datetimepicker1.Date)+''''+'and billdate<= '+''''+datetostr(datetimepicker2.Date)+''''+' group by fname,aa ');
open;
end;
if F_xstj.ADOQuery1.RecordCount=0 then
Application.MessageBox('无记录','提示',mb_ok);
F_xstj.Panel1.Caption:='统计日期:'+datetostr(datetimepicker1.Date)+' 至 '+datetostr(datetimepicker2.Date);
F_xstj.ADOQuery1.First;
for gcol:=1 to F_xstj.ADOQuery1.RecordCount do
begin
mone:=mone+F_xstj.ADOQuery1.Fields[3].AsFloat;
quit:=quit+F_xstj.ADOQuery1.Fields[2].AsFloat;
F_xstj.ADOQuery1.Next;
end;
F_xstj.StatusBar1.Panels[1].Text:='数量:'+floattostr(quit);
F_xstj.StatusBar1.Panels[2].Text:='金额:'+floattostr(mone);
Close;
end;
if F_zct.jt=3 then //销售排行榜代码
begin
with F_xsphb.ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('exec groupsellnum :xsdone,:xsdtwo,'''''); //调用存储过程
Parameters.ParamByName('xsdone').Value:=datetimepicker1.Date;
Parameters.ParamByName('xsdtwo').Value:=datetimepicker2.Date;
Open;
end;
if F_xsphb.ADOQuery1.RecordCount=0 then
begin
with F_xsphb.ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('select tradecode,fullname,sum(qty) as bsum,sum(tsum) asum from tb_sell_detailed where billdate between :xsdone and :xsdtwo group by tradecode,fullname order by bsum desc'); //调用存储过程以数量降序排
Parameters.ParamByName('xsdone').Value:=datetimepicker1.Date;
Parameters.ParamByName('xsdtwo').Value:=datetimepicker2.Date;
Open;
end;
end;
if F_xsphb.ADOQuery1.RecordCount=0 then
Application.MessageBox('无销售记录','提示',mb_ok);
F_xsphb.Panel1.Caption:='统计日期:'+datetostr(datetimepicker1.Date)+' 至 '+datetostr(datetimepicker2.Date);
Close;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -