|
|
unit u_ch_bankacc;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, dxExEdtr, DB, ADODB, u_ch_add_do, u_ch_delete_do, StdCtrls,
|
|
|
DBCtrls, wwdblook, ComCtrls, bsSkinTabs, RxLookup, bsSkinCtrls,
|
|
|
bsdbctrls, Mask, dxDBGrid, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxCntner,
|
|
|
Menus, XPMenu, wwdbdatetimepicker, wwdbedit, Wwdotdot, Wwdbcomb,
|
|
|
kbmMemTable, bsSkinBoxCtrls, DBCtrlsEh,ComObj,DateUtils,inifiles;
|
|
|
|
|
|
type
|
|
|
Tfrm_ch_bankacc = class(TForm)
|
|
|
bsSkinPanel2: TbsSkinPanel;
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
cwconnect: TADOConnection;
|
|
|
tblvouitems: TADOTable;
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
tblvouitems1: TDataSource;
|
|
|
dxDBGrid1: TdxDBGrid;
|
|
|
dxDBGrid1Column1: TdxDBGridColumn;
|
|
|
dxDBGrid1Column2: TdxDBGridColumn;
|
|
|
dxDBGrid1Column3: TdxDBGridColumn;
|
|
|
dxDBGrid1Column4: TdxDBGridColumn;
|
|
|
dxDBGrid1Column5: TdxDBGridColumn;
|
|
|
dxDBGrid1Column6: TdxDBGridColumn;
|
|
|
dxDBGrid1Column7: TdxDBGridColumn;
|
|
|
dxDBGrid1Column8: TdxDBGridColumn;
|
|
|
dxDBGrid1Column9: TdxDBGridColumn;
|
|
|
dxDBGrid1Column10: TdxDBGridColumn;
|
|
|
dxDBGrid1Column11: TdxDBGridColumn;
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
OpenDialog1: TOpenDialog;
|
|
|
dxDBGrid1Column12: TdxDBGridColumn;
|
|
|
Edit1: TEdit;
|
|
|
Label1: TLabel;
|
|
|
dxDBGrid1Column13: TdxDBGridColumn;
|
|
|
Edit2: TEdit;
|
|
|
Label2: TLabel;
|
|
|
Label3: TLabel;
|
|
|
Edit3: TEdit;
|
|
|
Label4: TLabel;
|
|
|
Edit4: TEdit;
|
|
|
Label5: TLabel;
|
|
|
Edit5: TEdit;
|
|
|
Label6: TLabel;
|
|
|
Edit6: TEdit;
|
|
|
Label7: TLabel;
|
|
|
Edit7: TEdit;
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
ch_check_shen_open:boolean;
|
|
|
frm_ch_bankacc: Tfrm_ch_bankacc;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_main, u_ch_shen_query, my_sys_function, u_data_share, my_sys_chat,u_op_kuaidi_shen,
|
|
|
dmAccu, VouItemStlu;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_bankacc.FormClose(Sender: TObject;
|
|
|
var Action: TCloseAction);
|
|
|
begin
|
|
|
ch_check_shen_open:=false;
|
|
|
frm_ch_bankacc.Hide;
|
|
|
frm_ch_bankacc.ManualFloat(frm_ch_bankacc.BoundsRect );
|
|
|
frm_main.freeTabs('frm_ch_bankacc');
|
|
|
action:=cafree;
|
|
|
frm_ch_bankacc:=nil;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_ch_bankacc.FormCloseQuery(Sender: TObject;
|
|
|
var CanClose: Boolean);
|
|
|
begin
|
|
|
// CanClose:=frm_close_query(t_ch_precost);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_ch_bankacc.bsSkinButton1Click(Sender: TObject);
|
|
|
var
|
|
|
Str,source,dbffile,exepath,adbftable:String;
|
|
|
connectstr:wideString;
|
|
|
begin
|
|
|
cwconnect.Connected:=false;
|
|
|
tblvouitems.Active:=false;
|
|
|
exepath:=extractfilepath(paramstr(0))+'BANKACC.dbf';
|
|
|
if not fileexists(exepath) then begin
|
|
|
messagedlg( '<27>ӿ<EFBFBD><D3BF>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtError,[mbyes],0);
|
|
|
exit;
|
|
|
end;
|
|
|
source:=extractfilepath(exepath);
|
|
|
adbftable:=extractfilename(exepath);
|
|
|
|
|
|
connectstr:='Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source='+source+';Mode=Share Deny None;';
|
|
|
connectstr:=connectstr+'Extended Properties=dBase 5.0;Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=18;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;';
|
|
|
connectstr:=connectstr+'Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False';// 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+source+';Extended Properties=dBase 5.0;Persist Security Info=False';
|
|
|
cwconnect.ConnectionString:=connectstr;
|
|
|
tblvouitems.TableName:=adbftable;
|
|
|
cwconnect.Connected:=true;
|
|
|
tblvouitems.Active:=true;
|
|
|
|
|
|
tblVouitems.Active:=true;
|
|
|
tblVouitems.First;
|
|
|
|
|
|
while not tblVouitems.Eof do begin
|
|
|
tblvouitems.Delete;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_ch_bankacc.bsSkinButton2Click(Sender: TObject);
|
|
|
var
|
|
|
Ext,s,strdate:String;
|
|
|
ExcelTemplet:Variant;
|
|
|
i,j,itemno,jhaccdateLineno,jhacctypeLineno,jhaccdrLineno,jhacccrLineno,jhaccremarksLineno:integer;
|
|
|
M,D,Y:Word;
|
|
|
imp:boolean;
|
|
|
begin
|
|
|
i:=StrToInt(Edit2.Text);
|
|
|
jhaccdateLineno:=StrToInt(Edit3.Text);
|
|
|
jhacctypeLineno:=StrToInt(Edit4.Text);
|
|
|
jhaccdrLineno:=StrToInt(Edit5.Text);
|
|
|
jhacccrLineno:=StrToInt(Edit6.Text);
|
|
|
jhaccremarksLineno:=StrToInt(Edit7.Text);
|
|
|
if Edit1.Text='' then
|
|
|
exit;
|
|
|
if OpenDialog1.Execute then begin
|
|
|
itemno:=1;
|
|
|
Ext:=lowercase(ExtractFileExt(OpenDialog1.FileName));
|
|
|
if Ext='.xls' then begin
|
|
|
ExcelTemplet:= CreateOleObject('Excel.Application');
|
|
|
try
|
|
|
ExcelTemplet.Workbooks.Open(OpenDialog1.FileName);
|
|
|
imp:=true;
|
|
|
{
|
|
|
corp:=VartoStr(ExcelTemplet.ActiveSheet.Cells[1,1].Value);
|
|
|
if corp<>'<27>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
|
|
|
MessageDlg('ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6>˵<EFBFBD><CBB5><EFBFBD>',mtWarning,[mbYes],0);
|
|
|
imp:=false;
|
|
|
end;
|
|
|
}
|
|
|
if imp then begin
|
|
|
//I:=10;
|
|
|
while VartoStr(ExcelTemplet.ActiveSheet.Cells[I,1].Value)<>'' do
|
|
|
begin
|
|
|
//aDate:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,1].Value);
|
|
|
// ShowMessage(aDate);
|
|
|
// M:=StrToInt(COPY(adate,1,pos('-',adate)-1));
|
|
|
// D:=StrToInt(COPY(adate,pos('-',adate)+1,length(adate)-pos('-',adate)));
|
|
|
// Y:=strtoint(formatdatetime('YYYY',date));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tblVouitems.Insert;
|
|
|
|
|
|
s:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,jhaccdateLineno].Value);
|
|
|
if (pos('-',s)>0)or(pos('/',s)>0) then
|
|
|
begin
|
|
|
strdate:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,jhaccdateLineno].Value);
|
|
|
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
strdate:=Copy(s,1,4)+'-'+Copy(s,5,2)+'-'Copy(s,7,2);
|
|
|
end;
|
|
|
|
|
|
tblVouitems.FieldByName('FDATE').Value:=strdate; //ok
|
|
|
// tblVouitems.FieldByName('FPeriod').Value:=Monthof(adateTime);
|
|
|
tblVouitems.FieldByName('FACCTID').AsString:=Edit1.Text; // ok
|
|
|
|
|
|
tblVouitems.FieldByName('FCYID').AsString:='RMB'; //ok
|
|
|
tblVouitems.FieldByName('FSETTLENO').AsString:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,jhacctypeLineno].Value); //ok
|
|
|
|
|
|
tblVouitems.FieldByName('FSETTLECD').AsString:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,jhacctypeLineno].Value); //ok
|
|
|
|
|
|
if trim(VarTostr(ExcelTemplet.ActiveSheet.Cells[i,5].Value))<>'--' then
|
|
|
tblVouitems.FieldByName('FDEBIT').Value:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,jhaccdrLineno].Value); //OK
|
|
|
if trim(VarTostr(ExcelTemplet.ActiveSheet.Cells[i,6].Value))<>'--' then
|
|
|
tblVouitems.FieldByName('FCREDIT').Value:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,jhacccrLineno].Value); // OK
|
|
|
|
|
|
// if trim(VarTostr(ExcelTemplet.ActiveSheet.Cells[i,7].Value))<>'--' then
|
|
|
// tblVouitems.FieldByName('FBALANCE').Value:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,7].Value);
|
|
|
|
|
|
|
|
|
tblVouitems.FieldByName('FEXP').AsString:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,jhaccremarksLineno].Value); //OK
|
|
|
|
|
|
itemno:=itemno+1;
|
|
|
// tblVouitems.FieldByName('FNUM').AsInteger:=itemno;
|
|
|
|
|
|
// tblVouitems.FieldByName('FENTRYID').AsInteger:=1;
|
|
|
|
|
|
tblVouitems.FieldByName('FORDERID').AsInteger:=itemno; //ok
|
|
|
|
|
|
tblVouitems.FieldByName('FHANDLER').AsInteger:=0; //ok
|
|
|
|
|
|
// tblVouitems.FieldByName('FCHECKED').Value:=0;
|
|
|
// tblVouitems.FieldByName('FAUTOCHK').Value:=0;
|
|
|
// tblVouitems.FieldByName('FCLOSED').Value:=0;
|
|
|
tblVouitems.FieldByName('FPREPARER').Value:=0; //OK
|
|
|
// tblVouitems.FieldByName('FEXCHRATE').Value:=1;
|
|
|
|
|
|
tblVouitems.Post;
|
|
|
i:=i+1;
|
|
|
end;
|
|
|
end;
|
|
|
finally
|
|
|
ExcelTemplet.DisplayAlerts := false;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
ExcelTemplet.Quit;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>', mtConfirmation, [mbYes],0);
|
|
|
end;
|
|
|
procedure Tfrm_ch_bankacc.bsSkinButton5Click(Sender: TObject);
|
|
|
var
|
|
|
inifile:Tinifile;
|
|
|
begin
|
|
|
inifile:=Tinifile.Create(ExtractFilePath(application.ExeName)+'bankini.ini');
|
|
|
inifile.writestring('bankjh','jhline',Edit2.text);
|
|
|
inifile.writestring('bankjh','jhaccdate',Edit3.text);
|
|
|
inifile.writestring('bankjh','jhacctype',Edit4.text);
|
|
|
inifile.writestring('bankjh','jhaccdr',Edit5.text);
|
|
|
inifile.writestring('bankjh','jhacccr',Edit6.text);
|
|
|
inifile.writestring('bankjh','jhaccremarks',Edit7.text);
|
|
|
inifile.free;
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_bankacc.FormShow(Sender: TObject);
|
|
|
var inifile:Tinifile;
|
|
|
begin
|
|
|
inifile:=Tinifile.Create(ExtractFilePath(application.ExeName)+'bankini.ini');
|
|
|
Edit2.text:=inifile.Readstring('bankjh','jhline','1');
|
|
|
Edit3.text:=inifile.Readstring('bankjh','jhaccdate','');
|
|
|
Edit4.text:=inifile.Readstring('bankjh','jhacctype','');
|
|
|
Edit5.text:=inifile.Readstring('bankjh','jhaccdr','');
|
|
|
Edit6.text:=inifile.Readstring('bankjh','jhacccr','');
|
|
|
Edit7.text:=inifile.Readstring('bankjh','jhaccremarks','');
|
|
|
end;
|
|
|
|
|
|
end.
|
|
|
|