222 lines
7.1 KiB
ObjectPascal
222 lines
7.1 KiB
ObjectPascal
|
unit U_SingleCustStatement;
|
|||
|
|
|||
|
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, cxDropDownEdit, RM_e_Xls, cxGridBandedTableView,
|
|||
|
cxGridDBBandedTableView, BtnEdit, cxLookAndFeels, cxLookAndFeelPainters,
|
|||
|
cxNavigator, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
|
|||
|
dxBarBuiltInMenu, 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, cxContainer, dxCore, cxDateUtils;
|
|||
|
|
|||
|
type
|
|||
|
TfrmSingleCustStatement = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
Panel1: TPanel;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
Label2: TLabel;
|
|||
|
Label6: TLabel;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
DS_HZ: TDataSource;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
Label5: TLabel;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
RMGridReport1: TRMGridReport;
|
|||
|
RMDBDataSet1: TRMDBDataSet;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
TV1: TcxGridDBBandedTableView;
|
|||
|
V1Column2: TcxGridDBBandedColumn;
|
|||
|
V1Column4: TcxGridDBBandedColumn;
|
|||
|
V1Column5: TcxGridDBBandedColumn;
|
|||
|
V1Column6: TcxGridDBBandedColumn;
|
|||
|
V1Column7: TcxGridDBBandedColumn;
|
|||
|
V1Column8: TcxGridDBBandedColumn;
|
|||
|
V1Column9: TcxGridDBBandedColumn;
|
|||
|
V1Column12: TcxGridDBBandedColumn;
|
|||
|
V1Column15: TcxGridDBBandedColumn;
|
|||
|
V1Column3: TcxGridDBBandedColumn;
|
|||
|
V1Column10: TcxGridDBBandedColumn;
|
|||
|
V1Column14: TcxGridDBBandedColumn;
|
|||
|
V1Column16: TcxGridDBBandedColumn;
|
|||
|
V1Column17: TcxGridDBBandedColumn;
|
|||
|
V1Column20: TcxGridDBBandedColumn;
|
|||
|
V1Column21: TcxGridDBBandedColumn;
|
|||
|
V1Column22: TcxGridDBBandedColumn;
|
|||
|
V1Column23: TcxGridDBBandedColumn;
|
|||
|
V1Column25: TcxGridDBBandedColumn;
|
|||
|
V1Column26: TcxGridDBBandedColumn;
|
|||
|
V1Column33: TcxGridDBBandedColumn;
|
|||
|
V1Column34: TcxGridDBBandedColumn;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
TV1Column1: TcxGridDBBandedColumn;
|
|||
|
begdate: TcxDateEdit;
|
|||
|
Enddate: TcxDateEdit;
|
|||
|
OppCoName: TcxTextEdit;
|
|||
|
TV1Column2: TcxGridDBBandedColumn;
|
|||
|
TV1Column3: TcxGridDBBandedColumn;
|
|||
|
TV1Column4: TcxGridDBBandedColumn;
|
|||
|
TV1Column5: TcxGridDBBandedColumn;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure P_OrderNo_YSK(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
|
|||
|
procedure InitGrid();
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
FOppCoNo, FCurrency: string;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmSingleCustStatement: TfrmSingleCustStatement;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_LabelPrint;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmSingleCustStatement.InitGrid();
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
Filtered := False;
|
|||
|
sql.Add(' exec P_Fin_CustStatementSingle ');
|
|||
|
sql.Add(' @Begdate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', begdate.Date))));
|
|||
|
sql.Add(' ,@Enddate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', Enddate.Date + 1))));
|
|||
|
sql.Add(' ,@OppCoNo=' + QuotedStr(Trim(FOppCoNo)));
|
|||
|
sql.Add(' ,@Currency=' + QuotedStr(Trim(FCurrency)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_HZ);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_HZ);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSingleCustStatement.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmSingleCustStatement := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSingleCustStatement.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSingleCustStatement.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSingleCustStatement.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
readCxBandedGrid(trim(self.Caption), Tv1, 'Ӧ<>տ<EFBFBD><D5BF><EFBFBD><EFBFBD>˵<EFBFBD>');
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSingleCustStatement.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
begdate.SetFocus;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSingleCustStatement.P_OrderNo_YSK(Sender: TObject);
|
|||
|
begin
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSingleCustStatement.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel(self.Caption + '-' + trim(OppCoName.Text), cxgrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSingleCustStatement.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxBandedGrid(trim(self.Caption), Tv1, 'Ӧ<>տ<EFBFBD><D5BF><EFBFBD><EFBFBD>˵<EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSingleCustStatement.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
Enddate.Date := SGetServerDate(ADOQueryTemp);
|
|||
|
begdate.Date := Enddate.Date;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSingleCustStatement.ToolButton3Click(Sender: TObject);
|
|||
|
var
|
|||
|
WSql: string;
|
|||
|
begin
|
|||
|
if CDS_HZ.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
WSql := ' @Begdate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', begdate.Date)));
|
|||
|
WSql := WSql + ' ,@Enddate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', Enddate.Date + 1)));
|
|||
|
WSql := WSql + ' ,@OppCoNo=' + QuotedStr(Trim(FOppCoNo));
|
|||
|
WSql := WSql + ' ,@Currency=' + QuotedStr(Trim(FCurrency));
|
|||
|
|
|||
|
try
|
|||
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
with frmLabelPrint do
|
|||
|
begin
|
|||
|
IsSql1 := True;
|
|||
|
FLMType := 'SingleCustStatement';
|
|||
|
FFiltration1 := WSql;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
// Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLabelPrint.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|