📄 main_query_scxsmx.pas
字号:
unit MAIN_QUERY_SCXSMX;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, MAIN_QUERY, DB, DBTables, ComCtrls, StdCtrls, TFlatComboBoxUnit,
TFlatSpeedButtonUnit, Grids, DBGrids, DsFancyButton, ExtCtrls,myself,frmmain;
type
TFrm_main_query_scxsmx = class(TFrm_main_query)
procedure FormCreate(Sender: TObject);
procedure SB_queryClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure SB_printClick(Sender: TObject);
procedure SB_chartClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frm_main_query_scxsmx: TFrm_main_query_scxsmx;
implementation
uses PRINT_SCXSMX, PRINT_TEMP, CHART_SCXS;
{$R *.dfm}
procedure TFrm_main_query_scxsmx.FormCreate(Sender: TObject);
begin
inherited;
self.Caption :='商场销售明细';
with query_temp do
begin
close;
sql.Clear ;
sql.Text :='select name from depot where setid=999 and type="外部"';
open;
CB_depot.Items.Clear ;
CB_depot.Style :=csDropDownList;
CB_depot.Items.Add('所有');
while not eof do
begin
CB_depot.Items.add(fieldbyname('name').asstring);
next;
end;
close;
end;
end;
procedure TFrm_main_query_scxsmx.SB_queryClick(Sender: TObject);
begin
inherited;
if not Checkrights(USERRIGHTS,'查看') then
begin
messagedlg(Errormsg0006+'0007',mterror,[mbok],0);
exit;
end;
with query_data do
begin
close;
sql.Clear ;
if (cb_depot.Text ='') or (CB_depot.Text ='所有') then
sql.Text :=' SELECT People.Name, (Depot.NAME) Depotname, (Goodsmessage.NAME) goodsname,'
+' Goodsmessage.TYPE,Goodsmessage.UNIT, Sellrecord.NUMBER,(Sellrecord.price) selldj,'
+' (Sellrecord.NUMBER*Sellrecord.PRICE) PRICE,Sellrecord.MYDATE, Sellrecord.MEMO'
+' FROM Sellrecord INNER JOIN People'
+' ON (Sellrecord.PEOPLEID = People.Id) INNER JOIN Depot'
+' ON (Sellrecord.DEPOTID = Depot.ID) INNER JOIN Goodsmessage'
+' ON (Sellrecord.GOODSID = Goodsmessage.ID)'
+' WHERE (Sellrecord.mydate>="'+formatdatetime('yyyy-mm-dd',DTP_begin.DateTime)+'")'
+' AND (Sellrecord.mydate<="'+formatdatetime('yyyy-mm-dd',dtp_end.DateTime)+'")'
+' UNION ALL'
+' SELECT People.Name, (Depot.NAME) Depotname, (Goodsmessage.NAME) goodsname,'
+' Goodsmessage.TYPE,Goodsmessage.UNIT,(0- XSTHrecord.NUMBER) NUMBER,(XSTHrecord.price) selldj,'
+' ((0-XSTHrecord.NUMBER)*XSTHrecord.PRICE) PRICE,XSTHrecord.MYDATE, XSTHrecord.MEMO'
+' FROM XSTHrecord INNER JOIN People'
+' ON (XSTHrecord.PEOPLEID = People.Id) INNER JOIN Depot'
+' ON (XSTHrecord.DEPOTID = Depot.ID) INNER JOIN Goodsmessage'
+' ON (XSTHrecord.GOODSID = Goodsmessage.ID)'
+' WHERE (XSTHrecord.mydate>="'+formatdatetime('yyyy-mm-dd',DTP_begin.DateTime)+'")'
+' AND (XSTHrecord.mydate<="'+formatdatetime('yyyy-mm-dd',dtp_end.DateTime)+'")'
+' ORDER BY DEPOT.NAME,MYDATE'
else
sql.Text :=' SELECT People.Name, (Depot.NAME) Depotname, (Goodsmessage.NAME) goodsname,'
+' Goodsmessage.TYPE,Goodsmessage.UNIT, Sellrecord.NUMBER,(Sellrecord.price) selldj,'
+' (Sellrecord.NUMBER*Sellrecord.PRICE) PRICE,Sellrecord.MYDATE, Sellrecord.MEMO'
+' FROM Sellrecord INNER JOIN People'
+' ON (Sellrecord.PEOPLEID = People.Id) INNER JOIN Depot'
+' ON (Sellrecord.DEPOTID = Depot.ID) INNER JOIN Goodsmessage'
+' ON (Sellrecord.GOODSID = Goodsmessage.ID)'
+' WHERE (Sellrecord.mydate>="'+formatdatetime('yyyy-mm-dd',DTP_begin.DateTime)+'")'
+' AND (Sellrecord.mydate<="'+formatdatetime('yyyy-mm-dd',dtp_end.DateTime)+'")'
+' and (depot.name="'+cb_depot.Text +'")'
+' UNION ALL'
+' SELECT People.Name, (Depot.NAME) Depotname, (Goodsmessage.NAME) goodsname,'
+' Goodsmessage.TYPE,Goodsmessage.UNIT,(0- XSTHrecord.NUMBER) NUMBER,(XSTHrecord.price) selldj,'
+' ((0 - XSTHrecord.NUMBER)*XSTHrecord.PRICE) PRICE,XSTHrecord.MYDATE, XSTHrecord.MEMO'
+' FROM XSTHrecord INNER JOIN People'
+' ON (XSTHrecord.PEOPLEID = People.Id) INNER JOIN Depot'
+' ON (XSTHrecord.DEPOTID = Depot.ID) INNER JOIN Goodsmessage'
+' ON (XSTHrecord.GOODSID = Goodsmessage.ID)'
+' WHERE (XSTHrecord.mydate>="'+formatdatetime('yyyy-mm-dd',DTP_begin.DateTime)+'")'
+' AND (XSTHrecord.mydate<="'+formatdatetime('yyyy-mm-dd',dtp_end.DateTime)+'")'
+' and (depot.name="'+cb_depot.Text +'")'
+' ORDER BY DEPOT.NAME,MYDATE';
try
open;
except
messagedlg(Errormsg0001+'0008+0018+0023',mtError,[mbok],0);
close;
end;
end;
end;
procedure TFrm_main_query_scxsmx.FormShow(Sender: TObject);
begin
inherited;
SB_query.Click ;
end;
procedure TFrm_main_query_scxsmx.SB_printClick(Sender: TObject);
begin
inherited;
try
Application.CreateForm(TFrm_print_scxsmx, Frm_print_scxsmx);
Application.CreateForm(TFrm_print_temp, Frm_print_temp);
except
messagedlg(Errormsg0011,mtError,[mbok],0);
exit;
end;
Frm_print_scxsmx.QuickRep_scxsmx.preview;
Frm_print_scxsmx.Free ;
Frm_print_temp.Free ;
end;
procedure TFrm_main_query_scxsmx.SB_chartClick(Sender: TObject);
begin
inherited;
Application.CreateForm(TFrm_chart_scxs,Frm_chart_scxs);
Frm_chart_scxs.DTP_begin.Date :=self.DTP_begin.Date ;
Frm_chart_scxs.DTP_end.Date :=self.DTP_end.Date ;
Frm_chart_scxs.showmodal;
Frm_chart_scxs.free;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -