unit u_info_price_mgJJ; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, RxLookup, StdCtrls, wwdblook, bsSkinCtrls, ExtCtrls, dxExEdtr, dxDBTLCl, dxGrClms, dxDBGrid, dxTL, dxDBCtrl, dxCntner, Menus, DB, ADODB, Grids, Wwdbigrd, Wwdbgrid, DBGridEh; type TFrm_info_price_mgJJ = class(TForm) Panel1: TPanel; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton11: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinPanel5: TbsSkinPanel; Label7: TLabel; Label124: TLabel; Label11: TLabel; Label8: TLabel; Label10: TLabel; bsSkinButton1: TbsSkinButton; wwDBLookupCombo2: TwwDBLookupCombo; wwDBLookupCombo4: TwwDBLookupCombo; Edit1: TEdit; bsSkinButton10: TbsSkinButton; RxDBLookupCombo3: TRxDBLookupCombo; RxDBLookupCombo4: TRxDBLookupCombo; t_price_ship: TADOQuery; t_price_ship1: TDataSource; t_price_agreement1: TDataSource; t_price_agreement: TADOQuery; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; N73: TMenuItem; N48: TMenuItem; wwDBGrid1: TwwDBGrid; bsSkinButton12: TbsSkinButton; bsSkinButton13: TbsSkinButton; wwstartport: TwwDBLookupCombo; wwendEnPort: TwwDBLookupCombo; shipper: TwwDBLookupCombo; shipline: TwwDBLookupCombo; wwendpotcn: TwwDBLookupCombo; procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure FormShow(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton12Click(Sender: TObject); procedure bsSkinButton13Click(Sender: TObject); procedure t_price_ship1DataChange(Sender: TObject; Field: TField); procedure wwDBGrid1CalcCellColors(Sender: TObject; Field: TField; State: TGridDrawState; Highlight: Boolean; AFont: TFont; ABrush: TBrush); private { Private declarations } procedure loadwwgrid ; procedure savewwgrid ; public { Public declarations } end; var Frm_info_price_mgJJ: TFrm_info_price_mgJJ; implementation uses u_main, u_data_share, my_sys_function, u_info_price_query, u_info_price_agreeview, u_info_price_manage; {$R *.dfm} procedure TFrm_info_price_mgJJ.bsSkinButton10Click(Sender: TObject); var str,str_tiaojian:String; begin IF TRIM(Edit1.TEXT)=''THEN EXIT; str_tiaojian:=' like '+''''+'%'+TRIM(Edit1.TEXT)+'%'+''''; str:='where 目的港'+str_tiaojian; str:=str+' or 目的港中文'+str_tiaojian; str:=str+' or 启运港'+str_tiaojian; str:=str+' or 航线'+str_tiaojian; str:=str+' or 船公司'+str_tiaojian; str:=str+' or 卖价说明'+str_tiaojian; str:=str+' or 结关时间'+str_tiaojian; str:=str+' or 开航时间'+str_tiaojian; str:=Str+' and '+open_data('3001','录入人','no','no','no','no'); t_price_ship.close; t_price_ship.sql.Clear; t_price_ship.sql.add('select * from t_price_ship '); t_price_ship.sql.add(str); t_price_ship.sql.add(' order by 运价编号'); t_price_ship.open; end; procedure TFrm_info_price_mgJJ.bsSkinButton1Click(Sender: TObject); var str:widestring; begin str:='SELECT * FROM t_price_ship where 1=1 '; str:=Str+' and '+open_data('3001','录入人','no','no','no','no'); if wwDBLookupCombo2.text<>''then str:=str+' and 启运港 like '+''''+'%'+wwDBLookupCombo2.text+'%'+''''; if wwDBLookupCombo4.text<>''then str:=str+' and 目的港 like '+''''+'%'+wwDBLookupCombo4.text+'%'+''''; if RxDBLookupCombo3.DisplayValue<>''then str:=str+' and 船公司='+''''+RxDBLookupCombo3.KeyValue+''''; if RxDBLookupCombo4.DisplayValue<>''then str:=str+' and 航线='+''''+RxDBLookupCombo4.KeyValue+''''; t_price_ship.close; t_price_ship.sql.Clear; t_price_ship.sql.add(str); t_price_ship.sql.add(' order by 运价编号'); t_price_ship.open; end; procedure TFrm_info_price_mgJJ.bsSkinButton7Click(Sender: TObject); begin table_Prior(t_price_ship); end; procedure TFrm_info_price_mgJJ.bsSkinButton6Click(Sender: TObject); begin table_next(t_price_ship); end; procedure TFrm_info_price_mgJJ.bsSkinButton5Click(Sender: TObject); begin sys_print('合约运价打印',2,t_price_ship1,frm_data_share.t_code_price_ctn1,nil,nil,t_price_ship1,nil,nil,nil,nil,nil,nil); end; procedure TFrm_info_price_mgJJ.bsSkinButton3Click(Sender: TObject); var afield : variant; i: Integer; begin if t_price_ship.IsEmpty then exit; afield := vararraycreate([0,t_price_ship.fieldcount-1],varvariant); for i := 0 to (t_price_ship.fieldcount-1) do begin afield[i] :=t_price_ship.fields[i].value ; end; t_price_ship.append; for i := 1 to (t_price_ship.fieldcount-1) do begin if t_price_ship.fields[i].FieldName<>'运价编号' then t_price_ship.fields[i].value := afield[i] ; end; t_price_ship['录入人']:=employee; t_price_ship['录入日期']:=date; showmessage('复制添加成功!!'); end; procedure TFrm_info_price_mgJJ.bsSkinButton11Click(Sender: TObject); begin table_post(t_price_ship); end; procedure TFrm_info_price_mgJJ.bsSkinButton4Click(Sender: TObject); begin table_delete(t_price_ship); end; procedure TFrm_info_price_mgJJ.bsSkinButton8Click(Sender: TObject); begin table_cancel(t_price_ship); end; procedure TFrm_info_price_mgJJ.bsSkinButton9Click(Sender: TObject); begin close; end; procedure TFrm_info_price_mgJJ.FormClose(Sender: TObject; var Action: TCloseAction); begin savewwgrid ; frm_info_price_mgJJ.Hide; frm_info_price_mgJJ.ManualFloat(frm_info_price_mgJJ.BoundsRect ); frm_main.freeTabs('Frm_info_price_mgJJ'); action:=cafree; frm_info_price_mgJJ:=nil; end; procedure TFrm_info_price_mgJJ.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose:=frm_close_query(t_price_ship); end; procedure TFrm_info_price_mgJJ.FormShow(Sender: TObject); begin loadwwgrid; t_price_ship.sql.Clear; t_price_ship.sql.add('SELECT * FROM t_price_ship where 1=1 '); t_price_ship.sql.add(' and '+open_data('3001','录入人','no','no','no','no')); t_price_ship.sql.add(' order by 航线 '); t_price_ship.open; t_price_agreement.open; end; procedure TFrm_info_price_mgJJ.bsSkinButton2Click(Sender: TObject); begin t_price_ship.insert; end; procedure TFrm_info_price_mgJJ.loadwwgrid; begin wwDBGrid1.IniAttributes.FileName:=caption+'jj' ; wwDBGrid1.LoadFromIniFile; end; procedure TFrm_info_price_mgJJ.savewwgrid; begin wwDBGrid1.IniAttributes.Enabled := True; wwDBGrid1.IniAttributes.FileName:=caption+'jj' ; wwDBGrid1.SaveToIniFile; end; procedure TFrm_info_price_mgJJ.bsSkinButton12Click(Sender: TObject); begin if t_price_ship.FieldByName('加锁').AsBoolean then exit ; t_price_ship.Edit ; t_price_ship.FieldByName('加锁').AsBoolean:=true ; t_price_ship.post ; end; procedure TFrm_info_price_mgJJ.bsSkinButton13Click(Sender: TObject); begin if not t_price_ship.FieldByName('加锁').AsBoolean then exit ; t_price_ship.Edit ; t_price_ship.FieldByName('加锁').AsBoolean:=False ; t_price_ship.post ; end; procedure TFrm_info_price_mgJJ.t_price_ship1DataChange(Sender: TObject; Field: TField); begin wwDBGrid1.ReadOnly:=t_price_ship.FieldByName('加锁').AsBoolean ; end; procedure TFrm_info_price_mgJJ.wwDBGrid1CalcCellColors(Sender: TObject; Field: TField; State: TGridDrawState; Highlight: Boolean; AFont: TFont; ABrush: TBrush); begin if t_price_ship.FieldByName('加锁').AsBoolean then brush.Color:=clskyblue else brush.color:=clwhite ; end; end.