D7wmguihua/应收应付/U_FYDJ.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

263 lines
6.6 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_FYDJ;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin,
StdCtrls, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdFTP,ShellAPI,IniFiles, cxCheckBox, cxCalendar,
cxButtonEdit, cxTextEdit, cxPC;
type
TfrmFYDJ = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBDel: TToolButton;
TBClose: TToolButton;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
Panel1: TPanel;
TBfind: TToolButton;
Label1: TLabel;
FeeName: TEdit;
ADOQueryMain: TADOQuery;
TBexcel: TToolButton;
RM1: TRMGridReport;
RMDB_Main: TRMDBDataSet;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
v2Column4: TcxGridDBColumn;
v2Column5: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
Label2: TLabel;
Label6: TLabel;
begdate: TDateTimePicker;
Enddate: TDateTimePicker;
cxGridPopupMenu2: TcxGridPopupMenu;
DS_HZ: TDataSource;
CDS_HZ: TClientDataSet;
TBAdd: TToolButton;
v2Column9: TcxGridDBColumn;
v2Column6: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
TBEdit: TToolButton;
TBZdy: TToolButton;
v2Column2: TcxGridDBColumn;
v2Column3: TcxGridDBColumn;
note: TEdit;
Label4: TLabel;
BZType: TComboBox;
Label5: TLabel;
FeeType: TEdit;
Label7: TLabel;
bankNo: TEdit;
Label3: TLabel;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure TBDelClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure TBfindClick(Sender: TObject);
procedure TBexcelClick(Sender: TObject);
procedure TBZdyClick(Sender: TObject);
procedure TBAddClick(Sender: TObject);
procedure FeeTypeChange(Sender: TObject);
procedure TBEditClick(Sender: TObject);
private
{ Private declarations }
procedure InitGrid();
procedure SetComboBox();
public
fSYRName:string;
fflag:integer;
{ Public declarations }
end;
var
frmFYDJ: TfrmFYDJ;
implementation
uses
U_DataLink,U_Fun,U_ZDYHelp,U_FYDJInput,U_ZdyAttachGYS,U_ZdyAttachment;
{$R *.dfm}
procedure TfrmFYDJ.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
SQL.Clear;
sql.Add(' select A.* from YF_Money_Fee A ');
sql.Add(' where A.CRTime>='''+FormatDateTime('yyyy-MM-dd',begdate.DateTime)+''' ');
sql.Add(' and A.CRTime<'''+FormatDateTime('yyyy-MM-dd',Enddate.DateTime+1)+''' ');
sql.Add(' and SYRName='''+trim(fSyrname)+''' ');
sql.Add(' and Feeflag='''+inttostr(fflag)+''' ');
sql.Add(' and money<>0 ');
Open;
end;
SCreateCDS20(ADOQueryMain,CDS_HZ);
SInitCDSData20(ADOQueryMain,CDS_HZ);
finally
ADOQueryMain.EnableControls;
TBfind.Click;
end;
end;
procedure TfrmFYDJ.FormDestroy(Sender: TObject);
begin
frmFYDJ:=nil;
end;
procedure TfrmFYDJ.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmFYDJ.TBCloseClick(Sender: TObject);
begin
WriteCxGrid(Self.Caption + Tv2.Name,Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Close;
end;
procedure TfrmFYDJ.TBDelClick(Sender: TObject);
begin
if CDS_HZ.IsEmpty then Exit;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add(' delete YF_Money_LL where exists(select FeeID from YF_Money_Fee X where X.FeeID=YF_Money_LL.fromMainID and FeeNo='''+Trim(CDS_HZ.fieldbyname('FeeNo').AsString)+''') ');
sql.Add(' delete YF_Money_Fee where FeeNo='''+Trim(CDS_HZ.fieldbyname('FeeNo').AsString)+''' ');
execsql;
end;
ADOQueryCmd.Connection.CommitTrans;
InitGrid();
except
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
end;
end;
procedure TfrmFYDJ.FormShow(Sender: TObject);
begin
ReadCxGrid(Self.Caption + Tv2.Name,Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Enddate.DateTime:=SGetServerDate(ADOQueryTemp);
begdate.DateTime:=Enddate.DateTime;
SetComboBox();
InitGrid();
end;
procedure TfrmFYDJ.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmFYDJ.TBfindClick(Sender: TObject);
begin
if ADOQueryMain.Active=False then Exit;
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,CDS_HZ);
SInitCDSData20(ADOQueryMain,CDS_HZ);
end;
procedure TfrmFYDJ.TBexcelClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then Exit;
SelExportData(Tv2,ADOQueryMain,'<27><><EFBFBD>õǼ<C3B5><C7BC>б<EFBFBD>');
end;
procedure TfrmFYDJ.SetComboBox();
begin
{ FeeType.Items.Clear;
FeeType.Items.Add('');
with ADOQueryTemp do
begin
Close;
SQL.Clear;
SQL.Add(' select distinct Note from KH_ZDY ');
SQL.Add(' where Type=''FeeType'' and ISNULL(Note,'''')<>'''' ');
Open;
while not Eof do
begin
FeeType.Items.Add(Trim(FieldByName('Note').AsString));
Next;
end;
end;
FeeType.ItemIndex:=0; }
end;
procedure TfrmFYDJ.TBZdyClick(Sender: TObject);
begin
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:='FeeType';
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
fnote:=True;
fZdyFlag:=True;
V1Note.Caption:='<27><><EFBFBD><EFBFBD>';
Show;
end;
end;
procedure TfrmFYDJ.TBAddClick(Sender: TObject);
begin
try
frmFYDJInput:=TfrmFYDJInput.Create(Application);
with frmFYDJInput do
begin
fkeyNo:='';
fflag:=self.fflag;
fSyrname:=self.fSYRName;
if ShowModal=1 then
begin
Self.InitGrid();
end;
end;
finally
frmFYDJInput.Free;
end;
end;
procedure TfrmFYDJ.FeeTypeChange(Sender: TObject);
begin
TBfind.Click;
end;
procedure TfrmFYDJ.TBEditClick(Sender: TObject);
begin
try
frmFYDJInput:=TfrmFYDJInput.Create(Application);
with frmFYDJInput do
begin
fkeyNo:=Trim(Self.CDS_HZ.FieldByName('FeeNo').AsString);
FeeType.Enabled:=False;
fflag:=self.fflag;
fSyrname:=self.fSYRName;
if ShowModal=1 then
begin
Self.InitGrid();
end;
end;
finally
frmFYDJInput.Free;
end;
end;
end.