unit u_info_plan_brother; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, DB, ADODB, wwdbdatetimepicker, StdCtrls, DBCtrls, RxLookup, wwdblook, Mask, bsSkinCtrls, dxDBGrid, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxCntner, ExtCtrls; type Tfrm_info_price_brother = 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; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid120GP: TdxDBGridMaskColumn; dxDBGrid140GP: TdxDBGridMaskColumn; dxDBGrid140HQ: TdxDBGridMaskColumn; dxDBGrid140RF: TdxDBGridMaskColumn; dxDBGrid140RH: TdxDBGridMaskColumn; dxDBGrid145HQ: TdxDBGridMaskColumn; dxDBGrid1Column36: TdxDBGridMaskColumn; dxDBGrid1Column37: TdxDBGridMaskColumn; dxDBGrid1Column38: TdxDBGridMaskColumn; dxDBGrid1Column39: TdxDBGridMaskColumn; dxDBGrid1Column41: TdxDBGridDateColumn; dxDBGrid1Column42: TdxDBGridDateColumn; dxDBGrid1Column43: TdxDBGridMaskColumn; dxDBGrid1Column44: TdxDBGridDateColumn; bsSkinPanel1: TbsSkinPanel; bsSkinPanel2: TbsSkinPanel; bsSkinPanel3: TbsSkinPanel; Label21: TLabel; RxDBLookupCombo20: TRxDBLookupCombo; t_price_brother: TADOQuery; t_price_brother1: TDataSource; dxDBGrid1Column20: TdxDBGridColumn; dxDBGrid1Column21: TdxDBGridColumn; bsSkinPanel4: TbsSkinPanel; Label9: TLabel; RxDBLookupCombo2: TRxDBLookupCombo; Label1: TLabel; RxDBLookupCombo1: TRxDBLookupCombo; Label20: TLabel; wwDBLookupCombo3: TwwDBLookupCombo; DBText1: TDBText; DBEdit1: TDBEdit; DBText2: TDBText; DBEdit2: TDBEdit; DBText3: TDBText; DBEdit3: TDBEdit; DBText6: TDBText; DBEdit4: TDBEdit; DBText5: TDBText; DBEdit5: TDBEdit; DBText4: TDBText; DBEdit6: TDBEdit; DBText7: TDBText; DBEdit36: TDBEdit; DBText8: TDBText; DBEdit41: TDBEdit; Label14: TLabel; DBEdit31: TDBEdit; Label17: TLabel; DBEdit34: TDBEdit; Label15: TLabel; DBEdit32: TDBEdit; Label16: TLabel; DBEdit33: TDBEdit; Label19: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; Label22: TLabel; wwDBDateTimePicker2: TwwDBDateTimePicker; Label23: TLabel; DBEdit38: TDBEdit; Label24: TLabel; DBEdit39: TDBEdit; Label25: TLabel; DBMemo1: TDBMemo; Label13: TLabel; wwDBLookupCombo52: TwwDBLookupCombo; dxDBGrid2: TdxDBGrid; dxDBGrid2Column1: TdxDBGridMaskColumn; dxDBGrid2Column2: TdxDBGridMaskColumn; dxDBGrid2Column3: TdxDBGridMaskColumn; dxDBGrid2Column4: TdxDBGridMaskColumn; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure t_price_brotherAfterInsert(DataSet: TDataSet); procedure t_price_brotherBeforePost(DataSet: TDataSet); procedure FormShow(Sender: TObject); procedure Panel1Resize(Sender: TObject); procedure dxDBGrid1CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); procedure bsSkinButton1Click(Sender: TObject); procedure t_price_brotherBeforeEdit(DataSet: TDataSet); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure RxDBLookupCombo20KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); procedure DBEdit1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit2KeyPress(Sender: TObject; var Key: Char); procedure DBEdit3KeyPress(Sender: TObject; var Key: Char); procedure DBEdit4KeyPress(Sender: TObject; var Key: Char); procedure DBEdit5KeyPress(Sender: TObject; var Key: Char); procedure DBEdit6KeyPress(Sender: TObject; var Key: Char); procedure DBEdit36KeyPress(Sender: TObject; var Key: Char); procedure DBEdit41KeyPress(Sender: TObject; var Key: Char); procedure DBEdit31KeyPress(Sender: TObject; var Key: Char); procedure DBEdit34KeyPress(Sender: TObject; var Key: Char); procedure DBEdit32KeyPress(Sender: TObject; var Key: Char); procedure DBEdit33KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char); procedure DBEdit38KeyPress(Sender: TObject; var Key: Char); procedure DBEdit39KeyPress(Sender: TObject; var Key: Char); procedure dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure wwDBLookupCombo52KeyPress(Sender: TObject; var Key: Char); procedure bsSkinPanel3Resize(Sender: TObject); procedure dxDBGrid2DblClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_info_price_brother: Tfrm_info_price_brother; implementation uses u_main, u_data_share, my_sys_function, u_info_price_brother_query; {$R *.dfm} procedure Tfrm_info_price_brother.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_info_price_brother.Hide; frm_info_price_brother.ManualFloat(frm_info_price_brother.BoundsRect ); frm_main.freeTabs('frm_info_price_brother'); action:=cafree; frm_info_price_brother:=nil; end; procedure Tfrm_info_price_brother.bsSkinButton7Click(Sender: TObject); begin table_Prior(t_price_brother); end; procedure Tfrm_info_price_brother.bsSkinButton6Click(Sender: TObject); begin table_next(t_price_brother); end; procedure Tfrm_info_price_brother.bsSkinButton11Click(Sender: TObject); begin table_post(t_price_brother); end; procedure Tfrm_info_price_brother.bsSkinButton8Click(Sender: TObject); begin table_cancel(t_price_brother); end; procedure Tfrm_info_price_brother.bsSkinButton4Click(Sender: TObject); begin table_delete(t_price_brother); end; procedure Tfrm_info_price_brother.bsSkinButton10Click(Sender: TObject); var answer:TModalResult; begin if bsSkinButton10.Caption='编辑修改' then begin Notebook1.PageIndex:=1; bsSkinButton10.Caption:='返回列表'; end else begin if (t_price_brother.State=dsinsert)or(t_price_brother.State=dsedit) then BEGIN answer:=messagedlg( '数据已经修改,是否保存?',mtWarning,mbYesNoCancel,0); if answer=mrYes then begin t_price_brother.post; end; if answer=mrNo then begin t_price_brother.cancel; end; if answer=mrCancel then begin exit; end; END; Notebook1.PageIndex:=0; bsSkinButton10.Caption:='编辑修改'; end; end; procedure Tfrm_info_price_brother.bsSkinButton9Click(Sender: TObject); begin close; end; procedure Tfrm_info_price_brother.bsSkinButton2Click(Sender: TObject); begin t_price_brother.insert; Notebook1.PageIndex:=1; bsSkinButton10.Caption:='返回列表'; end; procedure Tfrm_info_price_brother.bsSkinButton3Click(Sender: TObject); var afield : variant; i: Integer; begin if t_price_brother.IsEmpty then exit; afield := vararraycreate([0,t_price_brother.fieldcount-1],varvariant); for i := 0 to (t_price_brother.fieldcount-1) do begin afield[i] :=t_price_brother.fields[i].value ; end; t_price_brother.append; for i := 1 to (t_price_brother.fieldcount-1) do begin if t_price_brother.fields[i].FieldName<>'运价编号' then t_price_brother.fields[i].value := afield[i] ; end; t_price_brother['录入人']:=employee; t_price_brother['录入日期']:=date; Notebook1.PageIndex:=1; bsSkinButton10.Caption:='返回列表'; showmessage('复制添加成功!!'); end; procedure Tfrm_info_price_brother.bsSkinButton5Click(Sender: TObject); begin sys_print('同行运价打印',2,t_price_brother1,frm_data_share.t_code_price_ctn1,nil,nil,t_price_brother1,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_info_price_brother.t_price_brotherAfterInsert( DataSet: TDataSet); begin t_price_brother['录入人']:=employee; t_price_brother['录入日期']:=date; t_price_brother['生效日期']:=date; end; procedure Tfrm_info_price_brother.t_price_brotherBeforePost( DataSet: TDataSet); begin table_before_post(t_price_brother,'船公司'); table_before_post(t_price_brother,'货代公司'); table_before_post(t_price_brother,'启运港'); table_before_post(t_price_brother,'目的港'); table_before_post(t_price_brother,'生效日期'); table_before_post(t_price_brother,'有效日期'); end; procedure Tfrm_info_price_brother.FormShow(Sender: TObject); begin t_price_brother.sql.Clear; t_price_brother.sql.add('SELECT * FROM t_price_brother where 有效日期>=getdate()'); t_price_brother.sql.add(' and '+open_data('3004','录入人','no','no','no','no')); t_price_brother.sql.add(' order by 运价编号'); t_price_brother.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; end; procedure Tfrm_info_price_brother.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_brother.dxDBGrid1CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); begin if strtodatetime(ANode.Strings[dxDBGrid1Column42.Index])