unit u_op_railway_road; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, BusinessSkinForm, bsSkinCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB, ADODB, dxDBTLCl, dxGrClms, RxLookup, StdCtrls, wwdbdatetimepicker, Mask, wwdbedit, Wwdotdot, Wwdbcomb, DBCtrls; type Tfrm_op_railway_road = class(TForm) bsBusinessSkinForm1: TbsBusinessSkinForm; bsSkinPanel1: TbsSkinPanel; bsSkinButton5: TbsSkinButton; bsSkinNotebook1: TbsSkinNotebook; bsSkinButton2: TbsSkinButton; t_op_railway1: TDataSource; t_op_railway: TADOQuery; bsSkinPanel2: TbsSkinPanel; bsSkinPanel3: TbsSkinPanel; Edit1: TEdit; Edit2: TEdit; Label6: TLabel; Label1: TLabel; Label9: TLabel; RxDBLookupCombo2: TRxDBLookupCombo; Label3: TLabel; Edit4: TEdit; Edit3: TEdit; Label2: TLabel; Label10: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; dxDBGrid2: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGridMaskColumn4: TdxDBGridMaskColumn; dxDBGridMaskColumn5: TdxDBGridMaskColumn; dxDBGridMaskColumn6: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridDateColumn; dxDBGrid1Column17: TdxDBGridDateColumn; dxDBGrid1Column18: TdxDBGridDateColumn; dxDBGrid1Column19: TdxDBGridMaskColumn; dxDBGrid1Column20: TdxDBGridMaskColumn; dxDBGrid1Column22: TdxDBGridDateColumn; dxDBGrid1Column63: TdxDBGridMaskColumn; dxDBGrid1Column64: TdxDBGridMaskColumn; dxDBGrid1Column65: TdxDBGridDateColumn; dxDBGrid1Column66: TdxDBGridMaskColumn; dxDBGrid1Column67: TdxDBGridMaskColumn; op_type: TEdit; fee_type: TEdit; Label5: TLabel; Label7: TLabel; dxDBGrid2Column21: TdxDBGridColumn; bsSkinButton45: TbsSkinButton; bsSkinButton44: TbsSkinButton; Label4: TLabel; wwDBComboBox1: TwwDBComboBox; Label8: TLabel; wwDBDateTimePicker2: TwwDBDateTimePicker; t_ch_fee: TADOQuery; dxDBGrid2Column23: TdxDBGridColumn; dxDBGrid2Column24: TdxDBGridColumn; dxDBGrid2Column25: TdxDBGridColumn; dxDBGrid2Column26: TdxDBGridColumn; dxDBGrid2Column27: TdxDBGridColumn; dxDBGrid2Column28: TdxDBGridColumn; dxDBGrid2Column29: TdxDBGridColumn; dxDBGrid2Column30: TdxDBGridColumn; bsSkinPanel4: TbsSkinPanel; bsSkinGroupBox1: TbsSkinGroupBox; bsSkinGroupBox2: TbsSkinGroupBox; wwDBDateTimePicker3: TwwDBDateTimePicker; Label11: TLabel; Edit6: TEdit; Label12: TLabel; bsSkinButton1: TbsSkinButton; bsSkinButton3: TbsSkinButton; Label13: TLabel; Edit7: TEdit; t_op_railway_road: TADOQuery; t_op_railway_road1: TDataSource; dxDBGridroad: TdxDBGrid; dxDBGridColumn3: TdxDBGridColumn; dxDBGrid2Column3: TdxDBGridColumn; dxDBGrid2Column4: TdxDBGridColumn; dxDBGridroadColumn6: TdxDBGridColumn; dxDBGridroadColumn5: TdxDBGridColumn; dxDBGrid2Column31: TdxDBGridColumn; dxDBGrid2Column32: TdxDBGridColumn; Label14: TLabel; wwDBDateTimePicker4: TwwDBDateTimePicker; Label15: TLabel; Edit8: TEdit; Label16: TLabel; wwDBDateTimePicker5: TwwDBDateTimePicker; bsSkinButton4: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinPanel5: TbsSkinPanel; bsSkinButton10: TbsSkinButton; dxDBGrid2Column33: TdxDBGridColumn; dxDBGrid2Column34: TdxDBGridColumn; dxDBGrid2Column35: TdxDBGridColumn; RxDBLookupCombo19: TRxDBLookupCombo; Edit5: TEdit; procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton44Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton45Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure t_op_railway_roadAfterInsert(DataSet: TDataSet); procedure bsSkinButton6Click(Sender: TObject); procedure RxDBLookupCombo19Enter(Sender: TObject); procedure RxDBLookupCombo19Exit(Sender: TObject); private function fee_get_client(str:string):string; function fee_get_num(Str: String): Double; { Private declarations } public { Public declarations } end; var frm_op_railway_road: Tfrm_op_railway_road; implementation uses u_main, my_sys_function, u_data_share, u_op_shendate, u_op_givedate, u_op_railway_piliangfee; {$R *.dfm} procedure Tfrm_op_railway_road.bsSkinButton5Click(Sender: TObject); begin CLOSE; end; function Tfrm_op_railway_road.fee_get_client(str:string):string; begin end; function Tfrm_op_railway_road.fee_get_num(Str: String): Double; begin end; procedure Tfrm_op_railway_road.bsSkinButton44Click(Sender: TObject); var str:string; begin if Edit1.text<>''then str:=' and 业务编号 like '+''''+'%'+Edit1.text+'%'+''''; if Edit4.text<>''then begin str:=str+' and ( 主编号 in (select 编号 from t_op_railway where 委托编号 like '+''''+'%'+Edit4.text+'%'+'''))'; end; if Edit2.text<>''then begin str:=str+' and 车号 like '+''''+'%'+Edit2.text+'%'+''''; end; if Edit3.text<>''then begin str:=str+' and 箱号 like '+''''+'%'+Edit3.text+'%'+''''; end; if Edit5.text<>''then begin str:=str+' and 换装车号 like '+''''+'%'+Edit5.text+'%'+''''; end; if RxDBLookupCombo2.DisplayValue<>''then begin str:=str+' and 委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+''''; end; if RxDBLookupCombo19.DisplayValue<>''then begin str:=str+' and 代理='+''''+RxDBLookupCombo19.DisplayValues[1]+''''; end; if wwDBDateTimePicker1.text<>''then begin str:=str+' and 发车日期>='+''''+wwDBDateTimePicker1.text+''''; end; if wwDBDateTimePicker2.text<>''then begin str:=str+' and 发车日期<='+''''+wwDBDateTimePicker2.text+''''; end; if wwDBComboBox1.text<>''then begin if wwDBComboBox1.text='未申请代码' then str:=str+' and 代码状态='''' ' else str:=str+' and 代码状态= '+''''+wwDBComboBox1.text+''''; end; str:=str+' and '+open_data('0006','t_op_railway.录入人','t_op_railway.操作员','t_op_railway.客服员','t_op_railway.揽货人','no'); str:='select * from t_op_railway where 装运方式<>''铁路主票'' '+str+' order by 编号'; t_op_railway_road.Close; t_op_railway.close; t_op_railway.sql.clear; t_op_railway.sql.add(str); t_op_railway.open; t_op_railway_road.open; end; procedure Tfrm_op_railway_road.bsSkinButton2Click(Sender: TObject); begin t_op_railway_road.Close; query_railway(6,'0006'); t_op_railway_road.Open; end; procedure Tfrm_op_railway_road.bsSkinButton45Click(Sender: TObject); begin Edit1.text:=''; Edit2.text:=''; Edit3.text:=''; Edit4.text:=''; Edit5.text:=''; RxDBLookupCombo2.ClearValue; wwDBDateTimePicker1.Text:=''; wwDBDateTimePicker2.Text:=''; wwDBComboBox1.text:=''; end; procedure Tfrm_op_railway_road.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_op_railway_road.Hide; frm_op_railway_road.ManualFloat(frm_op_railway_road.BoundsRect ); frm_main.freeTabs('frm_op_railway_road'); action:=cafree; frm_op_railway_road:=nil; end; procedure Tfrm_op_railway_road.bsSkinButton4Click(Sender: TObject); var i:Integer; begin if (wwDBDateTimePicker4.Text='') and (wwDBDateTimePicker5.Text='') and (edit8.Text='')then begin MessageDlg('没有要更新的信息!',mtWarning,[mbyes],0); exit; end; t_op_railway.first; while not t_op_railway.eof do begin t_op_railway.Edit; if (wwDBDateTimePicker4.Text<>'') then t_op_railway['换装日期']:=wwDBDateTimePicker4.Date; if (wwDBDateTimePicker5.Text<>'') then t_op_railway['到货日期']:=wwDBDateTimePicker5.Date; if (edit8.Text<>'') then t_op_railway['换装车号']:=edit8.Text; t_op_railway.Post; t_op_railway.next; end; end; procedure Tfrm_op_railway_road.bsSkinButton3Click(Sender: TObject); var i:Integer; begin if Edit6.Text='' then begin MessageDlg('在途运踪不能为空',mtWarning,[mbyes],0); exit; end; if wwDBDateTimePicker3.Text='' then begin MessageDlg('在途日期不能为空',mtWarning,[mbyes],0); exit; end; if dxdbgrid2.SelectedCount>0 then begin for i:=0 to dxdbgrid2.SelectedCount-1 do begin t_op_railway.GotoBookmark(pointer(dxdbgrid2.selectedrows[i])); t_op_railway.Edit; t_op_railway['在途运踪']:=Edit6.text; t_op_railway['在途日期']:=wwDBDateTimePicker3.Date; t_op_railway.Post; t_op_railway_road.Insert; t_op_railway_road.Post; end; end end; procedure Tfrm_op_railway_road.bsSkinButton10Click(Sender: TObject); begin table_delete(t_op_railway_road); end; procedure Tfrm_op_railway_road.bsSkinButton1Click(Sender: TObject); var i:Integer; begin if Edit6.Text='' then begin MessageDlg('在途运踪不能为空',mtWarning,[mbyes],0); exit; end; if wwDBDateTimePicker3.Text='' then begin MessageDlg('在途日期不能为空',mtWarning,[mbyes],0); exit; end; t_op_railway.first; while not t_op_railway.eof do begin t_op_railway.Edit; t_op_railway['在途运踪']:=Edit6.text; t_op_railway['在途日期']:=wwDBDateTimePicker3.Date; t_op_railway.Post; t_op_railway_road.Insert; t_op_railway_road.Post; t_op_railway.next; end; end; procedure Tfrm_op_railway_road.t_op_railway_roadAfterInsert( DataSet: TDataSet); function getmaxno:Integer; var aQuery:TADOQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; SQL.Add('select MAx(rdno) stno from t_op_railway_road where 编号='''+t_op_railway.fieldbyname('编号').AsString+''''); open; if IsEmpty then result:=1 else Result:=fieldbyname('stno').AsInteger+1; end; finally FreeAndNil(aQuery); end; end; begin t_op_railway_road['编号']:=t_op_railway['编号']; t_op_railway_road['rdno']:=getmaxno; t_op_railway_road['在途日期']:=t_op_railway['在途日期']; t_op_railway_road['在途运踪']:=t_op_railway['在途运踪']; t_op_railway_road['备注']:=Edit7.Text; t_op_railway_road['更新人']:=employee; t_op_railway_road['更新日期']:=now; end; procedure Tfrm_op_railway_road.bsSkinButton6Click(Sender: TObject); var i:Integer; begin if (wwDBDateTimePicker4.Text='') and (wwDBDateTimePicker5.Text='') and (edit8.Text='')then begin MessageDlg('没有要更新的信息!',mtWarning,[mbyes],0); exit; end; if dxdbgrid2.SelectedCount>0 then begin for i:=0 to dxdbgrid2.SelectedCount-1 do begin t_op_railway.GotoBookmark(pointer(dxdbgrid2.selectedrows[i])); t_op_railway.Edit; if (wwDBDateTimePicker4.Text<>'') then t_op_railway['换装日期']:=wwDBDateTimePicker4.Date; if (wwDBDateTimePicker5.Text<>'') then t_op_railway['到货日期']:=wwDBDateTimePicker5.Date; if (edit8.Text<>'') then t_op_railway['换装车号']:=edit8.Text; t_op_railway.Post; end; end end; procedure Tfrm_op_railway_road.RxDBLookupCombo19Enter(Sender: TObject); begin // RxLookupComboEnter(TRxDBLookupCombo(Sender)); end; procedure Tfrm_op_railway_road.RxDBLookupCombo19Exit(Sender: TObject); begin // RxLookupComboExit(TRxDBLookupCombo(Sender)); end; end.