unit u_op_seae_assistant_qr; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, DBCtrls, StdCtrls, cxControls, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxButtonEdit, cxDBEdit, Mask, ExtCtrls, bsSkinCtrls, Menus, DB, ADODB; type Tfrm_op_seae_assistant_qr = class(TForm) bsSkinPanel3: TbsSkinPanel; Label24: TLabel; Label25: TLabel; Label29: TLabel; Label51: TLabel; Label53: TLabel; Label54: TLabel; Label55: TLabel; Label57: TLabel; Label58: TLabel; Label60: TLabel; Label61: TLabel; Label62: TLabel; Label63: TLabel; Label67: TLabel; Label68: TLabel; Label69: TLabel; Label70: TLabel; Label71: TLabel; Label73: TLabel; Label76: TLabel; lblcompany: TLabel; Label36: TLabel; Label37: TLabel; Label39: TLabel; Label40: TLabel; Label41: TLabel; Shape1: TShape; Label34: TLabel; Label9: TLabel; Label11: TLabel; DBEdit14: TDBEdit; cxDBButtonEdit2: TcxDBButtonEdit; DBMemo18: TDBMemo; DBMemo19: TDBMemo; DBMemo20: TDBMemo; DBMemo21: TDBMemo; DBMemo22: TDBMemo; DBMemo23: TDBMemo; DBEdit3: TDBEdit; DBEdit4: TDBEdit; DBEdit6: TDBEdit; DBEdit1: TDBEdit; DBEdit5: TDBEdit; DBEdit7: TDBEdit; DBEdit8: TDBEdit; DBRichEdit1: TDBRichEdit; DBRichEdit2: TDBRichEdit; DBRichEdit3: TDBRichEdit; DBRichEdit4: TDBRichEdit; DBRichEdit5: TDBRichEdit; DBRichEdit6: TDBRichEdit; DBRichEdit7: TDBRichEdit; DBRichEdit8: TDBRichEdit; DBRichEdit9: TDBRichEdit; qrytd_qr: TADOQuery; dsrtd_qr: TDataSource; Popop: TPopupMenu; pop2: TMenuItem; pop3: TMenuItem; bsSkinPanel1: TbsSkinPanel; bsSkinButton9: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton38: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; dsrassitant: TDataSource; bsSkinButton3: TbsSkinButton; chkedmain: TbsSkinCheckRadioBox; procedure cxDBButtonEdit2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure pop2Click(Sender: TObject); procedure pop3Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton38Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure qrytd_qrAfterPost(DataSet: TDataSet); procedure FormShow(Sender: TObject); procedure DBRichEdit1DblClick(Sender: TObject); procedure DBMemo18DblClick(Sender: TObject); procedure DBEdit3DblClick(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private declarations } procedure setdiffcolor; public { Public declarations } procedure showasid(myadiquery:tadoquery;asid:integer); end; var frm_op_seae_assistant_qr: Tfrm_op_seae_assistant_qr; implementation {$R *.dfm} uses my_sys_function, u_data_share, u_op_seae_difftd, u_main, u_send_msg ; { Tfrm_op_seae_assistant_qr } procedure Tfrm_op_seae_assistant_qr.showasid(myadiquery:tadoquery;asid:integer); begin dsrassitant.DataSet:=myadiquery ; with qrytd_qr,sql do begin close ; clear ; add('SELECT * FROM t_op_seae_assistant_on where as_id='+inttostr(asid)); open ; end ; setdiffcolor ; showmodal ; end; procedure Tfrm_op_seae_assistant_qr.cxDBButtonEdit2PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer); begin Popop.Popup(mouse.CursorPos.X,mouse.CursorPos.Y); end; procedure Tfrm_op_seae_assistant_qr.pop2Click(Sender: TObject); var i:integer ; myfield:string ; myzhl,mychm,myshl:real ; begin // 接受客户确认 myzhl:=total_nummemo(DBRichEdit8); mychm:=total_nummemo(DBRichEdit9); myshl:=total_nummemo(DBRichEdit6); qrytd_qr.Edit ; qrytd_qr['重量']:=myzhl ; qrytd_qr['尺码']:=mychm ; qrytd_qr['件数']:=myshl ; qrytd_qr.Post ; dsrassitant.dataset.Edit ; for i:=0 to qrytd_qr.FieldCount-1 do begin try myfield:=uppercase(qrytd_qr.fields[i].FieldName) ; if myfield<>'AS_ID' then dsrassitant.dataset[myfield]:=qrytd_qr[myfield]; except ; end; end; dsrassitant.DataSet['提交确认']:=td_sate3 ; dsrassitant.DataSet.Post ; qrytd_qr.Edit ; qrytd_qr.FieldByName('提交确认').AsString:=td_assate3 ; qrytd_qr.Post ; //更新主单 if chkedmain.Checked then begin with frm_main.qryTmp,sql do begin close; clear ; add('select * from t_op_seae where 编号=:bianhao'); parameters.ParamByName('bianhao').value:=qrytd_qr.fieldbyname('编号').asstring ; Open ; edit ; end ; if qrytd_qr.FieldByName('提单类型').AsString='直单' then begin frm_main.qryTmp['发货人代码']:=qrytd_qr['发货人代码']; frm_main.qryTmp['收货人代码']:=qrytd_qr['收货人代码']; frm_main.qryTmp['通知人代码']:=qrytd_qr['通知人代码']; end; frm_main.qryTmp['代理内容']:=qrytd_qr['代理内容']; frm_main.qryTmp['货物描述']:=qrytd_qr['货物描述']; frm_main.qryTmp['件数大写']:=qrytd_qr['件数大写']; frm_main.qryTmp['船名']:=qrytd_qr['船名']; frm_main.qryTmp['航次']:=qrytd_qr['航次']; frm_main.qryTmp['开船日期']:=qrytd_qr['开船日期']; frm_main.qryTmp['装货港']:=qrytd_qr['装货港']; frm_main.qryTmp['卸货港']:=qrytd_qr['卸货港']; frm_main.qryTmp['交货地点']:=qrytd_qr['交货地点']; frm_main.qryTmp['目的地']:=qrytd_qr['目的地']; frm_main.qryTmp['运输条款']:=qrytd_qr['运输条款']; frm_main.qryTmp['提单份数']:=qrytd_qr['提单份数']; frm_main.qryTmp['签单地点']:=qrytd_qr['签单地点']; frm_main.qryTmp['签单日期']:=qrytd_qr['签单日期']; frm_main.qryTmp['付费方式']:=qrytd_qr['付费方式']; frm_main.qryTmp['预付地点']:=qrytd_qr['预付地点']; frm_main.qryTmp['到付地点']:=qrytd_qr['到付地点']; frm_main.qryTmp['唛头']:=qrytd_qr['唛头']; frm_main.qryTmp['箱号封号']:=qrytd_qr['箱号封号']; frm_main.qryTmp['件数']:=qrytd_qr['件数']; frm_main.qryTmp['包装']:=qrytd_qr['包装']; frm_main.qryTmp['尺码']:=qrytd_qr['尺码']; frm_main.qryTmp['重量']:=qrytd_qr['重量']; frm_main.qryTmp['件数包装']:=qrytd_qr['件数包装']; frm_main.qryTmp['货物重量']:=qrytd_qr['货物重量']; frm_main.qryTmp['货物尺码']:=qrytd_qr['货物尺码']; frm_main.qryTmp.post; end ; /////////发送提单确认信息 if (yctx<>'启用') then exit ; if (trim(get_parameters_value(136,'无'))='无') then exit; frm_send_msg:=Tfrm_send_msg.Create(self); try frm_data_share.t_crm_client_all.Locate('客户简称',qrytd_qr['委托单位'],[]); frm_send_msg.t_crm_client_link.Open; frm_send_msg.memmsg.open; frm_send_msg.memmsg.insert; frm_send_msg.memmsg.FieldByName('收件单位').AsString:=qrytd_qr['委托单位']; if not frm_send_msg.t_crm_client_link.IsEmpty then begin frm_send_msg.t_crm_client_link.first; frm_send_msg.memmsg.FieldByName('收件人').AsString:=frm_send_msg.t_crm_client_link['姓名']; end; frm_send_msg.memmsg.FieldByName('内容').AsString:='主提单号:'+qrytd_qr['主提单号']+',' +'开船日期:'+qrytd_qr.Fieldbyname('开船日期').AsString+','+'船名:'+qrytd_qr.Fieldbyname('船名').AsString+',' +'航次:'+qrytd_qr.Fieldbyname('航次').AsString+' '+'已接受您的确认'; if trim(get_parameters_value(136,'无'))='MSN' then frm_send_msg.checkboxMSN.Checked:=true; if trim(get_parameters_value(136,'无'))='邮件' then frm_send_msg.checkboxMAIL.Checked:=true; if trim(get_parameters_value(136,'无'))='短信' then frm_send_msg.checkboxMSG.Checked:=true; frm_send_msg.ShowModal; finally FreeAndNil(frm_send_msg); end; end; procedure Tfrm_op_seae_assistant_qr.pop3Click(Sender: TObject); begin// 批准客户修改 qrytd_qr.Edit ; qrytd_qr.FieldByName('提交确认').AsString:=td_assate4 ; qrytd_qr.Post ; dsrassitant.DataSet.edit ; dsrassitant.DataSet['提交确认']:=td_sate5 ; dsrassitant.DataSet.Post ; end; procedure Tfrm_op_seae_assistant_qr.bsSkinButton5Click(Sender: TObject); begin close ; end; procedure Tfrm_op_seae_assistant_qr.bsSkinButton38Click(Sender: TObject); begin qrytd_qr.Edit ; end; procedure Tfrm_op_seae_assistant_qr.bsSkinButton2Click(Sender: TObject); begin if qrytd_qr.State in [dsedit,dsinsert] then qrytd_qr.Post ; end; procedure Tfrm_op_seae_assistant_qr.bsSkinButton8Click(Sender: TObject); begin if qrytd_qr.State in [dsedit,dsinsert] then qrytd_qr.Cancel ; end; procedure Tfrm_op_seae_assistant_qr.bsSkinButton9Click(Sender: TObject); begin sys_print('海运提单确认',2,dsrtd_qr,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_seae_assistant_qr.setdiffcolor; var i:integer ; myfield:string ; begin for i:=0 to bsSkinPanel3.ControlCount-1 do with bsSkinPanel3 do if (bsSkinPanel3.Controls[i] is TDBRichEdit) then begin myfield:=(Controls[i] as TDBRichEdit).DataField ; if AnsiCompareStr(qrytd_qr.Fieldbyname(myfield).asstring , dsrassitant.DataSet.fieldbyname(myfield).asstring)<>0 then (bsSkinPanel3.Controls[i] as TDBRichEdit).Font.Color:=clred else (bsSkinPanel3.Controls[i] as TDBRichEdit).Font.Color:=clblack ; end else if (bsSkinPanel3.Controls[i] is TDBEdit) then begin myfield:=(Controls[i] as TDBEdit).DataField ; if AnsiCompareStr(qrytd_qr.Fieldbyname(myfield).asstring , dsrassitant.DataSet.fieldbyname(myfield).asstring)<>0 then (bsSkinPanel3.Controls[i] as TDBEdit).Font.Color:=clred else (bsSkinPanel3.Controls[i] as TDBEdit).Font.Color:=clblack ; end else if (bsSkinPanel3.Controls[i] is TDBMemo) then begin myfield:=(Controls[i] as TDBMEMO).DataField ; if AnsiCompareStr(qrytd_qr.Fieldbyname(myfield).asstring , dsrassitant.DataSet.fieldbyname(myfield).asstring)<>0 then (bsSkinPanel3.Controls[i] as TDBMEMO).Font.Color:=clred else (bsSkinPanel3.Controls[i] as TDBMEMO).Font.Color:=clblack ; end ; end; procedure Tfrm_op_seae_assistant_qr.qrytd_qrAfterPost(DataSet: TDataSet); begin setdiffcolor; end; procedure Tfrm_op_seae_assistant_qr.FormShow(Sender: TObject); begin chkedmain.Checked:=loadedmain ; lblcompany.Caption:=frm_data_share.t_sys_company.fieldbyname('简称').asstring ; end; procedure Tfrm_op_seae_assistant_qr.DBRichEdit1DblClick(Sender: TObject); begin frm_op_seae_difftd:=Tfrm_op_seae_difftd.Create(self); frm_op_seae_difftd.showchgtd(dsrassitant,dsrtd_qr,TDBRichEdit(sender).DataField); frm_op_seae_difftd.Free ; end; procedure Tfrm_op_seae_assistant_qr.DBMemo18DblClick(Sender: TObject); begin frm_op_seae_difftd:=Tfrm_op_seae_difftd.Create(self); frm_op_seae_difftd.showchgtd(dsrassitant,dsrtd_qr,TDBMemo(sender).DataField); frm_op_seae_difftd.Free ; end; procedure Tfrm_op_seae_assistant_qr.DBEdit3DblClick(Sender: TObject); begin frm_op_seae_difftd:=Tfrm_op_seae_difftd.Create(self); frm_op_seae_difftd.showchgtd(dsrassitant,dsrtd_qr,TDBEdit(sender).DataField); frm_op_seae_difftd.Free ; end; procedure Tfrm_op_seae_assistant_qr.bsSkinButton3Click(Sender: TObject); begin qrytd_qr.Refresh ; end; procedure Tfrm_op_seae_assistant_qr.bsSkinButton1Click(Sender: TObject); begin if messagebox(handle,pchar('确定要删除吗?'),pchar('提示'),MB_YESNO)=idyes then qrytd_qr.delete ; end; procedure Tfrm_op_seae_assistant_qr.FormClose(Sender: TObject; var Action: TCloseAction); begin saveedmain(chkedmain.Checked); end; end.