You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1318 lines
41 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_ch_invoice_bankdata;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, bsSkinCtrls, DB,
ADODB, ExtCtrls, RxLookup, StdCtrls, wwdbdatetimepicker, wwdblook, Menus,
Mask, bsSkinBoxCtrls, bsdbctrls,DateUtils, kbmMemTable, DBCtrlsEh,comobj,
ComCtrls, bsSkinTabs, dxDBTLCl, dxGrClms, cxDBLabel, cxControls,
cxContainer, cxEdit, cxLabel, dxGrClEx, cxCheckBox, Grids, DBGrids;
type
Tfrm_ch_invoice_bankdata = class(TForm)
PopupMenu1: TPopupMenu;
N1: TMenuItem;
bsSkinPanel3: TbsSkinPanel;
btn6_notify_exit: TbsSkinButton;
btn1_notify_search: TbsSkinButton;
btn2_notify_clear: TbsSkinButton;
bsSkinPanel4: TbsSkinPanel;
lbl14: TLabel;
bsknpnl1_m: TbsSkinPanel;
ds1_bankdata: TDataSource;
qry1_bankdata: TADOQuery;
bsknspltr1: TbsSkinSplitter;
bsknpnl1: TbsSkinPanel;
bsknpnl2: TbsSkinPanel;
bsknpnl3: TbsSkinPanel;
btn5_submit: TbsSkinButton;
ds2_bankdata_billno: TDataSource;
qry2_bankdata_billno: TADOQuery;
bsknspltr2: TbsSkinSplitter;
dxdbgrd1: TdxDBGrid;
bsknpnl4: TbsSkinPanel;
bsknpnl5: TbsSkinPanel;
dxdbgrd3_notify: TdxDBGrid;
dxdbgrdmskclmndxdbgrd3_notifyColumn1: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd3_notifyColumn2: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd3_notifyColumn3: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd3_notifyColumn4: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd3_notifyIN_ID: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd3_notifyColumn6: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd3_notifyColumn8: TdxDBGridMaskColumn;
dxdbgrdtclmndxdbgrd3_notifyColumn9: TdxDBGridDateColumn;
dxdbgrdmskclmndxdbgrd3_notifyColumn10: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd3_notifyColumn11: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd3_notifyColumn13: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd3_notifyColumn15: TdxDBGridMaskColumn;
dxdbgrdchckclmndxdbgrd3_notifyColumn17: TdxDBGridCheckColumn;
btn6_cancelMatch: TbsSkinButton;
btn3ImportExcel: TbsSkinButton;
dxdbgrd2: TdxDBGrid;
lbl1: TLabel;
lbl2: TLabel;
edt3_billNo: TEdit;
cbb1_custmer3: TRxDBLookupCombo;
lbl3: TLabel;
lbl4: TLabel;
connExcel: TADOConnection;
qry1Excel: TADOQuery;
ds1Excel: TDataSource;
btn1_unmatchedSearch: TbsSkinButton;
qry3_unmatched: TADOQuery;
ds3_unmatched: TDataSource;
lbl5: TLabel;
wdblkpcmb1_billHead: TwwDBLookupCombo;
lbl6: TLabel;
wdbdtmpckr1_billdate: TwwDBDateTimePicker;
lbl7: TLabel;
wdbdtmpckr2_billdate: TwwDBDateTimePicker;
btn2_clearSeachTJ2: TbsSkinButton;
dxdbgrdmskclmndxdbgrd2IN_ID: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column2: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column3: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column4: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column5: TdxDBGridMaskColumn;
dxdbgrdxtlkpclmndxdbgrd2Column6: TdxDBGridExtLookupColumn;
dxdbgrdmskclmndxdbgrd2Column7: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column8: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column10: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column15: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column16: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column17: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column18: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column19: TdxDBGridMaskColumn;
dxdbgrdcrncyclmndxdbgrd2Column21: TdxDBGridCurrencyColumn;
dxdbgrdmskclmndxdbgrd2Column23: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column25: TdxDBGridMaskColumn;
dxdbgrdchckclmndxdbgrd2Column26: TdxDBGridCheckColumn;
dxdbgrdmskclmndxdbgrd2Column27: TdxDBGridMaskColumn;
dxdbgrdtclmndxdbgrd2Column28: TdxDBGridDateColumn;
dxdbgrdmskclmndxdbgrd2Column30: TdxDBGridMaskColumn;
dxdbgrdchckclmndxdbgrd2Column31: TdxDBGridCheckColumn;
dxdbgrdmskclmndxdbgrd2Column32: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column34: TdxDBGridMaskColumn;
dxdbgrdtclmndxdbgrd2Column35: TdxDBGridDateColumn;
dxdbgrdmskclmndxdbgrd2Column36: TdxDBGridMaskColumn;
dxdbgrdtclmndxdbgrd2Column37: TdxDBGridDateColumn;
dxdbgrdmskclmndxdbgrd2Column38: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column39: TdxDBGridMaskColumn;
dxdbgrdchckclmndxdbgrd2Column42: TdxDBGridCheckColumn;
dxdbgrdmskclmndxdbgrd2Column43: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column44: TdxDBGridMaskColumn;
dxdbgrdchckclmndxdbgrd2Column45: TdxDBGridCheckColumn;
dxdbgrdmskclmndxdbgrd2Column46: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column47: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column48: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column49: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column53: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column54: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column55: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column56: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd2Column60: TdxDBGridMaskColumn;
dxdbgrdchckclmndxdbgrd2Column61: TdxDBGridCheckColumn;
dxdbgrdmskclmndxdbgrd2Column62: TdxDBGridMaskColumn;
dxdbgrdchckclmndxdbgrd2Column63: TdxDBGridCheckColumn;
ds_ch_invoice_head1: TDataSource;
qry_ch_invoice_head: TADOQuery;
sp_bankflow_batid: TADOStoredProc;
dxdbgrdmskclmndxdbgrd1Column1: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd1Column2: TdxDBGridMaskColumn;
dxdbgrdclmndxdbgrd1Column3: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1Column4: TdxDBGridColumn;
dxdbgrdmskclmndxdbgrd1Column5: TdxDBGridMaskColumn;
dxdbgrdmskclmndxdbgrd1Column7: TdxDBGridMaskColumn;
dxdbgrdtclmndxdbgrd1Column8: TdxDBGridDateColumn;
dxdbgrdclmndxdbgrd1Column9: TdxDBGridColumn;
dxdbgrdmskclmndxdbgrd1Column11: TdxDBGridMaskColumn;
dxdbgrdtclmndxdbgrd1Column12: TdxDBGridDateColumn;
dxdbgrdmskclmndxdbgrd1Column13: TdxDBGridMaskColumn;
btn4_autoMatch: TbsSkinButton;
dxdbgrdclmndxdbgrd1Column6: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1Column14: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1Column15: TdxDBGridColumn;
dxdbgrdchckclmnColumn16_SHFPP: TdxDBGridCheckColumn;
dxdbgrdclmndxdbgrd1Column2b: TdxDBGridColumn;
ds4_pc: TDataSource;
qry4_pc: TADOQuery;
dxdbgrdclmndxdbgrdcrncyclmndxdbgrd1Column10: TdxDBGridColumn;
dxdbgrdclmndxdbgrdcrncyclmndxdbgrd2Column20: TdxDBGridColumn;
dxdbgrdclmndxdbgrdcrncyclmndxdbgrd2Column22: TdxDBGridColumn;
dxdbgrdclmndxdbgrdcrncyclmndxdbgrd2Column52: TdxDBGridColumn;
dxdbgrdclmndxdbgrdcrncyclmndxdbgrd3_notifyColumn16: TdxDBGridColumn;
btn11: TbsSkinButton;
btn3_custprint: TbsSkinButton;
dxdbgrdclmndxdbgrdcrncyclmndxdbgrd2Column51: TdxDBGridColumn;
qry5_report: TADOQuery;
ds5_report: TDataSource;
pnl1: TPanel;
lbl9: TLabel;
lbl15_searchqdthm: TLabel;
lbl10: TLabel;
lbl8: TLabel;
wdbdtmpckr1_kc: TwwDBDateTimePicker;
wdbdtmpckr2_kc: TwwDBDateTimePicker;
edt1_kh: TEdit;
cbb1_import_BatNo: TRxDBLookupCombo;
cxchckbx1: TcxCheckBox;
lbl11: TLabel;
btn4_cancalImport: TbsSkinButton;
btn2_refreshPC: TbsSkinButton;
dxdbgrdclmndxdbgrd1Column18_pprq: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1Column19: TdxDBGridColumn;
dxdbgrdclmndxdbgrd1Column21: TdxDBGridColumn;
dxdbgrdchckclmndxdbgrdclmndxdbgrd1Column20: TdxDBGridCheckColumn;
dxdbgrdclmndxdbgrd1Column22: TdxDBGridColumn;
dxdbgrd1Column23: TdxDBGridColumn;
dxdbgrd1Column24: TdxDBGridColumn;
dxdbgrd1Column25: TdxDBGridColumn;
procedure btn4_exitClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure N1Click(Sender: TObject);
procedure btn1_notify_searchClick(Sender: TObject);
procedure MenuItem1Click(Sender: TObject);
procedure btn6_notify_exitClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure edt1_khKeyPress(Sender: TObject; var Key: Char);
procedure dxdbgrd3_notifyDblClick(Sender: TObject);
procedure btn3_notifyClick(Sender: TObject);
procedure btn2_notify_clearClick(Sender: TObject);
procedure Edit6_searchkhmchKeyPress(Sender: TObject; var Key: Char);
procedure btn5_submitClick(Sender: TObject);
procedure btn6_cancelMatchClick(Sender: TObject);
procedure btn3ImportExcelClick(Sender: TObject);
procedure btn1_unmatchedSearchClick(Sender: TObject);
procedure btn4_autoMatchClick(Sender: TObject);
procedure dxdbgrd1CustomDraw(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn;
const AText: String; AFont: TFont; var AColor: TColor; ASelected,
AFocused: Boolean; var ADone: Boolean);
procedure btn2_clearSeachTJ2Click(Sender: TObject);
procedure btn11Click(Sender: TObject);
procedure btn3_custprintClick(Sender: TObject);
procedure cbb1_import_BatNoChange(Sender: TObject);
procedure cxchckbx1PropertiesChange(Sender: TObject);
procedure btn4_cancalImportClick(Sender: TObject);
procedure btn2_refreshPCClick(Sender: TObject);
procedure dxdbgrd1Click(Sender: TObject);
procedure dxdbgrd1ChangeNode(Sender: TObject; OldNode,
Node: TdxTreeListNode);
procedure dxdbgrd1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
private
{ Private declarations }
function checkImport(fkrzh:string;jylsh:string):Boolean;
function importdata(batid:string) :Boolean;
function importdata_zhsh(batid:string;skrzh_4m:string;skrzh_4:string;bb_7:string):Boolean;
procedure UpateSeaeState(bsno,billstate:string);
procedure customerUnmatchedBill();
public
{ Public declarations }
procedure seachPrintList();
end;
var
frm_ch_invoice_bankdata: Tfrm_ch_invoice_bankdata;
implementation
uses u_main,my_sys_function,u_sys_progress;
{$R *.dfm}
procedure Tfrm_ch_invoice_bankdata.btn4_exitClick(Sender: TObject);
begin
Close;
end;
procedure Tfrm_ch_invoice_bankdata.FormShow(Sender: TObject);
var str,mblstatus:string;
begin
qry_ch_invoice_head.active:=false;
qry_ch_invoice_head.active:=true;
wdbdtmpckr1_kc.Date:=Date-1 ;
wdbdtmpckr2_kc.Date:=Date ;
Width :=width-1;
qry4_pc.Active:=False;
qry4_pc.Active:=true;
dxdbgrd3_notify.Width :=dxdbgrd3_notify.width-1;
bsSkinPanel3.Height :=34;
loadreggrid(dxdbgrd3_notify,false,caption);
loadreggrid(dxdbgrd1,false,caption+'1');
loadreggrid(dxdbgrd2,false,caption+'2');
seachPrintList();
end;
procedure Tfrm_ch_invoice_bankdata.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrd1,caption+'1');
savereggrid(dxdbgrd2,caption+'2');
savereggrid(dxdbgrd3_notify,caption);
frm_ch_invoice_bankdata.Hide;
frm_ch_invoice_bankdata.ManualFloat(frm_ch_invoice_bankdata.BoundsRect );
frm_main.freeTabs('frm_ch_invoice_bankdata');
action:=cafree;
frm_ch_invoice_bankdata:=nil;
end;
procedure Tfrm_ch_invoice_bankdata.N1Click(Sender: TObject);
begin
grid_save_xls(dxdbgrd1);
end;
procedure Tfrm_ch_invoice_bankdata.btn1_notify_searchClick(Sender: TObject);
begin
seachPrintList();
end;
/// <summary>
///
/// </summary>
procedure Tfrm_ch_invoice_bankdata.seachPrintList();
var
str:string;
begin
//
str:=' where 1=1 ';
if(cbb1_import_BatNo.DisplayValues[1]<>'') then
str:= str + ' AND <20><><EFBFBD><EFBFBD> =' + Trim(cbb1_import_BatNo.DisplayValues[1]) + ' '
else
begin
if(wdbdtmpckr1_kc.Text<>'') then
str:= str + ' AND <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>=''' + Trim(wdbdtmpckr1_kc.Text) + ''' ';
//
if(wdbdtmpckr2_kc.Text<>'') then
str:= str + ' AND <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><=''' + Trim(wdbdtmpckr2_kc.Text) + ' 23:59:59'' ';
end;
if(edt1_kh.Text<>'') then
str:= str + ' AND <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> like ''%' +stringreplace( Trim(edt1_kh.Text),'''','',[rfreplaceall]) + '%'' ';
if cxchckbx1.State= cbsChecked then
str:=str+ 'AND <20>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5>=1'
else if cxchckbx1.State=cbsunchecked then
str:=str+ 'AND isnull(<28>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5>,0)=0';
str:=' select * from t_ch_invoice_bankdata ' + str+' order by <20><><EFBFBD><EFBFBD>';
with qry1_bankdata do begin
//
Close;
SQL.Clear;
SQL.Add(str) ;
Open;
end;
qry2_bankdata_billno.active:=false;
qry2_bankdata_billno.Active:=true;
end;
procedure Tfrm_ch_invoice_bankdata.MenuItem1Click(Sender: TObject);
begin
grid_save_xls(dxdbgrd3_notify);
end;
procedure Tfrm_ch_invoice_bankdata.btn6_notify_exitClick(Sender: TObject);
begin
Close();
end;
procedure Tfrm_ch_invoice_bankdata.edt1_khKeyPress(Sender: TObject;
var Key: Char);
var
str:string;
begin
//
if key=#13 then
begin
seachPrintList();
end;
end;
procedure Tfrm_ch_invoice_bankdata.dxdbgrd3_notifyDblClick(Sender: TObject);
var
str:string;
begin
//
// str:=qry1_qdtm.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
end;
procedure Tfrm_ch_invoice_bankdata.btn3_notifyClick(Sender: TObject);
var
qdtzht,str:string;
i,noticecount:integer;
aQuery:TADOQuery;
DatabaseDateTime:TDatetime;
begin
//
{ if (dxdbgrd3_notify.SelectedCount<1) and (qry1_qdtm.Recordset.RecordCount<1) then
Exit;
str:=qry1_qdtm.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
show_qdtxx(str,2);
qry1_qdtm.Requery();
Exit;
}
end;
procedure Tfrm_ch_invoice_bankdata.btn2_notify_clearClick(Sender: TObject);
begin
wdbdtmpckr1_kc.Date:=Date-1 ;
wdbdtmpckr2_kc.Date:=Date ;
edt1_kh.Text:='';
end;
procedure Tfrm_ch_invoice_bankdata.Edit6_searchkhmchKeyPress(
Sender: TObject; var Key: Char);
begin
//<2F>س<EFBFBD><D8B3><EFBFBD>ѯִ<D1AF><D6B4>
if key=#13 then
begin
btn1_notify_searchClick(Self.btn1_notify_search);
end;
end;
/// <summary>
/// <20><><EFBFBD>ĺ<EFBFBD><C4BA>˳<EFBFBD><CBB3><EFBFBD>״̬
/// </summary>
procedure Tfrm_ch_invoice_bankdata.UpateSeaeState(bsno,billstate:string);
begin
end;
procedure Tfrm_ch_invoice_bankdata.btn5_submitClick(
Sender: TObject);
var
str,pid,xh,strinfo:string;
bank1,bank2,kh1,kh2,khead1,khead2,checkinfo,kh_name,kh_bank:string;
fpbhs,fph:string;//<2F><>ѡ<EFBFBD><D1A1>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>s
i,icount:Integer;
aQuery:TADOQuery;
blcust,blbank,blmoney,blprop:Boolean;
totalmoney,bankmoney:double;
strsql:string;
begin
if(qry1_bankdata.Recordset.RecordCount<1) then
Exit;
if( qry1_bankdata.fieldbyname('<27>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5>').AsBoolean) then
begin
Exit;
end;
pid := qry1_bankdata.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
xh:= qry1_bankdata.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
blcust:=True;
blbank:=True;
blprop:=false;
//<2F><>֤<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ψһ??,<2C><><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><CBBA>Ƿ<EFBFBD>һ<EFBFBD><D2BB>??<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>??
checkinfo:='';
fpbhs:='';
totalmoney:=0;
aQuery:=CreateAdoQuery;
aQuery.Close;
aQuery.SQL.Clear;
strsql:='INSERT INTO [t_ch_invoice_bankdata_billno] ([<5B><><EFBFBD><EFBFBD>] ,[<5B><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>],[<5B><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>],[<5B><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>]) '
+'values (%s,''%s'',1,%d);';
for i:=0 to dxdbgrd2.SelectedCount-1 do
begin
icount:= dxdbgrd2.SelectedCount;
fph:=qry3_unmatched.FieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString;
aQuery.SQL.add(Format(strsql,[xh,fph,icount]));
//
qry3_unmatched.GoTobookmark(pointer(dxdbgrd2.SelectedRows[i]));
if(blcust) then
begin
if i=0 then
begin
kh1 := qry3_unmatched.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
kh2:=kh1;
khead1:= qry3_unmatched.FieldByName('<27><>Ʊ̧ͷ').AsString;
khead2:= khead1;
end
else
begin
kh2 := qry3_unmatched.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
khead2:= qry3_unmatched.FieldByName('<27><>Ʊ̧ͷ').AsString;
end;
if kh1<>kh2 then
begin
checkinfo:=checkinfo+'<27><>ѡ<EFBFBD><D1A1>Ʊ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>Ʋ<EFBFBD>Ψһ!'+#13#10;
blcust:=False;
end;
end;
if(blcust) then
begin
if i=0 then
begin
bank1 := qry3_unmatched.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
bank2:=bank1;
end
else
begin
bank2 := qry3_unmatched.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
end;
if bank1<>bank2 then
begin
checkinfo:=checkinfo+'<27><>ѡ<EFBFBD><D1A1>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD>Ψһ!'+#13#10;
blbank:=False;
end;
end;
totalmoney:= totalmoney+ qry3_unmatched.fieldbyname('<27>ϼƽ<CFBC><C6BD><EFBFBD>').AsFloat;
if( fpbhs='') then
fpbhs:= ''''+ qry3_unmatched.FieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString +''''
else
fpbhs:= fpbhs + ','''+ qry3_unmatched.FieldByName('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsString +'''' ;
end;
if(blbank=False) or ( blcust=False) then
blprop:=True;
//
kh_name:=qry1_bankdata.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
//<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
if( khead1<>kh_name) or (khead2<>kh_name) then
begin
checkinfo:=checkinfo +'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD>뷢Ʊ<EBB7A2>еĿͻ<C4BF><CDBB><EFBFBD><EFBFBD>Ʋ<EFBFBD>һ<EFBFBD><D2BB>!' +#13#10;
blprop:=True;
end;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
kh_bank:=qry1_bankdata.fieldbyname('<27>տ<EFBFBD><D5BF>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>').AsString;
if(copy(bank1,1,4)<>copy(kh_bank,1,4)) or ( copy(bank2,1,4)<>copy(kh_bank,1,4) ) then
begin
checkinfo:=checkinfo +'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뷢Ʊ<EBB7A2>еĿ<D0B5><C4BF><EFBFBD><EFBFBD>в<EFBFBD>һ<EFBFBD><D2BB>!' +#13#10;
blprop:=True;
end;
//<2F><>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD>
bankmoney:= qry1_bankdata.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat;
if( bankmoney-totalmoney)<>0 then
begin
checkinfo:=checkinfo +format('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>׽<EFBFBD><D7BD><EFBFBD>%f<>뷢Ʊƥ<C6B1><C6A5><EFBFBD>ĺϼƽ<CFBC><C6BD><EFBFBD>%f<><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!'
,[bankmoney,totalmoney]) +#13#10;
blprop:=True;
end;
if(blprop) then
begin
strinfo:='<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ֶ<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>֧Ʊ<D6A7><C6B1><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+#13#10
+ checkinfo+#13#10
+ '<27>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ϊ'+ qry1_bankdata.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString
+'˳<><CBB3><EFBFBD><EFBFBD>Ϊ' + qry1_bankdata.fieldbyname('˳<><CBB3><EFBFBD><EFBFBD>').AsString + '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD>ֶ<EFBFBD>ƥ<EFBFBD>䷢Ʊ<E4B7A2><C6B1>?';
if(application.MessageBox(pchar(strinfo),'<27><>Ϣ<EFBFBD><CFA2>ʾ', MB_ICONQUESTION+MB_YESNO) <> ID_YES) then
Exit;
end;
aQuery.SQL.add('update t_ch_invoice set <20>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ=1 where <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD> in (' +fpbhs +'); ');
aQuery.SQL.add('update t_ch_invoice_bankdata set t_ch_invoice_bankdata.<2E>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5>=1,ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=GETDATE(),ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27>ֶ<EFBFBD>'',<2C><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD> ='''
+ stringreplace(fpbhs,'''','',[rfreplaceall]) +''',ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= ' + inttostr(icount)
+ ' where <20><><EFBFBD><EFBFBD>= ' +xh +';');
//<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> <20>ͻ<EFBFBD>ȫ<EFBFBD><C8AB> <20><>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
aQuery.SQL.Add(
Format('update t_ch_invoice_bankdata set <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=( '
+' select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_crm_client c where c.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=''%s'' '
+' or c.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>=''%s'') where <20><><EFBFBD><EFBFBD>=%s',[kh1,khead1,xh])
);
try
frm_main.db.BeginTrans;
//<2F><EFBFBD><E1BDBB><EFBFBD><EFBFBD>='';
aQuery.ExecSQL;
frm_main.db.CommitTrans;
seachPrintList();
except
on ex: Exception do
begin
frm_main.db.RollbackTrans;
Application.messagebox(pchar('<27><EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD>쳣:'+ex.Message),'<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>',MB_ICONWARNING );
end;
end;
//
end;
procedure Tfrm_ch_invoice_bankdata.btn6_cancelMatchClick(
Sender: TObject);
var
str,xh,fph,strinfo:string;
i,icount:Integer;
aQuery:TADOQuery;
begin
// <20><>ȡ<EFBFBD><EFBFBD><E1BDBB><EFBFBD><EFBFBD>ID
if(qry1_bankdata.Recordset.RecordCount<1) then
Exit;
if(not qry1_bankdata.fieldbyname('<27>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5>').AsBoolean) then
Exit;
//
aQuery:=CreateAdoQuery;
icount:=0;
//
xh:= qry1_bankdata.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
//fph:= qry2_bankdata_billno.fieldbyname('<27><>Ʊ<EFBFBD><C6B1>').AsString;
strinfo:='<27>Ƿ<EFBFBD>Ҫȡ<D2AA><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ"'+ qry1_bankdata.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString
+'"˳<><CBB3><EFBFBD><EFBFBD>Ϊ"' + qry1_bankdata.fieldbyname('˳<><CBB3><EFBFBD><EFBFBD>').AsString + '"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>?';
if(application.MessageBox(pchar(strinfo),'<27><>Ϣ<EFBFBD><CFA2>ʾ', MB_ICONQUESTION+MB_YESNO) <> ID_YES) then
Exit;
try
str:='update t_ch_invoice set <20>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ=0 where <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD> in '
+' ( select <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD> from t_ch_invoice_bankdata_billno where <20><><EFBFBD><EFBFBD>=%s); ' +#13#10
+'delete from t_ch_invoice_bankdata_billno where <20><><EFBFBD><EFBFBD>=%s;' +#13#10
+' update t_ch_invoice_bankdata set <20>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5>=0,ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=null,ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=null,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=null where <20><><EFBFBD><EFBFBD>=%s; ';
str:=format(Str,[xh,xh,xh]);
frm_main.db.BeginTrans;
//
aQuery.close;
aQuery.sql.Clear;
aQuery.SQL.Add(str);
i:= aQuery.ExecSQL;
if(i<0 ) then
showmessage(inttostr(i));
frm_main.db.CommitTrans;
seachPrintList();
except
on ex: Exception do
begin
frm_main.db.RollbackTrans;
Application.messagebox(pchar('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><EFBFBD>쳣:'+ex.Message),'<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>',MB_ICONWARNING );
end;
end;
end;
function Tfrm_ch_invoice_bankdata.checkImport(fkrzh:string;jylsh:string):Boolean;
var
str,strinfo:string;
i,noticecount:integer;
aQuery:TADOQuery;
pc,shxh:string;
begin
Result:=true;
str:='select * from t_ch_invoice_bankdata where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>=''%s'' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>=''%s''';
aQuery:=CreateAdoQuery();
with aQuery do
begin
Close;
SQL.Clear;
SQL.Add(Format(str,[fkrzh,jylsh]));
Open;
if(not IsEmpty) then
begin
First;
strinfo:='Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>]=%s<><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>=%s <20>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>,'
+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ%s<><73>˳<EFBFBD><CBB3><EFBFBD><EFBFBD>Ϊ%s<>ؼ<EFBFBD><D8BC><EFBFBD>Ϣ<EFBFBD>ظ<EFBFBD>!'+#13
+'<27><>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸<EFBFBD><CBB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ!'+ #13#10
+'<27>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ"<22><>",<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رմ<D8B1><D5B4>ڻ<EFBFBD><DABB><EFBFBD>ѡ"<22><><><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!'+ #13#10
;
pc:=fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
shxh:=fieldbyname('˳<><CBB3><EFBFBD><EFBFBD>').asstring;
if(Application.messagebox(pchar(Format(strinfo,[fkrzh,jylsh,pc,shxh]) ) ,'<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>',MB_ICONQUESTION+mb_yesno )<>id_yes) then
result:=false;
end;
Close;
end;
end;
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ
/// </summary>
procedure Tfrm_ch_invoice_bankdata.btn3ImportExcelClick(Sender: TObject);
var
Excel: OLEVariant;
ExcelVersion,filename,strSheet1name,strbatid,strtmp: string;
dlg:TOpenDialog;
i,ifieldcount,istartLine,ititle:integer;
blChineseBank,blmerchants:Boolean;
f_skrzh_4m :string;//<2F>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 7
f_skrzh_4 :string;//<2F>տ<EFBFBD><D5BF><EFBFBD><EFBFBD>˻<EFBFBD> 8
f_skrmc_5 :string;//<2F>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 9
//6
f_bb_7 :string;//<2F>ұ<EFBFBD> 12
imOK:Boolean;
begin
blChineseBank:=False;
dlg:=TOpenDialog.Create(Self);
dlg.Filter:='Excel <20>ĵ<EFBFBD>(*.xls,*.xlsx)|*.xls;*.xlsx';
if( dlg.Execute()=false) then
Exit;
qry1Excel.Close;
connExcel.Close;
filename:=dlg.filename;
try
Excel := CreateOLEObject('EXCEL.Application');
ExcelVersion := Excel.version;
Excel.WorkBooks.Open( filename);
strSheet1name:= Excel.WorkSheets[1].Name;
//edt1.Text:=strSheet1name;
finally
Excel.Quit;
Excel := UnAssigned;
end;
if ExcelVersion = '11.0' then
//Excel2003<30><33><EFBFBD><EFBFBD><EFBFBD>ڵİ汾
ConnExcel.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+
filename+';Extended Properties=excel 8.0;'+
'Persist Security Info=false;'
else //Excel2007<30><37><EFBFBD>Ժ<EFBFBD><D4BA>İ汾
ConnExcel.ConnectionString:='Provider=Microsoft.ACE.OLEDB.12.0;Data Source='+
filename+';Extended Properties=excel 12.0;'+
'Persist Security Info=True';//ע<><EFBFBD><E2B2BB>Ϊfalse
try
ConnExcel.LoginPrompt:=false;
ConnExcel.Connected:=true;
qry1Excel.Connection:=ConnExcel;
qry1Excel.close;
qry1Excel.SQL.Clear;
qry1Excel.SQL.add('select * from ['+strSheet1name+'$]');
qry1Excel.Active:=true;
ifieldcount:= qry1Excel.Recordset.Fields.Count;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(ifieldcount>=30 )then
begin
//
qry1Excel.Last;
qry1Excel.First;
i:=0;
f_skrzh_4m:='';
if(qry1Excel.Recordset.RecordCount>=9) then
with qry1Excel do
begin
for i:=0 to 12 do
begin
// strtmp:=qry1Excel.Recordset.f fields[0].asstring;
strtmp:=qry1Excel.Fields[0].AsString;
if copy(Trim(strtmp),0,8)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
ititle:=i;
blChineseBank:=True;
break;
end;
// 4<><34>
if copy(Trim(strtmp),0,4)='<27><><EFBFBD><EFBFBD>' then
begin
//ititle:=i;
f_skrzh_4m:= qry1Excel.Fields[3].AsString;
ShowMessage(strtmp);
blmerchants:=True;
// break;
end;
if copy(Trim(strtmp),0,4)='<27>ӿ<EFBFBD>' then
begin
//ititle:=i;
f_skrzh_4:= qry1Excel.Fields[5].AsString;
blmerchants:=True;
// break;
end;
if (copy(Trim(strtmp),0,4)='<27>ʻ<EFBFBD>') or (copy(Trim(strtmp),0,4)='<27>˻<EFBFBD>') then
begin
//ititle:=i;
f_bb_7:= qry1Excel.Fields[1].AsString ;
blmerchants:=True;
end;
if blmerchants and (copy(Trim(strtmp),0,6)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ) then
begin
if(f_skrzh_4m='') then
f_skrzh_4m:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·֧<C2B7><D6A7>';
break;
end;
Next;
end;
end;
end;
sp_bankflow_batid.ExecProc;
strbatid:=sp_bankflow_batid.Parameters.ParamByName('@str').value;
if(blChineseBank or blmerchants ) then
begin
try
frm_main.db.BeginTrans;
if blChineseBank then
imOK:= importdata( strbatid)
else
imOK:= importdata_zhsh(strbatid,f_skrzh_4m,f_skrzh_4,f_bb_7);
if(imOK) then
begin
frm_main.db.CommitTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>','<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION);
qry4_pc.Active:=False;
qry4_pc.Active:=true;
qry1_bankdata.Requery( );
end
else
begin
frm_main.db.RollbackTrans;
end;
except
on ex:Exception do
begin
frm_main.db.RollbackTrans;
errorlog(ex.Message);
ShowMessage('<27><>ȷ<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ȷ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+ex.Message);
end;
end;
end
else
begin
ShowMessage('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>޷<EFBFBD>ʶ<EFBFBD><CAB6>,<2C><>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>Ƿ<EFBFBD><C7B7><EFBFBD>ȷ!');
end;
//ShowMessage(IntToStr(qry1Excel.Recordset.RecordCount));
finally
qry1Excel.close();
connExcel.Close();
end;
end;
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD> Ĭ<><C4AC>
/// </summary>
function Tfrm_ch_invoice_bankdata.importdata(batid:string):Boolean;
var
empQuery:TADOQuery;
strtmp:string;
f_jylx_1 :string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0
f_fkrzh_2m :string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3
f_fkrzh_2 :string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD> 4
f_fkrmc_3 :string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5
f_skrzh_4m :string;//<2F>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 7
f_skrzh_4 :string;//<2F>տ<EFBFBD><D5BF><EFBFBD><EFBFBD>˻<EFBFBD> 8
f_skrmc_5 :string;//<2F>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 9
f_jyrq_6 :string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 10
f_jyrq_6t :string;//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> 11
f_bb_7 :string;//<2F>ұ<EFBFBD> 12
f_je_8 :string;//<2F><><EFBFBD><EFBFBD> 13
f_jylsh_9 :string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE> 17
f_jyfy_10 :string;//<2F><><EFBFBD>׸<EFBFBD><D7B8><EFBFBD> 25
f_bz_11 :string;//<2F><>ע 26
f_zy_12 :string;//<2F><>ע 23
ino:Integer;//˳<><CBB3><EFBFBD><EFBFBD>
begin
//<2F>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD>,9<><39>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
result:=False;
if(qry1Excel.IsEmpty or (qry1Excel.Recordset.RecordCount<9)) then
Exit;
//<2F><>֤<EFBFBD><D6A4>9<EFBFBD><39><EFBFBD>Ƿ<EFBFBD><C7B7>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD>
empQuery:=CreateAdoQuery();
ino:=1;
with empQuery do
begin
Close;
SQL.Clear;
SQL.Add('select * from [t_ch_invoice_bankdata] where 1=2');
Open;
while not qry1Excel.Eof do
begin
strtmp:=qry1Excel.Fields[0].AsString;
//<2F><><EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><CBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if( strtmp='<27><><EFBFBD><EFBFBD>') then
begin
f_jylx_1 :=qry1Excel.Fields[0].AsString;
f_fkrzh_2m:=qry1Excel.Fields[3].AsString;
f_fkrzh_2:=qry1Excel.Fields[4].AsString;
f_fkrmc_3:=qry1Excel.Fields[5].AsString;
f_skrzh_4m:=qry1Excel.Fields[7].AsString;
f_skrzh_4:=qry1Excel.Fields[8].AsString;
f_skrmc_5:=qry1Excel.Fields[9].AsString;
f_jyrq_6 :=qry1Excel.Fields[10].AsString;
f_jyrq_6t:=qry1Excel.Fields[11].AsString;
f_bb_7 :=qry1Excel.Fields[12].AsString;
f_je_8 :=qry1Excel.Fields[13].AsString;
f_jylsh_9:=qry1Excel.Fields[17].AsString;
f_jyfy_10:=qry1Excel.Fields[25].AsString;
f_bz_11:=qry1Excel.Fields[26].AsString;
f_zy_12:=qry1Excel.Fields[23].AsString;
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(checkImport(f_fkrzh_2,f_jylsh_9)=False) then
begin
Result:=false;
Cancel;
//Break;
Close;
qry1Excel.Close;
connExcel.Close;
Exit;
end;
Insert;
FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=batid;
FieldByName('˳<><CBB3><EFBFBD><EFBFBD>').AsInteger:=ino;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=f_jylx_1;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>').AsString:=f_fkrzh_2m;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>').AsString:=f_fkrzh_2;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=f_fkrmc_3;
FieldByName('<27>տ<EFBFBD><D5BF>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>').AsString:=f_skrzh_4m;
FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD>˺<EFBFBD>').AsString:=f_skrzh_4;
FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=f_skrmc_5;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=
EncodeDate(StrToInt(Copy(f_jyrq_6,1,4)),StrToInt(Copy(f_jyrq_6,5,2)),StrToInt(Copy(f_jyrq_6,7,2)))
+ EncodeTime(StrToInt(Copy(f_jyrq_6t,1,2)),StrToInt(Copy(f_jyrq_6t,4,2)),StrToInt(Copy(f_jyrq_6t,7,2)),0);
FieldByName('<27>ұ<EFBFBD>').AsString:=f_bb_7;
FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=StringReplace( f_je_8,',','',[rfreplaceall]);;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>').AsString:=f_jylsh_9;
FieldByName('<27><><EFBFBD>׸<EFBFBD><D7B8><EFBFBD>').AsString:=f_jyfy_10;
FieldByName('<27><>ע').AsString:=f_bz_11;
FieldByName('ժҪ').AsString:=f_zy_12;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring :=employee;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=GetDbDatetime;
ino:=ino+1;
end;
qry1Excel.next;
end;
if(empQuery.State in [ dsEdit, dsInsert] ) then
empQuery.Post;
//employeePhone :=FieldByName('<27>̶<EFBFBD><CCB6>绰').AsString;
close();
end;
// connExcel.Close;
result:=True;
end;
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
function Tfrm_ch_invoice_bankdata.importdata_zhsh(batid:string;skrzh_4m:string;skrzh_4:string;bb_7:string):Boolean;
var
empQuery:TADOQuery;
strtmp,strtmp2:string;
f_jylx_1 :string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3
f_fkrzh_2m :string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 19
f_fkrzh_2 :string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD> 17
f_fkrmc_3 :string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16
f_skrzh_4m :string;//<2F>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
f_skrzh_4 :string;//<2F>տ<EFBFBD><D5BF><EFBFBD><EFBFBD>˻<EFBFBD> 0,5
f_skrmc_5 :string;//<2F>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1,3
f_jyrq_6 :string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0
f_jyrq_6t :string;//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> 1
f_bb_7 :string;//<2F>ұ<EFBFBD> 1,1
f_je_8 :string;//<2F><><EFBFBD><EFBFBD> 13
f_jylsh_9 :string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE> 17
f_zy_10 :string;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE> 17
ino:Integer;//˳<><CBB3><EFBFBD><EFBFBD>
begin
Result:=false;
//<2F>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD>,9<><39>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(qry1Excel.IsEmpty or (qry1Excel.Recordset.RecordCount<9)) then
Exit;
//<2F><>֤<EFBFBD><D6A4>9<EFBFBD><39><EFBFBD>Ƿ<EFBFBD><C7B7>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD>
ino:=1;
// ShowMessage(IntToStr(qry1Excel.Recordset.RecordCount));
empQuery:=CreateAdoQuery();
with empQuery do
begin
Close;
SQL.Clear;
SQL.Add('select * from [t_ch_invoice_bankdata] where 1=2');
Open;
qry1Excel.First;
while not qry1Excel.Eof do
begin
strtmp:=qry1Excel.Fields[6].AsString;
strtmp2:= qry1Excel.Fields[0].AsString;
//ȡ<><C8A1>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28>ų<EFBFBD>Դ/<2F><><EFBFBD><EFBFBD>) <20>̽<EFBFBD><CCBD><EFBFBD> 2017-07-13 ='<27><><EFBFBD>ضԹ<D8B6><D4B9><EFBFBD><EFBFBD>տ<EFBFBD>') then
if( Length(strtmp2)>2) and ((copy(Trim(strtmp2),1,2)='53')) then
begin
f_jylx_1 :=strtmp;//qry1Excel.Fields[3].AsString;
f_fkrzh_2m:=qry1Excel.Fields[22].AsString;
f_fkrzh_2:=qry1Excel.Fields[20].AsString;
f_fkrmc_3:=qry1Excel.Fields[19].AsString;
f_skrzh_4m:=skrzh_4m;//qry1Excel.Fields[7].AsString;
f_skrzh_4:=skrzh_4;//qry1Excel.Fields[8].AsString;
f_skrmc_5:='ɽ<><C9BD><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD>ʴ<EFBFBD><CAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޹<EFBFBD>˾';//qry1Excel.Fields[9].AsString;
f_jyrq_6 :=qry1Excel.Fields[3].AsString;
f_jyrq_6:=StringReplace(f_jyrq_6,'-','',[rfReplaceAll]);
f_jyrq_6t:=qry1Excel.Fields[4].AsString;
f_bb_7 :=bb_7;//qry1Excel.Fields[12].AsString;
f_je_8 :=qry1Excel.Fields[8].AsString;
f_jylsh_9:=qry1Excel.Fields[11].AsString;
f_zy_10:=qry1Excel.Fields[10].AsString;
f_skrzh_4:=qry1Excel.Fields[0].AsString;
f_skrzh_4m:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·֧<C2B7><D6A7>';
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(checkImport(f_fkrzh_2,f_jylsh_9)=False) then
begin
Result:=false;
//Break;
cancel;
Close;
qry1Excel.Close;
connExcel.Close;
Exit;
end;
Insert;
FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=batid;
FieldByName('˳<><CBB3><EFBFBD><EFBFBD>').AsInteger:=ino;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=f_jylx_1;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>').AsString:=f_fkrzh_2m;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>').AsString:=f_fkrzh_2;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=f_fkrmc_3;
FieldByName('<27>տ<EFBFBD><D5BF>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>').AsString:=f_skrzh_4m;
FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD>˺<EFBFBD>').AsString:=f_skrzh_4;
FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=f_skrmc_5;
if (Length(f_jyrq_6t)=6) then begin
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=
EncodeDate(StrToInt(Copy(f_jyrq_6,1,4)),StrToInt(Copy(f_jyrq_6,5,2)),StrToInt(Copy(f_jyrq_6,7,2)))
+ EncodeTime(StrToInt(Copy(f_jyrq_6t,1,2)),StrToInt(Copy(f_jyrq_6t,3,2)),StrToInt(Copy(f_jyrq_6t,5,2)),0);
end else begin
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=
EncodeDate(StrToInt(Copy(f_jyrq_6,1,4)),StrToInt(Copy(f_jyrq_6,5,2)),StrToInt(Copy(f_jyrq_6,7,2)))
+ EncodeTime(StrToInt(Copy(f_jyrq_6t,1,2)),StrToInt(Copy(f_jyrq_6t,4,2)),StrToInt(Copy(f_jyrq_6t,7,2)),0);
end;
FieldByName('<27>ұ<EFBFBD>').AsString:=f_bb_7;
FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=StringReplace( f_je_8,',','',[rfreplaceall]);
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>').AsString:=f_jylsh_9;
FieldByName('ժҪ').AsString:=f_zy_10;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring :=employee;
FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=GetDbDatetime;
ino:=ino+1;
end;
qry1Excel.next;
end;
if(empQuery.State in [ dsEdit, dsInsert] ) then
empQuery.Post;
//employeePhone :=FieldByName('<27>̶<EFBFBD><CCB6>绰').AsString;
close();
end;
Result:=True;
end;
procedure Tfrm_ch_invoice_bankdata.btn1_unmatchedSearchClick(
Sender: TObject);
var
str:string;
begin
//
str:=' where isnull(<28>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ,0)=0 ' ;
if(cbb1_custmer3.DisplayValues[1]<>'' ) then
str:= str+' AND <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=''' +TRIM( cbb1_custmer3.DisplayValues[1]) +'''';
if(wdblkpcmb1_billHead.text<>'' ) then
str:= str+' AND <20><>Ʊ̧ͷ like''%' +TRIM( wdblkpcmb1_billHead.text) +'%''';
if wdbdtmpckr1_billdate.text<>''then
str:=str+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>>='+''''+wdbdtmpckr1_billdate.text+'''';
if wdbdtmpckr2_billdate.text<>''then
str:=str+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><='+''''+wdbdtmpckr2_billdate.text+'''';
if Trim( edt3_billNo.text)<>''then
str:=str+' AND <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD> like '+''''+'%'+ stringreplace(Trim(edt3_billNo.text),'''','''''',[rfReplaceAll]) +'%'+'''';
str:='select * from t_ch_invoice ' +str;
with qry3_unmatched do
begin
Close;sql.Clear;
sql.add(str);
Open;First;
end;
end;
procedure Tfrm_ch_invoice_bankdata.btn4_autoMatchClick(Sender: TObject);
var
str:string;
i:integer;
begin
str:='DECLARE @return_value int ' +#13#10
+'EXEC @return_value = [dbo].[p_invoice_bankflow_bill_deal] '+#13#10
+'SELECT ''Return Value'' = @return_value';
try
frm_main.db.BeginTrans;
frm_main.db.Execute(str);
frm_main.db.CommitTrans;
qry1_bankdata.Requery( );
Application.MessageBox(pchar('<27>Զ<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION);
except
on ex:Exception do
begin
frm_main.db.RollbackTrans;
Application.MessageBox(pchar('ִ<><D6B4><EFBFBD>Զ<EFBFBD>ʧ<EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+ ex.message),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONWARNING);
end;
end;
end;
procedure Tfrm_ch_invoice_bankdata.dxdbgrd1CustomDraw(Sender: TObject;
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
var
value:string;
begin
value:=ANode.Strings[dxdbgrdchckclmnColumn16_SHFPP.Index];
if value ='True' then
begin
AFont.Color:=clgreen;
end
else
AFont.Color:=clblack;
end;
procedure Tfrm_ch_invoice_bankdata.btn2_clearSeachTJ2Click(
Sender: TObject);
begin
cbb1_custmer3.DisplayValue:='';
wdblkpcmb1_billHead.text:='';
edt3_billNo.text:='';
wdbdtmpckr1_billdate.text:='';
wdbdtmpckr2_billdate.text:='';
end;
procedure Tfrm_ch_invoice_bankdata.btn11Click(Sender: TObject);
var
strpc:string;
strsql,str:string;
aQuery:TADOQuery;
i:Integer;
begin
//
strpc:='-1';
if(cbb1_import_BatNo.DisplayValues[1]<>'') then
strpc:= Trim(cbb1_import_BatNo.DisplayValues[1])
else
begin
if(qry1_bankdata.Recordset.RecordCount>0) then
strpc :=qry1_bankdata.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
end;
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ȫƥ<C8AB><C6A5>
strsql:='select sum(case when t.[<5B>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5>]=1 then 1 else 0 end) as pcount,'
+ ' sum(case when t.[<5B>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5>]=0 then 1 else 0 end) as npcount '
+ ' from t_ch_invoice_bankdata t where t.<2E><><EFBFBD><EFBFBD>= ' + strpc;
aQuery:=CreateAdoQuery;
with aQuery do
begin
Close;SQL.Clear;
SQL.Add(strsql);
Open;
if( FieldByName('npcount').AsInteger >0) then
if(Application.MessageBox('ע<><EFBFBD><E2A3BA>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>δƥ<CEB4><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>״̬<D7B4><CCAC>'
+#13#10+'<27>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ӡ<EFBFBD><D3A1>ƥ<EFBFBD><C6A5>',MB_YESNO+mb_iconwarning)<> id_yes) then
begin
close;
Exit;
end;
close;
SQL.Clear;
end;
try
frm_main.db.BeginTrans;
with aQuery do
begin
SQL.Add(format('update t_ch_invoice_bankdata set [<5B>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5>]=1,[ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]=''ǿ<><C7BF>ƥ<EFBFBD><C6A5>'' where <20><><EFBFBD><EFBFBD>=%s and ISNULL([<5B>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5>],0)=0;',[strpc]) );
SQL.Add(Format('update t_ch_invoice_bankdata set <20>Ƿ<EFBFBD><C7B7><EFBFBD>ӡ=1, <20><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>=GETDATE(),<2C><>ӡ<EFBFBD><D3A1>=''%s'' '
+'where <20><><EFBFBD><EFBFBD> =%s ;',[employee,strpc]));
i:= ExecSQL;
if(i<0) then
ShowMessage('<27><><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>¼!');
end;
frm_main.db.CommitTrans;
except
on ex:Exception do
begin
str:= '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ӡ״̬ʱ<CCAC><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+ex.Message ;
errorlog(str);
Application.MessageBox(PChar(str),'<27><><EFBFBD><EFBFBD><EFBFBD>쳣',mb_iconwarning );
end;
end;
qry5_report.Active:=False;
qry5_report.Parameters[0].Value:=strpc;
qry5_report.Active:=true;
sys_print('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ',3,ds5_report,ds1_bankdata,ds2_bankdata_billno,nil,nil,nil,nil,nil,nil,nil,nil);
seachPrintList();
end;
/// <summary>
/// <20><EFBFBD><E8B6A8>ӡ<EFBFBD><D3A1>ʽ
/// </summary>
procedure Tfrm_ch_invoice_bankdata.btn3_custprintClick(Sender: TObject);
var
strpc:string;
begin
//
strpc:='-1';
if(qry1_bankdata.Recordset.RecordCount>0) then
strpc :=qry1_bankdata.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
qry5_report.Active:=False;
qry5_report.Parameters[0].Value:=strpc;
qry5_report.Active:=true;
sys_print('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ',2,ds5_report,ds1_bankdata,ds2_bankdata_billno,nil,nil,nil,nil,nil,nil,nil,nil);
end;
procedure Tfrm_ch_invoice_bankdata.cbb1_import_BatNoChange(
Sender: TObject);
begin
seachPrintList();
end;
procedure Tfrm_ch_invoice_bankdata.cxchckbx1PropertiesChange(
Sender: TObject);
begin
seachPrintList();
end;
procedure Tfrm_ch_invoice_bankdata.btn4_cancalImportClick(Sender: TObject);
var
i:Integer;
str,pc:string;
aQuery:TADOQuery;
begin
//
if(cbb1_import_BatNo.DisplayValues[1]='') then
begin
Application.MessageBox('<27><>ѡ<EFBFBD><D1A1>Ҫȡ<D2AA><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION);
Exit;
end;
str:='select COUNT(1) as ncount from t_ch_invoice_bankdata_billno t where '
+' exists (select <20><><EFBFBD><EFBFBD> from t_ch_invoice_bankdata where <20><><EFBFBD><EFBFBD>=%s and <20><><EFBFBD><EFBFBD>= t.<2E><><EFBFBD><EFBFBD>)' ;
pc:= Trim(cbb1_import_BatNo.DisplayValues[1]);
str :=format(str ,[pc]);
aQuery:=CreateAdoQuery();
with aQuery do begin
close;SQL.Clear;
SQL.Add(str) ;
Open;
if(FieldByName('ncount').AsInteger>0) then
begin
Application.MessageBox(pchar('<27><>ѡ<EFBFBD><D1A1>Ҫȡ<D2AA><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+pc+'<27>Ѿ<EFBFBD><D1BE><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD>ķ<EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>,<2C><><EFBFBD>ܽ<EFBFBD><DCBD><EFBFBD>ȡ<EFBFBD><C8A1>!'
+#13#10 +'<27><>ȡ<EFBFBD><C8A1>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD>ٽ<EFBFBD><D9BD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!'),'<27><>Ϣ<EFBFBD><CFA2>ʾ',MB_ICONINFORMATION);
Close;
Exit;
end;
Close;
//ȡ<><C8A1>
str:=format('delete from t_ch_invoice_bankdata where <20><><EFBFBD><EFBFBD>=%s;' ,[pc]);
SQL.Clear;
SQL.Add(str);
i:=ExecSQL;
qry4_pc.Active:=False;
qry4_pc.Active:=true;
qry1_bankdata.Requery( );
end;
end;
procedure Tfrm_ch_invoice_bankdata.btn2_refreshPCClick(Sender: TObject);
begin
qry4_pc.Active:=false;
qry4_pc.Active:=True;
seachPrintList();
end;
procedure Tfrm_ch_invoice_bankdata.dxdbgrd1Click(Sender: TObject);
begin
customerUnmatchedBill();
end;
procedure Tfrm_ch_invoice_bankdata.customerUnmatchedBill();
var
str,bibie,khmch:string;
begin
if(qry1_bankdata.Recordset.RecordCount<1) then
Exit;
if(qry1_bankdata.FieldByName('<27>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5>').IsNull)
or (qry1_bankdata.FieldByName('<27>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5>').AsBoolean=False) then
begin
//
bibie:=qry1_bankdata.FieldByName('<27>ұ<EFBFBD>').AsString;
khmch:=qry1_bankdata.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Asstring;
str:='SELECT * FROM t_ch_invoice c '
+' where isnull(c.<2E>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ,0)=0 AND '
+' replace(replace(''%s'',char(9),''''),''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',''RMB'')=c.<2E>ұ<EFBFBD> '
+' and rtrim(REPLACE(''%s'',CHAR(9),'''')) in( rtrim(c.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>),'
+' replace(replace(replace(rtrim(c.<2E><>Ʊ̧ͷ),CHAR(10),''''),CHAR(13),''''),CHAR(9),''''))';
str:=Format(str,[bibie,khmch]);
with qry3_unmatched do
begin
Close;
SQL.Clear;
SQL.Add(str);
Open;
end;
end;
end;
procedure Tfrm_ch_invoice_bankdata.dxdbgrd1ChangeNode(Sender: TObject;
OldNode, Node: TdxTreeListNode);
begin
customerUnmatchedBill();
end;
procedure Tfrm_ch_invoice_bankdata.dxdbgrd1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort(Column,qry1_bankdata,'<27><><EFBFBD><EFBFBD>');
end;
end.