560 lines
15 KiB
ObjectPascal
560 lines
15 KiB
ObjectPascal
|
unit U_ExpenseList;
|
|||
|
|
|||
|
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, cxDropDownEdit, cxLookAndFeels, cxLookAndFeelPainters,
|
|||
|
cxNavigator, dxBarBuiltInMenu, dxSkinsCore, dxSkinsDefaultPainters,
|
|||
|
dxDateRanges, U_BaseList, Vcl.Menus, Vcl.Clipbrd, cxContainer, dxCore,
|
|||
|
cxDateUtils, 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, FrameDateSel;
|
|||
|
|
|||
|
type
|
|||
|
TfrmExpenseList = class(TfrmBaseList)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
btnDel: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
Panel1: TPanel;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
Label3: TLabel;
|
|||
|
OppCoName: TcxTextEdit;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v2CRTime: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
GPM_1: TcxGridPopupMenu;
|
|||
|
DS_1: TDataSource;
|
|||
|
CDS_1: TClientDataSet;
|
|||
|
btnAdd: TToolButton;
|
|||
|
v2FactoryName: TcxGridDBColumn;
|
|||
|
F_Name: TcxTextEdit;
|
|||
|
Label4: TLabel;
|
|||
|
Label6: TLabel;
|
|||
|
P_Code: TcxTextEdit;
|
|||
|
v2OrderNo: TcxGridDBColumn;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
Label10: TLabel;
|
|||
|
ConNo: TcxTextEdit;
|
|||
|
Label11: TLabel;
|
|||
|
BuyConNo: TcxTextEdit;
|
|||
|
v2Column2: TcxGridDBColumn;
|
|||
|
btnChk: TToolButton;
|
|||
|
btnReChk: TToolButton;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
Label2: TLabel;
|
|||
|
OppParentCoName: TcxTextEdit;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
N2: TMenuItem;
|
|||
|
btnEdit: TToolButton;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column17: TcxGridDBColumn;
|
|||
|
Tv1Column18: TcxGridDBColumn;
|
|||
|
Tv1Column19: TcxGridDBColumn;
|
|||
|
Tv1Column20: TcxGridDBColumn;
|
|||
|
Tv1Column21: TcxGridDBColumn;
|
|||
|
Tv1Column22: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
ToolButton9: TToolButton;
|
|||
|
N3: TMenuItem;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
frmFrameDateSel1: TfrmFrameDateSel;
|
|||
|
TBFind: TToolButton;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure btnDelClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure cxGridDBColumn5PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure btnAddClick(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure btnChkClick(Sender: TObject);
|
|||
|
procedure btnReChkClick(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure btnEditClick(Sender: TObject);
|
|||
|
procedure ToolButton9Click(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N3Click(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure OppCoNamePropertiesChange(Sender: TObject);
|
|||
|
private
|
|||
|
procedure InitGrid();
|
|||
|
procedure SetStatus();
|
|||
|
public
|
|||
|
FAuthority: string;
|
|||
|
end;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ExpenseInput, U_ZDYHelp, U_AttachmentUpload;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmExpenseList.SetStatus();
|
|||
|
begin
|
|||
|
|
|||
|
btnChk.Enabled := false; //<2F><><EFBFBD><EFBFBD>
|
|||
|
btnReChk.Enabled := false; //<2F><><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
btnAdd.Enabled := false; //<2F><><EFBFBD><EFBFBD>
|
|||
|
btnEdit.Enabled := false; //<2F><EFBFBD>
|
|||
|
btnDel.Enabled := false; //ɾ<><C9BE>
|
|||
|
// if Trim(FAuthority) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
btnAdd.Enabled := true;
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
btnEdit.Enabled := true;
|
|||
|
btnDel.Enabled := true;
|
|||
|
btnChk.Enabled := true;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
btnReChk.Enabled := true;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.InitGrid();
|
|||
|
var
|
|||
|
Msql, mbegdate, menddate: string;
|
|||
|
SqlStr: string;
|
|||
|
begin
|
|||
|
|
|||
|
SqlStr := ' select A.* ';
|
|||
|
SqlStr := SqlStr + ',FJFlag=CAST((CASE WHEN (SELECT COUNT(X.FileName) FROM FJ_File X where X.TFType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ'' and X.WBID=A.FFID)>0 THEN 1 ELSE 0 END) AS BIT)';
|
|||
|
SqlStr := SqlStr + ' from Finance_Flow A ';
|
|||
|
SqlStr := SqlStr + ' where A.FFType=''<27><><EFBFBD>õǼ<C3B5>'' ';
|
|||
|
SqlStr := SqlStr + ' and A.FFTime>=''' + Trim(FormatDateTime('yyyy-MM-dd', frmFrameDateSel1.BegDate.Date)) + '''';
|
|||
|
SqlStr := SqlStr + ' and A.FFTime<''' + Trim(FormatDateTime('yyyy-MM-dd', frmFrameDateSel1.enddate.Date + 1)) + '''';
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
SqlStr := SqlStr + ' and isnull(status,''0'')=''0'' ';
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
SqlStr := SqlStr + ' and isnull(status,''0'')=''9'' ';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
InitCDSData(ADOQueryMain, CDS_1, Tv1, SqlStr, SGetFilters(Panel1, 1, 2), 'FFID');
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(cds_1, True);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Clipboard.SetTextBuf(PChar(Trim(CDS_1.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.N3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(cds_1, false);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.btnDelClick(Sender: TObject);
|
|||
|
var
|
|||
|
FFFIDS: string;
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
while CDS_1.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
FFFIDS := FFFIDS + Trim(CDS_1.fieldbyname('FFID').AsString) + ',';
|
|||
|
CDS_1.Delete;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_Fin_Flow_Del ');
|
|||
|
sql.Add(' @FFIDS=' + QuotedStr(FFFIDS));
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3>', '<27><>ʾ');
|
|||
|
except
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
ReadCxGrid(trim(Self.Caption), Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
frmFrameDateSel1.Enddate.Date := SGetServerDate(ADOQueryTemp);
|
|||
|
frmFrameDateSel1.begdate.Date := frmFrameDateSel1.Enddate.Date - 30;
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
frmFrameDateSel1.begdate.SetFocus;
|
|||
|
|
|||
|
InitGrid();
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.cxGridDBColumn5PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
FPS, FQty, FPrice, FQTFee, FMoney, FZKMoney: Double;
|
|||
|
begin
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
if Trim(mvalue) = '' then
|
|||
|
begin
|
|||
|
mvalue := '0';
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := Trim(mvalue);
|
|||
|
Post;
|
|||
|
FPS := CDS_1.fieldbyname('PS').AsFloat;
|
|||
|
FQty := CDS_1.fieldbyname('Qty').AsFloat;
|
|||
|
FQTFee := CDS_1.fieldbyname('QTFee').AsFloat;
|
|||
|
FPrice := CDS_1.fieldbyname('Price').AsFloat;
|
|||
|
FMoney := CDS_1.fieldbyname('Money').AsFloat;
|
|||
|
|
|||
|
FZKMoney := CDS_1.fieldbyname('ZKMoney').AsFloat;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(FFieldName) <> 'Money' then
|
|||
|
begin
|
|||
|
FMoney := FQty * FPrice + FQTFee - FZKMoney;
|
|||
|
end;
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('Money').Value := FMoney;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update Finance_Flow set ' + FFieldName + '=' + Trim(mvalue));
|
|||
|
if Trim(FFieldName) <> 'Money' then
|
|||
|
sql.Add(' ,Money=' + FloatToStr(FMoney));
|
|||
|
sql.Add('where FFID=' + quotedstr(Trim(CDS_1.fieldbyname('FFID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
Tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.btnChkClick(Sender: TObject);
|
|||
|
var
|
|||
|
FFFIDS: string;
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
while CDS_1.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
FFFIDS := FFFIDS + Trim(CDS_1.fieldbyname('FFID').AsString) + ',';
|
|||
|
CDS_1.Delete;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_Fin_Flow_SetStatus ');
|
|||
|
sql.Add(' @FFIDS=' + QuotedStr(FFFIDS));
|
|||
|
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_Fin_In_Bank_Flow ');
|
|||
|
sql.Add(' @FFIDS=' + QuotedStr(FFFIDS));
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3>', '<27><>ʾ');
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.btnReChkClick(Sender: TObject);
|
|||
|
var
|
|||
|
FFFIDS: string;
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
while CDS_1.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
FFFIDS := FFFIDS + Trim(CDS_1.fieldbyname('FFID').AsString) + ',';
|
|||
|
CDS_1.Delete;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_Fin_Flow_SetStatus ');
|
|||
|
sql.Add(' @FFIDS=' + QuotedStr(FFFIDS));
|
|||
|
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_Fin_In_Bank_Flow ');
|
|||
|
sql.Add(' @FFIDS=' + QuotedStr(FFFIDS));
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<CBB3>', '<27><>ʾ');
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.btnAddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
try
|
|||
|
frmExpenseInput := TfrmExpenseInput.Create(Application);
|
|||
|
with frmExpenseInput do
|
|||
|
begin
|
|||
|
FFFID := '';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmExpenseInput.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.TBFindClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel(self.Caption, cxgrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.ToolButton5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(trim(Self.Caption), Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.btnEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_Fin_Flow_Judge ');
|
|||
|
sql.Add(' @FFIDS=' + QuotedStr(Trim(SELF.CDS_1.fieldbyname('FFID').AsString)));
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
except
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
frmExpenseInput := TfrmExpenseInput.Create(Application);
|
|||
|
with frmExpenseInput do
|
|||
|
begin
|
|||
|
FFFID := Trim(SELF.CDS_1.fieldbyname('FFID').AsString);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmExpenseInput.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.ToolButton9Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmAttachmentUpload := TfrmAttachmentUpload.Create(Application);
|
|||
|
with frmAttachmentUpload do
|
|||
|
begin
|
|||
|
if Trim(Self.CDS_1.fieldbyname('filler').AsString) = dname then
|
|||
|
FEditAuthority := True;
|
|||
|
fkeyNO := Trim(Self.CDS_1.fieldbyname('FFID').AsString);
|
|||
|
fType := 'SD';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmAttachmentUpload.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.OppCoNamePropertiesChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmExpenseList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|