unit u_rp_ch_out_query; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, BusinessSkinForm, bsSkinCtrls, StdCtrls, RxLookup,inifiles, wwdbdatetimepicker, Mask, wwdbedit, Wwdotdot, Wwdbcomb; type Tfrm_rp_ch_Out_query = class(TForm) bsSkinGroupBox1: TbsSkinGroupBox; Label10: TLabel; Label5: TLabel; Label8: TLabel; Label11: TLabel; Label9: TLabel; Label22: TLabel; Label23: TLabel; Label14: TLabel; Label16: TLabel; Label15: TLabel; Label1: TLabel; Label32: TLabel; Label39: TLabel; Label40: TLabel; wwDBComboBox18: TwwDBComboBox; wwDBDateTimePicker1: TwwDBDateTimePicker; wwDBComboBox6: TwwDBComboBox; wwDBDateTimePicker2: TwwDBDateTimePicker; wwDBComboBox19: TwwDBComboBox; wwDBDateTimePicker3: TwwDBDateTimePicker; wwDBComboBox11: TwwDBComboBox; wwDBDateTimePicker4: TwwDBDateTimePicker; wwDBComboBox21: TwwDBComboBox; RxDBLookupCombo2: TRxDBLookupCombo; wwDBComboBox28: TwwDBComboBox; RxDBLookupCombo10: TRxDBLookupCombo; RxDBLookupCombo12: TRxDBLookupCombo; wwDBComboBox29: TwwDBComboBox; wwDBComboBox14: TwwDBComboBox; RxDBLookupCombo3: TRxDBLookupCombo; wwDBComboBox25: TwwDBComboBox; RxDBLookupCombo6: TRxDBLookupCombo; wwDBComboBox24: TwwDBComboBox; RxDBLookupCombo4: TRxDBLookupCombo; wwDBComboBox3: TwwDBComboBox; Edit1: TEdit; wwDBComboBox38: TwwDBComboBox; Edit9: TEdit; wwDBComboBox43: TwwDBComboBox; wwDBComboBox44: TwwDBComboBox; wwDBComboBox45: TwwDBComboBox; RxDBLookupCombo15: TRxDBLookupCombo; bsSkinGroupBox4: TbsSkinGroupBox; Label13: TLabel; Label37: TLabel; Label38: TLabel; wwDBComboBox13: TwwDBComboBox; RxDBLookupCombo5: TRxDBLookupCombo; RxDBLookupCombo1: TRxDBLookupCombo; wwDBComboBox41: TwwDBComboBox; wwDBComboBox42: TwwDBComboBox; RxDBLookupCombo16: TRxDBLookupCombo; bsSkinButton1: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsBusinessSkinForm1: TbsBusinessSkinForm; bsSkinGroupBox2: TbsSkinGroupBox; chkoutamt: TbsSkinCheckRadioBox; chkoutdate: TbsSkinCheckRadioBox; chkoutPort: TbsSkinCheckRadioBox; Label43: TLabel; wwDBComboBox48: TwwDBComboBox; wwDBComboBox49: TwwDBComboBox; bsSkinCheckRadioBox1: TbsSkinCheckRadioBox; procedure bsSkinButton5Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); private { Private declarations } procedure loadFindIni ; procedure writeFindIni ; public { Public declarations } function get_outstrwhere:widestring; end; var frm_rp_ch_Out_query: Tfrm_rp_ch_Out_query; implementation uses u_data_share,u_main ,my_sys_function; {$R *.dfm} procedure Tfrm_rp_ch_Out_query.bsSkinButton5Click(Sender: TObject); begin modalresult:=mrcancel ; end; procedure Tfrm_rp_ch_Out_query.FormShow(Sender: TObject); begin loadFindIni; frm_data_share.t_crm_client_all.requery; frm_data_share.t_sys_employee.requery; frm_data_share.t_sys_department.requery; end; procedure Tfrm_rp_ch_Out_query.bsSkinButton10Click(Sender: TObject); begin wwDBDateTimePicker1.Clear; wwDBDateTimePicker2.Clear; wwDBDateTimePicker3.Clear; wwDBDateTimePicker4.Clear; RxDBLookupCombo4.ClearValue; RxDBLookupCombo3.ClearValue; RxDBLookupCombo6.ClearValue; RxDBLookupCombo2.ClearValue; RxDBLookupCombo10.ClearValue; RxDBLookupCombo12.ClearValue; RxDBLookupCombo15.ClearValue; RxDBLookupCombo5.ClearValue; RxDBLookupCombo1.ClearValue; RxDBLookupCombo16.ClearValue; wwDBComboBox44.Clear ; wwDBComboBox49.Clear ; edit1.Text:=''; edit9.Text:=''; end; function Tfrm_rp_ch_Out_query.get_outstrwhere: widestring; var str_bill:widestring; begin writeFindIni; str_bill:='where (1=1)' ; str_bill:=query_tiaojian(1,str_bill,'v_op_bscard.会计期间',wwDBComboBox19.text,wwDBDateTimePicker3.text); str_bill:=query_tiaojian(1,str_bill,'v_op_bscard.会计期间',wwDBComboBox11.text,wwDBDateTimePicker4.text); str_bill:=query_tiaojian(1,str_bill,'v_op_bscard.客服员',wwDBComboBox24.text,RxDBLookupCombo4.DisplayValue); str_bill:=query_tiaojian(1,str_bill,'v_op_bscard.揽货人',wwDBComboBox14.text,RxDBLookupCombo3.DisplayValue); str_bill:=query_tiaojian(1,str_bill,'v_op_bscard.操作员',wwDBComboBox25.text,RxDBLookupCombo6.DisplayValue); str_bill:=query_tiaojian(1,str_bill,'v_op_bscard.销售部门',wwDBComboBox28.text,RxDBLookupCombo10.DisplayValue); str_bill:=query_tiaojian(1,str_bill,'v_op_bscard.操作部门',wwDBComboBox29.text,RxDBLookupCombo12.DisplayValue); str_bill:=query_tiaojian(2,str_bill,'v_op_bscard.周次',wwDBComboBox3.text,Edit1.text); str_bill:=query_tiaojian(2,str_bill,'v_op_bscard.周次',wwDBComboBox38.text,Edit9.text); str_bill:=query_tiaojian(1,str_bill,'v_op_bscard.业务种类',wwDBComboBox43.text,wwDBComboBox44.text); str_bill:=query_tiaojian(1,str_bill,'v_op_bscard.分部名称',wwDBComboBox45.text,RxDBLookupCombo15.DisplayValue); str_bill:=query_tiaojian(1,str_bill,'v_op_bscard.开船日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_bill:=query_tiaojian(1,str_bill,'v_op_bscard.开船日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_bill:=query_tiaojian(1,str_bill,'v_op_bscard.委托单位',wwDBComboBox21.text,RxDBLookupCombo2.DisplayValues[1]); str_bill:=query_tiaojian(1,str_bill,'t_ch_fee.客户名称',wwDBComboBox13.text,RxDBLookupCombo5.DisplayValues[1]); str_bill:=query_tiaojian(1,str_bill,'t_ch_fee.币别',wwDBComboBox41.text,RxDBLookupCombo1.DisplayValues[0]); str_bill:=query_tiaojian(1,str_bill,'t_ch_fee.费用名称',wwDBComboBox42.text,RxDBLookupCombo16.DisplayValues[1]); str_bill:=query_tiaojian(3,str_bill,'t_ch_fee.是否垫付',wwDBComboBox48.text,wwDBComboBox49.text); result:=str_bill ; end; procedure Tfrm_rp_ch_Out_query.bsSkinButton1Click(Sender: TObject); begin if (not chkoutamt.Checked) and (not chkoutdate.Checked) and (not chkoutport.Checked) then begin showmessage('必须选择一种统计范围!'); exit ; end ; modalresult:=mrok ; end; procedure Tfrm_rp_ch_Out_query.loadFindIni; var findini:tinifile ; mysec,tmpname:string; canload:boolean ; //是否记忆 i:integer ; begin mysec:='1' ; findini:=Tinifile.Create(ExtractFilePath(application.ExeName)+'rpoutquery.ini'); try canload:=findini.ReadBool(mysec,mysec,false); bsSkinCheckRadioBox1.Checked:=canload ; if canload then begin with bsSkinGroupBox1 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 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 ; with bsSkinGroupBox4 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 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 wwDBComboBox18.text:='大于'; wwDBComboBox6.text:='小于'; wwDBComboBox11.text:='小于'; wwDBComboBox19.text:='大于'; wwDBComboBox21.text:='等于'; wwDBComboBox24.text:='等于'; wwDBComboBox25.text:='等于'; wwDBComboBox28.text:='等于'; wwDBComboBox29.text:='等于'; wwDBComboBox14.text:='等于'; wwDBComboBox3.text:='等于'; wwDBComboBox38.text:='等于'; wwDBComboBox13.text:='等于'; wwDBComboBox41.text:='等于'; wwDBComboBox42.text:='等于'; wwDBComboBox43.text:='等于'; wwDBComboBox45.text:='等于'; wwDBComboBox48.text:='等于'; end ; finally findini.free; end ; end; procedure Tfrm_rp_ch_Out_query.writeFindIni; var findini:tinifile ; mysec,tmpname:string; canload:boolean ; //是否记忆 i:integer ; begin canload:=bsSkinCheckRadioBox1.Checked ; mysec:='1' ; findini:=Tinifile.Create(ExtractFilePath(application.ExeName)+'rpoutquery.ini'); try findini.WriteBool(mysec,mysec,canload); if canload then begin with bsSkinGroupBox1 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 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 ; with bsSkinGroupBox4 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 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.