unit u_op_kuaidi_manage; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, ExtCtrls, DB, ADODB, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, wwdbdatetimepicker, RxLookup, StdCtrls, Mask, wwdbedit, Wwdotdot, Wwdbcomb; type Tfrm_op_kuaidi_manage = class(TForm) Panel1: TPanel; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton9: TbsSkinButton; t_op_kuaidi_manage: TADOQuery; t_op_kuaidi_manage1: TDataSource; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; dxDBGrid1Column9: TdxDBGridDateColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridColumn; bsSkinButton8: TbsSkinButton; bsSkinPanel1: TbsSkinPanel; bsSkinButton5: TbsSkinButton; dxDBGrid1Column11: TdxDBGridColumn; dxDBGrid1Column12: TdxDBGridColumn; Label1: TLabel; Label7: TLabel; wwDBComboBox1: TwwDBComboBox; Label9: TLabel; RxDBLookupCombo2: TRxDBLookupCombo; Label3: TLabel; RxDBLookupCombo1: TRxDBLookupCombo; Label2: TLabel; Label5: TLabel; wwDBComboBox2: TwwDBComboBox; Label13: TLabel; RxDBLookupCombo5: TRxDBLookupCombo; Label11: TLabel; wwDBDateTimePicker4: TwwDBDateTimePicker; Label8: TLabel; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Label4: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; Label6: TLabel; wwDBDateTimePicker2: TwwDBDateTimePicker; wwDBDateTimePicker3: TwwDBDateTimePicker; Label10: TLabel; dxDBGrid1Column13: TdxDBGridColumn; procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure t_op_kuaidi_manageAfterInsert(DataSet: TDataSet); procedure t_op_kuaidi_manageBeforePost(DataSet: TDataSet); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormShow(Sender: TObject); procedure Panel1Resize(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure t_op_kuaidi_manageBeforeEdit(DataSet: TDataSet); private { Private declarations } public { Public declarations } end; var frm_op_kuaidi_manage: Tfrm_op_kuaidi_manage; implementation uses u_main, u_op_kuaidi_manage_modify, my_sys_function; {$R *.dfm} procedure Tfrm_op_kuaidi_manage.bsSkinButton7Click(Sender: TObject); begin table_Prior(frm_op_kuaidi_manage.t_op_kuaidi_manage); end; procedure Tfrm_op_kuaidi_manage.bsSkinButton6Click(Sender: TObject); begin table_next(frm_op_kuaidi_manage.t_op_kuaidi_manage); end; procedure Tfrm_op_kuaidi_manage.bsSkinButton4Click(Sender: TObject); begin table_delete(t_op_kuaidi_manage); end; procedure Tfrm_op_kuaidi_manage.bsSkinButton9Click(Sender: TObject); begin close; end; procedure Tfrm_op_kuaidi_manage.t_op_kuaidi_manageAfterInsert( DataSet: TDataSet); begin t_op_kuaidi_manage['付费方式']:='预付'; t_op_kuaidi_manage['金额']:=0; t_op_kuaidi_manage['收发人员']:=employee; t_op_kuaidi_manage['收发时间']:=date; t_op_kuaidi_manage['录入人']:=employee; t_op_kuaidi_manage['录入日期']:=date; end; procedure Tfrm_op_kuaidi_manage.t_op_kuaidi_manageBeforePost( DataSet: TDataSet); begin table_before_post(t_op_kuaidi_manage,'快递编号'); table_before_post(t_op_kuaidi_manage,'收发类别'); table_before_post(t_op_kuaidi_manage,'快递公司'); table_before_post(t_op_kuaidi_manage,'业务号码'); table_before_post(t_op_kuaidi_manage,'客户名称'); table_before_post(t_op_kuaidi_manage,'付费方式'); table_before_post(t_op_kuaidi_manage,'快递内容'); table_before_post(t_op_kuaidi_manage,'收发人员'); table_before_post(t_op_kuaidi_manage,'收发时间'); end; procedure Tfrm_op_kuaidi_manage.bsSkinButton2Click(Sender: TObject); begin try frm_op_kuaidi_manage_modify:=tfrm_op_kuaidi_manage_modify.Create (self); t_op_kuaidi_manage.insert; frm_op_kuaidi_manage_modify.ShowModal; finally frm_op_kuaidi_manage_modify.Free; frm_op_kuaidi_manage_modify:=nil; end; end; procedure Tfrm_op_kuaidi_manage.bsSkinButton3Click(Sender: TObject); begin if t_op_kuaidi_manage.IsEmpty then exit; try frm_op_kuaidi_manage_modify:=tfrm_op_kuaidi_manage_modify.Create (self); frm_op_kuaidi_manage_modify.ShowModal; finally frm_op_kuaidi_manage_modify.Free; frm_op_kuaidi_manage_modify:=nil; end; end; procedure Tfrm_op_kuaidi_manage.bsSkinButton8Click(Sender: TObject); begin sys_print('快递收付登记',2,nil,nil,nil,nil,t_op_kuaidi_manage1,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_kuaidi_manage.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_op_kuaidi_manage.Hide; frm_op_kuaidi_manage.ManualFloat(frm_op_kuaidi_manage.BoundsRect ); frm_main.freeTabs('frm_op_kuaidi_manage'); action:=cafree; frm_op_kuaidi_manage:=nil; end; procedure Tfrm_op_kuaidi_manage.FormShow(Sender: TObject); begin loadreggrid(dxdbgrid1,false,caption); t_op_kuaidi_manage.close; t_op_kuaidi_manage.Parameters.ParamByName('录入日期').value:=date-7; t_op_kuaidi_manage.Parameters.ParamByName('录入人').value:=employee; t_op_kuaidi_manage.open; end; procedure Tfrm_op_kuaidi_manage.Panel1Resize(Sender: TObject); var i:integer; begin i:=round(Panel1.width/9); bsSkinButton7.width:=i; bsSkinButton6.width:=i; bsSkinButton8.width:=i; bsSkinButton2.width:=i; bsSkinButton3.width:=i; bsSkinButton4.width:=i; bsSkinButton5.width:=i; bsSkinButton1.width:=i; end; procedure Tfrm_op_kuaidi_manage.bsSkinButton5Click(Sender: TObject); begin Edit1.text:=''; wwDBComboBox1.text:=''; wwDBComboBox2.text:=''; Edit2.text:=''; RxDBLookupCombo2.ClearValue; RxDBLookupCombo1.ClearValue; RxDBLookupCombo5.ClearValue; Edit3.text:=''; wwDBDateTimePicker4.text:=''; wwDBDateTimePicker1.text:=''; wwDBDateTimePicker3.text:=''; wwDBDateTimePicker2.text:=''; end; procedure Tfrm_op_kuaidi_manage.bsSkinButton1Click(Sender: TObject); var str:widestring; begin if Edit1.text<>''then str:=str+' and 快递编号 like '+''''+'%'+Edit1.text+'%'+''''; if wwDBComboBox1.text<>''then str:=str+' and 收发类别='+''''+wwDBComboBox1.text+''''; if wwDBComboBox2.text<>''then str:=str+' and 付费方式='+''''+wwDBComboBox2.text+''''; if Edit2.text<>''then str:=str+' and 业务号码 like '+''''+'%'+Edit2.text+'%'+''''; if RxDBLookupCombo2.DisplayValue<>''then str:=str+' and 快递公司='+''''+RxDBLookupCombo2.DisplayValues[1]+''''; if RxDBLookupCombo1.DisplayValue<>''then str:=str+' and 客户名称='+''''+RxDBLookupCombo1.DisplayValues[1]+''''; if RxDBLookupCombo5.DisplayValue<>''then str:=str+' and 收发人员='+''''+RxDBLookupCombo5.DisplayValue+''''; if Edit3.text<>''then str:=str+' and 快递内容 like '+''''+'%'+Edit3.text+'%'+''''; if wwDBDateTimePicker4.text<>''then str:=str+' and 收发时间>='+''''+wwDBDateTimePicker4.text+''''; if wwDBDateTimePicker1.text<>''then str:=str+' and 收发时间<='+''''+wwDBDateTimePicker1.text+''''; if wwDBDateTimePicker3.text<>''then str:=str+' and 录入日期>='+''''+wwDBDateTimePicker3.text+''''; if wwDBDateTimePicker2.text<>''then str:=str+' and 录入日期<='+''''+wwDBDateTimePicker2.text+''''; if str<>''then begin STR:=COPY(STR,5,LENGTH(STR)-4); STR:='WHERE '+STR; end; str:='select * from t_op_kuaidi_manage '+str+' order by 快递编号'; t_op_kuaidi_manage.close; t_op_kuaidi_manage.SQL.clear; t_op_kuaidi_manage.sql.add(str); t_op_kuaidi_manage.open; end; procedure Tfrm_op_kuaidi_manage.t_op_kuaidi_manageBeforeEdit( DataSet: TDataSet); begin if t_op_kuaidi_manage.fieldbyname('录入人').asstring<>employee then begin showmessage('对不起你无权修改他人的数据!!'); abort; end; end; end.