RTFormwork/项目代码/RTBasicsV1/A09财务通用管理/U_CustStatementWriteOff.pas
“ddf” 61630656e9 1
2024-07-07 09:35:27 +08:00

353 lines
10 KiB
ObjectPascal
Raw Permalink Blame History

unit U_CustStatementWriteOff;
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, U_BaseList, DateUtils, cxContainer, Vcl.Menus,
cxCurrencyEdit, System.Math, System.Character, Vcl.Clipbrd, 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
TfrmCustStatementWriteOff = class(TfrmBaseList)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBClose: TToolButton;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
Panel1: TPanel;
ToolButton2: TToolButton;
Label1: TLabel;
MPRTCodeName: TcxTextEdit;
ADOQueryMain: TADOQuery;
ToolButton1: TToolButton;
Label3: TLabel;
OrderNo: TcxTextEdit;
cxGrid2: TcxGrid;
cxGridLevel1: TcxGridLevel;
Label2: TLabel;
begdate: TDateTimePicker;
cxGridPopupMenu2: TcxGridPopupMenu;
DS_HZ: TDataSource;
CDS_HZ: TClientDataSet;
Label4: TLabel;
OrdDefNote3: TComboBox;
RMGridReport1: TRMGridReport;
RMDBDataSet1: TRMDBDataSet;
RMXLSExport1: TRMXLSExport;
ADOQueryPrint: TADOQuery;
Panetime: TPanel;
TV1: TcxGridDBBandedTableView;
V1Column1: TcxGridDBBandedColumn;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
TV1Column1: TcxGridDBBandedColumn;
TV1Column2: TcxGridDBBandedColumn;
TV1Column3: TcxGridDBBandedColumn;
TV1Column4: TcxGridDBBandedColumn;
TV1Column5: TcxGridDBBandedColumn;
TV1Column6: TcxGridDBBandedColumn;
TV1Column7: TcxGridDBBandedColumn;
TV1Column8: TcxGridDBBandedColumn;
TV1Column9: TcxGridDBBandedColumn;
TV1Column10: TcxGridDBBandedColumn;
TV1Column11: TcxGridDBBandedColumn;
TV1Column12: TcxGridDBBandedColumn;
TV1Column13: TcxGridDBBandedColumn;
TV1Column14: TcxGridDBBandedColumn;
TV1Column15: TcxGridDBBandedColumn;
TV1Column16: TcxGridDBBandedColumn;
TV1Column17: TcxGridDBBandedColumn;
TV1Column18: TcxGridDBBandedColumn;
TV1Column19: TcxGridDBBandedColumn;
TV1Column20: TcxGridDBBandedColumn;
TV1Column21: TcxGridDBBandedColumn;
TV1Column22: TcxGridDBBandedColumn;
TV1Column23: TcxGridDBBandedColumn;
TV1Column24: TcxGridDBBandedColumn;
TV1Column25: TcxGridDBBandedColumn;
TV1Column26: TcxGridDBBandedColumn;
TV1Column27: TcxGridDBBandedColumn;
TV1Column28: TcxGridDBBandedColumn;
TV1Column29: TcxGridDBBandedColumn;
TV1Column30: TcxGridDBBandedColumn;
TV1Column31: TcxGridDBBandedColumn;
TV1Column32: TcxGridDBBandedColumn;
TV1Column33: TcxGridDBBandedColumn;
TV1Column34: TcxGridDBBandedColumn;
TV1Column35: TcxGridDBBandedColumn;
TV1Column36: TcxGridDBBandedColumn;
TV1Column37: TcxGridDBBandedColumn;
Label5: TLabel;
factoryName: TcxTextEdit;
TV1Column38: TcxGridDBBandedColumn;
TV1Column39: TcxGridDBBandedColumn;
TV1Column40: TcxGridDBBandedColumn;
ToolButton4: TToolButton;
TV1Column41: TcxGridDBBandedColumn;
Label6: TLabel;
FactoryNo: TcxTextEdit;
Label7: TLabel;
FactType: TcxTextEdit;
TV1Column42: TcxGridDBBandedColumn;
TV1Column43: TcxGridDBBandedColumn;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
ToolButton5: TToolButton;
TV1Column44: TcxGridDBBandedColumn;
TV1Column45: TcxGridDBBandedColumn;
N2: TMenuItem;
chkqm: TCheckBox;
TV1Column46: 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 ToolButton2Click(Sender: TObject);
procedure P_OrderNo_YSK(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure OrderNoChange(Sender: TObject);
procedure MPRTCodeNameChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure factoryNameChange(Sender: TObject);
procedure FKKPFactoryNameBtnDnClick(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
private
{ Private declarations }
function getNumberFromStr(strIn: string; sFlag: string): string;
procedure InitGrid();
public
{ Public declarations }
RKFlag, FCYID, FZKType, FBZType: string;
fType: string;
end;
var
frmCustStatementWriteOff: TfrmCustStatementWriteOff;
implementation
uses
U_DataLink, U_RTFun, U_ZDYHelp, U_SingleCustStatement;
{$R *.dfm}
function TfrmCustStatementWriteOff.getNumberFromStr(strIn: string; sFlag: string): string;
var
i: Integer;
tempStr: string;
begin
tempStr := '';
if Length(strIn) = 0 then
begin
Result := '';
exit;
end;
for i := 1 to strIn.Length do
begin
if strIn[i] = sFlag then //<2F><>ȡ<EFBFBD><C8A1>sFlagλ<67>ý<EFBFBD><C3BD><EFBFBD>
Break;
if IsNumber(strIn[i]) then //isNumber--System.Character
begin
tempStr := tempStr + strIn[i];
end;
end;
Result := tempStr;
end;
procedure TfrmCustStatementWriteOff.InitGrid();
begin
screen.Cursor := crsqlwait;
Panetime.Visible := true;
Panetime.Left := (Width - Panetime.Width) div 2;
Panetime.top := (Height - Panetime.Height - 200) div 2;
application.ProcessMessages;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
SQL.Clear;
sql.Add(' exec P_Fin_CustStatementYearWriteOff ');
sql.Add(' @begdate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', begdate.DateTime))));
Open;
end;
SCreateCDS(ADOQueryMain, CDS_HZ);
SInitCDSData(ADOQueryMain, CDS_HZ);
finally
ADOQueryMain.EnableControls;
TV1.DataController.Filter.Clear;
ToolButton2.Click;
Panetime.Visible := false;
screen.Cursor := crdefault;
end;
end;
procedure TfrmCustStatementWriteOff.FormDestroy(Sender: TObject);
begin
inherited;
frmCustStatementWriteOff := nil;
end;
procedure TfrmCustStatementWriteOff.factoryNameChange(Sender: TObject);
begin
ToolButton2.Click;
end;
procedure TfrmCustStatementWriteOff.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
Action := caFree;
end;
procedure TfrmCustStatementWriteOff.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmCustStatementWriteOff.FormShow(Sender: TObject);
begin
inherited;
readCxBandedGrid(self.Caption + '2', Tv1, <><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>');
InitGrid();
end;
procedure TfrmCustStatementWriteOff.TBRafreshClick(Sender: TObject);
begin
begdate.SetFocus;
InitGrid();
end;
procedure TfrmCustStatementWriteOff.ToolButton2Click(Sender: TObject);
var
MGL: string;
begin
if chkqm.Checked then
begin
MGL := ' YuEMoney<>0'
end
else
begin
MGL := '';
end;
if SGetFilters(Panel1, 1, 2) <> '' then
begin
if MGL <> '' then
MGL := MGL + ' and ' + SGetFilters(Panel1, 1, 2)
else
MGL := SGetFilters(Panel1, 1, 2);
end;
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain, MGL);
SCreateCDS(ADOQueryMain, CDS_HZ);
SInitCDSData(ADOQueryMain, CDS_HZ);
end;
end;
procedure TfrmCustStatementWriteOff.ToolButton4Click(Sender: TObject);
begin
// if CDS_HZ.IsEmpty then
// exit;
// try
// frmSingleCustStatement := TfrmSingleCustStatement.Create(self);
// with frmSingleCustStatement do
// begin
// begdate.DateTime := StartOfTheYear(self.begdate.DateTime);
// enddate.DateTime := endOfTheYear(self.begdate.DateTime);
// factoryName.Text := self.CDS_HZ.fieldbyname('factoryName').AsString;
// factoryName.TxtCode := self.CDS_HZ.fieldbyname('factoryNo').AsString;
// FZKType := '';
// Show;
// end;
// finally
// end;
end;
procedure TfrmCustStatementWriteOff.ToolButton5Click(Sender: TObject);
begin
WriteCxBandedGrid(self.Caption + '2', Tv1, <><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>');
end;
procedure TfrmCustStatementWriteOff.P_OrderNo_YSK(Sender: TObject);
begin
ToolButton2.Click;
end;
procedure TfrmCustStatementWriteOff.FKKPFactoryNameBtnDnClick(Sender: TObject);
begin
TBtnEditC(Sender).Text := '';
TBtnEditC(Sender).TxtCode := '';
end;
procedure TfrmCustStatementWriteOff.ToolButton1Click(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then
Exit;
TcxGridToExcel(self.Caption, cxgrid2);
end;
procedure TfrmCustStatementWriteOff.OrderNoChange(Sender: TObject);
begin
if Length(Trim(OrderNo.Text)) < 3 then
Exit;
ToolButton2.Click;
end;
procedure TfrmCustStatementWriteOff.MPRTCodeNameChange(Sender: TObject);
begin
ToolButton2.Click;
end;
procedure TfrmCustStatementWriteOff.N2Click(Sender: TObject);
begin
Clipboard.SetTextBuf(PChar(Trim(CDS_HZ.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
end;
procedure TfrmCustStatementWriteOff.FormCreate(Sender: TObject);
begin
inherited;
begdate.DateTime := SGetServerDate(ADOQueryTemp);
end;
end.