📄 unit11.pas
字号:
unit Unit11;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Grids, DBGrids, ExtCtrls, ComCtrls;
type
TF_sfk_Z = class(TForm)
Panel1: TPanel;
DBGrid1: TDBGrid;
Panel2: TPanel;
Panel3: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn4: TBitBtn;
BitBtn5: TBitBtn;
ComboBox1: TComboBox;
DateTimePicker1: TDateTimePicker;
DateTimePicker2: TDateTimePicker;
Label1: TLabel;
Label2: TLabel;
BitBtn3: TBitBtn;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Panel4: TPanel;
Label6: TLabel;
Edit1: TEdit;
procedure BitBtn1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
F_sfk_Z: TF_sfk_Z;
implementation
uses unit1, Unit10;
{$R *.dfm}
procedure TF_sfk_Z.BitBtn1Click(Sender: TObject);
begin
mainform.sys.close;
mainform.sys.Open;
if copy(mainform.sys.fieldbyname('流水账号').AsString,4,8)=formatdatetime('yyyymmdd',now) then
begin
lszh_no:='MO_'+floattostr(strtofloat(copy(mainform.sys.fieldbyname('流水账号').AsString,4,12))+1);
end else lszh_no:='MO_'+formatdatetime('yyyymmdd',now)+'0001';
mainform.sys.Edit;
mainform.sys.fieldbyname('流水账号').AsString:=lszh_no;
mainform.sys.post;
mainform.A_sfk.Append;
mainform.A_sfk.FieldByName('流水账号').AsString:=lszh_no;
mainform.A_sfk.FieldByName('性质').asstring:='收款';
F_sfk.DBComboBox1.Color:=clgreen;
F_sfk.showmodal;
end;
procedure TF_sfk_Z.FormShow(Sender: TObject);
var
zrk,zck:double;
begin
F_sfk_z.DateTimePicker1.Date:=now;
F_sfk_z.DateTimePicker2.Date:=now;
with mainform.A_sfk do
begin
close;
sql.Clear;
sql.Add('select * from 收付款库');
open;
end;
with mainform.Q_temp do
begin
close;
sql.Clear;
sql.Add('select SUM(IIF(ISNULL(金额),0,金额)) as 总入账 from 收付款库 where 性质='+''''+'收款'+'''');
open;
end;
zrk:=mainform.Q_temp.fieldbyname('总入账').Asfloat;
with mainform.Q_temp do
begin
close;
sql.Clear;
sql.Add('select SUM(IIF(ISNULL(金额),0,金额)) as 总付出 from 收付款库 where 性质='+''''+'付款'+'''');
open;
end;
zck:=mainform.Q_temp.fieldbyname('总付出').Asfloat;
label3.Caption:='总入账:'+floattostr(zrk);
label4.Caption:='总付出:'+floattostr(zck);
label5.Caption:='平衡数:'+floattostr(zrk-zck);
end;
procedure TF_sfk_Z.BitBtn2Click(Sender: TObject);
begin
mainform.sys.close;
mainform.sys.Open;
if copy(mainform.sys.fieldbyname('流水账号').AsString,4,8)=formatdatetime('yyyymmdd',now) then
begin
lszh_no:='MO_'+floattostr(strtofloat(copy(mainform.sys.fieldbyname('流水账号').AsString,4,12))+1);
end else lszh_no:='MO_'+formatdatetime('yyyymmdd',now)+'0001';
mainform.sys.Edit;
mainform.sys.fieldbyname('流水账号').AsString:=lszh_no;
mainform.sys.post;
mainform.A_sfk.Append;
mainform.A_sfk.FieldByName('流水账号').AsString:=lszh_no;
mainform.A_sfk.FieldByName('性质').asstring:='付款';
F_sfk.DBComboBox1.Color:=clred;
F_sfk.showmodal;
end;
procedure TF_sfk_Z.BitBtn3Click(Sender: TObject);
var
zrk,zck:double;
Q_chr:string;
begin
Q_chr:='';
Q_chr:='日期>=#'+datetostr(F_sfk_Z.DateTimePicker1.Date)+'# and 日期<=#'+datetostr(F_sfk_Z.DateTimePicker2.Date)+'#';
if ComboBox1.text<>'全部' then Q_chr:=Q_chr+' and 性质='+''''+ComboBox1.text+'''';
with mainform.A_sfk do
begin
close;
sql.Clear;
sql.Add('select * from 收付款库');
sql.Add('where '+Q_chr);
open;
end;
with mainform.Q_temp do
begin
close;
sql.Clear;
sql.Add('select SUM(IIF(ISNULL(金额),0,金额)) as 总入账 from 收付款库 where 性质='+''''+'收款'+'''');
sql.Add(' and '+Q_chr);
open;
end;
zrk:=mainform.Q_temp.fieldbyname('总入账').Asfloat;
with mainform.Q_temp do
begin
close;
sql.Clear;
sql.Add('select SUM(IIF(ISNULL(金额),0,金额)) as 总付出 from 收付款库 where 性质='+''''+'付款'+'''');
sql.Add(' and '+Q_chr);
open;
end;
zck:=mainform.Q_temp.fieldbyname('总付出').Asfloat;
label3.Caption:='总入账:'+floattostr(zrk);
label4.Caption:='总付出:'+floattostr(zck);
label5.Caption:='平衡数:'+floattostr(zrk-zck);
end;
procedure TF_sfk_Z.BitBtn4Click(Sender: TObject);
begin
if application.MessageBox('请确认真的要删除本账务吗?','系统信息',MB_YESNO+MB_Iconquestion)=IDyes then
mainform.A_sfk.Delete;
end;
procedure TF_sfk_Z.Edit1Change(Sender: TObject);
begin
with mainform.A_sfk do
begin
close;
sql.Clear;
sql.Add('select * from 收付款库');
sql.Add('where 流水账号 like '+''''+'%'+F_sfk_Z.Edit1.text+'%'+'''');
open;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -