📄 main_query_ywyxsmx.pas
字号:
unit MAIN_QUERY_YWYXSMX;
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_ywyxsmx = 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_ywyxsmx: TFrm_main_query_ywyxsmx;
implementation
uses PRINT_TEMP, PRINT_YWYXSMX, CHART_YWYXS;
{$R *.dfm}
procedure TFrm_main_query_ywyxsmx.FormCreate(Sender: TObject);
begin
inherited;
self.Caption :='业务员销售明细';
with query_temp do
begin
close;
sql.Clear ;
sql.Text :='select name from people where usertype="在职"';
open;
cb_ywy.Items.Clear ;
cb_ywy.Style :=csDropDownList;
CB_ywy.Items.Add('所有');
while not eof do
begin
CB_ywy.Items.add(fieldbyname('name').asstring);
next;
end;
close;
end;
end;
procedure TFrm_main_query_ywyxsmx.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_ywy.Text ='') or (CB_ywy.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 PEOPLE.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 (People.name="'+cb_ywy.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 (People.name="'+cb_ywy.Text +'") '
+' ORDER BY PEOPLE.NAME, MYDATE';
try
open;
except
messagedlg(Errormsg0001+'0008+0018+0023',mtError,[mbok],0);
close;
end;
end;
end;
procedure TFrm_main_query_ywyxsmx.FormShow(Sender: TObject);
begin
inherited;
SB_query.Click ;
end;
procedure TFrm_main_query_ywyxsmx.SB_printClick(Sender: TObject);
begin
inherited;
try
Application.CreateForm(TFrm_print_ywyxsmx, Frm_print_ywyxsmx);
Application.CreateForm(TFrm_print_temp, Frm_print_temp);
except
messagedlg(Errormsg0011,mtError,[mbok],0);
exit;
end;
Frm_print_ywyxsmx.QuickRep_ywyxsmx.preview;
Frm_print_ywyxsmx.Free ;
Frm_print_temp.Free ;
end;
procedure TFrm_main_query_ywyxsmx.SB_chartClick(Sender: TObject);
begin
inherited;
Application.CreateForm(TFrm_chart_ywyxs,frm_chart_ywyxs);
frm_chart_ywyxs.DTP_begin.Date :=self.DTP_begin.Date ;
frm_chart_ywyxs.DTP_end.Date :=self.DTP_end.Date ;
frm_chart_ywyxs.showmodal;
frm_chart_ywyxs.free;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -