384 lines
10 KiB
ObjectPascal
384 lines
10 KiB
ObjectPascal
|
unit U_BankFlowList;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|||
|
cxEdit, DB, cxDBData, DBClient, ADODB, cxGridCustomPopupMenu, cxGridPopupMenu,
|
|||
|
cxPC, StdCtrls, ComCtrls, ExtCtrls, cxGridLevel, cxGridCustomTableView,
|
|||
|
cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView,
|
|||
|
cxGrid, ToolWin, cxCalendar, cxCurrencyEdit, cxTextEdit, cxLookAndFeels,
|
|||
|
cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, dxSkinsCore,
|
|||
|
dxSkinsDefaultPainters, dxDateRanges, U_BaseList, Vcl.Menus, Vcl.Clipbrd,
|
|||
|
cxContainer, dxCore, cxDateUtils, cxMaskEdit, cxDropDownEdit, dxSkinBasic,
|
|||
|
dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee,
|
|||
|
dxSkinDarkroom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
|
|||
|
dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast,
|
|||
|
dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
|
|||
|
dxSkinMcSkin, dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins,
|
|||
|
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
|
|||
|
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
|
|||
|
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
|
|||
|
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinOffice2016Colorful,
|
|||
|
dxSkinOffice2016Dark, dxSkinOffice2019Black, dxSkinOffice2019Colorful,
|
|||
|
dxSkinOffice2019DarkGray, dxSkinOffice2019White, dxSkinPumpkin, dxSkinSeven,
|
|||
|
dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
|
|||
|
dxSkinSpringtime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
|
|||
|
dxSkinTheBezier, dxSkinValentine, dxSkinVisualStudio2013Blue,
|
|||
|
dxSkinVisualStudio2013Dark, dxSkinVisualStudio2013Light, dxSkinVS2010,
|
|||
|
dxSkinWhiteprint, dxSkinWXI, dxSkinXmas2008Blue, dxScrollbarAnnotations;
|
|||
|
|
|||
|
type
|
|||
|
TfrmBankFlowList = class(TfrmBaseList)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TINIT: TToolButton;
|
|||
|
TGLV: TToolButton;
|
|||
|
TADD: TToolButton;
|
|||
|
TDEL: TToolButton;
|
|||
|
Texcel: TToolButton;
|
|||
|
TCLOSE: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
BFType: TcxTextEdit;
|
|||
|
NOTE: TcxTextEdit;
|
|||
|
DataSource1: TDataSource;
|
|||
|
AdoQueryTmp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
GPM_1: TcxGridPopupMenu;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
Label3: TLabel;
|
|||
|
OppCoName: TcxTextEdit;
|
|||
|
Label5: TLabel;
|
|||
|
Label8: TLabel;
|
|||
|
CDS_Bank: TClientDataSet;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
PM_1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
TV1: TcxGridDBTableView;
|
|||
|
V1Column1: TcxGridDBColumn;
|
|||
|
V1CRTime: TcxGridDBColumn;
|
|||
|
V1Column2: TcxGridDBColumn;
|
|||
|
V1Column3: TcxGridDBColumn;
|
|||
|
V1CRType: TcxGridDBColumn;
|
|||
|
V1InMoney: TcxGridDBColumn;
|
|||
|
V1OutMoney: TcxGridDBColumn;
|
|||
|
V1YEMoney: TcxGridDBColumn;
|
|||
|
V1NOTE: TcxGridDBColumn;
|
|||
|
V1Column4: TcxGridDBColumn;
|
|||
|
V1Column5: TcxGridDBColumn;
|
|||
|
TV1Column1: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
BFID: TcxTextEdit;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
Label6: TLabel;
|
|||
|
Edit1: TcxTextEdit;
|
|||
|
begdate: TcxDateEdit;
|
|||
|
Enddate: TcxDateEdit;
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TCLOSEClick(Sender: TObject);
|
|||
|
procedure TADDClick(Sender: TObject);
|
|||
|
procedure TINITClick(Sender: TObject);
|
|||
|
procedure TGLVClick(Sender: TObject);
|
|||
|
procedure TexcelClick(Sender: TObject);
|
|||
|
procedure TDELClick(Sender: TObject);
|
|||
|
procedure BFTypeChange(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
private
|
|||
|
FBKID, FBKName: string;
|
|||
|
procedure initGrid();
|
|||
|
procedure SetTab();
|
|||
|
procedure GetCurTab();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmBankFlowList: TfrmBankFlowList;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_BankFlowInInput, U_BankFlowOutInput, U_BankFlowIOInput;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmBankFlowList.GetCurTab();
|
|||
|
begin
|
|||
|
CDS_Bank.Locate('BankName', Trim(cxTabControl1.Tabs.Strings[cxTabControl1.TabIndex]), []);
|
|||
|
FBKID := Trim(CDS_Bank.FieldByName('BKID').AsString);
|
|||
|
FBKName := Trim(CDS_Bank.FieldByName('BankName').AsString);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.SetTab();
|
|||
|
begin
|
|||
|
cxTabControl1.OnChange := nil;
|
|||
|
|
|||
|
cxTabControl1.Tabs.Clear;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from BS_Bank order by SerialNo ');
|
|||
|
open;
|
|||
|
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryTmp, CDS_Bank);
|
|||
|
SInitCDSData(ADOQueryTmp, CDS_Bank);
|
|||
|
with CDS_Bank do
|
|||
|
begin
|
|||
|
if not CDS_Bank.isempty then
|
|||
|
begin
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
cxTabControl1.Tabs.Add(trim(fieldbyname('BankName').AsString));
|
|||
|
next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
if cxTabControl1.Tabs.Count < 1 then
|
|||
|
cxTabControl1.Tabs.Add('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>');
|
|||
|
// cxTabControl1.TabIndex:=0;
|
|||
|
cxTabControl1.OnChange := cxTabControl1Change;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.InitGrid();
|
|||
|
var
|
|||
|
MSG: string;
|
|||
|
begin
|
|||
|
if Trim(cxTabControl1.Tabs.Strings[cxTabControl1.TabIndex]) = '' then
|
|||
|
Exit;
|
|||
|
|
|||
|
GetCurTab();
|
|||
|
with AdoQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*,YEAmount=dbo.F_Bank_Balance(A.BFID,A.BFTime,A.OurBKID) ');
|
|||
|
sql.Add('from BS_Bank_Flow A ');
|
|||
|
sql.Add('where BFTime>=''' + formatdateTime('yyyy-MM-dd', begdate.Date) + ''' ');
|
|||
|
sql.Add('and BFTime<''' + formatdateTime('yyyy-MM-dd', enddate.Date + 1) + ''' ');
|
|||
|
|
|||
|
sql.Add('and OurBKID=' + quotedstr(Trim(FBKID)));
|
|||
|
SQL.Add('order by A.BFTime,BFID');
|
|||
|
open;
|
|||
|
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryTmp, CDS_Main);
|
|||
|
SInitCDSData(ADOQueryTmp, CDS_Main);
|
|||
|
|
|||
|
// with AdoQueryTmp do
|
|||
|
// begin
|
|||
|
// close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add(' EXEC P_CWLS_Judge_lSSC');
|
|||
|
// open;
|
|||
|
// end;
|
|||
|
//
|
|||
|
// if not AdoQueryTmp.IsEmpty then
|
|||
|
// begin
|
|||
|
// MSG := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD>쳣<EFBFBD><ECB3A3>' + AdoQueryTmp.FieldByName('FactoryName').AsString;
|
|||
|
// MSG := MSG + ' ʱ<>䣺' + AdoQueryTmp.FieldByName('CRTime').AsString;
|
|||
|
// MSG := MSG + ' <20><><EFBFBD>' + AdoQueryTmp.FieldByName('RZMoney').AsString;
|
|||
|
//
|
|||
|
// application.messagebox(pchar(MSG), '<27><>ʾ', 0);
|
|||
|
// end;
|
|||
|
TV1.DataController.Filter.Clear;
|
|||
|
CDS_Main.Last;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Clipboard.SetTextBuf(PChar(Trim(CDS_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
cxgrid1.Align := alclient;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
ReadCxGrid(self.Caption + tv1.Name, Tv1);
|
|||
|
enddate.Date := SGetServerDateTime(ADOQueryTmp);
|
|||
|
begdate.Date := strtodate(formatdateTime('yyyy-MM', enddate.Date) + '-01');
|
|||
|
SetTab();
|
|||
|
cxTabControl1.Refresh;
|
|||
|
initGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
frmBankFlowList := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
|
|||
|
Action := cafree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.TCLOSEClick(Sender: TObject);
|
|||
|
begin
|
|||
|
close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.TADDClick(Sender: TObject);
|
|||
|
begin
|
|||
|
GetCurTab();
|
|||
|
try
|
|||
|
frmBankFlowInInput := TfrmBankFlowInInput.Create(Application);
|
|||
|
with frmBankFlowInInput do
|
|||
|
begin
|
|||
|
OurBKName.Properties.LookupItems.Text := FBKID;
|
|||
|
OurBKName.text := FBKName;
|
|||
|
FBFID := '';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmBankFlowInInput.free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.TINITClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
writeCxGrid(self.Caption + tv1.Name, Tv1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
GetCurTab();
|
|||
|
try
|
|||
|
frmBankFlowOutInput := TfrmBankFlowOutInput.Create(Application);
|
|||
|
with frmBankFlowOutInput do
|
|||
|
begin
|
|||
|
OurBKName.TxtCode := FBKID;
|
|||
|
OurBKName.text := FBKName;
|
|||
|
FBFID := '';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmBankFlowOutInput.free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
GetCurTab();
|
|||
|
try
|
|||
|
frmBankFlowIOInput := TfrmBankFlowIOInput.Create(Application);
|
|||
|
with frmBankFlowIOInput do
|
|||
|
begin
|
|||
|
OurBKName.TxtCode := FBKID;
|
|||
|
OurBKName.text := FBKName;
|
|||
|
FBFID := '';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmBankFlowIOInput.free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.TGLVClick(Sender: TObject);
|
|||
|
begin
|
|||
|
SDofilter(AdoQueryTmp, SGetFilters(Panel1, 1, 0));
|
|||
|
SCreateCDS(AdoQueryTmp, CDS_Main);
|
|||
|
SInitCDSData(AdoQueryTmp, CDS_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.TexcelClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel(Trim(cxTabControl1.Tabs.Strings[cxTabControl1.TabIndex]), cxGrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.TDELClick(Sender: TObject);
|
|||
|
var
|
|||
|
FBFID: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
FBFID := trim(CDS_Main.fieldbyname('BFID').AsString);
|
|||
|
if CDS_Main.fieldbyname('fromID').AsString <> '' then
|
|||
|
begin
|
|||
|
application.messagebox('<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if Trim(CDS_Main.fieldbyname('Filler').AsString) <> Trim(DName) then
|
|||
|
begin
|
|||
|
application.messagebox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
if application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 1) = 2 then
|
|||
|
exit;
|
|||
|
try
|
|||
|
ADOQuerycmd.Connection.BeginTrans;
|
|||
|
with ADOQuerycmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete from BS_Bank_Flow where BFID=''' + FBFID + '''');
|
|||
|
sql.Add('delete from BS_Bank_Flow where isnull(fromID,'''')<>'''' and fromID=''' + FBFID + '''');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
ADOQuerycmd.Connection.CommitTrans;
|
|||
|
initGrid();
|
|||
|
except
|
|||
|
ADOQuerycmd.connection.rollbackTrans;
|
|||
|
application.messagebox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>ʧ<EFBFBD><CAA7>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.BFTypeChange(Sender: TObject);
|
|||
|
begin
|
|||
|
SDofilter(AdoQueryTmp, SGetFilters(Panel1, 1, 0));
|
|||
|
SCreateCDS(AdoQueryTmp, CDS_Main);
|
|||
|
SInitCDSData(AdoQueryTmp, CDS_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
initGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|