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