📄 cw_spxfhz.~pas
字号:
unit cw_spxfhz;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, Buttons, DB, DBTables;
type
TForm39 = class(TForm)
Label1: TLabel;
SpeedButton1: TSpeedButton;
GroupBox1: TGroupBox;
Label2: TLabel;
Label3: TLabel;
Button1: TButton;
rqq: TDateTimePicker;
rqh: TDateTimePicker;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Q_lsdz: TQuery;
Q_lsin: TQuery;
procedure SpeedButton1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form39: TForm39;
implementation
uses cw_spxfhzdy, cw_main, cw_spxfsn;
{$R *.dfm}
procedure TForm39.SpeedButton1Click(Sender: TObject);
begin
close;
end;
procedure TForm39.FormShow(Sender: TObject);
begin
rqq.Date:=date-1;
rqh.Date:=date;
end;
procedure TForm39.Button1Click(Sender: TObject);
var aaa,bbb:string;
begin
aaa:=DateTimeToStr(rqq.DateTime);
bbb:=DateTimeToStr(rqh.DateTime);
form40.rq.Caption:='从'''+aaa+'''至'''+bbb+'''';
form40.Q_spxf.SQL.Clear;
form40.Q_spxf.SQL.Add('select sum(Quantity) as sl,sum(SalePrice*Quantity) as je,menutype,menuname from h_Dinlist where (endtime is not null) and cstr(EndTime) between '''+aaa+''' and '''+bbb+''' group by menutype,MenuName order by menutype');
form40.Q_spxf.Open;
form40.bbr.Caption:=form1.operator.Caption;
form40.QuickRep1.Preview;
end;
procedure TForm39.Button2Click(Sender: TObject);
var aaa,bbb:string;
begin
aaa:=DateTimeToStr(rqq.DateTime);
bbb:=DateTimeToStr(rqh.DateTime);
form41.rq.Caption:='从'''+aaa+'''至'''+bbb+'''';
form41.Q_spxf.SQL.Clear;
form41.Q_spxf.SQL.Add('select sum(Quantity) as sl,sum(SalePrice*Quantity) as je,menutype,menuname from h_sn_Dinlist where (endtime is not null) and cstr(EndTime) between '''+aaa+''' and '''+bbb+''' group by menutype,MenuName order by menutype');
form41.Q_spxf.Open;
form41.bbr.Caption:=form1.operator.Caption;
form41.QuickRep1.Preview;
end;
procedure TForm39.Button3Click(Sender: TObject);
var aaa,bbb:string;
begin
aaa:=DateTimeToStr(rqq.DateTime);
bbb:=DateTimeToStr(rqh.DateTime);
//读取H_Account表中款待金额不为零的单号,在H_dinlist表中查找相应的消费记录,转至lsdz表中;
Q_lsin.SQL.Clear;
Q_lsin.sql.Add('delete from lsdz');
Q_lsin.ExecSQL;
Q_lsdz.Close;;
Q_lsdz.SQL.Clear;
Q_lsdz.SQL.Add('select * from h_account where dzje<>0 and (endtime is not null) and cstr(EndTime) between '''+aaa+''' and '''+bbb+'''');
Q_lsdz.Open;
while not Q_lsdz.Eof do
begin
Q_lsin.SQL.Clear;
Q_lsin.SQL.Add('insert into lsdz select * from h_dinlist where cstr(accountno)='''+Q_lsdz.fieldbyname('accountno').asstring+'''');
Q_lsin.ExecSQL;
Q_lsdz.Next;
end;
form40.rq.Caption:='从'''+aaa+'''至'''+bbb+'''';
form40.Q_spxf.SQL.Clear;
form40.Q_spxf.SQL.Add('select sum(Quantity) as sl,sum(SalePrice*Quantity) as je,menutype,menuname from lsdz where (endtime is not null) and cstr(EndTime) between '''+aaa+''' and '''+bbb+''' group by menutype,MenuName order by menutype');
form40.Q_spxf.Open;
form40.bbr.Caption:=form1.operator.Caption;
form40.QuickRep1.Preview;
end;
procedure TForm39.Button4Click(Sender: TObject);
var aaa,bbb:string;
begin
aaa:=DateTimeToStr(rqq.DateTime);
bbb:=DateTimeToStr(rqh.DateTime);
//读取H_Account表中款待金额不为零的单号,在H_dinlist表中查找相应的消费记录,转至lsdz表中;
Q_lsin.SQL.Clear;
Q_lsin.sql.Add('delete from sn_lsdz');
Q_lsin.ExecSQL;
Q_lsdz.Close;;
Q_lsdz.SQL.Clear;
Q_lsdz.SQL.Add('select * from h_sn_account where dzje<>0 and (endtime is not null) and cstr(EndTime) between '''+aaa+''' and '''+bbb+'''');
Q_lsdz.Open;
while not Q_lsdz.Eof do
begin
Q_lsin.SQL.Clear;
Q_lsin.SQL.Add('insert into sn_lsdz select * from h_sn_dinlist where cstr(accountno)='''+Q_lsdz.fieldbyname('accountno').asstring+'''');
Q_lsin.ExecSQL;
Q_lsdz.Next;
end;
form41.rq.Caption:='从'''+aaa+'''至'''+bbb+'''';
form41.Q_spxf.SQL.Clear;
form41.Q_spxf.SQL.Add('select sum(Quantity) as sl,sum(SalePrice*Quantity) as je,menutype,menuname from sn_lsdz where (endtime is not null) and cstr(EndTime) between '''+aaa+''' and '''+bbb+''' group by menutype,MenuName order by menutype');
form41.Q_spxf.Open;
form41.bbr.Caption:=form1.operator.Caption;
form41.QuickRep1.Preview;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -