U_kcpd_child.pas
上传用户:psxgmh
上传日期:2013-04-08
资源大小:15112k
文件大小:7k
- unit U_kcpd_child;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- ComCtrls, ToolWin, Grids, DBGrids, ExtCtrls, Menus, ImgList, Db, DBClient;
- type
- TForm65 = class(TForm)
- Panel1: TPanel;
- DBGrid1: TDBGrid;
- ToolBar1: TToolBar;
- ToolButton1: TToolButton;
- ToolButton2: TToolButton;
- ToolButton3: TToolButton;
- ToolButton4: TToolButton;
- ToolButton5: TToolButton;
- ToolButton6: TToolButton;
- ToolButton7: TToolButton;
- StatusBar1: TStatusBar;
- ClientDataSet1: TClientDataSet;
- ClientDataSet1ID: TIntegerField;
- ClientDataSet1CDSDesigner: TStringField;
- ClientDataSet1CDSDesigner2: TStringField;
- ClientDataSet1CDSDesigner3: TDateTimeField;
- ClientDataSet1CDSDesigner4: TStringField;
- ClientDataSet1CDSDesigner5: TStringField;
- ClientDataSet1Q_KCPD_CHILD: TDataSetField;
- DataSource1: TDataSource;
- ImageList1: TImageList;
- PopupMenu1: TPopupMenu;
- N2: TMenuItem;
- N1: TMenuItem;
- N5: TMenuItem;
- ClientDataSet1CDSDesigner6: TBooleanField;
- ClientDataSet1CDSDesigner7: TStringField;
- ClientDataSet1CDSDesigner8: TDateTimeField;
- Timer1: TTimer;
- ToolButton8: TToolButton;
- procedure ToolButton1Click(Sender: TObject);
- procedure ToolButton2Click(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure ToolButton6Click(Sender: TObject);
- procedure N2Click(Sender: TObject);
- procedure N1Click(Sender: TObject);
- procedure N5Click(Sender: TObject);
- procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
- DataCol: Integer; Column: TColumn; State: TGridDrawState);
- procedure Timer1Timer(Sender: TObject);
- procedure ToolButton3Click(Sender: TObject);
- procedure ToolButton8Click(Sender: TObject);
- procedure ToolButton4Click(Sender: TObject);
- procedure ToolButton7Click(Sender: TObject);
- procedure DBGrid1TitleClick(Column: TColumn);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form65: TForm65;
- implementation
- uses U_mainform, U_kcpd, U_pdgl_djsh, U_dwck, U_general_print;
- {$R *.DFM}
- procedure TForm65.ToolButton1Click(Sender: TObject);
- begin
- application.CreateForm(Tform5, form5);
- try
- form5.speedbutton1.click;
- form5.showmodal;
- finally
- form5.free;
- end;
- end;
- procedure TForm65.ToolButton2Click(Sender: TObject);
- begin
- if clientdataset1.RecordCount = 0 then
- begin
- application.messagebox('没有记录可删除', '物资管理系统', mb_iconinformation + mb_defbutton1);
- exit;
- end;
- if clientdataset1.fieldbyname('是否审核').value = true then
- begin
- application.messagebox('此盘点已审核,不能删除', '物资管理系统', mb_iconinformation + mb_defbutton1);
- exit;
- end;
- if application.messagebox('请确认是否要删除', '物资管理系统', mb_iconinformation + mb_yesno) = id_yes then
- begin
- clientdataset1.delete;
- clientdataset1.applyupdates(0);
- end;
- end;
- procedure TForm65.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- action := cafree;
- form65 := nil;
- end;
- procedure TForm65.ToolButton6Click(Sender: TObject);
- begin
- clientdataset1.refresh;
- end;
- procedure TForm65.N2Click(Sender: TObject);
- begin
- clientdataset1.filter := '是否审核=0 or 是否审核=null';
- clientdataset1.filtered := true;
- statusbar1.panels[1].text := '未审核';
- statusbar1.Refresh;
- end;
- procedure TForm65.N1Click(Sender: TObject);
- begin
- clientdataset1.filter := '是否审核=1';
- clientdataset1.filtered := true;
- statusbar1.panels[1].text := '已审核';
- statusbar1.Refresh;
- end;
- procedure TForm65.N5Click(Sender: TObject);
- begin
- clientdataset1.filtered := false;
- statusbar1.panels[1].text := '全部';
- statusbar1.Refresh;
- end;
- procedure TForm65.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
- DataCol: Integer; Column: TColumn; State: TGridDrawState);
- begin
- if clientdataset1.FieldByName('是否审核').value = true then
- dbgrid1.Canvas.Font.Color := clsilver;
- dbgrid1.DefaultDrawDataCell(Rect, Column.field, state);
- end;
- procedure TForm65.Timer1Timer(Sender: TObject);
- begin
- statusbar1.Panels[2].text := '共有:' + inttostr(clientdataset1.recordcount) + '条记录';
- statusbar1.Refresh;
- end;
- procedure TForm65.ToolButton3Click(Sender: TObject);
- begin
- if clientdataset1.recordcount = 0 then
- begin
- application.MessageBox('没有记录可编辑', '材料与计划管理系统', mb_iconinformation + mb_defbutton1);
- exit;
- end;
- if clientdataset1.FieldByName('是否审核').value = true then
- begin
- application.MessageBox('此单据已审核,不能编辑', '材料与计划管理系统', mb_iconinformation + mb_defbutton1);
- application.CreateForm(Tform5, form5);
- try
- form5.speedbutton1.enabled := false;
- form5.speedbutton2.enabled := false;
- form5.speedbutton4.enabled := false;
- form5.speedbutton5.enabled := false;
- form5.speedbutton6.enabled := false;
- form5.speedbutton7.enabled := false;
- form5.speedbutton8.enabled := false;
- form5.showmodal;
- finally
- form5.free;
- end;
- exit;
- end;
- application.CreateForm(Tform5, form5);
- try
- form5.speedbutton6.click;
- form5.showmodal;
- finally
- form5.free;
- end;
- end;
- procedure TForm65.ToolButton8Click(Sender: TObject);
- begin
- if clientdataset1.FieldByName('是否审核').value = true then
- begin
- application.MessageBox('此单据已审核', '材料与计划管理系统', mb_iconinformation + mb_defbutton1);
- exit;
- end;
- if application.MessageBox('请确认是否审核通过', '材料与计划管理系统', mb_iconinformation + mb_yesno) = idyes then
- begin
- application.createform(Tform54, form54);
- try
- form54.showmodal;
- finally
- form54.free;
- end;
- end;
- end;
- procedure TForm65.ToolButton4Click(Sender: TObject);
- begin
- application.createform(Tform77, form77);
- form77.combobox1.items.add('仓库名称');
- form77.combobox1.items.add('盘点编号');
- form77.combobox1.items.add('盘点日期');
- form77.combobox1.items.add('盘点人');
- form77.combobox1.items.add('备注');
- v_table := 'CL_KCPD';
- try
- form77.showmodal;
- finally
- form77.free;
- if sf_qr = 'yes' then
- begin
- clientdataset1.filter := xx401;
- clientdataset1.filtered := true;
- end;
- end;
- end;
- procedure TForm65.ToolButton7Click(Sender: TObject);
- begin
- application.createform(Tform80, form80);
- form80.srclist.items.add('仓库名称');
- form80.srclist.items.add('盘点编号');
- form80.srclist.items.add('盘点日期');
- form80.srclist.items.add('盘点人');
- form80.srclist.items.add('备注');
- vps_tablename := 'CL_kcpd';
- vps_filter := clientdataset1.Filter;
- vps_index := clientdataset1.IndexFieldNames;
- Form80.Edit1.Text := '库存盘点单据';
- try
- form80.showmodal;
- finally
- form80.free;
- end;
- end;
- procedure TForm65.DBGrid1TitleClick(Column: TColumn);
- begin
- Form1.MySort(dbgrid1, column);
- end;
- end.