{$INCLUDE t_main.inc} unit u_rp_query; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, BusinessSkinForm, bsSkinCtrls, RxLookup, wwdbdatetimepicker,inifiles, StdCtrls, Mask, wwdbedit, Wwdotdot, Wwdbcomb, wwdblook, DB, ADODB; type Tfrm_rp_query = class(TForm) bsBusinessSkinForm1: TbsBusinessSkinForm; bsSkinButton1: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton5: TbsSkinButton; Label7: TLabel; wwDBComboBox17: TwwDBComboBox; wwDBComboBox1: TwwDBComboBox; Label4: TLabel; wwDBComboBox7: TwwDBComboBox; wwDBComboBox2: TwwDBComboBox; Label10: TLabel; wwDBComboBox18: TwwDBComboBox; wwDBDateTimePicker1: TwwDBDateTimePicker; Label5: TLabel; wwDBComboBox6: TwwDBComboBox; wwDBDateTimePicker2: TwwDBDateTimePicker; Label8: TLabel; wwDBComboBox19: TwwDBComboBox; wwDBDateTimePicker3: TwwDBDateTimePicker; Label11: TLabel; wwDBComboBox11: TwwDBComboBox; wwDBDateTimePicker4: TwwDBDateTimePicker; Label9: TLabel; wwDBComboBox21: TwwDBComboBox; RxDBLookupCombo2: TRxDBLookupCombo; Label22: TLabel; wwDBComboBox28: TwwDBComboBox; RxDBLookupCombo10: TRxDBLookupCombo; RxDBLookupCombo12: TRxDBLookupCombo; wwDBComboBox29: TwwDBComboBox; Label23: TLabel; Label14: TLabel; wwDBComboBox14: TwwDBComboBox; RxDBLookupCombo3: TRxDBLookupCombo; Label16: TLabel; wwDBComboBox25: TwwDBComboBox; RxDBLookupCombo6: TRxDBLookupCombo; Label15: TLabel; wwDBComboBox24: TwwDBComboBox; RxDBLookupCombo4: TRxDBLookupCombo; Label32: TLabel; wwDBComboBox38: TwwDBComboBox; Edit9: TEdit; Label1: TLabel; wwDBComboBox3: TwwDBComboBox; Edit1: TEdit; RxDBLookupCombo17: TRxDBLookupCombo; wwDBComboBox47: TwwDBComboBox; Label42: TLabel; wwDBComboBox46: TwwDBComboBox; wwDBComboBox45: TwwDBComboBox; Label41: TLabel; bsSkinCheckRadioBox1: TbsSkinCheckRadioBox; Label6: TLabel; wwDBComboBox15: TwwDBComboBox; Edit2: TEdit; Label3: TLabel; wwDBComboBox4: TwwDBComboBox; Edit4: TEdit; Label2: TLabel; wwDBComboBox5: TwwDBComboBox; wwDBComboBox8: TwwDBComboBox; Label12: TLabel; wwDBComboBox9: TwwDBComboBox; wwDBComboBox10: TwwDBComboBox; Label13: TLabel; wwDBComboBox12: TwwDBComboBox; Edit3: TEdit; Label17: TLabel; wwDBComboBox13: TwwDBComboBox; Edit5: TEdit; Label18: TLabel; wwDBComboBox16: TwwDBComboBox; RxDBLookupCombo1: TRxDBLookupCombo; Label125: TLabel; wwDBComboBox36: TwwDBComboBox; wwDBLookupCombo49: TwwDBLookupCombo; Label30: TLabel; wwDBComboBox35: TwwDBComboBox; Edit7: TEdit; Label21: TLabel; wwDBComboBox20: TwwDBComboBox; RxDBLookupCombo20: TRxDBLookupCombo; Label19: TLabel; wwDBComboBox22: TwwDBComboBox; RxDBLookupCombo5: TRxDBLookupCombo; t_code_trade: TADOQuery; t_code_trade1: TDataSource; Label24: TLabel; wwDBComboBox23: TwwDBComboBox; RxDBLookupCombo7: TRxDBLookupCombo; Label20: TLabel; wwDBComboBox26: TwwDBComboBox; RxDBLookupCombo8: TRxDBLookupCombo; Label25: TLabel; wwDBComboBox27: TwwDBComboBox; RxDBLookupCombo9: TRxDBLookupCombo; Label26: TLabel; wwDBComboBox30: TwwDBComboBox; RxDBLookupCombo11: TRxDBLookupCombo; Label27: TLabel; wwDBComboBox31: TwwDBComboBox; RxDBLookupCombo16: TRxDBLookupCombo; Label44: TLabel; wwDBComboBox49: TwwDBComboBox; RxDBLookupCombo13: TRxDBLookupCombo; Label28: TLabel; wwDBComboBox32: TwwDBComboBox; RxDBLookupCombo14: TRxDBLookupCombo; Label29: TLabel; wwDBComboBox33: TwwDBComboBox; RxDBLookupCombo15: TRxDBLookupCombo; Label31: TLabel; wwDBComboBox34: TwwDBComboBox; wwDBDateTimePicker5: TwwDBDateTimePicker; Label33: TLabel; wwDBComboBox37: TwwDBComboBox; wwDBDateTimePicker6: TwwDBDateTimePicker; Label47: TLabel; wwDBComboBox52: TwwDBComboBox; wwDBComboBox53: TwwDBComboBox; Label34: TLabel; wwDBComboBox39: TwwDBComboBox; Edit6: TEdit; Label35: TLabel; wwDBComboBox40: TwwDBComboBox; Edit8: TEdit; Label36: TLabel; wwDBComboBox41: TwwDBComboBox; RxDBLookupCombo19: TRxDBLookupCombo; Label37: TLabel; Label38: TLabel; wwDBComboBox43: TwwDBComboBox; wwDBDateTimePicker7: TwwDBDateTimePicker; wwDBComboBox44: TwwDBComboBox; wwDBDateTimePicker8: TwwDBDateTimePicker; Label39: TLabel; wwDBComboBox48: TwwDBComboBox; RxDBLookupCombo18: TRxDBLookupCombo; wwDBComboBox42: TwwDBComboBox; Label40: TLabel; Label45: TLabel; wwDBComboBox50: TwwDBComboBox; wwDBDateTimePicker9: TwwDBDateTimePicker; wwDBComboBox51: TwwDBComboBox; wwDBDateTimePicker10: TwwDBDateTimePicker; wwDBComboBox54: TwwDBComboBox; Label46: TLabel; Label48: TLabel; Label124: TLabel; wwDBLookupCombo3: TwwDBLookupCombo; wwDBLookupCombo52: TwwDBLookupCombo; wwDBComboBox55: TwwDBComboBox; wwDBComboBox56: TwwDBComboBox; Label49: TLabel; wwDBComboBox57: TwwDBComboBox; Edit10: TEdit; Label50: TLabel; wwDBComboBox58: TwwDBComboBox; RxDBLookupCombo21: TRxDBLookupCombo; RxDBLookupCombo22: TRxDBLookupCombo; Label51: TLabel; wwDBComboBox59: TwwDBComboBox; Label52: TLabel; wwDBComboBox60: TwwDBComboBox; Edit11: TEdit; Label53: TLabel; wwDBComboBox61: TwwDBComboBox; Edit12: TEdit; procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure wwDBComboBox17KeyPress(Sender: TObject; var Key: Char); private procedure loadFindIni ; procedure writeFindIni ; { Private declarations } public { Public declarations } str_seae,str_seae_pin,str_seai,str_seai_pin,str_aire ,str_aire_pin,str_airi,str_airi_pin,str_airtruck ,str_railway,str_sealocal ,str_opctn ,str_ttl //操作 操作合计 销售部 推广部 公司货 ,str_total,str_all,sqltext,constr:widestring; procedure condition_1 ; procedure condition_2_5 ; procedure condition_12 ; end; var frm_rp_query: Tfrm_rp_query; rp_query_limited:string; rp_query_bs:integer; rp_query_bsType:integer; implementation uses my_sys_function, {$IFDEF YWTAIZHANG}u_rp_tai_total,{$ENDIF} u_rp_rp_total, u_rp_zou_total, u_rp_fen_total, u_data_share{$IFDEF ZHYDTONGJI},u_rp_rp_monthtotal, u_rp_pin_total{$ENDIF}; {$R *.dfm} procedure Tfrm_rp_query.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_rp_query.bsSkinButton10Click(Sender: TObject); begin wwDBComboBox1.text:=''; wwDBComboBox2.text:=''; wwDBDateTimePicker1.Clear; wwDBDateTimePicker2.Clear; wwDBDateTimePicker3.Clear; wwDBDateTimePicker4.Clear; wwDBDateTimePicker5.Clear; wwDBDateTimePicker6.Clear; wwDBDateTimePicker9.Clear; wwDBDateTimePicker10.Clear; Edit1.text:=''; Edit9.text:=''; RxDBLookupCombo2.ClearValue; RxDBLookupCombo19.ClearValue; RxDBLookupCombo10.ClearValue; RxDBLookupCombo6.ClearValue; RxDBLookupCombo21.ClearValue; RxDBLookupCombo18.ClearValue; RxDBLookupCombo3.ClearValue; RxDBLookupCombo12.ClearValue; RxDBLookupCombo17.ClearValue; RxDBLookupCombo4.ClearValue; wwDBComboBox46.Text:=''; wwDBComboBox53.Text:=''; Edit2.text:=''; Edit4.text:=''; Edit3.text:=''; Edit5.text:=''; Edit6.text:=''; RxDBLookupCombo1.ClearValue; wwDBLookupCombo49.text:=''; wwDBLookupCombo3.text:=''; wwDBLookupCombo52.text:=''; wwDBComboBox54.text:=''; Edit7.text:=''; RxDBLookupCombo5.ClearValue; RxDBLookupCombo7.ClearValue; RxDBLookupCombo9.ClearValue; RxDBLookupCombo20.ClearValue; RxDBLookupCombo8.ClearValue; RxDBLookupCombo11.ClearValue; RxDBLookupCombo13.ClearValue; RxDBLookupCombo14.ClearValue; RxDBLookupCombo15.ClearValue; RxDBLookupCombo16.ClearValue; Edit11.text:=''; Edit12.text:=''; end; procedure Tfrm_rp_query.FormShow(Sender: TObject); var bstype:string; begin loadFindIni; wwDBComboBox17.text:='等于'; wwDBComboBox18.text:='大于'; wwDBComboBox6.text:='小于'; wwDBComboBox11.text:='小于'; wwDBComboBox19.text:='大于'; wwDBComboBox21.text:='等于'; wwDBComboBox24.text:='等于'; wwDBComboBox25.text:='等于'; wwDBComboBox58.text:='等于'; wwDBComboBox59.text:='等于'; wwDBComboBox48.text:='等于'; wwDBComboBox7.text:='等于'; wwDBComboBox28.text:='等于'; wwDBComboBox29.text:='等于'; wwDBComboBox14.text:='等于'; wwDBComboBox3.text:='等于'; wwDBComboBox38.text:='等于'; wwDBComboBox45.text:='等于'; wwDBComboBox47.text:='等于'; wwDBComboBox15.text:='模糊'; wwDBComboBox4.text:='模糊'; wwDBComboBox5.text:='等于'; wwDBComboBox9.text:='等于'; wwDBComboBox12.text:='模糊'; wwDBComboBox13.text:='模糊'; wwDBComboBox16.text:='等于'; wwDBComboBox35.text:='模糊'; wwDBComboBox36.text:='模糊'; wwDBComboBox39.text:='等于'; wwDBComboBox40.text:='等于'; wwDBComboBox41.text:='等于'; wwDBComboBox55.text:='模糊'; wwDBComboBox56.text:='模糊'; wwDBComboBox20.text:='等于'; wwDBComboBox22.text:='等于'; wwDBComboBox23.text:='等于'; wwDBComboBox26.text:='等于'; wwDBComboBox27.text:='等于'; wwDBComboBox30.text:='等于'; wwDBComboBox31.text:='等于'; wwDBComboBox32.text:='等于'; wwDBComboBox33.text:='等于'; wwDBComboBox49.text:='等于'; wwDBComboBox52.text:='等于'; wwDBComboBox34.text:='大于'; wwDBComboBox37.text:='小于'; wwDBComboBox43.text:='大于'; wwDBComboBox44.text:='小于'; wwDBComboBox50.text:='大于'; wwDBComboBox51.text:='小于'; wwDBComboBox60.text:='等于'; wwDBComboBox61.text:='等于'; case rp_query_bsType of 0:bstype:='海运出口'; 1:bstype:='海运进口'; 2:bstype:='空运出口'; 3:bstype:='空运进口'; 4:bstype:='监管车'; 5:bstype:='铁路运输' else bstype:='海运出口'; end; frm_data_share.t_code_state.Filtered:=False; frm_data_share.t_code_state.Filter:='业务种类 = ''' +bstype+''''; // t_sys_bank.Filter:='分部名称='''+DBEdit30.text+''''; frm_data_share.t_code_state.Filtered:=True; wwDBComboBox1.Items.Clear; frm_data_share.t_code_state.First; while not frm_data_share.t_code_state.eof do begin if wwDBComboBox1.Items.IndexOf(Trim(frm_data_share.t_code_state.fieldbyname('业务状态').asstring))<=0 then wwDBComboBox1.Items.Add(Trim(frm_data_share.t_code_state.fieldbyname('业务状态').asstring)); frm_data_share.t_code_state.next; end; wwDBComboBox1.Items.Add('业务封帐'); wwDBComboBox43.text:='大于'; wwDBComboBox44.text:='小于'; wwDBComboBox50.text:='大于'; wwDBComboBox51.text:='小于'; frm_data_share.t_crm_client_all.requery; frm_data_share.t_sys_employee.requery; frm_data_share.t_sys_department.requery; t_code_trade.Open; end; procedure Tfrm_rp_query.condition_1 ; begin str_total:='SELECT '+''''+'海运出口'+''''+' as 业务种类,count(编号) as 票数,' +'sum(应收USD) as 应收USD,sum(已收USD) as 已收USD,' +'sum(应收USD-已收USD) AS 未收USD,sum(应收RMB) as 应收RMB,' +'sum(已收RMB) as 已收RMB,sum(应收RMB-已收RMB) AS 未收RMB,' +'sum(合计应收) as 合计应收,sum(合计已收) as 合计已收,' +'sum(合计应收-合计已收) AS 合计未收,' +'sum(应付USD) as 应付USD,sum(已付USD) as 已付USD,' +'sum(应付USD-已付USD) AS 未付USD,sum(应付RMB) as 应付RMB,' +'sum(已付RMB) as 已付RMB,sum(应付RMB- 已付RMB) AS 未付RMB,' +'sum(合计应付) as 合计应付,sum(合计已付) as 合计已付,' +'sum(合计应付-合计已付) AS 合计未付,sum(利润USD) as 利润USD,' +'sum(利润RMB) as 利润RMB,sum(毛利润) as 毛利润,' +'sum(不含税应收USD) as 不含税应收USD,sum(不含税应付USD) as 不含税应付USD,sum(不含税利润USD) as 不含税利润USD,' +'sum(不含税应收RMB) as 不含税应收RMB,sum(不含税应付RMB) as 不含税应付RMB,sum(不含税利润RMB) as 不含税利润RMB,' +'sum(不含税合计应收) as 不含税合计应收,sum(不含税合计应付) as 不含税合计应付,sum(不含税毛利润) as 不含税毛利润,' +'sum(不含税应收OT) as 不含税应收OT,sum(不含税应付OT) as 不含税应付OT,sum(不含税利润OT) as 不含税利润OT,' +'sum(不含税垫付费用) as 不含税垫付费用,' +'sum(应收USD税额) as 应收USD税额,sum(应付USD税额) as 应付USD税额,' +'sum(应收RMB税额) as 应收RMB税额,sum(应付RMB税额) as 应付RMB税额,' +'sum(合计应收税额) as 合计应收税额,sum(合计应付税额) as 合计应付税额,' +'sum(财务不含税应收USD) as 财务不含税应收USD,sum(财务不含税应付USD) as 财务不含税应付USD,sum(财务不含税利润USD) as 财务不含税利润USD,' +'sum(财务不含税应收RMB) as 财务不含税应收RMB,sum(财务不含税应付RMB) as 财务不含税应付RMB,sum(财务不含税利润RMB) as 财务不含税利润RMB,' +'sum(财务不含税合计应收) as 财务不含税合计应收,sum(财务不含税合计应付) as 财务不含税合计应付,sum(财务不含税毛利润) as 财务不含税毛利润,' +'sum(财务不含税应收OT) as 财务不含税应收OT,sum(财务不含税应付OT) as 财务不含税应付OT,sum(财务不含税利润OT) as 财务不含税利润OT,' +'sum(财务不含税垫付费用) as 财务不含税垫付费用,' +'sum(财务应收USD税额) as 财务应收USD税额,sum(财务应付USD税额) as 财务应付USD税额,' +'sum(财务应收RMB税额) as 财务应收RMB税额,sum(财务应付RMB税额) as 财务应付RMB税额,' +'sum(财务合计应收税额) as 财务合计应收税额,sum(财务合计应付税额) as 财务合计应付税额' +',(case when isnull(sum(合计应收),0)=0 then '+''''+'0'+''''+' else ' +'ltrim(str(sum(毛利润)/sum(合计应收)*100,10,2))+'+''''+'%'+''''+' end) as 利润率 ' +' FROM t_op_gain where 编号 in (select 编号' +' FROM t_op_seae '+str_seae+')' +' union ' +'SELECT '+''''+'海运进口'+''''+' as 业务种类,count(编号) as 票数,' +'sum(应收USD) as 应收USD,sum(已收USD) as 已收USD,' +'sum(应收USD-已收USD) AS 未收USD,sum(应收RMB) as 应收RMB,' +'sum(已收RMB) as 已收RMB,sum(应收RMB-已收RMB) AS 未收RMB,' +'sum(合计应收) as 合计应收,sum(合计已收) as 合计已收,' +'sum(合计应收-合计已收) AS 合计未收,' +'sum(应付USD) as 应付USD,sum(已付USD) as 已付USD,' +'sum(应付USD-已付USD) AS 未付USD,sum(应付RMB) as 应付RMB,' +'sum(已付RMB) as 已付RMB,sum(应付RMB- 已付RMB) AS 未付RMB,' +'sum(合计应付) as 合计应付,sum(合计已付) as 合计已付,' +'sum(合计应付-合计已付) AS 合计未付,sum(利润USD) as 利润USD,' +'sum(利润RMB) as 利润RMB,sum(毛利润) as 毛利润,' +'sum(不含税应收USD) as 不含税应收USD,sum(不含税应付USD) as 不含税应付USD,sum(不含税利润USD) as 不含税利润USD,' +'sum(不含税应收RMB) as 不含税应收RMB,sum(不含税应付RMB) as 不含税应付RMB,sum(不含税利润RMB) as 不含税利润RMB,' +'sum(不含税合计应收) as 不含税合计应收,sum(不含税合计应付) as 不含税合计应付,sum(不含税毛利润) as 不含税毛利润,' +'sum(不含税应收OT) as 不含税应收OT,sum(不含税应付OT) as 不含税应付OT,sum(不含税利润OT) as 不含税利润OT,' +'sum(不含税垫付费用) as 不含税垫付费用,' +'sum(应收USD税额) as 应收USD税额,sum(应付USD税额) as 应付USD税额,' +'sum(应收RMB税额) as 应收RMB税额,sum(应付RMB税额) as 应付RMB税额,' +'sum(合计应收税额) as 合计应收税额,sum(合计应付税额) as 合计应付税额,' +'sum(财务不含税应收USD) as 财务不含税应收USD,sum(财务不含税应付USD) as 财务不含税应付USD,sum(财务不含税利润USD) as 财务不含税利润USD,' +'sum(财务不含税应收RMB) as 财务不含税应收RMB,sum(财务不含税应付RMB) as 财务不含税应付RMB,sum(财务不含税利润RMB) as 财务不含税利润RMB,' +'sum(财务不含税合计应收) as 财务不含税合计应收,sum(财务不含税合计应付) as 财务不含税合计应付,sum(财务不含税毛利润) as 财务不含税毛利润,' +'sum(财务不含税应收OT) as 财务不含税应收OT,sum(财务不含税应付OT) as 财务不含税应付OT,sum(财务不含税利润OT) as 财务不含税利润OT,' +'sum(财务不含税垫付费用) as 财务不含税垫付费用,' +'sum(财务应收USD税额) as 财务应收USD税额,sum(财务应付USD税额) as 财务应付USD税额,' +'sum(财务应收RMB税额) as 财务应收RMB税额,sum(财务应付RMB税额) as 财务应付RMB税额,' +'sum(财务合计应收税额) as 财务合计应收税额,sum(财务合计应付税额) as 财务合计应付税额' +',(case when isnull(sum(合计应收),0)=0 then '+''''+'0'+''''+' else ' +'ltrim(str(sum(毛利润)/sum(合计应收)*100,10,2))+'+''''+'%'+''''+' end) as 利润率 ' +' FROM t_op_gain where 编号 in (select 编号' +' FROM t_op_seai '+str_seai+')' +' union ' +'SELECT '+''''+'空运出口'+''''+' as 业务种类,count(编号) as 票数,' +'sum(应收USD) as 应收USD,sum(已收USD) as 已收USD,' +'sum(应收USD-已收USD) AS 未收USD,sum(应收RMB) as 应收RMB,' +'sum(已收RMB) as 已收RMB,sum(应收RMB-已收RMB) AS 未收RMB,' +'sum(合计应收) as 合计应收,sum(合计已收) as 合计已收,' +'sum(合计应收-合计已收) AS 合计未收,' +'sum(应付USD) as 应付USD,sum(已付USD) as 已付USD,' +'sum(应付USD-已付USD) AS 未付USD,sum(应付RMB) as 应付RMB,' +'sum(已付RMB) as 已付RMB,sum(应付RMB- 已付RMB) AS 未付RMB,' +'sum(合计应付) as 合计应付,sum(合计已付) as 合计已付,' +'sum(合计应付-合计已付) AS 合计未付,sum(利润USD) as 利润USD,' +'sum(利润RMB) as 利润RMB,sum(毛利润) as 毛利润,' +'sum(不含税应收USD) as 不含税应收USD,sum(不含税应付USD) as 不含税应付USD,sum(不含税利润USD) as 不含税利润USD,' +'sum(不含税应收RMB) as 不含税应收RMB,sum(不含税应付RMB) as 不含税应付RMB,sum(不含税利润RMB) as 不含税利润RMB,' +'sum(不含税合计应收) as 不含税合计应收,sum(不含税合计应付) as 不含税合计应付,sum(不含税毛利润) as 不含税毛利润,' +'sum(不含税应收OT) as 不含税应收OT,sum(不含税应付OT) as 不含税应付OT,sum(不含税利润OT) as 不含税利润OT,' +'sum(不含税垫付费用) as 不含税垫付费用,' +'sum(应收USD税额) as 应收USD税额,sum(应付USD税额) as 应付USD税额,' +'sum(应收RMB税额) as 应收RMB税额,sum(应付RMB税额) as 应付RMB税额,' +'sum(合计应收税额) as 合计应收税额,sum(合计应付税额) as 合计应付税额,' +'sum(财务不含税应收USD) as 财务不含税应收USD,sum(财务不含税应付USD) as 财务不含税应付USD,sum(财务不含税利润USD) as 财务不含税利润USD,' +'sum(财务不含税应收RMB) as 财务不含税应收RMB,sum(财务不含税应付RMB) as 财务不含税应付RMB,sum(财务不含税利润RMB) as 财务不含税利润RMB,' +'sum(财务不含税合计应收) as 财务不含税合计应收,sum(财务不含税合计应付) as 财务不含税合计应付,sum(财务不含税毛利润) as 财务不含税毛利润,' +'sum(财务不含税应收OT) as 财务不含税应收OT,sum(财务不含税应付OT) as 财务不含税应付OT,sum(财务不含税利润OT) as 财务不含税利润OT,' +'sum(财务不含税垫付费用) as 财务不含税垫付费用,' +'sum(财务应收USD税额) as 财务应收USD税额,sum(财务应付USD税额) as 财务应付USD税额,' +'sum(财务应收RMB税额) as 财务应收RMB税额,sum(财务应付RMB税额) as 财务应付RMB税额,' +'sum(财务合计应收税额) as 财务合计应收税额,sum(财务合计应付税额) as 财务合计应付税额' +',(case when isnull(sum(合计应收),0)=0 then '+''''+'0'+''''+' else ' +'ltrim(str(sum(毛利润)/sum(合计应收)*100,10,2))+'+''''+'%'+''''+' end) as 利润率 ' +' FROM t_op_gain where 编号 in (select 编号' +' FROM t_op_aire '+str_aire+')' +' union ' +'SELECT '+''''+'空运进口'+''''+' as 业务种类,count(编号) as 票数,' +'sum(应收USD) as 应收USD,sum(已收USD) as 已收USD,' +'sum(应收USD-已收USD) AS 未收USD,sum(应收RMB) as 应收RMB,' +'sum(已收RMB) as 已收RMB,sum(应收RMB-已收RMB) AS 未收RMB,' +'sum(合计应收) as 合计应收,sum(合计已收) as 合计已收,' +'sum(合计应收-合计已收) AS 合计未收,' +'sum(应付USD) as 应付USD,sum(已付USD) as 已付USD,' +'sum(应付USD-已付USD) AS 未付USD,sum(应付RMB) as 应付RMB,' +'sum(已付RMB) as 已付RMB,sum(应付RMB- 已付RMB) AS 未付RMB,' +'sum(合计应付) as 合计应付,sum(合计已付) as 合计已付,' +'sum(合计应付-合计已付) AS 合计未付,sum(利润USD) as 利润USD,' +'sum(利润RMB) as 利润RMB,sum(毛利润) as 毛利润,' +'sum(不含税应收USD) as 不含税应收USD,sum(不含税应付USD) as 不含税应付USD,sum(不含税利润USD) as 不含税利润USD,' +'sum(不含税应收RMB) as 不含税应收RMB,sum(不含税应付RMB) as 不含税应付RMB,sum(不含税利润RMB) as 不含税利润RMB,' +'sum(不含税合计应收) as 不含税合计应收,sum(不含税合计应付) as 不含税合计应付,sum(不含税毛利润) as 不含税毛利润,' +'sum(不含税应收OT) as 不含税应收OT,sum(不含税应付OT) as 不含税应付OT,sum(不含税利润OT) as 不含税利润OT,' +'sum(不含税垫付费用) as 不含税垫付费用,' +'sum(应收USD税额) as 应收USD税额,sum(应付USD税额) as 应付USD税额,' +'sum(应收RMB税额) as 应收RMB税额,sum(应付RMB税额) as 应付RMB税额,' +'sum(合计应收税额) as 合计应收税额,sum(合计应付税额) as 合计应付税额,' +'sum(财务不含税应收USD) as 财务不含税应收USD,sum(财务不含税应付USD) as 财务不含税应付USD,sum(财务不含税利润USD) as 财务不含税利润USD,' +'sum(财务不含税应收RMB) as 财务不含税应收RMB,sum(财务不含税应付RMB) as 财务不含税应付RMB,sum(财务不含税利润RMB) as 财务不含税利润RMB,' +'sum(财务不含税合计应收) as 财务不含税合计应收,sum(财务不含税合计应付) as 财务不含税合计应付,sum(财务不含税毛利润) as 财务不含税毛利润,' +'sum(财务不含税应收OT) as 财务不含税应收OT,sum(财务不含税应付OT) as 财务不含税应付OT,sum(财务不含税利润OT) as 财务不含税利润OT,' +'sum(财务不含税垫付费用) as 财务不含税垫付费用,' +'sum(财务应收USD税额) as 财务应收USD税额,sum(财务应付USD税额) as 财务应付USD税额,' +'sum(财务应收RMB税额) as 财务应收RMB税额,sum(财务应付RMB税额) as 财务应付RMB税额,' +'sum(财务合计应收税额) as 财务合计应收税额,sum(财务合计应付税额) as 财务合计应付税额' +',(case when isnull(sum(合计应收),0)=0 then '+''''+'0'+''''+' else ' +'ltrim(str(sum(毛利润)/sum(合计应收)*100,10,2))+'+''''+'%'+''''+' end) as 利润率 ' +' FROM t_op_gain where 编号 in (select 编号' +' FROM t_op_airi '+str_airi+')' +' union ' +'SELECT '+''''+'监管车'+''''+' as 业务种类,count(编号) as 票数,' +'sum(应收USD) as 应收USD,sum(已收USD) as 已收USD,' +'sum(应收USD-已收USD) AS 未收USD,sum(应收RMB) as 应收RMB,' +'sum(已收RMB) as 已收RMB,sum(应收RMB-已收RMB) AS 未收RMB,' +'sum(合计应收) as 合计应收,sum(合计已收) as 合计已收,' +'sum(合计应收-合计已收) AS 合计未收,' +'sum(应付USD) as 应付USD,sum(已付USD) as 已付USD,' +'sum(应付USD-已付USD) AS 未付USD,sum(应付RMB) as 应付RMB,' +'sum(已付RMB) as 已付RMB,sum(应付RMB- 已付RMB) AS 未付RMB,' +'sum(合计应付) as 合计应付,sum(合计已付) as 合计已付,' +'sum(合计应付-合计已付) AS 合计未付,sum(利润USD) as 利润USD,' +'sum(利润RMB) as 利润RMB,sum(毛利润) as 毛利润,' +'sum(不含税应收USD) as 不含税应收USD,sum(不含税应付USD) as 不含税应付USD,sum(不含税利润USD) as 不含税利润USD,' +'sum(不含税应收RMB) as 不含税应收RMB,sum(不含税应付RMB) as 不含税应付RMB,sum(不含税利润RMB) as 不含税利润RMB,' +'sum(不含税合计应收) as 不含税合计应收,sum(不含税合计应付) as 不含税合计应付,sum(不含税毛利润) as 不含税毛利润,' +'sum(不含税应收OT) as 不含税应收OT,sum(不含税应付OT) as 不含税应付OT,sum(不含税利润OT) as 不含税利润OT,' +'sum(不含税垫付费用) as 不含税垫付费用,' +'sum(应收USD税额) as 应收USD税额,sum(应付USD税额) as 应付USD税额,' +'sum(应收RMB税额) as 应收RMB税额,sum(应付RMB税额) as 应付RMB税额,' +'sum(合计应收税额) as 合计应收税额,sum(合计应付税额) as 合计应付税额,' +'sum(财务不含税应收USD) as 财务不含税应收USD,sum(财务不含税应付USD) as 财务不含税应付USD,sum(财务不含税利润USD) as 财务不含税利润USD,' +'sum(财务不含税应收RMB) as 财务不含税应收RMB,sum(财务不含税应付RMB) as 财务不含税应付RMB,sum(财务不含税利润RMB) as 财务不含税利润RMB,' +'sum(财务不含税合计应收) as 财务不含税合计应收,sum(财务不含税合计应付) as 财务不含税合计应付,sum(财务不含税毛利润) as 财务不含税毛利润,' +'sum(财务不含税应收OT) as 财务不含税应收OT,sum(财务不含税应付OT) as 财务不含税应付OT,sum(财务不含税利润OT) as 财务不含税利润OT,' +'sum(财务不含税垫付费用) as 财务不含税垫付费用,' +'sum(财务应收USD税额) as 财务应收USD税额,sum(财务应付USD税额) as 财务应付USD税额,' +'sum(财务应收RMB税额) as 财务应收RMB税额,sum(财务应付RMB税额) as 财务应付RMB税额,' +'sum(财务合计应收税额) as 财务合计应收税额,sum(财务合计应付税额) as 财务合计应付税额' +',(case when isnull(sum(合计应收),0)=0 then '+''''+'0'+''''+' else ' +'ltrim(str(sum(毛利润)/sum(合计应收)*100,10,2))+'+''''+'%'+''''+' end) as 利润率 ' +' FROM t_op_gain where 编号 in (select 编号' +' FROM t_op_airtruck '+str_airtruck+')' +' union ' +'SELECT '+''''+'内贸'+''''+' as 业务种类,count(编号) as 票数,' +'sum(应收USD) as 应收USD,sum(已收USD) as 已收USD,' +'sum(应收USD-已收USD) AS 未收USD,sum(应收RMB) as 应收RMB,' +'sum(已收RMB) as 已收RMB,sum(应收RMB-已收RMB) AS 未收RMB,' +'sum(合计应收) as 合计应收,sum(合计已收) as 合计已收,' +'sum(合计应收-合计已收) AS 合计未收,' +'sum(应付USD) as 应付USD,sum(已付USD) as 已付USD,' +'sum(应付USD-已付USD) AS 未付USD,sum(应付RMB) as 应付RMB,' +'sum(已付RMB) as 已付RMB,sum(应付RMB- 已付RMB) AS 未付RMB,' +'sum(合计应付) as 合计应付,sum(合计已付) as 合计已付,' +'sum(合计应付-合计已付) AS 合计未付,sum(利润USD) as 利润USD,' +'sum(利润RMB) as 利润RMB,sum(毛利润) as 毛利润,' +'sum(不含税应收USD) as 不含税应收USD,sum(不含税应付USD) as 不含税应付USD,sum(不含税利润USD) as 不含税利润USD,' +'sum(不含税应收RMB) as 不含税应收RMB,sum(不含税应付RMB) as 不含税应付RMB,sum(不含税利润RMB) as 不含税利润RMB,' +'sum(不含税合计应收) as 不含税合计应收,sum(不含税合计应付) as 不含税合计应付,sum(不含税毛利润) as 不含税毛利润,' +'sum(不含税应收OT) as 不含税应收OT,sum(不含税应付OT) as 不含税应付OT,sum(不含税利润OT) as 不含税利润OT,' +'sum(不含税垫付费用) as 不含税垫付费用,' +'sum(应收USD税额) as 应收USD税额,sum(应付USD税额) as 应付USD税额,' +'sum(应收RMB税额) as 应收RMB税额,sum(应付RMB税额) as 应付RMB税额,' +'sum(合计应收税额) as 合计应收税额,sum(合计应付税额) as 合计应付税额,' +'sum(财务不含税应收USD) as 财务不含税应收USD,sum(财务不含税应付USD) as 财务不含税应付USD,sum(财务不含税利润USD) as 财务不含税利润USD,' +'sum(财务不含税应收RMB) as 财务不含税应收RMB,sum(财务不含税应付RMB) as 财务不含税应付RMB,sum(财务不含税利润RMB) as 财务不含税利润RMB,' +'sum(财务不含税合计应收) as 财务不含税合计应收,sum(财务不含税合计应付) as 财务不含税合计应付,sum(财务不含税毛利润) as 财务不含税毛利润,' +'sum(财务不含税应收OT) as 财务不含税应收OT,sum(财务不含税应付OT) as 财务不含税应付OT,sum(财务不含税利润OT) as 财务不含税利润OT,' +'sum(财务不含税垫付费用) as 财务不含税垫付费用,' +'sum(财务应收USD税额) as 财务应收USD税额,sum(财务应付USD税额) as 财务应付USD税额,' +'sum(财务应收RMB税额) as 财务应收RMB税额,sum(财务应付RMB税额) as 财务应付RMB税额,' +'sum(财务合计应收税额) as 财务合计应收税额,sum(财务合计应付税额) as 财务合计应付税额' +',(case when isnull(sum(合计应收),0)=0 then '+''''+'0'+''''+' else ' +'ltrim(str(sum(毛利润)/sum(合计应收)*100,10,2))+'+''''+'%'+''''+' end) as 利润率 ' +' FROM t_op_gain where 编号 in (select 编号' +' FROM t_op_sealocal '+str_sealocal+')' +' union ' +'SELECT '+''''+'铁路运输'+''''+' as 业务种类,count(编号) as 票数,' +'sum(应收USD) as 应收USD,sum(已收USD) as 已收USD,' +'sum(应收USD-已收USD) AS 未收USD,sum(应收RMB) as 应收RMB,' +'sum(已收RMB) as 已收RMB,sum(应收RMB-已收RMB) AS 未收RMB,' +'sum(合计应收) as 合计应收,sum(合计已收) as 合计已收,' +'sum(合计应收-合计已收) AS 合计未收,' +'sum(应付USD) as 应付USD,sum(已付USD) as 已付USD,' +'sum(应付USD-已付USD) AS 未付USD,sum(应付RMB) as 应付RMB,' +'sum(已付RMB) as 已付RMB,sum(应付RMB- 已付RMB) AS 未付RMB,' +'sum(合计应付) as 合计应付,sum(合计已付) as 合计已付,' +'sum(合计应付-合计已付) AS 合计未付,sum(利润USD) as 利润USD,' +'sum(利润RMB) as 利润RMB,sum(毛利润) as 毛利润,' +'sum(不含税应收USD) as 不含税应收USD,sum(不含税应付USD) as 不含税应付USD,sum(不含税利润USD) as 不含税利润USD,' +'sum(不含税应收RMB) as 不含税应收RMB,sum(不含税应付RMB) as 不含税应付RMB,sum(不含税利润RMB) as 不含税利润RMB,' +'sum(不含税合计应收) as 不含税合计应收,sum(不含税合计应付) as 不含税合计应付,sum(不含税毛利润) as 不含税毛利润,' +'sum(不含税应收OT) as 不含税应收OT,sum(不含税应付OT) as 不含税应付OT,sum(不含税利润OT) as 不含税利润OT,' +'sum(不含税垫付费用) as 不含税垫付费用,' +'sum(应收USD税额) as 应收USD税额,sum(应付USD税额) as 应付USD税额,' +'sum(应收RMB税额) as 应收RMB税额,sum(应付RMB税额) as 应付RMB税额,' +'sum(合计应收税额) as 合计应收税额,sum(合计应付税额) as 合计应付税额,' +'sum(财务不含税应收USD) as 财务不含税应收USD,sum(财务不含税应付USD) as 财务不含税应付USD,sum(财务不含税利润USD) as 财务不含税利润USD,' +'sum(财务不含税应收RMB) as 财务不含税应收RMB,sum(财务不含税应付RMB) as 财务不含税应付RMB,sum(财务不含税利润RMB) as 财务不含税利润RMB,' +'sum(财务不含税合计应收) as 财务不含税合计应收,sum(财务不含税合计应付) as 财务不含税合计应付,sum(财务不含税毛利润) as 财务不含税毛利润,' +'sum(财务不含税应收OT) as 财务不含税应收OT,sum(财务不含税应付OT) as 财务不含税应付OT,sum(财务不含税利润OT) as 财务不含税利润OT,' +'sum(财务不含税垫付费用) as 财务不含税垫付费用,' +'sum(财务应收USD税额) as 财务应收USD税额,sum(财务应付USD税额) as 财务应付USD税额,' +'sum(财务应收RMB税额) as 财务应收RMB税额,sum(财务应付RMB税额) as 财务应付RMB税额,' +'sum(财务合计应收税额) as 财务合计应收税额,sum(财务合计应付税额) as 财务合计应付税额' +',(case when isnull(sum(合计应收),0)=0 then '+''''+'0'+''''+' else ' +'ltrim(str(sum(毛利润)/sum(合计应收)*100,10,2))+'+''''+'%'+''''+' end) as 利润率 ' +' FROM t_op_gain where 编号 in (select 编号' +' FROM t_op_railway '+str_railway+')'; str_seae:='SELECT t_op_seae.编号,t_op_seae.业务编号,t_op_seae.业务状态,t_op_seae.费用状态,t_op_seae.会计期间,t_op_seae.主提单号,t_op_seae.分提单号,t_op_seae.委托编号,t_op_seae.装运方式,' +'t_op_seae.委托单位,t_op_seae.代理,t_op_seae.场站,t_op_seae.船名,t_op_seae.航次,t_op_seae.开船日期,t_op_seae.截港日期,t_op_seae.预抵日期,t_op_seae.装货港,t_op_seae.卸货港,t_op_seae.付费方式,t_op_seae.目的地,t_op_seae.签单方式,' +'t_op_seae.录入人,t_op_seae.录入日期,t_op_seae.航线,t_op_seae.船公司,t_op_seae.货代公司,t_op_seae.报关行,t_op_seae.承运车队,t_op_seae.操作员,t_op_seae.客服员,t_op_seae.揽货人,t_op_seae.销售部门,' +'t_op_seae.操作部门,t_op_seae.发货人,t_op_seae.收货人,t_op_seae.通知人,t_op_seae.货物名称,t_op_seae.件数,t_op_seae.包装,t_op_seae.重量,t_op_seae.尺码,' +'t_op_seae.箱型1,t_op_seae.箱型2,t_op_seae.箱型3,t_op_seae.箱型4,t_op_seae.箱型5,t_op_seae.箱型6,t_op_seae.箱型7,t_op_seae.箱型8,t_op_seae.箱型9,' +'t_op_seae.箱型10,t_op_seae.其他箱型,t_op_seae.箱TEU,t_op_seae.合计20,t_op_seae.合计40,t_op_seae.合计40H,t_op_seae.合计45,t_op_seae.集团成本,t_op_seae.集装箱,' +'t_op_seae.是否退舱,t_op_seae.销售订舱说明,t_op_seae.业务来源,t_op_seae.来源明细,t_op_seae.业务类型,t_op_seae.经营单位,t_op_seae.运费协议号,' +'t_op_seae.运费确认人,t_op_seae.货物标识,t_op_seae.订舱单号,dbo.F_Str_UsdRate(t_op_seae.会计期间) 业务汇率,v_fee_do_max.结算日期,' +'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.利润率' +',t_op_gain_main.不含税应收USD,t_op_gain_main.不含税应付USD,t_op_gain_main.不含税利润USD,' +'t_op_gain_main.不含税应收RMB,t_op_gain_main.不含税应付RMB,t_op_gain_main.不含税利润RMB,' +'t_op_gain_main.不含税合计应收,t_op_gain_main.不含税合计应付,t_op_gain_main.不含税毛利润,' +'t_op_gain_main.不含税应收OT,t_op_gain_main.不含税应付OT,t_op_gain_main.不含税利润OT,' +'t_op_gain_main.不含税垫付费用,t_op_gain_main.不含税利润率,' +'t_op_gain_main.应收USD税额,t_op_gain_main.应付USD税额,' +'t_op_gain_main.应收RMB税额,t_op_gain_main.应付RMB税额,' +'t_op_gain_main.合计应收税额,t_op_gain_main.合计应付税额,' +'t_op_gain_main.财务不含税应收USD,t_op_gain_main.财务不含税应付USD,t_op_gain_main.财务不含税利润USD,' +'t_op_gain_main.财务不含税应收RMB,t_op_gain_main.财务不含税应付RMB,t_op_gain_main.财务不含税利润RMB,' +'t_op_gain_main.财务不含税合计应收,t_op_gain_main.财务不含税合计应付,t_op_gain_main.财务不含税毛利润,' +'t_op_gain_main.财务不含税应收OT,t_op_gain_main.财务不含税应付OT,t_op_gain_main.财务不含税利润OT,' +'t_op_gain_main.财务不含税垫付费用,t_op_gain_main.财务不含税利润率,' +'t_op_gain_main.财务应收USD税额,t_op_gain_main.财务应付USD税额,' +'t_op_gain_main.财务应收RMB税额,t_op_gain_main.财务应付RMB税额,' +'t_op_gain_main.财务合计应收税额,t_op_gain_main.财务合计应付税额' +' FROM t_op_seae left JOIN t_op_gain t_op_gain_main ON t_op_seae.编号 = t_op_gain_main.编号 ' //20120326 +' left JOIN v_fee_do_max ON t_op_seae.编号 = v_fee_do_max.编号 ' //20120326 +str_seae+' and 1=1'+default_sort(53,'t_op_seae','','desc'); str_seai:='SELECT t_op_seai.编号,t_op_seai.业务编号,t_op_seai.业务状态,t_op_seai.费用状态,t_op_seai.会计期间,t_op_seai.委托编号,t_op_seai.主提单号,t_op_seai.分提单号,t_op_seai.合同号,' +'t_op_seai.装运方式,t_op_seai.委托单位,t_op_seai.代理,t_op_seai.场站,t_op_seai.船名,t_op_seai.航次,t_op_seai.进口日期,t_op_seai.装货港,t_op_seai.卸货港,t_op_seai.录入人,' +'t_op_seai.录入日期,t_op_seai.航线,t_op_seai.船公司,t_op_seai.货代公司,t_op_seai.报关行,t_op_seai.承运车队,t_op_seai.操作员,t_op_seai.客服员,' +'t_op_seai.揽货人,t_op_seai.销售部门,t_op_seai.操作部门,t_op_seai.发货人,t_op_seai.收货人,t_op_seai.通知人,' +'t_op_seai.货物名称,t_op_seai.件数,t_op_seai.包装,t_op_seai.重量,t_op_seai.尺码,t_op_seai.箱型1,t_op_seai.箱型2,t_op_seai.箱型3,t_op_seai.箱型4,t_op_seai.箱型5,' +'t_op_seai.箱型6,t_op_seai.箱型7,t_op_seai.箱型8,t_op_seai.箱型9,t_op_seai.箱型10,t_op_seai.其他箱型,t_op_seai.箱TEU,t_op_seai.合计20,t_op_seai.合计40,t_op_seai.合计40H,t_op_seai.合计45,t_op_seai.集团成本,t_op_seai.集装箱,' +'t_op_seai.业务来源,t_op_seai.来源明细,t_op_seai.业务类型,t_op_seai.经营单位,' +'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.利润率' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额,' +'t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_seai left JOIN t_op_gain ON t_op_seai.编号 = t_op_gain.编号 ' +str_seai+default_sort(54,'t_op_seai','','desc'); str_aire:='SELECT t_op_aire.编号,t_op_aire.业务编号,t_op_aire.业务状态,t_op_aire.费用状态,t_op_aire.会计期间,t_op_aire.委托编号,t_op_aire.主运单号,t_op_aire.分运单号,t_op_aire.委托单位,' +'t_op_aire.代理,t_op_aire.一程航班,t_op_aire.一程开航日期,t_op_aire.始发港,t_op_aire.目的港,t_op_aire.航空公司,t_op_aire.报关行,t_op_aire.录入人,t_op_aire.录入日期,' +'t_op_aire.操作员,t_op_aire.客服员,t_op_aire.揽货人,t_op_aire.操作部门,t_op_aire.销售部门,t_op_aire.发货人,t_op_aire.收货人,t_op_aire.通知人,' +'t_op_aire.货物名称,t_op_aire.件数,t_op_aire.计价重量,t_op_aire.业务来源,t_op_aire.来源明细,t_op_aire.业务类型,' +'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.利润率' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额,' +'t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_aire left JOIN t_op_gain ON t_op_aire.编号 = t_op_gain.编号 ' +str_aire+default_sort(55,'t_op_aire','','desc'); str_airi:='SELECT t_op_airi.编号,t_op_airi.业务编号,t_op_airi.业务状态,t_op_airi.费用状态,t_op_airi.会计期间,t_op_airi.委托编号,t_op_airi.主运单号,t_op_airi.分运单号,t_op_airi.委托单位,' +'t_op_airi.代理,t_op_airi.航班号,t_op_airi.进口日期,t_op_airi.始发港,t_op_airi.目的港,t_op_airi.航空公司,t_op_airi.报关行,t_op_airi.录入人,t_op_airi.录入日期,' +'t_op_airi.操作员,t_op_airi.客服员,t_op_airi.揽货人,t_op_airi.操作部门,t_op_airi.销售部门,t_op_airi.发货人,t_op_airi.收货人,t_op_airi.通知人,' +'t_op_airi.货物名称,t_op_airi.件数,t_op_airi.计价重量,t_op_airi.业务来源,t_op_airi.来源明细,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.利润率' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额,' +'t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,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_airi+default_sort(56,'t_op_airi','','desc'); str_airtruck:='SELECT t_op_airtruck.*, 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.利润率' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额,' +'t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_airtruck left JOIN t_op_gain ON t_op_airtruck.编号 = t_op_gain.编号 ' +str_airtruck; str_railway:='SELECT t_op_railway.*, 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.利润率' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额,' +'t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_railway left JOIN t_op_gain ON t_op_railway.编号 = t_op_gain.编号 ' +str_railway; str_sealocal:='SELECT t_op_sealocal.委托单位,t_op_sealocal.主提单号,t_op_sealocal.开船日期,t_op_sealocal.船公司,t_op_sealocal.船名,t_op_sealocal.航次,t_op_sealocal.起运地,t_op_sealocal.目的地' +',sum(t_op_gain.应收USD) 应收USD, sum(t_op_gain.已收USD) 已收USD,sum(t_op_gain.应收USD-t_op_gain.已收USD) AS 未收USD' +',sum(t_op_gain.应收RMB) 应收RMB, sum(t_op_gain.已收RMB) 已收RMB,sum(t_op_gain.应收RMB-t_op_gain.已收RMB) AS 未收RMB' +', sum(t_op_gain.合计应收) 合计应收,sum(t_op_gain.合计已收)合计已收,sum(t_op_gain.合计应收-t_op_gain.合计已收) AS 合计未收' +',sum(t_op_gain.应付USD) 应付USD, sum(t_op_gain.已付USD) 已付USD, sum(t_op_gain.应付USD-t_op_gain.已付USD) AS 未付USD' +',sum(t_op_gain.应付RMB) 应付RMB, sum(t_op_gain.已付RMB) 已付RMB,sum(t_op_gain.应付RMB- t_op_gain.已付RMB) AS 未付RMB' +',sum(t_op_gain.合计应付) 合计应付,sum(t_op_gain.合计已付) 合计已付,sum(t_op_gain.合计应付-t_op_gain.合计已付) AS 合计未付' +',sum(t_op_gain.利润USD) 利润USD, sum(t_op_gain.利润RMB) 利润RMB, sum(t_op_gain.毛利润) 毛利润, ' +'sum(t_op_gain.应收USD税额) 应收USD税额,sum(t_op_gain.应付USD税额) 应付USD税额,' +'sum(t_op_gain.应收RMB税额) 应收RMB税额,sum(t_op_gain.应付RMB税额) 应付RMB税额,' +'sum(t_op_gain.合计应收税额) 合计应收税额,sum(t_op_gain.合计应付税额) 合计应付税额,' +'sum(t_op_gain.财务不含税应收USD) 财务不含税应收USD,sum(t_op_gain.财务不含税应付USD) 财务不含税应付USD,sum(t_op_gain.财务不含税利润USD) 财务不含税利润USD,' +'sum(t_op_gain.财务不含税应收RMB) 财务不含税应收RMB,sum(t_op_gain.财务不含税应付RMB) 财务不含税应付RMB,sum(t_op_gain.财务不含税利润RMB) 财务不含税利润RMB,' +'sum(t_op_gain.财务不含税合计应收) 财务不含税合计应收,sum(t_op_gain.财务不含税合计应付) 财务不含税合计应付,sum(t_op_gain.财务不含税毛利润) 财务不含税毛利润,' +'sum(t_op_gain.财务不含税应收OT) 财务不含税应收OT,sum(t_op_gain.财务不含税应付OT) 财务不含税应付OT,sum(t_op_gain.财务不含税利润OT) 财务不含税利润OT,' +'sum(t_op_gain.财务不含税垫付费用) 财务不含税垫付费用,' +'sum(t_op_gain.财务应收USD税额) 财务应收USD税额,sum(t_op_gain.财务应付USD税额) 财务应付USD税额,' +'sum(t_op_gain.财务应收RMB税额) 财务应收RMB税额,sum(t_op_gain.财务应付RMB税额) 财务应付RMB税额,' +'sum(t_op_gain.财务合计应收税额) 财务合计应收税额,sum(t_op_gain.财务合计应付税额) 财务合计应付税额' +' FROM t_op_sealocal left JOIN t_op_gain ON t_op_sealocal.编号 = t_op_gain.编号 ' +str_sealocal +'group by t_op_sealocal.委托单位,t_op_sealocal.主提单号,t_op_sealocal.开船日期,t_op_sealocal.船公司,t_op_sealocal.船名,t_op_sealocal.航次,t_op_sealocal.起运地,t_op_sealocal.目的地'; //showmessage(str_sealocal); end; procedure Tfrm_rp_query.condition_2_5 ; begin str_seae:='SELECT t_op_seae.编号,t_op_seae.业务编号,t_op_seae.业务状态,t_op_seae.费用状态,t_op_seae.会计期间,t_op_seae.主提单号,t_op_seae.分提单号,t_op_seae.委托编号,t_op_seae.装运方式,' +'t_op_seae.委托单位,t_op_seae.代理,t_op_seae.场站,t_op_seae.船名,t_op_seae.航次,t_op_seae.开船日期,t_op_seae.截港日期,t_op_seae.预抵日期,t_op_seae.装货港,t_op_seae.卸货港,t_op_seae.付费方式,t_op_seae.目的地,t_op_seae.签单方式,' +'t_op_seae.录入人,t_op_seae.录入日期,t_op_seae.航线,t_op_seae.船公司,t_op_seae.货代公司,t_op_seae.报关行,t_op_seae.承运车队,t_op_seae.操作员,t_op_seae.客服员,t_op_seae.揽货人,t_op_seae.销售部门,' +'t_op_seae.操作部门,t_op_seae.发货人,t_op_seae.收货人,t_op_seae.通知人,t_op_seae.货物名称,t_op_seae.件数,t_op_seae.包装,t_op_seae.重量,t_op_seae.尺码,' +'t_op_seae.箱型1,t_op_seae.箱型2,t_op_seae.箱型3,t_op_seae.箱型4,t_op_seae.箱型5,t_op_seae.箱型6,t_op_seae.箱型7,t_op_seae.箱型8,t_op_seae.箱型9,' +'t_op_seae.箱型10,t_op_seae.其他箱型,t_op_seae.箱TEU,t_op_seae.合计20,t_op_seae.合计40,t_op_seae.合计40H,t_op_seae.合计45,t_op_seae.集团成本,t_op_seae.集装箱,' +'t_op_seae.是否退舱,t_op_seae.销售订舱说明,t_op_seae.业务来源,t_op_seae.来源明细,t_op_seae.业务类型,t_op_seae.经营单位,t_op_seae.运费协议号,t_op_seae.运费确认人,t_op_seae.订舱单号' +', 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.应收OT,t_op_gain.已收OT,(t_op_gain.应收OT-t_op_gain.已收OT) 未收OT' +',t_op_gain.应付OT,t_op_gain.已付OT,(t_op_gain.应付OT-t_op_gain.已付OT) 未付OT,t_op_gain.利润OT,' +' t_op_gain.利润USD, t_op_gain.利润RMB, t_op_gain.毛利润, t_op_gain.利润率,(CASE WHEN t_op_gain.应收USD=0' +' THEN 0 ELSE t_op_gain.利润USD/t_op_gain.应收USD END)*100 as USD利润率,(CASE WHEN t_op_gain.应收RMB=0' +' THEN 0 ELSE t_op_gain.利润RMB/t_op_gain.应收RMB END)*100 as RMB利润率' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_seae left JOIN t_op_gain ON t_op_seae.编号 = t_op_gain.编号 ' +str_seae+default_sort(53,'t_op_seae','','desc'); //ShowMessage(str_seae); str_seai:='SELECT t_op_seai.*, 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.应收OT,t_op_gain.已收OT,(t_op_gain.应收OT-t_op_gain.已收OT) 未收OT' +',t_op_gain.应付OT,t_op_gain.已付OT,(t_op_gain.应付OT-t_op_gain.已付OT) 未付OT,t_op_gain.利润OT,' +' t_op_gain.利润USD, t_op_gain.利润RMB, t_op_gain.毛利润, t_op_gain.利润率,(CASE WHEN t_op_gain.应收USD=0' +' THEN 0 ELSE t_op_gain.利润USD/t_op_gain.应收USD END)*100 as USD利润率,(CASE WHEN t_op_gain.应收RMB=0' +' THEN 0 ELSE t_op_gain.利润RMB/t_op_gain.应收RMB END)*100 as RMB利润率' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_seai left JOIN t_op_gain ON t_op_seai.编号 = t_op_gain.编号 ' +str_seai+default_sort(54,'t_op_seai','','desc'); str_aire:='SELECT t_op_aire.*, 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.应收OT,t_op_gain.已收OT,(t_op_gain.应收OT-t_op_gain.已收OT) 未收OT' +',t_op_gain.应付OT,t_op_gain.已付OT,(t_op_gain.应付OT-t_op_gain.已付OT) 未付OT,t_op_gain.利润OT,' +' t_op_gain.利润USD, t_op_gain.利润RMB, t_op_gain.毛利润, t_op_gain.利润率,(CASE WHEN t_op_gain.应收USD=0' +' THEN 0 ELSE t_op_gain.利润USD/t_op_gain.应收USD END)*100 as USD利润率,(CASE WHEN t_op_gain.应收RMB=0' +' THEN 0 ELSE t_op_gain.利润RMB/t_op_gain.应收RMB END)*100 as RMB利润率' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_aire left JOIN t_op_gain ON t_op_aire.编号 = t_op_gain.编号 ' +str_aire+default_sort(55,'t_op_aire','','desc'); str_airi:='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.应收OT,t_op_gain.已收OT,(t_op_gain.应收OT-t_op_gain.已收OT) 未收OT' +',t_op_gain.应付OT,t_op_gain.已付OT,(t_op_gain.应付OT-t_op_gain.已付OT) 未付OT,t_op_gain.利润OT,' +' t_op_gain.利润USD, t_op_gain.利润RMB, t_op_gain.毛利润, t_op_gain.利润率,(CASE WHEN t_op_gain.应收USD=0' +' THEN 0 ELSE t_op_gain.利润USD/t_op_gain.应收USD END)*100 as USD利润率,(CASE WHEN t_op_gain.应收RMB=0' +' THEN 0 ELSE t_op_gain.利润RMB/t_op_gain.应收RMB END)*100 as RMB利润率' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,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_airi+default_sort(56,'t_op_airi','','desc'); str_airtruck:='SELECT t_op_airtruck.*, v_op_gain_main_airtruck.应收USD, v_op_gain_main_airtruck.已收USD,(v_op_gain_main_airtruck.应收USD-v_op_gain_main_airtruck.已收USD)' +' AS 未收USD,v_op_gain_main_airtruck.应收RMB, v_op_gain_main_airtruck.已收RMB,(v_op_gain_main_airtruck.应收RMB-v_op_gain_main_airtruck.已收RMB)' +' AS 未收RMB, v_op_gain_main_airtruck.合计应收,v_op_gain_main_airtruck.合计已收,(v_op_gain_main_airtruck.合计应收-v_op_gain_main_airtruck.合计已收)' +' AS 合计未收,v_op_gain_main_airtruck.应付USD, v_op_gain_main_airtruck.已付USD, (v_op_gain_main_airtruck.应付USD-v_op_gain_main_airtruck.已付USD)' +' AS 未付USD,v_op_gain_main_airtruck.应付RMB, v_op_gain_main_airtruck.已付RMB,(v_op_gain_main_airtruck.应付RMB- v_op_gain_main_airtruck.已付RMB)' +' AS 未付RMB,v_op_gain_main_airtruck.合计应付,v_op_gain_main_airtruck.合计已付,(v_op_gain_main_airtruck.合计应付-v_op_gain_main_airtruck.合计已付) AS 合计未付,' +' v_op_gain_main_airtruck.应收OT,v_op_gain_main_airtruck.已收OT,(v_op_gain_main_airtruck.应收OT-v_op_gain_main_airtruck.已收OT) 未收OT' +',v_op_gain_main_airtruck.应付OT,v_op_gain_main_airtruck.已付OT,(v_op_gain_main_airtruck.应付OT-v_op_gain_main_airtruck.已付OT) 未付OT,v_op_gain_main_airtruck.利润OT,' +' v_op_gain_main_airtruck.利润USD, v_op_gain_main_airtruck.利润RMB, v_op_gain_main_airtruck.毛利润, '''' 利润率,(CASE WHEN v_op_gain_main_airtruck.应收USD=0' +' THEN 0 ELSE v_op_gain_main_airtruck.利润USD/v_op_gain_main_airtruck.应收USD END)*100 as USD利润率,(CASE WHEN v_op_gain_main_airtruck.应收RMB=0' +' THEN 0 ELSE v_op_gain_main_airtruck.利润RMB/v_op_gain_main_airtruck.应收RMB END)*100 as RMB利润率' +',v_op_gain_main_airtruck.不含税应收USD,v_op_gain_main_airtruck.不含税应付USD,v_op_gain_main_airtruck.不含税利润USD,' +'v_op_gain_main_airtruck.不含税应收RMB,v_op_gain_main_airtruck.不含税应付RMB,v_op_gain_main_airtruck.不含税利润RMB,' +'v_op_gain_main_airtruck.不含税合计应收,v_op_gain_main_airtruck.不含税合计应付,v_op_gain_main_airtruck.不含税毛利润,' +'v_op_gain_main_airtruck.不含税应收OT,v_op_gain_main_airtruck.不含税应付OT,v_op_gain_main_airtruck.不含税利润OT,' +'v_op_gain_main_airtruck.不含税垫付费用,'''' 不含税利润率,' +'v_op_gain_main_airtruck.应收USD税额,v_op_gain_main_airtruck.应付USD税额,' +'v_op_gain_main_airtruck.应收RMB税额,v_op_gain_main_airtruck.应付RMB税额,' +'v_op_gain_main_airtruck.合计应收税额,v_op_gain_main_airtruck.合计应付税额' +',v_op_gain_main_airtruck.财务不含税应收USD,v_op_gain_main_airtruck.财务不含税应付USD,v_op_gain_main_airtruck.财务不含税利润USD,' +'v_op_gain_main_airtruck.财务不含税应收RMB,v_op_gain_main_airtruck.财务不含税应付RMB,v_op_gain_main_airtruck.财务不含税利润RMB,' +'v_op_gain_main_airtruck.财务不含税合计应收,v_op_gain_main_airtruck.财务不含税合计应付,v_op_gain_main_airtruck.财务不含税毛利润,' +'v_op_gain_main_airtruck.财务不含税应收OT,v_op_gain_main_airtruck.财务不含税应付OT,v_op_gain_main_airtruck.财务不含税利润OT,' +'v_op_gain_main_airtruck.财务不含税垫付费用,'''' 财务不含税利润率,' +'v_op_gain_main_airtruck.财务应收USD税额,v_op_gain_main_airtruck.财务应付USD税额,' +'v_op_gain_main_airtruck.财务应收RMB税额,v_op_gain_main_airtruck.财务应付RMB税额,' +'v_op_gain_main_airtruck.财务合计应收税额,v_op_gain_main_airtruck.财务合计应付税额' +' FROM t_op_airtruck left JOIN v_op_gain_main_airtruck ON t_op_airtruck.主编号 = v_op_gain_main_airtruck.主编号 ' +str_airtruck+' order by t_op_airtruck.业务编号'; str_railway:='SELECT t_op_railway.*, 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.应收OT,t_op_gain_main.应付OT,t_op_gain_main.已收OT,t_op_gain_main.已付OT,t_op_gain_main.利润OT,' +' t_op_gain_main.利润USD, t_op_gain_main.利润RMB, t_op_gain_main.毛利润, t_op_gain_main.利润率,(CASE WHEN t_op_gain_main.应收USD=0' +' THEN 0 ELSE t_op_gain_main.利润USD/t_op_gain_main.应收USD END)*100 as USD利润率,(CASE WHEN t_op_gain_main.应收RMB=0' +' THEN 0 ELSE t_op_gain_main.利润RMB/t_op_gain_main.应收RMB END)*100 as RMB利润率' +',t_op_gain_main.不含税应收USD,t_op_gain_main.不含税应付USD,t_op_gain_main.不含税利润USD,' +'t_op_gain_main.不含税应收RMB,t_op_gain_main.不含税应付RMB,t_op_gain_main.不含税利润RMB,' +'t_op_gain_main.不含税合计应收,t_op_gain_main.不含税合计应付,t_op_gain_main.不含税毛利润,' +'t_op_gain_main.不含税应收OT,t_op_gain_main.不含税应付OT,t_op_gain_main.不含税利润OT,' +'t_op_gain_main.不含税垫付费用,t_op_gain_main.不含税利润率,' +'t_op_gain_main.应收USD税额,t_op_gain_main.应付USD税额,' +'t_op_gain_main.应收RMB税额,t_op_gain_main.应付RMB税额,' +'t_op_gain_main.合计应收税额,t_op_gain_main.合计应付税额' +',t_op_gain_main.财务不含税应收USD,t_op_gain_main.财务不含税应付USD,t_op_gain_main.财务不含税利润USD,' +'t_op_gain_main.财务不含税应收RMB,t_op_gain_main.财务不含税应付RMB,t_op_gain_main.财务不含税利润RMB,' +'t_op_gain_main.财务不含税合计应收,t_op_gain_main.财务不含税合计应付,t_op_gain_main.财务不含税毛利润,' +'t_op_gain_main.财务不含税应收OT,t_op_gain_main.财务不含税应付OT,t_op_gain_main.财务不含税利润OT,' +'t_op_gain_main.财务不含税垫付费用,t_op_gain_main.财务不含税利润率,' +'t_op_gain_main.财务应收USD税额,t_op_gain_main.财务应付USD税额,' +'t_op_gain_main.财务应收RMB税额,t_op_gain_main.财务应付RMB税额,' +'t_op_gain_main.财务合计应收税额,t_op_gain_main.财务合计应付税额' +' FROM t_op_railway left JOIN t_op_gain t_op_gain_main ON t_op_railway.编号 = t_op_gain_main.编号 ' +str_railway+' and t_op_railway.编号=t_op_railway.编号 order by t_op_railway.业务编号'; // +str_railway+' and t_op_railway.编号=t_op_railway.主编号 order by t_op_railway.业务编号'; 20120330 end; procedure Tfrm_rp_query.bsSkinButton1Click(Sender: TObject); var DBQueryThread1,DBQueryThread2,DBQueryThread3,DBQueryThread4,DBQueryThread5 ,DBQueryThread6,DBQueryThread7:TDBQueryThread; W: DWord; H: THandle; begin {$IFDEF ZHYDTONGJI} case rp_query_bs of 22: begin if frm_rp_rp_monthtotal.bsSkinCheckRadioBox2.Checked then begin if wwDBDateTimePicker1.Text='' then begin MessageDlg('业务开始日期必须有值',mtWarning,[mbYes],0); exit; end; if wwDBDateTimePicker2.Text='' then begin MessageDlg('业务结束日期必须有值',mtWarning,[mbYes],0); exit; end; frm_rp_rp_monthtotal.wwDBDateTimePicker1.Date:=wwDBDateTimePicker1.date; frm_rp_rp_monthtotal.wwDBDateTimePicker2.date:=wwDBDateTimePicker2.date; end; if frm_rp_rp_monthtotal.bsSkinCheckRadioBox1.Checked then begin if wwDBDateTimePicker3.Text='' then begin MessageDlg('会计开始日期必须有值',mtWarning,[mbYes],0); exit; end; if wwDBDateTimePicker4.Text='' then begin MessageDlg('会计结束日期必须有值',mtWarning,[mbYes],0); exit; end; frm_rp_rp_monthtotal.wwDBDateTimePicker1.date:=wwDBDateTimePicker3.date; frm_rp_rp_monthtotal.wwDBDateTimePicker2.date:=wwDBDateTimePicker4.date; end; end; end; {$ENDIF} writeFindIni; str_seae:=query_tiaojian(1,str_seae,'业务状态',wwDBComboBox17.text,wwDBComboBox1.text); str_seae:=query_tiaojian(1,str_seae,'费用状态',wwDBComboBox7.text,wwDBComboBox2.text); str_seae:=query_tiaojian(1,str_seae,'会计期间',wwDBComboBox19.text,wwDBDateTimePicker3.text); str_seae:=query_tiaojian(1,str_seae,'会计期间',wwDBComboBox11.text,wwDBDateTimePicker4.text); str_seae:=query_tiaojian(1,str_seae,'委托单位',wwDBComboBox21.text,RxDBLookupCombo2.DisplayValues[1]); // str_seae:=query_tiaojian(1,str_seae,'付费方式',wwDBComboBox41.text,RxDBLookupCombo19.DisplayValues[1]); str_seae:=query_tiaojian(1,str_seae,'客服员',wwDBComboBox24.text,RxDBLookupCombo4.DisplayValue); str_seae:=query_tiaojian(1,str_seae,'揽货人',wwDBComboBox14.text,RxDBLookupCombo3.DisplayValue); str_seae:=query_tiaojian(1,str_seae,'操作员',wwDBComboBox25.text,RxDBLookupCombo6.DisplayValue); str_seae:=query_tiaojian(1,str_seae,'录入人',wwDBComboBox58.text,RxDBLookupCombo21.DisplayValue); str_seae:=query_tiaojian(1,str_seae,'销售部门',wwDBComboBox28.text,RxDBLookupCombo10.DisplayValue); str_seae:=query_tiaojian(1,str_seae,'操作部门',wwDBComboBox29.text,RxDBLookupCombo12.DisplayValue); str_seae:=query_tiaojian(2,str_seae,'周次',wwDBComboBox3.text,Edit1.text); str_seae:=query_tiaojian(2,str_seae,'周次',wwDBComboBox38.text,Edit9.text); str_seae:=query_tiaojian(1,str_seae,'业务类型',wwDBComboBox45.text,wwDBComboBox46.text); str_seae:=query_tiaojian(1,str_seae,'分部名称',wwDBComboBox47.text,RxDBLookupCombo17.DisplayValue); str_seae:=query_tiaojian(1,str_seae,'业务编号',wwDBComboBox15.text,Edit2.text); str_seae:=query_tiaojian(1,str_seae,'委托编号',wwDBComboBox4.text,Edit4.text); str_seae:=query_tiaojian(1,str_seae,'装运方式',wwDBComboBox9.text,wwDBComboBox10.text); str_seae:=query_tiaojian(1,str_seae,'业务编号',wwDBComboBox12.text,Edit3.text); str_seae:=query_tiaojian(1,str_seae,'委托编号',wwDBComboBox13.text,Edit5.text); str_seae:=query_tiaojian(1,str_seae,'代理',wwDBComboBox16.text,RxDBLookupCombo1.DisplayValues[1]); str_seae:=query_tiaojian(1,str_seae,'费用封帐日期',wwDBComboBox34.text,wwDBDateTimePicker5.text); str_seae:=query_tiaojian(1,str_seae,'费用封帐日期',wwDBComboBox37.text,wwDBDateTimePicker6.text); { str_seae:=query_tiaojian(1,str_seae,'审核日期',wwDBComboBox43.text,wwDBDateTimePicker7.text); str_seae:=query_tiaojian(1,str_seae,'审核日期',wwDBComboBox44.text,wwDBDateTimePicker8.text); } str_seae:=query_tiaojian(1,str_seae,'发货人',wwDBComboBox26.text,RxDBLookupCombo8.DisplayValues[1]); str_seae:=query_tiaojian(1,str_seae,'收货人',wwDBComboBox27.text,RxDBLookupCombo9.DisplayValues[1]); str_seae:=query_tiaojian(1,str_seae,'通知人',wwDBComboBox30.text,RxDBLookupCombo11.DisplayValues[1]); str_seae:=query_tiaojian(1,str_seae,'业务来源',wwDBComboBox31.text,RxDBLookupCombo16.DisplayValue); str_seae:=query_tiaojian(1,str_seae,'来源明细',wwDBComboBox49.text,RxDBLookupCombo13.DisplayValue); if rp_query_limited<>'no'then begin if trim(str_seae)='' then begin str_seai:='where '+open_data(rp_query_limited,'揽货人','操作员','客服员','报关操作','报检操作'); end else begin str_seai:=str_seae+' and '+open_data(rp_query_limited,'揽货人','操作员','客服员','报关操作','报检操作'); end; if trim(str_seae)='' then begin str_aire:='where '+open_data(rp_query_limited,'揽货人','操作员','客服员','no','no'); end else begin str_aire:=str_seae+' and '+open_data(rp_query_limited,'揽货人','操作员','客服员','no','no'); end; if trim(str_seae)='' then begin str_airi:='where '+open_data(rp_query_limited,'揽货人','操作员','客服员','no','no'); end else begin str_airi:=str_seae+' and '+open_data(rp_query_limited,'揽货人','操作员','客服员','no','no'); end; if trim(str_seae)='' then begin str_all:='where '+open_data(rp_query_limited,'揽货人','操作员','客服员','报关操作','报检操作'); end else begin str_all:=str_seae+' and '+open_data(rp_query_limited,'揽货人','操作员','客服员','报关操作','报检操作'); end; if trim(str_seae)='' then begin str_airtruck:='where t_op_airtruck.主编号=t_op_airtruck.编号 and '+open_data(rp_query_limited,'揽货人','操作员','客服员','no','no'); end else begin str_airtruck:=str_seae+' and t_op_airtruck.主编号=t_op_airtruck.编号 and '+open_data(rp_query_limited,'揽货人','操作员','客服员','no','no'); end; if trim(str_seae)='' then begin str_railway:='where '+open_data(rp_query_limited,'揽货人','操作员','客服员','no','no'); end else begin str_railway:=str_seae+' and '+open_data(rp_query_limited,'揽货人','操作员','客服员','no','no'); end; if trim(str_seae)='' then begin str_seae:='where '+open_data(rp_query_limited,'揽货人','操作员','客服员','报关操作','报检操作'); end else begin str_seae:=str_seae+' and '+open_data(rp_query_limited,'揽货人','操作员','客服员','报关操作','报检操作'); end; str_seae:=query_tiaojian(1,str_seae,'运费确认人',wwDBComboBox48.text,RxDBLookupCombo18.DisplayValue); str_seae:=query_tiaojian(1,str_seae,'主提单号',wwDBComboBox39.text,Edit6.text); str_seae:=query_tiaojian(1,str_seae,'主提单号',wwDBComboBox40.text,Edit8.text); str_seae:=query_tiaojian(1,str_seae,'装货港',wwDBComboBox55.text,wwDBLookupCombo3.text); str_seae:=query_tiaojian(1,str_seae,'卸货港',wwDBComboBox56.text,wwDBLookupCombo52.text); str_seae:=query_tiaojian(1,str_seae,'发货人代码',wwDBComboBox57.text,Edit10.text); str_seai:=query_tiaojian(1,str_seai,'主提单号',wwDBComboBox39.text,Edit6.text); str_seai:=query_tiaojian(1,str_seai,'主提单号',wwDBComboBox40.text,Edit8.text); str_seai:=query_tiaojian(1,str_seai,'发货人代码',wwDBComboBox57.text,Edit10.text); str_aire:=query_tiaojian(1,str_aire,'主运单号',wwDBComboBox39.text,Edit6.text); str_aire:=query_tiaojian(1,str_aire,'主运单号',wwDBComboBox40.text,Edit8.text); str_aire:=query_tiaojian(1,str_aire,'发货人代码',wwDBComboBox57.text,Edit10.text); str_airi:=query_tiaojian(1,str_airi,'主运单号',wwDBComboBox39.text,Edit6.text); str_airi:=query_tiaojian(1,str_airi,'主运单号',wwDBComboBox40.text,Edit8.text); str_airi:=query_tiaojian(1,str_airi,'发货人代码',wwDBComboBox57.text,Edit10.text); str_airtruck:=query_tiaojian(1,str_airtruck,'主提单号',wwDBComboBox39.text,Edit6.text); str_airtruck:=query_tiaojian(1,str_airtruck,'主提单号',wwDBComboBox40.text,Edit8.text); str_airtruck:=query_tiaojian(1,str_airtruck,'发货人代码',wwDBComboBox57.text,Edit10.text); str_railway:=query_tiaojian(1,str_railway,'主运单号',wwDBComboBox39.text,Edit6.text); str_railway:=query_tiaojian(1,str_railway,'主运单号',wwDBComboBox40.text,Edit8.text); str_railway:=query_tiaojian(1,str_railway,'发货人代码',wwDBComboBox57.text,Edit10.text); str_seai:=query_tiaojian(1,str_seai,'进口日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_seai:=query_tiaojian(1,str_seai,'进口日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_aire:=query_tiaojian(1,str_aire,'一程开航日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_aire:=query_tiaojian(1,str_aire,'一程开航日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_airi:=query_tiaojian(1,str_airi,'进口日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_airi:=query_tiaojian(1,str_airi,'进口日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_airtruck:=query_tiaojian(1,str_airtruck,'发车日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_airtruck:=query_tiaojian(1,str_airtruck,'发车日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_railway:=query_tiaojian(1,str_railway,'发车日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_railway:=query_tiaojian(1,str_railway,'发车日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_all:=query_tiaojian(1,str_all,'业务日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_all:=query_tiaojian(1,str_all,'业务日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_all:=query_tiaojian(1,str_all,'业务种类',wwDBComboBox5.text,wwDBComboBox8.text); str_seae:=query_tiaojian(1,str_seae,'开船日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_seae:=query_tiaojian(1,str_seae,'开船日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_seae:=query_tiaojian(1,str_seae,'t_op_seae.船名',wwDBComboBox36.text,wwDBLookupCombo49.text); str_seae:=query_tiaojian(1,str_seae,'t_op_seae.航次',wwDBComboBox35.text,Edit7.text); str_seae:=query_tiaojian(1,str_seae,'t_op_seae.船公司',wwDBComboBox22.text,RxDBLookupCombo5.DisplayValues[1]); str_seae:=query_tiaojian(1,str_seae,'t_op_seae.航线',wwDBComboBox20.text,RxDBLookupCombo20.DisplayValues[1]); str_seae:=query_tiaojian(1,str_seae,'t_op_seae.船公司',wwDBComboBox32.text,RxDBLookupCombo14.DisplayValues[1]); str_seae:=query_tiaojian(1,str_seae,'t_op_seae.货代公司',wwDBComboBox33.text,RxDBLookupCombo15.DisplayValues[1]); str_seae:=query_tiaojian(3,str_seae,'t_op_seae.是否退舱',wwDBComboBox52.text,wwDBComboBox53.text); str_seai:=query_tiaojian(1,str_seai,'t_op_seai.船名',wwDBComboBox36.text,wwDBLookupCombo49.text); str_seai:=query_tiaojian(1,str_seai,'t_op_seai.航次',wwDBComboBox35.text,Edit7.text); str_seai:=query_tiaojian(1,str_seai,'t_op_seai.船公司',wwDBComboBox22.text,RxDBLookupCombo5.DisplayValues[1]); str_seai:=query_tiaojian(1,str_seai,'t_op_seai.航线',wwDBComboBox20.text,RxDBLookupCombo20.DisplayValues[1]); str_seai:=query_tiaojian(1,str_seai,'t_op_seai.船公司',wwDBComboBox32.text,RxDBLookupCombo14.DisplayValues[1]); str_seai:=query_tiaojian(1,str_seai,'t_op_seai.货代公司',wwDBComboBox33.text,RxDBLookupCombo15.DisplayValues[1]); str_aire:=query_tiaojian(1,str_aire,'t_op_aire.一程航班',wwDBComboBox35.text,Edit7.text); str_aire:=query_tiaojian(1,str_aire,'t_op_aire.航空公司',wwDBComboBox22.text,RxDBLookupCombo5.DisplayValues[1]); str_aire:=query_tiaojian(1,str_aire,'t_op_aire.航线',wwDBComboBox23.text,RxDBLookupCombo7.DisplayValues[1]); str_aire:=query_tiaojian(1,str_aire,'t_op_aire.航空公司',wwDBComboBox32.text,RxDBLookupCombo14.DisplayValues[1]); str_aire:=query_tiaojian(1,str_aire,'t_op_aire.订舱代理',wwDBComboBox33.text,RxDBLookupCombo15.DisplayValues[1]); str_airi:=query_tiaojian(1,str_airi,'t_op_airi.航班号',wwDBComboBox35.text,Edit7.text); str_airi:=query_tiaojian(1,str_airi,'t_op_airi.航空公司',wwDBComboBox22.text,RxDBLookupCombo5.DisplayValues[1]); str_airi:=query_tiaojian(1,str_airi,'t_op_airi.航空公司',wwDBComboBox32.text,RxDBLookupCombo14.DisplayValues[1]); str_airi:=query_tiaojian(1,str_airi,'t_op_airi.卸货代理',wwDBComboBox33.text,RxDBLookupCombo15.DisplayValues[1]); str_airtruck:=query_tiaojian(1,str_airtruck,'t_op_airtruck.SA车号',wwDBComboBox35.text,Edit7.text); str_airtruck:=query_tiaojian(1,str_airtruck,'t_op_airtruck.BGS监管公司',wwDBComboBox22.text,RxDBLookupCombo5.DisplayValues[1]); str_airtruck:=query_tiaojian(1,str_airtruck,'t_op_airtruck.BGS监管公司',wwDBComboBox32.text,RxDBLookupCombo14.DisplayValues[1]); str_airtruck:=query_tiaojian(1,str_airtruck,'t_op_airtruck.BGS监管公司',wwDBComboBox33.text,RxDBLookupCombo15.DisplayValues[1]); str_airtruck:=query_tiaojian(1,str_airtruck,'t_op_airtruck.航线',wwDBComboBox23.text,RxDBLookupCombo7.DisplayValues[1]); str_railway:=query_tiaojian(1,str_railway,'t_op_railway.车号',wwDBComboBox35.text,Edit7.text); str_railway:=query_tiaojian(1,str_railway,'t_op_railway.承运人',wwDBComboBox22.text,RxDBLookupCombo5.DisplayValues[1]); str_railway:=query_tiaojian(1,str_railway,'接单日期',wwDBComboBox50.text,wwDBDateTimePicker9.text); str_railway:=query_tiaojian(1,str_railway,'接单日期',wwDBComboBox51.text,wwDBDateTimePicker10.text); str_sealocal:=query_tiaojian(1,str_sealocal,'开船日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_sealocal:=query_tiaojian(1,str_sealocal,'开船日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_sealocal:=query_tiaojian(1,str_sealocal,'主提单号',wwDBComboBox39.text,Edit6.text); str_sealocal:=query_tiaojian(1,str_sealocal,'主提单号',wwDBComboBox40.text,Edit8.text); str_sealocal:=query_tiaojian(1,str_sealocal,'箱型',wwDBComboBox59.text,StringReplace(RxDBLookupCombo22.DisplayValue,'''','''''',[rfReplaceAll])); str_sealocal:=query_tiaojian(1,str_sealocal,'委托单位',wwDBComboBox21.text,RxDBLookupCombo2.DisplayValues[1]); end else begin str_seai:=query_tiaojian(1,str_seae,'进口日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_seai:=query_tiaojian(1,str_seai,'进口日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_aire:=query_tiaojian(1,str_seae,'一程开航日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_aire:=query_tiaojian(1,str_aire,'一程开航日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_airi:=query_tiaojian(1,str_seae,'进口日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_airi:=query_tiaojian(1,str_airi,'进口日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_airtruck:=query_tiaojian(1,str_seae,'发车日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_airtruck:=query_tiaojian(1,str_airtruck,'发车日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_railway:=query_tiaojian(1,str_railway,'发车日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_railway:=query_tiaojian(1,str_railway,'发车日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_all:=query_tiaojian(1,str_seae,'业务日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_all:=query_tiaojian(1,str_all,'业务日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_all:=query_tiaojian(1,str_all,'业务种类',wwDBComboBox5.text,wwDBComboBox8.text); str_seae:=query_tiaojian(1,str_seae,'开船日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_seae:=query_tiaojian(1,str_seae,'开船日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_seae:=query_tiaojian(1,str_seae,'t_op_seae.船名',wwDBComboBox36.text,wwDBLookupCombo49.text); str_seae:=query_tiaojian(1,str_seae,'t_op_seae.航次',wwDBComboBox35.text,Edit7.text); str_seae:=query_tiaojian(1,str_seae,'t_op_seae.船公司',wwDBComboBox22.text,RxDBLookupCombo5.DisplayValues[1]); str_seae:=query_tiaojian(1,str_seae,'t_op_seae.航线',wwDBComboBox20.text,RxDBLookupCombo20.DisplayValues[1]); str_seae:=query_tiaojian(1,str_seae,'t_op_seae.船公司',wwDBComboBox32.text,RxDBLookupCombo14.DisplayValues[1]); str_seae:=query_tiaojian(1,str_seae,'t_op_seae.货代公司',wwDBComboBox33.text,RxDBLookupCombo15.DisplayValues[1]); str_seae:=query_tiaojian(1,str_seae,'运费确认人',wwDBComboBox48.text,RxDBLookupCombo18.DisplayValue); str_seai:=query_tiaojian(1,str_seai,'t_op_seai.船名',wwDBComboBox36.text,wwDBLookupCombo49.text); str_seai:=query_tiaojian(1,str_seai,'t_op_seai.航次',wwDBComboBox35.text,Edit7.text); str_seai:=query_tiaojian(1,str_seai,'t_op_seai.船公司',wwDBComboBox22.text,RxDBLookupCombo5.DisplayValues[1]); str_seai:=query_tiaojian(1,str_seai,'t_op_seai.航线',wwDBComboBox20.text,RxDBLookupCombo20.DisplayValues[1]); str_seai:=query_tiaojian(1,str_seai,'t_op_seai.船公司',wwDBComboBox32.text,RxDBLookupCombo14.DisplayValues[1]); str_seai:=query_tiaojian(1,str_seai,'t_op_seai.货代公司',wwDBComboBox33.text,RxDBLookupCombo15.DisplayValues[1]); str_aire:=query_tiaojian(1,str_aire,'t_op_aire.一程航班',wwDBComboBox35.text,Edit7.text); str_aire:=query_tiaojian(1,str_aire,'t_op_aire.航空公司',wwDBComboBox22.text,RxDBLookupCombo5.DisplayValues[1]); str_aire:=query_tiaojian(1,str_aire,'t_op_aire.航线',wwDBComboBox23.text,RxDBLookupCombo7.DisplayValues[1]); str_aire:=query_tiaojian(1,str_aire,'t_op_aire.航空公司',wwDBComboBox32.text,RxDBLookupCombo14.DisplayValues[1]); str_aire:=query_tiaojian(1,str_aire,'t_op_aire.订舱代理',wwDBComboBox33.text,RxDBLookupCombo15.DisplayValues[1]); str_airi:=query_tiaojian(1,str_airi,'t_op_airi.航班号',wwDBComboBox35.text,Edit7.text); str_airi:=query_tiaojian(1,str_airi,'t_op_airi.航空公司',wwDBComboBox22.text,RxDBLookupCombo5.DisplayValues[1]); str_airi:=query_tiaojian(1,str_airi,'t_op_airi.航空公司',wwDBComboBox32.text,RxDBLookupCombo14.DisplayValues[1]); str_airi:=query_tiaojian(1,str_airi,'t_op_airi.卸货代理',wwDBComboBox33.text,RxDBLookupCombo15.DisplayValues[1]); str_airtruck:=query_tiaojian(1,str_airtruck,'t_op_airtruck.SA车号',wwDBComboBox35.text,Edit7.text); str_airtruck:=query_tiaojian(1,str_airtruck,'t_op_airtruck.BGS监管公司',wwDBComboBox22.text,RxDBLookupCombo5.DisplayValues[1]); str_airtruck:=query_tiaojian(1,str_airtruck,'t_op_airtruck.BGS监管公司',wwDBComboBox32.text,RxDBLookupCombo14.DisplayValues[1]); str_airtruck:=query_tiaojian(1,str_airtruck,'t_op_airtruck.BGS监管公司',wwDBComboBox33.text,RxDBLookupCombo15.DisplayValues[1]); str_airtruck:=query_tiaojian(1,str_airtruck,'t_op_airtruck.航线',wwDBComboBox23.text,RxDBLookupCombo7.DisplayValues[1]); str_airtruck:=query_tiaojian(1,str_airtruck,'t_op_airtruck.联系人',wwDBComboBox60.text,Edit11.text); str_airtruck:=query_tiaojian(1,str_airtruck,'t_op_airtruck.HY司机',wwDBComboBox61.text,Edit12.text); str_railway:=query_tiaojian(1,str_railway,'t_op_railway.车号',wwDBComboBox35.text,Edit7.text); str_railway:=query_tiaojian(1,str_railway,'t_op_railway.承运人',wwDBComboBox22.text,RxDBLookupCombo5.DisplayValues[1]); str_railway:=query_tiaojian(1,str_railway,'接单日期',wwDBComboBox50.text,wwDBDateTimePicker9.text); str_railway:=query_tiaojian(1,str_railway,'接单日期',wwDBComboBox51.text,wwDBDateTimePicker10.text); str_sealocal:=query_tiaojian(1,str_sealocal,'开船日期',wwDBComboBox18.text,wwDBDateTimePicker1.text); str_sealocal:=query_tiaojian(1,str_sealocal,'开船日期',wwDBComboBox6.text,wwDBDateTimePicker2.text); str_sealocal:=query_tiaojian(1,str_sealocal,'主提单号',wwDBComboBox39.text,Edit6.text); str_sealocal:=query_tiaojian(1,str_sealocal,'主提单号',wwDBComboBox40.text,Edit8.text); str_sealocal:=query_tiaojian(1,str_sealocal,'委托单位',wwDBComboBox21.text,RxDBLookupCombo2.DisplayValues[1]); if str_seai='' then str_seai:=' where 1=1 '; if str_seae='' then str_seae:=' where 1=1 '; if str_aire='' then str_aire:=' where 1=1 '; if str_airi='' then str_airi:=' where 1=1 '; if str_airtruck='' then str_airtruck:=' where 1=1 '; end; if rp_query_bs=2 then if wwDBComboBox42.text='是' then begin if str_seae='' then str_seae:=' where t_op_seae.编号 in (select 编号 from t_ch_fee where 是否垫付=1)' else str_seae:=str_seae+' and t_op_seae.编号 in (select 编号 from t_ch_fee where 是否垫付=1)'; if str_seai='' then str_seai:=' where t_op_seai.编号 in (select 编号 from t_ch_fee where 是否垫付=1)' else str_seai:=str_seai+' and t_op_seai.编号 in (select 编号 from t_ch_fee where 是否垫付=1)'; end else if wwDBComboBox42.text='否' then begin if str_seae='' then str_seae:=' where t_op_seae.编号 in (select 编号 from t_ch_fee where 是否垫付=0 or 是否垫付 is null )' else str_seae:=str_seae+' and t_op_seae.编号 in (select 编号 from t_ch_fee where 是否垫付=0 or 是否垫付 is null )'; if str_seai='' then str_seai:=' where t_op_seai.编号 in (select 编号 from t_ch_fee where 是否垫付=0 or 是否垫付 is null )' else str_seai:=str_seai+' and t_op_seai.编号 in (select 编号 from t_ch_fee where 是否垫付=0 or 是否垫付 is null )'; end; if trim(wwDBComboBox54.Text)<>'' then begin if str_seae='' then begin if wwDBComboBox54.Text='票结' then str_seae:=' where t_op_seae.委托单位 not in (select 客户简称 from t_crm_client_sales where 结费类型 in (''约定天数'',''约定时间''))' else if wwDBComboBox54.Text='月结' then str_seae:=' where t_op_seae.委托单位 in (select 客户简称 from t_crm_client_sales where 结费类型 in (''约定天数'',''约定时间''))' end else begin if wwDBComboBox54.Text='票结' then str_seae:=str_seae+' and t_op_seae.委托单位 not in (select 客户简称 from t_crm_client_sales where 结费类型 in (''约定天数'',''约定时间''))' else if wwDBComboBox54.Text='月结' then str_seae:=str_seae+' and t_op_seae.委托单位 in (select 客户简称 from t_crm_client_sales where 结费类型 in (''约定天数'',''约定时间''))' end; end; if wwDBComboBox53.ItemIndex=1 then begin str_seai:=str_seai+' and 1=2 '; str_aire:=str_aire+' and 1=2 '; str_airi:=str_airi+' and 1=2 '; str_airtruck:=str_airtruck+' and 1=2 '; str_railway:=str_railway+' and 1=2 '; end; if (wwDBComboBox5.text<>'') and (wwDBComboBox8.text<>'') then begin if wwDBComboBox5.text='等于' then begin if wwDBComboBox8.text='海运出口' then begin str_seai:=str_seai+' and 1=2 '; str_aire:=str_aire+' and 1=2 '; str_airi:=str_airi+' and 1=2 '; str_airtruck:=str_airtruck+' and 1=2 '; str_railway:=str_railway+' and 1=2 '; end; if wwDBComboBox8.text='海运进口' then begin str_seae:=str_seae+' and 1=2 '; str_aire:=str_aire+' and 1=2 '; str_airi:=str_airi+' and 1=2 '; str_airtruck:=str_airtruck+' and 1=2 '; str_railway:=str_railway+' and 1=2 '; end; if wwDBComboBox8.text='空运出口' then begin str_seai:=str_seai+' and 1=2 '; str_seae:=str_seae+' and 1=2 '; str_airi:=str_airi+' and 1=2 '; str_airtruck:=str_airtruck+' and 1=2 '; str_railway:=str_railway+' and 1=2 '; end; if wwDBComboBox8.text='空运进口' then begin str_seai:=str_seai+' and 1=2 '; str_aire:=str_aire+' and 1=2 '; str_seae:=str_seae+' and 1=2 '; str_airtruck:=str_airtruck+' and 1=2 '; str_railway:=str_railway+' and 1=2 '; end; if wwDBComboBox8.text='监管车' then begin str_seai:=str_seai+' and 1=2 '; str_aire:=str_aire+' and 1=2 '; str_airi:=str_airi+' and 1=2 '; str_seae:=str_seae+' and 1=2 '; str_railway:=str_railway+' and 1=2 '; end; if wwDBComboBox8.text='铁路运输' then begin str_seai:=str_seai+' and 1=2 '; str_aire:=str_aire+' and 1=2 '; str_airi:=str_airi+' and 1=2 '; str_seae:=str_seae+' and 1=2 '; str_airtruck:=str_airtruck+' and 1=2 '; end; end; if wwDBComboBox5.text='不等于' then begin if wwDBComboBox8.text='海运出口' then begin str_seae:=str_seae+' and 1=2 '; end; if wwDBComboBox8.text='海运进口' then begin str_seai:=str_seai+' and 1=2 '; end; if wwDBComboBox8.text='空运出口' then begin str_aire:=str_aire+' and 1=2 '; end; if wwDBComboBox8.text='空运进口' then begin str_airi:=str_airi+' and 1=2 '; end; if wwDBComboBox8.text='监管车' then begin str_airtruck:=str_airtruck+' and 1=2 '; end; if wwDBComboBox8.text='铁路运输' then begin str_railway:=str_railway+' and 1=2 '; end; end; end; case rp_query_bs of 1: begin condition_1; end; 2,5: begin condition_2_5; end; 12: begin condition_12; end; 22: begin str_seae:='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.利润率' +',t_op_gain_main.应收OT,t_op_gain_main.应付OT,t_op_gain_main.利润OT' +',t_op_gain_main.不含税应收USD,t_op_gain_main.不含税应付USD,t_op_gain_main.不含税利润USD,' +'t_op_gain_main.不含税应收RMB,t_op_gain_main.不含税应付RMB,t_op_gain_main.不含税利润RMB,' +'t_op_gain_main.不含税合计应收,t_op_gain_main.不含税合计应付,t_op_gain_main.不含税毛利润,' +'t_op_gain_main.不含税应收OT,t_op_gain_main.不含税应付OT,t_op_gain_main.不含税利润OT,' +'t_op_gain_main.不含税垫付费用,t_op_gain_main.不含税利润率' +',t_op_gain_main.财务不含税应收USD,t_op_gain_main.财务不含税应付USD,t_op_gain_main.财务不含税利润USD,' +'t_op_gain_main.财务不含税应收RMB,t_op_gain_main.财务不含税应付RMB,t_op_gain_main.财务不含税利润RMB,' +'t_op_gain_main.财务不含税合计应收,t_op_gain_main.财务不含税合计应付,t_op_gain_main.财务不含税毛利润,' +'t_op_gain_main.财务不含税应收OT,t_op_gain_main.财务不含税应付OT,t_op_gain_main.财务不含税利润OT,' +'t_op_gain_main.财务不含税垫付费用,t_op_gain_main.财务不含税利润率,' +'t_op_gain_main.财务应收USD税额,t_op_gain_main.应付USD税额,' +'t_op_gain_main.财务应收RMB税额,t_op_gain_main.财务应付RMB税额,' +'t_op_gain_main.财务合计应收税额,t_op_gain_main.财务合计应付税额' +' FROM t_op_seae left JOIN t_op_gain t_op_gain_main ON t_op_seae.编号 = t_op_gain_main.编号 ' +str_seae+' and t_op_seae.编号=t_op_seae.编号'+default_sort(53,'t_op_seae','','desc'); // +str_seae+' and t_op_seae.编号=t_op_seae.主编号'+default_sort(53,'t_op_seae','','desc'); // ShowMessage(str_seae); str_seai:='SELECT t_op_seai.*, 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.利润率' +',t_op_gain.应收OT,t_op_gain.应付OT,t_op_gain.利润OT' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_seai left JOIN t_op_gain ON t_op_seai.编号 = t_op_gain.编号 ' +str_seai+default_sort(54,'t_op_seai','','desc'); str_aire:='SELECT t_op_aire.*, 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.利润率' +',t_op_gain.应收OT,t_op_gain.应付OT,t_op_gain.利润OT' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_aire left JOIN t_op_gain ON t_op_aire.编号 = t_op_gain.编号 ' +str_aire+default_sort(55,'t_op_aire','','desc'); str_airi:='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.利润率' +',t_op_gain.应收OT,t_op_gain.应付OT,t_op_gain.利润OT' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,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_airi+default_sort(56,'t_op_airi','','desc'); str_airtruck:='SELECT t_op_airtruck.*, 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.利润率' +',t_op_gain.应收OT,t_op_gain.应付OT,t_op_gain.利润OT' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_airtruck left JOIN t_op_gain ON t_op_airtruck.编号 = t_op_gain.编号 ' +str_airtruck; str_railway:='SELECT t_op_railway.*, 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.利润率' +',t_op_gain.应收OT,t_op_gain.应付OT,t_op_gain.利润OT' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_railway left JOIN t_op_gain ON t_op_railway.编号 = t_op_gain.编号 ' +str_railway; end; end; case rp_query_bs of {$IFDEF YWTAIZHANG} 1: begin constr:=connect_string('main.ini'); frm_rp_tai_total.p_query_seae.ConnectionString:=constr; DBQueryThread1:=TDBQueryThread.Create(frm_rp_tai_total.p_query_seae,str_seae,frm_rp_tai_total.p_query_seae1); // showmessage(str_seae); frm_rp_tai_total.p_query_seai.ConnectionString:=constr; DBQueryThread2:=TDBQueryThread.Create(frm_rp_tai_total.p_query_seai,str_seai,frm_rp_tai_total.p_query_seai1); frm_rp_tai_total.p_query_aire.ConnectionString:=constr; DBQueryThread3:=TDBQueryThread.Create(frm_rp_tai_total.p_query_aire,str_aire,frm_rp_tai_total.p_query_aire1); frm_rp_tai_total.p_query_airi.ConnectionString:=constr; DBQueryThread4:=TDBQueryThread.Create(frm_rp_tai_total.p_query_airi,str_airi,frm_rp_tai_total.p_query_airi1); frm_rp_tai_total.p_query_airtruck.ConnectionString:=constr; DBQueryThread5:=TDBQueryThread.Create(frm_rp_tai_total.p_query_airtruck,str_airtruck,frm_rp_tai_total.p_query_airtruck1); frm_rp_tai_total.p_query_railway.ConnectionString:=constr; DBQueryThread6:=TDBQueryThread.Create(frm_rp_tai_total.p_query_railway,str_railway,frm_rp_tai_total.p_query_railway1); frm_rp_tai_total.p_query_sealocal.ConnectionString:=constr; DBQueryThread7:=TDBQueryThread.Create(frm_rp_tai_total.p_query_sealocal,str_sealocal,frm_rp_tai_total.p_query_sealocal1); frm_rp_tai_total.p_query_total.close; frm_rp_tai_total.p_query_total.Parameters.ParamByName('SQLStr').value:=str_total; frm_rp_tai_total.p_query_total.Open; // frm_rp_tai_total.p_query_total.ConnectionString:=constr; // DBQueryThread6:=TDBQueryThread.Create(frm_rp_tai_total.p_query_total,str_total,frm_rp_tai_total.p_query_total1); { frm_rp_tai_total.p_query_seae.close; frm_rp_tai_total.p_query_seae.Parameters.ParamByName('SQLStr').value:=str_seae; frm_rp_tai_total.p_query_seae.Open; frm_rp_tai_total.p_query_seai.close; frm_rp_tai_total.p_query_seai.Parameters.ParamByName('SQLStr').value:=str_seai; frm_rp_tai_total.p_query_seai.Open; frm_rp_tai_total.p_query_aire.close; frm_rp_tai_total.p_query_aire.Parameters.ParamByName('SQLStr').value:=str_aire; frm_rp_tai_total.p_query_aire.Open; frm_rp_tai_total.p_query_airi.close; frm_rp_tai_total.p_query_airi.Parameters.ParamByName('SQLStr').value:=str_airi; frm_rp_tai_total.p_query_airi.Open; frm_rp_tai_total.p_query_airtruck.close; frm_rp_tai_total.p_query_airtruck.Parameters.ParamByName('SQLStr').value:=str_airtruck; frm_rp_tai_total.p_query_airtruck.Open; frm_rp_tai_total.p_query_total.close; frm_rp_tai_total.p_query_total.Parameters.ParamByName('SQLStr').value:=str_total; frm_rp_tai_total.p_query_total.Open; } end; {$ENDIF} 2: begin constr:=connect_string('main.ini'); frm_rp_rp_total.p_seae.ConnectionString:=constr; DBQueryThread1:=TDBQueryThread.Create(frm_rp_rp_total.p_seae,str_seae,frm_rp_rp_total.p_seae1); frm_rp_rp_total.p_seai.ConnectionString:=constr; DBQueryThread2:=TDBQueryThread.Create(frm_rp_rp_total.p_seai,str_seai,frm_rp_rp_total.p_seai1); // showmessage('1'); frm_rp_rp_total.p_aire.ConnectionString:=constr; DBQueryThread3:=TDBQueryThread.Create(frm_rp_rp_total.p_aire,str_aire,frm_rp_rp_total.p_aire1); frm_rp_rp_total.p_airi.ConnectionString:=constr; DBQueryThread4:=TDBQueryThread.Create(frm_rp_rp_total.p_airi,str_airi,frm_rp_rp_total.p_airi1); frm_rp_rp_total.p_airtruck.ConnectionString:=constr; DBQueryThread5:=TDBQueryThread.Create(frm_rp_rp_total.p_airtruck,str_airtruck,frm_rp_rp_total.p_airtruck1); frm_rp_rp_total.p_railway.ConnectionString:=constr; DBQueryThread6:=TDBQueryThread.Create(frm_rp_rp_total.p_railway,str_railway,frm_rp_rp_total.p_railway1); { frm_rp_rp_total.p_seae.close; frm_rp_rp_total.p_seae.Parameters.ParamByName('SQLStr').value:=str_seae; frm_rp_rp_total.p_seae.Open; } { repeat H:=DBQueryThread1.handle; W := MsgWaitForMultipleObjects(1, H, False, INFINITE, QS_ALLINPUT); Application.ProcessMessages; until (W = WAIT_OBJECT_0) or (W = WAIT_FAILED); } { frm_rp_rp_total.p_seae.close; frm_rp_rp_total.p_seae.Parameters.ParamByName('SQLStr').value:=str_seae; frm_rp_rp_total.p_seae.Open; frm_rp_rp_total.p_seai.close; frm_rp_rp_total.p_seai.Parameters.ParamByName('SQLStr').value:=str_seai; frm_rp_rp_total.p_seai.Open; frm_rp_rp_total.p_aire.close; frm_rp_rp_total.p_aire.Parameters.ParamByName('SQLStr').value:=str_aire; frm_rp_rp_total.p_aire.Open; frm_rp_rp_total.p_airi.close; frm_rp_rp_total.p_airi.Parameters.ParamByName('SQLStr').value:=str_airi; frm_rp_rp_total.p_airi.Open; frm_rp_rp_total.p_airtruck.close; frm_rp_rp_total.p_airtruck.Parameters.ParamByName('SQLStr').value:=str_airtruck; frm_rp_rp_total.p_airtruck.Open; } end; 12: begin constr:=connect_string('main.ini'); frm_rp_pin_total.p_seae.ConnectionString:=constr; DBQueryThread1:=TDBQueryThread.Create(frm_rp_pin_total.p_seae,str_seae,frm_rp_pin_total.p_seae1); frm_rp_pin_total.p_seae_pin.ConnectionString:=constr; DBQueryThread6:=TDBQueryThread.Create(frm_rp_pin_total.p_seae_pin,str_seae_pin,frm_rp_pin_total.p_seae_pin1); frm_rp_pin_total.p_seai.ConnectionString:=constr; DBQueryThread2:=TDBQueryThread.Create(frm_rp_pin_total.p_seai,str_seai,frm_rp_pin_total.p_seai1); frm_rp_pin_total.p_seai_pin.ConnectionString:=constr; DBQueryThread2:=TDBQueryThread.Create(frm_rp_pin_total.p_seai_pin,str_seai_pin,frm_rp_pin_total.p_seai_pin1); frm_rp_pin_total.p_aire.ConnectionString:=constr; DBQueryThread3:=TDBQueryThread.Create(frm_rp_pin_total.p_aire,str_aire,frm_rp_pin_total.p_aire1); frm_rp_pin_total.p_aire_pin.ConnectionString:=constr; DBQueryThread3:=TDBQueryThread.Create(frm_rp_pin_total.p_aire_pin,str_aire_pin,frm_rp_pin_total.p_aire_pin1); frm_rp_pin_total.p_airi.ConnectionString:=constr; DBQueryThread4:=TDBQueryThread.Create(frm_rp_pin_total.p_airi,str_airi,frm_rp_pin_total.p_airi1); frm_rp_pin_total.p_airi_pin.ConnectionString:=constr; DBQueryThread4:=TDBQueryThread.Create(frm_rp_pin_total.p_airi_pin,str_airi_pin,frm_rp_pin_total.p_airi_pin1); frm_rp_pin_total.p_airtruck.ConnectionString:=constr; DBQueryThread5:=TDBQueryThread.Create(frm_rp_pin_total.p_airtruck,str_airtruck,frm_rp_pin_total.p_airtruck1); repeat H:=DBQueryThread1.handle; W := MsgWaitForMultipleObjects(1, H, False, INFINITE, QS_ALLINPUT); Application.ProcessMessages; until (W = WAIT_OBJECT_0) or (W = WAIT_FAILED); end; {$IFDEF ZHYDTONGJI} 22: begin constr:=connect_string('main.ini'); // frm_rp_rp_monthtotal.p_seae.ConnectionString:=constr; // DBQueryThread1:=TDBQueryThread.Create(frm_rp_rp_monthtotal.p_seae,str_seae,frm_rp_rp_monthtotal.p_seae1); frm_rp_rp_monthtotal.p_seai.ConnectionString:=constr; DBQueryThread2:=TDBQueryThread.Create(frm_rp_rp_monthtotal.p_seai,str_seai,frm_rp_rp_monthtotal.p_seai1); frm_rp_rp_monthtotal.p_aire.ConnectionString:=constr; // showmessage(str_aire); DBQueryThread3:=TDBQueryThread.Create(frm_rp_rp_monthtotal.p_aire,str_aire,frm_rp_rp_monthtotal.p_aire1); frm_rp_rp_monthtotal.p_airi.ConnectionString:=constr; DBQueryThread4:=TDBQueryThread.Create(frm_rp_rp_monthtotal.p_airi,str_airi,frm_rp_rp_monthtotal.p_airi1); frm_rp_rp_monthtotal.p_airtruck.ConnectionString:=constr; DBQueryThread5:=TDBQueryThread.Create(frm_rp_rp_monthtotal.p_airtruck,str_airtruck,frm_rp_rp_monthtotal.p_airtruck1); frm_rp_rp_monthtotal.p_railway.ConnectionString:=constr; DBQueryThread6:=TDBQueryThread.Create(frm_rp_rp_monthtotal.p_railway,str_railway,frm_rp_rp_monthtotal.p_railway1); frm_rp_rp_monthtotal.p_seae.close; frm_rp_rp_monthtotal.p_seae.Parameters.ParamByName('SQLStr').value:=str_seae; frm_rp_rp_monthtotal.p_seae.Open; { repeat H:=DBQueryThread1.handle; W := MsgWaitForMultipleObjects(1, H, False, INFINITE, QS_ALLINPUT); Application.ProcessMessages; until (W = WAIT_OBJECT_0) or (W = WAIT_FAILED); } { frm_rp_rp_monthtotal.p_seae.close; frm_rp_rp_monthtotal.p_seae.Parameters.ParamByName('SQLStr').value:=str_seae; frm_rp_rp_monthtotal.p_seae.Open; frm_rp_rp_monthtotal.p_seai.close; frm_rp_rp_monthtotal.p_seai.Parameters.ParamByName('SQLStr').value:=str_seai; frm_rp_rp_monthtotal.p_seai.Open; frm_rp_rp_monthtotal.p_aire.close; frm_rp_rp_monthtotal.p_aire.Parameters.ParamByName('SQLStr').value:=str_aire; frm_rp_rp_monthtotal.p_aire.Open; frm_rp_rp_monthtotal.p_airi.close; frm_rp_rp_monthtotal.p_airi.Parameters.ParamByName('SQLStr').value:=str_airi; frm_rp_rp_monthtotal.p_airi.Open; frm_rp_rp_monthtotal.p_airtruck.close; frm_rp_rp_monthtotal.p_airtruck.Parameters.ParamByName('SQLStr').value:=str_airtruck; frm_rp_rp_monthtotal.p_airtruck.Open; } end; {$ENDIF} 3: begin frm_rp_zou_total.p_seae.close; if frm_rp_zou_total.bsSkinCheckRadioBox2.checked then begin frm_rp_zou_total.p_seae.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),t_op_seae.开船日期,111),1,7) AS 月份,' +'SUM(dbo.t_op_gain_main.毛利润) AS 毛利润 FROM t_op_seae inner JOIN t_op_gain_main' +' ON t_op_seae.编号 =t_op_gain_main.编号 ' +str_seae +' GROUP BY SUBSTRING(CONVERT(char(15),开船日期,111),1,7)' +' order by SUBSTRING(CONVERT(char(15),开船日期, 111), 1, 7)'; end else begin frm_rp_zou_total.p_seae.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),t_op_seae.会计期间,111),1,7) AS 月份,' +'SUM(dbo.t_op_gain_main.毛利润) AS 毛利润 FROM t_op_seae inner JOIN t_op_gain_main' +' ON t_op_seae.编号 =t_op_gain_main.编号 ' +str_seae +' GROUP BY SUBSTRING(CONVERT(char(15),会计期间,111),1,7)' +' order by SUBSTRING(CONVERT(char(15),会计期间, 111), 1, 7)'; end; frm_rp_zou_total.p_seae.Open; frm_rp_zou_total.p_seai.close; if frm_rp_zou_total.bsSkinCheckRadioBox2.checked then begin frm_rp_zou_total.p_seai.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),t_op_seai.进口日期,111),1,7) AS 月份,' +'SUM(dbo.t_op_gain.毛利润) AS 毛利润 FROM t_op_seai left JOIN t_op_gain' +' ON t_op_seai.编号 =t_op_gain.编号 ' +str_seai +' GROUP BY SUBSTRING(CONVERT(char(15),进口日期,111),1,7)' +' order by SUBSTRING(CONVERT(char(15),进口日期, 111), 1, 7)'; end else begin frm_rp_zou_total.p_seai.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),t_op_seai.会计期间,111),1,7) AS 月份,' +'SUM(dbo.t_op_gain.毛利润) AS 毛利润 FROM t_op_seai left JOIN t_op_gain' +' ON t_op_seai.编号 =t_op_gain.编号 ' +str_seai +' GROUP BY SUBSTRING(CONVERT(char(15),会计期间,111),1,7)' +' order by SUBSTRING(CONVERT(char(15),会计期间, 111), 1, 7)'; end; frm_rp_zou_total.p_seai.Open; frm_rp_zou_total.p_aire.close; if frm_rp_zou_total.bsSkinCheckRadioBox2.checked then begin frm_rp_zou_total.p_aire.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),t_op_aire.一程开航日期,111),1,7) AS 月份,' +'SUM(dbo.t_op_gain.毛利润) AS 毛利润 FROM t_op_aire left JOIN t_op_gain' +' ON t_op_aire.编号 =t_op_gain.编号 ' +str_aire +' GROUP BY SUBSTRING(CONVERT(char(15),一程开航日期,111),1,7)' +' order by SUBSTRING(CONVERT(char(15),一程开航日期, 111), 1, 7)'; end else begin frm_rp_zou_total.p_aire.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),t_op_aire.会计期间,111),1,7) AS 月份,' +'SUM(dbo.t_op_gain.毛利润) AS 毛利润 FROM t_op_aire left JOIN t_op_gain' +' ON t_op_aire.编号 =t_op_gain.编号 ' +str_aire +' GROUP BY SUBSTRING(CONVERT(char(15),会计期间,111),1,7)' +' order by SUBSTRING(CONVERT(char(15),会计期间, 111), 1, 7)'; end; frm_rp_zou_total.p_aire.Open; frm_rp_zou_total.p_airi.close; if frm_rp_zou_total.bsSkinCheckRadioBox2.checked then begin frm_rp_zou_total.p_airi.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),t_op_airi.进口日期,111),1,7) AS 月份,' +'SUM(dbo.t_op_gain.毛利润) AS 毛利润 FROM t_op_airi left JOIN t_op_gain' +' ON t_op_airi.编号 =t_op_gain.编号 ' +str_airi +' GROUP BY SUBSTRING(CONVERT(char(15),进口日期,111),1,7)' +' order by SUBSTRING(CONVERT(char(15),进口日期, 111), 1, 7)'; end else begin frm_rp_zou_total.p_airi.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),t_op_airi.会计期间,111),1,7) AS 月份,' +'SUM(dbo.t_op_gain.毛利润) AS 毛利润 FROM t_op_airi left JOIN t_op_gain' +' ON t_op_airi.编号 =t_op_gain.编号 ' +str_airi +' GROUP BY SUBSTRING(CONVERT(char(15),会计期间,111),1,7)' +' order by SUBSTRING(CONVERT(char(15),会计期间, 111), 1, 7)'; end; frm_rp_zou_total.p_airi.Open; frm_rp_zou_total.p_airtruck.close; if frm_rp_zou_total.bsSkinCheckRadioBox2.checked then begin frm_rp_zou_total.p_airtruck.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),t_op_airtruck.发车日期,111),1,7) AS 月份,' +'SUM(dbo.t_op_gain.毛利润) AS 毛利润 FROM t_op_airtruck left JOIN t_op_gain' +' ON t_op_airtruck.编号 =t_op_gain.编号 ' +str_airtruck +' GROUP BY SUBSTRING(CONVERT(char(15),发车日期,111),1,7)' +' order by SUBSTRING(CONVERT(char(15),发车日期, 111), 1, 7)'; end else begin frm_rp_zou_total.p_airtruck.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),t_op_airtruck.会计期间,111),1,7) AS 月份,' +'SUM(dbo.t_op_gain.毛利润) AS 毛利润 FROM t_op_airtruck left JOIN t_op_gain' +' ON t_op_airtruck.编号 =t_op_gain.编号 ' +str_airtruck +' GROUP BY SUBSTRING(CONVERT(char(15),会计期间,111),1,7)' +' order by SUBSTRING(CONVERT(char(15),会计期间, 111), 1, 7)'; end; frm_rp_zou_total.p_airtruck.Open; frm_rp_zou_total.p_railway.close; if frm_rp_zou_total.bsSkinCheckRadioBox2.checked then begin frm_rp_zou_total.p_railway.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),t_op_railway.发车日期,111),1,7) AS 月份,' +'SUM(dbo.t_op_gain.毛利润) AS 毛利润 FROM t_op_railway left JOIN t_op_gain' +' ON t_op_railway.编号 =t_op_gain.编号 ' +str_railway +' GROUP BY SUBSTRING(CONVERT(char(15),发车日期,111),1,7)' +' order by SUBSTRING(CONVERT(char(15),发车日期, 111), 1, 7)'; end else begin frm_rp_zou_total.p_railway.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),t_op_railway.会计期间,111),1,7) AS 月份,' +'SUM(dbo.t_op_gain.毛利润) AS 毛利润 FROM t_op_railway left JOIN t_op_gain' +' ON t_op_railway.编号 =t_op_gain.编号 ' +str_railway +' GROUP BY SUBSTRING(CONVERT(char(15),会计期间,111),1,7)' +' order by SUBSTRING(CONVERT(char(15),会计期间, 111), 1, 7)'; end; frm_rp_zou_total.p_railway.Open; frm_rp_zou_total.p_total.close; if frm_rp_zou_total.bsSkinCheckRadioBox2.checked then begin frm_rp_zou_total.p_total.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),v_op_no.业务日期,111),1,7) AS 月份,' +'SUM(dbo.t_op_gain.毛利润) AS 毛利润 FROM v_op_no left JOIN t_op_gain' +' ON v_op_no.编号 =t_op_gain.编号 ' +str_all +' GROUP BY SUBSTRING(CONVERT(char(15),业务日期,111),1,7)' +' order by SUBSTRING(CONVERT(char(15),业务日期, 111), 1, 7)'; end else begin frm_rp_zou_total.p_total.Parameters.ParamByName('SQLStr').value:= 'SELECT SUBSTRING(CONVERT(char(15),v_op_no.会计期间,111),1,7) AS 月份,' +'SUM(dbo.t_op_gain.毛利润) AS 毛利润 FROM v_op_no left JOIN t_op_gain' +' ON v_op_no.编号 =t_op_gain.编号 ' +str_all +' GROUP BY SUBSTRING(CONVERT(char(15),会计期间,111),1,7)' +' order by SUBSTRING(CONVERT(char(15),会计期间, 111), 1, 7)'; end; frm_rp_zou_total.p_total.Open; end; 4: begin fen_total_str:=str_all; end; {$IFDEF ZHYDTONGJI} 5: begin frm_rp_rp_monthtotal.p_seae.close; frm_rp_rp_monthtotal.p_seae.Parameters.ParamByName('SQLStr').value:=str_seae; frm_rp_rp_monthtotal.p_seae.Open; frm_rp_rp_monthtotal.p_seai.close; frm_rp_rp_monthtotal.p_seai.Parameters.ParamByName('SQLStr').value:=str_seai; frm_rp_rp_monthtotal.p_seai.Open; frm_rp_rp_monthtotal.p_aire.close; frm_rp_rp_monthtotal.p_aire.Parameters.ParamByName('SQLStr').value:=str_aire; frm_rp_rp_monthtotal.p_aire.Open; frm_rp_rp_monthtotal.p_airi.close; frm_rp_rp_monthtotal.p_airi.Parameters.ParamByName('SQLStr').value:=str_airi; frm_rp_rp_monthtotal.p_airi.Open; frm_rp_rp_monthtotal.p_airtruck.close; frm_rp_rp_monthtotal.p_airtruck.Parameters.ParamByName('SQLStr').value:=str_airtruck; frm_rp_rp_monthtotal.p_airtruck.Open; end; {$ENDIF} end; close; end; procedure Tfrm_rp_query.wwDBComboBox17KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; frm_rp_query.bsSkinButton1Click(Sender); end; end; procedure Tfrm_rp_query.loadFindIni; var findini:tinifile ; mysec,tmpname:string; canload:boolean ; //是否记忆 i:integer ; begin mysec:=inttostr(rp_query_bs) ; findini:=Tinifile.Create(ExtractFilePath(application.ExeName)+'rpquery.ini'); try canload:=findini.ReadBool(mysec,mysec,false); bsSkinCheckRadioBox1.Checked:=canload ; if canload then begin with frm_rp_query 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,'') else if Controls[i] is TwwDBLookupCombo then (Controls[i] as TwwDBLookupCombo).Value:=findini.ReadString(mysec,TmpName,'') end ; end else begin end ; finally findini.free; end ; end; procedure Tfrm_rp_query.writeFindIni; var findini:tinifile ; mysec,tmpname:string; canload:boolean ; //是否记忆 i:integer ; begin canload:=bsSkinCheckRadioBox1.Checked ; mysec:=inttostr(rp_query_bs) ; findini:=Tinifile.Create(ExtractFilePath(application.ExeName)+'rpquery.ini'); try findini.WriteBool(mysec,mysec,canload); if canload then begin with frm_rp_query 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) else if Controls[i] is TwwDBLookupCombo then findini.writeString(mysec,TmpName,(Controls[i] as TwwDBLookupCombo).Value) ; end ; end ; finally findini.free; end ; end; procedure Tfrm_rp_query.condition_12; begin str_seae_pin:=str_seae; str_seai_pin:=str_seai; str_aire_pin:=str_aire; str_airi_pin:=str_airi; str_seae:='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.应收OT,t_op_gain_main.应付OT,t_op_gain_main.已收OT,t_op_gain_main.已付OT,t_op_gain_main.利润OT,' +' t_op_gain_main.利润USD, t_op_gain_main.利润RMB, t_op_gain_main.毛利润, t_op_gain_main.利润率' +',t_op_gain_main.不含税应收USD,t_op_gain_main.不含税应付USD,t_op_gain_main.不含税利润USD,' +'t_op_gain_main.不含税应收RMB,t_op_gain_main.不含税应付RMB,t_op_gain_main.不含税利润RMB,' +'t_op_gain_main.不含税合计应收,t_op_gain_main.不含税合计应付,t_op_gain_main.不含税毛利润,' +'t_op_gain_main.不含税应收OT,t_op_gain_main.不含税应付OT,t_op_gain_main.不含税利润OT,' +'t_op_gain_main.不含税垫付费用,t_op_gain_main.不含税利润率,' +'t_op_gain_main.应收USD税额,t_op_gain_main.应付USD税额,' +'t_op_gain_main.应收RMB税额,t_op_gain_main.应付RMB税额,' +'t_op_gain_main.合计应收税额,t_op_gain_main.合计应付税额' +',t_op_gain_main.财务不含税应收USD,t_op_gain_main.财务不含税应付USD,t_op_gain_main.财务不含税利润USD,' +'t_op_gain_main.财务不含税应收RMB,t_op_gain_main.财务不含税应付RMB,t_op_gain_main.财务不含税利润RMB,' +'t_op_gain_main.财务不含税合计应收,t_op_gain_main.财务不含税合计应付,t_op_gain_main.财务不含税毛利润,' +'t_op_gain_main.财务不含税应收OT,t_op_gain_main.财务不含税应付OT,t_op_gain_main.财务不含税利润OT,' +'t_op_gain_main.财务不含税垫付费用,t_op_gain_main.财务不含税利润率,' +'t_op_gain_main.财务应收USD税额,t_op_gain_main.应付USD税额,' +'t_op_gain_main.财务应收RMB税额,t_op_gain_main.财务应付RMB税额,' +'t_op_gain_main.财务合计应收税额,t_op_gain_main.财务合计应付税额 ' +' FROM t_op_seae left JOIN t_op_gain t_op_gain_main ON t_op_seae.编号 = t_op_gain_main.编号 ' +str_seae+' and t_op_seae.编号=t_op_seae.编号 '+default_sort(53,'t_op_seae','','desc'); // +str_seae+' and t_op_seae.编号=t_op_seae.主编号 '+default_sort(53,'t_op_seae','','desc'); 20120330 str_seae_pin:='SELECT t_op_seae.*, 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.应收OT,t_op_gain.应付OT,t_op_gain.已收OT,t_op_gain.已付OT,t_op_gain.利润OT,' +' t_op_gain.利润USD, t_op_gain.利润RMB, t_op_gain.毛利润, t_op_gain.利润率' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_seae left JOIN t_op_gain ON t_op_seae.编号 = t_op_gain.编号 where t_op_seae.主编号 in (select 编号 from t_op_seae ' +str_seae_pin+' and 编号=主编号) and t_op_seae.编号<>t_op_seae.主编号 order by t_op_seae.主编号'; str_seai:='SELECT t_op_seai.*, 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.应收OT,t_op_gain_main.已收OT,(t_op_gain_main.应收OT-t_op_gain_main.已收OT) 未收OT' +',t_op_gain_main.应付OT,t_op_gain_main.已付OT,(t_op_gain_main.应付OT-t_op_gain_main.已付OT) 未付OT,t_op_gain_main.利润OT,' +' t_op_gain_main.利润USD, t_op_gain_main.利润RMB, t_op_gain_main.毛利润, t_op_gain_main.利润率' +',t_op_gain_main.不含税应收USD,t_op_gain_main.不含税应付USD,t_op_gain_main.不含税利润USD,' +'t_op_gain_main.不含税应收RMB,t_op_gain_main.不含税应付RMB,t_op_gain_main.不含税利润RMB,' +'t_op_gain_main.不含税合计应收,t_op_gain_main.不含税合计应付,t_op_gain_main.不含税毛利润,' +'t_op_gain_main.不含税应收OT,t_op_gain_main.不含税应付OT,t_op_gain_main.不含税利润OT,' +'t_op_gain_main.不含税垫付费用,t_op_gain_main.不含税利润率,' +'t_op_gain_main.应收USD税额,t_op_gain_main.应付USD税额,' +'t_op_gain_main.应收RMB税额,t_op_gain_main.应付RMB税额,' +'t_op_gain_main.合计应收税额,t_op_gain_main.合计应付税额' +',t_op_gain_main.财务不含税应收USD,t_op_gain_main.财务不含税应付USD,t_op_gain_main.财务不含税利润USD,' +'t_op_gain_main.财务不含税应收RMB,t_op_gain_main.财务不含税应付RMB,t_op_gain_main.财务不含税利润RMB,' +'t_op_gain_main.财务不含税合计应收,t_op_gain_main.财务不含税合计应付,t_op_gain_main.财务不含税毛利润,' +'t_op_gain_main.财务不含税应收OT,t_op_gain_main.财务不含税应付OT,t_op_gain_main.财务不含税利润OT,' +'t_op_gain_main.财务不含税垫付费用,t_op_gain_main.财务不含税利润率,' +'t_op_gain_main.财务应收USD税额,t_op_gain_main.应付USD税额,' +'t_op_gain_main.财务应收RMB税额,t_op_gain_main.财务应付RMB税额,' +'t_op_gain_main.财务合计应收税额,t_op_gain_main.财务合计应付税额' +' FROM t_op_seai left JOIN t_op_gain t_op_gain_main ON t_op_seai.编号 = t_op_gain_main.编号 ' +str_seai+' and t_op_seai.编号=t_op_seai.编号 '+default_sort(54,'t_op_seai','','desc'); // +str_seai+' and t_op_seai.编号=t_op_seai.主编号 '+default_sort(54,'t_op_seai','','desc'); 20120330 str_seai_pin:='SELECT t_op_seai.*, 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.应收OT,t_op_gain.已收OT,(t_op_gain.应收OT-t_op_gain.已收OT) 未收OT' +',t_op_gain.应付OT,t_op_gain.已付OT,(t_op_gain.应付OT-t_op_gain.已付OT) 未付OT,t_op_gain.利润OT,' +' t_op_gain.利润USD, t_op_gain.利润RMB, t_op_gain.毛利润, t_op_gain.利润率' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_seai left JOIN t_op_gain ON t_op_seai.编号 = t_op_gain.编号 where t_op_seai.编号<>t_op_seai.主编号 ' +' and t_op_seai.主编号 in (select 编号 from t_op_seai ' +str_seai_pin+' and 编号=主编号) order by t_op_seai.主编号'; str_aire:='SELECT t_op_aire.*, 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.应收OT,t_op_gain_main.已收OT,(t_op_gain_main.应收OT-t_op_gain_main.已收OT) 未收OT' +',t_op_gain_main.应付OT,t_op_gain_main.已付OT,(t_op_gain_main.应付OT-t_op_gain_main.已付OT) 未付OT,t_op_gain_main.利润OT,' +' t_op_gain_main.利润USD, t_op_gain_main.利润RMB, t_op_gain_main.毛利润, t_op_gain_main.利润率' +',t_op_gain_main.不含税应收USD,t_op_gain_main.不含税应付USD,t_op_gain_main.不含税利润USD,' +'t_op_gain_main.不含税应收RMB,t_op_gain_main.不含税应付RMB,t_op_gain_main.不含税利润RMB,' +'t_op_gain_main.不含税合计应收,t_op_gain_main.不含税合计应付,t_op_gain_main.不含税毛利润,' +'t_op_gain_main.不含税应收OT,t_op_gain_main.不含税应付OT,t_op_gain_main.不含税利润OT,' +'t_op_gain_main.不含税垫付费用,t_op_gain_main.不含税利润率,' +'t_op_gain_main.应收USD税额,t_op_gain_main.应付USD税额,' +'t_op_gain_main.应收RMB税额,t_op_gain_main.应付RMB税额,' +'t_op_gain_main.合计应收税额,t_op_gain_main.合计应付税额' +',t_op_gain_main.财务不含税应收USD,t_op_gain_main.财务不含税应付USD,t_op_gain_main.财务不含税利润USD,' +'t_op_gain_main.财务不含税应收RMB,t_op_gain_main.财务不含税应付RMB,t_op_gain_main.财务不含税利润RMB,' +'t_op_gain_main.财务不含税合计应收,t_op_gain_main.财务不含税合计应付,t_op_gain_main.财务不含税毛利润,' +'t_op_gain_main.财务不含税应收OT,t_op_gain_main.财务不含税应付OT,t_op_gain_main.财务不含税利润OT,' +'t_op_gain_main.财务不含税垫付费用,t_op_gain_main.财务不含税利润率,' +'t_op_gain_main.财务应收USD税额,t_op_gain_main.应付USD税额,' +'t_op_gain_main.财务应收RMB税额,t_op_gain_main.财务应付RMB税额,' +'t_op_gain_main.财务合计应收税额,t_op_gain_main.财务合计应付税额' +' FROM t_op_aire left JOIN t_op_gain t_op_gain_main ON t_op_aire.编号 = t_op_gain_main.编号 ' +str_aire+' and t_op_aire.编号=t_op_aire.编号 '+default_sort(55,'t_op_aire','','desc'); // +str_aire+' and t_op_aire.编号=t_op_aire.主编号 '+default_sort(55,'t_op_aire','','desc'); //20120330 str_aire_pin:='SELECT t_op_aire.*, 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.应收OT,t_op_gain.已收OT,(t_op_gain.应收OT-t_op_gain.已收OT) 未收OT' +',t_op_gain.应付OT,t_op_gain.已付OT,(t_op_gain.应付OT-t_op_gain.已付OT) 未付OT,t_op_gain.利润OT,' +' t_op_gain.利润USD, t_op_gain.利润RMB, t_op_gain.毛利润, t_op_gain.利润率' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_aire left JOIN t_op_gain ON t_op_aire.编号 = t_op_gain.编号 where t_op_aire.编号<>t_op_aire.主编号 ' +' and t_op_aire.主编号 in (select 编号 from t_op_aire ' +str_aire_pin+' and 编号=主编号) order by t_op_aire.主编号'; str_airi:='SELECT t_op_airi.*, 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.应收OT,t_op_gain_main.已收OT,(t_op_gain_main.应收OT-t_op_gain_main.已收OT) 未收OT' +',t_op_gain_main.应付OT,t_op_gain_main.已付OT,(t_op_gain_main.应付OT-t_op_gain_main.已付OT) 未付OT,t_op_gain_main.利润OT,' +' t_op_gain_main.利润USD, t_op_gain_main.利润RMB, t_op_gain_main.毛利润, t_op_gain_main.利润率' +',t_op_gain_main.不含税应收USD,t_op_gain_main.不含税应付USD,t_op_gain_main.不含税利润USD,' +'t_op_gain_main.不含税应收RMB,t_op_gain_main.不含税应付RMB,t_op_gain_main.不含税利润RMB,' +'t_op_gain_main.不含税合计应收,t_op_gain_main.不含税合计应付,t_op_gain_main.不含税毛利润,' +'t_op_gain_main.不含税应收OT,t_op_gain_main.不含税应付OT,t_op_gain_main.不含税利润OT,' +'t_op_gain_main.不含税垫付费用,t_op_gain_main.不含税利润率,' +'t_op_gain_main.应收USD税额,t_op_gain_main.应付USD税额,' +'t_op_gain_main.应收RMB税额,t_op_gain_main.应付RMB税额,' +'t_op_gain_main.合计应收税额,t_op_gain_main.合计应付税额' +',t_op_gain_main.不含税应收USD,t_op_gain_main.不含税应付USD,t_op_gain_main.不含税利润USD,' +'t_op_gain_main.不含税应收RMB,t_op_gain_main.不含税应付RMB,t_op_gain_main.不含税利润RMB,' +'t_op_gain_main.不含税合计应收,t_op_gain_main.不含税合计应付,t_op_gain_main.不含税毛利润,' +'t_op_gain_main.不含税应收OT,t_op_gain_main.不含税应付OT,t_op_gain_main.不含税利润OT,' +'t_op_gain_main.不含税垫付费用,t_op_gain_main.不含税利润率,' +'t_op_gain_main.应收USD税额,t_op_gain_main.应付USD税额,' +'t_op_gain_main.应收RMB税额,t_op_gain_main.应付RMB税额,' +'t_op_gain_main.合计应收税额,t_op_gain_main.合计应付税额' +',t_op_gain_main.财务不含税应收USD,t_op_gain_main.财务不含税应付USD,t_op_gain_main.财务不含税利润USD,' +'t_op_gain_main.财务不含税应收RMB,t_op_gain_main.财务不含税应付RMB,t_op_gain_main.财务不含税利润RMB,' +'t_op_gain_main.财务不含税合计应收,t_op_gain_main.财务不含税合计应付,t_op_gain_main.财务不含税毛利润,' +'t_op_gain_main.财务不含税应收OT,t_op_gain_main.财务不含税应付OT,t_op_gain_main.财务不含税利润OT,' +'t_op_gain_main.财务不含税垫付费用,t_op_gain_main.财务不含税利润率,' +'t_op_gain_main.财务应收USD税额,t_op_gain_main.财务应付USD税额,' +'t_op_gain_main.财务应收RMB税额,t_op_gain_main.财务应付RMB税额,' +'t_op_gain_main.财务合计应收税额,t_op_gain_main.财务合计应付税额' +' FROM t_op_airi left JOIN t_op_gain t_op_gain_main ON t_op_airi.编号 = t_op_gain_main.编号 ' +str_airi+' and t_op_airi.编号=t_op_airi.编号 '+default_sort(56,'t_op_airi','','desc'); // +str_airi+' and t_op_airi.编号=t_op_airi.主编号 '+default_sort(56,'t_op_airi','','desc'); //20120230 // showmessage(str_airi); str_airi_pin:='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.应收OT,t_op_gain.已收OT,(t_op_gain.应收OT-t_op_gain.已收OT) 未收OT' +',t_op_gain.应付OT,t_op_gain.已付OT,(t_op_gain.应付OT-t_op_gain.已付OT) 未付OT,t_op_gain.利润OT,' +' t_op_gain.利润USD, t_op_gain.利润RMB, t_op_gain.毛利润, t_op_gain.利润率' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,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.编号 where t_op_airi.编号<>t_op_airi.主编号 ' +' and t_op_airi.主编号 in (select 编号 from t_op_airi ' +str_airi_pin+' and 编号=主编号) order by t_op_airi.主编号 '; // showmessage(str_airi_pin); str_airtruck:='SELECT t_op_airtruck.*, v_op_gain_main_airtruck.计费重,v_op_gain_main_airtruck.应收USD, v_op_gain_main_airtruck.已收USD,(v_op_gain_main_airtruck.应收USD-v_op_gain_main_airtruck.已收USD)' +' AS 未收USD,v_op_gain_main_airtruck.应收RMB, v_op_gain_main_airtruck.已收RMB,(v_op_gain_main_airtruck.应收RMB-v_op_gain_main_airtruck.已收RMB)' +' AS 未收RMB, v_op_gain_main_airtruck.合计应收,v_op_gain_main_airtruck.合计已收,(v_op_gain_main_airtruck.合计应收-v_op_gain_main_airtruck.合计已收)' +' AS 合计未收,v_op_gain_main_airtruck.应付USD, v_op_gain_main_airtruck.已付USD, (v_op_gain_main_airtruck.应付USD-v_op_gain_main_airtruck.已付USD)' +' AS 未付USD,v_op_gain_main_airtruck.应付RMB, v_op_gain_main_airtruck.已付RMB,(v_op_gain_main_airtruck.应付RMB- v_op_gain_main_airtruck.已付RMB)' +' AS 未付RMB,v_op_gain_main_airtruck.合计应付,v_op_gain_main_airtruck.合计已付,(v_op_gain_main_airtruck.合计应付-v_op_gain_main_airtruck.合计已付) AS 合计未付,' +' v_op_gain_main_airtruck.应收OT,v_op_gain_main_airtruck.已收OT,(v_op_gain_main_airtruck.应收OT-v_op_gain_main_airtruck.已收OT) 未收OT' +',v_op_gain_main_airtruck.应付OT,v_op_gain_main_airtruck.已付OT,(v_op_gain_main_airtruck.应付OT-v_op_gain_main_airtruck.已付OT) 未付OT,v_op_gain_main_airtruck.利润OT,' +' v_op_gain_main_airtruck.利润USD, v_op_gain_main_airtruck.利润RMB, v_op_gain_main_airtruck.毛利润,'''' 利润率' +'v_op_gain_main_airtruck.合计应收税额,v_op_gain_main_airtruck.合计应付税额' +',v_op_gain_main_airtruck.不含税应收USD,v_op_gain_main_airtruck.不含税应付USD,v_op_gain_main_airtruck.不含税利润USD,' +'v_op_gain_main_airtruck.不含税应收RMB,v_op_gain_main_airtruck.不含税应付RMB,v_op_gain_main_airtruck.不含税利润RMB,' +'v_op_gain_main_airtruck.不含税合计应收,v_op_gain_main_airtruck.不含税合计应付,v_op_gain_main_airtruck.不含税毛利润,' +'v_op_gain_main_airtruck.不含税应收OT,v_op_gain_main_airtruck.不含税应付OT,v_op_gain_main_airtruck.不含税利润OT,' +'v_op_gain_main_airtruck.不含税垫付费用,'''' 不含税利润率,' +'v_op_gain_main_airtruck.应收USD税额,v_op_gain_main_airtruck.应付USD税额,' +'v_op_gain_main_airtruck.应收RMB税额,v_op_gain_main_airtruck.应付RMB税额,' +'v_op_gain_main_airtruck.合计应收税额,v_op_gain_main_airtruck.合计应付税额' +',v_op_gain_main_airtruck.财务不含税应收USD,v_op_gain_main_airtruck.财务不含税应付USD,v_op_gain_main_airtruck.财务不含税利润USD,' +'v_op_gain_main_airtruck.财务不含税应收RMB,v_op_gain_main_airtruck.财务不含税应付RMB,v_op_gain_main_airtruck.财务不含税利润RMB,' +'v_op_gain_main_airtruck.财务不含税合计应收,v_op_gain_main_airtruck.财务不含税合计应付,v_op_gain_main_airtruck.财务不含税毛利润,' +'v_op_gain_main_airtruck.财务不含税应收OT,v_op_gain_main_airtruck.财务不含税应付OT,v_op_gain_main_airtruck.财务不含税利润OT,' +'v_op_gain_main_airtruck.财务不含税垫付费用,'''' 财务不含税利润率,' +'v_op_gain_main_airtruck.财务应收USD税额,v_op_gain_main_airtruck.财务应付USD税额,' +'v_op_gain_main_airtruck.财务应收RMB税额,v_op_gain_main_airtruck.财务应付RMB税额,' +'v_op_gain_main_airtruck.财务合计应收税额,v_op_gain_main_airtruck.财务合计应付税额' +' FROM t_op_airtruck left JOIN v_op_gain_main_airtruck ON t_op_airtruck.主编号 = v_op_gain_main_airtruck.主编号 ' +str_airtruck+' order by t_op_airtruck.业务编号'; str_railway:='SELECT t_op_railway.*, 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.应收OT,t_op_gain.已收OT,(t_op_gain.应收OT-t_op_gain.已收OT) 未收OT' +',t_op_gain.应付OT,t_op_gain.已付OT,(t_op_gain.应付OT-t_op_gain.已付OT) 未付OT,t_op_gain.利润OT,' +' t_op_gain.利润USD, t_op_gain.利润RMB, t_op_gain.毛利润, t_op_gain.利润率' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.不含税应收USD,t_op_gain.不含税应付USD,t_op_gain.不含税利润USD,' +'t_op_gain.不含税应收RMB,t_op_gain.不含税应付RMB,t_op_gain.不含税利润RMB,' +'t_op_gain.不含税合计应收,t_op_gain.不含税合计应付,t_op_gain.不含税毛利润,' +'t_op_gain.不含税应收OT,t_op_gain.不含税应付OT,t_op_gain.不含税利润OT,' +'t_op_gain.不含税垫付费用,t_op_gain.不含税利润率,' +'t_op_gain.应收USD税额,t_op_gain.应付USD税额,' +'t_op_gain.应收RMB税额,t_op_gain.应付RMB税额,' +'t_op_gain.合计应收税额,t_op_gain.合计应付税额' +',t_op_gain.财务不含税应收USD,t_op_gain.财务不含税应付USD,t_op_gain.财务不含税利润USD,' +'t_op_gain.财务不含税应收RMB,t_op_gain.财务不含税应付RMB,t_op_gain.财务不含税利润RMB,' +'t_op_gain.财务不含税合计应收,t_op_gain.财务不含税合计应付,t_op_gain.财务不含税毛利润,' +'t_op_gain.财务不含税应收OT,t_op_gain.财务不含税应付OT,t_op_gain.财务不含税利润OT,' +'t_op_gain.财务不含税垫付费用,t_op_gain.财务不含税利润率,' +'t_op_gain.财务应收USD税额,t_op_gain.财务应付USD税额,' +'t_op_gain.财务应收RMB税额,t_op_gain.财务应付RMB税额,' +'t_op_gain.财务合计应收税额,t_op_gain.财务合计应付税额' +' FROM t_op_railway left JOIN t_op_gain ON t_op_railway.编号 = t_op_gain.编号 ' +str_railway+' order by t_op_railway.业务编号'; end; end.