U_kcpd_child.pas
上传用户:psxgmh
上传日期:2013-04-08
资源大小:15112k
文件大小:7k
源码类别:

Delphi/CppBuilder

开发平台:

Delphi

  1. unit U_kcpd_child;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  5.   ComCtrls, ToolWin, Grids, DBGrids, ExtCtrls, Menus, ImgList, Db, DBClient;
  6. type
  7.   TForm65 = class(TForm)
  8.     Panel1: TPanel;
  9.     DBGrid1: TDBGrid;
  10.     ToolBar1: TToolBar;
  11.     ToolButton1: TToolButton;
  12.     ToolButton2: TToolButton;
  13.     ToolButton3: TToolButton;
  14.     ToolButton4: TToolButton;
  15.     ToolButton5: TToolButton;
  16.     ToolButton6: TToolButton;
  17.     ToolButton7: TToolButton;
  18.     StatusBar1: TStatusBar;
  19.     ClientDataSet1: TClientDataSet;
  20.     ClientDataSet1ID: TIntegerField;
  21.     ClientDataSet1CDSDesigner: TStringField;
  22.     ClientDataSet1CDSDesigner2: TStringField;
  23.     ClientDataSet1CDSDesigner3: TDateTimeField;
  24.     ClientDataSet1CDSDesigner4: TStringField;
  25.     ClientDataSet1CDSDesigner5: TStringField;
  26.     ClientDataSet1Q_KCPD_CHILD: TDataSetField;
  27.     DataSource1: TDataSource;
  28.     ImageList1: TImageList;
  29.     PopupMenu1: TPopupMenu;
  30.     N2: TMenuItem;
  31.     N1: TMenuItem;
  32.     N5: TMenuItem;
  33.     ClientDataSet1CDSDesigner6: TBooleanField;
  34.     ClientDataSet1CDSDesigner7: TStringField;
  35.     ClientDataSet1CDSDesigner8: TDateTimeField;
  36.     Timer1: TTimer;
  37.     ToolButton8: TToolButton;
  38.     procedure ToolButton1Click(Sender: TObject);
  39.     procedure ToolButton2Click(Sender: TObject);
  40.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  41.     procedure ToolButton6Click(Sender: TObject);
  42.     procedure N2Click(Sender: TObject);
  43.     procedure N1Click(Sender: TObject);
  44.     procedure N5Click(Sender: TObject);
  45.     procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  46.       DataCol: Integer; Column: TColumn; State: TGridDrawState);
  47.     procedure Timer1Timer(Sender: TObject);
  48.     procedure ToolButton3Click(Sender: TObject);
  49.     procedure ToolButton8Click(Sender: TObject);
  50.     procedure ToolButton4Click(Sender: TObject);
  51.     procedure ToolButton7Click(Sender: TObject);
  52.     procedure DBGrid1TitleClick(Column: TColumn);
  53.   private
  54.     { Private declarations }
  55.   public
  56.     { Public declarations }
  57.   end;
  58. var
  59.   Form65: TForm65;
  60. implementation
  61. uses U_mainform, U_kcpd, U_pdgl_djsh, U_dwck, U_general_print;
  62. {$R *.DFM}
  63. procedure TForm65.ToolButton1Click(Sender: TObject);
  64. begin
  65.   application.CreateForm(Tform5, form5);
  66.   try
  67.     form5.speedbutton1.click;
  68.     form5.showmodal;
  69.   finally
  70.     form5.free;
  71.   end;
  72. end;
  73. procedure TForm65.ToolButton2Click(Sender: TObject);
  74. begin
  75.   if clientdataset1.RecordCount = 0 then
  76.   begin
  77.     application.messagebox('没有记录可删除', '物资管理系统', mb_iconinformation + mb_defbutton1);
  78.     exit;
  79.   end;
  80.   if clientdataset1.fieldbyname('是否审核').value = true then
  81.   begin
  82.     application.messagebox('此盘点已审核,不能删除', '物资管理系统', mb_iconinformation + mb_defbutton1);
  83.     exit;
  84.   end;
  85.   if application.messagebox('请确认是否要删除', '物资管理系统', mb_iconinformation + mb_yesno) = id_yes then
  86.   begin
  87.     clientdataset1.delete;
  88.     clientdataset1.applyupdates(0);
  89.   end;
  90. end;
  91. procedure TForm65.FormClose(Sender: TObject; var Action: TCloseAction);
  92. begin
  93.   action := cafree;
  94.   form65 := nil;
  95. end;
  96. procedure TForm65.ToolButton6Click(Sender: TObject);
  97. begin
  98.   clientdataset1.refresh;
  99. end;
  100. procedure TForm65.N2Click(Sender: TObject);
  101. begin
  102.   clientdataset1.filter := '是否审核=0 or 是否审核=null';
  103.   clientdataset1.filtered := true;
  104.   statusbar1.panels[1].text := '未审核';
  105.   statusbar1.Refresh;
  106. end;
  107. procedure TForm65.N1Click(Sender: TObject);
  108. begin
  109.   clientdataset1.filter := '是否审核=1';
  110.   clientdataset1.filtered := true;
  111.   statusbar1.panels[1].text := '已审核';
  112.   statusbar1.Refresh;
  113. end;
  114. procedure TForm65.N5Click(Sender: TObject);
  115. begin
  116.   clientdataset1.filtered := false;
  117.   statusbar1.panels[1].text := '全部';
  118.   statusbar1.Refresh;
  119. end;
  120. procedure TForm65.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  121.   DataCol: Integer; Column: TColumn; State: TGridDrawState);
  122. begin
  123.   if clientdataset1.FieldByName('是否审核').value = true then
  124.     dbgrid1.Canvas.Font.Color := clsilver;
  125.   dbgrid1.DefaultDrawDataCell(Rect, Column.field, state);
  126. end;
  127. procedure TForm65.Timer1Timer(Sender: TObject);
  128. begin
  129.   statusbar1.Panels[2].text := '共有:' + inttostr(clientdataset1.recordcount) + '条记录';
  130.   statusbar1.Refresh;
  131. end;
  132. procedure TForm65.ToolButton3Click(Sender: TObject);
  133. begin
  134.   if clientdataset1.recordcount = 0 then
  135.   begin
  136.     application.MessageBox('没有记录可编辑', '材料与计划管理系统', mb_iconinformation + mb_defbutton1);
  137.     exit;
  138.   end;
  139.   if clientdataset1.FieldByName('是否审核').value = true then
  140.   begin
  141.     application.MessageBox('此单据已审核,不能编辑', '材料与计划管理系统', mb_iconinformation + mb_defbutton1);
  142.     application.CreateForm(Tform5, form5);
  143.     try
  144.       form5.speedbutton1.enabled := false;
  145.       form5.speedbutton2.enabled := false;
  146.       form5.speedbutton4.enabled := false;
  147.       form5.speedbutton5.enabled := false;
  148.       form5.speedbutton6.enabled := false;
  149.       form5.speedbutton7.enabled := false;
  150.       form5.speedbutton8.enabled := false;
  151.       form5.showmodal;
  152.     finally
  153.       form5.free;
  154.     end;
  155.     exit;
  156.   end;
  157.   application.CreateForm(Tform5, form5);
  158.   try
  159.     form5.speedbutton6.click;
  160.     form5.showmodal;
  161.   finally
  162.     form5.free;
  163.   end;
  164. end;
  165. procedure TForm65.ToolButton8Click(Sender: TObject);
  166. begin
  167.   if clientdataset1.FieldByName('是否审核').value = true then
  168.   begin
  169.     application.MessageBox('此单据已审核', '材料与计划管理系统', mb_iconinformation + mb_defbutton1);
  170.     exit;
  171.   end;
  172.   if application.MessageBox('请确认是否审核通过', '材料与计划管理系统', mb_iconinformation + mb_yesno) = idyes then
  173.   begin
  174.     application.createform(Tform54, form54);
  175.     try
  176.       form54.showmodal;
  177.     finally
  178.       form54.free;
  179.     end;
  180.   end;
  181. end;
  182. procedure TForm65.ToolButton4Click(Sender: TObject);
  183. begin
  184.   application.createform(Tform77, form77);
  185.   form77.combobox1.items.add('仓库名称');
  186.   form77.combobox1.items.add('盘点编号');
  187.   form77.combobox1.items.add('盘点日期');
  188.   form77.combobox1.items.add('盘点人');
  189.   form77.combobox1.items.add('备注');
  190.   v_table := 'CL_KCPD';
  191.   try
  192.     form77.showmodal;
  193.   finally
  194.     form77.free;
  195.     if sf_qr = 'yes' then
  196.     begin
  197.       clientdataset1.filter := xx401;
  198.       clientdataset1.filtered := true;
  199.     end;
  200.   end;
  201. end;
  202. procedure TForm65.ToolButton7Click(Sender: TObject);
  203. begin
  204.   application.createform(Tform80, form80);
  205.   form80.srclist.items.add('仓库名称');
  206.   form80.srclist.items.add('盘点编号');
  207.   form80.srclist.items.add('盘点日期');
  208.   form80.srclist.items.add('盘点人');
  209.   form80.srclist.items.add('备注');
  210.   vps_tablename := 'CL_kcpd';
  211.   vps_filter := clientdataset1.Filter;
  212.   vps_index := clientdataset1.IndexFieldNames;
  213.   Form80.Edit1.Text := '库存盘点单据';
  214.   try
  215.     form80.showmodal;
  216.   finally
  217.     form80.free;
  218.   end;
  219. end;
  220. procedure TForm65.DBGrid1TitleClick(Column: TColumn);
  221. begin
  222.   Form1.MySort(dbgrid1, column);
  223. end;
  224. end.