unit u_ch_fee_check_railway; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, DB, ADODB, dxDBTLCl, dxGrClms, StdCtrls, DBCtrls, RxLookup, wwdbdatetimepicker, bsSkinCtrls, Mask, u_fee_check, ComCtrls, bsSkinTabs, dxDBGrid, dxTL, dxDBCtrl, dxCntner, XPMenu, Menus, wwdblook, wwdbedit, Wwdotdot, Wwdbcomb,inifiles, bsSkinBoxCtrls, ExtCtrls; type Tfrm_ch_fee_check_railway = class(TForm) bsSkinPanel1: TbsSkinPanel; bsSkinPanel2: TbsSkinPanel; bsSkinButton10: TbsSkinButton; t_op_state: TADOQuery; t_op_state1: TDataSource; t_op_railway1: TDataSource; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinTabSheet2: TbsSkinTabSheet; bsSkinTabSheet3: TbsSkinTabSheet; fra_fee_check1: Tfra_fee_check; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridDateColumn; dxDBGrid1Column5: TdxDBGridDateColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column17: TdxDBGridMaskColumn; dxDBGrid1Column18: TdxDBGridMaskColumn; dxDBGrid1Column19: TdxDBGridColumn; dxDBGrid1Column21: TdxDBGridMaskColumn; dxDBGrid1Column22: TdxDBGridMaskColumn; dxDBGrid1Column23: TdxDBGridMaskColumn; dxDBGrid1Column24: TdxDBGridMaskColumn; dxDBGrid1Column26: TdxDBGridMaskColumn; dxDBGrid1Column25: TdxDBGridDateColumn; dxDBGrid2: TdxDBGrid; dxDBGrid2Column1: TdxDBGridMaskColumn; dxDBGrid2Column2: TdxDBGridCheckColumn; dxDBGrid2Column4: TdxDBGridMaskColumn; dxDBGrid2Column3: TdxDBGridDateColumn; dxDBGrid2Column6: TdxDBGridColumn; dxDBGrid2Column7: TdxDBGridColumn; dxDBGrid2Column5: TdxDBGridMaskColumn; bsSkinPanel3: TbsSkinPanel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; Label11: TLabel; Label12: TLabel; Label13: TLabel; Label14: TLabel; Label15: TLabel; DBEdit5: TDBEdit; RxDBLookupCombo2: TRxDBLookupCombo; DBEdit6: TDBEdit; RxDBLookupCombo3: TRxDBLookupCombo; DBEdit10: TDBEdit; DBEdit11: TDBEdit; dbedtt: TDBEdit; RxDBLookupCombo4: TRxDBLookupCombo; DBEdit14: TDBEdit; dxDBGrid1Column27: TdxDBGridColumn; DBEdit18: TDBEdit; Label65: TLabel; DBEdit4: TDBEdit; bsSkinButton7: TbsSkinButton; bsSkinButton5: TbsSkinButton; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; XPMenu1: TXPMenu; bsSkinButton1: TbsSkinButton; PopupMenu3: TPopupMenu; N37: TMenuItem; N38: TMenuItem; N17: TMenuItem; N18: TMenuItem; N34: TMenuItem; N35: TMenuItem; N36: TMenuItem; t_op_railway: TADOStoredProc; N1: TMenuItem; N2: TMenuItem; N3: TMenuItem; N4: TMenuItem; N5: TMenuItem; N6: TMenuItem; N7: TMenuItem; N8: TMenuItem; bsSkinGroupBox10: TbsSkinGroupBox; Label51: TLabel; Label52: TLabel; Label1: TLabel; Label23: TLabel; Label2: TLabel; Label27: TLabel; Label42: TLabel; Label17: TLabel; Label16: TLabel; wwDBDateTimePicker12: TwwDBDateTimePicker; wwDBComboBox2: TwwDBComboBox; RxDBLookupCombo7: TRxDBLookupCombo; RxDBLookupCombo8: TRxDBLookupCombo; wwDBComboBox3: TwwDBComboBox; RxDBLookupCombo29: TRxDBLookupCombo; RxDBLookupCombo30: TRxDBLookupCombo; RxDBLookupCombo13: TRxDBLookupCombo; wwDBComboBox4: TwwDBComboBox; bsSkinGroupBox2: TbsSkinGroupBox; Label85: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label18: TLabel; Label36: TLabel; Label38: TLabel; Label40: TLabel; Label39: TLabel; Label43: TLabel; Label44: TLabel; Label45: TLabel; Label46: TLabel; Label47: TLabel; wwDBLookupCombo52: TwwDBLookupCombo; DBEdit1: TDBEdit; DBEdit7: TDBEdit; wwDBLookupCombo2: TwwDBLookupCombo; DBEdit9: TDBEdit; DBEdit2: TDBEdit; RxDBLookupCombo1: TRxDBLookupCombo; RxDBLookupCombo5: TRxDBLookupCombo; wwDBComboBox1: TwwDBComboBox; DBEdit21: TDBEdit; DBEdit81: TDBEdit; wwDBLookupCombo61: TwwDBLookupCombo; DBEdit82: TDBEdit; DBEdit83: TDBEdit; RxDBLookupCombo6: TRxDBLookupCombo; DBEdit22: TDBEdit; bsSkinGroupBox3: TbsSkinGroupBox; Label22: TLabel; Label19: TLabel; Label20: TLabel; Label26: TLabel; Label60: TLabel; Label61: TLabel; Label55: TLabel; wwDBDateTimePicker4: TwwDBDateTimePicker; DBEdit12: TDBEdit; DBEdit13: TDBEdit; wwDBDateTimePicker6: TwwDBDateTimePicker; wwDBDateTimePicker5: TwwDBDateTimePicker; wwDBDateTimePicker14: TwwDBDateTimePicker; wwDBDateTimePicker15: TwwDBDateTimePicker; bsSkinGroupBox9: TbsSkinGroupBox; Label28: TLabel; Label29: TLabel; Label30: TLabel; Label31: TLabel; Label32: TLabel; Label33: TLabel; Label48: TLabel; Label49: TLabel; DBEdit17: TDBEdit; DBEdit19: TDBEdit; wwDBDateTimePicker7: TwwDBDateTimePicker; wwDBDateTimePicker8: TwwDBDateTimePicker; DBEdit20: TDBEdit; wwDBDateTimePicker9: TwwDBDateTimePicker; wwDBDateTimePicker1: TwwDBDateTimePicker; wwDBDateTimePicker10: TwwDBDateTimePicker; bsSkinGroupBox4: TbsSkinGroupBox; Label21: TLabel; Label24: TLabel; Label25: TLabel; Label34: TLabel; Label35: TLabel; Label50: TLabel; Label37: TLabel; Label95: TLabel; DBEdit3: TDBEdit; DBEdit15: TDBEdit; wwDBDateTimePicker2: TwwDBDateTimePicker; wwDBDateTimePicker3: TwwDBDateTimePicker; DBEdit16: TDBEdit; wwDBDateTimePicker11: TwwDBDateTimePicker; wwDBLookupCombo5: TwwDBLookupCombo; wwDBLookupCombo6: TwwDBLookupCombo; DBEdit44: TDBEdit; bsSkinGroupBox5: TbsSkinGroupBox; Label104: TLabel; Label56: TLabel; DBRichEdit3: TDBRichEdit; DBMemo1: TDBMemo; dxDBGrid1Column28: TdxDBGridColumn; dxDBGrid1Column29: TdxDBGridColumn; dxDBGrid1Column30: TdxDBGridColumn; dxDBGrid1Column31: TdxDBGridColumn; dxDBGrid1Column32: TdxDBGridColumn; dxDBGrid1Column33: TdxDBGridColumn; dxDBGrid1Column34: TdxDBGridColumn; dxDBGrid1Column35: TdxDBGridColumn; dxDBGrid1Column36: TdxDBGridColumn; dxDBGrid1Column37: TdxDBGridColumn; dxDBGrid1Column38: TdxDBGridColumn; Panel3: TPanel; Label41: TLabel; bsSkinComboBox1: TbsSkinComboBox; bsSkinEdit1: TbsSkinEdit; bsSkinButton8: TbsSkinButton; bsSkinButton2: TbsSkinButton; N9: TMenuItem; N19: TMenuItem; procedure FormShow(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton10Click(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 dxDBGrid1Column3CustomDraw(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 bsSkinButton7Click(Sender: TObject); 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 bsSkinButton1Click(Sender: TObject); procedure N37Click(Sender: TObject); procedure N17Click(Sender: TObject); procedure N34Click(Sender: TObject); procedure N36Click(Sender: TObject); procedure N2Click(Sender: TObject); procedure N4Click(Sender: TObject); procedure N5Click(Sender: TObject); procedure N8Click(Sender: TObject); procedure fra_fee_check1bsSkinButton1Click(Sender: TObject); procedure bsSkinEdit1KeyPress(Sender: TObject; var Key: Char); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure N19Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_ch_fee_check_railway: Tfrm_ch_fee_check_railway; implementation uses u_main, my_sys_function; {$R *.dfm} procedure Tfrm_ch_fee_check_railway.FormShow(Sender: TObject); var inifile1:Tinifile; begin t_op_state.close; t_op_railway.Close; t_op_railway.Parameters.ParamByName('SQLStr').value:='select * from t_op_railway where ' +open_data('0016','操作员','揽货人','no','no','no') +' and 编号 in (select 编号 from v_fee_check_railway) ' +' order by 业务编号 '; t_op_railway.open; t_op_state.open; loadreggrid(dxdbgrid1,false,caption); loadwwgrid(fra_fee_check1.wwDBGrid1,'监管车经理审核应收'); loadwwgrid(fra_fee_check1.wwDBGrid2,'监管车经理审核应付'); bsSkinPageControl1.Align:=alClient; fra_fee_check1.limited_str.text:='0016'; fra_fee_check1.chk_accept.Text:=get_parameters_value(309,'FALSE') ; fra_fee_check1.chk_pay.text:=get_parameters_value(310,'FALSE') ; // fra_fee_check1.chk_accept.Text:='FALSE'; // fra_fee_check1.chk_pay.text:='FALSE'; fra_fee_check1.ywlb.Text:='铁路运输' ; if if_open('324') then begin fra_fee_check1.t_ch_accept.DataSource:=t_op_railway1; fra_fee_check1.t_ch_accept.open; fra_fee_check1.a_shen_delete.open; fra_fee_check1.a_shen_modify_old.open; fra_fee_check1.a_shen_modify_new.open; fra_fee_check1.bsSkinPanel3.visible:=true; end else begin fra_fee_check1.bsSkinPanel3.visible:=false; end; if if_open('325') then begin fra_fee_check1.t_ch_pay.DataSource:=t_op_railway1; fra_fee_check1.t_ch_pay.open; fra_fee_check1.p_shen_delete.open; fra_fee_check1.p_shen_modify_old.open; fra_fee_check1.p_shen_modify_new.open; fra_fee_check1.bsSkinPanel5.visible:=true; end else begin fra_fee_check1.bsSkinPanel5.visible:=false; end; if fra_fee_check1.bsSkinPanel3.visible and fra_fee_check1.bsSkinPanel5.visible then begin fra_fee_check1.Panel3.Visible:=true; fra_fee_check1.t_op_gain.DataSource:=t_op_railway1; fra_fee_check1.t_op_gain.open; fra_fee_check1.bsSkinPanel9.Visible:=false; fra_fee_check1.Panel3.Height:=20; end else begin fra_fee_check1.Panel3.Visible:=false; end; if strtobool(get_parameters_value(150,'false')) then fra_fee_check1.bsSkinPanel10.Visible:=true else fra_fee_check1.bsSkinPanel10.Visible:=False; inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini'); if strtoint(get_parameters_value(197,'0'))<>0 then fra_fee_check1.bsSkinComboBox1.ItemIndex:=strtoint(get_parameters_value(197,'0'))-1 else fra_fee_check1.bsSkinComboBox1.ItemIndex:=inifile1.ReadInteger('FEE','FEEVAT',0); inifile1.Free; end; procedure Tfrm_ch_fee_check_railway.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_ch_fee_check_railway.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); savewwgrid(fra_fee_check1.wwDBGrid1,'铁路运输经理审核应收'); savewwgrid(fra_fee_check1.wwDBGrid2,'铁路运输经理审核应付'); frm_ch_fee_check_railway.Hide; frm_ch_fee_check_railway.ManualFloat(frm_ch_fee_check_railway.BoundsRect ); frm_main.freeTabs('frm_ch_fee_check_railway'); action:=cafree; frm_ch_fee_check_railway:=nil; end; procedure Tfrm_ch_fee_check_railway.bsSkinButton10Click(Sender: TObject); begin query_railway(3,'0016'); end; procedure Tfrm_ch_fee_check_railway.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 AColor:=dxgrid_color('铁路运输',ANode.Strings[dxDBGrid1Column2.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_fee_check_railway.dxDBGrid1Column3CustomDraw( 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 AColor:=dxgrid_color_fee(ANode.strings[dxDBGrid1Column3.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_fee_check_railway.bsSkinButton7Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.Parameters.ParamByName('SQLStr').value:='select * from t_op_railway where ' +open_data('0016','操作员','揽货人','no','no','no') +' and 编号 in (select 编号 from v_fee_check_railway) '; t_op_railway.open; end; procedure Tfrm_ch_fee_check_railway.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_ch_fee_check_railway.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_ch_fee_check_railway.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,61); end; procedure Tfrm_ch_fee_check_railway.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_ch_fee_check_railway.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort_pro(Column,t_op_railway,'业务编号'); end; procedure Tfrm_ch_fee_check_railway.bsSkinButton1Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton1.ClientToScreen(Point(0,bsSkinButton1.Height)); PopupMenu3.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_ch_fee_check_railway.N37Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.Parameters.ParamByName('SQLStr').value:='select * from t_op_railway where ' +open_data('0016','揽货人','操作员','客服员','no','no') +' and 编号 in (select distinct 编号 from t_op_state where 是否完成<>1) '; t_op_railway.open; end; procedure Tfrm_ch_fee_check_railway.N17Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.Parameters.ParamByName('SQLStr').value:='select * from t_op_railway where ' +open_data('0016','揽货人','操作员','客服员','no','no') +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态=' +''''+'录入状态'+''''+') '; t_op_railway.open end; procedure Tfrm_ch_fee_check_railway.N34Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.Parameters.ParamByName('SQLStr').value:='select * from t_op_railway where ' +open_data('0016','揽货人','操作员','客服员','no','no') +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'驳回提交'+''''+','+''''+'禁止修改'+''''+','+''''+'禁止删除'+''''+')) '; t_op_railway.open; end; procedure Tfrm_ch_fee_check_railway.N36Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.Parameters.ParamByName('SQLStr').value:='select * from t_op_railway where ' +open_data('0016','揽货人','操作员','客服员','no','no') +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'提交审核'+''''+','+''''+'申请修改'+''''+','+''''+'申请删除'+''''+')) '; t_op_railway.open; end; procedure Tfrm_ch_fee_check_railway.N2Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.Parameters.ParamByName('SQLStr').value:='select * from t_op_railway where ' +open_data('0016','揽货人','操作员','客服员','no','no') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee where 类型='+''''+'收'+''''+')'; t_op_railway.open; end; procedure Tfrm_ch_fee_check_railway.N4Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.Parameters.ParamByName('SQLStr').value:='select * from t_op_railway where ' +open_data('0016','揽货人','操作员','客服员','no','no') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee where 类型='+''''+'付'+''''+')'; t_op_railway.open; end; procedure Tfrm_ch_fee_check_railway.N5Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.Parameters.ParamByName('SQLStr').value:='select * from t_op_railway where ' +open_data('0016','揽货人','操作员','客服员','no','no') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee )'; t_op_railway.open; end; procedure Tfrm_ch_fee_check_railway.N8Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.Parameters.ParamByName('SQLStr').value:='select * from t_op_railway where ' +open_data('0016','揽货人','操作员','客服员','no','no') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态<>'+''''+'结算完毕'+''''+')'; t_op_railway.open; end; procedure Tfrm_ch_fee_check_railway.fra_fee_check1bsSkinButton1Click( Sender: TObject); begin fra_fee_check1.bsSkinButton1Click(Sender); end; procedure Tfrm_ch_fee_check_railway.bsSkinEdit1KeyPress(Sender: TObject; var Key: Char); var s:string; begin if Trim(bsSkinEdit1.Text)='' then Exit; if Key=#13 then begin s:='select * from t_op_railway where 主编号=编号 and ' +open_data('0006','录入人','操作员','客服员','no','no'); if (bsSkinComboBox1.ItemIndex>=0) and (Trim(bsSkinEdit1.Text)<>'') then begin s:=s+' and '+bsSkinComboBox1.Text +' like ''%'+bsSkinEdit1.Text+'%'''; end; s:=s+' '+' order by 接单日期 DESC'; t_op_railway.Close; t_op_railway.Parameters.ParamByName('SQLStr').value:=s; t_op_railway.open; end; end; procedure Tfrm_ch_fee_check_railway.bsSkinButton8Click(Sender: TObject); var i :Integer; begin if dxDBGrid1.SelectedCount>=1 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_railway.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); fra_fee_check1.bsSkinButton10Click(Sender); fra_fee_check1.bsSkinButton12Click(Sender); end; end else begin fra_fee_check1.bsSkinButton10Click(Sender); fra_fee_check1.bsSkinButton12Click(Sender); end; end; procedure Tfrm_ch_fee_check_railway.bsSkinButton2Click(Sender: TObject); var book1:Tbookmark; begin try book1:=t_op_railway.GetBookmark; t_op_railway.Requery; t_op_railway.GotoBookmark(book1); except ; end; end; procedure Tfrm_ch_fee_check_railway.N19Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.Parameters.ParamByName('SQLStr').value:='select * from t_op_railway where ' +open_data('0016','揽货人','操作员','客服员','no','no') +' and 编号 in (select distinct 编号 from t_ch_fee where 费用名称=''额外应收'' and 费用状态 in (' +''''+'提交审核'+''''+','+''''+'申请修改'+''''+','+''''+'申请删除'+''''+')) '; t_op_railway.open; end; end.