unit u_info_price_release; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, DB, ADODB, DBCtrls, StdCtrls, Mask, wwdbedit, Wwdotdot, Wwdbcomb, bsSkinCtrls, wwdblook, RxLookup, dxDBTLCl, dxGrClms, dxDBCtrl, dxDBGrid, dxTL, dxCntner, ExtCtrls, wwdbdatetimepicker, bsdbctrls; type Tfrm_info_price_release = class(TForm) Panel1: TPanel; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton11: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton10: TbsSkinButton; Notebook1: TNotebook; bsSkinGroupBox2: TbsSkinGroupBox; Label14: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; DBEdit31: TDBEdit; DBEdit1: TDBEdit; DBEdit2: TDBEdit; DBEdit3: TDBEdit; t_price_release: TADOQuery; t_price_release1: TDataSource; t_price_ship: TADOQuery; t_price_ship1: TDataSource; t_price_release_port: TADOQuery; t_price_release_port1: TDataSource; Label1: TLabel; DBEdit11: TDBEdit; bsSkinGroupBox3: TbsSkinGroupBox; dxDBGrid1: TdxDBGrid; dxDBGrid1Column4: TdxDBGridColumn; dxDBGrid1Column3: TdxDBGridColumn; dxDBGrid1Column2: TdxDBGridColumn; dxDBGrid1Column5: TdxDBGridColumn; dxDBGrid120GP: TdxDBGridColumn; dxDBGrid140GP: TdxDBGridColumn; dxDBGrid140HQ: TdxDBGridColumn; dxDBGrid140RF: TdxDBGridColumn; dxDBGrid140RH: TdxDBGridColumn; dxDBGrid145HQ: TdxDBGridColumn; dxDBGrid1Column20: TdxDBGridColumn; dxDBGrid1Column21: TdxDBGridColumn; dxDBGrid1Column37: TdxDBGridColumn; dxDBGrid1Column38: TdxDBGridColumn; dxDBGrid1Column39: TdxDBGridColumn; dxDBGrid1Column22: TdxDBGridColumn; bsSkinButton14: TbsSkinButton; bsSkinButton15: TbsSkinButton; dxDBGrid3: TdxDBGrid; dxDBGrid3Column1: TdxDBGridMaskColumn; dxDBGrid3Column2: TdxDBGridMaskColumn; dxDBGrid3Column3: TdxDBGridDateColumn; dxDBGrid3Column4: TdxDBGridMaskColumn; dxDBGrid3Column5: TdxDBGridMaskColumn; bsSkinButton16: TbsSkinButton; Label6: TLabel; wwDBDateTimePicker2: TwwDBDateTimePicker; Label9: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; dxDBGrid1Column36: TdxDBGridColumn; dxDBGrid1Column41: TdxDBGridColumn; dxDBGrid1Column42: TdxDBGridColumn; dxDBGrid3Column6: TdxDBGridColumn; bsSkinGroupBox4: TbsSkinGroupBox; bsSkinDBCheckRadioBox2: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox3: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox4: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox11: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox9: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox; v_price_release_port: TADOQuery; v_price_release_port1: TDataSource; spl1: TSplitter; bsSkinGroupBox1: TbsSkinGroupBox; dxDBGrid2: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGridMaskColumn2: TdxDBGridMaskColumn; dxDBGridMaskColumn3: TdxDBGridMaskColumn; dxDBGridMaskColumn4: TdxDBGridMaskColumn; dxDBGridMaskColumn5: TdxDBGridMaskColumn; dxDBGridMaskColumn6: TdxDBGridMaskColumn; dxDBGridMaskColumn7: TdxDBGridMaskColumn; dxDBGridMaskColumn8: TdxDBGridMaskColumn; dxDBGridMaskColumn9: TdxDBGridMaskColumn; dxDBGridMaskColumn10: TdxDBGridMaskColumn; dxDBGridMaskColumn11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridMaskColumn; dxDBGrid1Column17: TdxDBGridMaskColumn; dxDBGrid1Column18: TdxDBGridMaskColumn; dxDBGrid1Column19: TdxDBGridMaskColumn; dxDBGridMaskColumn12: TdxDBGridMaskColumn; dxDBGridMaskColumn13: TdxDBGridMaskColumn; dxDBGridMaskColumn14: TdxDBGridMaskColumn; dxDBGrid1Column23: TdxDBGridMaskColumn; dxDBGrid1Column24: TdxDBGridMaskColumn; dxDBGrid1Column25: TdxDBGridMaskColumn; dxDBGrid1Column26: TdxDBGridMaskColumn; dxDBGrid1Column27: TdxDBGridMaskColumn; dxDBGrid1Column28: TdxDBGridMaskColumn; dxDBGrid1Column29: TdxDBGridMaskColumn; dxDBGrid1Column30: TdxDBGridMaskColumn; dxDBGrid1Column31: TdxDBGridMaskColumn; dxDBGrid1Column32: TdxDBGridMaskColumn; dxDBGrid1Column33: TdxDBGridMaskColumn; dxDBGrid1Column34: TdxDBGridMaskColumn; dxDBGrid1Column35: TdxDBGridMaskColumn; dxDBGridMaskColumn15: TdxDBGridMaskColumn; dxDBGridMaskColumn16: TdxDBGridMaskColumn; dxDBGridMaskColumn17: TdxDBGridMaskColumn; dxDBGridMaskColumn18: TdxDBGridMaskColumn; dxDBGrid1Column40: TdxDBGridMaskColumn; dxDBGridDateColumn1: TdxDBGridDateColumn; dxDBGridDateColumn2: TdxDBGridDateColumn; dxDBGridMaskColumn19: TdxDBGridMaskColumn; dxDBGridDateColumn3: TdxDBGridDateColumn; dxDBGrid1Column45: TdxDBGridColumn; dxDBGrid1Column46: TdxDBGridColumn; dxDBGrid1Column47: TdxDBGridColumn; dxDBGrid1Column48: TdxDBGridColumn; dxDBGrid1Column49: TdxDBGridColumn; dxDBGrid1Column50: TdxDBGridColumn; dxDBGrid1Column51: TdxDBGridColumn; dxDBGrid1Column52: TdxDBGridColumn; dxDBGrid1Column53: TdxDBGridColumn; dxDBGrid1Column54: TdxDBGridColumn; dxDBGrid2Column55: TdxDBGridColumn; dxDBGrid2Column56: TdxDBGridColumn; dxDBGrid2Column57: TdxDBGridColumn; bsSkinPanel1: TbsSkinPanel; Label8: TLabel; Label10: TLabel; Label2: TLabel; Label7: TLabel; Label27: TLabel; Label30: TLabel; Label12: TLabel; RxDBLookupCombo3: TRxDBLookupCombo; wwDBLookupCombo2: TwwDBLookupCombo; bsSkinButton12: TbsSkinButton; bsSkinButton13: TbsSkinButton; wwDBComboBox3: TwwDBComboBox; RxDBLookupCombo4: TRxDBLookupCombo; RxDBLookupCombo8: TRxDBLookupCombo; Edit7: TEdit; wwDBLookupCombo5: TwwDBLookupCombo; procedure bsSkinButton9Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton11Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure t_price_releaseAfterInsert(DataSet: TDataSet); procedure FormShow(Sender: TObject); procedure Panel1Resize(Sender: TObject); procedure t_price_releaseBeforeEdit(DataSet: TDataSet); procedure bsSkinButton12Click(Sender: TObject); procedure bsSkinButton13Click(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure bsSkinButton14Click(Sender: TObject); procedure bsSkinButton15Click(Sender: TObject); procedure t_price_release_portAfterInsert(DataSet: TDataSet); procedure bsSkinButton16Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure DBEdit31KeyPress(Sender: TObject; var Key: Char); procedure DBEdit11KeyPress(Sender: TObject; var Key: Char); procedure DBEdit1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit2KeyPress(Sender: TObject; var Key: Char); procedure dxDBGrid3ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure dxDBGrid3Column6CustomDraw(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); private { Private declarations } public { Public declarations } end; var frm_info_price_release: Tfrm_info_price_release; implementation uses u_main, u_data_share, my_sys_function, u_info_price_release_query; {$R *.dfm} procedure Tfrm_info_price_release.bsSkinButton9Click(Sender: TObject); begin close; end; procedure Tfrm_info_price_release.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_info_price_release.Hide; frm_info_price_release.ManualFloat(frm_info_price_release.BoundsRect ); frm_main.freeTabs('frm_info_price_release'); action:=cafree; frm_info_price_release:=nil; end; procedure Tfrm_info_price_release.bsSkinButton11Click(Sender: TObject); begin table_post(t_price_release); end; procedure Tfrm_info_price_release.bsSkinButton8Click(Sender: TObject); begin table_cancel(t_price_release); end; procedure Tfrm_info_price_release.bsSkinButton4Click(Sender: TObject); begin table_delete(t_price_release); end; procedure Tfrm_info_price_release.bsSkinButton10Click(Sender: TObject); var answer:TModalResult; begin if bsSkinButton10.Caption='编辑修改' then begin Notebook1.PageIndex:=1; bsSkinButton10.Caption:='返回列表'; end else begin if (t_price_release.State=dsinsert)or(t_price_release.State=dsedit) then BEGIN answer:=messagedlg( '数据已经修改,是否保存?',mtWarning,mbYesNoCancel,0); if answer=mrYes then begin t_price_release.post; end; if answer=mrNo then begin t_price_release.cancel; end; if answer=mrCancel then begin exit; end; END; Notebook1.PageIndex:=0; bsSkinButton10.Caption:='编辑修改'; end; end; procedure Tfrm_info_price_release.bsSkinButton2Click(Sender: TObject); begin t_price_release.insert; Notebook1.PageIndex:=1; bsSkinButton10.Caption:='返回列表'; end; procedure Tfrm_info_price_release.bsSkinButton3Click(Sender: TObject); var afield : variant; i: Integer; begin if t_price_release.IsEmpty then exit; afield := vararraycreate([0,t_price_release.fieldcount-1],varvariant); for i := 0 to (t_price_release.fieldcount-1) do begin afield[i] :=t_price_release.fields[i].value ; end; t_price_release.append; for i := 1 to (t_price_release.fieldcount-1) do begin if t_price_release.fields[i].FieldName<>'发布编号' then t_price_release.fields[i].value := afield[i] ; end; t_price_release['发布人']:=employee; t_price_release['发布日期']:=date; t_price_release['发布状态']:='添加发布'; Notebook1.PageIndex:=1; bsSkinButton10.Caption:='返回列表'; showmessage('复制添加成功!!'); end; procedure Tfrm_info_price_release.bsSkinButton5Click(Sender: TObject); begin sys_print('运价发布打印',2,t_price_release1,frm_data_share.t_code_price_ctn1,nil,nil,t_price_release_port1,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_info_price_release.t_price_releaseAfterInsert( DataSet: TDataSet); begin t_price_release['发布人']:=employee; t_price_release['发布日期']:=date; t_price_release['发布状态']:='添加发布'; t_price_release['条件船公司']:=0; t_price_release['条件货代公司']:=0; t_price_release['条件目的港']:=0; t_price_release['条件开船日期']:=0; t_price_release['条件船名']:=0; t_price_release['条件航次']:=0; t_price_release['条件操作部门']:=0; t_price_release['条件销售部门']:=0; t_price_release['条件委托单位']:=0; t_price_release['条件交货地点']:=0; end; procedure Tfrm_info_price_release.FormShow(Sender: TObject); begin t_price_release.sql.Clear; t_price_release.sql.add('SELECT top 100 * FROM t_price_release '); t_price_release.sql.add('where '+open_data('3007','发布人','no','no','no','no')); t_price_release.sql.add(' order by 发布日期'); t_price_release.open; t_price_release_port.open; frm_data_share.t_code_price_ctn.requery; if frm_data_share.t_code_price_ctn.IsEmpty then exit; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型1').asstring)<>'' then begin dxDBGrid120GP.Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型1').asstring); dxDBGrid120GP.Visible:=true; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型2').asstring)<>'' then begin dxDBGrid140GP.Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型2').asstring); dxDBGrid140GP.Visible:=true; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型3').asstring)<>'' then begin dxDBGrid140HQ.Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型3').asstring); dxDBGrid140HQ.Visible:=true; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型4').asstring)<>'' then begin dxDBGrid140RF.Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型4').asstring); dxDBGrid140RF.Visible:=true; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型5').asstring)<>'' then begin dxDBGrid140RH.Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型5').asstring); dxDBGrid140RH.Visible:=true; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型6').asstring)<>'' then begin dxDBGrid145HQ.Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型6').asstring); dxDBGrid145HQ.Visible:=true; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型7').asstring)<>'' then begin dxDBGrid1Column20.Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型7').asstring); dxDBGrid1Column20.Visible:=true; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型8').asstring)<>'' then begin dxDBGrid1Column21.Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型8').asstring); dxDBGrid1Column21.Visible:=true; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型1').asstring)<>'' then begin dxDBGrid2.Bands[1].Visible:=true; dxDBGrid2.Bands[1].Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型1').asstring); end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型2').asstring)<>'' then begin dxDBGrid2.Bands[2].Visible:=true; dxDBGrid2.Bands[2].Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型2').asstring); end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型3').asstring)<>'' then begin dxDBGrid2.Bands[3].Visible:=true; dxDBGrid2.Bands[3].Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型3').asstring); end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型4').asstring)<>'' then begin dxDBGrid2.Bands[4].Visible:=true; dxDBGrid2.Bands[4].Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型4').asstring); end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型5').asstring)<>'' then begin dxDBGrid2.Bands[5].Visible:=true; dxDBGrid2.Bands[5].Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型5').asstring); end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型6').asstring)<>'' then begin dxDBGrid2.Bands[6].Visible:=true; dxDBGrid2.Bands[6].Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型6').asstring); end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型7').asstring)<>'' then begin dxDBGrid2.Bands[7].Visible:=true; dxDBGrid2.Bands[7].Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型7').asstring); end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型8').asstring)<>'' then begin dxDBGrid2.Bands[8].Visible:=true; dxDBGrid2.Bands[8].Caption:=trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型8').asstring); end; wwDBComboBox3.Items.Clear; frm_data_share.t_sys_code_data.Filtered:=false; frm_data_share.t_sys_code_data.Filter:='属性='+''''+'3006'+''''; frm_data_share.t_sys_code_data.Filtered:=true; if frm_data_share.t_sys_code_data.IsEmpty then exit; if frm_data_share.t_sys_code_data.Locate('职员','全包底价',[])then begin if frm_data_share.t_sys_code_data.fieldbyname('是否可视').asboolean then begin dxDBGridMaskColumn6.Visible:=true; dxDBGridMaskColumn7.Visible:=true; dxDBGridMaskColumn8.Visible:=true; dxDBGridMaskColumn9.Visible:=true; dxDBGridMaskColumn10.Visible:=true; dxDBGridMaskColumn11.Visible:=true; dxDBGrid1Column45.Visible:=true; dxDBGrid1Column50.Visible:=true; wwDBComboBox3.Items.Add('全包底价'); end; end; if frm_data_share.t_sys_code_data.Locate('职员','底价构成',[])then begin if frm_data_share.t_sys_code_data.fieldbyname('是否可视').asboolean then begin dxDBGrid1Column12.Visible:=true; dxDBGrid1Column13.Visible:=true; dxDBGrid1Column14.Visible:=true; dxDBGrid1Column15.Visible:=true; dxDBGrid1Column16.Visible:=true; dxDBGrid1Column17.Visible:=true; dxDBGrid1Column46.Visible:=true; dxDBGrid1Column51.Visible:=true; end; end; if frm_data_share.t_sys_code_data.Locate('职员','一级售价',[])then begin if frm_data_share.t_sys_code_data.fieldbyname('是否可视').asboolean then begin dxDBGrid1Column18.Visible:=true; dxDBGrid1Column19.Visible:=true; dxDBGridMaskColumn12.Visible:=true; dxDBGridMaskColumn13.Visible:=true; dxDBGridMaskColumn14.Visible:=true; dxDBGrid1Column23.Visible:=true; dxDBGrid1Column47.Visible:=true; dxDBGrid1Column52.Visible:=true; wwDBComboBox3.Items.Add('一级售价'); end; end; if frm_data_share.t_sys_code_data.Locate('职员','二级售价',[])then begin if frm_data_share.t_sys_code_data.fieldbyname('是否可视').asboolean then begin dxDBGrid1Column24.Visible:=true; dxDBGrid1Column25.Visible:=true; dxDBGrid1Column26.Visible:=true; dxDBGrid1Column27.Visible:=true; dxDBGrid1Column28.Visible:=true; dxDBGrid1Column29.Visible:=true; dxDBGrid1Column48.Visible:=true; dxDBGrid1Column53.Visible:=true; wwDBComboBox3.Items.Add('二级售价'); end; end; if frm_data_share.t_sys_code_data.Locate('职员','三级售价',[])then begin if frm_data_share.t_sys_code_data.fieldbyname('是否可视').asboolean then begin dxDBGrid1Column30.Visible:=true; dxDBGrid1Column31.Visible:=true; dxDBGrid1Column32.Visible:=true; dxDBGrid1Column33.Visible:=true; dxDBGrid1Column34.Visible:=true; dxDBGrid1Column35.Visible:=true; dxDBGrid1Column49.Visible:=true; dxDBGrid1Column54.Visible:=true; wwDBComboBox3.Items.Add('三级售价'); end; end; end; procedure Tfrm_info_price_release.Panel1Resize(Sender: TObject); var i:integer; begin i:=round(Panel1.Width/11); bsSkinButton5.Width:=i; bsSkinButton7.Width:=i; bsSkinButton6.Width:=i; bsSkinButton2.Width:=i; bsSkinButton3.Width:=i; bsSkinButton10.Width:=i; bsSkinButton11.Width:=i; bsSkinButton4.Width:=i; bsSkinButton8.Width:=i; bsSkinButton1.Width:=i; end; procedure Tfrm_info_price_release.t_price_releaseBeforeEdit( DataSet: TDataSet); begin if do_data('3007',t_price_release.fieldbyname('发布人').asstring,'','','','','')=false then begin showmessage('对不起你无权修改此数据!!'); abort; end; if t_price_release.fieldbyname('发布状态').asstring='确认发布' then begin showmessage('运价已发布不能修改此数据!!'); abort; end; end; procedure Tfrm_info_price_release.bsSkinButton12Click(Sender: TObject); begin t_price_ship.close; t_price_ship.sql.clear; t_price_ship.sql.add('SELECT * FROM t_price_ship where 有效日期>=getdate()'); if wwDBLookupCombo2.text<>''then t_price_ship.sql.add(' and 目的港 like '+''''+'%'+wwDBLookupCombo2.text+'%'+''''); if RxDBLookupCombo3.DisplayValue<>''then t_price_ship.sql.add(' and 船公司='+''''+RxDBLookupCombo3.DisplayValueS[1]+''''); if RxDBLookupCombo4.DisplayValue<>''then t_price_ship.sql.add(' and 航线='+''''+RxDBLookupCombo4.DisplayValueS[1]+''''); if wwDBLookupCombo5.Text<>''then t_price_ship.sql.add(' and 船名='+''''+wwDBLookupCombo5.Text+''''); if RxDBLookupCombo8.DisplayValue<>''then t_price_ship.sql.add(' and 货代公司='+''''+RxDBLookupCombo8.DisplayValues[1]+''''); if Edit7.text<>''then t_price_ship.sql.add(' and 目的港 like '+''''+'%'+Edit7.text+'%'+''''); t_price_ship.sql.add('order by 运价编号'); t_price_ship.open; end; procedure Tfrm_info_price_release.bsSkinButton13Click(Sender: TObject); var i:integer; begin if wwDBComboBox3.ItemIndex=-1 then begin showmessage('请选择要公布的售价级别!!'); exit; end; if t_price_ship.Active=false then exit; if t_price_ship.IsEmpty then exit; if t_price_release.IsEmpty then exit; if t_price_release.state=dsinsert then t_price_release.post; if dxDBGrid2.SelectedCount>=1 then begin for i:=0 to dxDBGrid2.SelectedCount-1 do begin t_price_ship.GotoBookmark(pointer(dxDBGrid2.selectedrows[i])); t_price_release_port.insert; t_price_release_port['箱型1']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'1').asstring; t_price_release_port['箱型2']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'2').asstring; t_price_release_port['箱型3']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'3').asstring; t_price_release_port['箱型4']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'4').asstring; t_price_release_port['箱型5']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'5').asstring; t_price_release_port['箱型6']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'6').asstring; t_price_release_port['箱型7']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'7').asstring; t_price_release_port['箱型8']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'8').asstring; t_price_release_port['船公司']:=t_price_ship.fieldbyname('船公司').asstring; t_price_release_port['货代公司']:=t_price_ship.fieldbyname('货代公司').asstring; t_price_release_port['船名']:=t_price_ship.fieldbyname('船名').asstring; t_price_release_port['航次']:=t_price_ship.fieldbyname('航次').asstring; t_price_release_port['启运港']:=t_price_ship.fieldbyname('启运港').asstring; t_price_release_port['目的港']:=t_price_ship.fieldbyname('目的港').asstring; t_price_release_port['航线']:=t_price_ship.fieldbyname('航线').asstring; t_price_release_port['结关时间']:=t_price_ship.fieldbyname('结关时间').asstring; t_price_release_port['开航时间']:=t_price_ship.fieldbyname('开航时间').asstring; t_price_release_port['航行天数']:=t_price_ship.fieldbyname('航行天数').asstring; t_price_release_port['运价编号']:=t_price_ship.fieldbyname('运价编号').asinteger; t_price_release_port.post; end; exit; end; t_price_release_port.insert; t_price_release_port['箱型1']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'1').asstring; t_price_release_port['箱型2']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'2').asstring; t_price_release_port['箱型3']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'3').asstring; t_price_release_port['箱型4']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'4').asstring; t_price_release_port['箱型5']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'5').asstring; t_price_release_port['箱型6']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'6').asstring; t_price_release_port['箱型7']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'7').asstring; t_price_release_port['箱型8']:=t_price_ship.fieldbyname(wwDBComboBox3.text+'8').asstring; t_price_release_port['船公司']:=t_price_ship.fieldbyname('船公司').asstring; t_price_release_port['货代公司']:=t_price_ship.fieldbyname('货代公司').asstring; t_price_release_port['船名']:=t_price_ship.fieldbyname('船名').asstring; t_price_release_port['航次']:=t_price_ship.fieldbyname('航次').asstring; t_price_release_port['启运港']:=t_price_ship.fieldbyname('启运港').asstring; t_price_release_port['目的港']:=t_price_ship.fieldbyname('目的港').asstring; t_price_release_port['航线']:=t_price_ship.fieldbyname('航线').asstring; t_price_release_port['结关时间']:=t_price_ship.fieldbyname('结关时间').asstring; t_price_release_port['开航时间']:=t_price_ship.fieldbyname('开航时间').asstring; t_price_release_port['航行天数']:=t_price_ship.fieldbyname('航行天数').asstring; t_price_release_port['运价编号']:=t_price_ship.fieldbyname('运价编号').asinteger; t_price_release_port.post; end; procedure Tfrm_info_price_release.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose:=frm_close_query(t_price_release); end; procedure Tfrm_info_price_release.bsSkinButton14Click(Sender: TObject); begin if t_price_release_port.state=dsedit then t_price_release_port.post; end; procedure Tfrm_info_price_release.bsSkinButton15Click(Sender: TObject); begin table_delete(t_price_release_port); end; procedure Tfrm_info_price_release.t_price_release_portAfterInsert( DataSet: TDataSet); begin t_price_release_port['发布编号']:=t_price_release['发布编号']; t_price_release_port['箱型1']:=0; t_price_release_port['箱型2']:=0; t_price_release_port['箱型3']:=0; t_price_release_port['箱型4']:=0; t_price_release_port['箱型5']:=0; t_price_release_port['箱型6']:=0; t_price_release_port['箱型7']:=0; t_price_release_port['箱型8']:=0; end; procedure Tfrm_info_price_release.bsSkinButton16Click(Sender: TObject); begin table_cancel(t_price_release_port); end; procedure Tfrm_info_price_release.bsSkinButton1Click(Sender: TObject); begin try frm_info_price_release_query:=tfrm_info_price_release_query.Create (self); frm_info_price_release_query.ShowModal; finally frm_info_price_release_query.Free; end; end; procedure Tfrm_info_price_release.DBEdit31KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit11); end; procedure Tfrm_info_price_release.DBEdit11KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit1); end; procedure Tfrm_info_price_release.DBEdit1KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit2); end; procedure Tfrm_info_price_release.DBEdit2KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit3); end; procedure Tfrm_info_price_release.dxDBGrid3ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort(Column,t_price_release,'发布编号'); end; procedure Tfrm_info_price_release.dxDBGrid3Column6CustomDraw( 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[dxDBGrid3Column6.Index]='确认发布' then AColor:=clRed else if ANode.Strings[dxDBGrid3Column6.Index]='取消发布' then AColor:=clGreen else AColor:=clWhite; AFont.Color:=clblack; end; procedure Tfrm_info_price_release.bsSkinButton7Click(Sender: TObject); var aQuery:TADOQuery; subStr,Str,cntrstr:String; sl:tStrings; begin v_price_release_port.Close; v_price_release_port.Open; v_price_release_port.First; if MessageDlg('发布运价,系统会自动更新系统中符合条件的运费信息,确实要发布吗?',mtConfirmation,[mbYes,mbNo],0)=mrYes then begin frm_main.db.BeginTrans; try try aQuery:=CreateAdoQuery; with aQuery do begin while not v_price_release_port.Eof do begin subStr:=''; if (v_price_release_port['条件船公司']=1) and (v_price_release_port['船公司'].asString<>'') then begin subStr:=subStr+' and 船公司='+''''+v_price_release_port['船公司'].asString+''''; end; if (v_price_release_port['条件货代公司']=1) and (v_price_release_port['货代公司'].asString<>'') then begin subStr:=subStr+' and 货代公司='+''''+v_price_release_port['货代公司'].asString+''''; end; if (v_price_release_port['条件目的港']=1) and (v_price_release_port['目的港'].asString<>'') then begin subStr:=subStr+' and 目的港 like '+''''+'%'+v_price_release_port['目的港'].asString+'%'+''''; end; if (v_price_release_port['条件交货地点']=1) and (v_price_release_port['目的港'].asString<>'') then begin subStr:=subStr+' and 交货地点 like '+''''+'%'+v_price_release_port['目的港'].asString+'%'+''''; end; if (v_price_release_port['条件船名']=1) and (v_price_release_port['船名'].asString<>'') then begin subStr:=subStr+' and 船名='+''''+v_price_release_port['目的港'].asString+''''; end; if (v_price_release_port['条件航次']=1) and (v_price_release_port['航次'].asString<>'') then begin subStr:=subStr+' and 航次 like '+''''+'%'+v_price_release_port['航次'].asString+'%'+''''; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型1').asstring)<>'' then begin if StrToFloatDef(v_price_release_port['箱型1'],0)<>0 then begin cntrstr:=frm_data_share.t_code_price_ctn.fieldbyname('运价箱型1').asstring; CntrStr:=StringReplace(CntrStr,'''','''''',[rfReplaceAll]); Str:='Update t_ch_fee set 单价='+v_price_release_port['箱型1']+' where 系统费用=1 and 费用状态=''录入状态'' and 标准='+''''+trim(CntrStr)+'''' +' and 编号 in (select 编号 from t_op_seae where 开船日期>='+''''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期起'])+''''+' and 开船日期<='''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期止'])+'''' +subStr+')'; Close; SQL.Text:=Str; ExecSQL; end; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型2').asstring)<>'' then begin if StrToFloatDef(v_price_release_port['箱型2'],0)<>0 then begin cntrstr:=frm_data_share.t_code_price_ctn.fieldbyname('运价箱型2').asstring; CntrStr:=StringReplace(CntrStr,'''','''''',[rfReplaceAll]); Str:='Update t_ch_fee set 单价='+v_price_release_port['箱型2']+' where 系统费用=1 and 费用状态=''录入状态'' and 标准='+''''+trim(cntrstr)+'''' +' and 编号 in (select 编号 from t_op_seae where 开船日期>='+''''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期起'])+''''+' and 开船日期<='''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期止'])+'''' +subStr+')'; Close; SQL.Text:=Str; ExecSQL; end; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型3').asstring)<>'' then begin if StrToFloatDef(v_price_release_port['箱型3'],0)<>0 then begin cntrstr:=frm_data_share.t_code_price_ctn.fieldbyname('运价箱型3').asstring; CntrStr:=StringReplace(CntrStr,'''','''''',[rfReplaceAll]); Str:='Update t_ch_fee set 单价='+v_price_release_port['箱型3']+' where 系统费用=1 and 费用状态=''录入状态'' and 标准='+''''+trim(cntrstr)+'''' +' and 编号 in (select 编号 from t_op_seae where 开船日期>='+''''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期起'])+''''+' and 开船日期<='''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期止'])+'''' +subStr+')'; Close; SQL.Text:=Str; ExecSQL; end; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型4').asstring)<>'' then begin if StrToFloatDef(v_price_release_port['箱型4'],0)<>0 then begin cntrstr:=frm_data_share.t_code_price_ctn.fieldbyname('运价箱型4').asstring; CntrStr:=StringReplace(CntrStr,'''','''''',[rfReplaceAll]); Str:='Update t_ch_fee set 单价='+v_price_release_port['箱型4']+' where 系统费用=1 and 费用状态=''录入状态'' and 标准='+''''+trim(cntrstr)+'''' +' and 编号 in (select 编号 from t_op_seae where 开船日期>='+''''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期起'])+''''+' and 开船日期<='''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期止'])+'''' +subStr+')'; Close; SQL.Text:=Str; ExecSQL; end; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型5').asstring)<>'' then begin cntrstr:=frm_data_share.t_code_price_ctn.fieldbyname('运价箱型5').asstring; CntrStr:=StringReplace(CntrStr,'''','''''',[rfReplaceAll]); if StrToFloatDef(v_price_release_port['箱型5'],0)<>0 then begin Str:='Update t_ch_fee set 单价='+v_price_release_port['箱型5']+' where 系统费用=1 and 费用状态=''录入状态'' and 标准='+''''+trim(cntrstr)+'''' +' and 编号 in (select 编号 from t_op_seae where 开船日期>='+''''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期起'])+''''+' and 开船日期<='''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期止'])+'''' +subStr+')'; Close; SQL.Text:=Str; ExecSQL; end; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型6').asstring)<>'' then begin if StrToFloatDef(v_price_release_port['箱型6'],0)<>0 then begin cntrstr:=frm_data_share.t_code_price_ctn.fieldbyname('运价箱型6').asstring; CntrStr:=StringReplace(CntrStr,'''','''''',[rfReplaceAll]); Str:='Update t_ch_fee set 单价='+v_price_release_port['箱型6']+' where 系统费用=1 and 费用状态=''录入状态'' and 标准='+''''+trim(cntrstr)+'''' +' and 编号 in (select 编号 from t_op_seae where 开船日期>='+''''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期起'])+''''+' and 开船日期<='''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期止'])+'''' +subStr+')'; Close; SQL.Text:=Str; ExecSQL; end; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型7').asstring)<>'' then begin if StrToFloatDef(v_price_release_port['箱型7'],0)<>0 then begin cntrstr:=frm_data_share.t_code_price_ctn.fieldbyname('运价箱型7').asstring; CntrStr:=StringReplace(CntrStr,'''','''''',[rfReplaceAll]); Str:='Update t_ch_fee set 单价='+v_price_release_port['箱型7']+' where 系统费用=1 and 费用状态=''录入状态'' and 标准='+''''+trim(cntrstr)+'''' +' and 编号 in (select 编号 from t_op_seae where 开船日期>='+''''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期起'])+''''+' and 开船日期<='''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期止'])+'''' +subStr+')'; Close; SQL.Text:=Str; ExecSQL; end; end; if trim(frm_data_share.t_code_price_ctn.fieldbyname('运价箱型8').asstring)<>'' then begin if StrToFloatDef(v_price_release_port['箱型8'],0)<>0 then begin cntrstr:=frm_data_share.t_code_price_ctn.fieldbyname('运价箱型8').asstring; CntrStr:=StringReplace(CntrStr,'''','''''',[rfReplaceAll]); Str:='Update t_ch_fee set 单价='+v_price_release_port['箱型8']+' where 系统费用=1 and 费用状态=''录入状态'' and 标准='+''''+trim(cntrstr)+'''' +' and 编号 in (select 编号 from t_op_seae where 开船日期>='+''''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期起'])+''''+' and 开船日期<='''+formatDatetime('yyyy-mm-dd',v_price_release_port['有效日期止'])+'''' +subStr+')'; Close; SQL.Text:=Str; ExecSQL; end; end; v_price_release_port.Next; end; end; finally FreeAndNil(aQuery); end; t_price_release.Edit; t_price_release['发布状态']:='确认发布'; t_price_release.Post; showmessage('运价成功发布!'); frm_main.db.CommitTrans; except frm_main.db.RollbackTrans; end; end; end; procedure Tfrm_info_price_release.bsSkinButton6Click(Sender: TObject); begin t_price_release.Edit; t_price_release['发布状态']:='取消发布'; t_price_release.Post; end; end.