{$INCLUDE t_main.inc} unit u_op_airi_query; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, BusinessSkinForm, bsSkinCtrls, wwdbdatetimepicker, Mask, wwdbedit, Wwdotdot, Wwdbcomb, RxLookup, StdCtrls, ComCtrls, bsSkinTabs, ADODB, DB, RxMemDS, dxExEdtr, dxTL, dxDBCtrl, dxDBGrid, dxCntner, dxDBTLCl, dxGrClms, wwdblook,inifiles; type Tfrm_op_airi_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; Label19: TLabel; Label22: TLabel; Label23: TLabel; Label18: TLabel; Label26: 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; RxDBLookupCombo5: TRxDBLookupCombo; RxDBLookupCombo6: TRxDBLookupCombo; bsSkinButton10: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton1: TbsSkinButton; RxDBLookupCombo9: TRxDBLookupCombo; wwDBComboBox4: TwwDBComboBox; wwDBComboBox5: TwwDBComboBox; wwDBComboBox6: TwwDBComboBox; wwDBComboBox7: TwwDBComboBox; wwDBComboBox9: TwwDBComboBox; wwDBComboBox11: TwwDBComboBox; wwDBComboBox13: TwwDBComboBox; wwDBComboBox14: TwwDBComboBox; wwDBComboBox15: TwwDBComboBox; wwDBComboBox16: TwwDBComboBox; wwDBComboBox17: TwwDBComboBox; wwDBComboBox18: TwwDBComboBox; wwDBComboBox19: TwwDBComboBox; wwDBComboBox21: TwwDBComboBox; wwDBComboBox22: TwwDBComboBox; wwDBComboBox24: TwwDBComboBox; wwDBComboBox25: TwwDBComboBox; wwDBComboBox26: TwwDBComboBox; wwDBComboBox27: TwwDBComboBox; wwDBComboBox28: TwwDBComboBox; RxDBLookupCombo10: TRxDBLookupCombo; RxDBLookupCombo12: TRxDBLookupCombo; wwDBComboBox29: TwwDBComboBox; wwDBComboBox8: TwwDBComboBox; RxDBLookupCombo8: TRxDBLookupCombo; wwDBComboBox32: TwwDBComboBox; RxDBLookupCombo13: TRxDBLookupCombo; wwDBComboBox38: TwwDBComboBox; Edit9: TEdit; t_sys_queryfields: TADOQuery; t_sys_queryfields1: TDataSource; t_sys_query: TADOQuery; t_sys_query1: TDataSource; t_sys_query_detail: TADOQuery; t_sys_query_detail1: TDataSource; bsSkinGroupBox1: TbsSkinGroupBox; bsSkinPanel1: TbsSkinPanel; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinPanel2: TbsSkinPanel; Label33: TLabel; Label34: TLabel; Label35: TLabel; Label36: TLabel; RxDBLookupCombo14: TRxDBLookupCombo; wwDBComboBox39: TwwDBComboBox; wwDBComboBox40: TwwDBComboBox; query_bit: TwwDBComboBox; query_str_int: TEdit; query_date: TwwDBDateTimePicker; RxDBLookupList1: TRxDBLookupList; bsSkinGroupBox2: TbsSkinGroupBox; bsSkinPanel3: TbsSkinPanel; bsSkinButton3: TbsSkinButton; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton9: TbsSkinButton; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridPickColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridPickColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid2: TdxDBGrid; dxDBGrid2SQ_ID: TdxDBGridMaskColumn; wwDBLookupCombo2: TwwDBLookupCombo; wwDBLookupCombo1: TwwDBLookupCombo; Label17: TLabel; wwDBComboBox3: TwwDBComboBox; wwDBComboBox10: TwwDBComboBox; Label21: TLabel; wwDBComboBox12: TwwDBComboBox; RxDBLookupCombo7: TRxDBLookupCombo; Label41: TLabel; wwDBComboBox46: TwwDBComboBox; RxDBLookupCombo18: TRxDBLookupCombo; Label27: TLabel; wwDBComboBox30: TwwDBComboBox; RxDBLookupCombo11: TRxDBLookupCombo; bsSkinCheckRadioBox2: TbsSkinCheckRadioBox; bsSkinCheckRadioBox1: TbsSkinCheckRadioBox; Label52: TLabel; wwDBComboBox57: TwwDBComboBox; RxDBLookupCombo21: TRxDBLookupCombo; Label24: TLabel; Label25: TLabel; wwDBDateTimePicker5: TwwDBDateTimePicker; wwDBDateTimePicker6: TwwDBDateTimePicker; wwDBComboBox20: TwwDBComboBox; wwDBComboBox23: TwwDBComboBox; procedure FormShow(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton1Click(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 t_sys_query_detailAfterScroll(DataSet: TDataSet); procedure t_sys_query_detailBeforePost(DataSet: TDataSet); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); private { Private declarations } procedure loadFindIni ; procedure writeFindIni ; public { Public declarations } end; var frm_op_airi_query: Tfrm_op_airi_query; airi_query_limited:string; airi_query_table:integer; implementation uses u_data_share, u_op_airi, {$IFDEF XSGUANLI}u_ch_fee_airi_sales,{$ENDIF} u_ch_fee_check_airi, u_op_airi_close, my_sys_function, {$IFDEF YWTAIZHANG}u_rp_tai_airi,{$ENDIF} u_rp_rp_airi, {$IFDEF TBQITA}u_rp_zou_airi, u_rp_fen_airi, {$ENDIF}u_rp_fee_modify, u_main, u_ch_fee_Recheck_airi; {$R *.dfm} procedure Tfrm_op_airi_query.FormShow(Sender: TObject); begin wwDBComboBox15.text:='模糊'; wwDBComboBox16.text:='模糊'; wwDBComboBox4.text:='模糊'; wwDBComboBox5.text:='模糊'; wwDBComboBox17.text:='等于'; wwDBComboBox7.text:='等于'; wwDBComboBox18.text:='大于'; wwDBComboBox6.text:='小于'; wwDBComboBox11.text:='小于'; wwDBComboBox19.text:='大于'; wwDBComboBox21.text:='等于'; wwDBComboBox22.text:='等于'; wwDBComboBox24.text:='等于'; wwDBComboBox25.text:='等于'; wwDBComboBox26.text:='模糊'; wwDBComboBox27.text:='模糊'; wwDBComboBox9.text:='等于'; wwDBComboBox8.text:='等于'; wwDBComboBox13.text:='等于'; wwDBComboBox14.text:='等于'; wwDBComboBox28.text:='等于'; wwDBComboBox29.text:='等于'; wwDBComboBox32.text:='等于'; wwDBComboBox38.text:='等于'; wwDBComboBox3.text:='等于'; wwDBComboBox12.text:='等于'; wwDBComboBox46.text:='等于'; wwDBComboBox30.text:='等于'; wwDBComboBox57.text:='等于'; loadfindini; 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_hangkong.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_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('业务封帐'); wwDBComboBox1.Items.Add('业务封帐'); t_sys_query.Parameters.ParamByName('查询类型').Value:='空运进口'; t_sys_query.Parameters.ParamByName('录入人').Value:=employee; t_sys_query.open; t_sys_query_detail.open; t_sys_queryfields.open; wwDBComboBox39.ItemIndex:=0; end; procedure Tfrm_op_airi_query.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_airi_query.bsSkinButton10Click(Sender: TObject); begin Edit1.text:=''; Edit2.text:=''; Edit3.text:=''; Edit4.text:=''; Edit9.text:=''; wwDBLookupCombo2.text:=''; wwDBLookupCombo1.text:=''; wwDBComboBox1.text:=''; wwDBComboBox2.text:=''; wwDBComboBox10.text:=''; wwDBDateTimePicker1.Clear; wwDBDateTimePicker2.Clear; wwDBDateTimePicker3.Clear; wwDBDateTimePicker4.Clear; wwDBDateTimePicker5.Clear; wwDBDateTimePicker6.Clear; RxDBLookupCombo2.ClearValue; RxDBLookupCombo1.ClearValue; RxDBLookupCombo9.ClearValue; RxDBLookupCombo8.ClearValue; RxDBLookupCombo4.ClearValue; RxDBLookupCombo3.ClearValue; RxDBLookupCombo6.ClearValue; RxDBLookupCombo5.ClearValue; RxDBLookupCombo10.ClearValue; RxDBLookupCombo12.ClearValue; RxDBLookupCombo13.ClearValue; RxDBLookupCombo7.ClearValue; RxDBLookupCombo18.ClearValue; RxDBLookupCombo11.ClearValue; RxDBLookupCombo21.ClearValue; end; procedure Tfrm_op_airi_query.bsSkinButton1Click(Sender: TObject); var str:widestring; str_date:string; begin writeFindIni; str:=''; if bsSkinTabSheet2.Showing then begin str:=query_tiaojian(1,str,'t_op_airi.业务编号',wwDBComboBox15.text,Edit1.text); str:=query_tiaojian(1,str,'t_op_airi.委托编号',wwDBComboBox4.text,Edit4.text); str:=query_tiaojian(1,str,'t_op_airi.主运单号',wwDBComboBox16.text,Edit2.text); str:=query_tiaojian(1,str,'t_op_airi.分运单号',wwDBComboBox5.text,Edit3.text); str:=query_tiaojian(1,str,'t_op_airi.业务状态',wwDBComboBox17.text,wwDBComboBox1.text); str:=query_tiaojian(1,str,'t_op_airi.费用状态',wwDBComboBox7.text,wwDBComboBox2.text); str:=query_tiaojian(1,str,'t_op_airi.进口日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str:=query_tiaojian(1,str,'t_op_airi.进口日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str:=query_tiaojian(1,str,'t_op_airi.会计期间',wwDBComboBox19.text,wwDBDateTimePicker3.text); str:=query_tiaojian(1,str,'t_op_airi.会计期间',wwDBComboBox11.text,wwDBDateTimePicker4.text); str:=query_tiaojian(1,str,'t_op_airi.通关日期',wwDBComboBox23.text,wwDBDateTimePicker5.text); str:=query_tiaojian(1,str,'t_op_airi.通关日期',wwDBComboBox20.text,wwDBDateTimePicker6.text); str:=query_tiaojian(1,str,'t_op_airi.委托单位',wwDBComboBox21.text,RxDBLookupCombo2.DisplayValues[1]); str:=query_tiaojian(1,str,'t_op_airi.航空公司',wwDBComboBox9.text,RxDBLookupCombo1.DisplayValues[1]); str:=query_tiaojian(1,str,'t_op_airi.报关行',wwDBComboBox22.text,RxDBLookupCombo9.DisplayValues[1]); str:=query_tiaojian(1,str,'t_op_airi.代理',wwDBComboBox8.text,RxDBLookupCombo8.DisplayValues[1]); str:=query_tiaojian(1,str,'t_op_airi.始发港代码',wwDBComboBox26.text,wwDBLookupCombo2.text); str:=query_tiaojian(1,str,'t_op_airi.目的港代码',wwDBComboBox27.text,wwDBLookupCombo1.text); str:=query_tiaojian(1,str,'t_op_airi.客服员',wwDBComboBox24.text,RxDBLookupCombo4.DisplayValue); str:=query_tiaojian(1,str,'t_op_airi.揽货人',wwDBComboBox14.text,RxDBLookupCombo3.DisplayValue); str:=query_tiaojian(1,str,'t_op_airi.操作员',wwDBComboBox25.text,RxDBLookupCombo6.DisplayValue); str:=query_tiaojian(1,str,'t_op_airi.录入人',wwDBComboBox13.text,RxDBLookupCombo5.DisplayValue); str:=query_tiaojian(1,str,'t_op_airi.销售部门',wwDBComboBox28.text,RxDBLookupCombo10.DisplayValue); str:=query_tiaojian(1,str,'t_op_airi.操作部门',wwDBComboBox29.text,RxDBLookupCombo12.DisplayValue); str:=query_tiaojian(1,str,'t_op_airi.货物名称',wwDBComboBox32.text,RxDBLookupCombo13.DisplayValues[1]); str:=query_tiaojian(2,str,'t_op_airi.周次',wwDBComboBox38.text,Edit9.text); str:=query_tiaojian(1,str,'t_op_airi.业务类型',wwDBComboBox3.text,wwDBComboBox10.text); str:=query_tiaojian(1,str,'t_op_airi.分部名称',wwDBComboBox12.text,RxDBLookupCombo7.DisplayValue); str:=query_tiaojian(1,str,'t_op_airi.业务来源',wwDBComboBox46.text,RxDBLookupCombo18.DisplayValue); str:=query_tiaojian(1,str,'t_op_airi.来源明细',wwDBComboBox30.text,RxDBLookupCombo11.DisplayValue); if Trim(RxDBLookupCombo21.DisplayValues[1])<>'' then begin if str='' then str:=' where t_op_Airi.编号 in (select 编号 from t_ch_fee where 客户名称='+''''+Trim(RxDBLookupCombo21.DisplayValues[1])+''')' else str:=str+' and t_op_Airi.编号 in (select 编号 from t_ch_fee where 客户名称='+''''+Trim(RxDBLookupCombo21.DisplayValues[1])+''')'; end; 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 airi_query_table of 1: begin if airi_query_limited<>'no'then begin if trim(str)='' then begin str:='where '+open_data(airi_query_limited,'t_op_airi.录入人','t_op_airi.操作员','t_op_airi.客服员','no','no'); end else begin str:=str+' and '+open_data(airi_query_limited,'t_op_airi.录入人','t_op_airi.操作员','t_op_airi.客服员','no','no'); end; end; end; 2: begin if airi_query_limited<>'no'then begin if trim(str)='' then begin str:='where '+open_data(airi_query_limited,'t_op_airi.揽货人','no','no','no','no'); end else begin str:=str+' and '+open_data(airi_query_limited,'t_op_airi.揽货人','no','no','no','no'); end; end; end; 3,4,5,6,7,8,13: begin if airi_query_limited<>'no'then begin if trim(str)='' then begin str:='where '+open_data(airi_query_limited,'t_op_airi.揽货人','t_op_airi.操作员','t_op_airi.客服员','no','no'); end else begin str:=str+' and '+open_data(airi_query_limited,'t_op_airi.揽货人','t_op_airi.操作员','t_op_airi.客服员','no','no'); end; end; end; end; case airi_query_table of 1: begin if (not frm_op_airi.t_op_airi.IsEmpty) and (frm_op_airi.t_op_airi.sql.Text<>'') then frm_op_airi.airipsqlstr:=frm_op_airi.t_op_airi.sql.Text; frm_op_airi.t_op_airi.close; frm_op_airi.t_op_airi.sql.clear; if not bsSkinCheckRadioBox2.Checked then frm_op_airi.t_op_airi.sql.add('select * from t_op_airi where 主编号=编号 and 编号 in (select 主编号 from t_op_airi '+str+')'+default_sort(56,'t_op_airi','','desc')) else begin str:=StringReplace(str,'t_op_airi','t_op_aire_assistant',[rfReplaceAll]); frm_op_airi.t_op_airi.sql.add('select * from t_op_airi where 主编号=编号 and 编号 in (select distinct 主编号 from t_op_aire_assistant '+str+')'+default_sort(56,'t_op_airi','','desc')) end; // frm_op_airi.t_op_airi.sql.add('select * from t_op_airi '+str+default_sort(56,'t_op_airi','','desc')); frm_op_airi.t_op_airi.Open; if frm_op_airi.t_op_airi.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; {$IFDEF XSGUANLI} 2: begin frm_ch_fee_airi_sales.t_op_airi.Close; frm_ch_fee_airi_sales.t_op_airi.Parameters.ParamByName('SQLStr').value:='select * from t_op_airi '+str+default_sort(56,'t_op_airi','','desc'); frm_ch_fee_airi_sales.t_op_airi.Open; if frm_ch_fee_airi_sales.t_op_airi.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; {$ENDIF} 3: begin frm_ch_fee_check_airi.t_op_airi.Close; frm_ch_fee_check_airi.t_op_airi.Parameters.ParamByName('SQLStr').value:='select * from t_op_airi '+str+default_sort(56,'t_op_airi','','desc'); frm_ch_fee_check_airi.t_op_airi.Open; if frm_ch_fee_check_airi.t_op_airi.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; 4: begin frm_op_airi_close.t_op_airi.close; frm_op_airi_close.t_op_airi.sql.text:='select * from t_op_airi '+str+default_sort(56,'t_op_airi','','desc'); frm_op_airi_close.t_op_airi.Open; if frm_op_airi_close.t_op_airi.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; {$IFDEF YWTAIZHANG} 5: begin str:='SELECT t_op_airi.*, t_op_gain.应收USD, t_op_gain.已收USD,(t_op_gain.应收USD-t_op_gain.已收USD)' +' AS 未收USD,t_op_gain.应收RMB, t_op_gain.已收RMB,(t_op_gain.应收RMB-t_op_gain.已收RMB)' +' AS 未收RMB, t_op_gain.合计应收,t_op_gain.合计已收,(t_op_gain.合计应收-t_op_gain.合计已收)' +' AS 合计未收,t_op_gain.应付USD, t_op_gain.已付USD, (t_op_gain.应付USD-t_op_gain.已付USD)' +' AS 未付USD,t_op_gain.应付RMB, t_op_gain.已付RMB,(t_op_gain.应付RMB- t_op_gain.已付RMB)' +' AS 未付RMB,t_op_gain.合计应付,t_op_gain.合计已付,(t_op_gain.合计应付-t_op_gain.合计已付)' +' AS 合计未付,t_op_gain.利润USD, t_op_gain.利润RMB, t_op_gain.毛利润, t_op_gain.利润率' +' FROM t_op_airi left JOIN t_op_gain ON t_op_airi.编号 = t_op_gain.编号 ' +str+default_sort(56,'t_op_airi','','desc'); frm_rp_tai_airi.p_query_table.close; frm_rp_tai_airi.p_query_table.Parameters.ParamByName('SQLStr').value:=str; frm_rp_tai_airi.p_query_table.Open; if frm_rp_tai_airi.p_query_table.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; {$ENDIF} 6: begin frm_rp_rp_airi.p_detail.close; frm_rp_rp_airi.p_detail.Parameters.ParamByName('SQLStr').value:= 'SELECT t_op_airi.*, t_op_gain.应收USD, t_op_gain.已收USD,(t_op_gain.应收USD-t_op_gain.已收USD)' +' AS 未收USD,t_op_gain.应收RMB, t_op_gain.已收RMB,(t_op_gain.应收RMB-t_op_gain.已收RMB)' +' AS 未收RMB, t_op_gain.合计应收,t_op_gain.合计已收,(t_op_gain.合计应收-t_op_gain.合计已收)' +' AS 合计未收,t_op_gain.应付USD, t_op_gain.已付USD, (t_op_gain.应付USD-t_op_gain.已付USD)' +' AS 未付USD,t_op_gain.应付RMB, t_op_gain.已付RMB,(t_op_gain.应付RMB- t_op_gain.已付RMB)' +' AS 未付RMB,t_op_gain.合计应付,t_op_gain.合计已付,(t_op_gain.合计应付-t_op_gain.合计已付)' +' AS 合计未付,t_op_gain.利润USD, t_op_gain.利润RMB, t_op_gain.毛利润, t_op_gain.利润率' +' FROM t_op_airi left JOIN t_op_gain ON t_op_airi.编号 = t_op_gain.编号 ' +str+default_sort(56,'t_op_airi','','desc'); frm_rp_rp_airi.p_detail.Open; if frm_rp_rp_airi.p_detail.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; {$IFDEF TBQITA} 7: begin if frm_rp_zou_airi.bsSkinCheckRadioBox1.Checked then str_date:='会计期间' else str_date:='进口日期'; frm_rp_zou_airi.p_lirun.close; frm_rp_zou_airi.p_lirun.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),t_op_airi.'+str_date+',111),1,7) AS 月份,' +'SUM(dbo.t_op_gain.毛利润) AS 毛利润,' +'sum(t_op_airi.计价重量) as 计价重量,count(t_op_airi.编号) as 票数' +' FROM t_op_airi left JOIN t_op_gain' +' ON t_op_airi.编号 =t_op_gain.编号 ' +str +' GROUP BY SUBSTRING(CONVERT(char(15),'+str_date+',111),1,7)' +' order by SUBSTRING(CONVERT(char(15),'+str_date+', 111), 1, 7)'; frm_rp_zou_airi.p_lirun.Open; end; 8: begin { frm_rp_fen_airi.p_client.close; frm_rp_fen_airi.p_client.Parameters.ParamByName('SQLStr').value:= 'SELECT t_op_airi.计价重量 as 箱TEU,t_op_airi.委托单位' +',t_op_airi.操作员,t_op_airi.操作部门,t_op_airi.揽货人,t_op_airi.销售部门' +',t_op_airi.航空公司' +',t_op_gain.毛利润 FROM t_op_airi left JOIN t_op_gain ON ' +'t_op_airi.编号 =t_op_gain.编号 ' +str; frm_rp_fen_airi.p_client.Open; } fen_airi_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_airi.close; frm_rp_fee_modify.p_airi.Parameters.ParamByName('SQLStr').value:= 'SELECT t_op_airi.*, v_ch_fee_modify_sum.利润调整 AS 利润调整 ' +'FROM t_op_airi INNER JOIN ' +'v_ch_fee_modify_sum ON t_op_airi.编号 = v_ch_fee_modify_sum.编号 '+str+' order by t_op_airi.业务编号 desc'; frm_rp_fee_modify.p_airi.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; 13: begin frm_ch_fee_recheck_airi.t_op_airi.Close; frm_ch_fee_recheck_airi.t_op_airi.Parameters.ParamByName('SQLStr').value:='select * from t_op_airi '+str+default_sort(56,'t_op_airi','','desc'); frm_ch_fee_recheck_airi.t_op_airi.Open; if frm_ch_fee_recheck_airi.t_op_airi.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; end; close; end; procedure Tfrm_op_airi_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_airi_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_airi_query.bsSkinButton4Click(Sender: TObject); begin if not t_sys_query_detail.IsEmpty then t_sys_query_detail.Delete; end; procedure Tfrm_op_airi_query.RxDBLookupList1DblClick(Sender: TObject); begin RxDBLookupCombo14.DisplayValue:=RxDBLookupList1.DisplayValue; end; procedure Tfrm_op_airi_query.wwDBComboBox15KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; frm_op_airi_query.bsSkinButton1Click(Sender); end; end; procedure Tfrm_op_airi_query.t_sys_queryAfterInsert(DataSet: TDataSet); begin t_sys_query['查询类型']:='空运进口'; t_sys_query['录入人']:=employee; t_sys_query['录入日期']:=date; end; procedure Tfrm_op_airi_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_airi_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_airi_query.bsSkinButton6Click(Sender: TObject); begin t_sys_query.Insert; t_sys_query.post; end; procedure Tfrm_op_airi_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_airi_query.loadFindIni; var findini:tinifile ; mysec,tmpname:string; canload:boolean ; //是否记忆 i:integer ; begin mysec:=inttostr(airi_query_table) ; findini:=Tinifile.Create(ExtractFilePath(application.ExeName)+'Airequery.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:='等于'; 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:='等于'; } end ; finally findini.free; end ; end; procedure Tfrm_op_airi_query.writeFindIni; var findini:tinifile ; mysec,tmpname:string; canload:boolean ; //是否记忆 i:integer ; begin canload:=bsSkinCheckRadioBox1.Checked ; mysec:=inttostr(airi_query_table) ; findini:=Tinifile.Create(ExtractFilePath(application.ExeName)+'Airequery.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.