unit u_op_card; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, bsSkinCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, XPMenu, Menus, Grids, Wwdbigrd, Wwdbgrid, StdCtrls, wwdblook; type Tfra_op_card = class(TFrame) bsSkinGroupBox1: TbsSkinGroupBox; t_op_card: TADOQuery; t_op_card1: TDataSource; XPMenu1: TXPMenu; PopupMenu1: TPopupMenu; N1: TMenuItem; N2: TMenuItem; N3: TMenuItem; N4: TMenuItem; N5: TMenuItem; N6: TMenuItem; N7: TMenuItem; N8: TMenuItem; N9: TMenuItem; N10: TMenuItem; N11: TMenuItem; N12: TMenuItem; N13: TMenuItem; N14: TMenuItem; N15: TMenuItem; N16: TMenuItem; N17: TMenuItem; N18: TMenuItem; N19: TMenuItem; N20: TMenuItem; N21: TMenuItem; N22: TMenuItem; N23: TMenuItem; N24: TMenuItem; N25: TMenuItem; N26: TMenuItem; N27: TMenuItem; N28: TMenuItem; wwDBGrid1: TwwDBGrid; wwDBLookupCombo2: TwwDBLookupCombo; wwDBLookupCombo1: TwwDBLookupCombo; wwDBLookupCombo3: TwwDBLookupCombo; procedure t_op_cardAfterInsert(DataSet: TDataSet); procedure t_op_cardBeforePost(DataSet: TDataSet); procedure N1Click(Sender: TObject); procedure dxDBGrid1Column1ButtonClick(Sender: TObject; AbsoluteIndex: Integer); procedure N3Click(Sender: TObject); procedure N4Click(Sender: TObject); procedure N7Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N15Click(Sender: TObject); procedure N19Click(Sender: TObject); procedure N24Click(Sender: TObject); procedure N21Click(Sender: TObject); procedure N26Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure N23Click(Sender: TObject); procedure N28Click(Sender: TObject); procedure t_op_cardBeforeInsert(DataSet: TDataSet); procedure FrameEnter(Sender: TObject); private procedure t_op_carddjoncharge(Sender: TField); procedure t_op_cardhmoncharge(Sender: TField); { Private declarations } public { Public declarations } end; implementation uses u_main, my_sys_function, u_op_card_add, u_data_share; {$R *.dfm} procedure Tfra_op_card.t_op_cardAfterInsert(DataSet: TDataSet); begin t_op_card['编号']:=t_op_card.DataSource.DataSet['编号']; t_op_card['是否回单']:=0; t_op_card['是否还单']:=0; end; procedure Tfra_op_card.t_op_cardBeforePost(DataSet: TDataSet); begin table_before_post(t_op_card,'单证名称'); end; procedure Tfra_op_card.N1Click(Sender: TObject); begin if t_op_card.DataSource.DataSet=nil then exit; if t_op_card.DataSource.DataSet.state=dsinsert then t_op_card.DataSource.DataSet.post; try frm_op_card_add:=tfrm_op_card_add.Create (self); frm_op_card_add.bsSkinCheckRadioBox2.Checked:=true; frm_op_card_add.DataSource1.Enabled:=false; frm_op_card_add.DataSource1.DataSet:=t_op_card; frm_op_card_add.DataSource1.Enabled:=true; frm_op_card_add.ShowModal; finally frm_op_card_add.Free; frm_op_card_add:=nil; end; end; procedure Tfra_op_card.dxDBGrid1Column1ButtonClick(Sender: TObject; AbsoluteIndex: Integer); begin try frm_op_card_add:=tfrm_op_card_add.Create (self); frm_op_card_add.bsSkinCheckRadioBox1.Checked:=true; frm_op_card_add.DataSource1.DataSet:=t_op_card; frm_op_card_add.ShowModal; finally frm_op_card_add.Free; frm_op_card_add:=nil; end; end; procedure Tfra_op_card.N3Click(Sender: TObject); begin table_post(t_op_card); end; procedure Tfra_op_card.N4Click(Sender: TObject); var i:integer; begin if t_op_card.isempty then exit; if application.MessageBox('您确定要删除数据吗?','警告:',MB_OKCANCEL)<>IDOK then exit; if wwDBGrid1.SelectedList.Count>=1 then begin for i:=0 to wwDBGrid1.SelectedList.Count-1 do begin t_op_card.GotoBookmark(pointer(wwDBGrid1.SelectedList[i])); t_op_card.delete; end; end else begin t_op_card.delete; end; end; procedure Tfra_op_card.N7Click(Sender: TObject); begin table_cancel(t_op_card); end; procedure Tfra_op_card.N14Click(Sender: TObject); begin if t_op_card.isempty then exit; t_op_card.Edit; t_op_card['送单日期']:=date; t_op_card.post; end; procedure Tfra_op_card.N15Click(Sender: TObject); var i:integer; begin if t_op_card.isempty then exit; if wwDBGrid1.SelectedList.Count>=1 then begin for i:=0 to wwDBGrid1.SelectedList.Count-1 do begin t_op_card.GotoBookmark(pointer(wwDBGrid1.SelectedList[i])); t_op_card.Edit; t_op_card['送单日期']:=date; t_op_card.post; end; end else begin t_op_card.Edit; t_op_card['送单日期']:=date; t_op_card.post; end; end; procedure Tfra_op_card.N19Click(Sender: TObject); begin if t_op_card.isempty then exit; t_op_card.Edit; t_op_card['是否回单']:=1; t_op_card['回单日期']:=date; t_op_card.post; end; procedure Tfra_op_card.N24Click(Sender: TObject); begin if t_op_card.isempty then exit; t_op_card.Edit; t_op_card['是否回单']:=1; t_op_card['是否还单']:=1; t_op_card['还单日期']:=date; t_op_card.post; end; procedure Tfra_op_card.N21Click(Sender: TObject); var i:integer; begin if t_op_card.isempty then exit; if wwDBGrid1.SelectedList.Count>=1 then begin for i:=0 to wwDBGrid1.SelectedList.Count-1 do begin t_op_card.GotoBookmark(pointer(wwDBGrid1.SelectedList[i])); t_op_card.Edit; t_op_card['是否回单']:=1; t_op_card['回单日期']:=date; t_op_card.post; end; end else begin t_op_card.Edit; t_op_card['是否回单']:=1; t_op_card['回单日期']:=date; t_op_card.post; end; end; procedure Tfra_op_card.N26Click(Sender: TObject); var i:integer; begin if t_op_card.isempty then exit; if wwDBGrid1.SelectedList.Count>=1 then begin for i:=0 to wwDBGrid1.SelectedList.Count-1 do begin t_op_card.GotoBookmark(pointer(wwDBGrid1.SelectedList[i])); t_op_card.Edit; t_op_card['是否回单']:=1; t_op_card['是否还单']:=1; t_op_card['还单日期']:=date; t_op_card.post; end; end else begin t_op_card.Edit; t_op_card['是否回单']:=1; t_op_card['是否还单']:=1; t_op_card['还单日期']:=date; t_op_card.post; end; end; procedure Tfra_op_card.N16Click(Sender: TObject); begin if t_op_card.isempty then exit; t_op_card.first; while not t_op_card.eof do begin t_op_card.Edit; t_op_card['送单日期']:=date; t_op_card.post; t_op_card.next; end; end; procedure Tfra_op_card.N23Click(Sender: TObject); begin if t_op_card.isempty then exit; t_op_card.first; while not t_op_card.eof do begin t_op_card.Edit; t_op_card['是否回单']:=1; t_op_card['回单日期']:=date; t_op_card.post; t_op_card.next; end; end; procedure Tfra_op_card.N28Click(Sender: TObject); begin if t_op_card.isempty then exit; t_op_card.first; while not t_op_card.eof do begin t_op_card.Edit; t_op_card['是否回单']:=1; t_op_card['是否还单']:=1; t_op_card['还单日期']:=date; t_op_card.post; t_op_card.next; end; end; procedure Tfra_op_card.t_op_cardBeforeInsert(DataSet: TDataSet); begin if t_op_card.DataSource.DataSet.State=dsinsert then t_op_card.DataSource.DataSet.post; end; procedure Tfra_op_card.t_op_carddjoncharge(Sender: TField); begin if t_op_card.DataSource.DataSet.FindField(Sender.AsString+'号')<>nil then begin if t_op_card.DataSource.DataSet.Fieldbyname(Sender.AsString+'号').AsString<>'' then begin t_op_card.Edit; t_op_card.fieldbyname('单证号码').AsString:=t_op_card.DataSource.DataSet.Fieldbyname(t_op_card.fieldbyname('单证名称').AsString+'号').AsString; t_op_card.Post; end; end; end; procedure Tfra_op_card.FrameEnter(Sender: TObject); begin t_op_card.FieldByName('单证名称').OnChange:=t_op_carddjoncharge; t_op_card.FieldByName('单证号码').OnChange:=t_op_cardhmoncharge; end; procedure Tfra_op_card.t_op_cardhmoncharge(Sender: TField); var dname,dno:string; begin { dname:=sender.DataSet.fieldbyname('单证名称').AsString+'号'; dno:=sender.AsString; if t_op_card.DataSource.DataSet.FindField(dname)<>nil then begin t_op_card.DataSource.DataSet.Edit; t_op_card.DataSource.DataSet.Fieldbyname(dname).Value:=dno; t_op_card.DataSource.DataSet.Post; end; } end; end.