|
|
unit Unit1;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, DB, DBTables, StdCtrls, ADODB, ExtCtrls,inifiles, Grids, DBGrids,
|
|
|
RxMemDS, ComCtrls, Menus, DBCtrls, kbmMemTable, kbmMemBinaryStreamFormat;
|
|
|
|
|
|
type
|
|
|
TForm1 = class(TForm)
|
|
|
Database1: TDatabase;
|
|
|
busicard: TQuery;
|
|
|
Button1: TButton;
|
|
|
t_op_seae: TADOQuery;
|
|
|
Panel1: TPanel;
|
|
|
Memo1: TMemo;
|
|
|
conAdoServer: TADOConnection;
|
|
|
Panel2: TPanel;
|
|
|
Memo2: TMemo;
|
|
|
Button2: TButton;
|
|
|
DataSource1: TDataSource;
|
|
|
DBGrid1: TDBGrid;
|
|
|
t_ch_fee: TADOQuery;
|
|
|
t_ch_fee_do: TADOQuery;
|
|
|
carriage: TQuery;
|
|
|
stlitems: TQuery;
|
|
|
temp: TADOQuery;
|
|
|
p_id: TADOStoredProc;
|
|
|
p_no_get: TADOStoredProc;
|
|
|
t_sum_ctn: TRxMemoryData;
|
|
|
t_code_ctn_de: TADOQuery;
|
|
|
t_code_ctn: TADOQuery;
|
|
|
t_code_ctn_kind: TADOQuery;
|
|
|
bscntrqty: TQuery;
|
|
|
t_op_ctn: TADOQuery;
|
|
|
qrytemp: TQuery;
|
|
|
t_op_seae1: TDataSource;
|
|
|
ProgressBar1: TProgressBar;
|
|
|
Button3: TButton;
|
|
|
Button5: TButton;
|
|
|
Button6: TButton;
|
|
|
Button7: TButton;
|
|
|
t_crm_client: TADOQuery;
|
|
|
PopupMenu1: TPopupMenu;
|
|
|
N1: TMenuItem;
|
|
|
SaveDialog1: TSaveDialog;
|
|
|
t_code_fee: TADOQuery;
|
|
|
p_op_gain: TADOStoredProc;
|
|
|
qrytemp2: TQuery;
|
|
|
t_code_trade: TADOQuery;
|
|
|
t_code_source: TADOQuery;
|
|
|
t_code_source_dl: TADOQuery;
|
|
|
t_sys_employee: TADOQuery;
|
|
|
t_sys_employee1: TDataSource;
|
|
|
Button4: TButton;
|
|
|
t_sys_code: TADOQuery;
|
|
|
t_sys_code_data_all: TADOQuery;
|
|
|
t_sys_code_data: TADOQuery;
|
|
|
t_sys_code_emp: TADOQuery;
|
|
|
carriage1: TDataSource;
|
|
|
memtblDetail: TkbmMemTable;
|
|
|
kbmThreadDataSet1: TkbmThreadDataSet;
|
|
|
kbmBinaryStreamFormat1: TkbmBinaryStreamFormat;
|
|
|
t_sys_department: TADOQuery;
|
|
|
t_sys_code_sql: TADOQuery;
|
|
|
memtblDetailField: TStringField;
|
|
|
DataSource2: TDataSource;
|
|
|
t_ch_balance: TADOQuery;
|
|
|
Button8: TButton;
|
|
|
t_ch_invoice: TADOQuery;
|
|
|
invitem: TQuery;
|
|
|
DataSource3: TDataSource;
|
|
|
procedure conAdoServerBeforeConnect(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure Button2Click(Sender: TObject);
|
|
|
procedure Button1Click(Sender: TObject);
|
|
|
procedure N1Click(Sender: TObject);
|
|
|
procedure t_crm_clientAfterInsert(DataSet: TDataSet);
|
|
|
procedure Button6Click(Sender: TObject);
|
|
|
procedure Button3Click(Sender: TObject);
|
|
|
procedure Button5Click(Sender: TObject);
|
|
|
procedure Button7Click(Sender: TObject);
|
|
|
procedure Button4Click(Sender: TObject);
|
|
|
procedure Button8Click(Sender: TObject);
|
|
|
private
|
|
|
function numtoc(c:char):string;
|
|
|
Function numtoen(c:char):String;
|
|
|
Function spart(s:String;k:integer;Isnil:boolean):String ;
|
|
|
|
|
|
procedure update_ctn(table:Tadoquery);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
Function change( data:extended; mode: Boolean): String;
|
|
|
function ntoc(s:real;bool:boolean):string;
|
|
|
function get_id:string;
|
|
|
function get_no(d1:Tdatetime;no:string):string;
|
|
|
function connect_string(file_name:string):string;
|
|
|
function WeekofYear(Date: TDate): integer;
|
|
|
function getcust(custtype,custid:string):string;
|
|
|
function getemp(emptype,empid:string):string;
|
|
|
function getdept(depttype,empid:string):string;
|
|
|
function getdeptname(depttype,emp:string):string;
|
|
|
function getvessl(vslid:string):string;
|
|
|
function getsub(subtype,empid:string):string;
|
|
|
function getFeename(feeid:string):string;
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
Form1: TForm1;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
function TForm1.getFeename(feeid:string):string;
|
|
|
begin
|
|
|
if trim(feeid)='' then begin
|
|
|
result:='';
|
|
|
exit;
|
|
|
end;
|
|
|
with temp do begin
|
|
|
close;sql.Clear;
|
|
|
sql.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_code_fee where <20><><EFBFBD><EFBFBD>='''+feeid+'''');
|
|
|
open;
|
|
|
if IsEmpty then begin
|
|
|
qrytemp.close;qrytemp.SQL.Clear;
|
|
|
qrytemp.SQL.Add('select cname from accounts where accid='''+feeid+'''');
|
|
|
qrytemp.Open;
|
|
|
if not IsEmpty then begin
|
|
|
result:=qrytemp.fieldbyname('cname').AsString;
|
|
|
end else begin
|
|
|
Memo1.Lines.Add('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD>--'':'+feeid);
|
|
|
result:=feeid;
|
|
|
end;
|
|
|
end else
|
|
|
result:=Fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
function TForm1.getsub(subtype,empid:string):string;
|
|
|
begin
|
|
|
if trim(empid)='' then begin
|
|
|
result:='';
|
|
|
exit;
|
|
|
end;
|
|
|
with temp do begin
|
|
|
close;sql.Clear;
|
|
|
sql.Add('select <20>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+empid+'''');
|
|
|
open;
|
|
|
if IsEmpty then begin
|
|
|
Memo1.Lines.Add('<27>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD>--'+subtype+':'+empid);
|
|
|
result:=empid;
|
|
|
end else
|
|
|
result:=Fieldbyname('<27>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>').asstring;;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
function TForm1.getdept(depttype,empid:string):string;
|
|
|
begin
|
|
|
if trim(empid)='' then begin
|
|
|
result:='';
|
|
|
exit;
|
|
|
end;
|
|
|
with temp do begin
|
|
|
close;sql.Clear;
|
|
|
sql.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+empid+'''');
|
|
|
open;
|
|
|
if IsEmpty then begin
|
|
|
Memo1.Lines.Add('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD>--'+depttype+':'+empid);
|
|
|
result:=empid;
|
|
|
end else
|
|
|
result:=Fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function TForm1.getdeptname(depttype,emp:string):string;
|
|
|
begin
|
|
|
if trim(emp)='' then begin
|
|
|
result:='';
|
|
|
exit;
|
|
|
end;
|
|
|
with temp do begin
|
|
|
close;sql.Clear;
|
|
|
sql.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+emp+'''');
|
|
|
open;
|
|
|
if IsEmpty then begin
|
|
|
Memo1.Lines.Add('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD>--'+depttype+':'+emp);
|
|
|
result:=emp;
|
|
|
end else
|
|
|
result:=Fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;;
|
|
|
end;
|
|
|
end;
|
|
|
function TForm1.getemp(emptype, empid: string): string;
|
|
|
begin
|
|
|
if trim(empid)='' then begin
|
|
|
result:='';
|
|
|
exit;
|
|
|
end;
|
|
|
with temp do begin
|
|
|
close;sql.Clear;
|
|
|
sql.Add('select <20><><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+empid+'''');
|
|
|
open;
|
|
|
if IsEmpty then begin
|
|
|
Memo1.Lines.Add('Ա<><D4B1><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD>--'+emptype+':'+empid);
|
|
|
result:=empid;
|
|
|
end else
|
|
|
result:=Fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
function TForm1.getvessl(vslid:string):string;
|
|
|
begin
|
|
|
if trim(vslid)='' then begin
|
|
|
result:='';
|
|
|
exit;
|
|
|
end;
|
|
|
with qrytemp do begin
|
|
|
close;sql.clear;
|
|
|
sql.Add('select ename from vesselvoy where vslid='''+VSLID+'''');
|
|
|
open;
|
|
|
result:=fieldbyname('ename').AsString;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function TForm1.getcust(custtype,custid:string):string;
|
|
|
begin
|
|
|
if trim(custid)='' then begin
|
|
|
result:='';
|
|
|
exit;
|
|
|
end;
|
|
|
with temp do begin
|
|
|
qrytemp.close;qrytemp.sql.Clear;
|
|
|
qrytemp.sql.Add('select sname from customer where custid='''+custid+'''');
|
|
|
qrytemp.open;
|
|
|
Close;SQL.Clear;
|
|
|
sql.Add('select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_crm_client where <20><><EFBFBD><EFBFBD>='''+custid+'''');
|
|
|
open;
|
|
|
if IsEmpty then begin
|
|
|
if qrytemp.IsEmpty then begin
|
|
|
Memo1.Lines.Add('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD>--'+custtype+':'+custid);
|
|
|
result:=custid;
|
|
|
end else
|
|
|
result:=qrytemp.fieldbyname('sname').AsString;
|
|
|
end else
|
|
|
result:=Fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring;;
|
|
|
end;
|
|
|
end;
|
|
|
function TForm1.WeekofYear(Date: TDate): integer;
|
|
|
var
|
|
|
FirstDay, FirstWeekEnd, NowWeekEnd: TDate;
|
|
|
Year, Month, Day: word;
|
|
|
begin
|
|
|
date:=date-1;
|
|
|
DecodeDate(Date, Year, Month, Day);
|
|
|
FirstDay := EncodeDate(Year, 1, 1);
|
|
|
FirstWeekEnd := FirstDay + 7 - DayofWeek(FirstDay);
|
|
|
NowWeekEnd := Date + 7 - DayofWeek(Date);
|
|
|
Result := Round(NowWeekEnd - FirstWeekEnd) div 7 + 1;
|
|
|
end;
|
|
|
|
|
|
function TForm1.spart(s:String;k:integer;Isnil:boolean):String ;
|
|
|
var i:Integer;
|
|
|
begin
|
|
|
if s[2] <> '0' Then
|
|
|
if s[2] = '1' Then
|
|
|
begin
|
|
|
i:=strtoint(s[2]+s[3]);
|
|
|
case i of
|
|
|
10 :spart := 'ten';
|
|
|
11 :spart := 'eleven';
|
|
|
12 :spart := 'twelve';
|
|
|
13 :spart := 'thirteen';
|
|
|
14 :spart := 'fourteen';
|
|
|
15 :spart := 'fifteen';
|
|
|
16 :spart := 'sixteen';
|
|
|
17 :spart := 'seventeen';
|
|
|
18 :spart := 'eighteen';
|
|
|
19 :spart := 'nineteen'
|
|
|
end
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
case s[2] of
|
|
|
'2':spart := 'twenty';
|
|
|
'3':spart := 'thirty';
|
|
|
'4':spart := 'forty';
|
|
|
'5':spart := 'fifty';
|
|
|
'6':spart := 'sixty' ;
|
|
|
'7':spart := 'seventy';
|
|
|
'8':spart := 'eighty';
|
|
|
'9':spart := 'ninety'
|
|
|
end ;
|
|
|
if s[3] <> '0' Then
|
|
|
if k=4 then
|
|
|
result:= result + '-' + numtoen(s[3])
|
|
|
else
|
|
|
result:= result+ ' ' + numtoen(s[3])
|
|
|
end
|
|
|
else
|
|
|
result := numtoen(s[3]);
|
|
|
|
|
|
|
|
|
if result <> '' Then
|
|
|
begin
|
|
|
if s[1]<>'0' then
|
|
|
result := numtoen(s[1]) + ' hundred and ' + result
|
|
|
else
|
|
|
if Isnil=false then
|
|
|
result:=' and '+result
|
|
|
end
|
|
|
else
|
|
|
if s[1]<>'0' then
|
|
|
result := numtoen(s[1])+ ' hundred '
|
|
|
end;
|
|
|
|
|
|
function TForm1.numtoc(c:char):string;
|
|
|
var s: string;
|
|
|
begin
|
|
|
case c of
|
|
|
'0' : s:= '<27><>';
|
|
|
'1' : s:= 'Ҽ';
|
|
|
'2' : s:= '<27><>' ;
|
|
|
'3' : s:= '<27><>' ;
|
|
|
'4' : s:= '<27><>' ;
|
|
|
'5' : s:= '<27><>' ;
|
|
|
'6' : s:= '½' ;
|
|
|
'7' : s:= '<27><>' ;
|
|
|
'8' : s:= '<27><>' ;
|
|
|
'9' : s:= '<27><>' ;
|
|
|
end ;
|
|
|
numtoc:=s;
|
|
|
end;
|
|
|
function TForm1.numtoen(c:char):String;
|
|
|
var s:String;
|
|
|
begin
|
|
|
case c of
|
|
|
'0' : s:= '' ;
|
|
|
'1' : s:= 'one';
|
|
|
'2' : s:= 'two';
|
|
|
'3' : s:= 'three';
|
|
|
'4' : s:= 'four';
|
|
|
'5' : s:= 'five';
|
|
|
'6' : s:= 'six';
|
|
|
'7' : s:= 'seven';
|
|
|
'8' : s:= 'eight';
|
|
|
'9' : s:= 'nine' ;
|
|
|
end ;
|
|
|
result:=s;
|
|
|
end;
|
|
|
|
|
|
function TForm1.get_id:string;
|
|
|
begin
|
|
|
p_id.ExecProc;
|
|
|
result:=p_id.Parameters.ParamByName('str').value;
|
|
|
end;
|
|
|
|
|
|
Function TForm1.change( data:extended; mode: Boolean): String;
|
|
|
const cunit:Array[0..12] of string=('<27><>', 'Ǫ', '<27><>', 'ʰ', '<27><>', 'Ǫ', '<27><>', 'ʰ', '<27><>', 'Ǫ', '<27><>', 'ʰ', 'Բ');
|
|
|
Eunit:array[0..3] of string=(' billion ', ' million ', ' thousand ','');
|
|
|
var
|
|
|
Sint,sdec,txtdec,txtint,s,intpart,decpart:String;
|
|
|
i,jj,lentxt:Integer;
|
|
|
tt:Boolean;
|
|
|
Sth:array[1..5] of string;
|
|
|
begin
|
|
|
if data>999999999999.99 then exit;
|
|
|
If mode = false then //ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
|
|
|
begin
|
|
|
txtint:=inttostr(trunc(data));
|
|
|
txtdec:=formatfloat('00',frac(data)*100);
|
|
|
lentxt := Length(txtint);
|
|
|
for i := 1 to lentxt do
|
|
|
s:= txtint[i] + s;
|
|
|
txtint := s;
|
|
|
tt := False ;
|
|
|
jj := 0;
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
if txtint <> '0' then
|
|
|
for i := lentxt downto 1 do
|
|
|
if txtint[i] = '0' Then
|
|
|
if i = 1 then
|
|
|
Sint := Sint + cunit[12]
|
|
|
else if i = 9 then
|
|
|
Sint := Sint + cunit[4]
|
|
|
else if (i = 5) and (jj < 3) Then
|
|
|
Sint := Sint + cunit[8]
|
|
|
else if tt = False then
|
|
|
begin
|
|
|
tt := True;
|
|
|
jj := 1;
|
|
|
end
|
|
|
else
|
|
|
jj := jj + 1
|
|
|
else
|
|
|
if tt = True Then
|
|
|
begin
|
|
|
Sint := Sint + '<27><>' + numtoc(txtint[i]) + cunit[13 - i];
|
|
|
tt := False;
|
|
|
end
|
|
|
else
|
|
|
Sint := Sint + numtoc(txtint[i]) + cunit[13 - i];
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>
|
|
|
if txtdec[2] = '0' Then
|
|
|
if txtdec[1] = '0' Then
|
|
|
if Sint = '0' Then
|
|
|
result := '<27><>Բ<EFBFBD><D4B2>'
|
|
|
else
|
|
|
result := Sint + '<27><>'
|
|
|
else
|
|
|
begin
|
|
|
sdec := numtoc(txtdec[1]) + '<27><><EFBFBD><EFBFBD>';
|
|
|
result := Sint + sdec;
|
|
|
end
|
|
|
else If txtdec[1] = '0' Then
|
|
|
If Sint[2]= '0' Then
|
|
|
begin
|
|
|
sdec := numtoc(txtdec[2]) + '<27><>';
|
|
|
result:= sdec;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
sdec := '<27><>' + numtoc(txtdec[2]) + '<27><>';
|
|
|
result := Sint + sdec;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
sdec := numtoc(txtdec[1]) + '<27><>' + numtoc(txtdec[2]) + '<27><>';
|
|
|
result := Sint + sdec;
|
|
|
end
|
|
|
end
|
|
|
// Ӣ<><D3A2>ģʽ
|
|
|
else If mode = True Then
|
|
|
begin
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
txtint:=formatfloat('000000000000.00',data);
|
|
|
tt:=true;
|
|
|
for i:=1 to 4 do
|
|
|
begin
|
|
|
Sth[i]:=txtint[3*i-2]+txtint[3*i-1]+txtint[3*i];
|
|
|
if Sth[i]<>'000' then
|
|
|
begin
|
|
|
intpart:=intpart+spart(Sth[i],i,tt)+eunit[i-1];
|
|
|
tt:=false
|
|
|
end
|
|
|
end;
|
|
|
if intpart='' then
|
|
|
intpart:='zero';
|
|
|
//<2F><><EFBFBD><EFBFBD>С<EFBFBD><D0A1>
|
|
|
txtint[13]:='0';
|
|
|
sdec:=txtint[13]+txtint[14]+txtint[15];
|
|
|
decpart:=spart(sdec,1,true);
|
|
|
if decpart='' then
|
|
|
result:=intpart
|
|
|
else
|
|
|
result:=trim(intpart+' point '+decpart)
|
|
|
end
|
|
|
end;
|
|
|
|
|
|
|
|
|
function TForm1.get_no(d1:Tdatetime;no:string):string;
|
|
|
var
|
|
|
get_year,get_month,get_day:word;
|
|
|
str:string;
|
|
|
begin
|
|
|
decodedate(d1,get_year,get_month,get_day);
|
|
|
if get_month<10 then
|
|
|
str:=no+inttostr(get_year)+'0'+inttostr(get_month)
|
|
|
else
|
|
|
str:=no+inttostr(get_year)+inttostr(get_month);
|
|
|
|
|
|
p_no_get.Parameters.ParamByName('Code').value:=str;
|
|
|
p_no_get.ExecProc;
|
|
|
result:=p_no_get.Parameters.ParamByName('Num').value;
|
|
|
end;
|
|
|
|
|
|
function TForm1.ntoc(s:real;bool:boolean):string;
|
|
|
begin
|
|
|
if (s=0) and (bool=true) then
|
|
|
begin
|
|
|
result:='ZERO';
|
|
|
exit;
|
|
|
end;
|
|
|
if (s=0) and (bool=false) then
|
|
|
begin
|
|
|
result:='<27><>Ԫ<EFBFBD><D4AA>';
|
|
|
exit;
|
|
|
end;
|
|
|
result:=trim(uppercase(change(s,bool)))+' ';
|
|
|
end;
|
|
|
|
|
|
procedure TForm1.update_ctn(table:Tadoquery);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
var
|
|
|
num_ctn:integer;
|
|
|
ctn_string,str:widestring;
|
|
|
if_first:boolean;
|
|
|
str_list:Tstringlist;
|
|
|
bok:Tbookmark;
|
|
|
begin
|
|
|
|
|
|
str_list:=Tstringlist.Create();
|
|
|
t_sum_ctn.close;
|
|
|
t_sum_ctn.open;
|
|
|
bok:=table.GetBookmark;
|
|
|
t_op_seae.Edit;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>1']:=0;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>2']:=0;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>3']:=0;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>4']:=0;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>5']:=0;
|
|
|
table.DataSource.DataSet['<27><><EFBFBD><EFBFBD>6']:=0;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>7']:=0;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>8']:=0;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>9']:=0;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>10']:=0;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
t_op_seae['<27><>TEU']:=0;
|
|
|
t_op_seae['<27><>װ<EFBFBD><D7B0>']:='';
|
|
|
t_op_seae['<27>Ʒѱ<C6B7>']:='';
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д']:='';
|
|
|
table.first;
|
|
|
while not table.eof do
|
|
|
begin
|
|
|
if table.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring=t_code_ctn_de.fieldbyname('<27><><EFBFBD><EFBFBD>1').asstring then
|
|
|
begin
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>1']:=t_op_seae['<27><><EFBFBD><EFBFBD>1']+table.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger;
|
|
|
t_op_seae['<27><>TEU']:=t_op_seae['<27><>TEU']+table.fieldbyname('TEU').asinteger;
|
|
|
end
|
|
|
else if table.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring=t_code_ctn_de.fieldbyname('<27><><EFBFBD><EFBFBD>2').asstring then
|
|
|
begin
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>2']:=t_op_seae['<27><><EFBFBD><EFBFBD>2']+table.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger;
|
|
|
t_op_seae['<27><>TEU']:=t_op_seae['<27><>TEU']+table.fieldbyname('TEU').asinteger;
|
|
|
end
|
|
|
else if table.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring=t_code_ctn_de.fieldbyname('<27><><EFBFBD><EFBFBD>3').asstring then
|
|
|
begin
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>3']:=t_op_seae['<27><><EFBFBD><EFBFBD>3']+table.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger;
|
|
|
t_op_seae['<27><>TEU']:=t_op_seae['<27><>TEU']+table.fieldbyname('TEU').asinteger;
|
|
|
end
|
|
|
else if table.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring=t_code_ctn_de.fieldbyname('<27><><EFBFBD><EFBFBD>4').asstring then
|
|
|
begin
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>4']:=t_op_seae['<27><><EFBFBD><EFBFBD>4']+table.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger;
|
|
|
t_op_seae['<27><>TEU']:=t_op_seae['<27><>TEU']+table.fieldbyname('TEU').asinteger;
|
|
|
end
|
|
|
else if table.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring=t_code_ctn_de.fieldbyname('<27><><EFBFBD><EFBFBD>5').asstring then
|
|
|
begin
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>5']:=t_op_seae['<27><><EFBFBD><EFBFBD>5']+table.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger;
|
|
|
t_op_seae['<27><>TEU']:=t_op_seae['<27><>TEU']+table.fieldbyname('TEU').asinteger;
|
|
|
end
|
|
|
else if table.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring=t_code_ctn_de.fieldbyname('<27><><EFBFBD><EFBFBD>6').asstring then
|
|
|
begin
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>6']:=t_op_seae['<27><><EFBFBD><EFBFBD>6']+table.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger;
|
|
|
t_op_seae['<27><>TEU']:=t_op_seae['<27><>TEU']+table.fieldbyname('TEU').asinteger;
|
|
|
end
|
|
|
else if table.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring=t_code_ctn_de.fieldbyname('<27><><EFBFBD><EFBFBD>7').asstring then
|
|
|
begin
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>7']:=t_op_seae['<27><><EFBFBD><EFBFBD>7']+table.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger;
|
|
|
t_op_seae['<27><>TEU']:=t_op_seae['<27><>TEU']+table.fieldbyname('TEU').asinteger;
|
|
|
end
|
|
|
else if table.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring=t_code_ctn_de.fieldbyname('<27><><EFBFBD><EFBFBD>8').asstring then
|
|
|
begin
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>8']:=t_op_seae['<27><><EFBFBD><EFBFBD>8']+table.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger;
|
|
|
t_op_seae['<27><>TEU']:=t_op_seae['<27><>TEU']+table.fieldbyname('TEU').asinteger;
|
|
|
end
|
|
|
else if table.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring=t_code_ctn_de.fieldbyname('<27><><EFBFBD><EFBFBD>9').asstring then
|
|
|
begin
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>9']:=t_op_seae['<27><><EFBFBD><EFBFBD>9']+table.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger;
|
|
|
t_op_seae['<27><>TEU']:=t_op_seae['<27><>TEU']+table.fieldbyname('TEU').asinteger;
|
|
|
end
|
|
|
else if table.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring=t_code_ctn_de.fieldbyname('<27><><EFBFBD><EFBFBD>10').asstring then
|
|
|
begin
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>10']:=t_op_seae['<27><><EFBFBD><EFBFBD>10']+table.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger;
|
|
|
t_op_seae['<27><>TEU']:=t_op_seae['<27><>TEU']+table.fieldbyname('TEU').asinteger;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+table.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger;
|
|
|
t_op_seae['<27><>TEU']:=t_op_seae['<27><>TEU']+table.fieldbyname('TEU').asinteger;
|
|
|
end;
|
|
|
if not t_sum_ctn.locate('<27><><EFBFBD><EFBFBD>',table.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,[]) then
|
|
|
begin
|
|
|
t_sum_ctn.insert;
|
|
|
t_sum_ctn['<27><><EFBFBD><EFBFBD>']:=table.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
t_sum_ctn['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ']:=table.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').asstring;
|
|
|
t_sum_ctn['<27><><EFBFBD><EFBFBD>']:=table.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger;
|
|
|
t_sum_ctn.post;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_sum_ctn.edit;
|
|
|
t_sum_ctn['<27><><EFBFBD><EFBFBD>']:=t_sum_ctn['<27><><EFBFBD><EFBFBD>']+table.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger;
|
|
|
t_sum_ctn.post;
|
|
|
end;
|
|
|
table.next;
|
|
|
end;
|
|
|
|
|
|
ctn_string:='';
|
|
|
if_first:=true;
|
|
|
num_ctn:=0;
|
|
|
str:='';
|
|
|
|
|
|
t_sum_ctn.first;
|
|
|
while not t_sum_ctn.eof do
|
|
|
begin
|
|
|
if ctn_string='' then
|
|
|
begin
|
|
|
ctn_string:=t_sum_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').asstring+'*'+t_sum_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
ctn_string:=ctn_string+' '+t_sum_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').asstring+'*'+t_sum_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
end;
|
|
|
if if_first then
|
|
|
begin
|
|
|
str:=ntoc(t_sum_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat,true)+'('
|
|
|
+t_sum_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').asstring
|
|
|
+'*'+t_sum_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+')';
|
|
|
if_first:=false;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str:=str+' AND '+ntoc(t_sum_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat,true)+'('
|
|
|
+t_sum_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').asstring
|
|
|
+'*'+t_sum_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+')';
|
|
|
end;
|
|
|
num_ctn:=num_ctn+t_sum_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asinteger;
|
|
|
str_list.Add(t_sum_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').asstring+'*'+t_sum_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring
|
|
|
+'-'+t_sum_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').asstring);
|
|
|
t_sum_ctn.next;
|
|
|
end;
|
|
|
|
|
|
t_op_seae['<27><>װ<EFBFBD><D7B0>']:=ctn_string;
|
|
|
t_op_seae['<27>Ʒѱ<C6B7>']:=str_list.Text;
|
|
|
if num_ctn>1 then
|
|
|
begin
|
|
|
str:='SAY: '+str+' CONTAINERS ONLY.'
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
str:='SAY: '+str+' CONTAINER ONLY.'
|
|
|
end;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д']:=str;
|
|
|
t_op_seae.post;
|
|
|
str_list.free;
|
|
|
table.GotoBookmark(bok);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
procedure TForm1.conAdoServerBeforeConnect(Sender: TObject);
|
|
|
begin
|
|
|
conAdoServer.ConnectionString:=connect_string('server.ini');
|
|
|
|
|
|
end;
|
|
|
|
|
|
function TForm1.connect_string(file_name:string):string;
|
|
|
var
|
|
|
str:string;
|
|
|
inifile1:Tinifile;
|
|
|
begin
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(ParamStr(0))+file_name);
|
|
|
str:='';
|
|
|
str:='Provider='+inifile1.ReadString('database','Provider','');
|
|
|
str:=str+'Password='+inifile1.ReadString('database','Password','');
|
|
|
str:=str+'Persist Security Info='+inifile1.ReadString('database','Persist Security Info','');
|
|
|
str:=str+'User ID='+inifile1.ReadString('database','User ID','');
|
|
|
str:=str+'Initial Catalog='+inifile1.ReadString('database','Initial Catalog','');
|
|
|
str:=str+'Data Source='+inifile1.ReadString('database','Data Source','');
|
|
|
result:=str;
|
|
|
inifile1.Free;
|
|
|
end;
|
|
|
|
|
|
procedure TForm1.FormShow(Sender: TObject);
|
|
|
begin
|
|
|
Database1.Connected:=true;
|
|
|
conAdoServer.Connected:=true;
|
|
|
t_sys_employee.open;
|
|
|
end;
|
|
|
|
|
|
procedure TForm1.Button2Click(Sender: TObject);
|
|
|
begin
|
|
|
with busicard do begin
|
|
|
Close;sql.Clear;
|
|
|
sql.Text:=Memo2.Text;
|
|
|
open;
|
|
|
end;
|
|
|
Memo1.Lines.Add('<27><><EFBFBD><EFBFBD>'+inttostr(busicard.RecordCount)+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+datetimetostr(now));
|
|
|
end;
|
|
|
|
|
|
procedure TForm1.Button1Click(Sender: TObject);
|
|
|
var
|
|
|
i:integer;
|
|
|
str,cntr,balno,cust:string;
|
|
|
bal:double;
|
|
|
begin
|
|
|
Memo1.Lines.Add('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>'+inttostr(busicard.RecordCount)+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>ʼʱ<CABC><CAB1>'+datetimetostr(now));
|
|
|
ProgressBar1.Max:=busicard.RecordCount;
|
|
|
ProgressBar1.Position:=0;
|
|
|
t_code_ctn.open;
|
|
|
t_code_ctn_de.open;
|
|
|
t_ch_balance.Open;
|
|
|
busicard.First;
|
|
|
while not busicard.Eof do begin
|
|
|
t_ch_fee_do.close;
|
|
|
t_ch_fee.close;
|
|
|
t_op_seae.close;
|
|
|
str:=get_id;
|
|
|
t_op_seae.SQL.Text:='select * from t_op_aire where <20><><EFBFBD><EFBFBD>='''+str+'''';
|
|
|
t_op_seae.Open;
|
|
|
t_op_seae.Insert;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>']:=str;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=str;
|
|
|
if busicard.fieldbyname('etd').AsDateTime>strtodatetime('2002-01-01') then
|
|
|
t_op_seae['һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=FormatDateTime('YYYY-MM-DD',busicard.fieldbyname('ETD').AsDateTime);
|
|
|
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=t_op_seae['һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
t_op_seae['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=get_no(t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').AsDateTime,'AE');
|
|
|
t_op_seae['ί<>б<EFBFBD><D0B1><EFBFBD>']:=busicard.fieldbyname('BSNO').AsString;
|
|
|
t_op_seae['<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>']:=busicard.fieldbyname('MBLNO').AsString;
|
|
|
t_op_seae['<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>']:=busicard.fieldbyname('HBLNO').AsString;
|
|
|
if busicard.FieldByName('GOODSSTATUS').AsInteger=5 then
|
|
|
t_op_seae['ҵ<><D2B5>״̬']:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
else
|
|
|
t_op_seae['ҵ<><D2B5>״̬']:='<27><><EFBFBD><EFBFBD>ί<EFBFBD><CEAF>';
|
|
|
if busicard.FieldByName('STATUS').AsInteger=1 then
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>״̬']:='<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>'
|
|
|
else
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>״̬']:='¼<><C2BC>״̬';
|
|
|
if busicard.FieldByName('POSTED').AsString='V' then
|
|
|
t_op_seae['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='<27><><EFBFBD>ĵ<EFBFBD>'
|
|
|
else
|
|
|
t_op_seae['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='<27><>ͨ<EFBFBD><CDA8>';
|
|
|
t_op_seae['<27>ܴ<EFBFBD>']:=WeekofYear(t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').AsDateTime);
|
|
|
if busicard.fieldbyname('BSTYPE').AsString='GENERAL' then
|
|
|
t_op_seae['װ<>˷<EFBFBD>ʽ']:='<27><><EFBFBD>˵<EFBFBD>Ʊ'
|
|
|
else if busicard.fieldbyname('BSTYPE').AsString='MASTER' then
|
|
|
t_op_seae['װ<>˷<EFBFBD>ʽ']:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ'
|
|
|
else if busicard.fieldbyname('BSTYPE').AsString='LCL' then
|
|
|
t_op_seae['װ<>˷<EFBFBD>ʽ']:='<27><><EFBFBD>˷<EFBFBD>Ʊ';
|
|
|
t_op_seae['ί<>е<EFBFBD>λ']:=getcust('ί<>е<EFBFBD>λ',busicard.fieldbyname('CONTROLLERID').AsString);
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=getcust('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',busicard.fieldbyname('SHIPPERID').AsString);
|
|
|
t_op_seae['<27>ջ<EFBFBD><D5BB><EFBFBD>']:=getcust('<27>ջ<EFBFBD><D5BB><EFBFBD>',busicard.fieldbyname('CONSIGNEEID').AsString);
|
|
|
t_op_seae['֪ͨ<CDA8><D6AA>']:=getcust('֪ͨ<CDA8><D6AA>',busicard.fieldbyname('NOTIFYPARTYID').AsString);
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD>']:=busicard.fieldbyname('SHIPPER').AsString;
|
|
|
t_op_seae['<27>ջ<EFBFBD><D5BB>˴<EFBFBD><CBB4><EFBFBD>']:=busicard.fieldbyname('CONSIGNEE').AsString;
|
|
|
t_op_seae['֪ͨ<CDA8>˴<EFBFBD><CBB4><EFBFBD>']:=busicard.fieldbyname('NOTIFYPARTY').AsString;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>']:=getcust('<27><><EFBFBD><EFBFBD>',busicard.fieldbyname('DAGENTID').AsString);
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=busicard.fieldbyname('DAGENT').AsString;
|
|
|
t_op_seae['һ<>̺<EFBFBD><CCBA><EFBFBD>']:=busicard.fieldbyname('VOYNO').AsString;
|
|
|
|
|
|
t_op_seae['ʼ<><CABC><EFBFBD><EFBFBD>']:=busicard.fieldbyname('PORTLOAD').AsString;
|
|
|
t_op_seae['Ŀ<>ĸ<EFBFBD>']:=busicard.fieldbyname('PORTDISCHARGE').AsString;
|
|
|
|
|
|
t_op_seae['ǩ<><C7A9><EFBFBD>ص<EFBFBD>']:=busicard.fieldbyname('PLACEISSUE').AsString;
|
|
|
if busicard.fieldbyname('dateissue').AsDateTime>strtodatetime('2002-01-01') then
|
|
|
t_op_seae['ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=FormatDateTime('YYYY-MM-DD',busicard.fieldbyname('DATEISSUE').AsDateTime);
|
|
|
if busicard.FieldByName('MBLFRT').AsString='PP' then
|
|
|
t_op_seae['<27><><EFBFBD>ѷ<EFBFBD>ʽ']:='FREIGHT PREPAID'
|
|
|
else if busicard.FieldByName('MBLFRT').AsString='CC' then
|
|
|
t_op_seae['<27><><EFBFBD>ѷ<EFBFBD>ʽ']:='FREIGHT COLLECT';
|
|
|
|
|
|
t_op_seae['<27><>ͷ']:=busicard.fieldbyname('MARKS').AsString;
|
|
|
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>']:=busicard.fieldbyname('PKGS').Asinteger;
|
|
|
t_op_seae['<27><>λ']:=busicard.fieldbyname('KINDPKGS').AsString;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>']:=busicard.fieldbyname('GROSSWEIGHT').Asfloat;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>']:=busicard.fieldbyname('MEASUREMENT').Asfloat;
|
|
|
t_op_seae['¼<><C2BC><EFBFBD><EFBFBD>']:=getemp('¼<><C2BC><EFBFBD><EFBFBD>',busicard.fieldbyname('OPID').Asstring);
|
|
|
t_op_seae['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=FormatDateTime('YYYY-MM-DD',busicard.fieldbyname('BSDATE').AsDateTime);
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>Ա']:=getemp('<27><><EFBFBD><EFBFBD>Ա',busicard.fieldbyname('OPID').Asstring);
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=busicard.fieldbyname('SALEID').Asstring;
|
|
|
t_op_seae['<27>ͷ<EFBFBD>Ա']:=getemp('<27>ͷ<EFBFBD>Ա',busicard.fieldbyname('OPID').Asstring);
|
|
|
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>']:=busicard.fieldbyname('LANEID').Asstring;
|
|
|
t_op_seae['<27><><EFBFBD>չ<EFBFBD>˾']:=getcust('<27><><EFBFBD><EFBFBD>˾',busicard.fieldbyname('CARRIERID').AsString);
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=getcust('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',busicard.fieldbyname('CUSTBROKERID').AsString);
|
|
|
t_op_seae['<27><>ע']:=busicard.fieldbyname('REMARKS').Asstring;
|
|
|
if busicard.fieldbyname('CUSTBROKERTIME').AsDateTime>strtodatetime('2002-01-01') then
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=FormatDateTime('YYYY-MM-DD',busicard.fieldbyname('CUSTBROKERTIME').AsDateTime);
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=getdept('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',busicard.fieldbyname('OPID').Asstring);
|
|
|
t_op_seae['<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>']:=getdeptname('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>',busicard.fieldbyname('SALEID').Asstring);
|
|
|
t_op_seae['ҵ<><D2B5><EFBFBD><EFBFBD>Դ']:=busicard.fieldbyname('MARKET').Asstring;
|
|
|
t_op_seae['<27><>Դ<EFBFBD><D4B4>ϸ']:=busicard.fieldbyname('MARKETNAME').Asstring;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD>']:=0;
|
|
|
t_op_seae['<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>']:=str;
|
|
|
t_op_seae['<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>']:=str;
|
|
|
t_op_seae['ί<>б<EFBFBD>']:=str;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=str;
|
|
|
t_op_seae['<27><><EFBFBD>ر<EFBFBD>']:=str;
|
|
|
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=str;
|
|
|
t_op_seae['<27>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>']:=getsub('<27>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>',busicard.fieldbyname('OPID').Asstring);;
|
|
|
|
|
|
t_op_seae.post;
|
|
|
|
|
|
carriage.Open;
|
|
|
if carriage.RecordCount<>0 then begin
|
|
|
t_ch_fee.SQL.Text:='select * from t_ch_fee where <20><><EFBFBD><EFBFBD>='''+str+'''';
|
|
|
t_ch_fee.Open;
|
|
|
carriage.First;
|
|
|
while not carriage.Eof do begin
|
|
|
t_ch_fee.Insert;
|
|
|
t_ch_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString:=str;
|
|
|
if carriage.FieldByName('DRCR').AsString='D' then
|
|
|
t_ch_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString:='<27><>'
|
|
|
else
|
|
|
t_ch_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString:='<27><>';
|
|
|
case carriage.FieldByName('STATUS').AsInteger of
|
|
|
0:t_ch_fee.fieldbyname('<27><><EFBFBD><EFBFBD>״̬').AsString:='¼<><C2BC>״̬';
|
|
|
1:t_ch_fee.fieldbyname('<27><><EFBFBD><EFBFBD>״̬').AsString:='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>';
|
|
|
2:t_ch_fee.fieldbyname('<27><><EFBFBD><EFBFBD>״̬').AsString:='<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>';
|
|
|
3:t_ch_fee.fieldbyname('<27><><EFBFBD><EFBFBD>״̬').AsString:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
end;
|
|
|
t_ch_fee.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=getFeename(carriage.fieldbyname('ACCID').AsString);
|
|
|
if carriage.FieldByName('DRCR').AsString='D' then
|
|
|
t_ch_fee.fieldbyname('<27><><EFBFBD>㵥λ').AsString:='ί<>е<EFBFBD>λ'
|
|
|
else
|
|
|
t_ch_fee.fieldbyname('<27><><EFBFBD>㵥λ').AsString:='<27><><EFBFBD><EFBFBD>˾';
|
|
|
cust:=getcust('<27><><EFBFBD>ÿͻ<C3BF><CDBB><EFBFBD><EFBFBD><EFBFBD>',carriage.fieldbyname('OBJID').AsString);
|
|
|
t_ch_fee['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=cust;
|
|
|
t_ch_fee['<27><>']:=carriage.fieldbyname('RTUNIT').AsString;
|
|
|
t_ch_fee['<27><><EFBFBD><EFBFBD>']:=carriage.fieldbyname('RTPRICE').Asfloat;
|
|
|
t_ch_fee['<27><><EFBFBD><EFBFBD>']:=carriage.fieldbyname('RT').Asfloat;
|
|
|
t_ch_fee['<27><><EFBFBD><EFBFBD>']:=carriage.fieldbyname('ACCAMT_L').Asfloat;
|
|
|
if (carriage.fieldbyname('FCURRID').AsString='') or (carriage.fieldbyname('FCURRID').AsString='RMB') then begin
|
|
|
t_ch_fee['<27>ұ<EFBFBD>']:='RMB';
|
|
|
t_ch_fee['<27><><EFBFBD><EFBFBD>']:=1;
|
|
|
end else begin
|
|
|
t_ch_fee['<27>ұ<EFBFBD>']:=carriage.fieldbyname('FCURRID').AsString;
|
|
|
t_ch_fee['<27><><EFBFBD><EFBFBD>']:=carriage.fieldbyname('USDEXRATE').Asfloat;
|
|
|
end;
|
|
|
t_ch_fee['<27><>ע']:=carriage.fieldbyname('COMMENT').AsString;
|
|
|
t_ch_fee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=carriage.fieldbyname('STLAMT_L').Asfloat;
|
|
|
t_ch_fee['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']:=0;
|
|
|
t_ch_fee['¼<><C2BC><EFBFBD><EFBFBD>']:=getemp('¼<><C2BC><EFBFBD><EFBFBD>',carriage.fieldbyname('INPUTBY').Asstring);
|
|
|
t_ch_fee['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=FormatDateTime('YYYY-MM-DD',carriage.fieldbyname('INPUTDATE').AsDatetime);
|
|
|
t_ch_fee['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
t_ch_fee['<27>Ƿ<C7B7>']:=0;
|
|
|
t_ch_fee['<27>Ƿ<EFBFBD><C7B7>渶']:=0;
|
|
|
t_ch_fee['<27><><EFBFBD><EFBFBD>']:=0;
|
|
|
t_ch_fee['<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>']:=0;
|
|
|
t_ch_fee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
t_ch_fee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ']:=0;
|
|
|
t_ch_fee.post;
|
|
|
|
|
|
if carriage.FieldByName('STLAMT_L').AsFloat<>0 then begin
|
|
|
stlitems.open;
|
|
|
stlitems.First;
|
|
|
t_ch_fee_do.Open;
|
|
|
while not stlitems.Eof do begin
|
|
|
t_ch_fee_do.insert;
|
|
|
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=3;
|
|
|
bal:=stlitems.fieldbyname('STLRMBDEBIT').AsFloat+stlitems.fieldbyname('STLRMBCREDIT').AsFloat+stlitems.fieldbyname('STLUSDDEBIT').AsFloat+stlitems.fieldbyname('STLUSDCREDIT').AsFloat;
|
|
|
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=bal;
|
|
|
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=bal;
|
|
|
if (carriage.fieldbyname('FCURRID').AsString='') or (carriage.fieldbyname('FCURRID').AsString='RMB') then
|
|
|
t_ch_fee_do['<27>ұ<EFBFBD>']:='RMB'
|
|
|
else
|
|
|
t_ch_fee_do['<27>ұ<EFBFBD>']:=carriage.fieldbyname('FCURRID').AsString;
|
|
|
t_ch_fee_do['CH_ID']:=t_ch_fee['CH_ID'];
|
|
|
t_ch_fee_do['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=str;
|
|
|
if t_ch_balance.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',VarArrayOf([cust,FormatDateTime('YYYY-MM-DD',stlitems.fieldbyname('stldate').AsDatetime)]),[]) then begin
|
|
|
balno:=t_ch_balance['<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
t_ch_balance.edit;
|
|
|
if (carriage.fieldbyname('FCURRID').AsString='') or (carriage.fieldbyname('FCURRID').AsString='RMB') then begin
|
|
|
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>']:=t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>']+bal;
|
|
|
end else begin
|
|
|
t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']:=t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']+bal;
|
|
|
end;
|
|
|
t_ch_balance.post;
|
|
|
end else begin
|
|
|
t_ch_balance.insert;
|
|
|
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='<27><><EFBFBD><EFBFBD>';
|
|
|
t_ch_balance['<27>ʵ<EFBFBD>״̬']:='¼<><C2BC>״̬';
|
|
|
t_ch_balance['<27><><EFBFBD>㷽ʽ']:=stlitems.fieldbyname('STLMODE').AsString;
|
|
|
t_ch_balance['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=cust;
|
|
|
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=getemp('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',stlitems.fieldbyname('OPNAME').Asstring);
|
|
|
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=FormatDateTime('YYYY-MM-DD',stlitems.fieldbyname('stldate').AsDatetime);
|
|
|
t_ch_balance['<27>Զ<EFBFBD>']:=1;
|
|
|
t_ch_balance['<27><><EFBFBD><EFBFBD>']:=0;
|
|
|
if carriage.FieldByName('DRCR').AsString='D' then begin
|
|
|
balno:=get_no(t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'],'BA');
|
|
|
t_ch_balance['<27><><EFBFBD><EFBFBD>']:='<27><>';
|
|
|
end else begin
|
|
|
balno:=get_no(t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'],'BP');
|
|
|
t_ch_balance['<27><><EFBFBD><EFBFBD>']:='<27><>';
|
|
|
end;
|
|
|
if (carriage.fieldbyname('FCURRID').AsString='') or (carriage.fieldbyname('FCURRID').AsString='RMB') then begin
|
|
|
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>']:=bal;
|
|
|
t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']:=0;
|
|
|
end else begin
|
|
|
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>']:=0;
|
|
|
t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']:=bal;
|
|
|
end;
|
|
|
t_ch_balance['<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>']:=balno;
|
|
|
t_ch_balance.post;
|
|
|
end;
|
|
|
t_ch_fee_do['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=balno;
|
|
|
t_ch_fee_do.Post;
|
|
|
stlitems.Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
carriage.Next;
|
|
|
end;
|
|
|
p_op_gain.Parameters.ParamByName('@con_no').value:=str;
|
|
|
p_op_gain.ExecProc;
|
|
|
Memo1.Lines.Add(busicard.fieldbyname('BSNO').AsString+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>')
|
|
|
end;
|
|
|
ProgressBar1.StepIt;
|
|
|
busicard.Next;
|
|
|
end;
|
|
|
|
|
|
Memo1.Lines.Add('ȫ<><C8AB>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'+datetimetostr(now));
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
|
|
|
procedure TForm1.N1Click(Sender: TObject);
|
|
|
begin
|
|
|
if SaveDialog1.Execute then
|
|
|
Memo1.Lines.SaveToFile(SaveDialog1.FileName);
|
|
|
end;
|
|
|
|
|
|
procedure TForm1.t_crm_clientAfterInsert(DataSet: TDataSet);
|
|
|
begin
|
|
|
t_crm_client['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:='<27><><EFBFBD><EFBFBD>';
|
|
|
t_crm_client['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='Լ<><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
// t_crm_client['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure TForm1.Button6Click(Sender: TObject);
|
|
|
begin
|
|
|
with temp do begin
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_code_fee');
|
|
|
ExecSQL;
|
|
|
end;
|
|
|
|
|
|
t_code_fee.open;
|
|
|
with qrytemp do begin
|
|
|
Close;sql.Clear;
|
|
|
sql.Add('select * from accounts');
|
|
|
open;
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if not t_code_fee.Locate('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',fieldbyname('CNAME').AsString,[]) then begin
|
|
|
t_code_fee.Insert;
|
|
|
t_code_fee['<27><><EFBFBD><EFBFBD>']:=fieldbyname('AccID').AsString;
|
|
|
t_code_fee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=fieldbyname('CNAME').AsString;
|
|
|
t_code_fee['Ӣ<><D3A2><EFBFBD><EFBFBD>']:=fieldbyname('ENAME').AsString;
|
|
|
t_code_fee['Ĭ<>ϱұ<CFB1>']:=fieldbyname('CURRID').AsString;
|
|
|
t_code_fee['<27><><EFBFBD><EFBFBD>']:=1;
|
|
|
t_code_fee['<27><><EFBFBD><EFBFBD>']:=1;
|
|
|
t_code_fee['<27><>']:='';
|
|
|
t_code_fee.post;
|
|
|
end;
|
|
|
next;
|
|
|
end;
|
|
|
end;
|
|
|
t_code_fee.close;
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
procedure TForm1.Button3Click(Sender: TObject);
|
|
|
begin
|
|
|
t_sys_employee.First;
|
|
|
with temp do begin
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_crm_client_link');
|
|
|
ExecSQL;
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_crm_client_linkman');
|
|
|
ExecSQL;
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_crm_client_contract');
|
|
|
ExecSQL;
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_crm_client_limited');
|
|
|
ExecSQL;
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_crm_client_trade');
|
|
|
ExecSQL;
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_crm_client');
|
|
|
ExecSQL;
|
|
|
end;
|
|
|
t_crm_client.open;
|
|
|
with qrytemp do begin
|
|
|
Close;sql.Clear;
|
|
|
sql.Add('select * from customer');
|
|
|
open;
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if (not t_crm_client.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',fieldbyname('SNAME').AsString,[])) and (not t_crm_client.Locate('<27><><EFBFBD><EFBFBD>',fieldbyname('CUSTID').AsString,[])) then begin
|
|
|
t_crm_client.Insert;
|
|
|
t_crm_client['<27><><EFBFBD><EFBFBD>']:=fieldbyname('CUSTID').AsString;
|
|
|
t_crm_client['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=fieldbyname('SNAME').AsString;
|
|
|
t_crm_client['<27>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>']:=fieldbyname('CNAME').AsString;
|
|
|
t_crm_client['ͨѶ<CDA8><D1B6>ַ']:=fieldbyname('ADDR').AsString;
|
|
|
t_crm_client['<27><><EFBFBD><EFBFBD>']:=fieldbyname('EMAIL').AsString;
|
|
|
t_crm_client['<27>绰']:=fieldbyname('TEL').AsString;
|
|
|
t_crm_client['<27><><EFBFBD><EFBFBD>']:=fieldbyname('FAX').AsString;
|
|
|
t_crm_client['¼<><C2BC><EFBFBD><EFBFBD>']:=t_sys_employee['<27><><EFBFBD><EFBFBD>'];
|
|
|
t_crm_client['<27><><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>']:=fieldbyname('SUMMARY').AsString;
|
|
|
qrytemp2.close;qrytemp2.sql.Clear;
|
|
|
qrytemp2.SQL.Add('select * from custtype where custtype='''+fieldbyname('CUSTTYPE').AsString+'''');
|
|
|
qrytemp2.Open;
|
|
|
if qrytemp2.FieldByName('SHIPPERID').AsString='T' then
|
|
|
t_crm_client['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=1;
|
|
|
if qrytemp2.FieldByName('CONSIGNEEID').AsString='T' then
|
|
|
t_crm_client['<27>ջ<EFBFBD><D5BB><EFBFBD>']:=1;
|
|
|
if qrytemp2.FieldByName('NOTIFYPARTYID').AsString='T' then
|
|
|
t_crm_client['֪ͨ<CDA8><D6AA>']:=1;
|
|
|
if qrytemp2.FieldByName('CARRIERID').AsString='T' then
|
|
|
t_crm_client['<27><><EFBFBD><EFBFBD>˾']:=1;
|
|
|
if qrytemp2.FieldByName('YARDID').AsString='T' then
|
|
|
t_crm_client['<27><>վ']:=1;
|
|
|
if qrytemp2.FieldByName('MOTORID').AsString='T' then
|
|
|
t_crm_client['<27><><EFBFBD><EFBFBD>']:=1;
|
|
|
if qrytemp2.FieldByName('CUSTBROKERID').AsString='T' then
|
|
|
t_crm_client['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=1;
|
|
|
if qrytemp2.FieldByName('CONTROLLERID').AsString='T' then
|
|
|
t_crm_client['ί<>е<EFBFBD>λ']:=1;
|
|
|
if qrytemp2.FieldByName('AGENTID').AsString='T' then
|
|
|
t_crm_client['<27><><EFBFBD><EFBFBD>']:=1;
|
|
|
if qrytemp2.FieldByName('LOCALAGENTID').AsString='T' then
|
|
|
t_crm_client['<27><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>']:=1;
|
|
|
t_crm_client.post;
|
|
|
end;
|
|
|
next;
|
|
|
end;
|
|
|
end;
|
|
|
t_crm_client.close;
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>');
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure TForm1.Button5Click(Sender: TObject);
|
|
|
var
|
|
|
i:integer;
|
|
|
begin
|
|
|
with temp do begin
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_code_trade_map');
|
|
|
ExecSQL;
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_code_trade');
|
|
|
ExecSQL;
|
|
|
end;
|
|
|
|
|
|
t_code_trade.open;
|
|
|
with qrytemp do begin
|
|
|
Close;sql.Clear;
|
|
|
sql.Add('select * from LANE');
|
|
|
open;
|
|
|
first;
|
|
|
i:=1;
|
|
|
while not eof do begin
|
|
|
if not t_code_trade.Locate('<27><><EFBFBD><EFBFBD>',fieldbyname('CNAME').AsString,[]) then begin
|
|
|
t_code_trade.Insert;
|
|
|
t_code_trade['<27><><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD>']:=inttostr(i);
|
|
|
t_code_trade['<27><><EFBFBD><EFBFBD>']:=fieldbyname('CNAME').AsString;
|
|
|
t_code_trade.post;
|
|
|
inc(i);
|
|
|
end;
|
|
|
next;
|
|
|
end;
|
|
|
end;
|
|
|
t_code_trade.close;
|
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
procedure TForm1.Button7Click(Sender: TObject);
|
|
|
var
|
|
|
i:integer;
|
|
|
begin
|
|
|
with temp do begin
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_code_source_dl');
|
|
|
ExecSQL;
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_code_source');
|
|
|
ExecSQL;
|
|
|
end;
|
|
|
|
|
|
t_code_source.open;
|
|
|
with qrytemp do begin
|
|
|
Close;sql.Clear;
|
|
|
sql.Add('select * from MARKET');
|
|
|
open;
|
|
|
first;
|
|
|
i:=1;
|
|
|
while not eof do begin
|
|
|
if not t_code_source.Locate('ҵ<><D2B5><EFBFBD><EFBFBD>Դ',fieldbyname('MARKET').AsString,[]) then begin
|
|
|
t_code_source.Insert;
|
|
|
t_code_source['<27><><EFBFBD><EFBFBD>']:=inttostr(i);
|
|
|
t_code_source['ҵ<><D2B5><EFBFBD><EFBFBD>Դ']:=fieldbyname('MARKET').AsString;
|
|
|
t_code_source.post;
|
|
|
inc(i);
|
|
|
end;
|
|
|
next;
|
|
|
end;
|
|
|
end;
|
|
|
t_code_source.close;
|
|
|
|
|
|
t_code_source_dl.open;
|
|
|
with qrytemp do begin
|
|
|
Close;sql.Clear;
|
|
|
sql.Add('select * from MARKETDETAIL');
|
|
|
open;
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
t_code_source_dl.Insert;
|
|
|
t_code_source_dl['ҵ<><D2B5><EFBFBD><EFBFBD>Դ']:=fieldbyname('MARKET').AsString;
|
|
|
t_code_source_dl['<27><>Դ<EFBFBD><D4B4>ϸ']:=fieldbyname('MARKETNAME').AsString;
|
|
|
t_code_source_dl.post;
|
|
|
next;
|
|
|
end;
|
|
|
end;
|
|
|
t_code_source_dl.close;
|
|
|
|
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>');
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure TForm1.Button4Click(Sender: TObject);
|
|
|
var
|
|
|
i:integer;
|
|
|
begin
|
|
|
t_sys_code.Open;
|
|
|
t_sys_code_data_all.Open;
|
|
|
memtblDetail.LoadFromDataSet(t_sys_code_data_all,[]);
|
|
|
conAdoServer.BeginTrans;
|
|
|
try
|
|
|
with temp do begin
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_sys_code_data');
|
|
|
ExecSQL;
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_sys_code_emp');
|
|
|
ExecSQL;
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_sys_code_sql');
|
|
|
ExecSQL;
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_sys_report_employee');
|
|
|
ExecSQL;
|
|
|
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_sys_department');
|
|
|
ExecSQL;
|
|
|
close;sql.Clear;
|
|
|
sql.Add('delete from t_sys_employee');
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
t_sys_department.Open;
|
|
|
t_sys_code_emp.open;
|
|
|
t_sys_code_data.open;
|
|
|
t_sys_code_sql.open;
|
|
|
with qrytemp do begin
|
|
|
close;sql.Clear;
|
|
|
sql.Add('select * from department');
|
|
|
open;
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
t_sys_department.Insert;
|
|
|
t_sys_department['<27><><EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD>']:=fieldbyname('DEPTID').AsString;
|
|
|
t_sys_department['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=fieldbyname('SNAME').AsString;
|
|
|
t_sys_department['<27>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>']:='<27>ܹ<EFBFBD>˾';
|
|
|
t_sys_department.post;
|
|
|
Next;
|
|
|
end;
|
|
|
t_sys_department.Insert;
|
|
|
t_sys_department['<27><><EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD>']:='WSZBM';
|
|
|
t_sys_department['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='δ<><CEB4><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>';
|
|
|
t_sys_department['<27>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>']:='<27>ܹ<EFBFBD>˾';
|
|
|
t_sys_department.post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
t_sys_employee.Requery();
|
|
|
qrytemp2.Close;qrytemp2.sql.clear;
|
|
|
qrytemp2.sql.Add('select DISTINCT OPNAME from pur_op');
|
|
|
qrytemp2.open;
|
|
|
with qrytemp do begin
|
|
|
close;sql.Clear;
|
|
|
sql.Add('select * from PUR_OP');
|
|
|
open;
|
|
|
ProgressBar1.Max:=RecordCount;
|
|
|
ProgressBar1.Position:=0;
|
|
|
// ProgressBar1.Step:=100/RecordCount;
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if not t_sys_employee.Locate('<27><><EFBFBD><EFBFBD>',fieldbyname('OPNAME').AsString,[]) then begin
|
|
|
t_sys_employee.Insert;
|
|
|
if fieldbyname('DEPTID').AsString<>'-1' then begin
|
|
|
if t_sys_department.Locate('<27><><EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD>',fieldbyname('DEPTID').AsString,[]) then
|
|
|
t_sys_employee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_sys_department['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
end else begin
|
|
|
t_sys_employee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='δ<><CEB4><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>';
|
|
|
end;
|
|
|
t_sys_employee['<27><><EFBFBD><EFBFBD>']:=fieldbyname('OPNO').AsString;
|
|
|
t_sys_employee['<27><><EFBFBD><EFBFBD>']:=fieldbyname('OPNAME').AsString;
|
|
|
t_sys_employee['<27>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>']:='<27>ܹ<EFBFBD>˾';
|
|
|
t_sys_employee.post;
|
|
|
|
|
|
if fieldbyname('STATUS').AsInteger=0 then begin
|
|
|
t_sys_code.First;
|
|
|
while not t_sys_code.eof do begin
|
|
|
t_sys_code_emp.Insert;
|
|
|
t_sys_code_emp['Ȩ<><EFBFBD><DEB4><EFBFBD>']:=t_sys_code['Ȩ<><EFBFBD><DEB4><EFBFBD>'];
|
|
|
t_sys_code_emp['һ<><D2BB>ģ<EFBFBD><C4A3>']:=t_sys_code['һ<><D2BB>ģ<EFBFBD><C4A3>'];
|
|
|
t_sys_code_emp['<27><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>']:=t_sys_code['<27><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>'];
|
|
|
t_sys_code_emp['Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_sys_code['Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
t_sys_code_emp['<27><>Ա']:=Fieldbyname('OPNAME').AsString;
|
|
|
t_sys_code_emp['<27>Ƿ<EFBFBD><C7B7>ɲ<EFBFBD><C9B2><EFBFBD>']:=1;
|
|
|
t_sys_code_emp.post;
|
|
|
t_sys_code.next;
|
|
|
end;
|
|
|
memtblDetail.First;
|
|
|
while not memtblDetail.Eof do begin
|
|
|
qrytemp2.First;
|
|
|
while not qrytemp2.Eof do begin
|
|
|
t_sys_code_data.Insert;
|
|
|
t_sys_code_data['<27><>Ա']:=fieldbyname('OPNAME').AsString;
|
|
|
t_sys_code_data['<27><><EFBFBD><EFBFBD>']:=memtblDetail.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
t_sys_code_data['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=1;
|
|
|
t_sys_code_data['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=1;
|
|
|
t_sys_code_data['ְԱ']:=qrytemp2.fieldbyname('OPNAME').AsString;
|
|
|
t_sys_code_data.post;
|
|
|
qrytemp2.Next;
|
|
|
end;
|
|
|
t_sys_code_sql.Insert;
|
|
|
t_sys_code_sql['<27><>Ա']:=fieldbyname('OPNAME').AsString;
|
|
|
t_sys_code_sql['<27><><EFBFBD><EFBFBD>']:=memtblDetail.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
t_sys_code_sql['<27><><EFBFBD>ӷ<EFBFBD>Χ']:='ȫ<><C8AB>';
|
|
|
t_sys_code_sql.post;
|
|
|
memtbldetail.next;
|
|
|
end;
|
|
|
|
|
|
end else begin
|
|
|
{
|
|
|
t_sys_code.First;
|
|
|
while not t_sys_code.eof do begin
|
|
|
t_sys_code_emp.Insert;
|
|
|
t_sys_code_emp['Ȩ<><EFBFBD><DEB4><EFBFBD>']:=t_sys_code['Ȩ<><EFBFBD><DEB4><EFBFBD>'];
|
|
|
t_sys_code_emp['һ<><D2BB>ģ<EFBFBD><C4A3>']:=t_sys_code['һ<><D2BB>ģ<EFBFBD><C4A3>'];
|
|
|
t_sys_code_emp['<27><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>']:=t_sys_code['<27><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>'];
|
|
|
t_sys_code_emp['Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_sys_code['Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
t_sys_code_emp['<27><>Ա']:=Fieldbyname('OPNAME').AsString;
|
|
|
t_sys_code_emp['<27>Ƿ<EFBFBD><C7B7>ɲ<EFBFBD><C9B2><EFBFBD>']:=0;
|
|
|
t_sys_code_emp.post;
|
|
|
t_sys_code.next;
|
|
|
end;
|
|
|
memtblDetail.First;
|
|
|
while not memtblDetail.Eof do begin
|
|
|
qrytemp2.First;
|
|
|
while not qrytemp2.Eof do begin
|
|
|
t_sys_code_data.Insert;
|
|
|
t_sys_code_data['<27><>Ա']:=fieldbyname('OPNAME').AsString;
|
|
|
t_sys_code_data['<27><><EFBFBD><EFBFBD>']:=memtblDetail.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
t_sys_code_data['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
t_sys_code_data['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
t_sys_code_data['ְԱ']:=qrytemp2.fieldbyname('OPNAME').AsString;
|
|
|
t_sys_code_data.post;
|
|
|
qrytemp2.Next;
|
|
|
end;
|
|
|
memtbldetail.next;
|
|
|
end;
|
|
|
}
|
|
|
end;
|
|
|
end;
|
|
|
ProgressBar1.StepIt;
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
conAdoServer.CommitTrans;
|
|
|
except
|
|
|
conAdoServer.RollbackTrans;
|
|
|
end;
|
|
|
|
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>');
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure TForm1.Button8Click(Sender: TObject);
|
|
|
begin
|
|
|
t_ch_invoice.Open;
|
|
|
busicard.First;
|
|
|
while not busicard.Eof do begin
|
|
|
if busicard.FieldByName('status').AsInteger<>2 then begin
|
|
|
t_ch_invoice.Insert;
|
|
|
t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']:=busicard.fieldbyname('INVNO').AsString;
|
|
|
t_ch_invoice['<27><>Ʊ̧ͷ']:=busicard.fieldbyname('OBJNAME').AsString;
|
|
|
t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']:=strtodate(FormatDateTime('YYYY-MM-DD',busicard.fieldbyname('INVDATE').AsDatetime));
|
|
|
t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=busicard.fieldbyname('BANK').AsString;
|
|
|
t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>']:=busicard.fieldbyname('ACCOUNT').AsString;
|
|
|
t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=busicard.fieldbyname('VSLVOY').AsString;
|
|
|
t_ch_invoice['<27>ᵥ<EFBFBD><E1B5A5>']:=busicard.fieldbyname('MBLNO').AsString;
|
|
|
if not busicard.fieldbyname('ETD').IsNull then
|
|
|
t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=strtodate(FormatDateTime('YYYY-MM-DD',busicard.fieldbyname('ETD').AsDatetime));
|
|
|
t_ch_invoice['<27><><EFBFBD>˸<EFBFBD>']:=busicard.fieldbyname('PORTLOAD').AsString;
|
|
|
t_ch_invoice['ж<><D0B6><EFBFBD><EFBFBD>']:=busicard.fieldbyname('PORTDIS').AsString;
|
|
|
t_ch_invoice['Ŀ<>ĸ<EFBFBD>']:=busicard.fieldbyname('DESTINATION').AsString;
|
|
|
t_ch_invoice['<27><>ע']:=busicard.fieldbyname('REMARKS').AsString;
|
|
|
t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д']:=busicard.fieldbyname('TOTALCAPITAL').AsString;
|
|
|
t_ch_invoice['<27>ұ<EFBFBD>']:=busicard.fieldbyname('CURRENCY').AsString;
|
|
|
t_ch_invoice['<27>Ƶ<EFBFBD><C6B5><EFBFBD>']:=getemp('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',busicard.fieldbyname('OPID').Asstring);
|
|
|
t_ch_invoice['<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>']:='<27><><EFBFBD>ɷ<EFBFBD>Ʊ';
|
|
|
t_ch_invoice['ί<>б<EFBFBD><D0B1><EFBFBD>']:=busicard.fieldbyname('BSNO').Asstring;
|
|
|
t_ch_invoice['<27>ϼƽ<CFBC><C6BD><EFBFBD>']:=busicard.fieldbyname('DEBIT').AsFloat;
|
|
|
t_ch_invoice['<27>鿪<EFBFBD><E9BFAA><EFBFBD><EFBFBD>']:=busicard.fieldbyname('DEBIT').AsFloat;
|
|
|
invitem.Open;
|
|
|
invitem.First;
|
|
|
t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:='';
|
|
|
t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:='';
|
|
|
while not invitem.Eof do begin
|
|
|
t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:=t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']+invitem.fieldbyname('DESCRIPTION').AsString+#10#13;
|
|
|
t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:=t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']+floattostr(invitem.fieldbyname('DEBIT').Asfloat)+#10#13;
|
|
|
invitem.Next;
|
|
|
end;
|
|
|
if busicard.FieldByName('status').AsInteger=1 then
|
|
|
t_ch_invoice['<27>Ƿ<EFBFBD><C7B7>ϳ<EFBFBD>']:=1
|
|
|
else
|
|
|
t_ch_invoice['<27>Ƿ<EFBFBD><C7B7>ϳ<EFBFBD>']:=0;
|
|
|
t_ch_invoice['<27>ϳ<EFBFBD><CFB3><EFBFBD><EFBFBD><EFBFBD>']:=null;
|
|
|
t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=null;
|
|
|
t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=null;
|
|
|
t_ch_invoice['<27>Ƿ<EFBFBD><C7B7><EFBFBD>ӡ']:=1;
|
|
|
t_ch_invoice['<27>Զ<EFBFBD>']:=1;
|
|
|
t_ch_invoice['<27>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>']:='<27>ܹ<EFBFBD>˾';
|
|
|
|
|
|
t_ch_invoice.post;
|
|
|
end;
|
|
|
busicard.Next;
|
|
|
end;
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
end.
|