unit u_op_railway_close; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, DB, ADODB, RxLookup, StdCtrls, Mask, DBCtrls, Grids, Wwdbigrd, Wwdbgrid, dxDBGrid, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxCntner, ComCtrls, bsSkinTabs, bsSkinCtrls, XPMenu, Menus, bsSkinBoxCtrls, bsdbctrls, ExtCtrls, wwdblook, wwdbedit, Wwdotdot, Wwdbcomb, wwdbdatetimepicker; type Tfrm_op_railway_close = class(TForm) bsSkinPanel2: TbsSkinPanel; bsSkinButton5: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinTabSheet2: TbsSkinTabSheet; wwDBGrid1: TwwDBGrid; wwDBGrid2: TwwDBGrid; bsSkinPanel3: TbsSkinPanel; Label1: TLabel; Label19: TLabel; Label2: TLabel; Label17: TLabel; Label3: TLabel; Label37: TLabel; Label5: TLabel; Label38: TLabel; Label4: TLabel; Label36: TLabel; DBEdit1: TDBEdit; RxDBLookupCombo12: TRxDBLookupCombo; DBEdit2: TDBEdit; RxDBLookupCombo13: TRxDBLookupCombo; DBEdit3: TDBEdit; DBEdit8: TDBEdit; DBEdit4: TDBEdit; DBEdit9: TDBEdit; RxDBLookupCombo1: TRxDBLookupCombo; DBEdit19: TDBEdit; t_ch_accept: TADOQuery; t_ch_accept1: TDataSource; t_ch_pay: TADOQuery; t_ch_pay1: TDataSource; t_op_railway1: TDataSource; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; XPMenu1: TXPMenu; t_op_gain: TADOQuery; t_op_gain1: TDataSource; Panel2: TPanel; bsSkinStdLabel4: TbsSkinStdLabel; bsSkinStdLabel2: TbsSkinStdLabel; bsSkinStdLabel3: TbsSkinStdLabel; bsSkinStdLabel1: TbsSkinStdLabel; bsSkinStdLabel5: TbsSkinStdLabel; bsSkinStdLabel6: TbsSkinStdLabel; bsSkinStdLabel7: TbsSkinStdLabel; bsSkinStdLabel8: TbsSkinStdLabel; bsSkinStdLabel9: TbsSkinStdLabel; bsSkinStdLabel10: TbsSkinStdLabel; bsSkinDBEdit6: TbsSkinDBEdit; bsSkinDBEdit4: TbsSkinDBEdit; bsSkinDBEdit1: TbsSkinDBEdit; bsSkinDBEdit3: TbsSkinDBEdit; bsSkinDBEdit5: TbsSkinDBEdit; bsSkinDBEdit2: TbsSkinDBEdit; bsSkinDBEdit8: TbsSkinDBEdit; bsSkinDBEdit7: TbsSkinDBEdit; bsSkinDBEdit9: TbsSkinDBEdit; bsSkinDBEdit10: TbsSkinDBEdit; bsSkinButton2: TbsSkinButton; PopupMenu3: TPopupMenu; N37: TMenuItem; N38: TMenuItem; N1: TMenuItem; N2: TMenuItem; N4: TMenuItem; N3: TMenuItem; N17: TMenuItem; N18: TMenuItem; N34: TMenuItem; N35: TMenuItem; N36: TMenuItem; N6: TMenuItem; N5: TMenuItem; N7: TMenuItem; N8: TMenuItem; N9: TMenuItem; N19: TMenuItem; t_op_railway: TADOQuery; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridDateColumn; dxDBGrid1Column27: TdxDBGridColumn; 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; dxDBGrid1Column28: TdxDBGridColumn; dxDBGrid1Column29: TdxDBGridColumn; dxDBGrid1Column30: TdxDBGridColumn; dxDBGrid1Column31: TdxDBGridColumn; dxDBGrid1Column32: TdxDBGridColumn; dxDBGrid1Column33: TdxDBGridColumn; dxDBGrid1Column34: TdxDBGridColumn; dxDBGrid1Column35: TdxDBGridColumn; bsSkinTabSheet3: TbsSkinTabSheet; bsSkinPanel1: TbsSkinPanel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; Label11: TLabel; Label12: TLabel; Label13: TLabel; Label14: TLabel; Label15: TLabel; Label65: TLabel; DBEdit5: TDBEdit; RxDBLookupCombo2: TRxDBLookupCombo; DBEdit6: TDBEdit; RxDBLookupCombo3: TRxDBLookupCombo; DBEdit10: TDBEdit; DBEdit11: TDBEdit; dbedtt: TDBEdit; RxDBLookupCombo4: TRxDBLookupCombo; DBEdit14: TDBEdit; DBEdit18: TDBEdit; DBEdit7: TDBEdit; bsSkinGroupBox10: TbsSkinGroupBox; Label51: TLabel; Label52: TLabel; Label16: TLabel; Label23: TLabel; Label18: TLabel; Label27: TLabel; Label42: TLabel; Label20: TLabel; Label21: TLabel; wwDBDateTimePicker12: TwwDBDateTimePicker; wwDBComboBox2: TwwDBComboBox; RxDBLookupCombo7: TRxDBLookupCombo; RxDBLookupCombo8: TRxDBLookupCombo; wwDBComboBox3: TwwDBComboBox; RxDBLookupCombo29: TRxDBLookupCombo; RxDBLookupCombo30: TRxDBLookupCombo; RxDBLookupCombo5: TRxDBLookupCombo; wwDBComboBox4: TwwDBComboBox; bsSkinGroupBox2: TbsSkinGroupBox; Label85: TLabel; Label22: TLabel; Label24: TLabel; Label25: TLabel; Label26: TLabel; Label28: TLabel; Label29: TLabel; Label40: TLabel; Label39: TLabel; Label43: TLabel; Label44: TLabel; Label45: TLabel; Label46: TLabel; Label47: TLabel; wwDBLookupCombo52: TwwDBLookupCombo; DBEdit12: TDBEdit; DBEdit13: TDBEdit; wwDBLookupCombo2: TwwDBLookupCombo; DBEdit15: TDBEdit; DBEdit16: TDBEdit; RxDBLookupCombo6: TRxDBLookupCombo; RxDBLookupCombo9: TRxDBLookupCombo; wwDBComboBox1: TwwDBComboBox; DBEdit21: TDBEdit; DBEdit81: TDBEdit; wwDBLookupCombo61: TwwDBLookupCombo; DBEdit82: TDBEdit; DBEdit83: TDBEdit; RxDBLookupCombo10: TRxDBLookupCombo; DBEdit22: TDBEdit; bsSkinGroupBox3: TbsSkinGroupBox; Label30: TLabel; Label31: TLabel; Label32: TLabel; Label33: TLabel; Label60: TLabel; Label61: TLabel; Label55: TLabel; wwDBDateTimePicker4: TwwDBDateTimePicker; DBEdit17: TDBEdit; DBEdit20: TDBEdit; wwDBDateTimePicker6: TwwDBDateTimePicker; wwDBDateTimePicker5: TwwDBDateTimePicker; wwDBDateTimePicker14: TwwDBDateTimePicker; wwDBDateTimePicker15: TwwDBDateTimePicker; bsSkinGroupBox9: TbsSkinGroupBox; Label34: TLabel; Label35: TLabel; Label41: TLabel; Label48: TLabel; Label49: TLabel; Label50: TLabel; Label53: TLabel; Label54: TLabel; DBEdit23: TDBEdit; DBEdit24: TDBEdit; wwDBDateTimePicker7: TwwDBDateTimePicker; wwDBDateTimePicker8: TwwDBDateTimePicker; DBEdit25: TDBEdit; wwDBDateTimePicker9: TwwDBDateTimePicker; wwDBDateTimePicker1: TwwDBDateTimePicker; wwDBDateTimePicker10: TwwDBDateTimePicker; bsSkinGroupBox4: TbsSkinGroupBox; Label56: TLabel; Label57: TLabel; Label58: TLabel; Label59: TLabel; Label62: TLabel; Label63: TLabel; Label64: TLabel; Label95: TLabel; DBEdit26: TDBEdit; DBEdit27: TDBEdit; wwDBDateTimePicker2: TwwDBDateTimePicker; wwDBDateTimePicker3: TwwDBDateTimePicker; DBEdit28: TDBEdit; wwDBDateTimePicker11: TwwDBDateTimePicker; wwDBLookupCombo5: TwwDBLookupCombo; wwDBLookupCombo6: TwwDBLookupCombo; DBEdit44: TDBEdit; dxDBGrid1Column36: TdxDBGridColumn; bsSkinButton11: TbsSkinButton; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton5Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); 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 dxDBGrid1DblClick(Sender: TObject); procedure wwDBGrid1DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState); procedure wwDBGrid2DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton8Click(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 bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure FormResize(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 Panel2Resize(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure N37Click(Sender: TObject); procedure N17Click(Sender: TObject); procedure N34Click(Sender: TObject); procedure N36Click(Sender: TObject); procedure N1Click(Sender: TObject); procedure N4Click(Sender: TObject); procedure N5Click(Sender: TObject); procedure N7Click(Sender: TObject); procedure N19Click(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_op_railway_close: Tfrm_op_railway_close; implementation uses u_main, u_op_close_select, u_op_close_all, u_op_open_select, u_op_open_all, my_sys_function, u_piliang_railway_state; {$R *.dfm} procedure Tfrm_op_railway_close.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_op_railway_close.Hide; frm_op_railway_close.ManualFloat(frm_op_railway_close.BoundsRect ); frm_main.freeTabs('frm_op_railway_close'); action:=cafree; frm_op_railway_close:=nil; end; procedure Tfrm_op_railway_close.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_railway_close.FormShow(Sender: TObject); begin t_op_railway.Close; t_op_railway.sql.text:='select * from t_op_railway where 业务状态<>'+''''+'业务封帐'+'''' +' or 费用状态<>'+''''+'费用封帐'+''''; t_op_railway.open; t_ch_accept.open; t_ch_pay.open; t_op_gain.open; loadreggrid(dxdbgrid1,false,caption); end; procedure Tfrm_op_railway_close.bsSkinButton10Click(Sender: TObject); begin query_railway(4,'no'); end; procedure Tfrm_op_railway_close.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_op_railway_close.dxDBGrid1DblClick(Sender: TObject); begin bsSkinTabSheet2.show; end; procedure Tfrm_op_railway_close.wwDBGrid1DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState); begin fee_color(t_ch_accept,wwDBGrid1,Rect,Field); end; procedure Tfrm_op_railway_close.wwDBGrid2DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState); begin fee_color(t_ch_pay,wwDBGrid2,Rect,Field); end; procedure Tfrm_op_railway_close.bsSkinButton3Click(Sender: TObject); begin if t_op_railway.IsEmpty then exit; if (t_op_railway.fieldbyname('业务状态').asstring='业务封帐') and(t_op_railway.fieldbyname('费用状态').asstring='费用封帐')then begin showmessage('对不起业务信息的业务、费用都已经封帐,不能操作!!'); exit; end; try frm_op_close_select:=tfrm_op_close_select.Create(self); close_select_num:=6; frm_op_close_select.bsSkinCheckRadioBox3.Checked:=true; frm_op_close_select.yewu.DataSet:=t_op_railway; frm_op_close_select.accept.DataSet:=t_ch_accept; frm_op_close_select.pay.DataSet:=t_ch_pay; frm_op_close_select.ShowModal; finally frm_op_close_select.Free; end; end; procedure Tfrm_op_railway_close.bsSkinButton1Click(Sender: TObject); begin if t_op_railway.IsEmpty then exit; if (t_op_railway.fieldbyname('业务状态').asstring='业务封帐') and(t_op_railway.fieldbyname('费用状态').asstring='费用封帐')then begin showmessage('对不起业务信息的业务、费用都已经封帐,不能操作!!'); exit; end; try frm_op_close_all:=tfrm_op_close_all.Create(self); frm_op_close_all.bsSkinCheckRadioBox3.Checked:=true; frm_op_close_all.yewu.DataSet:=t_op_railway; frm_op_close_all.accept.DataSet:=t_ch_accept; frm_op_close_all.pay.DataSet:=t_ch_pay; frm_op_close_all.ShowModal; finally frm_op_close_all.Free; end; end; procedure Tfrm_op_railway_close.bsSkinButton4Click(Sender: TObject); begin if t_op_railway.IsEmpty then exit; if (t_op_railway.fieldbyname('业务状态').asstring<>'业务封帐') and(t_op_railway.fieldbyname('费用状态').asstring<>'费用封帐')then begin showmessage('对不起业务信息的业务、费用都没有封帐,不能操作!!'); exit; end; try frm_op_open_select:=tfrm_op_open_select.Create(self); open_select_num:=6; frm_op_open_select.bsSkinCheckRadioBox3.Checked:=true; frm_op_open_select.yewu.DataSet:=t_op_railway; frm_op_open_select.accept.DataSet:=t_ch_accept; frm_op_open_select.pay.DataSet:=t_ch_pay; frm_op_open_select.ShowModal; finally frm_op_open_select.Free; end; end; procedure Tfrm_op_railway_close.bsSkinButton8Click(Sender: TObject); begin if t_op_railway.IsEmpty then exit; if (t_op_railway.fieldbyname('业务状态').asstring<>'业务封帐') and(t_op_railway.fieldbyname('费用状态').asstring<>'费用封帐')then begin showmessage('对不起业务信息的业务、费用都没有封帐,不能操作!!'); exit; end; try frm_op_open_all:=tfrm_op_open_all.Create(self); frm_op_open_all.bsSkinCheckRadioBox3.Checked:=true; frm_op_open_all.yewu.DataSet:=t_op_railway; frm_op_open_all.accept.DataSet:=t_ch_accept; frm_op_open_all.pay.DataSet:=t_ch_pay; frm_op_open_all.ShowModal; finally frm_op_open_all.Free; end; end; procedure Tfrm_op_railway_close.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_op_railway_close.bsSkinButton7Click(Sender: TObject); begin if not t_op_railway.Bof then t_op_railway.Prior; end; procedure Tfrm_op_railway_close.bsSkinButton6Click(Sender: TObject); begin if not t_op_railway.eof then t_op_railway.next; end; procedure Tfrm_op_railway_close.FormResize(Sender: TObject); var i:integer; begin i:=round(bsSkinPanel2.Width/9); bsSkinButton7.Width:=i; bsSkinButton6.Width:=i; bsSkinButton10.Width:=i; bsSkinButton3.Width:=i; bsSkinButton1.Width:=i; bsSkinButton4.Width:=i; bsSkinButton8.Width:=i; bsSkinButton2.Width:=i; wwDBGrid1.Height:=round((bsSkinTabSheet2.Height-bsSkinPanel3.Height-Panel2.Height)/2); end; procedure Tfrm_op_railway_close.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_op_railway_close.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_op_railway_close.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,208); end; procedure Tfrm_op_railway_close.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_op_railway_close.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin // Column_sort_pro(Column,t_op_airtruck,'业务编号'); end; procedure Tfrm_op_railway_close.Panel2Resize(Sender: TObject); var i:integer; begin i:=round((Panel2.Width-196)/10); bsSkinDBEdit1.Width:=i; bsSkinDBEdit2.Width:=i; bsSkinDBEdit3.Width:=i; bsSkinDBEdit4.Width:=i; bsSkinDBEdit5.Width:=i; bsSkinDBEdit6.Width:=i; bsSkinDBEdit7.Width:=i; bsSkinDBEdit8.Width:=i; bsSkinDBEdit9.Width:=i; end; procedure Tfrm_op_railway_close.bsSkinButton2Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton2.ClientToScreen(Point(0,bsSkinButton2.Height)); PopupMenu3.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_railway_close.N37Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.sql.text:='select * from t_op_railway where ' +' 编号 in (select distinct 编号 from t_op_state where 是否完成<>1) '; t_op_railway.open; end; procedure Tfrm_op_railway_close.N17Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.sql.text:='select * from t_op_railway where ' +' 编号 in (select distinct 编号 from t_ch_fee where 费用状态=' +''''+'录入状态'+''''+') '; t_op_railway.open end; procedure Tfrm_op_railway_close.N34Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.sql.text:='select * from t_op_railway where ' +' 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'驳回提交'+''''+','+''''+'禁止修改'+''''+','+''''+'禁止删除'+''''+')) '; t_op_railway.open; end; procedure Tfrm_op_railway_close.N36Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.sql.text:='select * from t_op_railway where ' +' 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'提交审核'+''''+','+''''+'申请修改'+''''+','+''''+'申请删除'+''''+')) '; t_op_railway.open; end; procedure Tfrm_op_railway_close.N1Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.sql.text:='select * from t_op_railway where ' +' 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee where 类型='+''''+'收'+''''+')'; t_op_railway.open; end; procedure Tfrm_op_railway_close.N4Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.sql.text:='select * from t_op_railway where ' +' 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee where 类型='+''''+'付'+''''+')'; t_op_railway.open; end; procedure Tfrm_op_railway_close.N5Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.sql.text:='select * from t_op_railway ' +' where 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'审核通过'+''''+','+''''+'禁止修改'+''''+','+''''+'禁止删除'+'''' +','+''''+'部分结算'+''''+','+''''+'结算完毕'+''''+')) ' +' and 编号 not in (select distinct 编号 from t_ch_fee where 费用状态 not in (' +''''+'审核通过'+''''+','+''''+'禁止修改'+''''+','+''''+'禁止删除'+'''' +','+''''+'部分结算'+''''+','+''''+'结算完毕'+''''+')) '; t_op_railway.open; end; procedure Tfrm_op_railway_close.N7Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.sql.text:='select * from t_op_railway where ' +' 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee )'; t_op_railway.open; end; procedure Tfrm_op_railway_close.N19Click(Sender: TObject); begin t_op_railway.Close; t_op_railway.sql.text:='select * from t_op_railway where ' +' 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态<>'+''''+'结算完毕'+''''+')'; t_op_railway.open; end; procedure Tfrm_op_railway_close.bsSkinButton11Click(Sender: TObject); var str, bsno: widestring; i: integer; aQuery: TAdoQuery; book1: Tbookmark; begin //批量选择打印帐单 if t_op_railway.IsEmpty then exit; if dxDBGrid1.SelectedCount < 1 then begin showmessage('请选择要更新的业务!!'); exit; end; if (t_op_railway.State = dsinsert) or (t_op_railway.State = dsedit) then t_op_railway.post; try frm_piliang_railway_state := tfrm_piliang_railway_state.Create(self); t_op_railway.DisableControls; for i := 0 to dxDBGrid1.SelectedCount - 1 do begin t_op_railway.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); if str = '' then begin str := '''' + t_op_railway.fieldbyname('编号').AsString + ''''; bsno := t_op_railway.fieldbyname('编号').AsString; end else str := str + ',' + '''' + t_op_railway.fieldbyname('编号').AsString + ''''; end; str := '(' + str + ')'; str := 'select * from t_op_railway where 编号 in ' + str + ' order by 业务编号 desc '; frm_piliang_railway_state.t_op_seae.Parameters.ParamByName('SQLStr').value := str; frm_piliang_railway_state.t_op_seae.open; aQuery := createAdoQuery; try with aQuery do begin Close; sql.clear; sql.Add('select * from t_op_state where 编号=''' + bsno + ''''); open; frm_piliang_railway_state.t_op_state.LoadFromDataSet(aQuery, []); end; finally FreeAndNil(aQuery); end; frm_piliang_railway_state.ShowModal; finally t_op_railway.EnableControls; frm_piliang_railway_state.Free; frm_piliang_railway_state := nil; book1 := t_op_railway.GetBookmark; t_op_railway.Refresh; t_op_railway.GotoBookmark(book1); end; end; end.