U_Clsldjshkp.pas
上传用户:psxgmh
上传日期:2013-04-08
资源大小:15112k
文件大小:4k
- unit U_Clsldjshkp;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- ExtCtrls, StdCtrls, Mask, DBCtrls, Buttons, Db, DBClient;
- type
- TfrmClsldDjsh = class(TForm)
- Panel1: TPanel;
- Panel2: TPanel;
- SpeedButton1: TSpeedButton;
- SpeedButton2: TSpeedButton;
- Label1: TLabel;
- DBEdit1: TDBEdit;
- Label2: TLabel;
- DBEdit2: TDBEdit;
- BitBtn1: TBitBtn;
- procedure BitBtn1Click(Sender: TObject);
- procedure SpeedButton1Click(Sender: TObject);
- procedure SpeedButton2Click(Sender: TObject);
- procedure FormActivate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- frmClsldDjsh: TfrmClsldDjsh;
- implementation
- uses U_djsh, U_fzlr_zgxm, U_mainform, WzglDB, u_public;
- {$R *.DFM}
- procedure TfrmClsldDjsh.BitBtn1Click(Sender: TObject);
- begin
- DM.CDS_CLSLD.FieldByName('审核人').value := GetEmployeeName;
- end;
- procedure TfrmClsldDjsh.SpeedButton1Click(Sender: TObject);
- var
- SysDate: oleVariant;
- vs_clbm: string;
- vr_sssl, vr_yssl: real; //实收数量,原有数量
- vs_ckmc: string; //仓库名称
- begin
- DM.CDS_KC.Close;
- DM.CDS_KC.Open;
- if dbedit2.text = '' then
- begin
- application.MessageBox('审核人不能为空', '物资管理系统', mb_iconinformation + mb_defbutton1);
- dbedit2.SetFocus;
- exit;
- end;
- DM.CDS_CLSLD.fieldbyname('是否审核').value := true;
- DM.CDS_CLSLD.post;
- DM.CDS_CLSLD.applyupdates(0);
- DM.CDS_CLSLD_DETAIL.First;
- vs_ckmc := DM.CDS_CLSLD.fieldbyname('仓库名称').value;
- DM.CDS_CLSLD_DETAIL.disablecontrols;
- while not DM.CDS_CLSLD_DETAIL.eof do
- begin
- vs_clbm := DM.CDS_CLSLD_DETAIL.fieldbyname('材料编号').value;
- DM.CDS_KC.IndexFieldNames := '材料编码;仓库名称';
- if DM.CDS_KC.findkey([vs_clbm, vs_ckmc]) then
- begin
- vr_sssl := DM.CDS_CLSLD_DETAIL.fieldbyname('实收数量').value;
- vr_yssl := DM.CDS_KC.fieldbyname('现有库存量').value;
- DM.CDS_KC.Insert;
- DM.CDS_KC.FieldByName('材料编码').value := DM.CDS_CLSLD_DETAIL.fieldbyname('材料编号').value;
- DM.CDS_KC.FieldByName('材料名称').value := DM.CDS_CLSLD_DETAIL.fieldbyname('材料名称').value;
- DM.CDS_KC.FieldByName('规格型号').value := DM.CDS_CLSLD_DETAIL.fieldbyname('规格型号').value;
- DM.CDS_KC.FieldByName('计量单位').value := DM.CDS_CLSLD_DETAIL.fieldbyname('计量单位').value;
- DM.CDS_KC.FieldByName('计划单价').value := DM.CDS_CLSLD_DETAIL.fieldbyname('计划单价').value;
- DM.CDS_KC.FieldByName('单价单位').value := DM.CDS_CLSLD_DETAIL.fieldbyname('单价单位').value;
- DM.CDS_KC.FieldByName('现有库存量').value := vr_sssl + vr_yssl;
- DM.CDS_KC.fieldbyname('仓库名称').value := vs_ckmc;
- frmMain.SocketConnection.AppServer.GetSysTime(sysDate);
- DM.CDS_KC.fieldbyname('截止日期').value := sysDate;
- end
- else
- begin
- DM.CDS_KC.Insert;
- DM.CDS_KC.FieldByName('材料编码').value := DM.CDS_CLSLD_DETAIL.fieldbyname('材料编号').value;
- DM.CDS_KC.FieldByName('材料名称').value := DM.CDS_CLSLD_DETAIL.fieldbyname('材料名称').value;
- DM.CDS_KC.FieldByName('规格型号').value := DM.CDS_CLSLD_DETAIL.fieldbyname('规格型号').value;
- DM.CDS_KC.FieldByName('计量单位').value := DM.CDS_CLSLD_DETAIL.fieldbyname('计量单位').value;
- DM.CDS_KC.FieldByName('计划单价').value := DM.CDS_CLSLD_DETAIL.fieldbyname('计划单价').value;
- DM.CDS_KC.FieldByName('单价单位').value := DM.CDS_CLSLD_DETAIL.fieldbyname('单价单位').value;
- DM.CDS_KC.FieldByName('现有库存量').value := DM.CDS_CLSLD_DETAIL.fieldbyname('实收数量').value;
- DM.CDS_KC.fieldbyname('仓库名称').value := vs_ckmc;
- frmMain.SocketConnection.AppServer.GetSysTime(sysDate);
- DM.CDS_KC.fieldbyname('截止日期').value := sysDate;
- end;
- DM.CDS_CLSLD_DETAIL.next;
- end;
- DM.CDS_CLSLD_DETAIL.enablecontrols;
- DM.CDS_KC.edit;
- DM.CDS_KC.post;
- DM.CDS_KC.ApplyUpdates(0);
- close;
- end;
- procedure TfrmClsldDjsh.SpeedButton2Click(Sender: TObject);
- begin
- close;
- end;
- procedure TfrmClsldDjsh.FormActivate(Sender: TObject);
- begin
- dbedit2.setfocus;
- end;
- end.