【delphi开源代码栏目提醒】:网学会员鉴于大家对delphi开源代码十分关注,论文会员在此为大家搜集整理了“CheckInfoUnit.pas”一文,供大家参考学习
unit CheckInfoUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Buttons, ToolWin, ComCtrls, Grids, DBGrids, StdCtrls,
Mask, DBCtrls;
type
TfrmCheckInfo = class(TForm)
ControlBar1: TControlBar;
CoolBar2: TCoolBar;
sbtnFirst: TSpeedButton;
sbtnPrior: TSpeedButton;
sbtnNext: TSpeedButton;
sbtnLast: TSpeedButton;
Panel2: TPanel;
Label4: TLabel;
Label3: TLabel;
Bevel2: TBevel;
Label7: TLabel;
Label8: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
dbGrdWarehouse: TDBGrid;
Label6: TLabel;
Label5: TLabel;
Label2: TLabel;
Label9: TLabel;
Label14: TLabel;
Label19: TLabel;
SaveBtn: TBitBtn;
CloseBtn: TBitBtn;
edtWareDate: TEdit;
edtWareName: TEdit;
edtMaterialModel: TEdit;
edtMaterialUnit: TEdit;
edt_MaterialName: TEdit;
edtMaterialType: TEdit;
edt_MaterialID: TEdit;
edtMaterialSpecs: TEdit;
edtAccountNum: TEdit;
edtAccountPrice: TEdit;
edtAccountMoney: TEdit;
edtFactNum: TEdit;
edtFactPrice: TEdit;
edtFactMoney: TEdit;
edtLoseSpillNum: TEdit;
edtLoseSpillPrice: TEdit;
edtLoseSpillMoney: TEdit;
procedure sbtnFirstClick(Sender: TObject);
procedure sbtnPriorClick(Sender: TObject);
procedure sbtnNextClick(Sender: TObject);
procedure sbtnLastClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure dbGrdWarehouseCellClick(Column: TColumn);
procedure edtFactNumKeyPress(Sender: TObject; var Key: Char);
procedure SaveBtnClick(Sender: TObject);
private
str_sql:string;
procedure SaveCheckInfo(var WarehouseName,MaterialID,MaterialName,
MaterialModel,MaterialSpecs,MaterialUnit,MaterialType,AccountNum,AccountPrice,
AccountMoney,FactNum,FactPrice,FactMoney,LoseSpillNum,LoseSpillPrice,LoseSpillMoney: string);
procedure updateWarehouse(var WarehouseName,MaterialName,MaterialType,MaterialUnit,MaterialNum,MaterialPrice,MaterialMoney:String);
public
{ Public declarations }
end;
var
frmCheckInfo: TfrmCheckInfo;
implementation
uses DM_Unit;
{$R *.dfm}
procedure TfrmCheckInfo.sbtnFirstClick(Sender: TObject);
begin
DM.DataSetFirst(DM.sdsWare);
end;
procedure TfrmCheckInfo.sbtnPriorClick(Sender: TObject);
begin
DM.DataSetPrior(DM.sdsWare);
end;
procedure TfrmCheckInfo.sbtnNextClick(Sender: TObject);
begin
DM.DataSetNext(DM.sdsWare);
end;
procedure TfrmCheckInfo.sbtnLastClick(Sender: TObject);
begin
DM.DataSetLast(DM.sdsWare);
end;
procedure TfrmCheckInfo.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
DM.sdsWare.Close;
end;
procedure TfrmCheckInfo.FormCreate(Sender: TObject);
begin
DM.sdsWare.Open;
end;
procedure TfrmCheckInfo.dbGrdWarehouseCellClick(Column: TColumn);
begin
if DM.sdsWare.RecordCount<>0 then
begin
edtWareDate.Text := formatdatetime('yyyy-mm-dd',now);
edtWareName.Text := DM.sdsWare.FieldByName('WarehouseName').AsString;
edt_MaterialID.Text := DM.sdsWare.FieldByName('MaterialID').AsString;
edt_MaterialName.Text := DM.sdsWare.FieldByName('MaterialName').AsString;
edtMaterialModel.Text := DM.sdsWare.FieldByName('MaterialModel').AsString;
edtMaterialSpecs.Text := DM.sdsWare.FieldByName('MaterialSpecs').AsString;
edtMaterialType.Text := DM.sdsWare.FieldByName('MaterialType').AsString;
edtMaterialUnit.Text := DM.sdsWare.FieldByName('MaterialUnit').AsString;
edtAccountNum.Text := DM.sdsWare.FieldByName('MaterialNum').AsString;
edtAccountPrice.Text := DM.sdsWare.FieldByName('MaterialPrice').AsString;
edtAccountMoney.Text := DM.sdsWare.FieldByName('MaterialMoney').AsString;
edtFactNum.Text := DM.sdsWare.FieldByName('MaterialNum').AsString;
edtFactPrice.Text := DM.sdsWare.FieldByName('MaterialPrice').AsString;
edtFactMoney.Text := DM.sdsWare.FieldByName('MaterialMoney').AsString;
end;
end;
procedure TfrmCheckInfo.edtFactNumKeyPress(Sender: TObject; var Key: Char);
var
Money,Num: Integer;
begin
if edtAccountNum.Text='' then Exit;
if edtFactNum.Text='' then Exit;
if edtFactPrice.Text='' then Exit;
Num := StrToInt(edtFactNum.Text) - StrToInt(edtAccountNum.Text);
Money :=Num * StrToInt(edtFactPrice.Text);
edtLoseSpillNum.Text := IntToStr(Num);
edtLoseSpillPrice.Text := edtFactPrice.Text;
edtLoseSpillMoney.Text := IntToStr(Money);
end;
procedure TfrmCheckInfo.SaveCheckInfo(var WarehouseName, MaterialID,
MaterialName, MaterialModel, MaterialSpecs,MaterialUnit, MaterialType,
AccountNum, AccountPrice, AccountMoney, FactNum, FactPrice,FactMoney,
LoseSpillNum, LoseSpillPrice, LoseSpillMoney: string);
var
InNO,CheckID: string;
begin
try
DM.OfferTypeID('select CheckID from wms_CheckInfo where CheckID like'+
#39+'KC'+formatdatetime('yyyymmdd',now)+'%'+#39,InNo);
CheckID := 'RK'+formatdatetime('yyyymmdd',now)+'000'+InNo;
str_sql := 'insert into wms_CheckInfo (CheckID,CheckDate,WarehouseName,'+
'MaterialID,MaterialName,MaterialModel,MaterialSpecs,MaterialUnit,MaterialType,'+
'AccountNum,AccountPrice,AccountMoney,FactNum,FactPrice,FactMoney,LoseSpillNum,'+
'LoseSpillPrice,LoseSpillMoney) values('+
#39+CheckID+#39+','+#39+formatdatetime('yyyy-mm-dd',now)+#39+','+#39+WarehouseName+#39+','+
#39+MaterialID+#39+','+#39+MaterialName+#39+','+#39+MaterialModel+#39+','+#39+
MaterialSpecs+#39+','+#39+MaterialUnit+#39+','+ #39+MaterialType+#39+
','+AccountNum+','+AccountPrice+','+AccountMoney+','+FactNum+','+
FactPrice+','+FactMoney+','+LoseSpillNum+','+LoseSpillPrice+','+LoseSpillMoney+')';
DM.sdsCheckInfo.Close;
DM.sdsCheckInfo.DataSet.CommandText := str_sql;
DM.sdsCheckInfo.Execute;
except
on e : exception do
begin
Application.MessageBox(pchar('错误:数据写入数据库失败.错误代码:' + e.Message),
'连接错误',MB_OK+MB_ICONWARNING);
abort;
end;
end;
end;
procedure TfrmCheckInfo.SaveBtnClick(Sender: TObject);
var
AWarehouseName, AMaterialID,
AMaterialName, AMaterialModel, AMaterialSpecs,AMaterialUnit, AMaterialType,
AAccountNum, AAccountPrice, AAccountMoney, AFactNum, AFactPrice,AFactMoney,
ALoseSpillNum, ALoseSpillPrice, ALoseSpillMoney: string;
begin
AWarehouseName := edtWareName.Text;
AMaterialID := edt_MaterialID.Text;
AMaterialName := edt_MaterialName.Text;
AMaterialModel := edtMaterialModel.Text;
AMaterialSpecs := edtMaterialSpecs.Text;
AMaterialUnit := edtMaterialUnit.Text;
AMaterialType := edtMaterialType.Text;
AAccountNum := edtAccountNum.Text;
AAccountPrice := edtAccount
上一篇:
DlgKH.cpp
下一篇:
政治视域中的行政