{$INCLUDE t_main.inc} unit u_op_seae_query; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, RxLookup, StdCtrls, Mask, wwdbedit, Wwdotdot, Wwdbcomb, wwdbdatetimepicker, wwdblook, bsSkinCtrls, BusinessSkinForm, DB, ComCtrls, bsSkinTabs, ADODB, DBCtrls, RxMemDS, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms,inifiles; type Tfrm_op_seae_query = class(TForm) bsBusinessSkinForm1: TbsBusinessSkinForm; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinTabSheet2: TbsSkinTabSheet; Label10: TLabel; Label9: TLabel; Label14: TLabel; Label15: TLabel; Label6: TLabel; Label7: TLabel; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label8: TLabel; Label11: TLabel; Label12: TLabel; Label20: TLabel; Label124: TLabel; Label13: TLabel; Label16: TLabel; Label28: TLabel; Label17: TLabel; Label18: TLabel; Label19: TLabel; Label21: TLabel; Label24: TLabel; Label22: TLabel; Label23: TLabel; Label25: TLabel; Label26: TLabel; Label27: TLabel; Label29: TLabel; Label125: TLabel; Label30: TLabel; Label31: TLabel; Label32: TLabel; Edit1: TEdit; RxDBLookupCombo2: TRxDBLookupCombo; RxDBLookupCombo3: TRxDBLookupCombo; RxDBLookupCombo4: TRxDBLookupCombo; Edit2: TEdit; Edit3: TEdit; Edit4: TEdit; wwDBComboBox1: TwwDBComboBox; wwDBComboBox2: TwwDBComboBox; wwDBDateTimePicker1: TwwDBDateTimePicker; wwDBDateTimePicker2: TwwDBDateTimePicker; wwDBDateTimePicker3: TwwDBDateTimePicker; wwDBDateTimePicker4: TwwDBDateTimePicker; RxDBLookupCombo1: TRxDBLookupCombo; wwDBLookupCombo3: TwwDBLookupCombo; wwDBLookupCombo52: TwwDBLookupCombo; RxDBLookupCombo5: TRxDBLookupCombo; RxDBLookupCombo6: TRxDBLookupCombo; bsSkinButton10: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton1: TbsSkinButton; RxDBLookupCombo7: TRxDBLookupCombo; RxDBLookupCombo8: TRxDBLookupCombo; RxDBLookupCombo9: TRxDBLookupCombo; RxDBLookupCombo11: TRxDBLookupCombo; RxDBLookupCombo20: TRxDBLookupCombo; wwDBComboBox3: TwwDBComboBox; wwDBComboBox4: TwwDBComboBox; wwDBComboBox5: TwwDBComboBox; wwDBComboBox6: TwwDBComboBox; wwDBComboBox7: TwwDBComboBox; wwDBComboBox8: TwwDBComboBox; wwDBComboBox9: TwwDBComboBox; wwDBComboBox10: TwwDBComboBox; wwDBComboBox11: TwwDBComboBox; wwDBComboBox12: TwwDBComboBox; wwDBComboBox13: TwwDBComboBox; wwDBComboBox14: TwwDBComboBox; wwDBComboBox15: TwwDBComboBox; wwDBComboBox16: TwwDBComboBox; wwDBComboBox17: TwwDBComboBox; wwDBComboBox18: TwwDBComboBox; wwDBComboBox19: TwwDBComboBox; wwDBComboBox20: TwwDBComboBox; wwDBComboBox21: TwwDBComboBox; wwDBComboBox22: TwwDBComboBox; wwDBComboBox23: TwwDBComboBox; wwDBComboBox24: TwwDBComboBox; wwDBComboBox25: TwwDBComboBox; wwDBComboBox26: TwwDBComboBox; wwDBComboBox27: TwwDBComboBox; wwDBComboBox28: TwwDBComboBox; RxDBLookupCombo10: TRxDBLookupCombo; RxDBLookupCombo12: TRxDBLookupCombo; wwDBComboBox29: TwwDBComboBox; wwDBComboBox30: TwwDBComboBox; wwDBComboBox31: TwwDBComboBox; wwDBComboBox32: TwwDBComboBox; RxDBLookupCombo13: TRxDBLookupCombo; wwDBComboBox33: TwwDBComboBox; Edit5: TEdit; wwDBComboBox34: TwwDBComboBox; Edit6: TEdit; wwDBLookupCombo49: TwwDBLookupCombo; wwDBComboBox35: TwwDBComboBox; Edit7: TEdit; wwDBComboBox36: TwwDBComboBox; wwDBComboBox37: TwwDBComboBox; Edit8: TEdit; Edit9: TEdit; wwDBComboBox38: TwwDBComboBox; t_sys_queryfields: TADOQuery; t_sys_queryfields1: TDataSource; bsSkinGroupBox1: TbsSkinGroupBox; bsSkinPanel1: TbsSkinPanel; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinPanel2: TbsSkinPanel; Label33: TLabel; RxDBLookupList1: TRxDBLookupList; RxDBLookupCombo14: TRxDBLookupCombo; Label34: TLabel; wwDBComboBox39: TwwDBComboBox; Label35: TLabel; wwDBComboBox40: TwwDBComboBox; Label36: TLabel; bsSkinGroupBox2: TbsSkinGroupBox; bsSkinPanel3: TbsSkinPanel; bsSkinButton3: TbsSkinButton; bsSkinButton7: TbsSkinButton; t_sys_query_detail1: TDataSource; dxDBGrid1: TdxDBGrid; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; query_bit: TwwDBComboBox; query_str_int: TEdit; query_date: TwwDBDateTimePicker; t_sys_query: TADOQuery; t_sys_query1: TDataSource; t_sys_query_detail: TADOQuery; dxDBGrid2: TdxDBGrid; dxDBGrid2SQ_ID: TdxDBGridMaskColumn; bsSkinButton6: TbsSkinButton; bsSkinButton9: TbsSkinButton; dxDBGrid1Column1: TdxDBGridPickColumn; dxDBGrid1Column3: TdxDBGridPickColumn; Label37: TLabel; wwDBComboBox41: TwwDBComboBox; Edit10: TEdit; Label38: TLabel; wwDBComboBox42: TwwDBComboBox; Edit11: TEdit; Label39: TLabel; wwDBComboBox43: TwwDBComboBox; wwDBComboBox44: TwwDBComboBox; Label40: TLabel; wwDBComboBox45: TwwDBComboBox; RxDBLookupCombo15: TRxDBLookupCombo; Label41: TLabel; wwDBComboBox46: TwwDBComboBox; RxDBLookupCombo16: TRxDBLookupCombo; Edit12: TEdit; Label42: TLabel; wwDBComboBox47: TwwDBComboBox; bsSkinCheckRadioBox1: TbsSkinCheckRadioBox; bsSkinCheckRadioBox2: TbsSkinCheckRadioBox; wwDBComboBox48: TwwDBComboBox; Label43: TLabel; Label116: TLabel; Edit16: TEdit; Label44: TLabel; wwDBComboBox49: TwwDBComboBox; RxDBLookupCombo17: TRxDBLookupCombo; Label45: TLabel; wwDBComboBox50: TwwDBComboBox; wwDBDateTimePicker5: TwwDBDateTimePicker; Label46: TLabel; wwDBComboBox51: TwwDBComboBox; wwDBDateTimePicker6: TwwDBDateTimePicker; Label47: TLabel; wwDBComboBox52: TwwDBComboBox; wwDBComboBox53: TwwDBComboBox; Label48: TLabel; wwDBComboBox54: TwwDBComboBox; RxDBLookupCombo18: TRxDBLookupCombo; Label49: TLabel; wwDBComboBox55: TwwDBComboBox; Label50: TLabel; wwDBComboBox56: TwwDBComboBox; Edit13: TEdit; Edit14: TEdit; Label51: TLabel; wwDBComboBox57: TwwDBComboBox; Label52: TLabel; wwDBComboBox58: TwwDBComboBox; Label53: TLabel; Edit15: TEdit; procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure RxDBLookupCombo14Change(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure RxDBLookupList1DblClick(Sender: TObject); procedure wwDBComboBox15KeyPress(Sender: TObject; var Key: Char); procedure t_sys_queryAfterInsert(DataSet: TDataSet); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure t_sys_query_detailBeforePost(DataSet: TDataSet); procedure t_sys_query_detailAfterScroll(DataSet: TDataSet); private { Private declarations } procedure loadFindIni ; procedure writeFindIni ; public { Public declarations } end; var frm_op_seae_query: Tfrm_op_seae_query; seae_query_limited:string; seae_query_table:integer; implementation uses my_sys_function, u_op_seae, {$IFDEF XSGUANLI}u_ch_fee_sea_sales,{$ENDIF} u_ch_fee_check_seae, u_op_seae_close, {$IFDEF YWTAIZHANG}u_rp_tai_seae,{$ENDIF} u_rp_rp_seae, u_rp_fee_modify, u_data_share, u_main,{$IFDEF TBQITA} u_rp_fen_seae_ctn, u_rp_zou_seae,u_rp_fen_seae,{$ENDIF} {$IFDEF SJBAOGUAN}u_op_seae_apply, {$ENDIF}{$IFDEF YWFUHE}u_ch_fee_Recheck_seae, {$ENDIF}u_info_bunk; {$R *.dfm} procedure Tfrm_op_seae_query.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_seae_query.bsSkinButton10Click(Sender: TObject); begin Edit1.text:=''; Edit2.text:=''; Edit3.text:=''; Edit4.text:=''; Edit5.text:=''; Edit6.text:=''; Edit7.text:=''; Edit8.text:=''; Edit9.text:=''; Edit10.text:=''; Edit11.text:=''; Edit12.text:=''; wwDBComboBox1.text:=''; wwDBComboBox2.text:=''; wwDBDateTimePicker1.Clear; wwDBDateTimePicker2.Clear; wwDBDateTimePicker3.Clear; wwDBDateTimePicker4.Clear; wwDBDateTimePicker5.Clear; wwDBDateTimePicker6.Clear; wwDBComboBox3.text:=''; RxDBLookupCombo20.ClearValue; RxDBLookupCombo2.ClearValue; RxDBLookupCombo1.ClearValue; RxDBLookupCombo9.ClearValue; RxDBLookupCombo18.ClearValue; RxDBLookupCombo8.ClearValue; RxDBLookupCombo11.ClearValue; RxDBLookupCombo7.ClearValue; wwDBLookupCombo3.text:=''; wwDBLookupCombo52.text:=''; wwDBLookupCombo49.text:=''; RxDBLookupCombo4.ClearValue; RxDBLookupCombo3.ClearValue; RxDBLookupCombo6.ClearValue; RxDBLookupCombo5.ClearValue; RxDBLookupCombo10.ClearValue; RxDBLookupCombo12.ClearValue; wwDBComboBox31.text:=''; RxDBLookupCombo13.ClearValue; RxDBLookupCombo15.ClearValue; wwDBComboBox44.Text:=''; RxDBLookupCombo16.ClearValue; wwDBComboBox48.text:=''; wwDBComboBox57.text:=''; RxDBLookupCombo17.ClearValue; wwDBComboBox53.text:=''; end; procedure Tfrm_op_seae_query.bsSkinButton1Click(Sender: TObject); var str:widestring; str_date:string; str_tdld_not_empty:string;//0809捷丰会议:提单留底和提单COPY如果同时为空则参与检验,cjb 2017-08-21 begin writeFindIni; str:=''; if bsSkinTabSheet2.Showing then begin str:=query_tiaojian(1,str,'t_op_seae.业务编号',wwDBComboBox15.text,Edit1.text); str:=query_tiaojian(1,str,'t_op_seae.委托编号',wwDBComboBox4.text,Edit4.text); str:=query_tiaojian(1,str,'t_op_seae.主提单号',wwDBComboBox16.text,Edit2.text); str:=query_tiaojian(1,str,'t_op_seae.分提单号',wwDBComboBox5.text,Edit3.text); str:=query_tiaojian(1,str,'t_op_seae.订舱单号',wwDBComboBox47.text,Edit12.text); str:=query_tiaojian(1,str,'t_op_seae.报关单号',wwDBComboBox41.text,Edit10.text); str:=query_tiaojian(1,str,'t_op_seae.报检单号',wwDBComboBox42.text,Edit11.text); str:=query_tiaojian(1,str,'t_op_seae.发票号',wwDBComboBox33.text,Edit5.text); str:=query_tiaojian(1,str,'t_op_seae.核销单号',wwDBComboBox34.text,Edit6.text); str:=query_tiaojian(1,str,'t_op_seae.业务状态',wwDBComboBox17.text,wwDBComboBox1.text); str:=query_tiaojian(1,str,'t_op_seae.费用状态',wwDBComboBox7.text,wwDBComboBox2.text); str:=query_tiaojian(1,str,'t_op_seae.开船日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str:=query_tiaojian(1,str,'t_op_seae.开船日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str:=query_tiaojian(1,str,'t_op_seae.会计期间',wwDBComboBox19.text,wwDBDateTimePicker3.text); str:=query_tiaojian(1,str,'t_op_seae.会计期间',wwDBComboBox11.text,wwDBDateTimePicker4.text); str:=query_tiaojian(1,str,'t_op_seae.装运方式',wwDBComboBox20.text,wwDBComboBox3.text); str:=query_tiaojian(1,str,'t_op_seae.航线',wwDBComboBox10.text,RxDBLookupCombo20.DisplayValues[1]); str:=query_tiaojian(1,str,'t_op_seae.委托单位',wwDBComboBox21.text,RxDBLookupCombo2.DisplayValues[1]); str:=query_tiaojian(1,str,'t_op_seae.代理',wwDBComboBox54.text,RxDBLookupCombo18.DisplayValues[1]); str:=query_tiaojian(1,str,'t_op_seae.船公司',wwDBComboBox9.text,RxDBLookupCombo1.DisplayValues[1]); str:=query_tiaojian(1,str,'t_op_seae.报关行',wwDBComboBox22.text,RxDBLookupCombo9.DisplayValues[1]); str:=query_tiaojian(1,str,'t_op_seae.货代公司',wwDBComboBox8.text,RxDBLookupCombo8.DisplayValues[1]); str:=query_tiaojian(1,str,'t_op_seae.承运车队',wwDBComboBox23.text,RxDBLookupCombo11.DisplayValues[1]); str:=query_tiaojian(1,str,'t_op_seae.场站',wwDBComboBox12.text,RxDBLookupCombo7.DisplayValues[1]); str:=query_tiaojian(1,str,'t_op_seae.装货港',wwDBComboBox26.text,wwDBLookupCombo3.text); str:=query_tiaojian(1,str,'t_op_seae.卸货港',wwDBComboBox27.text,wwDBLookupCombo52.text); str:=query_tiaojian(1,str,'t_op_seae.客服员',wwDBComboBox24.text,RxDBLookupCombo4.DisplayValue); str:=query_tiaojian(1,str,'t_op_seae.揽货人',wwDBComboBox14.text,RxDBLookupCombo3.DisplayValue); str:=query_tiaojian(1,str,'t_op_seae.操作员',wwDBComboBox25.text,RxDBLookupCombo6.DisplayValue); str:=query_tiaojian(1,str,'t_op_seae.录入人',wwDBComboBox13.text,RxDBLookupCombo5.DisplayValue); str:=query_tiaojian(1,str,'t_op_seae.货物名称',wwDBComboBox32.text,RxDBLookupCombo13.DisplayValues[1]); str:=query_tiaojian(3,str,'t_op_seae.报关服务',wwDBComboBox30.text,wwDBComboBox31.text); str:=query_tiaojian(1,str,'t_op_seae.销售部门',wwDBComboBox28.text,RxDBLookupCombo10.DisplayValue); str:=query_tiaojian(1,str,'t_op_seae.操作部门',wwDBComboBox29.text,RxDBLookupCombo12.DisplayValue); str:=query_tiaojian(1,str,'t_op_seae.船名',wwDBComboBox36.text,wwDBLookupCombo49.text); str:=query_tiaojian(1,str,'t_op_seae.航次',wwDBComboBox35.text,Edit7.text); str:=query_tiaojian(1,str,'t_op_seae.箱号封号',wwDBComboBox37.text,Edit8.text); str:=query_tiaojian(2,str,'t_op_seae.周次',wwDBComboBox38.text,Edit9.text); str:=query_tiaojian(1,str,'t_op_seae.业务类型',wwDBComboBox43.text,wwDBComboBox44.text); str:=query_tiaojian(1,str,'t_op_seae.分部名称',wwDBComboBox45.text,RxDBLookupCombo15.DisplayValue); str:=query_tiaojian(1,str,'t_op_seae.业务来源',wwDBComboBox46.text,RxDBLookupCombo16.DisplayValue); str:=query_tiaojian(1,str,'t_op_seae.来源明细',wwDBComboBox49.text,RxDBLookupCombo17.DisplayValue); str:=query_tiaojian(1,str,'t_op_seae.费用封帐日期',wwDBComboBox50.text,wwDBDateTimePicker5.text); str:=query_tiaojian(1,str,'t_op_seae.费用封帐日期',wwDBComboBox51.text,wwDBDateTimePicker6.text); str:=query_tiaojian(3,str,'t_op_seae.是否退舱',wwDBComboBox52.text,wwDBComboBox53.text); str:=query_tiaojian(1,str,'t_op_seae.商品编码',wwDBComboBox55.text,Edit13.text); str:=query_tiaojian(1,str,'t_op_seae.商品名称',wwDBComboBox56.text,Edit14.text); str:=query_tiaojian(1,str,'t_op_seae.运费协议号','模糊',Edit15.text); if edit16.Text<>'' then begin if str='' then str:=' where (t_op_seae.主提单号 like '+''''+'%'+Edit16.text+'%'+''' or t_op_seae.分提单号 like '+''''+'%'+Edit16.text+'%'+''' or t_op_seae.委托编号 like '+''''+'%'+Edit16.text+'%'+''') ' else str:=' and (t_op_seae.主提单号 like '+''''+'%'+Edit16.text+'%'+''' or t_op_seae.分提单号 like '+''''+'%'+Edit16.text+'%'+''' or t_op_seae.委托编号 like '+''''+'%'+Edit16.text+'%'+''') '; end; if wwDBComboBox57.Text<>'' then begin if wwDBComboBox57.Text='做应收未做应付' then begin if str='' then str:=' where t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_op_gain where (合计应收<>0 and 合计应付=0))) ' else str:=str+' and t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_op_gain where (合计应收<>0 and 合计应付=0)))'; end else if wwDBComboBox57.Text='做应付未做应收' then begin if str='' then str:=' where t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_op_gain where (合计应付<>0 and 合计应收=0))) ' else str:=str+' and t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_op_gain where (合计应付<>0 and 合计应收=0)))'; end else if wwDBComboBox57.Text='财务结算未提交' then begin if str='' then str:=' where t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 费用状态 not in (''提交财务'',''费用封帐'') and 编号 in (select distinct 编号 from t_op_gain where (合计已付<>0 or 合计已收<>0))) ' else str:=str+' and t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 费用状态 not in (''提交财务'',''费用封帐'') and 编号 in (select distinct 编号 from t_op_gain where (合计已付<>0 or 合计已收<>0))) '; end else if wwDBComboBox57.Text='提交财务未审核' then begin if str='' then str:=' where t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 费用状态 in (''提交财务'',''费用封帐'') and 编号 in (select distinct 编号 from t_ch_fee where (费用状态 =''录入状态''))) ' else str:=str+' and t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 费用状态 in (''提交财务'',''费用封帐'') and 编号 in (select distinct 编号 from t_ch_fee where (费用状态 =''录入状态'')))'; end else if wwDBComboBox57.Text='录入状态毛利润' then begin if str='' then str:=' where t_op_seae.编号 in (select 编号 from T_OP_seae where 编号 in( select t_op_gain.编号 from t_op_gain left join (SELECT 编号,round(isnull(SUM(CASE 类型 WHEN ''收'' THEN ISNULL(金额,0) * ISNULL(汇率,0) ELSE 0 END),0), 2)' +' -round(isnull(SUM(CASE 类型 WHEN ''付'' THEN ISNULL(金额,0) *ISNULL( 汇率,0) ELSE 0 END),0),2) as 毛利润 FROM t_ch_fee ' +' where not 编号 is null group by 编号) as t on t.编号=t_op_gain.编号 where (t_op_gain.毛利润-t.毛利润)>1 )) ' else str:=str+' and t_op_seae.编号 in (select 编号 from T_OP_seae where 编号 in( select t_op_gain.编号 from t_op_gain left join (SELECT 编号,round(isnull(SUM(CASE 类型 WHEN ''收'' THEN ISNULL(金额,0) * ISNULL(汇率,0) ELSE 0 END),0), 2)' +' -round(isnull(SUM(CASE 类型 WHEN ''付'' THEN ISNULL(金额,0) *ISNULL( 汇率,0) ELSE 0 END),0),2) as 毛利润 FROM t_ch_fee ' +' where not 编号 is null group by 编号) as t on t.编号=t_op_gain.编号 where (t_op_gain.毛利润-t.毛利润)>1 ))'; end else if wwDBComboBox57.Text='开发票未提交财务' then begin if str='' then str:=' where t_op_seae.费用状态 not in (''提交财务'',''费用封帐'') and t_op_seae.编号 in (select distinct 编号 from t_ch_fee where 开票金额<>0 and 类型=''收'')' else str:=str+' and t_op_seae.费用状态 not in (''提交财务'',''费用封帐'') and t_op_seae.编号 in (select distinct 编号 from t_ch_fee where 开票金额<>0 and 类型=''收'')'; end else if wwDBComboBox57.Text='全部提交电子档案' then begin if str='' then str:=' where t_op_seae.编号 in (select 编号 from t_op_file where 备注=''是'' and (大小<>0 and 大小 is not null) group by 编号 having count(fid)=5)' else str:=str+' and t_op_seae.编号 in (select 编号 from t_op_file where 备注=''是'' and (大小<>0 and 大小 is not null) group by 编号 having count(fid)=5)'; end else if wwDBComboBox57.Text='未提交电子档案' then begin //海运出口-》业务检索-》条件内容-》未提交电子档案:提单留底和提单COPY如果同时为空则参与检验 str_tdld_not_empty:= ' or not exists( select 编号 from t_op_file where 文件类型 in (''提单留底'',''提单COPY'') and t_op_file.编号 =t_op_seae.编号) '; if str='' then str:=' where (t_op_seae.编号 in (select distinct 编号 from t_op_file where 备注=''是'' and (大小=0 or 大小 is null)) ' + str_tdld_not_empty + ' or ( t_op_seae.编号 not in (select 编号 from t_op_file)))' else str:=str+' and (t_op_seae.编号 in (select distinct 编号 from t_op_file where 备注=''是'' and (大小=0 or 大小 is null)) ' + str_tdld_not_empty + ' or ( t_op_seae.编号 not in (select 编号 from t_op_file)))'; end; end; if wwDBComboBox48.Text<>'' then begin if wwDBComboBox48.Text='未完成业务' then begin if str='' then str:=' where t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_op_state where 是否完成<>1)) ' else str:=str+' and t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_op_state where 是否完成<>1)) '; end else if wwDBComboBox48.Text='未录入收费' then begin if str='' then str:=' where t_op_seae.费用状态<>'+''''+'费用封帐'+''''+' and t_op_seae.主编号 not in (select distinct 编号 from t_ch_fee where 类型='+''''+'收'+''''+')' else str:=str+' and t_op_seae.费用状态<>'+''''+'费用封帐'+''''+' and t_op_seae.主编号 not in (select distinct 编号 from t_ch_fee where 类型='+''''+'收'+''''+')'; end else if wwDBComboBox48.Text='未录入付费' then begin if str='' then str:=' where t_op_seae.费用状态<>'+''''+'费用封帐'+''''+' and t_op_seae.主编号 not in (select distinct 编号 from t_ch_fee where 类型='+''''+'付'+''''+')' else str:=str+' and t_op_seae.费用状态<>'+''''+'费用封帐'+''''+' and t_op_seae.主编号 not in (select distinct 编号 from t_ch_fee where 类型='+''''+'付'+''''+')'; end else if wwDBComboBox48.Text='未录入费用' then begin if str='' then str:=' where t_op_seae.费用状态<>'+''''+'费用封帐'+''''+' and t_op_seae.主编号 not in (select distinct 编号 from t_ch_fee)' else str:=str+' and t_op_seae.费用状态<>'+''''+'费用封帐'+''''+' and t_op_seae.主编号 not in (select distinct 编号 from t_ch_fee)'; end else if wwDBComboBox48.Text='未提交费用' then begin if str='' then str:=' where t_op_seae.主编号 in (select 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_ch_fee where 费用状态='+''''+'录入状态'+''''+')) ' else str:=str+' and t_op_seae.主编号 in (select 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_ch_fee where 费用状态='+''''+'录入状态'+''''+')) '; end else if wwDBComboBox48.Text='被驳回费用' then begin if str='' then str:=' where t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in ('+''''+'驳回提交'+''''+','+''''+'禁止修改'+''''+','+''''+'禁止删除'+''''+'))) ' else str:=str+' and t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in ('+''''+'驳回提交'+''''+','+''''+'禁止修改'+''''+','+''''+'禁止删除'+''''+'))) '; end else if wwDBComboBox48.Text='未审核费用' then begin if str='' then str:=' where t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in ('+''''+'提交审核'+''''+','+''''+'申请修改'+''''+','+''''+'申请删除'+''''+'))) ' else str:=str+' and t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in ('+''''+'提交审核'+''''+','+''''+'申请修改'+''''+','+''''+'申请删除'+''''+'))) '; end else if wwDBComboBox48.Text='提交未审核' then begin if str='' then str:=' where t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in ('+''''+'提交审核'+''''+'))) ' else str:=str+' and t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in ('+''''+'提交审核'+''''+'))) '; end else if wwDBComboBox48.Text='待批准修改' then begin if str='' then str:=' where t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in ('''''+'申请修改'+''''+','+''''+'申请删除'+''''+'))) ' else str:=str+' and t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in ('+''''+'申请修改'+''''+','+''''+'申请删除'+''''+'))) '; end else if wwDBComboBox48.Text='未结算费用' then begin if str='' then str:=' where t_op_seae.费用状态<>'+''''+'费用封帐'+''''+' and t_op_seae.主编号 in (select distinct 编号 from t_ch_fee where 费用状态<>'+''''+'结算完毕'+''''+')' else str:=str+' and t_op_seae.费用状态<>'+''''+'费用封帐'+''''+' and t_op_seae.主编号 in (select distinct 编号 from t_ch_fee where 费用状态<>'+''''+'结算完毕'+''''+')'; end else if wwDBComboBox48.Text='未通知放单' then begin if str='' then str:=' where t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 not in (select distinct 编号 from t_op_state where 业务状态 =''通知放单'')) ' else str:=str+' and t_op_seae.主编号 in (select distinct 主编号 from t_op_seae where 编号 not in (select distinct 编号 from t_op_state where 业务状态 =''通知放单''))'; end; end; if wwDBComboBox58.Text<>'' then begin if wwDBComboBox58.Text='票结' then begin if str='' then str:=' where (t_op_seae.委托单位 not in (select 客户简称 from t_crm_client_sales) or t_op_seae.委托单位 in (select 客户简称 from t_crm_client_sales where 结费类型=''现结买单'') )' else str:=str+' and (t_op_seae.委托单位 not in (select 客户简称 from t_crm_client_sales) or t_op_seae.委托单位 in (select 客户简称 from t_crm_client_sales where 结费类型=''现结买单'') )' end else if wwDBComboBox58.Text='月结' then begin if str='' then str:=' where t_op_seae.委托单位 in (select 客户简称 from t_crm_client_sales where 结费类型<>''现结买单'') ' else str:=str+' and t_op_seae.委托单位 in (select 客户简称 from t_crm_client_sales where 结费类型<>''现结买单'') ' end end; //select * from t_op_state where 编号 not in ( select distinct 编号 from t_op_state where 业务状态 ='通知放单' ) end else begin if query_wanneng_error(t_sys_query_detail)then begin showmessage('‘或’的条件必须在2个以上!!'); exit; end; str:=query_wanneng(t_sys_query_detail); end; case seae_query_table of 1,14: begin if seae_query_limited<>'no'then begin if trim(str)='' then begin str:='where '+open_data(seae_query_limited,'t_op_seae.录入人', 't_op_seae.操作员','t_op_seae.客服员','t_op_seae.报关操作','t_op_seae.报检操作'); end else begin str:=str+' and '+open_data(seae_query_limited,'t_op_seae.录入人', 't_op_seae.操作员','t_op_seae.客服员','t_op_seae.报关操作','t_op_seae.报检操作'); end; end; end; 11: begin if seae_query_limited<>'no'then begin if trim(str)='' then begin str:='where '+open_data(seae_query_limited,'t_op_seae.录入人', 't_op_seae.报关操作','t_op_seae.报检操作','no','no'); end else begin str:=str+' and '+open_data(seae_query_limited,'t_op_seae.录入人', 't_op_seae.报关操作','t_op_seae.报检操作','no','no'); end; end; end; 2: begin if seae_query_limited<>'no'then begin if trim(str)='' then begin str:='where '+open_data(seae_query_limited,'t_op_seae.揽货人','no','no','no','no'); end else begin str:=str+' and '+open_data(seae_query_limited,'t_op_seae.揽货人','no','no','no','no'); end; end; end; 3,4,5,6,7,8,9,10: begin if seae_query_limited<>'no'then begin if trim(str)='' then begin str:='where '+open_data(seae_query_limited,'t_op_seae.揽货人','t_op_seae.操作员','t_op_seae.客服员','t_op_seae.报关操作','t_op_seae.报检操作'); end else begin str:=str+' and '+open_data(seae_query_limited,'t_op_seae.揽货人','t_op_seae.操作员','t_op_seae.客服员','t_op_seae.报关操作','t_op_seae.报检操作'); end; end; end; end; case seae_query_table of 1: begin if not bsSkinCheckRadioBox2.Checked then begin str:='select * from t_op_seae where 主编号=编号 and 装运方式<>''报关'' '+' and 编号 in (select 主编号 from t_op_seae ' // str:='select * from t_op_seae where 主编号=编号 and 编号 in (select 主编号 from t_op_seae ' +str+')'+default_sort(53,'t_op_seae','','desc'); end else begin str:=StringReplace(str,'t_op_seae','t_op_seae_assistant',[rfReplaceAll]); str:='select * from t_op_seae where 主编号=编号 and 装运方式<>''报关'''+' and 编号 in (select 主编号 from t_op_seae_assistant ' // str:='select * from t_op_seae where 主编号=编号 and 编号 in (select 主编号 from t_op_seae_assistant ' +str+')'+default_sort(53,'t_op_seae','','desc'); end; end; 13,14: begin if not bsSkinCheckRadioBox2.Checked then begin str:='select * from t_op_seae where 主编号=编号'+' and 编号 in (select 主编号 from t_op_seae ' +str+')'+default_sort(53,'t_op_seae','','desc'); end else begin str:=StringReplace(str,'t_op_seae','t_op_seae_assistant',[rfReplaceAll]); str:='select * from t_op_seae where 主编号=编号'+' and 编号 in (select 主编号 from t_op_seae_assistant ' +str+')'+default_sort(53,'t_op_seae','','desc'); end; end; 3: begin if not bsSkinCheckRadioBox2.Checked then begin str:='select * from t_op_seae where 主编号=编号'+' and 编号 not in (select 更改单编号 from t_op_gain_cx) and 编号 in (select 主编号 from t_op_seae ' +str+')'+default_sort(53,'t_op_seae','','desc'); end else begin str:=StringReplace(str,'t_op_seae','t_op_seae_assistant',[rfReplaceAll]); str:='select * from t_op_seae where 主编号=编号'+' and 编号 not in (select 更改单编号 from t_op_gain_cx) and 编号 in (select 主编号 from t_op_seae_assistant ' +str+')'+default_sort(53,'t_op_seae','','desc'); end; end; 2,4: begin str:='select *,dbo.GetCustSaleZq(委托单位) 客户账期 from t_op_seae '+str+default_sort(53,'t_op_seae','','desc'); end; 11: begin if (str='') then str:='select * from t_op_seae 报关服务=1 '+default_sort(53,'t_op_seae','','desc') else str:='select * from t_op_seae 报关服务=1 and '+str+default_sort(53,'t_op_seae','','desc'); end; 5: begin str:='SELECT t_op_seae.*' +',t_op_gain_main.应收USD, t_op_gain_main.已收USD,(t_op_gain_main.应收USD-t_op_gain_main.已收USD)' +' AS 未收USD,t_op_gain_main.应收RMB, t_op_gain_main.已收RMB,(t_op_gain_main.应收RMB-t_op_gain_main.已收RMB)' +' AS 未收RMB, t_op_gain_main.合计应收,t_op_gain_main.合计已收,(t_op_gain_main.合计应收-t_op_gain_main.合计已收)' +' AS 合计未收,t_op_gain_main.应付USD, t_op_gain_main.已付USD, (t_op_gain_main.应付USD-t_op_gain_main.已付USD)' +' AS 未付USD,t_op_gain_main.应付RMB, t_op_gain_main.已付RMB,(t_op_gain_main.应付RMB- t_op_gain_main.已付RMB)' +' AS 未付RMB,t_op_gain_main.合计应付,t_op_gain_main.合计已付,(t_op_gain_main.合计应付-t_op_gain_main.合计已付)' +' AS 合计未付,t_op_gain_main.利润USD, t_op_gain_main.利润RMB, t_op_gain_main.毛利润, t_op_gain_main.利润率' +' FROM t_op_seae left JOIN t_op_gain_main ON t_op_seae.编号 = t_op_gain_main.编号 ' +str +' order by (case when t_op_seae.编号<>t_op_seae.主编号 then '+''''+'拼箱主票'+''''+' else t_op_seae.装运方式 end)' +',主编号,装运方式 desc,主提单号'; end; end; case seae_query_table of 1: begin if (not frm_op_seae.t_op_seae.IsEmpty) and (frm_op_seae.t_op_seae.sql.Text<>'') then frm_op_seae.psqlstr:=frm_op_seae.t_op_seae.sql.Text; frm_op_seae.t_op_seae.close; frm_op_seae.t_op_seae.sql.clear; frm_op_seae.t_op_seae.sql.add(str); frm_op_seae.t_op_seae.Open; if frm_op_seae.t_op_seae.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; {$IFDEF XSGUANLI} 2: begin frm_ch_fee_seae_sales.mailSend.EmptyTable; frm_ch_fee_seae_sales.mailSend.Open; frm_ch_fee_seae_sales.mailSend.Insert; frm_ch_fee_seae_sales.mailSend.FieldByName('开始日期').AsString:=wwDBDateTimePicker1.Text; frm_ch_fee_seae_sales.mailSend.FieldByName('结束日期').AsString:=wwDBDateTimePicker2.Text; frm_ch_fee_seae_sales.t_op_seae.Close; frm_ch_fee_seae_sales.t_op_seae.Parameters.ParamByName('SQLStr').value:=str; frm_ch_fee_seae_sales.t_op_seae.Open; if frm_ch_fee_seae_sales.t_op_seae.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; {$ENDIF} 3: begin frm_ch_fee_check_seae.t_op_seae.Close; frm_ch_fee_check_seae.t_op_seae.Parameters.ParamByName('SQLStr').value:=str; frm_ch_fee_check_seae.t_op_seae.Open; if frm_ch_fee_check_seae.t_op_seae.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; 4: begin frm_op_seae_close.t_ch_accept.close; frm_op_seae_close.t_ch_pay.close; frm_op_seae_close.t_op_gain.close; frm_op_seae_close.t_op_seae.Close; // frm_op_seae_close.t_op_seae.Parameters.ParamByName('SQLStr').value:=str; frm_op_seae_close.t_op_seae.sql.text:=str; frm_op_seae_close.t_op_seae.Open; frm_op_seae_close.t_ch_accept.open; frm_op_seae_close.t_ch_pay.open; frm_op_seae_close.t_op_gain.OPEN; if frm_op_seae_close.t_op_seae.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; {$IFDEF YWTAIZHANG} 5: begin frm_rp_tai_seae.p_query_table.close; frm_rp_tai_seae.p_query_table.Parameters.ParamByName('SQLStr').value:=str; frm_rp_tai_seae.p_query_table.Open; if frm_rp_tai_seae.p_query_table.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; {$ENDIF} 6: begin frm_rp_rp_seae.p_detail.close; frm_rp_rp_seae.p_detail.Parameters.ParamByName('SQLStr').value:= 'SELECT t_op_seae.*, t_op_gain_main.应收USD, t_op_gain_main.已收USD,(t_op_gain_main.应收USD-t_op_gain_main.已收USD)' +' AS 未收USD,t_op_gain_main.应收RMB, t_op_gain_main.已收RMB,(t_op_gain_main.应收RMB-t_op_gain_main.已收RMB)' +' AS 未收RMB, t_op_gain_main.合计应收,t_op_gain_main.合计已收,(t_op_gain_main.合计应收-t_op_gain_main.合计已收)' +' AS 合计未收,t_op_gain_main.应付USD, t_op_gain_main.已付USD, (t_op_gain_main.应付USD-t_op_gain_main.已付USD)' +' AS 未付USD,t_op_gain_main.应付RMB, t_op_gain_main.已付RMB,(t_op_gain_main.应付RMB- t_op_gain_main.已付RMB)' +' AS 未付RMB,t_op_gain_main.合计应付,t_op_gain_main.合计已付,(t_op_gain_main.合计应付-t_op_gain_main.合计已付)' +' AS 合计未付,t_op_gain_main.利润USD, t_op_gain_main.利润RMB, t_op_gain_main.毛利润, t_op_gain_main.利润率' +' FROM t_op_seae left JOIN t_op_gain_main ON t_op_seae.编号 = t_op_gain_main.编号 ' +str+' and t_op_seae.编号=t_op_seae.主编号 '+default_sort(53,'t_op_seae','','desc'); rp_rp_seae_str:=str; frm_rp_rp_seae.p_detail.Open; if frm_rp_rp_seae.p_detail.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; {$IFDEF TBQITA} 7: begin if frm_rp_zou_seae.bsSkinCheckRadioBox1.Checked then str_date:='会计期间' else str_date:='开船日期'; frm_rp_zou_seae.p_lirun.close; frm_rp_zou_seae.p_lirun.sql.text:= // frm_rp_zou_seae.p_lirun.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),t_op_seae.'+str_date+',111),1,7) AS 月份,' +'SUM(dbo.t_op_gain_main.毛利润) AS 毛利润,' +'sum(t_op_seae.箱TEU) as 箱TEU,count(t_op_seae.编号) as 票数' +' FROM t_op_seae inner JOIN t_op_gain_main' +' ON t_op_seae.编号 =t_op_gain_main.编号 ' +str +' GROUP BY SUBSTRING(CONVERT(char(15),t_op_seae.'+str_date+',111),1,7)' +' order by SUBSTRING(CONVERT(char(15),'+str_date+', 111), 1, 7)'; frm_rp_zou_seae.p_lirun.Open; end; 8: begin fen_seae_str:=str; end; 10: begin fen_seae_ctn_str:=str; end; {$ENDIF} 9: begin {frm_rp_fee_modify.t_ch_fee_modify.close; frm_rp_fee_modify.a_shen_delete.close; frm_rp_fee_modify.a_shen_modify_old.close; frm_rp_fee_modify.a_shen_modify_new.close; frm_rp_fee_modify.p_seae.close; frm_rp_fee_modify.p_seae.Parameters.ParamByName('SQLStr').value:= 'SELECT t_op_seae.*, v_ch_fee_modify_sum.利润调整 AS 利润调整 ' +'FROM t_op_seae INNER JOIN ' +'v_ch_fee_modify_sum ON t_op_seae.编号 = v_ch_fee_modify_sum.编号 '+str+default_sort(53,'t_op_seae','','desc'); frm_rp_fee_modify.p_seae.open; frm_rp_fee_modify.t_ch_fee_modify.open; frm_rp_fee_modify.a_shen_delete.open; frm_rp_fee_modify.a_shen_modify_old.open; frm_rp_fee_modify.a_shen_modify_new.open;} end; {$IFDEF SJBAOGUAN} 11: begin frm_op_seae_apply.t_op_seae.close; frm_op_seae_apply.t_op_seae.sql.clear; frm_op_seae_apply.t_op_seae.sql.add(str); frm_op_seae_apply.t_op_seae.Open; if frm_op_seae_apply.t_op_seae.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; {$ENDIF} {$IFDEF YWFUHE} 13: begin frm_ch_fee_Recheck_seae.t_op_seae.Close; frm_ch_fee_Recheck_seae.t_op_seae.Parameters.ParamByName('SQLStr').value:=str; frm_ch_fee_Recheck_seae.t_op_seae.Open; if frm_ch_fee_Recheck_seae.t_op_seae.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; {$ENDIF} 14: begin frm_info_bunk.t_op_seae.close; frm_info_bunk.t_op_seae.sql.clear; frm_info_bunk.t_op_seae.sql.add(str); frm_info_bunk.t_op_seae.Open; if frm_info_bunk.t_op_seae.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; end; close; end; procedure Tfrm_op_seae_query.FormShow(Sender:TObject); begin loadfindini; Label3.Caption:=Logininfo.seaewtno; Label42.Caption:=Logininfo.seaedcno; frm_data_share.t_code_state.Filtered:=false; frm_data_share.t_code_state.Filter:='业务种类='+''''+'海运出口'+''''; frm_data_share.t_code_state.Filtered:=true; frm_data_share.t_crm_client_ship.requery; frm_data_share.t_crm_client_changzhan.requery; frm_data_share.t_crm_client_truck.requery; frm_data_share.t_crm_client_baoguan.requery; frm_data_share.t_crm_client_weituo.requery; frm_data_share.t_crm_client_daili.requery; frm_data_share.t_crm_client_huodai.requery; frm_data_share.t_code_state.first; while not frm_data_share.t_code_state.eof do begin wwDBComboBox1.Items.Add(frm_data_share.t_code_state.fieldbyname('业务状态').asstring); frm_data_share.t_code_state.next; end; wwDBComboBox1.Items.Add('业务封帐'); t_sys_queryfields.open; t_sys_query.Parameters.ParamByName('查询类型').Value:='海运出口'; t_sys_query.Parameters.ParamByName('录入人').Value:=employee; t_sys_query.open; t_sys_query_detail.open; wwDBComboBox39.ItemIndex:=0; end; procedure Tfrm_op_seae_query.RxDBLookupCombo14Change(Sender: TObject); begin query_str_int.text:=''; query_bit.text:=''; query_date.text:=''; if t_sys_queryfields.Locate('字段名称',RxDBLookupCombo14.DisplayValue,[])then begin wwDBComboBox40.ItemIndex:=-1; wwDBComboBox40.Items.Clear; if (t_sys_queryfields.FieldByName('类型').asstring='varchar') then begin query_str_int.Visible:=true; query_bit.Visible:=false; query_date.Visible:=false; wwDBComboBox40.Items.Add('等于'); wwDBComboBox40.Items.Add('不等于'); wwDBComboBox40.Items.Add('模糊'); wwDBComboBox40.ItemIndex:=2; end; if (t_sys_queryfields.FieldByName('类型').asstring='int') then begin query_str_int.Visible:=true; query_bit.Visible:=false; query_date.Visible:=false; wwDBComboBox40.Items.Add('等于'); wwDBComboBox40.Items.Add('不等于'); wwDBComboBox40.Items.Add('大于'); wwDBComboBox40.Items.Add('小于'); wwDBComboBox40.ItemIndex:=0; end; if (t_sys_queryfields.FieldByName('类型').asstring='bit') then begin query_str_int.Visible:=false; query_bit.Visible:=true; query_date.Visible:=false; wwDBComboBox40.Items.Add('等于'); wwDBComboBox40.Items.Add('不等于'); wwDBComboBox40.ItemIndex:=0; end; if (t_sys_queryfields.FieldByName('类型').asstring='date') then begin query_str_int.Visible:=false; query_bit.Visible:=false; query_date.Visible:=true; wwDBComboBox40.Items.Add('等于'); wwDBComboBox40.Items.Add('不等于'); wwDBComboBox40.Items.Add('大于'); wwDBComboBox40.Items.Add('小于'); wwDBComboBox40.ItemIndex:=0; end; end else begin query_str_int.Visible:=false; query_bit.Visible:=false; query_date.Visible:=false; end; end; procedure Tfrm_op_seae_query.bsSkinButton2Click(Sender: TObject); begin if RxDBLookupCombo14.DisplayValue='' then begin showmessage('请输入条件名称!!'); exit; end; if wwDBComboBox39.ItemIndex=-1 then begin showmessage('请输入条件关系!!'); exit; end; if wwDBComboBox40.ItemIndex=-1 then begin showmessage('请输入查询类型!!'); exit; end; if query_str_int.Visible then begin if query_str_int.text='' then begin showmessage('请输入条件值!!'); exit; end; if (t_sys_queryfields.FieldByName('类型').asstring='int') then begin try strtoint(query_str_int.text); except showmessage('条件值只能输入数字!!'); exit; end; end; end; if query_bit.Visible then begin if query_bit.ItemIndex=-1 then begin showmessage('请输入条件值!!'); exit; end; end; if query_date.Visible then begin if query_date.text='' then begin showmessage('请输入条件值!!'); exit; end; end; if t_sys_query.IsEmpty then begin t_sys_query.Insert; t_sys_query.post; end; t_sys_query_detail.Append; t_sys_query_detail['表']:=t_sys_queryfields['表']; t_sys_query_detail['字段名']:=t_sys_queryfields['字段名称']; if query_str_int.Visible then begin t_sys_query_detail['条件值']:=query_str_int.text; end; if query_bit.Visible then begin t_sys_query_detail['条件值']:=query_bit.text; end; if query_date.Visible then begin t_sys_query_detail['条件值']:=query_date.text; end; t_sys_query_detail['字段类型']:=t_sys_queryfields['类型']; t_sys_query_detail['条件关系']:=wwDBComboBox39.text; t_sys_query_detail['查询类型']:=wwDBComboBox40.text; t_sys_query_detail.post; end; procedure Tfrm_op_seae_query.bsSkinButton4Click(Sender: TObject); begin if not t_sys_query_detail.IsEmpty then t_sys_query_detail.Delete; end; procedure Tfrm_op_seae_query.RxDBLookupList1DblClick(Sender: TObject); begin RxDBLookupCombo14.DisplayValue:=RxDBLookupList1.DisplayValue; end; procedure Tfrm_op_seae_query.wwDBComboBox15KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; frm_op_seae_query.bsSkinButton1Click(Sender); end; end; procedure Tfrm_op_seae_query.t_sys_queryAfterInsert(DataSet: TDataSet); begin t_sys_query['查询类型']:='海运出口'; t_sys_query['录入人']:=employee; t_sys_query['录入日期']:=date; end; procedure Tfrm_op_seae_query.bsSkinButton6Click(Sender: TObject); begin t_sys_query.Insert; t_sys_query.post; end; procedure Tfrm_op_seae_query.bsSkinButton9Click(Sender: TObject); begin while not t_sys_query_detail.eof do begin t_sys_query_detail.Delete; end; if not t_sys_query.Eof then t_sys_query.delete; end; procedure Tfrm_op_seae_query.t_sys_query_detailBeforePost( DataSet: TDataSet); begin if t_sys_query_detail.fieldbyname('字段类型').asstring='int' then begin try strtoint(t_sys_query_detail.fieldbyname('条件值').asstring); except showmessage('条件值只能输入数字!!'); abort; end; end; if t_sys_query_detail.fieldbyname('字段类型').asstring='date' then begin try strtodate(t_sys_query_detail.fieldbyname('条件值').asstring); except showmessage('条件值只能输入日期!!'); abort; end; end; if t_sys_query_detail.fieldbyname('字段类型').asstring='bit' then begin if (t_sys_query_detail.fieldbyname('条件值').asstring<>'否') and(t_sys_query_detail.fieldbyname('条件值').asstring<>'是')then begin showmessage('条件值只能输入是\否!!'); abort; end; end; if (t_sys_query_detail.fieldbyname('条件关系').asstring<>'且') and(t_sys_query_detail.fieldbyname('条件关系').asstring<>'或')then begin showmessage('条件关系只能输入且\或!!'); abort; end; if (dxDBGrid1Column3.Items.IndexOf(t_sys_query_detail.fieldbyname('查询类型').asstring)=-1) and (t_sys_query_detail.state<>dsinsert) then begin showmessage('查询类型只能输入'+dxDBGrid1Column3.Items.text+'!!'); abort; end; end; procedure Tfrm_op_seae_query.t_sys_query_detailAfterScroll( DataSet: TDataSet); begin if (t_sys_query_detail.fieldbyname('字段类型').asstring='varchar') then begin dxDBGrid1Column3.Items.Clear; dxDBGrid1Column3.Items.Add('等于'); dxDBGrid1Column3.Items.Add('不等于'); dxDBGrid1Column3.Items.Add('模糊'); end; if (t_sys_query_detail.fieldbyname('字段类型').asstring='int') then begin dxDBGrid1Column3.Items.Clear; dxDBGrid1Column3.Items.Add('等于'); dxDBGrid1Column3.Items.Add('不等于'); dxDBGrid1Column3.Items.Add('大于'); dxDBGrid1Column3.Items.Add('小于'); end; if (t_sys_query_detail.fieldbyname('字段类型').asstring='bit') then begin dxDBGrid1Column3.Items.Clear; dxDBGrid1Column3.Items.Add('等于'); dxDBGrid1Column3.Items.Add('不等于'); end; if (t_sys_query_detail.fieldbyname('字段类型').asstring='date') then begin dxDBGrid1Column3.Items.Clear; dxDBGrid1Column3.Items.Add('等于'); dxDBGrid1Column3.Items.Add('不等于'); dxDBGrid1Column3.Items.Add('大于'); dxDBGrid1Column3.Items.Add('小于'); end; end; procedure Tfrm_op_seae_query.loadFindIni; var findini:tinifile ; mysec,tmpname:string; canload:boolean ; //是否记忆 i:integer ; begin mysec:=inttostr(seae_query_table) ; findini:=Tinifile.Create(ExtractFilePath(application.ExeName)+'seaequery.ini'); try canload:=findini.ReadBool(mysec,mysec,false); bsSkinCheckRadioBox1.Checked:=canload ; if canload then begin with bsSkinTabSheet2 do for i:=0 to ControlCount-1 do begin tmpname:=Controls[i].Name ; if Controls[i] is TwwDBComboBox then (Controls[i] as TwwDBComboBox).Text:=findini.ReadString(mysec,TmpName,'') else if Controls[i] is TwwDBLookupCombo then (Controls[i] as TwwDBLookupCombo).Text:=findini.ReadString(mysec,TmpName,'') else if Controls[i] is TEdit then (Controls[i] as TEdit).Text:=findini.ReadString(mysec,TmpName,'') else if Controls[i] is TwwDBDateTimePicker then (Controls[i] as TwwDBDateTimePicker).Date:=strtodate(findini.ReadString(mysec,TmpName,'')) else if Controls[i] is TRxDBLookupCombo then (Controls[i] as TRxDBLookupCombo).Value:=findini.ReadString(mysec,TmpName,'') ; end ; end else begin wwDBComboBox15.text:='模糊'; wwDBComboBox16.text:='模糊'; wwDBComboBox41.text:='模糊'; wwDBComboBox42.text:='模糊'; wwDBComboBox33.text:='模糊'; wwDBComboBox34.text:='模糊'; wwDBComboBox4.text:='模糊'; wwDBComboBox5.text:='模糊'; wwDBComboBox35.text:='模糊'; wwDBComboBox36.text:='模糊'; wwDBComboBox37.text:='模糊'; wwDBComboBox17.text:='等于'; wwDBComboBox7.text:='等于'; wwDBComboBox18.text:='大于'; wwDBComboBox6.text:='小于'; wwDBComboBox11.text:='小于'; wwDBComboBox19.text:='大于'; wwDBComboBox51.text:='小于'; wwDBComboBox50.text:='大于'; wwDBComboBox10.text:='等于'; wwDBComboBox20.text:='等于'; wwDBComboBox21.text:='等于'; wwDBComboBox22.text:='等于'; wwDBComboBox54.text:='等于'; wwDBComboBox23.text:='等于'; wwDBComboBox24.text:='等于'; wwDBComboBox25.text:='等于'; wwDBComboBox26.text:='模糊'; wwDBComboBox27.text:='模糊'; wwDBComboBox9.text:='等于'; wwDBComboBox8.text:='等于'; wwDBComboBox12.text:='等于'; wwDBComboBox13.text:='等于'; wwDBComboBox14.text:='等于'; wwDBComboBox28.text:='等于'; wwDBComboBox29.text:='等于'; wwDBComboBox30.text:='等于'; wwDBComboBox32.text:='等于'; wwDBComboBox38.text:='等于'; wwDBComboBox43.text:='等于'; wwDBComboBox45.text:='等于'; wwDBComboBox46.text:='等于'; wwDBComboBox47.text:='模糊'; wwDBComboBox49.text:='等于'; wwDBComboBox52.text:='等于'; wwDBComboBox55.text:='模糊'; wwDBComboBox56.text:='模糊'; end ; finally findini.free; end ; end; procedure Tfrm_op_seae_query.writeFindIni; var findini:tinifile ; mysec,tmpname:string; canload:boolean ; //是否记忆 i:integer ; begin canload:=bsSkinCheckRadioBox1.Checked ; mysec:=inttostr(seae_query_table) ; findini:=Tinifile.Create(ExtractFilePath(application.ExeName)+'seaequery.ini'); try findini.WriteBool(mysec,mysec,canload); if canload then begin with bsSkinTabSheet2 do for i:=0 to ControlCount-1 do begin tmpname:=Controls[i].Name ; if Controls[i] is TwwDBComboBox then findini.WriteString(mysec,TmpName,(Controls[i] as TwwDBComboBox).Text) else if Controls[i] is TwwDBLookupCombo then findini.WriteString(mysec,TmpName,(Controls[i] as TwwDBLookupCombo).Text) else if Controls[i] is TEdit then findini.WriteString(mysec,TmpName,(Controls[i] as TEdit).Text) else if Controls[i] is TwwDBDateTimePicker then findini.WriteString(mysec,TmpName,datetostr((Controls[i] as TwwDBDateTimePicker).Date)) else if Controls[i] is TRxDBLookupCombo then findini.writeString(mysec,TmpName,(Controls[i] as TRxDBLookupCombo).Value) ; end ; end ; finally findini.free; end ; end; end.