⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uselectpartmoveedit.pas

📁 天涯進銷存系統
💻 PAS
字号:
unit uSelectPartMoveEdit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, LBCtrls, LBDBCtrls, jpeg, ExtCtrls,
  LBMorphVCLBase, LBMorphButton;

type
  TfrmSelectPartMoveEdit = class(TForm)
    Label1: TLabel;
    QuantityEdit: TLBNumberEdit;
    Panel4: TPanel;
    Panel6: TPanel;
    Panel3: TPanel;
    Image2: TImage;
    SysCloseButton: TLBMorphButton;
    LBButton1: TLBButton;
    LBButton2: TLBButton;
    WindowCaption: TLabel;
    procedure FormShow(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure QuantityEditExit(Sender: TObject);
    procedure QuantityEditKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Image2MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private declarations }
  public
    isSelect : Boolean;
  end;

var
  frmSelectPartMoveEdit: TfrmSelectPartMoveEdit;

implementation

uses uDataMo, uPublicvar, uConst, uSelectPart;

{$R *.dfm}

procedure TfrmSelectPartMoveEdit.FormShow(Sender: TObject);
begin
  isSelect:=BillIsEdit;
end;

procedure TfrmSelectPartMoveEdit.Button1Click(Sender: TObject);
var
  Agiosum, CessSum: Extended;
begin
  if Trim(QuantityEdit.Text)='' then
  begin
    Application.MessageBox('请输入数量。',Hintinfo,$30);
    QuantityEdit.SetFocus;
    Exit;
  end;
  if StrToFloat(QuantityEdit.Text)<=0 then
  begin
    Application.MessageBox('数量不能小于或等于“0”',Hintinfo,$30);
    QuantityEdit.SetFocus;
    Exit;
  end;
  if Trim(QuantityEdit.Text)='' then QuantityEdit.Text:='1';
  if StrToFloat(QuantityEdit.Text)>dmData.sdsSelectPart.FieldByName('BillQuantity').asfloat then
    if Application.MessageBox('数量不足,是否继续?',Hintinfo,$24)=idNo then
    begin
      QuantityEdit.SetFocus;
      Exit;
    end;
  with SelectPartCds do
  begin
    if (FieldByName('BILLCODE').asstring<>'') and (not BillisEdit) then Edit
    else
    begin
      Append;
      FieldByName('BILLCODE').asstring:='新单据';
      FieldByName('ID').asinteger:=SelectPartCds.RecordCount+1;
    end;
    FieldByName('PARTCODE').asstring:=dmData.sdsSelectPart.FieldByName('Code').asstring;
    FieldByName('PARTNAME').asstring:=dmData.sdsSelectPart.FieldByName('Name').asstring;
    FieldByName('BORNCODE').asstring:=dmData.sdsSelectPart.FieldByName('BORNCODE').asstring;
    FieldByName('CARMODEL').asstring:=dmData.sdsSelectPart.FieldByName('CARMODEL').asstring;
    FieldByName('PRODUCING').asstring:=dmData.sdsSelectPart.FieldByName('PRODUCING').asstring;
    FieldByName('UNITS').asstring:=dmData.sdsSelectPart.FieldByName('UNITS').asstring;
    FieldByName('DepotPlace').asstring:=dmData.sdsSelectPart.FieldByName('DepotPlace').asstring;
    FieldByName('Quantity').asfloat:=StrToFloat(QuantityEdit.Text);
    Post;
  end;
  isSelect:=True;
  Close;  
end;

procedure TfrmSelectPartMoveEdit.Button2Click(Sender: TObject);
begin
  isSelect:=False;
  Close;
end;

procedure TfrmSelectPartMoveEdit.QuantityEditExit(Sender: TObject);
begin
  if Trim(QuantityEdit.Text)='' then QuantityEdit.Text:='1';
  if StrToFloat(QuantityEdit.Text)>dmData.sdsSelectPart.FieldByName('BillQuantity').asfloat then
    if Application.MessageBox('数量不足,是否继续?',Hintinfo,$24)=idNo then
    begin
       QuantityEdit.SetFocus;
    end;
end;

procedure TfrmSelectPartMoveEdit.QuantityEditKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  if key=13 then Button1Click(Nil);
end;

procedure TfrmSelectPartMoveEdit.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key=27 then Close;
end;

procedure TfrmSelectPartMoveEdit.Image2MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture;
  SendMessage(Handle, wm_SysCommand ,$F012, 0);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -