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; type Tfra_op_card = class(TFrame) bsSkinGroupBox1: TbsSkinGroupBox; t_op_card: TADOQuery; t_op_card1: TDataSource; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridButtonColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridDateColumn; dxDBGrid1Column4: TdxDBGridDateColumn; dxDBGrid1Column5: TdxDBGridCheckColumn; dxDBGrid1Column6: TdxDBGridDateColumn; dxDBGrid1Column7: TdxDBGridCheckColumn; dxDBGrid1Column8: TdxDBGridDateColumn; dxDBGrid1Column9: TdxDBGridMaskColumn; 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; 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); private { Private declarations } public { Public declarations } end; implementation uses u_main, my_sys_function, u_op_card_add; {$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 dxDBGrid1.SelectedCount>=1 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_card.GotoBookmark(pointer(dxDBGrid1.selectedrows[0])); 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 dxDBGrid1.SelectedCount>=1 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_card.GotoBookmark(pointer(dxDBGrid1.selectedrows[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 dxDBGrid1.SelectedCount>=1 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_card.GotoBookmark(pointer(dxDBGrid1.selectedrows[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 dxDBGrid1.SelectedCount>=1 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_card.GotoBookmark(pointer(dxDBGrid1.selectedrows[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; end.