2025-03-01 10:55:52 +08:00
unit U_InvoiceInList;
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,
2026-03-24 10:22:19 +08:00
cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, dxDateRanges, U_BaseList,
Vcl. Clipbrd, cxContainer, dxCore, cxDateUtils, dxSkinsCore,
dxSkinsDefaultPainters, dxScrollbarAnnotations, cxProgressBar, cxCurrencyEdit;
2025-03-01 10:55:52 +08:00
type
TfrmInvoiceInList = class( TfrmBaseList)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBClose: TToolButton;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
Panel1: TPanel;
ToolButton2: TToolButton;
ADOQueryMain: TADOQuery;
ToolButton1: TToolButton;
RM1: TRMGridReport;
RMDB_Main: TRMDBDataSet;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
cxGridLevel1: TcxGridLevel;
cxGridPopupMenu2: TcxGridPopupMenu;
DS_Invoice: TDataSource;
CDS_Invoice: TClientDataSet;
TADD: TToolButton;
TUPDATE: TToolButton;
TBDEL: TToolButton;
2026-03-09 12:49:21 +08:00
Tv1IVNo: TcxGridDBColumn;
Tv1IVDate: TcxGridDBColumn;
2025-03-01 10:55:52 +08:00
TCHK: TToolButton;
TNOCHK: TToolButton;
cxTabControl1: TcxTabControl;
TSel: TToolButton;
2026-03-09 12:49:21 +08:00
Tv1OurCoName: TcxGridDBColumn;
2025-03-01 10:55:52 +08:00
RMXLSExport1: TRMXLSExport;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
ToolButton4: TToolButton;
v1Column3: TcxGridDBColumn;
ADOQueryPrint: TADOQuery;
v1Column14: TcxGridDBColumn;
2026-03-09 12:49:21 +08:00
Tv1Amount: TcxGridDBColumn;
Tv1TaxFee: TcxGridDBColumn;
Tv1TaxAmount: TcxGridDBColumn;
2025-03-01 10:55:52 +08:00
ToolButton3: TToolButton;
N3: TMenuItem;
Tv1Column1: TcxGridDBColumn;
Label3: TLabel;
Label5: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
F_Name: TcxTextEdit;
IVNo: TcxTextEdit;
F_Spec: TcxTextEdit;
OppCoName: TcxTextEdit;
OurCoName: TcxTextEdit;
ToolButton5: TToolButton;
Label2: TLabel;
begdate: TcxDateEdit;
Enddate: TcxDateEdit;
Label4: TLabel;
2026-03-09 12:49:21 +08:00
Tv1BGDNum: TcxGridDBColumn;
Tv1SupplierShuiNo: TcxGridDBColumn;
Tv1Supplier: TcxGridDBColumn;
Tv1OurShuiNo: TcxGridDBColumn;
Tv1BillCycle: TcxGridDBColumn;
Tv1PayDate: TcxGridDBColumn;
Tv1Column2: TcxGridDBColumn;
Tv1Chker: TcxGridDBColumn;
Tv1Chktime: TcxGridDBColumn;
2026-03-24 10:22:19 +08:00
Tv1PayStatus: TcxGridDBColumn;
Tv1PayTime: TcxGridDBColumn;
TbYFK: TToolButton;
2025-03-01 10:55:52 +08:00
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) ;
2026-03-24 10:22:19 +08:00
procedure TbYFKClick( Sender: TObject) ;
procedure SaveFlowInvoice( const IVID, FFFIDs: string ) ;
2025-03-01 10:55:52 +08:00
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_InvoiceInInPut, U_LabelPrint,
2026-03-24 10:22:19 +08:00
U_AttachmentUpload, U_PayableSel;
2025-03-01 10:55:52 +08:00
{$R *.dfm}
procedure TfrmInvoiceInList. SetStatus( ) ;
begin
tchk. Visible : = false ;
tnochk. Visible : = false ;
TUPDATE. Visible : = false ;
tbdel. Visible : = false ;
2026-03-24 10:22:19 +08:00
// TbYFK.visible := False;
2025-03-01 10:55:52 +08:00
if trim( DParameters1) < > '<27> <> Ȩ<EFBFBD> <C8A8> ' then
begin
case cxTabControl1. TabIndex of
0 :
begin
TUPDATE. Visible : = true ;
tbdel. Visible : = true ;
TCHK. Visible : = true ;
2026-03-24 10:22:19 +08:00
// TbYFK.visible := true;
2025-03-01 10:55:52 +08:00
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 ;
2026-03-24 10:22:19 +08:00
// TbYFK.visible := true;
2025-03-01 10:55:52 +08:00
end ;
1 :
begin
tnochk. Visible : = true ;
end ;
2 :
begin
end ;
end ;
end ;
end ;
procedure TfrmInvoiceInList. 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)' ) ;
2026-03-24 10:22:19 +08:00
sql. Add( ',checkStatus=case when A.status = ' '0' ' then ' 'δ<> <CEB4> <EFBFBD> <EFBFBD> ' ' else ' '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ' end ' ) ;
sql. Add( ',PayStatus=(select PayStatus from Finance_Flow X where X.IVID = A.IVID ) ' ) ;
// sql.Add(',PayTime=(select PayTime from Finance_Flow X where X.IVID = A.IVID ) ');
sql. Add( ',PayTime=case when (select PayStatus from Finance_Flow X where X.IVID = A.IVID ) = ' 'δ<> <CEB4> <EFBFBD> <EFBFBD> ' ' then null else (select PayTime from Finance_Flow X where X.IVID = A.IVID ) end ' ) ;
2025-03-01 10:55:52 +08:00
sql. Add( ' from Finance_Invoice A ' ) ;
sql. add( ' where A.IVDate>=' '' + formatdatetime( 'yyyy-MM-dd' , begdate. Date) + '' ' ' ) ;
sql. Add( ' and A.IVDate<' '' + formatdateTime( 'yyyy-MM-dd' , 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 TfrmInvoiceInList. FormDestroy( Sender: TObject) ;
begin
inherited ;
// frmInvoiceXX := nil;
end ;
procedure TfrmInvoiceInList. FormClose( Sender: TObject; var Action: TCloseAction) ;
begin
inherited ;
Action : = caFree;
end ;
procedure TfrmInvoiceInList. TBCloseClick( Sender: TObject) ;
begin
Close;
end ;
procedure TfrmInvoiceInList. FormShow( Sender: TObject) ;
begin
inherited ;
ReadCxGrid( self. Caption, Tv1, '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ) ;
Enddate. Date : = SGetServerDate( ADOQueryTemp) ;
begdate. Date : = Enddate. Date - 3 0 ;
SetStatus( ) ;
InitGrid( ) ;
end ;
procedure TfrmInvoiceInList. TBRafreshClick( Sender: TObject) ;
begin
begdate. SetFocus;
InitGrid( ) ;
end ;
2026-03-24 10:22:19 +08:00
procedure TfrmInvoiceInList. TbYFKClick( Sender: TObject) ;
var
mIVId, mffIDS: string ;
begin
if CDS_Invoice. Locate( 'ssel' , True , [ ] ) = false then
begin
Application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> ѡ <EFBFBD> <D1A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_OK) ;
Exit;
end ;
try
CDS_Invoice. Locate( 'ssel' , True , [ ] ) ;
mIVId : = CDS_Invoice. fieldByName( 'IVId' ) . AsString;
with ADOQueryCmd do
begin
Close;
sql. Clear;
sql. add( ' select * from Finance_Invoice where IVId = ' + QuotedStr( Trim( mIVId) ) ) ;
Open;
end ;
frmPayableSel : = TfrmPayableSel. Create( Application) ;
with frmPayableSel do
begin
if ShowModal = 1 then
begin
with frmPayableSel. CDS_1 do
begin
self. ADOQueryCmd. Edit;
self. ADOQueryCmd. FieldByName( 'Supplier' ) . AsString : = frmPayableSel. CDS_1. FieldByName( 'OppCoName' ) . AsString;
self. ADOQueryCmd. FieldByName( 'SupplierNo' ) . AsString : = frmPayableSel. CDS_1. FieldByName( 'OppCoNo' ) . AsString;
self. ADOQueryCmd. FieldByName( 'SupplierShuiNo' ) . AsString : = frmPayableSel. CDS_1. FieldByName( 'oppShuiNo' ) . AsString;
self. ADOQueryCmd. FieldByName( 'OurCoName' ) . AsString : = frmPayableSel. CDS_1. FieldByName( 'OurCoName' ) . AsString;
self. ADOQueryCmd. FieldByName( 'OurCoNo' ) . AsString : = frmPayableSel. CDS_1. FieldByName( 'OurCoNo' ) . AsString;
self. ADOQueryCmd. FieldByName( 'OurShuiNo' ) . AsString : = frmPayableSel. CDS_1. FieldByName( 'ourShuiNo' ) . AsString;
self. ADOQueryCmd. FieldByName( 'Currency' ) . AsString : = frmPayableSel. CDS_1. FieldByName( 'Currency' ) . AsString;
self. ADOQueryCmd. FieldByName( 'BillCycle' ) . AsString : = frmPayableSel. CDS_1. FieldByName( 'BillCycle' ) . AsString;
if frmPayableSel. CDS_1. FieldByName( 'NoTaxPrice' ) . AsString < > '' then
begin
Self. ADOQueryCmd. FieldByName( 'Price' ) . value : = frmPayableSel. CDS_1. FieldByName( 'NoTaxPrice' ) . AsString;
end
else
begin
Self. ADOQueryCmd. FieldByName( 'Price' ) . value : = 0 ;
end ;
Self. ADOQueryCmd. FieldByName( 'Amount' ) . value : = frmPayableSel. FNoTaxInclude;
Self. ADOQueryCmd. FieldByName( 'TaxFee' ) . value : = frmPayableSel. FTax;
Self. ADOQueryCmd. FieldByName( 'TaxAmount' ) . value : = frmPayableSel. FTaxInclude;
self. ADOQueryCmd. FieldByName( 'fromFlow' ) . Value : = frmPayableSel. FFFIDs;
mffIDS : = frmPayableSel. FFFIDs;
self. ADOQueryCmd. Post;
end ;
end ;
end ;
finally
frmPayableSel. Free;
SaveFlowInvoice( mIVId, mffIDS) ;
end ;
end ;
procedure TfrmInvoiceInList. SaveFlowInvoice( const IVID, fffIDS: string ) ;
begin
if CDS_Invoice. IsEmpty then
Exit;
if fffIDS = '' then
Exit;
// <20> <> ʼ <EFBFBD> <CABC> <EFBFBD> <EFBFBD> <F1A3A8BC> <EFBFBD> ʹ <EFBFBD> <CAB9> ADO<44> <4F> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
ADOQueryCmd. Connection. BeginTrans;
try
CDS_Invoice. DisableControls;
// ʹ <> ò<EFBFBD> <C3B2> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ѯ
with ADOQueryCmd do
begin
Close;
SQL. Text : = 'delete from Finance_FlowInvoice where IVID = :IVID' ;
Parameters. ParamByName( 'IVID' ) . Value : = Trim( IVID) ;
ExecSQL;
Close;
SQL. Text : = 'exec P_InsertFinanceFlowInvoice @IVID = :IVID, @fffIDs = :fffIDs' ;
Parameters. ParamByName( 'IVID' ) . Value : = Trim( IVID) ;
Parameters. ParamByName( 'fffIDs' ) . Value : = Trim( fffIDS) ;
// ShowMessage(sql.Text);
ExecSQL;
end ;
CDS_Invoice. EnableControls;
ADOQueryCmd. Connection. CommitTrans; // <20> ύ<EFBFBD> <E1BDBB> <EFBFBD> <EFBFBD>
// ShowMessage('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> ɹ<EFBFBD> <C9B9> <EFBFBD> ');
except
ADOQueryCmd. Connection. RollbackTrans; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ع<EFBFBD>
raise ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ׳ <EFBFBD> <D7B3> 쳣
end ;
end ;
2025-03-01 10:55:52 +08:00
procedure TfrmInvoiceInList. 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 TfrmInvoiceInList. ToolButton3Click( Sender: TObject) ;
begin
WriteCxGrid( self. Caption, Tv1, '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ) ;
end ;
procedure TfrmInvoiceInList. ToolButton1Click( Sender: TObject) ;
begin
if ADOQueryMain. IsEmpty then
Exit;
TcxGridToExcel( self. Caption, cxgrid1) ;
end ;
procedure TfrmInvoiceInList. IVNoChange( Sender: TObject) ;
begin
ToolButton2. Click;
end ;
procedure TfrmInvoiceInList. TADDClick( Sender: TObject) ;
begin
frmInvoiceInInPut : = TfrmInvoiceInInPut. Create( self) ;
with frmInvoiceInInPut do
begin
FIVID : = '' ;
FZKType : = Self. FZKType;
if showmodal = 1 then
begin
initGrid( ) ;
end ;
free;
end ;
end ;
procedure TfrmInvoiceInList. TUPDATEClick( Sender: TObject) ;
begin
frmInvoiceInInPut : = TfrmInvoiceInInPut. Create( self) ;
with frmInvoiceInInPut 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 TfrmInvoiceInList. 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;
2026-03-24 10:22:19 +08:00
ADOQueryCmd. Connection. BeginTrans;
2025-03-01 10:55:52 +08:00
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 ;
2026-03-24 10:22:19 +08:00
with ADOQueryCmd do
begin
close;
sql. Clear;
sql. add( 'delete from Finance_FlowInvoice ' ) ;
sql. add( 'where exists(select * from [dbo].[F_Tool_SplitString](' + quotedstr( FIVIDS) + ',' ',' ') X where X.RTVALUE=Finance_FlowInvoice.IVID )' ) ;
execsql;
end ;
2025-03-01 10:55:52 +08:00
application. MessageBox( 'ɾ<> <C9BE> <EFBFBD> ɹ<EFBFBD> ' , '<27> <> ʾ ' ) ;
2026-03-24 10:22:19 +08:00
ADOQueryCmd. Connection. CommitTrans; // <20> ύ<EFBFBD> <E1BDBB> <EFBFBD> <EFBFBD>
2025-03-01 10:55:52 +08:00
except
2026-03-24 10:22:19 +08:00
ADOQueryCmd. Connection. RollbackTrans; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ع<EFBFBD>
2025-03-01 10:55:52 +08:00
application. MessageBox( 'ɾ<> <C9BE> ʧ<EFBFBD> <CAA7> ' , '<27> <> ʾ ' ) ;
InitGrid( ) ;
end ;
end ;
procedure TfrmInvoiceInList. cxTabControl1Change( Sender: TObject) ;
begin
SetStatus( ) ;
initGrid( ) ;
end ;
procedure TfrmInvoiceInList. 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 TfrmInvoiceInList. 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 TfrmInvoiceInList. TSelClick( Sender: TObject) ;
begin
frmInvoiceInInPut : = TfrmInvoiceInInPut. Create( self) ;
with frmInvoiceInInPut do
begin
TSave. Visible : = False ;
FIvID : = trim( Self. CDS_Invoice. fieldbyname( 'IvID' ) . asstring) ;
if showmodal = 1 then
begin
end ;
end ;
end ;
procedure TfrmInvoiceInList. FormCreate( Sender: TObject) ;
begin
inherited ;
canshu1 : = trim( DParameters1) ;
end ;
procedure TfrmInvoiceInList. N1Click( Sender: TObject) ;
begin
SelOKNo( CDS_Invoice, True ) ;
end ;
procedure TfrmInvoiceInList. N2Click( Sender: TObject) ;
begin
SelOKNo( CDS_Invoice, false ) ;
end ;
procedure TfrmInvoiceInList. N3Click( Sender: TObject) ;
begin
Clipboard. SetTextBuf( PChar( Trim( CDS_Invoice. fieldbyname( TV1. Controller. FocusedColumn. DataBinding. FilterFieldName) . AsString) ) ) ;
end ;
procedure TfrmInvoiceInList. 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 : = 'InvoiceIn' ;
FFiltration1 : = MIvID;
if ShowModal = 1 then
begin
// Self.InitGrid();
end ;
end ;
finally
frmLabelPrint. Free;
end ;
end ;
procedure TfrmInvoiceInList. ToolButton5Click( Sender: TObject) ;
begin
if CDS_Invoice. IsEmpty then
Exit;
try
frmAttachmentUpload : = TfrmAttachmentUpload. Create( Application) ;
with frmAttachmentUpload do
begin
2026-03-24 10:22:19 +08:00
fkeyNO : = Trim( Self. CDS_Invoice. fieldbyname( 'IVID' ) . AsString) ;
2025-03-01 10:55:52 +08:00
fType : = '<27> <> <EFBFBD> Ʊ' ;
FEditAuthority : = True ;
if ShowModal = 1 then
begin
end ;
end ;
finally
frmAttachmentUpload. Free;
end ;
end ;
procedure TfrmInvoiceInList. 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 / 1 0 0 ) ] ) ) ;
FPrice : = strtofloat( format( '%.2f' , [ FMoney / FQty] ) ) ;
end
else
begin
FPrice : = 0 ;
FMoney : = strtofloat( format( '%.2f' , [ FtaxMoney / ( 1 + Ftax / 1 0 0 ) ] ) ) ;
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 .