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.
626 lines
25 KiB
Plaintext
626 lines
25 KiB
Plaintext
unit u_op_seae_apply_add;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, DB, BusinessSkinForm, StdCtrls, wwdbdatetimepicker, bsSkinCtrls,
|
|
Menus,ComObj;
|
|
|
|
type
|
|
Tfrm_op_seae_apply_add = class(TForm)
|
|
Label1: TLabel;
|
|
bsSkinButton1: TbsSkinButton;
|
|
bsSkinButton2: TbsSkinButton;
|
|
wwDBDateTimePicker1: TwwDBDateTimePicker;
|
|
bsSkinButton3: TbsSkinButton;
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
data1: TDataSource;
|
|
PopupMenu1: TPopupMenu;
|
|
N1: TMenuItem;
|
|
N2: TMenuItem;
|
|
N3: TMenuItem;
|
|
bsSkinButton4: TbsSkinButton;
|
|
OpenDialog1: TOpenDialog;
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
procedure FormShow(Sender: TObject);
|
|
procedure bsSkinButton3Click(Sender: TObject);
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
procedure N1Click(Sender: TObject);
|
|
procedure bsSkinButton4Click(Sender: TObject);
|
|
procedure N3Click(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
frm_op_seae_apply_add: Tfrm_op_seae_apply_add;
|
|
seae_apply_add_total:boolean=false;
|
|
|
|
implementation
|
|
|
|
uses u_op_seae_apply, my_sys_function, u_main, u_data_share, u_op_apply;
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure Tfrm_op_seae_apply_add.bsSkinButton2Click(Sender: TObject);
|
|
begin
|
|
close;
|
|
end;
|
|
|
|
procedure Tfrm_op_seae_apply_add.FormShow(Sender: TObject);
|
|
begin
|
|
wwDBDateTimePicker1.MinDate:=Logininfo.endday+1;
|
|
wwDBDateTimePicker1.Date:=date;
|
|
end;
|
|
|
|
procedure Tfrm_op_seae_apply_add.bsSkinButton3Click(Sender: TObject);
|
|
var
|
|
afield : variant;
|
|
i: Integer;
|
|
begin
|
|
if data1.DataSet.IsEmpty then
|
|
begin
|
|
showmessage('没有复制母体,不能复制新建!');
|
|
exit;
|
|
end;
|
|
afield := vararraycreate([0,data1.DataSet.fieldcount-1],varvariant);
|
|
for i := 0 to (data1.DataSet.fieldcount-1) do
|
|
begin
|
|
afield[i] :=data1.DataSet.fields[i].value ;
|
|
end;
|
|
data1.DataSet.append;
|
|
for i := 0 to (data1.DataSet.fieldcount-1) do
|
|
begin
|
|
data1.DataSet.fields[i].value := afield[i] ;
|
|
end;
|
|
data1.DataSet['周次']:=WeekofYear(wwDBDateTimePicker1.date);
|
|
data1.DataSet['装运方式']:='报关';
|
|
data1.DataSet['业务类型']:='普通货';
|
|
data1.DataSet['业务编号']:='';
|
|
data1.DataSet['主编号']:='';
|
|
if not (Trim(frm_data_share.t_sys_noset.fieldbyname('出号规则').Asstring)='手动编辑') then
|
|
data1.DataSet['委托编号']:='';
|
|
data1.DataSet['编号']:='';
|
|
data1.DataSet['箱型1']:=0;
|
|
data1.DataSet['箱型2']:=0;
|
|
data1.DataSet['箱型3']:=0;
|
|
data1.DataSet['箱型4']:=0;
|
|
data1.DataSet['箱型5']:=0;
|
|
data1.DataSet['箱型6']:=0;
|
|
data1.DataSet['箱型7']:=0;
|
|
data1.DataSet['箱型8']:=0;
|
|
data1.DataSet['箱型9']:=0;
|
|
data1.DataSet['箱型10']:=0;
|
|
data1.DataSet['其他箱型']:=0;
|
|
data1.DataSet['箱TEU']:=0;
|
|
data1.DataSet['集装箱']:='';
|
|
data1.DataSet['箱数大写']:='';
|
|
data1.DataSet['计费标准']:='';
|
|
data1.DataSet['报关日期']:=null;
|
|
data1.DataSet['报关员']:='';
|
|
data1.DataSet['报关单号']:='';
|
|
data1.DataSet['核销单号']:='';
|
|
data1.DataSet['手册号']:='';
|
|
data1.DataSet['是否退税']:=0;
|
|
data1.DataSet['退税日期']:=null;
|
|
data1.DataSet['是否通关']:=0;
|
|
data1.DataSet['通关日期']:=null;
|
|
// data1.DataSet['危险品分类']:='';
|
|
// data1.DataSet['危险品编号']:=null;
|
|
data1.DataSet['冷藏通风量']:='';
|
|
data1.DataSet['温度单位']:='';
|
|
data1.DataSet['设置温度']:='';
|
|
data1.DataSet['最低温度']:='';
|
|
data1.DataSet['最高温度']:='';
|
|
data1.DataSet['货物标识']:='';
|
|
data1.DataSet['二程开船日期']:=null;
|
|
data1.DataSet['二程港口']:='';
|
|
data1.DataSet['二程船名']:='';
|
|
data1.DataSet['二程航次']:='';
|
|
data1.DataSet['箱号封号']:='';
|
|
data1.DataSet['备注']:='';
|
|
data1.DataSet['分单列表']:='';
|
|
data1.DataSet['发票号']:='';
|
|
// data1.DataSet['商品编码']:='';
|
|
data1.DataSet['是否签单']:=0;
|
|
data1.DataSet['签回日期']:=null;
|
|
data1.DataSet['请求派车']:=0;
|
|
data1.DataSet['是否派车']:=0;
|
|
data1.DataSet['派车日期']:=null;
|
|
data1.DataSet['是否解锁']:=0;
|
|
data1.DataSet['解锁日期']:=null;
|
|
data1.DataSet['解锁人']:='';
|
|
data1.DataSet['应收陆运']:=0;
|
|
data1.DataSet['应付陆运']:=0;
|
|
data1.DataSet['陆运利润']:=0;
|
|
data1.DataSet['是否退税']:=0;
|
|
data1.DataSet['是否通关']:=0;
|
|
data1.DataSet['是否签单']:=0;
|
|
data1.DataSet['是否退舱']:=0;
|
|
|
|
data1.DataSet['业务状态']:='接受委托';
|
|
data1.DataSet['费用状态']:='录入状态';
|
|
data1.DataSet['录入人']:=employee;
|
|
data1.DataSet['录入日期']:=date;
|
|
data1.DataSet['分部名称']:=subComp;
|
|
data1.DataSet['操作员']:=employee;
|
|
// data1.DataSet['报关操作']:=employee;
|
|
// data1.DataSet['报检操作']:=employee;
|
|
data1.DataSet['会计期间']:=wwDBDateTimePicker1.date;
|
|
data1.DataSet['财务']:=0;
|
|
data1.DataSet['财务凭证']:='';
|
|
data1.DataSet['备案号']:='';
|
|
data1.DataSet['批准文号']:='';
|
|
data1.DataSet['成交方式']:='';
|
|
data1.DataSet['净重']:=0;
|
|
data1.DataSet['单价']:='';
|
|
data1.DataSet['总价']:='';
|
|
data1.DataSet['接单日期']:=null;
|
|
data1.DataSet['报检日期']:=null;
|
|
data1.DataSet['报检单号']:='';
|
|
data1.DataSet['验货时间']:=null;
|
|
data1.DataSet['实验时间']:=null;
|
|
data1.DataSet['熏蒸时间']:=null;
|
|
data1.DataSet['出证时间']:=null;
|
|
data1.DataSet['货代公司']:='无';
|
|
|
|
data1.DataSet['审核日期']:=null;
|
|
data1.DataSet['审核人']:='';
|
|
|
|
{
|
|
t_op_seae1.DataSet.fieldbyname('商品名称').asstring:=frm_data_share.t_code_goods.fieldbyname('货物描述').asstring;
|
|
t_op_seae1.DataSet.fieldbyname('商品编码').asstring:=frm_data_share.t_code_goods.fieldbyname('英文名称').asstring;
|
|
t_op_seae1.DataSet.fieldbyname('辅助字段二').asstring:=frm_data_share.t_code_goods.fieldbyname('英文描述').asstring;
|
|
t_op_seae1.DataSet.fieldbyname('危险品编号').asstring:=frm_data_share.t_code_goods.fieldbyname('应急措施编号').asstring;
|
|
t_op_seae1.DataSet.fieldbyname('危险品级别').asstring:=frm_data_share.t_code_goods.fieldbyname('危险品等级').asstring;
|
|
t_op_seae1.DataSet.fieldbyname('危险品分类').asstring:=frm_data_share.t_code_goods.fieldbyname('危品类别').asstring;
|
|
t_op_seae1.DataSet.fieldbyname('其它备注').asstring:=frm_data_share.t_code_goods.fieldbyname('包装类').asstring;
|
|
}
|
|
|
|
|
|
|
|
|
|
if not seae_apply_add_total then begin
|
|
frm_op_seae_apply.Notebook1.PageIndex:=1;
|
|
frm_op_seae_apply.bsSkinButton11.Caption:='返回列表';
|
|
end;
|
|
close;
|
|
end;
|
|
|
|
procedure Tfrm_op_seae_apply_add.bsSkinButton1Click(Sender: TObject);
|
|
begin
|
|
if not seae_apply_add_total then begin
|
|
with frm_op_seae_apply do
|
|
begin
|
|
t_op_seae.insert;
|
|
if bsSkinButton11.Caption='编辑修改' then
|
|
begin
|
|
Notebook1.PageIndex:=1;
|
|
bsSkinButton11.Caption:='返回列表';
|
|
end;
|
|
t_op_seae['会计期间']:=date;
|
|
t_op_seae['周次']:=WeekofYear(date);
|
|
t_op_seae['录入人']:=employee;
|
|
t_op_seae['录入日期']:=date;
|
|
t_op_seae['分部名称']:=subComp;
|
|
t_op_seae['操作员']:=employee;
|
|
// t_op_seae['揽货人']:=employee;
|
|
// t_op_seae['报关操作']:=employee;
|
|
// t_op_seae['报检操作']:=employee;
|
|
t_op_seae['客服员']:=employee;
|
|
// t_op_seae['销售部门']:=department;
|
|
t_op_seae['操作部门']:=department;
|
|
t_op_seae['业务来源']:='自揽货';
|
|
t_op_seae['起运港']:=get_parameters_value(14,'QINGDAO,CHINA');
|
|
t_op_seae['装货港']:=get_parameters_value(16,'QINGDAO,CHINA');
|
|
t_op_seae['提单份数']:=get_parameters_value(20,'THREE');
|
|
t_op_seae['运输条款']:=get_parameters_value(21,'CY-CY');
|
|
t_op_seae['唛头']:=get_parameters_value(22,'N/M');
|
|
t_op_seae['付费方式']:=get_parameters_value(23,'FREIGHT PREPAID');
|
|
t_op_seae['是否退税']:=0;
|
|
t_op_seae['是否通关']:=0;
|
|
t_op_seae['是否签单']:=0;
|
|
t_op_seae['是否退舱']:=0;
|
|
t_op_seae['请求派车']:=0;
|
|
t_op_seae['是否派车']:=0;
|
|
t_op_seae['是否解锁']:=0;
|
|
t_op_seae['解锁日期']:=null;
|
|
t_op_seae['解锁人']:='';
|
|
t_op_seae['应收陆运']:=0;
|
|
t_op_seae['应付陆运']:=0;
|
|
t_op_seae['陆运利润']:=0;
|
|
t_op_seae['财务']:=0;
|
|
t_op_seae['财务凭证']:='';
|
|
t_op_seae['装运方式']:='报关';
|
|
t_op_seae['业务类型']:='普通货';
|
|
t_op_seae['货代公司']:='无';
|
|
t_op_seae['BI船公司']:='无';
|
|
t_op_seae['BI货代公司']:='无';
|
|
end;
|
|
end else begin
|
|
with frm_op_apply do
|
|
begin
|
|
t_op_seae.insert;
|
|
if bsSkinButton11.Caption='编辑修改' then
|
|
begin
|
|
Notebook1.PageIndex:=1;
|
|
bsSkinButton11.Caption:='返回列表';
|
|
end;
|
|
t_op_seae['会计期间']:=date;
|
|
t_op_seae['周次']:=WeekofYear(date);
|
|
t_op_seae['录入人']:=employee;
|
|
t_op_seae['录入日期']:=date;
|
|
t_op_seae['分部名称']:=subComp;
|
|
t_op_seae['操作员']:=employee;
|
|
// t_op_seae['揽货人']:=employee;
|
|
// t_op_seae['报关操作']:=employee;
|
|
// t_op_seae['报检操作']:=employee;
|
|
t_op_seae['客服员']:=employee;
|
|
// t_op_seae['销售部门']:=department;
|
|
t_op_seae['操作部门']:=department;
|
|
t_op_seae['业务来源']:='自揽货';
|
|
t_op_seae['起运港']:=get_parameters_value(14,'QINGDAO,CHINA');
|
|
t_op_seae['装货港']:=get_parameters_value(16,'QINGDAO,CHINA');
|
|
t_op_seae['提单份数']:=get_parameters_value(20,'THREE');
|
|
t_op_seae['运输条款']:=get_parameters_value(21,'CY-CY');
|
|
t_op_seae['唛头']:=get_parameters_value(22,'N/M');
|
|
t_op_seae['付费方式']:=get_parameters_value(23,'FREIGHT PREPAID');
|
|
t_op_seae['是否退税']:=0;
|
|
t_op_seae['是否通关']:=0;
|
|
t_op_seae['是否签单']:=0;
|
|
t_op_seae['请求派车']:=0;
|
|
t_op_seae['是否派车']:=0;
|
|
t_op_seae['是否解锁']:=0;
|
|
t_op_seae['是否退舱']:=0;
|
|
t_op_seae['解锁日期']:=null;
|
|
t_op_seae['解锁人']:='';
|
|
t_op_seae['应收陆运']:=0;
|
|
t_op_seae['应付陆运']:=0;
|
|
t_op_seae['陆运利润']:=0;
|
|
t_op_seae['财务']:=0;
|
|
t_op_seae['财务凭证']:='';
|
|
t_op_seae['装运方式']:='报关';
|
|
t_op_seae['业务类型']:='普通货';
|
|
t_op_seae['货代公司']:='无';
|
|
t_op_seae['BI船公司']:='无';
|
|
t_op_seae['BI货代公司']:='无';
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
close;
|
|
end;
|
|
|
|
procedure Tfrm_op_seae_apply_add.N1Click(Sender: TObject);
|
|
var
|
|
Ext,adate,bsno,corp,vslvoy:String;
|
|
ExcelTemplet:Variant;
|
|
i,j:integer;
|
|
M,D,Y:Word;
|
|
imp:boolean;
|
|
begin
|
|
if OpenDialog1.Execute then begin
|
|
Ext:=lowercase(ExtractFileExt(OpenDialog1.FileName));
|
|
if Ext='.xls' then begin
|
|
ExcelTemplet:= CreateOleObject('Excel.Application');
|
|
try
|
|
ExcelTemplet.Workbooks.Open(OpenDialog1.FileName);
|
|
I:=3;
|
|
imp:=true;
|
|
while VartoStr(ExcelTemplet.ActiveSheet.Cells[I,2].Value)<>'' do begin
|
|
corp:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,10].Value);
|
|
if not frm_data_share.t_crm_client_all.Locate('客户简称',corp,[]) then begin
|
|
MessageDlg('客户名称:'+corp+' 系统中不存在,请先在系统中添加此客户!',mtWarning,[mbYes],0);
|
|
imp:=false;
|
|
end;
|
|
i:=i+1;
|
|
end;
|
|
|
|
if imp then begin
|
|
I:=3;
|
|
while VartoStr(ExcelTemplet.ActiveSheet.Cells[I,2].Value)<>'' do begin
|
|
aDate:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,2].Value);
|
|
M:=StrToInt(COPY(adate,1,pos('.',adate)-1));
|
|
D:=StrToInt(COPY(adate,pos('.',adate)+1,length(adate)-pos('.',adate)));
|
|
Y:=strtoint(formatdatetime('YYYY',date));
|
|
corp:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,10].Value);
|
|
if not seae_apply_add_total then begin
|
|
with frm_op_seae_apply do
|
|
begin
|
|
t_op_seae.insert;
|
|
t_op_seae['会计期间']:=date;
|
|
t_op_seae['周次']:=WeekofYear(date);
|
|
t_op_seae['录入人']:=employee;
|
|
t_op_seae['录入日期']:=date;
|
|
t_op_seae['分部名称']:=subComp;
|
|
t_op_seae['操作员']:=employee;
|
|
t_op_seae['揽货人']:=employee;
|
|
t_op_seae['报关操作']:=employee;
|
|
t_op_seae['报检操作']:=employee;
|
|
t_op_seae['客服员']:=employee;
|
|
t_op_seae['销售部门']:=department;
|
|
t_op_seae['操作部门']:=department;
|
|
t_op_seae['业务来源']:='自揽货';
|
|
t_op_seae['起运港']:=get_parameters_value(14,'QINGDAO,CHINA');
|
|
t_op_seae['装货港']:=get_parameters_value(16,'QINGDAO,CHINA');
|
|
t_op_seae['提单份数']:=get_parameters_value(20,'THREE');
|
|
t_op_seae['运输条款']:=get_parameters_value(21,'CY-CY');
|
|
t_op_seae['唛头']:=get_parameters_value(22,'N/M');
|
|
t_op_seae['付费方式']:=get_parameters_value(23,'FREIGHT PREPAID');
|
|
t_op_seae['是否退税']:=0;
|
|
t_op_seae['是否通关']:=0;
|
|
t_op_seae['是否签单']:=0;
|
|
t_op_seae['请求派车']:=0;
|
|
t_op_seae['是否派车']:=0;
|
|
t_op_seae['是否退税']:=0;
|
|
t_op_seae['是否结汇']:=0;
|
|
t_op_seae['是否退舱']:=0;
|
|
t_op_seae['解锁日期']:=null;
|
|
t_op_seae['解锁人']:='';
|
|
t_op_seae['应收陆运']:=0;
|
|
t_op_seae['应付陆运']:=0;
|
|
t_op_seae['陆运利润']:=0;
|
|
t_op_seae['财务']:=0;
|
|
t_op_seae['财务凭证']:='';
|
|
t_op_seae['装运方式']:='报关';
|
|
t_op_seae['业务类型']:='普通货';
|
|
t_op_seae['开船日期']:=EncodeDate(Y,M,D);
|
|
t_op_seae['通关日期']:=EncodeDate(Y,M,D);
|
|
t_op_seae['报关日期']:=EncodeDate(Y,M,D);
|
|
t_op_seae['经营单位']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,3].Value);
|
|
vslvoy:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,4].Value);
|
|
if pos('/',VSLVOY)>0 then begin
|
|
t_op_seae['船名']:=COPY(VSLVOY,1,pos('/',VSLVOY)-1);
|
|
t_op_seae['航次']:=COPY(VSLVOY,pos('/',VSLVOY)+1,length(VSLVOY)-pos('/',VSLVOY));
|
|
end else
|
|
t_op_seae['船名']:=VSLVOY;
|
|
t_op_seae['主提单号']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,5].Value);
|
|
t_op_seae['核销单号']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,7].Value);
|
|
t_op_seae['成交方式']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,8].Value);
|
|
t_op_seae['报关单号']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,9].Value);
|
|
t_op_seae['委托单位']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,10].Value);
|
|
t_op_seae['报关备注']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,11].Value);
|
|
t_op_seae.post;
|
|
end;
|
|
end else begin
|
|
with frm_op_apply do
|
|
begin
|
|
t_op_seae.insert;
|
|
t_op_seae['会计期间']:=date;
|
|
t_op_seae['周次']:=WeekofYear(date);
|
|
t_op_seae['录入人']:=employee;
|
|
t_op_seae['录入日期']:=date;
|
|
t_op_seae['分部名称']:=subComp;
|
|
t_op_seae['操作员']:=employee;
|
|
t_op_seae['揽货人']:=employee;
|
|
t_op_seae['报关操作']:=employee;
|
|
t_op_seae['报检操作']:=employee;
|
|
t_op_seae['客服员']:=employee;
|
|
t_op_seae['销售部门']:=department;
|
|
t_op_seae['操作部门']:=department;
|
|
t_op_seae['业务来源']:='自揽货';
|
|
t_op_seae['起运港']:=get_parameters_value(14,'QINGDAO,CHINA');
|
|
t_op_seae['装货港']:=get_parameters_value(16,'QINGDAO,CHINA');
|
|
t_op_seae['提单份数']:=get_parameters_value(20,'THREE');
|
|
t_op_seae['运输条款']:=get_parameters_value(21,'CY-CY');
|
|
t_op_seae['唛头']:=get_parameters_value(22,'N/M');
|
|
t_op_seae['付费方式']:=get_parameters_value(23,'FREIGHT PREPAID');
|
|
t_op_seae['是否退税']:=0;
|
|
t_op_seae['是否通关']:=0;
|
|
t_op_seae['是否签单']:=0;
|
|
t_op_seae['请求派车']:=0;
|
|
t_op_seae['是否派车']:=0;
|
|
t_op_seae['是否解锁']:=0;
|
|
t_op_seae['是否结汇']:=0;
|
|
t_op_seae['是否退舱']:=0;
|
|
t_op_seae['解锁日期']:=null;
|
|
t_op_seae['解锁人']:='';
|
|
t_op_seae['应收陆运']:=0;
|
|
t_op_seae['应付陆运']:=0;
|
|
t_op_seae['陆运利润']:=0;
|
|
t_op_seae['财务']:=0;
|
|
t_op_seae['财务凭证']:='';
|
|
t_op_seae['装运方式']:='报关';
|
|
t_op_seae['业务类型']:='普通货';
|
|
t_op_seae['开船日期']:=EncodeDate(Y,M,D);
|
|
t_op_seae['通关日期']:=EncodeDate(Y,M,D);
|
|
t_op_seae['报关日期']:=EncodeDate(Y,M,D);
|
|
t_op_seae['经营单位']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,3].Value);
|
|
vslvoy:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,4].Value);
|
|
if pos('/',VSLVOY)>0 then begin
|
|
t_op_seae['船名']:=COPY(VSLVOY,1,pos('/',VSLVOY)-1);
|
|
t_op_seae['航次']:=COPY(VSLVOY,pos('/',VSLVOY)+1,length(VSLVOY)-pos('/',VSLVOY));
|
|
end else
|
|
t_op_seae['船名']:=VSLVOY;
|
|
t_op_seae['主提单号']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,5].Value);
|
|
t_op_seae['核销单号']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,7].Value);
|
|
t_op_seae['成交方式']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,8].Value);
|
|
t_op_seae['报关单号']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,9].Value);
|
|
t_op_seae['委托单位']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,10].Value);
|
|
t_op_seae['报关备注']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,11].Value);
|
|
t_op_seae.post;
|
|
end;
|
|
end;
|
|
i:=i+1;
|
|
end;
|
|
end;
|
|
finally
|
|
ExcelTemplet.DisplayAlerts := false;//是否提示存盘
|
|
ExcelTemplet.Quit;//如果出错则退出
|
|
end;
|
|
end;
|
|
end;
|
|
MessageDlg('导入完成!', mtConfirmation, [mbYes],0);
|
|
end;
|
|
|
|
procedure Tfrm_op_seae_apply_add.bsSkinButton4Click(Sender: TObject);
|
|
var
|
|
Pnt:Tpoint;
|
|
begin
|
|
Pnt:=bsSkinButton4.ClientToScreen(Point(0,bsSkinButton4.Height));
|
|
PopupMenu1.Popup(Pnt.x,Pnt.y);
|
|
end;
|
|
|
|
procedure Tfrm_op_seae_apply_add.N3Click(Sender: TObject);
|
|
var
|
|
Ext,adate,bsno,corp:String;
|
|
ExcelTemplet:Variant;
|
|
i,j:integer;
|
|
M,D,Y:Word;
|
|
imp:boolean;
|
|
begin
|
|
if OpenDialog1.Execute then begin
|
|
Ext:=lowercase(ExtractFileExt(OpenDialog1.FileName));
|
|
if Ext='.xls' then begin
|
|
ExcelTemplet:= CreateOleObject('Excel.Application');
|
|
try
|
|
ExcelTemplet.Workbooks.Open(OpenDialog1.FileName);
|
|
I:=3;
|
|
imp:=true;
|
|
while VartoStr(ExcelTemplet.ActiveSheet.Cells[I,2].Value)<>'' do begin
|
|
corp:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,13].Value);
|
|
if not frm_data_share.t_crm_client_all.Locate('客户简称',corp,[]) then begin
|
|
MessageDlg('客户名称:'+corp+' 系统中不存在,请先在系统中添加此客户!',mtWarning,[mbYes],0);
|
|
imp:=false;
|
|
end;
|
|
i:=i+1;
|
|
end;
|
|
|
|
if imp then begin
|
|
I:=3;
|
|
while VartoStr(ExcelTemplet.ActiveSheet.Cells[I,2].Value)<>'' do begin
|
|
aDate:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,2].Value);
|
|
M:=StrToInt(COPY(adate,1,pos('.',adate)-1));
|
|
D:=StrToInt(COPY(adate,pos('.',adate)+1,length(adate)-pos('.',adate)));
|
|
Y:=strtoint(formatdatetime('YYYY',date));
|
|
corp:=VartoStr(ExcelTemplet.ActiveSheet.Cells[I,10].Value);
|
|
if not seae_apply_add_total then begin
|
|
with frm_op_seae_apply do
|
|
begin
|
|
t_op_seae.insert;
|
|
t_op_seae['会计期间']:=date;
|
|
t_op_seae['周次']:=WeekofYear(date);
|
|
t_op_seae['录入人']:=employee;
|
|
t_op_seae['录入日期']:=date;
|
|
t_op_seae['分部名称']:=subComp;
|
|
t_op_seae['操作员']:=employee;
|
|
t_op_seae['揽货人']:=employee;
|
|
t_op_seae['报关操作']:=employee;
|
|
t_op_seae['报检操作']:=employee;
|
|
t_op_seae['客服员']:=employee;
|
|
t_op_seae['销售部门']:=department;
|
|
t_op_seae['操作部门']:=department;
|
|
t_op_seae['业务来源']:='自揽货';
|
|
t_op_seae['起运港']:=get_parameters_value(14,'QINGDAO,CHINA');
|
|
t_op_seae['装货港']:=get_parameters_value(16,'QINGDAO,CHINA');
|
|
t_op_seae['提单份数']:=get_parameters_value(20,'THREE');
|
|
t_op_seae['运输条款']:=get_parameters_value(21,'CY-CY');
|
|
t_op_seae['唛头']:=get_parameters_value(22,'N/M');
|
|
t_op_seae['付费方式']:=get_parameters_value(23,'FREIGHT PREPAID');
|
|
t_op_seae['是否退税']:=0;
|
|
t_op_seae['是否通关']:=0;
|
|
t_op_seae['是否签单']:=0;
|
|
t_op_seae['请求派车']:=0;
|
|
t_op_seae['是否派车']:=0;
|
|
t_op_seae['是否解锁']:=0;
|
|
t_op_seae['是否结汇']:=0;
|
|
t_op_seae['是否退舱']:=0;
|
|
t_op_seae['解锁日期']:=null;
|
|
t_op_seae['解锁人']:='';
|
|
t_op_seae['应收陆运']:=0;
|
|
t_op_seae['应付陆运']:=0;
|
|
t_op_seae['陆运利润']:=0;
|
|
t_op_seae['财务']:=0;
|
|
t_op_seae['财务凭证']:='';
|
|
t_op_seae['装运方式']:='报关';
|
|
t_op_seae['业务类型']:='普通货';
|
|
t_op_seae['开船日期']:=EncodeDate(Y,M,D);
|
|
t_op_seae['通关日期']:=EncodeDate(Y,M,D);
|
|
t_op_seae['报关日期']:=EncodeDate(Y,M,D);
|
|
t_op_seae['经营单位']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,3].Value);
|
|
t_op_seae['运抵国']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,4].Value);
|
|
t_op_seae['报检单号']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,5].Value);
|
|
t_op_seae['船名']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,6].Value);
|
|
t_op_seae['主提单号']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,7].Value);
|
|
t_op_seae['商品名称']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,8].Value);
|
|
t_op_seae['商品编码']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,9].Value);
|
|
t_op_seae['数量单位']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,10].Value);
|
|
t_op_seae['总价']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,11].Value);
|
|
t_op_seae['委托单位']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,13].Value);
|
|
t_op_seae.post;
|
|
end;
|
|
end else begin
|
|
with frm_op_apply do
|
|
begin
|
|
t_op_seae.insert;
|
|
t_op_seae['会计期间']:=date;
|
|
t_op_seae['周次']:=WeekofYear(date);
|
|
t_op_seae['录入人']:=employee;
|
|
t_op_seae['录入日期']:=date;
|
|
t_op_seae['分部名称']:=subComp;
|
|
t_op_seae['操作员']:=employee;
|
|
t_op_seae['揽货人']:=employee;
|
|
t_op_seae['报关操作']:=employee;
|
|
t_op_seae['报检操作']:=employee;
|
|
t_op_seae['客服员']:=employee;
|
|
t_op_seae['销售部门']:=department;
|
|
t_op_seae['操作部门']:=department;
|
|
t_op_seae['业务来源']:='自揽货';
|
|
t_op_seae['起运港']:=get_parameters_value(14,'QINGDAO,CHINA');
|
|
t_op_seae['装货港']:=get_parameters_value(16,'QINGDAO,CHINA');
|
|
t_op_seae['提单份数']:=get_parameters_value(20,'THREE');
|
|
t_op_seae['运输条款']:=get_parameters_value(21,'CY-CY');
|
|
t_op_seae['唛头']:=get_parameters_value(22,'N/M');
|
|
t_op_seae['付费方式']:=get_parameters_value(23,'FREIGHT PREPAID');
|
|
t_op_seae['是否退税']:=0;
|
|
t_op_seae['是否通关']:=0;
|
|
t_op_seae['是否签单']:=0;
|
|
t_op_seae['请求派车']:=0;
|
|
t_op_seae['是否派车']:=0;
|
|
t_op_seae['是否解锁']:=0;
|
|
t_op_seae['是否结汇']:=0;
|
|
t_op_seae['是否退舱']:=0;
|
|
t_op_seae['解锁日期']:=null;
|
|
t_op_seae['解锁人']:='';
|
|
t_op_seae['应收陆运']:=0;
|
|
t_op_seae['应付陆运']:=0;
|
|
t_op_seae['陆运利润']:=0;
|
|
t_op_seae['财务']:=0;
|
|
t_op_seae['财务凭证']:='';
|
|
t_op_seae['装运方式']:='报关';
|
|
t_op_seae['业务类型']:='普通货';
|
|
t_op_seae['开船日期']:=EncodeDate(Y,M,D);
|
|
t_op_seae['通关日期']:=EncodeDate(Y,M,D);
|
|
t_op_seae['报关日期']:=EncodeDate(Y,M,D);
|
|
t_op_seae['经营单位']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,3].Value);
|
|
t_op_seae['运抵国']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,4].Value);
|
|
t_op_seae['报检单号']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,5].Value);
|
|
t_op_seae['船名']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,6].Value);
|
|
t_op_seae['主提单号']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,7].Value);
|
|
t_op_seae['商品名称']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,8].Value);
|
|
t_op_seae['商品编码']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,9].Value);
|
|
t_op_seae['数量单位']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,10].Value);
|
|
t_op_seae['总价']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,11].Value);
|
|
t_op_seae['委托单位']:=VarTostr(ExcelTemplet.ActiveSheet.Cells[i,13].Value);
|
|
t_op_seae.post;
|
|
end;
|
|
end;
|
|
i:=i+1;
|
|
end;
|
|
end;
|
|
finally
|
|
ExcelTemplet.DisplayAlerts := false;//是否提示存盘
|
|
ExcelTemplet.Quit;//如果出错则退出
|
|
end;
|
|
end;
|
|
end;
|
|
MessageDlg('导入完成!', mtConfirmation, [mbYes],0);
|
|
end;
|
|
|
|
end.
|