340 lines
9.0 KiB
ObjectPascal
340 lines
9.0 KiB
ObjectPascal
unit U_YF_Money_LL;
|
||
|
||
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,
|
||
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, dxSkinPumpkin,
|
||
dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
|
||
dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
|
||
dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine,
|
||
dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue, dxSkinscxPCPainter;
|
||
|
||
type
|
||
TfrmMoney_LL = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TINIT: TToolButton;
|
||
TGLV: TToolButton;
|
||
TADD: TToolButton;
|
||
TUPDATE: TToolButton;
|
||
TDEL: TToolButton;
|
||
TSELECT: TToolButton;
|
||
Texcel: TToolButton;
|
||
TCLOSE: TToolButton;
|
||
Panel1: TPanel;
|
||
Label1: TLabel;
|
||
Label4: TLabel;
|
||
Label2: TLabel;
|
||
CRType: TEdit;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
CRZY: TEdit;
|
||
cxGrid1: TcxGrid;
|
||
TV1: TcxGridDBTableView;
|
||
V1CRTime: TcxGridDBColumn;
|
||
V1CRType: TcxGridDBColumn;
|
||
V1InMoney: TcxGridDBColumn;
|
||
V1NOTE: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
DataSource1: TDataSource;
|
||
AdoQueryTmp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
TZDY: TToolButton;
|
||
cxTabControl1: TcxTabControl;
|
||
V1CRZY: TcxGridDBColumn;
|
||
V1OutMoney: TcxGridDBColumn;
|
||
V1YEMoney: TcxGridDBColumn;
|
||
Label3: TLabel;
|
||
V1Column1: TcxGridDBColumn;
|
||
TofactoryName: TEdit;
|
||
Label5: TLabel;
|
||
V1Column2: TcxGridDBColumn;
|
||
Label6: TLabel;
|
||
OrderNo: TEdit;
|
||
CDS_Main: TClientDataSet;
|
||
ADOQueryMain: TADOQuery;
|
||
ToolButton1: TToolButton;
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TV1DblClick(Sender: TObject);
|
||
procedure TCLOSEClick(Sender: TObject);
|
||
procedure TADDClick(Sender: TObject);
|
||
procedure TINITClick(Sender: TObject);
|
||
procedure TGLVClick(Sender: TObject);
|
||
procedure TUPDATEClick(Sender: TObject);
|
||
procedure TSELECTClick(Sender: TObject);
|
||
procedure TexcelClick(Sender: TObject);
|
||
procedure TDELClick(Sender: TObject);
|
||
procedure TZDYClick(Sender: TObject);
|
||
procedure CRTypeChange(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
private
|
||
procedure initGrid();
|
||
procedure SetTab();
|
||
{ Private declarations }
|
||
public
|
||
fSYRName:string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmMoney_LL: TfrmMoney_LL;
|
||
|
||
implementation
|
||
|
||
uses U_DataLink, U_Fun10,U_YF_Money_Sub, U_ZDYHelp, U_SysLogHelp;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmMoney_LL.SetTab();
|
||
begin
|
||
cxTabControl1.OnChange := nil;
|
||
cxTabControl1.Tabs.Clear;
|
||
with AdoqueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_ZDY where Type ='''+trim(fsyrName)+'''+''XJLLFLAG'' ');
|
||
open;
|
||
If not isempty then
|
||
begin
|
||
while not eof do
|
||
begin
|
||
cxTabControl1.Tabs.Add(trim(fieldbyname('ZDYName').AsString));
|
||
next;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
IF cxTabControl1.Tabs.Count<1 then
|
||
cxTabControl1.Tabs.Add('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>');
|
||
cxTabControl1.OnChange := cxTabControl1Change;
|
||
// cxTabControl1.TabIndex:=0;
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.InitGrid();
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('exec P_ZHLL_List_MX ');
|
||
sql.Add('@begdate='''+formatdateTime('yyyy-MM-dd',begdate.DateTime)+''' ');
|
||
sql.Add(',@enddate='''+formatdateTime('yyyy-MM-dd',enddate.DateTime+1)+''' ');
|
||
sql.Add(',@factoryName='+quotedstr(Trim(cxTabControl1.Tabs.Strings[cxTabControl1.TabIndex])));
|
||
sql.Add(',@syrName='''+trim(fsyrName)+''' ');
|
||
// ShowMessage(SQL.text);
|
||
open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.FormCreate(Sender: TObject);
|
||
begin
|
||
cxgrid1.Align:=alclient;
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid(self.Caption+tv1.Name+'1',Tv1);
|
||
enddate.datetime:=SGetServerDateTime(ADOQueryTmp);
|
||
begdate.datetime:=strtodate(formatdateTime('yyyy-MM',enddate.DateTime)+'-01');
|
||
SetTab();
|
||
initGrid();
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmMoney_LL:=nil;
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
writeCxGrid(self.Caption+tv1.Name+'1',Tv1);
|
||
action:=cafree;
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.TV1DblClick(Sender: TObject);
|
||
begin
|
||
TSELECT.click;
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.TCLOSEClick(Sender: TObject);
|
||
begin
|
||
close;
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.TADDClick(Sender: TObject);
|
||
begin
|
||
try
|
||
FrmYF_Money_Sub:=TFrmYF_Money_Sub.Create(Application);
|
||
with FrmYF_Money_Sub do
|
||
begin
|
||
factoryName.text:=Trim(cxTabControl1.Tabs.Strings[cxTabControl1.TabIndex]);
|
||
fsyrName:=self.fSYRName;
|
||
Fkeyno:='';
|
||
if ShowModal=1 then
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
end;
|
||
finally;
|
||
FrmYF_Money_Sub.free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.TINITClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.TGLVClick(Sender: TObject);
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,0));
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.TUPDATEClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
if CDS_Main.fieldbyname('frommainID').AsString<>'' then
|
||
begin
|
||
application.messagebox('<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
try
|
||
FrmYF_Money_Sub:=TFrmYF_Money_Sub.Create(Application);
|
||
with FrmYF_Money_Sub do
|
||
begin
|
||
Fkeyno:=trim(Self.CDS_Main.fieldbyname('LLNO').asstring);
|
||
fsyrName:=self.fSYRName;
|
||
if ShowModal=1 then
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
end;
|
||
finally;
|
||
FrmYF_Money_Sub.free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.TSELECTClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
try
|
||
FrmYF_Money_Sub:=TFrmYF_Money_Sub.Create(Application);
|
||
with FrmYF_Money_Sub do
|
||
begin
|
||
Fkeyno:=trim(Self.CDS_Main.fieldbyname('LLNO').asstring);
|
||
TSave.Visible:=False;
|
||
panel1.Enabled:=False;
|
||
if ShowModal=1 then
|
||
begin
|
||
// InitGrid();
|
||
end;
|
||
end;
|
||
finally;
|
||
FrmYF_Money_Sub.free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.TexcelClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
TcxGridToExcel(Trim(cxTabControl1.Tabs.Strings[cxTabControl1.TabIndex]),cxGrid1);
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.TDELClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then exit;
|
||
if CDS_Main.fieldbyname('frommainID').AsString<>'' then
|
||
begin
|
||
application.messagebox('<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB>ɾ<EFBFBD><C9BE>!','<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 YF_Money_LL where LLNO='''+trim(CDS_Main.fieldbyname('LLNO').AsString)+'''');
|
||
sql.Add('delete from YF_Money_LL where fromMainID='''+trim(CDS_Main.fieldbyname('LLNO').AsString)+'''');
|
||
execsql;
|
||
end;
|
||
ADOQuerycmd.Connection.CommitTrans;
|
||
initGrid();
|
||
except
|
||
ADOQuerycmd.connection.rollbackTrans;
|
||
application.messagebox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>ʧ<EFBFBD><CAA7>','<27><>ʾ',0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.TZDYClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(self);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:=trim(fsyrName)+'XJLLFLAG';
|
||
flagname:='<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>';
|
||
if showmodal=1 then
|
||
begin
|
||
SetTab();
|
||
// cxTabControl1.Tabs.Text:=trim(ClientDataSet1.fieldbyname('ZDYName').asstring);
|
||
end;
|
||
end;
|
||
// initGrid();
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.CRTypeChange(Sender: TObject);
|
||
begin
|
||
TGLV.Click;
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
// IF cxTabControl1.TabIndex>=0 then
|
||
initGrid();
|
||
end;
|
||
|
||
procedure TfrmMoney_LL.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
frmSysLogHelp:=TfrmSysLogHelp.create(self);
|
||
with frmSysLogHelp do
|
||
begin
|
||
facction:='<27>˻<EFBFBD><CBBB><EFBFBD>ˮ<EFBFBD><EFBFBD>';
|
||
showmodal;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
end.
|