📄 xffltj.pas
字号:
unit xffltj;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, Grids, DBGrids, Mask, Db, DBTables, ExtCtrls, ComCtrls;
type
Txffltjform = class(TForm)
q1: TQuery;
DataSource1: TDataSource;
mxname: TTabControl;
DBGrid1: TDBGrid;
mxlb: TComboBox;
Panel2: TPanel;
begdate: TDateTimePicker;
begtime: TDateTimePicker;
Label7: TLabel;
enddate: TDateTimePicker;
endtime: TDateTimePicker;
xfname: TComboBox;
xflb: TComboBox;
Panel3: TPanel;
Label1: TLabel;
yjzhj: TLabel;
Label2: TLabel;
wjzhj: TLabel;
Label3: TLabel;
hj: TLabel;
SpeedButton1: TSpeedButton;
Panel4: TPanel;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
cwsys: TComboBox;
Label4: TLabel;
SpeedButton4: TSpeedButton;
Label5: TLabel;
Label6: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
wxj: TEdit;
wmd: TEdit;
yxj: TEdit;
ymd: TEdit;
wj: TEdit;
procedure FormCreate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure begdateChange(Sender: TObject);
procedure xfnameChange(Sender: TObject);
procedure mxnameChange(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
xffltjform: Txffltjform;
implementation
uses dataproc, xftjprin;
{$R *.DFM}
procedure formini;
begin
with xffltjform do
begin
DataSource1.DataSet:=nil;
q1.Active :=false;
q1.sql.clear;
q1.SQL.Add('delete from customls');
q1.Prepare;
q1.ExecSQL;
if xfname.ItemIndex=0 then
begin
q1.sql.add('select sum(Money) from custom where (Regtime>=:pbgtm1) and (Regtime<=:pedtm1) ');
q1.ParamByName ('pbgtm1').asstring:=datetostr(begdate.Date)+' '+timetostr(begtime.time);
q1.ParamByName ('pedtm1').asstring:=datetostr(enddate.Date)+' '+timetostr(endtime.time);
q1.Prepare;
q1.open;
if (q1.Fields[0].isnull) or (trim(q1.Fields[0].asstring)='') then
wjzhj.Caption:='0'
else
wjzhj.Caption:=q1.Fields[0].asstring;
q1.Active :=false;
q1.sql.clear;
q1.sql.add('select sum(Money) from custom where isxj=1 and (Regtime>=:pbgtm1) and (Regtime<=:pedtm1) ');
q1.ParamByName ('pbgtm1').asstring:=datetostr(begdate.Date)+' '+timetostr(begtime.time);
q1.ParamByName ('pedtm1').asstring:=datetostr(enddate.Date)+' '+timetostr(endtime.time);
q1.Prepare;
q1.open;
if (q1.Fields[0].isnull) or (trim(q1.Fields[0].asstring)='') then
wxj.text:='0'
else
wxj.text:=q1.Fields[0].asstring;
q1.Active :=false;
q1.sql.clear;
q1.sql.add('select sum(Money) from custom where ismd=1 and (Regtime>=:pbgtm1) and (Regtime<=:pedtm1) ');
q1.ParamByName ('pbgtm1').asstring:=datetostr(begdate.Date)+' '+timetostr(begtime.time);
q1.ParamByName ('pedtm1').asstring:=datetostr(enddate.Date)+' '+timetostr(endtime.time);
q1.Prepare;
q1.open;
if (q1.Fields[0].isnull) or (trim(q1.Fields[0].asstring)='') then
wmd.text:='0'
else
wmd.text:=q1.Fields[0].asstring;
q1.Active :=false;
q1.sql.clear;
q1.sql.add('select sum(Money) from custom where ismd<>1 and isxj<>1 and (Regtime>=:pbgtm1) and (Regtime<=:pedtm1) ');
q1.ParamByName ('pbgtm1').asstring:=datetostr(begdate.Date)+' '+timetostr(begtime.time);
q1.ParamByName ('pedtm1').asstring:=datetostr(enddate.Date)+' '+timetostr(endtime.time);
q1.Prepare;
q1.open;
if (q1.Fields[0].isnull) or (trim(q1.Fields[0].asstring)='') then
wj.text:='0'
else
wj.text:=q1.Fields[0].asstring;
q1.Active :=false;
q1.sql.clear;
q1.sql.add('select sum(Money) from lscustom where (Regtime>=:pbgtm1) and (Regtime<=:pedtm1) ');
q1.ParamByName ('pbgtm1').asstring:=datetostr(begdate.Date)+' '+timetostr(begtime.time);
q1.ParamByName ('pedtm1').asstring:=datetostr(enddate.Date)+' '+timetostr(endtime.time);
q1.Prepare;
q1.open;
if (q1.Fields[0].isnull) or (trim(q1.Fields[0].asstring)='') then
yjzhj.Caption:='0'
else
yjzhj.Caption:=q1.Fields[0].asstring;
q1.Active :=false;
q1.sql.clear;
q1.sql.add('select sum(Money) from lscustom where isxj=1 and (Regtime>=:pbgtm1) and (Regtime<=:pedtm1) ');
q1.ParamByName ('pbgtm1').asstring:=datetostr(begdate.Date)+' '+timetostr(begtime.time);
q1.ParamByName ('pedtm1').asstring:=datetostr(enddate.Date)+' '+timetostr(endtime.time);
q1.Prepare;
q1.open;
if (q1.Fields[0].isnull) or (trim(q1.Fields[0].asstring)='') then
yxj.text:='0'
else
yxj.text:=q1.Fields[0].asstring;
q1.Active :=false;
q1.sql.clear;
q1.sql.add('select sum(Money) from lscustom where ismd=1 and (Regtime>=:pbgtm1) and (Regtime<=:pedtm1) ');
q1.ParamByName ('pbgtm1').asstring:=datetostr(begdate.Date)+' '+timetostr(begtime.time);
q1.ParamByName ('pedtm1').asstring:=datetostr(enddate.Date)+' '+timetostr(endtime.time);
q1.Prepare;
q1.open;
if (q1.Fields[0].isnull) or (trim(q1.Fields[0].asstring)='') then
ymd.text:='0'
else
ymd.text:=q1.Fields[0].asstring;
hj.Caption:=floattostr(strtofloat(wjzhj.Caption)+strtofloat(yjzhj.Caption));
q1.Active :=false;
q1.sql.clear;
q1.SQL.Add('delete from customls');
q1.sql.add('insert into customls select * from custom where (Regtime>=:pbgtm1) and (Regtime<=:pedtm1) ');
q1.sql.add('insert into customls select * from lscustom where (Regtime>=:pbgtm1) and (Regtime<=:pedtm1) ');
q1.ParamByName ('pbgtm1').asstring:=datetostr(begdate.Date)+' '+timetostr(begtime.time);
q1.ParamByName ('pedtm1').asstring:=datetostr(enddate.Date)+' '+timetostr(endtime.time);
q1.Prepare;
q1.ExecSQL;
q1.Active :=false;
q1.sql.clear;
end
else
begin
q1.Active :=false;
q1.sql.clear;
if mxname.TabIndex=0 then
q1.sql.add('select sum(Money) from custom where (regtime>=:pbgtm1) and (regtime<=:pedtm1) and substring(custype,1,2)='''+xflb.Items[xfname.itemIndex]+''' ')
else
q1.sql.add('select sum(Money) from custom where (regtime>=:pbgtm1) and (regtime<=:pedtm1) and custype='''+mxlb.Items[mxname.TabIndex]+'''');
q1.ParamByName ('pbgtm1').asstring:=datetostr(begdate.Date)+' '+timetostr(begtime.time);
q1.ParamByName ('pedtm1').asstring:=datetostr(enddate.Date)+' '+timetostr(endtime.time);
q1.Prepare;
q1.open;
if (q1.Fields[0].isnull) or (trim(q1.Fields[0].asstring)='') then
wjzhj.Caption:='0'
else
wjzhj.Caption:=q1.Fields[0].asstring;
q1.Active :=false;
q1.sql.clear;
if mxname.TabIndex=0 then
q1.sql.add('select sum(Money) from custom where ISXJ=1 and (regtime>=:pbgtm1) and (regtime<=:pedtm1) and substring(custype,1,2)='''+xflb.Items[xfname.itemIndex]+'''')
else
q1.sql.add('select sum(Money) from custom where ISXJ=1 and (regtime>=:pbgtm1) and (regtime<=:pedtm1) and custype='''+mxlb.Items[mxname.TabIndex]+'''');
q1.ParamByName ('pbgtm1').asstring:=datetostr(begdate.Date)+' '+timetostr(begtime.time);
q1.ParamByName ('pedtm1').asstring:=datetostr(enddate.Date)+' '+timetostr(endtime.time);
q1.Prepare;
q1.open;
if (q1.Fields[0].isnull) or (trim(q1.Fields[0].asstring)='') then
wxj.text:='0'
else
wxj.text:=q1.Fields[0].asstring;
q1.Active :=false;
q1.sql.clear;
if mxname.TabIndex=0 then
q1.sql.add('select sum(Money) from custom where ismd=1 and (regtime>=:pbgtm1) and (regtime<=:pedtm1) and substring(custype,1,2)='''+xflb.Items[xfname.itemIndex]+'''')
else
q1.sql.add('select sum(Money) from custom where ismd=1 and (regtime>=:pbgtm1) and (regtime<=:pedtm1) and custype='''+mxlb.Items[mxname.TabIndex]+'''');
q1.ParamByName ('pbgtm1').asstring:=datetostr(begdate.Date)+' '+timetostr(begtime.time);
q1.ParamByName ('pedtm1').asstring:=datetostr(enddate.Date)+' '+timetostr(endtime.time);
q1.Prepare;
q1.open;
if (q1.Fields[0].isnull) or (trim(q1.Fields[0].asstring)='') then
wmd.text:='0'
else
wmd.text:=q1.Fields[0].asstring;
q1.Active :=false;
q1.sql.clear;
if mxname.TabIndex=0 then
q1.sql.add('select sum(Money) from custom where ismd<>1 and isxj<>1 and (regtime>=:pbgtm1) and (regtime<=:pedtm1) and substring(custype,1,2)='''+xflb.Items[xfname.itemIndex]+'''')
else
q1.sql.add('select sum(Money) from custom where (regtime>=:pbgtm1) and (regtime<=:pedtm1) and custype='''+mxlb.Items[mxname.TabIndex]+'''');
q1.ParamByName ('pbgtm1').asstring:=datetostr(begdate.Date)+' '+timetostr(begtime.time);
q1.ParamByName ('pedtm1').asstring:=datetostr(enddate.Date)+' '+timetostr(endtime.time);
q1.Prepare;
q1.open;
if (q1.Fields[0].isnull) or (trim(q1.Fields[0].asstring)='') then
wj.Text:='0'
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -