unit u_ch_accept_shen; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, DB, ADODB, u_ch_add_do, u_ch_delete_do, StdCtrls, DBCtrls, wwdblook, ComCtrls, bsSkinTabs, RxLookup, bsSkinCtrls, bsdbctrls, Mask, dxDBGrid, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxCntner, Menus, XPMenu, wwdbdatetimepicker, wwdbedit, Wwdotdot, Wwdbcomb, kbmMemTable; type Tfrm_ch_accept_shen = class(TForm) bsSkinPanel2: TbsSkinPanel; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton11: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinNotebook1: TbsSkinNotebook; dxDBGrid1: TdxDBGrid; bsSkinPanel1: TbsSkinPanel; bsSkinPanel3: TbsSkinPanel; fra_ch_add_do1: Tfra_ch_add_do; t_ch_accept1: TDataSource; t_ch_fee_do: TADOQuery; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column9: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridDateColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridDateColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridDateColumn; dxDBGrid1Column6: TdxDBGridColumn; dxDBGrid1Column7: TdxDBGridColumn; dxDBGrid1Column8: TdxDBGridColumn; fra_ch_delete_do1: Tfra_ch_delete_do; dxDBGrid1Column16: TdxDBGridColumn; XPMenu1: TXPMenu; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; dxDBGrid1Column17: TdxDBGridColumn; PopupMenu3: TPopupMenu; N17: TMenuItem; N18: TMenuItem; N34: TMenuItem; N35: TMenuItem; N36: TMenuItem; N1: TMenuItem; N6: TMenuItem; N5: TMenuItem; N4: TMenuItem; bsSkinButton12: TbsSkinButton; bsSkinButton7: TbsSkinButton; t_ch_accept: TADOQuery; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinTabSheet2: TbsSkinTabSheet; Label25: TLabel; DBEdit14: TDBEdit; Label17: TLabel; DBEdit1: TDBEdit; RxDBLookupCombo1: TRxDBLookupCombo; Label12: TLabel; Label2: TLabel; RxDBLookupCombo2: TRxDBLookupCombo; bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox; DBEdit2: TDBEdit; Label4: TLabel; DBEdit3: TDBEdit; Label1: TLabel; Label8: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; DBEdit7: TDBEdit; wwDBComboBox1: TwwDBComboBox; DBEdit6: TDBEdit; DBEdit4: TDBEdit; Label3: TLabel; Label5: TLabel; Label18: TLabel; Label6: TLabel; Label10: TLabel; DBMemo1: TDBMemo; Label9: TLabel; DBEdit5: TDBEdit; Label11: TLabel; DBMemo2: TDBMemo; Label13: TLabel; DBMemo3: TDBMemo; Label7: TLabel; DBEdit8: TDBEdit; Label14: TLabel; wwDBDateTimePicker2: TwwDBDateTimePicker; Label15: TLabel; DBEdit9: TDBEdit; Label16: TLabel; wwDBLookupCombo3: TwwDBLookupCombo; Label19: TLabel; wwDBLookupCombo2: TwwDBLookupCombo; Label20: TLabel; wwDBLookupCombo1: TwwDBLookupCombo; dxDBGrid1Column18: TdxDBGridColumn; p_accept_bill: TADOStoredProc; p_accept_bill1: TDataSource; p_accept_fee: TADOStoredProc; p_accept_fee1: TDataSource; dxDBGrid1Column19: TdxDBGridColumn; dxDBGrid1Column20: TdxDBGridColumn; memtblprint1: TDataSource; memtblprint: TkbmMemTable; bsSkinPanel4: TbsSkinPanel; Label21: TLabel; Label22: TLabel; Label23: TLabel; Label24: TLabel; Label27: TLabel; Label28: TLabel; Label31: TLabel; Label32: TLabel; Label33: TLabel; Label92: TLabel; Label93: TLabel; DBEdit10: TDBEdit; DBEdit11: TDBEdit; RxDBLookupCombo3: TRxDBLookupCombo; RxDBLookupCombo4: TRxDBLookupCombo; bsSkinDBCheckRadioBox2: TbsSkinDBCheckRadioBox; DBEdit13: TDBEdit; wwDBDateTimePicker3: TwwDBDateTimePicker; DBEdit15: TDBEdit; wwDBComboBox2: TwwDBComboBox; DBMemo4: TDBMemo; DBEdit70: TDBEdit; DBEdit71: TDBEdit; dxDBGrid1Column21: TdxDBGridColumn; bsSkinButton38: TbsSkinButton; Label26: TLabel; DBEdit12: TDBEdit; Label29: TLabel; DBEdit16: TDBEdit; RxDBLookupCombo14: TRxDBLookupCombo; Label30: TLabel; dxDBGrid1Column22: TdxDBGridColumn; bsSkinButton8: TbsSkinButton; dxDBGrid1Column23: TdxDBGridColumn; Label34: TLabel; DBEdit17: TDBEdit; dxDBGrid1Column24: TdxDBGridColumn; dxDBGrid1Column25: TdxDBGridColumn; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormShow(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure t_ch_acceptAfterInsert(DataSet: TDataSet); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure t_ch_acceptBeforePost(DataSet: TDataSet); procedure DBEdit4Enter(Sender: TObject); procedure t_ch_acceptBeforeEdit(DataSet: TDataSet); procedure bsSkinButton6Click(Sender: TObject); procedure t_ch_acceptAfterPost(DataSet: TDataSet); procedure RxDBLookupCombo1Enter(Sender: TObject); procedure dxDBGrid1Column2CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); procedure DBEdit1Change(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure t_ch_acceptAfterDelete(DataSet: TDataSet); procedure DBEdit14KeyPress(Sender: TObject; var Key: Char); procedure DBEdit1KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); procedure bsSkinDBCheckRadioBox1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit4KeyPress(Sender: TObject; var Key: Char); procedure DBEdit2KeyPress(Sender: TObject; var Key: Char); procedure DBEdit6KeyPress(Sender: TObject; var Key: Char); procedure DBEdit8KeyPress(Sender: TObject; var Key: Char); procedure DBEdit3KeyPress(Sender: TObject; var Key: Char); procedure N10Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit7KeyPress(Sender: TObject; var Key: Char); procedure bsSkinPanel2Resize(Sender: TObject); procedure wwDBComboBox1KeyPress(Sender: TObject; var Key: Char); procedure bsSkinButton12Click(Sender: TObject); procedure N17Click(Sender: TObject); procedure N34Click(Sender: TObject); procedure N36Click(Sender: TObject); procedure N6Click(Sender: TObject); procedure N4Click(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure fra_ch_add_do1bsSkinButton10Click(Sender: TObject); procedure bsSkinNotebook1PageChanged(Sender: TObject); procedure bsSkinButton38Click(Sender: TObject); procedure fra_ch_delete_do1N1Click(Sender: TObject); procedure fra_ch_add_do1bsSkinButton1Click(Sender: TObject); procedure fra_ch_add_do1bsSkinButton8Click(Sender: TObject); procedure fra_ch_add_do1MenuItem1Click(Sender: TObject); procedure DBEdit17KeyPress(Sender: TObject; var Key: Char); private edittrue:boolean; { Private declarations } public { Public declarations } end; var ch_accept_shen_open:boolean; frm_ch_accept_shen: Tfrm_ch_accept_shen; implementation uses u_main, u_ch_shen_query, my_sys_function, u_data_share; {$R *.dfm} procedure Tfrm_ch_accept_shen.FormClose(Sender: TObject; var Action: TCloseAction); begin ch_accept_shen_open:=false; savereggrid(dxdbgrid1,caption); frm_ch_accept_shen.Hide; frm_ch_accept_shen.ManualFloat(frm_ch_accept_shen.BoundsRect ); frm_main.freeTabs('frm_ch_accept_shen'); action:=cafree; frm_ch_accept_shen:=nil; end; procedure Tfrm_ch_accept_shen.FormShow(Sender: TObject); begin edittrue:=false; bsSkinNotebook1.PageIndex:=0; t_ch_accept.Close; t_ch_accept.SQL.clear; t_ch_accept.SQL.Add('select * from t_ch_accept where 申请状态 not in ('+''''+'批准收款'+'''' +','+''''+'收款完毕'+''''+') and ' +open_data('1003','申请人','no','no','no','no') +'order by 申请编号'); t_ch_accept.open; ch_accept_shen_open:=true; // t_ch_fee_do.open; if StrToBool(get_parameters_value(85,'false')) then begin fra_ch_add_do1.bsSkinTabSheet1.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet2.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet3.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet4.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet5.TabVisible:=True; fra_ch_add_do1.bsSkinPageControl1.TabIndex:=0; // fra_ch_add_do1.bsSkinButton11.Caption:='收费申请'; fra_ch_delete_do1.bsSkinTabSheet1.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet2.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet3.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet4.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet5.TabVisible:=True; fra_ch_delete_do1.bsSkinPageControl1.ActivePage:=fra_ch_delete_do1.bsSkinTabSheet5; end else begin fra_ch_add_do1.bsSkinTabSheet1.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet2.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet3.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet4.TabVisible:=True; fra_ch_add_do1.bsSkinPageControl1.ActivePage:=fra_ch_add_do1.bsSkinTabSheet1; fra_ch_add_do1.bsSkinTabSheet5.TabVisible:=False; fra_ch_delete_do1.bsSkinTabSheet1.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet2.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet3.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet4.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet5.TabVisible:=false; fra_ch_delete_do1.bsSkinPageControl1.ActivePage:=fra_ch_delete_do1.bsSkinTabSheet1; end; if StrToBool(get_parameters_value(85,'false')) then begin fra_ch_delete_do1.v_fee_do_bscard.SQL.clear; fra_ch_delete_do1.v_fee_do_bscard.sql.add('select * from v_fee_do_bscard ' +'where 工作编号=:申请编号 order by 编号,费用名称'); fra_ch_delete_do1.v_fee_do_bscard.DataSource:=t_ch_accept1; fra_ch_delete_do1.v_fee_do_bscard.Open; fra_ch_delete_do1.v_fee_do_bscard_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_bscard_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_bscard ' +'where 工作编号=:申请编号 group by 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_bscard_sum.DataSource:=t_ch_accept1; fra_ch_delete_do1.v_fee_do_bscard_sum.Open; end else begin fra_ch_delete_do1.v_fee_do_seae.SQL.clear; fra_ch_delete_do1.v_fee_do_seae.sql.add('select * from v_fee_do_seae ' +'where 工作编号=:申请编号 order by 编号,费用名称'); fra_ch_delete_do1.v_fee_do_seae.DataSource:=t_ch_accept1; fra_ch_delete_do1.v_fee_do_seae.Open; fra_ch_delete_do1.v_fee_do_seai.SQL.clear; fra_ch_delete_do1.v_fee_do_seai.sql.add('select * from v_fee_do_seai ' +'where 工作编号=:申请编号 order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_seai.DataSource:=t_ch_accept1; fra_ch_delete_do1.v_fee_do_seai.Open; fra_ch_delete_do1.v_fee_do_aire.SQL.clear; fra_ch_delete_do1.v_fee_do_aire.sql.add('select * from v_fee_do_aire ' +'where 工作编号=:申请编号 order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_aire.DataSource:=t_ch_accept1; fra_ch_delete_do1.v_fee_do_aire.Open; fra_ch_delete_do1.v_fee_do_airi.SQL.clear; fra_ch_delete_do1.v_fee_do_airi.sql.add('select * from v_fee_do_airi ' +'where 工作编号=:申请编号 order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_airi.DataSource:=t_ch_accept1; fra_ch_delete_do1.v_fee_do_airi.Open; fra_ch_delete_do1.v_fee_do_seae_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_seae_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_seae ' +'where 工作编号=:申请编号 group by 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_seae_sum.DataSource:=t_ch_accept1; fra_ch_delete_do1.v_fee_do_seae_sum.Open; fra_ch_delete_do1.v_fee_do_seai_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_seai_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_seai ' +'where 工作编号=:申请编号 group by 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_seai_sum.DataSource:=t_ch_accept1; fra_ch_delete_do1.v_fee_do_seai_sum.Open; fra_ch_delete_do1.v_fee_do_aire_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_aire_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开航日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_aire ' +'where 工作编号=:申请编号 group by 类型,SUBSTRING(CONVERT(char(15),开航日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开航日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_aire_sum.DataSource:=t_ch_accept1; fra_ch_delete_do1.v_fee_do_aire_sum.Open; fra_ch_delete_do1.v_fee_do_airi_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_airi_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_airi ' +'where 工作编号=:申请编号 group by 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_airi_sum.DataSource:=t_ch_accept1; fra_ch_delete_do1.v_fee_do_airi_sum.Open; end; fra_ch_add_do1.do_ban1.DataSet:=t_ch_accept; fra_ch_add_do1.wwDBComboBox31.text:='收'; fra_ch_add_do1.bs_text.text:='6'; fra_ch_add_do1.t_ch_fee_do.open; fra_ch_add_do1.bsSkinPanel9.Visible:=true; fra_ch_delete_do1.bs_text.Text:='6'; fra_ch_delete_do1.do_ban1.DataSet:=t_ch_accept; fra_ch_add_do1.dxDBGrid13.Visible:=true; fra_ch_add_do1.dxDBGrid14.Visible:=true; fra_ch_add_do1.dxDBGrid15.Visible:=true; fra_ch_add_do1.dxDBGrid16.Visible:=true; loadreggrid(dxdbgrid1,false,caption); if StrToBool(get_parameters_value(83,'false')) then begin dxdbgrid1.ColumnByFieldName('币别').Visible:=false; dxdbgrid1.ColumnByFieldName('申请金额').Visible:=False; dxdbgrid1.ColumnByFieldName('实际金额').Visible:=false; dxdbgrid1.ColumnByFieldName('虚开金额').Visible:=False; dxdbgrid1.ColumnByFieldName('美元金额').Visible:=True; dxdbgrid1.ColumnByFieldName('人民币金额').Visible:=True; bsSkinPanel4.Visible:=true; fra_ch_add_do1.bsSkinPanel12.Visible:=true; end else begin dxdbgrid1.ColumnByFieldName('币别').Visible:=True; dxdbgrid1.ColumnByFieldName('申请金额').Visible:=True; dxdbgrid1.ColumnByFieldName('实际金额').Visible:=True; dxdbgrid1.ColumnByFieldName('虚开金额').Visible:=True; dxdbgrid1.ColumnByFieldName('美元金额').Visible:=False; dxdbgrid1.ColumnByFieldName('人民币金额').Visible:=False; bsSkinPanel4.Visible:=false; fra_ch_add_do1.bsSkinPanel12.Visible:=false; end; frm_data_share.t_crm_client_all.requery; frm_data_share.t_code_currency.requery; end; procedure Tfrm_ch_accept_shen.bsSkinButton11Click(Sender: TObject); var answer:TModalResult; begin if bsSkinButton11.Caption='编辑修改' then begin if t_ch_accept.IsEmpty then exit; bsSkinNotebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; end else begin if (t_ch_accept.State=dsinsert)or(t_ch_accept.State=dsedit) then BEGIN answer:=messagedlg( '数据已经修改,是否保存?',mtWarning,mbYesNoCancel,0); if answer=mrYes then begin t_ch_accept.post; end; if answer=mrNo then begin t_ch_accept.cancel; end; if answer=mrCancel then begin exit; end; END; bsSkinNotebook1.PageIndex:=0; bsSkinButton11.Caption:='编辑修改'; end; end; procedure Tfrm_ch_accept_shen.t_ch_acceptAfterInsert(DataSet: TDataSet); begin t_ch_accept['申请状态']:='申请收款'; t_ch_accept['申请人']:=employee; t_ch_accept['申请日期']:=now; t_ch_accept['自动']:=1; t_ch_accept['申请金额']:=0; t_ch_accept['实际金额']:=0; t_ch_accept['虚开金额']:=0; t_ch_accept['人民币金额']:=0; t_ch_accept['美元金额']:=0; t_ch_accept['收款方式']:='支票'; t_ch_accept['发票状态']:='申请开票'; // t_ch_accept['申请编号']:=get_no(date,'DS'); // t_ch_accept['财务']:=0; end; procedure Tfrm_ch_accept_shen.bsSkinButton1Click(Sender: TObject); begin t_ch_accept.insert; bsSkinNotebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; end; procedure Tfrm_ch_accept_shen.bsSkinButton2Click(Sender: TObject); begin table_post(t_ch_accept); end; procedure Tfrm_ch_accept_shen.bsSkinButton4Click(Sender: TObject); begin if t_ch_accept.IsEmpty then exit; if (t_ch_accept.FieldByName('申请状态').asstring='批准收款')or (t_ch_accept.FieldByName('申请状态').asstring='禁止修改')or (t_ch_accept.FieldByName('申请状态').asstring='收款完毕')or (t_ch_accept.FieldByName('申请状态').asstring='提交申请')or (t_ch_accept.FieldByName('申请状态').asstring='申请修改')then begin showmessage('当前业务操作的状态不允许删除!!'); exit; end; if application.MessageBox('您确定要删除数据吗?','警告:',MB_OKCANCEL)=IDOK then begin bsSkinNotebook1.PageIndex:=0; t_ch_fee_do.open; while not t_ch_fee_do.eof do t_ch_fee_do.delete; t_ch_fee_do.close; t_ch_accept.Delete; end; end; procedure Tfrm_ch_accept_shen.bsSkinButton3Click(Sender: TObject); begin table_cancel(t_ch_accept); end; procedure Tfrm_ch_accept_shen.t_ch_acceptBeforePost(DataSet: TDataSet); begin table_before_post(t_ch_accept,'客户名称'); if not StrToBool(get_parameters_value(83,'false')) then table_before_post(t_ch_accept,'币别'); // table_before_post(t_ch_accept,'要求收款日期'); t_ch_accept['申请金额']:=s_w(strtoint(apointnum),t_ch_accept['申请金额']); t_ch_accept['实际金额']:=s_w(strtoint(apointnum),t_ch_accept['实际金额']); t_ch_accept['虚开金额']:=s_w(strtoint(apointnum),t_ch_accept['虚开金额']); t_ch_accept['美元金额']:=s_w(strtoint(apointnum),t_ch_accept['美元金额']); t_ch_accept['人民币金额']:=s_w(strtoint(apointnum),t_ch_accept['人民币金额']); if t_ch_accept.FieldByName('自动').asboolean then begin t_ch_accept['申请金额']:=t_ch_accept['实际金额']; end else begin end; t_ch_accept['申请状态']:=t_ch_accept['申请状态']; t_ch_accept['虚开金额']:=t_ch_accept['申请金额']-t_ch_accept['实际金额']; if (t_ch_accept.state=dsinsert) and (trim(t_ch_accept.FieldByName('申请编号').AsString)='') then begin t_ch_accept['申请编号']:=get_no(date,'DS'); end; end; procedure Tfrm_ch_accept_shen.DBEdit4Enter(Sender: TObject); begin if bsSkinDBCheckRadioBox1.Checked then DBEdit4.ReadOnly:=true else DBEdit4.ReadOnly:=false; end; procedure Tfrm_ch_accept_shen.t_ch_acceptBeforeEdit(DataSet: TDataSet); begin if not modify_all then begin if (t_ch_accept.FieldByName('申请状态').asstring='批准收款')or (t_ch_accept.FieldByName('申请状态').asstring='禁止修改')or (t_ch_accept.FieldByName('申请状态').asstring='收款完毕')or (t_ch_accept.FieldByName('申请状态').asstring='提交申请')or (t_ch_accept.FieldByName('申请状态').asstring='申请修改')then begin showmessage('当前业务操作的状态不允许更改'); abort; end; end; end; procedure Tfrm_ch_accept_shen.bsSkinButton6Click(Sender: TObject); var aQuery,aQuery2:TADOQuery; begin if t_ch_accept.IsEmpty then exit; if (t_ch_accept.FieldByName('申请状态').asstring='申请收款')or (t_ch_accept.FieldByName('申请状态').asstring='批准修改')or (t_ch_accept.FieldByName('申请状态').asstring='驳回申请')then begin t_ch_accept.Edit; t_ch_accept['申请状态']:='提交申请'; t_ch_accept['提交日期']:=NOW; t_ch_accept.post; aQuery:=CreateAdoQuery; aQuery2:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('select 编号,费用状态 from t_op_seae where 编号 in (select DISTINCT 业务编号 from t_ch_fee_do where 工作编号='''+t_ch_accept['申请编号']+''')'); Open; if not IsEmpty then begin First; while not eof do begin aQuery2.Close; aQuery2.SQL.Clear; aQuery2.SQL.Add('Select * from t_op_state where 业务状态=''提交收款'' and 编号='''+FieldByName('编号').AsString+''''); aQuery2.Open; if aQuery2.IsEmpty then begin aQuery2.insert; aQuery2.FieldByName('编号').AsString:=FieldByName('编号').AsString; aQuery2.FieldByName('业务状态').AsString:='提交收款'; aQuery2['是否完成']:=1; aQuery2['完成时间']:=date; aQuery2['完成人']:=employee; aQuery2.Post; end else begin Edit; aQuery2['是否完成']:=1; aQuery2['完成时间']:=date; aQuery2['完成人']:=employee; Post; end; Next; end; end; end; finally FreeAndNil(aQuery); FreeAndNil(aQuery2); end; { Send_invocie_check_shen('申请支付费用,申请编号:'+t_ch_check.fieldbyname('申请编号').asstring +',客户:'+t_ch_check.fieldbyname('客户名称').asstring,'037','17'); } end else begin showmessage('当前业务状态不能提交申请!!'); end; end; procedure Tfrm_ch_accept_shen.t_ch_acceptAfterPost(DataSet: TDataSet); begin if StrToBool(get_parameters_value(85,'false')) then begin if fra_ch_delete_do1.v_fee_do_bscard.active then begin fra_ch_delete_do1.v_fee_do_bscard.DisableControls; fra_ch_delete_do1.v_fee_do_bscard_sum.DisableControls; fra_ch_delete_do1.v_fee_do_bscard.Requery; fra_ch_delete_do1.v_fee_do_bscard_sum.Requery; fra_ch_delete_do1.v_fee_do_bscard.EnableControls; fra_ch_delete_do1.v_fee_do_bscard_sum.EnableControls; end; if fra_ch_add_do1.V_op_BSCARD.Active then begin fra_ch_add_do1.t_ch_fee.Requery(); fra_ch_add_do1.t_ch_fee_sum.Requery(); end; end else begin case delete_do_type_num of 1: begin if fra_ch_delete_do1.v_fee_do_seae.active then begin fra_ch_delete_do1.v_fee_do_seae.DisableControls; fra_ch_delete_do1.v_fee_do_seae_sum.DisableControls; fra_ch_delete_do1.v_fee_do_seae.Requery; fra_ch_delete_do1.v_fee_do_seae_sum.Requery; fra_ch_delete_do1.v_fee_do_seae.EnableControls; fra_ch_delete_do1.v_fee_do_seae_sum.EnableControls; end; end; 2: begin if fra_ch_delete_do1.v_fee_do_seai.active then begin fra_ch_delete_do1.v_fee_do_seai.Requery; fra_ch_delete_do1.v_fee_do_seai_sum.Requery; end; end; 3: begin if fra_ch_delete_do1.v_fee_do_aire.active then begin fra_ch_delete_do1.v_fee_do_aire.Requery; fra_ch_delete_do1.v_fee_do_aire_sum.Requery; end; end; 4: begin if fra_ch_delete_do1.v_fee_do_airi.active then begin fra_ch_delete_do1.v_fee_do_airi.Requery; fra_ch_delete_do1.v_fee_do_airi_sum.Requery; end; end; 5: begin end; end; end; if if_ch_delete_do then begin case delete_do_type_num of 1,2,3,4: begin if fra_ch_add_do1.t_op_seae.Active then begin fra_ch_add_do1.t_ch_fee.Requery(); fra_ch_add_do1.t_ch_fee_sum.Requery(); end; end; end; end; delete_do_type_num:=0; if_ch_delete_do:=false; end; procedure Tfrm_ch_accept_shen.RxDBLookupCombo1Enter(Sender: TObject); begin if fra_ch_delete_do1.v_fee_do_seae.IsEmpty and fra_ch_delete_do1.v_fee_do_seai.IsEmpty and fra_ch_delete_do1.v_fee_do_aire.IsEmpty and fra_ch_delete_do1.v_fee_do_airi.IsEmpty then begin RxDBLookupCombo1.ReadOnly:=false; RxDBLookupCombo2.ReadOnly:=false; end else begin RxDBLookupCombo1.ReadOnly:=true; RxDBLookupCombo2.ReadOnly:=true; end; end; procedure Tfrm_ch_accept_shen.dxDBGrid1Column2CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); begin if (ANode.strings[dxDBGrid1Column2.Index]='申请收款')or (ANode.strings[dxDBGrid1Column2.Index]='批准修改') then AColor :=clwhite else if (ANode.strings[dxDBGrid1Column2.Index]='提交申请')or (ANode.strings[dxDBGrid1Column2.Index]='申请修改') then AColor :=clyellow else if (ANode.strings[dxDBGrid1Column2.Index]='禁止修改')or (ANode.strings[dxDBGrid1Column2.Index]='驳回申请')then AColor :=clred else if (ANode.strings[dxDBGrid1Column2.Index]='批准收款')or (ANode.strings[dxDBGrid1Column2.Index]='收款完毕') then AColor :=$00DDF21C; AFont.Color:=clblack; end; procedure Tfrm_ch_accept_shen.DBEdit1Change(Sender: TObject); begin if (DBEdit1.Text='') or (DBEdit1.Text='申请开票') or (DBEdit1.Text='批准修改')then DBEdit1.Color:=clwhite else if (DBEdit1.Text='提交申请') or (DBEdit1.Text='申请修改') then DBEdit1.Color:=clyellow else if (DBEdit1.Text='禁止修改') or (DBEdit1.Text='驳回申请') then DBEdit1.Color:=clred else if (DBEdit1.Text='批准开票') or (DBEdit1.Text='开出发票') then DBEdit1.Color:=$00DDF21C; end; procedure Tfrm_ch_accept_shen.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose:=frm_close_query(t_ch_accept); end; procedure Tfrm_ch_accept_shen.bsSkinButton9Click(Sender: TObject); var aQuery:TAdoQuery; strbs,strwt,strmb:WideString; begin if t_ch_accept.IsEmpty then exit; table_post(t_ch_accept); if strtobool(get_parameters_value(27,'false'))then begin if (t_ch_accept.FieldByName('申请状态').asstring='提交申请')or (t_ch_accept.FieldByName('申请状态').asstring='驳回申请')or (t_ch_accept.FieldByName('申请状态').asstring='申请收款')or (t_ch_accept.FieldByName('申请状态').asstring='批准修改')then begin if application.MessageBox('打印后你就不可以进行更改了,你确认打印吗?','警告:',MB_OKCANCEL)<>IDOK then exit; try modify_all:=true; edittrue:=true; t_ch_accept.Edit; t_ch_accept['申请状态']:='提交申请'; t_ch_accept['审核人']:=employee; t_ch_accept['审核日期']:=now; t_ch_accept.FieldByName('打印次数').AsInteger:=t_ch_accept.FieldByName('打印次数').AsInteger+1; t_ch_accept.post; edittrue:=false; finally modify_all:=false; edittrue:=false; end; end; end else begin try modify_all:=true; edittrue:=true; t_ch_accept.Edit; t_ch_accept.FieldByName('打印次数').AsInteger:=t_ch_accept.FieldByName('打印次数').AsInteger+1; t_ch_accept.post; edittrue:=false; finally modify_all:=false; edittrue:=false; end; end; memtblprint.close; memtblprint.Open; aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; sql.Add('select distinct 委托编号,业务编号,主提单号 from v_op_bscard where 编号 in (select 业务编号 from t_ch_fee_do where 工作编号='''+t_ch_accept['申请编号']+''')'); Open; first; while not eof do begin if strwt='' then strwt:=fieldbyname('委托编号').AsString else strwt:=strwt+'/'+fieldbyname('委托编号').AsString; if strbs='' then strbs:=fieldbyname('业务编号').AsString else strbs:=strbs+'/'+fieldbyname('业务编号').AsString; if strmb='' then strmb:=fieldbyname('主提单号').AsString else strmb:=strmb+'/'+fieldbyname('主提单号').AsString; Next; end; memtblprint.Edit; memtblprint.fieldbyname('bsno').AsString:=strbs; memtblprint.fieldbyname('wtno').AsString:=strwt; memtblprint.fieldbyname('mblno').AsString:=strmb; memtblprint.post; end; finally FreeAndNil(aQuery); end; if StrToBool(get_parameters_value(85,'false')) then begin sys_print('业务收款申请',2,t_ch_accept1,memtblprint1,nil,nil,fra_ch_delete_do1.v_fee_do_bscard1,nil,nil,nil,t_ch_accept1,p_accept_bill1,nil); end else begin sys_print('业务收款申请',2,t_ch_accept1,memtblprint1,nil,nil,fra_ch_delete_do1.v_fee_do_seae1,fra_ch_delete_do1.v_fee_do_seai1,fra_ch_delete_do1.v_fee_do_aire1,fra_ch_delete_do1.v_fee_do_airi1,t_ch_accept1,p_accept_bill1,nil); end; end; procedure Tfrm_ch_accept_shen.bsSkinButton8Click(Sender: TObject); var aAdoQuery:TAdoQuery; begin if t_ch_accept.FieldByName('收款方式').asstring<>'支票' then begin showmessage('只有收款方式为支票才可以进行支票交接'); exit; end; if t_ch_accept.IsEmpty then exit; if (t_ch_accept.FieldByName('申请状态').asstring='批准收款')or (t_ch_accept.FieldByName('申请状态').asstring='禁止修改')or (t_ch_accept.FieldByName('申请状态').asstring='收款完毕')or (t_ch_accept.FieldByName('申请状态').asstring='申请修改')then begin showmessage('当前帐单状态为:'+t_ch_accept.FieldByName('申请状态').asstring+'不允许修改!!'); exit; end; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;sql.Clear; SQL.Add('Update t_ch_accept set 交接人=:emp,交接日期=:adate'); SQL.Add('Where 申请编号=:bsno'); Parameters.ParamByName('bsno').Value:=t_ch_accept.fieldByName('申请编号').Value; Parameters.ParamByName('emp').Value:=employee; Parameters.ParamByName('adate').Value:=date; ExecSql; finally t_ch_accept.refresh; Free; showmessage('交接完成'); end; end; procedure Tfrm_ch_accept_shen.bsSkinButton10Click(Sender: TObject); begin try frm_ch_shen_query:=tfrm_ch_shen_query.Create (self); shen_query_type:=8; shen_query_limited:='1003'; shen_query_op_limited:='1004'; frm_ch_shen_query.ShowModal; finally frm_ch_shen_query.Free; end; end; procedure Tfrm_ch_accept_shen.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_ch_accept_shen.t_ch_acceptAfterDelete(DataSet: TDataSet); begin if fra_ch_add_do1.t_op_seae.Active then fra_ch_add_do1.t_op_seae.Requery(); if fra_ch_add_do1.t_op_seai.Active then fra_ch_add_do1.t_op_seai.Requery(); if fra_ch_add_do1.t_op_aire.Active then fra_ch_add_do1.t_op_aire.Requery(); if fra_ch_add_do1.t_op_airi.Active then fra_ch_add_do1.t_op_airi.Requery(); end; procedure Tfrm_ch_accept_shen.DBEdit14KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit1); end; procedure Tfrm_ch_accept_shen.DBEdit1KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo1); end; procedure Tfrm_ch_accept_shen.RxDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo2); end; procedure Tfrm_ch_accept_shen.RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); begin key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox1); end; procedure Tfrm_ch_accept_shen.bsSkinDBCheckRadioBox1KeyPress( Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit4); end; procedure Tfrm_ch_accept_shen.DBEdit4KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit2); end; procedure Tfrm_ch_accept_shen.DBEdit2KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit6); end; procedure Tfrm_ch_accept_shen.DBEdit6KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit8); end; procedure Tfrm_ch_accept_shen.DBEdit8KeyPress(Sender: TObject; var Key: Char); begin key_wwDBComboBox(Key,wwDBComboBox1); end; procedure Tfrm_ch_accept_shen.DBEdit3KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit7); end; procedure Tfrm_ch_accept_shen.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_ch_accept_shen.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_ch_accept_shen.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,6); end; procedure Tfrm_ch_accept_shen.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_ch_accept_shen.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort(Column,t_ch_accept,'申请编号'); end; procedure Tfrm_ch_accept_shen.wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo1); end; procedure Tfrm_ch_accept_shen.DBEdit7KeyPress(Sender: TObject; var Key: Char); begin key_wwDBDateTimePicker(Key,wwDBDateTimePicker1); end; procedure Tfrm_ch_accept_shen.bsSkinPanel2Resize(Sender: TObject); var i:integer; begin i:=round(bsSkinPanel2.Width/12); bsSkinButton10.Width:=i; bsSkinButton9.Width:=i; bsSkinButton2.Width:=i; bsSkinButton3.Width:=i; bsSkinButton4.Width:=i; bsSkinButton1.Width:=i; bsSkinButton11.Width:=i; bsSkinButton6.Width:=i; bsSkinButton38.Width:=i; bsSkinButton7.Width:=i; bsSkinButton8.Width:=i; bsSkinButton12.Left:=bsSkinPanel2.Width-bsSkinButton12.Width-20; end; procedure Tfrm_ch_accept_shen.wwDBComboBox1KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit3); end; procedure Tfrm_ch_accept_shen.bsSkinButton12Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton12.ClientToScreen(Point(0,bsSkinButton12.Height)); PopupMenu3.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_ch_accept_shen.N17Click(Sender: TObject); begin t_ch_accept.Close; t_ch_accept.SQL.clear; t_ch_accept.SQL.Add('select * from t_ch_accept where 申请状态 in ('+''''+'申请收款'+'''' +') and ' +open_data('1003','申请人','no','no','no','no') +'order by 申请编号 desc'); t_ch_accept.open; end; procedure Tfrm_ch_accept_shen.N34Click(Sender: TObject); begin t_ch_accept.Close; t_ch_accept.SQL.clear; t_ch_accept.SQL.Add('select * from t_ch_check where 申请状态 in ('+''''+'驳回申请'+'''' +','+''''+'禁止修改'+''''+') and ' +open_data('1003','申请人','no','no','no','no') +'order by 申请编号 desc'); t_ch_accept.open; end; procedure Tfrm_ch_accept_shen.N36Click(Sender: TObject); begin t_ch_accept.Close; t_ch_accept.SQL.clear; t_ch_accept.SQL.Add('select * from t_ch_check where 申请状态 in ('+''''+'提交申请'+'''' +','+''''+'申请修改'+''''+') and ' +open_data('1003','申请人','no','no','no','no') +'order by 申请编号 desc'); t_ch_accept.open; end; procedure Tfrm_ch_accept_shen.N6Click(Sender: TObject); begin t_ch_accept.Close; t_ch_accept.SQL.clear; t_ch_accept.SQL.Add('select * from t_ch_check where 申请状态 in ('+''''+'批准收款'+'''' +','+''''+'禁止修改'+''''+') and ' +open_data('1003','申请人','no','no','no','no') +'order by 申请编号 desc'); t_ch_accept.open; end; procedure Tfrm_ch_accept_shen.N4Click(Sender: TObject); begin t_ch_accept.Close; t_ch_accept.SQL.clear; t_ch_accept.SQL.Add('select * from t_ch_check where 申请状态 in ('+''''+'收款完毕'+''''+') and ' +open_data('1003','申请人','no','no','no','no') +'order by 申请编号 desc'); t_ch_accept.open; end; procedure Tfrm_ch_accept_shen.bsSkinButton7Click(Sender: TObject); var afield : variant; i: Integer; begin if t_ch_accept.IsEmpty then exit; try afield := vararraycreate([0,t_ch_accept.fieldcount-1],varvariant); for i := 0 to (t_ch_accept.fieldcount-1) do begin afield[i] :=t_ch_accept.fields[i].value ; end; t_ch_accept.insert; for i := 0 to (t_ch_accept.fieldcount-1) do begin if t_ch_accept.fields[i].FieldName<>'申请编号'then t_ch_accept.fields[i].value := afield[i] ; end; t_ch_accept['相关号码']:=''; t_ch_accept['申请状态']:='申请收款'; t_ch_accept['申请人']:=employee; t_ch_accept['申请日期']:=now; t_ch_accept['自动']:=1; t_ch_accept['申请金额']:=0; t_ch_accept['实际金额']:=0; t_ch_accept['虚开金额']:=0; t_ch_accept['美元金额']:=0; t_ch_accept['人民币金额']:=0; t_ch_accept['审核人']:=''; t_ch_accept['审核日期']:=null; t_ch_accept['开出人']:=''; t_ch_accept['开出日期']:=null; t_ch_accept['支票抬头']:=''; t_ch_accept['申请原因']:=''; t_ch_accept['帐单编号']:=''; bsSkinNotebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; except if t_ch_accept.state=dsinsert then t_ch_accept.cancel; showmessage('复制添加失败!!'); end; end; procedure Tfrm_ch_accept_shen.fra_ch_add_do1bsSkinButton10Click( Sender: TObject); begin fra_ch_add_do1.bsSkinButton10Click(Sender); end; procedure Tfrm_ch_accept_shen.bsSkinNotebook1PageChanged(Sender: TObject); begin if not ch_accept_shen_open then exit; if bsSkinNotebook1.PageIndex<>1 then exit; { if StrToBool(get_parameters_value(85,'false')) then begin fra_ch_delete_do1.v_fee_do_bscard.close; fra_ch_delete_do1.v_fee_do_bscard.SQL.clear; fra_ch_delete_do1.v_fee_do_bscard.sql.add('select * from v_fee_do_bscard ' +'where 工作编号='''+t_ch_accept.fieldbyname('申请编号').asstring+''' order by 编号,费用名称'); fra_ch_delete_do1.v_fee_do_bscard.Open; fra_ch_delete_do1.v_fee_do_bscard_sum.close; fra_ch_delete_do1.v_fee_do_bscard_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_bscard_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_bscard ' +'where 工作编号='''+t_ch_accept.fieldbyname('申请编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_bscard_sum.Open; end else begin fra_ch_delete_do1.v_fee_do_seae.close; fra_ch_delete_do1.v_fee_do_seae.SQL.clear; fra_ch_delete_do1.v_fee_do_seae.sql.add('select * from v_fee_do_seae ' +'where 工作编号='''+t_ch_accept.fieldbyname('申请编号').asstring+''' order by 编号,费用名称'); fra_ch_delete_do1.v_fee_do_seae.Open; fra_ch_delete_do1.v_fee_do_seai.close; fra_ch_delete_do1.v_fee_do_seai.SQL.clear; fra_ch_delete_do1.v_fee_do_seai.sql.add('select * from v_fee_do_seai ' +'where 工作编号='''+t_ch_accept.fieldbyname('申请编号').asstring+''' order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_seai.Open; fra_ch_delete_do1.v_fee_do_aire.close; fra_ch_delete_do1.v_fee_do_aire.SQL.clear; fra_ch_delete_do1.v_fee_do_aire.sql.add('select * from v_fee_do_aire ' +'where 工作编号='''+t_ch_accept.fieldbyname('申请编号').asstring+''' order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_aire.Open; fra_ch_delete_do1.v_fee_do_airi.close; fra_ch_delete_do1.v_fee_do_airi.SQL.clear; fra_ch_delete_do1.v_fee_do_airi.sql.add('select * from v_fee_do_airi ' +'where 工作编号='''+t_ch_accept.fieldbyname('申请编号').asstring+''' order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_airi.Open; fra_ch_delete_do1.v_fee_do_seae_sum.close; fra_ch_delete_do1.v_fee_do_seae_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_seae_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_seae ' +'where 工作编号='''+t_ch_accept.fieldbyname('申请编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_seae_sum.Open; fra_ch_delete_do1.v_fee_do_seai_sum.close; fra_ch_delete_do1.v_fee_do_seai_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_seai_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_seai ' +'where 工作编号='''+t_ch_accept.fieldbyname('申请编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_seai_sum.Open; fra_ch_delete_do1.v_fee_do_aire_sum.close; fra_ch_delete_do1.v_fee_do_aire_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_aire_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开航日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_aire ' +'where 工作编号='''+t_ch_accept.fieldbyname('申请编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),开航日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开航日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_aire_sum.Open; fra_ch_delete_do1.v_fee_do_airi_sum.close; fra_ch_delete_do1.v_fee_do_airi_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_airi_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_airi ' +'where 工作编号='''+t_ch_accept.fieldbyname('申请编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_airi_sum.Open; end; } end; procedure Tfrm_ch_accept_shen.bsSkinButton38Click(Sender: TObject); var book1:Tbookmark; begin if t_ch_accept.IsEmpty then exit; book1:=t_ch_accept.GetBookmark; t_ch_accept.Requery; t_ch_accept.GotoBookmark(book1); end; procedure Tfrm_ch_accept_shen.fra_ch_delete_do1N1Click(Sender: TObject); begin fra_ch_delete_do1.N1Click(Sender); end; procedure Tfrm_ch_accept_shen.fra_ch_add_do1bsSkinButton1Click( Sender: TObject); begin fra_ch_add_do1.bsSkinButton1Click(Sender); end; procedure Tfrm_ch_accept_shen.fra_ch_add_do1bsSkinButton8Click( Sender: TObject); begin fra_ch_add_do1.bsSkinButton8Click(Sender); end; procedure Tfrm_ch_accept_shen.fra_ch_add_do1MenuItem1Click( Sender: TObject); begin fra_ch_add_do1.MenuItem1Click(Sender); end; procedure Tfrm_ch_accept_shen.DBEdit17KeyPress(Sender: TObject; var Key: Char); var aAdoQuery:TAdoQuery; begin if key=#13 then begin key:=#0; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;Sql.Clear; sql.Add('Select * from t_ch_invoice'); sql.Add('where (是否收费=0 or 是否收费 is null) and (是否废除=0 or 是否废除 is null ) and 发票号码=:invno'); Parameters.ParamByName('invno').Value:=DBEdit17.Text; Open; if not isEmpty then begin t_ch_accept.Edit; t_ch_accept.FieldByName('发票抬头').Value:=fieldByName('发票抬头').asstring; t_ch_accept.FieldByName('船名航次').Value:=fieldByName('船名航次').asstring; t_ch_accept.FieldByName('开船日期').Value:=fieldByName('开船日期').value; t_ch_accept.FieldByName('提单号').Value:=fieldByName('提单号').asstring; t_ch_accept.FieldByName('启运港').Value:=fieldByName('启运港').asstring; t_ch_accept.FieldByName('卸货港').Value:=fieldByName('卸货港').asstring; t_ch_accept.FieldByName('目的港').Value:=fieldByName('目的港').asstring; t_ch_accept.FieldByName('费用列表').Value:=fieldByName('费用列表').asstring; t_ch_accept.FieldByName('金额列表').Value:=fieldByName('金额列表').asstring; t_ch_accept.post; end; finally Free; end; end; end; end.