unit U_ReceivableEdit_XT;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, DB, ADODB;

type
  TfrmReceivableEdit_XT = class(TForm)
    Panel1: TPanel;
    Button1: TButton;
    Label1: TLabel;
    Button2: TButton;
    ADOQueryMain: TADOQuery;
    ADOQueryTemp: TADOQuery;
    ADOQueryCmd: TADOQuery;
    PBQty: TEdit;
    Label2: TLabel;
    CPQty: TEdit;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    FFFIDS: string;
    FConSID: string;
    { Public declarations }
  end;

var
  frmReceivableEdit_XT: TfrmReceivableEdit_XT;

implementation

{$R *.dfm}

procedure TfrmReceivableEdit_XT.Button2Click(Sender: TObject);
begin
  Close;
end;

procedure TfrmReceivableEdit_XT.FormShow(Sender: TObject);
begin
  PBQty.SetFocus;

  with ADOQueryCmd do
  begin
    Close;
    sql.Clear;
    sql.Add(' select * from BS_Contract_Sub    ');
    sql.Add(' where ConSID=''' + Trim(FConSID) + '''');
//      showmessage(sql.text);
    Open;
  end;

  PBQty.text := Trim(ADOQueryCmd.fieldbyname('PBQty').AsString);
  CPQty.text := Trim(ADOQueryCmd.fieldbyname('CPQty').AsString);

end;

procedure TfrmReceivableEdit_XT.Button1Click(Sender: TObject);
begin
  if StrToFloatDef(PBQty.Text, 0) = 0 then
    PBQty.Text := '0';

  if StrToFloatDef(CPQty.Text, 0) = 0 then
    CPQty.Text := '0';

  try
    with ADOQueryCmd do
    begin
      Close;
      sql.Clear;
      sql.Add(' update BS_Contract_Sub   ');
      sql.Add(' set  PBQty=' + PBQty.Text);
      sql.Add(' ,    CPQty=' + CPQty.Text);
      sql.Add(' where ConSID=''' + Trim(FConSID) + '''');
//      showmessage(sql.text);
      ExecSQL;
    end;
    ModalResult := 1;
  except
    application.MessageBox(PChar(Exception(ExceptObject).Message), 'ΜαΚΎΠΕΟ’', 0);

  end;
end;

end.

