unit u_rp_dui_seae_accept; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, bsSkinCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB, ADODB, StdCtrls, Mask, DBCtrls, dxDBTLCl, dxGrClms, RxLookup, wwdbdatetimepicker, Menus, XPMenu, ComCtrls, bsSkinTabs, RxMemDS, bsdbctrls; type Tfrm_rp_dui_seae_accept = class(TForm) Panel1: TPanel; bsSkinPanel2: TbsSkinPanel; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton11: TbsSkinButton; Notebook1: TNotebook; dxDBGrid1: TdxDBGrid; bsSkinPanel3: TbsSkinPanel; t_ch_dui: TADOQuery; t_ch_dui1: TDataSource; bsSkinPanel4: TbsSkinPanel; Label1: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; Label11: TLabel; Label12: TLabel; Label13: TLabel; Label14: TLabel; Edit4: TEdit; Edit2: TEdit; Edit3: TEdit; wwDBDateTimePicker1: TwwDBDateTimePicker; wwDBDateTimePicker3: TwwDBDateTimePicker; wwDBDateTimePicker2: TwwDBDateTimePicker; wwDBDateTimePicker4: TwwDBDateTimePicker; RxDBLookupCombo2: TRxDBLookupCombo; bsSkinButton7: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinPanel5: TbsSkinPanel; dxDBGrid3: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGridMaskColumn2: TdxDBGridMaskColumn; dxDBGridMaskColumn3: TdxDBGridMaskColumn; dxDBGridMaskColumn4: TdxDBGridMaskColumn; dxDBGridMaskColumn5: TdxDBGridMaskColumn; dxDBGridDateColumn1: TdxDBGridDateColumn; dxDBGridDateColumn2: TdxDBGridDateColumn; dxDBGridMaskColumn6: TdxDBGridMaskColumn; dxDBGridColumn1: TdxDBGridColumn; dxDBGridMaskColumn7: TdxDBGridMaskColumn; dxDBGridMaskColumn8: TdxDBGridMaskColumn; dxDBGridMaskColumn9: TdxDBGridMaskColumn; dxDBGridMaskColumn10: TdxDBGridMaskColumn; dxDBGridColumn2: TdxDBGridColumn; dxDBGridColumn3: TdxDBGridColumn; dxDBGridMaskColumn11: TdxDBGridMaskColumn; dxDBGridMaskColumn12: TdxDBGridMaskColumn; dxDBGridMaskColumn13: TdxDBGridMaskColumn; Panel2: TPanel; dxDBGrid4: TdxDBGrid; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridColumn; dxDBGrid1Column3: TdxDBGridColumn; t_op_seae: TADOQuery; t_op_seae1: TDataSource; t_ch_fee: TADOQuery; t_ch_fee1: TDataSource; PopupMenu1: TPopupMenu; N1: TMenuItem; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; dxDBGrid1Column9: TdxDBGridDateColumn; bsSkinButton12: TbsSkinButton; t_ch_dui_format1: TDataSource; bsSkinPanel1: TbsSkinPanel; bsSkinPanel6: TbsSkinPanel; Label2: TLabel; DBEdit2: TDBEdit; DBEdit5: TDBEdit; Label5: TLabel; Label6: TLabel; Label15: TLabel; RxDBLookupCombo3: TRxDBLookupCombo; DBEdit6: TDBEdit; Label3: TLabel; RxDBLookupCombo1: TRxDBLookupCombo; DBEdit7: TDBEdit; Label7: TLabel; Label4: TLabel; DBEdit4: TDBEdit; t_ch_dui_format: TADOQuery; t_ch_dui_bill: TADOQuery; p_update: TADOStoredProc; v_dui_bill: TADOQuery; v_dui_bill1: TDataSource; v_dui_fee: TADOQuery; v_dui_fee1: TDataSource; bsSkinButton6: TbsSkinButton; PopupMenu2: TPopupMenu; N5: TMenuItem; XPMenu1: TXPMenu; wwDBDateTimePicker5: TwwDBDateTimePicker; Label16: TLabel; wwDBDateTimePicker6: TwwDBDateTimePicker; Label17: TLabel; Label18: TLabel; DBEdit1: TDBEdit; Label19: TLabel; wwDBDateTimePicker7: TwwDBDateTimePicker; dxDBGrid3Column19: TdxDBGridColumn; dxDBGrid3Column20: TdxDBGridColumn; t_bill_fee_dong: TRxMemoryData; t_bill_fee_dong1: TDataSource; Panel3: TPanel; dxDBGrid5: TdxDBGrid; dxDBGrid5Column1: TdxDBGridMaskColumn; dxDBGrid5Column2: TdxDBGridMaskColumn; dxDBGrid5Column6: TdxDBGridMaskColumn; dxDBGrid5Column7: TdxDBGridColumn; dxDBGrid5Column8: TdxDBGridColumn; dxDBGrid5Column9: TdxDBGridColumn; dxDBGrid6: TdxDBGrid; dxDBGrid6Column1: TdxDBGridMaskColumn; dxDBGrid6Column2: TdxDBGridMaskColumn; dxDBGrid6Column3: TdxDBGridMaskColumn; dxDBGrid6RMB: TdxDBGridColumn; dxDBGrid6Column20: TdxDBGridColumn; dxDBGrid6Column21: TdxDBGridColumn; dxDBGrid6USD: TdxDBGridColumn; dxDBGrid6Column23: TdxDBGridColumn; dxDBGrid6Column24: TdxDBGridColumn; dxDBGrid6Column4: TdxDBGridMaskColumn; dxDBGrid6Column5: TdxDBGridMaskColumn; dxDBGrid6Column6: TdxDBGridMaskColumn; dxDBGrid6Column7: TdxDBGridDateColumn; dxDBGrid6Column8: TdxDBGridMaskColumn; dxDBGrid6Column9: TdxDBGridMaskColumn; dxDBGrid6Column10: TdxDBGridMaskColumn; dxDBGrid6Column11: TdxDBGridMaskColumn; dxDBGrid6Column12: TdxDBGridColumn; dxDBGrid6Column13: TdxDBGridColumn; dxDBGrid6Column14: TdxDBGridMaskColumn; dxDBGrid6Column15: TdxDBGridMaskColumn; dxDBGrid6Column16: TdxDBGridMaskColumn; dxDBGrid6Column17: TdxDBGridMaskColumn; dxDBGrid6Column18: TdxDBGridMaskColumn; dxDBGrid6Column25: TdxDBGridColumn; dxDBGrid6Column26: TdxDBGridColumn; PopupMenu3: TPopupMenu; N2: TMenuItem; PopupMenu4: TPopupMenu; N3: TMenuItem; bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox; dxDBGrid6Column27: TdxDBGridColumn; Label20: TLabel; wwDBDateTimePicker8: TwwDBDateTimePicker; Label21: TLabel; wwDBDateTimePicker9: TwwDBDateTimePicker; dxDBGrid3Column21: TdxDBGridColumn; Label22: TLabel; Edit1: TEdit; Edit5: TEdit; Label23: TLabel; dxDBGrid3Column22: TdxDBGridColumn; dxDBGrid3Column23: TdxDBGridColumn; Label24: TLabel; RxDBLookupCombo4: TRxDBLookupCombo; Label25: TLabel; RxDBLookupCombo19: TRxDBLookupCombo; dxDBGrid3Column24: TdxDBGridColumn; dxDBGrid4Column5: TdxDBGridColumn; procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinPanel2Resize(Sender: TObject); procedure t_ch_duiAfterInsert(DataSet: TDataSet); procedure t_ch_duiBeforePost(DataSet: TDataSet); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure bsSkinButton12Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure t_ch_duiAfterScroll(DataSet: TDataSet); procedure N1Click(Sender: TObject); procedure RxDBLookupCombo1Enter(Sender: TObject); procedure dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure N5Click(Sender: TObject); procedure N2Click(Sender: TObject); procedure N3Click(Sender: TObject); procedure bsSkinDBCheckRadioBox1Enter(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_rp_dui_seae_accept: Tfrm_rp_dui_seae_accept; implementation uses u_main, my_sys_function, u_data_share, u_rp_dui_format, u_rp_dui_query; {$R *.dfm} procedure Tfrm_rp_dui_seae_accept.bsSkinButton8Click(Sender: TObject); begin RxDBLookupCombo2.ClearValue; Edit4.text:=''; Edit3.Text:=''; Edit2.text:=''; wwDBDateTimePicker1.Clear; wwDBDateTimePicker2.clear; wwDBDateTimePicker3.clear; wwDBDateTimePicker4.clear; Edit1.text:=''; Edit5.text:=''; end; procedure Tfrm_rp_dui_seae_accept.bsSkinButton7Click(Sender: TObject); var str_fee,str_op:widestring; begin if NOT strtobool(get_parameters_value(47,'false')) then begin str_fee:='where (是否对帐=0 OR 是否对帐 IS NULL) and 类型='+''''+'收'+'''' +' and 费用状态 in ('+''''+'审核通过'+''''+','+''''+'部分结算'+'''' +','+''''+'结算完毕'+''''+','+''''+'禁止删除'+'''' +','+''''+'禁止修改'+''''+')'; end else begin str_fee:='where (是否对帐=0 OR 是否对帐 IS NULL) and 类型='+''''+'收'+'''' +' and 费用状态 in ('+''''+'审核通过'+''''+','+''''+'部分结算'+'''' +','+''''+'禁止删除'+'''' +','+''''+'禁止修改'+''''+')'; end; if RxDBLookupCombo2.DisplayValues[1]<>''then str_fee:=str_fee+' and 客户名称='+''''+RxDBLookupCombo2.DisplayValues[1]+''''; str_op:=''; if Edit4.text<>''then str_op:=str_op+' and 委托编号 like '+''''+'%'+Edit4.text+'%'+''''; if Edit2.text<>''then str_op:=str_op+' and 主提单号 like '+''''+'%'+Edit2.text+'%'+''''; if Edit3.text<>''then str_op:=str_op+' and 分提单号 like '+''''+'%'+Edit3.text+'%'+''''; if wwDBDateTimePicker1.text<>''then str_op:=str_op+' and 开船日期>='+''''+wwDBDateTimePicker1.text+''''; if wwDBDateTimePicker2.text<>''then str_op:=str_op+' and 开船日期<='+''''+wwDBDateTimePicker2.text+''''; if wwDBDateTimePicker8.text<>''then str_op:=str_op+' and 预抵日期>='+''''+wwDBDateTimePicker8.text+''''; if wwDBDateTimePicker9.text<>''then str_op:=str_op+' and 预抵日期<'+''''+FormatDateTime('YYYY-MM-DD',(wwDBDateTimePicker9.Date+1))+''''; if wwDBDateTimePicker3.text<>''then str_op:=str_op+' and 会计期间>='+''''+wwDBDateTimePicker3.text+''''; if wwDBDateTimePicker4.text<>''then str_op:=str_op+' and 会计期间<='+''''+wwDBDateTimePicker4.text+''''; if Edit1.text<>''then str_op:=str_op+' and 占舱备注 like '+''''+'%'+Edit1.text+'%'+''''; if Edit5.text<>''then str_op:=str_op+' and 其他备注 like '+''''+'%'+Edit5.text+'%'+''''; if RxDBLookupCombo4.DisplayValues[1]<>''then str_op:=str_op+' and 船公司='+''''+RxDBLookupCombo4.DisplayValues[1]+''''; if RxDBLookupCombo19.DisplayValues[1]<>'' then begin str_fee:=str_fee+' and 委托单位 in (select 客户简称 from t_crm_client where 客户全称='+''''+RxDBLookupCombo2.DisplayValues[1]+''')'; end; str_op:='where 编号 in (select distinct 编号 from t_ch_fee '+str_fee+')'+str_op; str_op:=str_op+' and '+open_data('0032','揽货人','操作员','客服员','no','no'); str_op:='select * from t_op_seae '+str_op+default_sort(53,'t_op_seae','','desc'); str_fee:='select * from t_ch_fee ' +str_fee+' and 编号=:编号 order by CH_ID'; t_ch_fee.Close; t_op_seae.close; t_op_seae.sql.clear; t_op_seae.sql.add(str_op); t_op_seae.open; t_ch_fee.sql.clear; t_ch_fee.sql.add(str_fee); t_ch_fee.open; end; procedure Tfrm_rp_dui_seae_accept.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_rp_dui_seae_accept.Hide; frm_rp_dui_seae_accept.ManualFloat(frm_rp_dui_seae_accept.BoundsRect ); frm_main.freeTabs('frm_rp_dui_seae_accept'); action:=cafree; frm_rp_dui_seae_accept:=nil; end; procedure Tfrm_rp_dui_seae_accept.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_rp_dui_seae_accept.bsSkinPanel2Resize(Sender: TObject); var i:integer; begin i:=round(bsSkinPanel2.width/10); bsSkinButton9.width:=i; bsSkinButton12.width:=i; bsSkinButton10.width:=i; bsSkinButton1.width:=i; bsSkinButton2.width:=i; bsSkinButton4.width:=i; bsSkinButton3.width:=i; bsSkinButton11.width:=i; bsSkinButton6.width:=i; end; procedure Tfrm_rp_dui_seae_accept.t_ch_duiAfterInsert(DataSet: TDataSet); begin t_ch_dui['对帐日期']:=date; t_ch_dui['对帐人']:=employee; t_ch_dui['类别']:=1; t_ch_dui['仅显示未结算费用']:=1; if not t_ch_fee.IsEmpty then t_ch_dui['对帐客户']:=t_ch_fee.fieldbyname('客户名称').asstring; end; procedure Tfrm_rp_dui_seae_accept.t_ch_duiBeforePost(DataSet: TDataSet); begin table_before_post(t_ch_dui,'对帐客户'); if t_ch_dui.State=dsinsert then begin t_ch_dui['对帐编号']:=get_no(date,'D1'); end; end; procedure Tfrm_rp_dui_seae_accept.bsSkinButton1Click(Sender: TObject); begin t_ch_dui.insert; Notebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; end; procedure Tfrm_rp_dui_seae_accept.bsSkinButton2Click(Sender: TObject); begin table_post(t_ch_dui); end; procedure Tfrm_rp_dui_seae_accept.bsSkinButton4Click(Sender: TObject); var str:widestring; begin if t_ch_dui.IsEmpty then exit; if application.MessageBox('您确定要删除数据吗?','警告:',MB_OKCANCEL)<>IDOK then exit; v_dui_bill.first; while not v_dui_bill.eof do begin str:='update t_ch_fee set 是否对帐=0,对帐编号=null' +' where 编号='+''''+v_dui_bill.fieldbyname('编号').asstring+'''' +' and 对帐编号='+''''+t_ch_dui.fieldbyname('对帐编号').asstring+''''; p_update.Parameters.ParamByName('SQLStr').value:=str; p_update.ExecProc; if t_ch_dui_bill.Locate('编号',v_dui_bill.fieldbyname('编号').asstring,[])then t_ch_dui_bill.delete; v_dui_bill.next; end; t_ch_dui.delete; if t_op_seae.Active then t_op_seae.Requery(); end; procedure Tfrm_rp_dui_seae_accept.bsSkinButton3Click(Sender: TObject); begin table_cancel(t_ch_dui); end; procedure Tfrm_rp_dui_seae_accept.bsSkinButton11Click(Sender: TObject); var answer:TModalResult; begin if bsSkinButton11.Caption='编辑修改' then begin Notebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; end else begin if (t_ch_dui.State=dsinsert)or(t_ch_dui.State=dsedit) then BEGIN answer:=messagedlg( '数据已经修改,是否保存?',mtWarning,mbYesNoCancel,0); if answer=mrYes then begin t_ch_dui.post; end; if answer=mrNo then begin t_ch_dui.cancel; end; if answer=mrCancel then begin exit; end; END; Notebook1.PageIndex:=0; bsSkinButton11.Caption:='编辑修改'; end; end; procedure Tfrm_rp_dui_seae_accept.bsSkinButton12Click(Sender: TObject); begin try if not assigned(frm_rp_dui_format) then frm_rp_dui_format:=tfrm_rp_dui_format.Create (self); dui_format_type:=1; frm_rp_dui_format.showmodal; finally frm_rp_dui_format.free; frm_rp_dui_format:=nil; t_ch_dui_format.requery; end; end; procedure Tfrm_rp_dui_seae_accept.FormShow(Sender: TObject); var str:widestring; begin t_ch_dui_format.Parameters[0].value:=1; t_ch_dui_format.open; str:='select top 50 * from t_ch_dui '; str:=str+' where 类别=1 and 对帐人='+''''+employee+''''+' order by 对帐日期 desc'; t_ch_dui.close; t_ch_dui.SQL.clear; t_ch_dui.sql.Add(str); t_ch_dui.open; t_ch_dui_bill.open; v_dui_bill.open; v_dui_fee.Parameters.ParamByName('对帐编号').value:=t_ch_dui.fieldbyname('对帐编号').asstring; v_dui_fee.open; frm_data_share.t_crm_client_all.requery; Notebook1.PageIndex:=0; end; procedure Tfrm_rp_dui_seae_accept.t_ch_duiAfterScroll(DataSet: TDataSet); begin if v_dui_fee.active then begin v_dui_fee.close; v_dui_fee.Parameters.ParamByName('对帐编号').value:=t_ch_dui.fieldbyname('对帐编号').asstring; v_dui_fee.open; end; end; procedure Tfrm_rp_dui_seae_accept.N1Click(Sender: TObject); var i,k:integer; begin if t_op_seae.IsEmpty then exit; if t_ch_dui.IsEmpty then exit; if t_ch_dui.FieldByName('对帐客户').asstring='' then begin t_ch_dui.edit; t_ch_dui['对帐客户']:=t_ch_fee.FieldByName('客户名称').asstring; t_ch_dui.post; end; if dxDBGrid3.SelectedCount>=1 then begin for i:=0 to dxDBGrid3.SelectedCount-1 do begin t_op_seae.GotoBookmark(pointer(dxDBGrid3.selectedrows[i])); t_ch_fee.first; while not t_ch_fee.Eof do begin if t_ch_dui.FieldByName('对帐客户').asstring<>t_ch_fee.FieldByName('客户名称').asstring then begin showmessage('当前客户名称与对帐客户名称不符,加入失败!!'); exit; end; t_ch_fee.next; end; end; end else begin t_ch_fee.first; while not t_ch_fee.Eof do begin if getFullName(t_ch_dui.FieldByName('对帐客户').asstring)<>getFullName(t_ch_fee.FieldByName('客户名称').asstring) then begin showmessage('当前客户名称与对帐客户名称不符,加入失败!!'); exit; end; t_ch_fee.next; end; end; if (t_ch_dui.state=dsinsert)or(t_ch_dui.state=dsedit) then t_ch_dui.Post; if dxDBGrid3.SelectedCount>=1 then begin for i:=0 to dxDBGrid3.SelectedCount-1 do begin t_op_seae.GotoBookmark(pointer(dxDBGrid3.selectedrows[i])); if not t_ch_fee.IsEmpty then begin if not t_ch_dui_bill.Locate('对帐编号;编号',VarArrayOf([t_ch_dui.FieldByName('对帐编号').asstring,t_op_seae.FieldByName('编号').asstring]),[]) then begin t_ch_dui_bill.insert; t_ch_dui_bill['对帐编号']:=t_ch_dui.FieldByName('对帐编号').asstring; t_ch_dui_bill['编号']:=t_op_seae.FieldByName('编号').asstring; t_ch_dui_bill.post; end; t_ch_fee.first; while not t_ch_fee.Eof do begin t_ch_fee.edit; t_ch_fee['是否对帐']:=1; t_ch_fee['对帐编号']:=t_ch_dui.FieldByName('对帐编号').asstring; t_ch_fee.post; t_ch_fee.next; end; end; end; end else begin if not t_ch_fee.IsEmpty then begin if not t_ch_dui_bill.Locate('对帐编号;编号',VarArrayOf([t_ch_dui.FieldByName('对帐编号').asstring,t_op_seae.FieldByName('编号').asstring]),[]) then begin t_ch_dui_bill.insert; t_ch_dui_bill['对帐编号']:=t_ch_dui.FieldByName('对帐编号').asstring; t_ch_dui_bill['编号']:=t_op_seae.FieldByName('编号').asstring; t_ch_dui_bill.post; END; t_ch_fee.first; while not t_ch_fee.Eof do begin t_ch_fee.edit; t_ch_fee['是否对帐']:=1; t_ch_fee['对帐编号']:=t_ch_dui.FieldByName('对帐编号').asstring; t_ch_fee.post; t_ch_fee.next; end; end; end; t_op_seae.requery; v_dui_bill.requery; end; procedure Tfrm_rp_dui_seae_accept.RxDBLookupCombo1Enter(Sender: TObject); begin if t_ch_dui_bill.IsEmpty then RxDBLookupCombo1.ReadOnly:=false else RxDBLookupCombo1.ReadOnly:=true; end; procedure Tfrm_rp_dui_seae_accept.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort(Column,t_ch_dui,'对帐编号'); end; procedure Tfrm_rp_dui_seae_accept.bsSkinButton9Click(Sender: TObject); begin if t_ch_dui.IsEmpty then exit; if t_ch_dui.fieldbyname('DM_ID').asstring='' then exit; if t_ch_dui.fieldbyname('DM_ID').asstring='0' then exit; if t_ch_dui.State in [dsedit,dsinsert] then t_ch_dui.Post; dui_table(t_bill_fee_dong,t_ch_dui_format.fieldbyname('字段内容').asstring,v_dui_bill,v_dui_fee,t_ch_dui['仅显示未结算费用']); if t_bill_fee_dong.FindField('开船日期')<>nil then t_bill_fee_dong.SortOnFields('开船日期'); sys_print('海运出口应收对帐'+t_ch_dui.fieldbyname('DM_ID').asstring,2,t_ch_dui1,nil,nil,nil,t_bill_fee_dong1,NIL,NIL,NIL,nil,nil,nil); end; procedure Tfrm_rp_dui_seae_accept.bsSkinButton10Click(Sender: TObject); begin try if not assigned(frm_rp_dui_query) then frm_rp_dui_query:=tfrm_rp_dui_query.Create (self); dui_query_num:=1; frm_rp_dui_query.showmodal; finally frm_rp_dui_query.free; frm_rp_dui_query:=nil; end; end; procedure Tfrm_rp_dui_seae_accept.bsSkinButton6Click(Sender: TObject); begin if t_ch_dui.IsEmpty then exit; sys_print('海运出口应收对帐',2,t_ch_dui1,nil,nil,nil,v_dui_bill1,v_dui_fee1,NIL,NIL,nil,nil,nil); end; procedure Tfrm_rp_dui_seae_accept.N5Click(Sender: TObject); var i:integer; str:widestring; begin if v_dui_bill.IsEmpty then exit; if dxDBGrid6.SelectedCount>=1 then begin for i:=0 to dxDBGrid6.SelectedCount-1 do begin v_dui_bill.GotoBookmark(pointer(dxDBGrid6.selectedrows[i])); str:='update t_ch_fee set 是否对帐=0,对帐编号=null' +' where 编号='+''''+v_dui_bill.fieldbyname('编号').asstring+'''' +' and 对帐编号='+''''+t_ch_dui.fieldbyname('对帐编号').asstring+''''; p_update.Parameters.ParamByName('SQLStr').value:=str; p_update.ExecProc; if t_ch_dui_bill.Locate('编号',v_dui_bill.fieldbyname('编号').asstring,[])then t_ch_dui_bill.delete; end; end else begin str:='update t_ch_fee set 是否对帐=0,对帐编号=null' +' where 编号='+''''+v_dui_bill.fieldbyname('编号').asstring+'''' +' and 对帐编号='+''''+t_ch_dui.fieldbyname('对帐编号').asstring+''''; p_update.Parameters.ParamByName('SQLStr').value:=str; p_update.ExecProc; if t_ch_dui_bill.Locate('编号',v_dui_bill.fieldbyname('编号').asstring,[])then t_ch_dui_bill.delete; end; if t_op_seae.Active then t_op_seae.Requery(); v_dui_bill.Requery(); end; procedure Tfrm_rp_dui_seae_accept.N2Click(Sender: TObject); var i,k:integer; book1:Tbookmark; begin if t_op_seae.IsEmpty then exit; if t_ch_dui.IsEmpty then exit; if t_ch_dui.FieldByName('对帐客户').asstring='' then begin t_ch_dui.edit; t_ch_dui['对帐客户']:=t_ch_fee.FieldByName('客户名称').asstring; t_ch_dui.post; end; if (t_ch_dui.state=dsinsert)or(t_ch_dui.state=dsedit) then t_ch_dui.Post; if getFullName(t_ch_dui.FieldByName('对帐客户').asstring)<>getFullName(t_ch_fee.FieldByName('客户名称').asstring) then begin showmessage('当前客户名称与对帐客户名称不符,加入失败!!'); exit; end; if not t_ch_fee.IsEmpty then begin if not t_ch_dui_bill.Locate('对帐编号;编号',VarArrayOf([t_ch_dui.FieldByName('对帐编号').asstring,t_op_seae.FieldByName('编号').asstring]),[]) then begin t_ch_dui_bill.insert; t_ch_dui_bill['对帐编号']:=t_ch_dui.FieldByName('对帐编号').asstring; t_ch_dui_bill['编号']:=t_op_seae.FieldByName('编号').asstring; t_ch_dui_bill.post; end; t_ch_fee.edit; t_ch_fee['是否对帐']:=1; t_ch_fee['对帐编号']:=t_ch_dui.FieldByName('对帐编号').asstring; t_ch_fee.post; end; v_dui_bill.requery; book1:=t_op_seae.GetBookmark; t_op_seae.Refresh; t_op_seae.GotoBookmark(book1); end; procedure Tfrm_rp_dui_seae_accept.N3Click(Sender: TObject); var Str:String; begin if v_dui_bill.IsEmpty then exit; if v_dui_fee.IsEmpty then exit; str:='update t_ch_fee set 是否对帐=0,对帐编号=null' +' where CH_ID='+v_dui_fee.fieldbyname('CH_ID').asstring; p_update.Parameters.ParamByName('SQLStr').value:=str; p_update.ExecProc; if t_op_seae.Active then t_op_seae.Requery(); v_dui_bill.Requery(); v_dui_fee.Requery(); end; procedure Tfrm_rp_dui_seae_accept.bsSkinDBCheckRadioBox1Enter( Sender: TObject); begin if not (t_ch_dui.State in [dsinsert,dsedit]) then t_ch_dui.Edit; end; end.