📄 frmmoneyu.pas
字号:
unit frmMoneyU;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, Buttons, cxStyles, cxCustomData, cxGraphics,
cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel,
cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, cxGrid;
type
TfrmMoney = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
dtDate1: TDateTimePicker;
dtDate2: TDateTimePicker;
Label2: TLabel;
btnMoney: TBitBtn;
btnClose: TBitBtn;
cxGridName: TcxGrid;
cxGridDBTableView2: TcxGridDBTableView;
cxGridNameLevel1: TcxGridLevel;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
cxStyle2: TcxStyle;
cxStyle3: TcxStyle;
dsMoney: TDataSource;
Label3: TLabel;
edMoney: TEdit;
cxGridDBTableView2DBColumn1: TcxGridDBColumn;
cxGridDBTableView2DBColumn2: TcxGridDBColumn;
cxGridDBTableView2DBColumn3: TcxGridDBColumn;
cxGridDBTableView2DBColumn4: TcxGridDBColumn;
cxGridDBTableView2DBColumn5: TcxGridDBColumn;
cxGridDBTableView2DBColumn6: TcxGridDBColumn;
procedure edMoneyKeyPress(Sender: TObject; var Key: Char);
procedure btnCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btnMoneyClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmMoney: TfrmMoney;
implementation
uses DMU;
{$R *.dfm}
procedure TfrmMoney.edMoneyKeyPress(Sender: TObject; var Key: Char);
begin
if not (((key>='0')and(key<='9'))or(key=chr(8)))then
begin
key:=char(0);
end;
end;
procedure TfrmMoney.btnCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmMoney.FormShow(Sender: TObject);
var
Year,Month,Day:Word;
begin
edMoney.Clear;
DecodeDate(Date,Year,Month,Day);
dtDate1.Date:=StrToDate(IntToStr(Year)+'-'+IntToStr(Month)+'-'+'01');
dtDate2.Date:=Date;
btnMoney.Click;
end;
procedure TfrmMoney.btnMoneyClick(Sender: TObject);
var
Money:Single;
begin
Dm.adoMoney.Close;
Dm.adoMoney.SQL.Clear;
Dm.adoMoney.SQL.Text:='Select * from Rechargeable where Date>= #'+DateToStr(dtDate1.Date)+'# and Date<= #'+DateToStr(dtDate2.Date)+'#';
Dm.adoMoney.Open;
Dm.adoMoney.First;
Money:=0;
while not Dm.adoMoney.Eof do
begin
if Dm.adoMoney.FieldByName('PressGold').AsString<>''then
Money:=Money+StrToFloat(Dm.adoMoney.FieldByName('PressGold').AsString);
if Dm.adoMoney.FieldByName('Balance').AsString<>''then
Money:=Money+StrToFloat(Dm.adoMoney.FieldByName('Balance').AsString);
if Dm.adoMoney.FieldByName('BagMonthMoney').AsString<>''then
Money:=Money+StrToFloat(Dm.adoMoney.FieldByName('BagMonthMoney').AsString);
Dm.adoMoney.Next;
end;
edMoney.Text:=FloatToStr(Money);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -