623 lines
16 KiB
ObjectPascal
623 lines
16 KiB
ObjectPascal
|
unit U_InvoiceOutList;
|
|||
|
|
|||
|
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, cxPC, RM_e_Xls, Menus, cxLookAndFeels,
|
|||
|
cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, dxSkinsCore,
|
|||
|
dxSkinsDefaultPainters, dxDateRanges, U_BaseList, 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
|
|||
|
TfrmInvoiceOutList = class(TfrmBaseList)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
Panel1: TPanel;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
F_Name: TcxTextEdit;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
Label3: TLabel;
|
|||
|
IVNo: TcxTextEdit;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
DS_Invoice: TDataSource;
|
|||
|
CDS_Invoice: TClientDataSet;
|
|||
|
TADD: TToolButton;
|
|||
|
TUPDATE: TToolButton;
|
|||
|
TBDEL: TToolButton;
|
|||
|
v1InvoiceNo: TcxGridDBColumn;
|
|||
|
v1InvoiceType: TcxGridDBColumn;
|
|||
|
v1InvoiceDate: TcxGridDBColumn;
|
|||
|
v1FactoryName: TcxGridDBColumn;
|
|||
|
v1note: TcxGridDBColumn;
|
|||
|
F_Spec: TcxTextEdit;
|
|||
|
Label5: TLabel;
|
|||
|
OppCoName: TcxTextEdit;
|
|||
|
TCHK: TToolButton;
|
|||
|
TNOCHK: TToolButton;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
TSel: TToolButton;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
Label7: TLabel;
|
|||
|
OurCoName: TcxTextEdit;
|
|||
|
Label8: TLabel;
|
|||
|
Label9: TLabel;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
v1Column15: TcxGridDBColumn;
|
|||
|
v1Column17: TcxGridDBColumn;
|
|||
|
v1Column18: TcxGridDBColumn;
|
|||
|
v1Column19: TcxGridDBColumn;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
N3: TMenuItem;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
frmFrameDateSel1: TfrmFrameDateSel;
|
|||
|
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 ToolButton1Click(Sender: TObject);
|
|||
|
procedure IVNoChange(Sender: TObject);
|
|||
|
procedure TADDClick(Sender: TObject);
|
|||
|
procedure TUPDATEClick(Sender: TObject);
|
|||
|
procedure TBDELClick(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure TCHKClick(Sender: TObject);
|
|||
|
procedure TNOCHKClick(Sender: TObject);
|
|||
|
procedure TSelClick(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure v1Column14PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure N3Click(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
|
|||
|
procedure InitGrid();
|
|||
|
procedure SetStatus();
|
|||
|
public
|
|||
|
FZKType, canshu1, canshu2: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
//var
|
|||
|
// frmInvoiceXX: TfrmInvoiceXX;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_InvoiceOutInPut, U_LabelPrint,
|
|||
|
U_AttachmentUpload;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.SetStatus();
|
|||
|
begin
|
|||
|
tchk.Visible := false;
|
|||
|
tnochk.Visible := false;
|
|||
|
TUPDATE.Visible := false;
|
|||
|
tbdel.Visible := false;
|
|||
|
|
|||
|
if trim(DParameters1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
begin
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
TUPDATE.Visible := true;
|
|||
|
tbdel.Visible := true;
|
|||
|
TCHK.Visible := true;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
tnochk.Visible := true;
|
|||
|
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
end;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
tchk.Visible := true;
|
|||
|
TUPDATE.Visible := true;
|
|||
|
tbdel.Visible := true;
|
|||
|
TCHK.Visible := true;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
tnochk.Visible := true;
|
|||
|
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
sql.Add(',FJFlag=CAST((CASE WHEN (SELECT COUNT(X.FileName) FROM FJ_File X where X.TFType=''<27><><EFBFBD>Ʊ'' and X.WBID=A.IVNo)>0 THEN 1 ELSE 0 END) AS BIT)');
|
|||
|
|
|||
|
sql.Add(' from Finance_Invoice A ');
|
|||
|
sql.add(' where A.IVDate>=''' + formatdatetime('yyyy-MM-dd', frmFrameDateSel1.begdate.Date) + ''' ');
|
|||
|
sql.Add(' and A.IVDate<''' + formatdateTime('yyyy-MM-dd', frmFrameDateSel1.enddate.Date + 1) + ''' ');
|
|||
|
sql.Add(' and IVFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
sql.add(' and isnull(A.Status,''0'')=''0''');
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
sql.add(' and A.Status=''9''');
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_Invoice);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_Invoice);
|
|||
|
finally
|
|||
|
TV1.DataController.Filter.Clear;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
// frmInvoiceXX := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
ReadCxGrid(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 TfrmInvoiceOutList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
frmFrameDateSel1.begdate.SetFocus;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_Invoice);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_Invoice);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(self.Caption, Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel(self.Caption, cxgrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.IVNoChange(Sender: TObject);
|
|||
|
begin
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.TADDClick(Sender: TObject);
|
|||
|
begin
|
|||
|
frmInvoiceOutInPut := TfrmInvoiceOutInPut.Create(self);
|
|||
|
with frmInvoiceOutInPut do
|
|||
|
begin
|
|||
|
FIVID := '';
|
|||
|
FZKType := Self.FZKType;
|
|||
|
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
initGrid();
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.TUPDATEClick(Sender: TObject);
|
|||
|
begin
|
|||
|
frmInvoiceOutInPut := TfrmInvoiceOutInPut.Create(self);
|
|||
|
with frmInvoiceOutInPut do
|
|||
|
begin
|
|||
|
IvNo.Enabled := False;
|
|||
|
FIVID := trim(Self.CDS_Invoice.fieldbyname('IVID').asstring);
|
|||
|
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
Self.initGrid();
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.TBDELClick(Sender: TObject);
|
|||
|
var
|
|||
|
FIVIDS: string;
|
|||
|
begin
|
|||
|
if CDS_Invoice.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
if not CDS_Invoice.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>', '<27><>ʾ', 1) = 2 then
|
|||
|
exit;
|
|||
|
with CDS_Invoice do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
while CDS_Invoice.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
FIVIDS := FIVIDS + Trim(CDS_Invoice.fieldbyname('IVID').AsString) + ',';
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
sql.Add(',getdate() ');
|
|||
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>Ʊɾ<C6B1><C9BE>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>Ʊ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Invoice.FieldByName('ivNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
|
|||
|
CDS_Invoice.Delete;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('delete from Finance_Invoice');
|
|||
|
sql.add('where IVFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.add('and exists(select * from [dbo].[F_Tool_SplitString](' + quotedstr(FIVIDS) + ','','') X where X.RTVALUE=Finance_Invoice.IVID )');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
application.MessageBox('ɾ<><C9BE><EFBFBD>ɹ<EFBFBD>', '<27><>ʾ');
|
|||
|
except
|
|||
|
application.MessageBox('ɾ<><C9BE>ʧ<EFBFBD><CAA7>', '<27><>ʾ');
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
SetStatus();
|
|||
|
initGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.TCHKClick(Sender: TObject);
|
|||
|
var
|
|||
|
FIVIDS: string;
|
|||
|
begin
|
|||
|
if CDS_Invoice.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
if not CDS_Invoice.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_Invoice do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
while CDS_Invoice.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
FIVIDS := FIVIDS + Trim(CDS_Invoice.fieldbyname('IVID').AsString) + ',';
|
|||
|
CDS_Invoice.Delete;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('update Finance_Invoice set Chker=''' + trim(DName) + ''',Chktime=getdate(),status=''9'' ');
|
|||
|
sql.add('where IVFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.add('and exists(select * from [dbo].[F_Tool_SplitString](' + quotedstr(FIVIDS) + ','','') X where X.RTVALUE=Finance_Invoice.IVID )');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3>', '<27><>ʾ');
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>', '<27><>ʾ');
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.TNOCHKClick(Sender: TObject);
|
|||
|
var
|
|||
|
FIVIDS: string;
|
|||
|
begin
|
|||
|
if CDS_Invoice.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
if not CDS_Invoice.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_Invoice do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
while CDS_Invoice.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
FIVIDS := FIVIDS + Trim(CDS_Invoice.fieldbyname('IVID').AsString) + ',';
|
|||
|
CDS_Invoice.Delete;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('update Finance_Invoice set Chker=null,Chktime=null,status=''0'' ');
|
|||
|
|
|||
|
sql.add('where IVFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.add('and exists(select * from [dbo].[F_Tool_SplitString](' + quotedstr(FIVIDS) + ','','') X where X.RTVALUE=Finance_Invoice.IVID )');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>', '<27><>ʾ');
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>', '<27><>ʾ');
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.TSelClick(Sender: TObject);
|
|||
|
begin
|
|||
|
frmInvoiceOutInPut := TfrmInvoiceOutInPut.Create(self);
|
|||
|
with frmInvoiceOutInPut do
|
|||
|
begin
|
|||
|
TSave.Visible := False;
|
|||
|
FIvID := trim(Self.CDS_Invoice.fieldbyname('IvID').asstring);
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
canshu1 := trim(DParameters1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
SelOKNo(CDS_Invoice, True);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Invoice, false);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.N3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Clipboard.SetTextBuf(PChar(Trim(CDS_Invoice.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.ToolButton4Click(Sender: TObject);
|
|||
|
var
|
|||
|
MIvID: string;
|
|||
|
begin
|
|||
|
if CDS_Invoice.IsEmpty then
|
|||
|
Exit;
|
|||
|
if CDS_Invoice.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
MIvID := '';
|
|||
|
CDS_Invoice.DisableControls;
|
|||
|
with CDS_Invoice do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while CDS_Invoice.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
|
|||
|
MIvID := MIvID + ',' + (Trim(CDS_Invoice.fieldbyname('IvID').AsString));
|
|||
|
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value := False;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Invoice.EnableControls;
|
|||
|
|
|||
|
try
|
|||
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
with frmLabelPrint do
|
|||
|
begin
|
|||
|
FLMType := 'InvoiceOut';
|
|||
|
FFiltration1 := MIvID;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
// Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLabelPrint.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.ToolButton5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Invoice.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmAttachmentUpload := TfrmAttachmentUpload.Create(Application);
|
|||
|
with frmAttachmentUpload do
|
|||
|
begin
|
|||
|
fkeyNO := Trim(Self.CDS_Invoice.fieldbyname('IVNo').AsString);
|
|||
|
fType := '<27><><EFBFBD>Ʊ';
|
|||
|
FEditAuthority := True;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmAttachmentUpload.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmInvoiceOutList.v1Column14PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
FQty, FPrice, FMoney, Ftax, FtaxMoney: double;
|
|||
|
begin
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
if Trim(mvalue) = '' then
|
|||
|
begin
|
|||
|
mvalue := '0';
|
|||
|
end;
|
|||
|
with CDS_Invoice do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := Trim(mvalue);
|
|||
|
Post;
|
|||
|
FQty := FieldbyName('Qty').AsFloat;
|
|||
|
FtaxMoney := FieldbyName('taxMoney').AsFloat;
|
|||
|
Ftax := FieldbyName('tax').AsFloat;
|
|||
|
end;
|
|||
|
if FQty <> 0 then
|
|||
|
begin
|
|||
|
|
|||
|
FMoney := strtofloat(format('%.2f', [FtaxMoney / (1 + Ftax / 100)]));
|
|||
|
FPrice := strtofloat(format('%.2f', [FMoney / FQty]));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
FPrice := 0;
|
|||
|
FMoney := strtofloat(format('%.2f', [FtaxMoney / (1 + Ftax / 100)]));
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_Invoice do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('Price').Value := FPrice;
|
|||
|
FieldByName('Money').Value := FMoney;
|
|||
|
FieldByName('TaxFee').Value := FtaxMoney - FMoney;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|