D7myChengxie/应收应付/U_JXFPINVOICE_TJ.pas
DESKTOP-E401PHE\Administrator e4d35a6883 1234
2025-08-25 10:39:41 +08:00

214 lines
6.0 KiB
ObjectPascal
Raw Permalink Blame History

unit U_JXFPINVOICE_TJ;
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
TfrmJXFPInvoice_TJ = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBClose: TToolButton;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
Panel1: TPanel;
ToolButton2: TToolButton;
ADOQueryMain: TADOQuery;
ToolButton1: TToolButton;
RM1: TRMGridReport;
RMDB_Main: TRMDBDataSet;
Label3: TLabel;
ToFactoryName: TEdit;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
cxGridLevel1: TcxGridLevel;
Label2: TLabel;
Label6: TLabel;
begdate: TDateTimePicker;
Enddate: TDateTimePicker;
cxGridPopupMenu2: TcxGridPopupMenu;
DS_HZ: TDataSource;
CDS_HZ: TClientDataSet;
v2FPMoney: TcxGridDBColumn;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
cxStyle2: TcxStyle;
cxStyle_gridRow: TcxStyle;
cxStyle_gridFoot: TcxStyle;
cxStyle_gridHead: TcxStyle;
cxStyle_gridGroupBox: TcxStyle;
cxStyle_yellow: TcxStyle;
cxStyle_Red: TcxStyle;
cxStyle_fontBlack: TcxStyle;
cxStyle_fontclFuchsia: TcxStyle;
cxStyle_fontclPurple: TcxStyle;
cxStyle_fontclGreen: TcxStyle;
cxStyle_fontclBlue: TcxStyle;
cxStyle_fontclTeal: TcxStyle;
cxStyle_fontclOlive: TcxStyle;
Label5: TLabel;
BBMoney: TEdit;
Label7: TLabel;
v2FactoryName: TcxGridDBColumn;
FactoryName: TEdit;
FactoryNameTJ: TEdit;
Label1: TLabel;
Label4: TLabel;
ToFactoryNameTJ: TEdit;
Label8: TLabel;
Label9: TLabel;
cxTabControl1: TcxTabControl;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure ToFactoryNameChange(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure Tv2DblClick(Sender: TObject);
procedure cxTabControl1Change(Sender: TObject);
private
IsEdit: integer;
{ Private declarations }
procedure InitGrid();
public
{ Public declarations }
RKFlag, FCYID: string;
fInvoiceFlag: string;
IsHx: integer;
end;
var
frmjXFPInvoice_TJ: TfrmjXFPInvoice_TJ;
implementation
uses
U_DataLink, U_Fun10, U_FdInviceList;
{$R *.dfm}
procedure TfrmJXFPInvoice_TJ.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
SQL.Clear;
case cxTabControl1.TabIndex of
0:
begin
sql.Add('select sum(B.TaxMoney)as kpMoney,FactoryName from FD_Invoice A ');
sql.Add(' inner join FD_InvoiceSub B on B.invoiceNO=A.invoiceNO');
sql.Add(' where InvoiceFlag=''0'' AND A.chkstatus<>2');
sql.add(' AND A.FILLTIME>=''' + formatdatetime('yyyy-MM-dd', begdate.datetime) + ''' ');
sql.Add(' and A.FILLTIME<''' + formatdateTime('yyyy-MM-dd', enddate.DateTime + 1) + ''' ');
sql.Add(' group by FactoryName');
end;
1:
begin
sql.Add('select sum(B.TaxMoney)as kpMoney,FactoryName from FD_Invoice A ');
sql.Add(' inner join FD_InvoiceSub B on B.invoiceNO=A.invoiceNO');
sql.Add(' where InvoiceFlag=''1'' AND A.chkstatus<>2');
sql.add(' and A.FILLTIME>=''' + formatdatetime('yyyy-MM-dd', begdate.datetime) + ''' ');
sql.Add(' and A.FILLTIME<''' + formatdateTime('yyyy-MM-dd', enddate.DateTime + 1) + ''' ');
sql.Add(' group by FactoryName');
end;
end;
// ShowMessage(SQL.Text);
Open;
end;
SCreateCDS20(ADOQueryMain, CDS_HZ);
SInitCDSData20(ADOQueryMain, CDS_HZ);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmJXFPInvoice_TJ.FormDestroy(Sender: TObject);
begin
frmjXFPInvoice_TJ := nil;
end;
procedure TfrmJXFPInvoice_TJ.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TfrmJXFPInvoice_TJ.TBCloseClick(Sender: TObject);
begin
WriteCxGrid(self.Caption, Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Close;
end;
procedure TfrmJXFPInvoice_TJ.FormShow(Sender: TObject);
begin
ReadCxGrid(self.Caption, Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Enddate.DateTime := SGetServerDate(ADOQueryTemp);
begdate.DateTime := Enddate.DateTime - 30;
InitGrid();
end;
procedure TfrmJXFPInvoice_TJ.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmJXFPInvoice_TJ.ToolButton2Click(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS20(ADOQueryMain, CDS_HZ);
SInitCDSData20(ADOQueryMain, CDS_HZ);
end;
end;
procedure TfrmJXFPInvoice_TJ.ToFactoryNameChange(Sender: TObject);
begin
ToolButton2.Click;
end;
procedure TfrmJXFPInvoice_TJ.ToolButton1Click(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then
Exit;
TcxGridToExcel(self.Caption, cxgrid2);
end;
procedure TfrmJXFPInvoice_TJ.Tv2DblClick(Sender: TObject);
begin
frmFdInviceList := TfrmFdInviceList.Create(self);
with frmFdInviceList do
begin
FactoryName.Text := CDS_HZ.FieldByName('FactoryName').AsString;
fInvoiceFlag := self.fInvoiceFlag;
if showmodal = 1 then
begin
initGrid();
end;
free;
end;
end;
procedure TfrmJXFPInvoice_TJ.cxTabControl1Change(Sender: TObject);
begin
InitGrid();
end;
end.