unit UFechasEmp;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.Win.ADODB, Vcl.StdCtrls,
  Vcl.DBCtrls, Vcl.Buttons, Vcl.Mask, JvExMask, JvToolEdit, JvMaskEdit,
  JvCheckedMaskEdit, JvDatePickerEdit, JvDBDatePickerEdit;

type
  TFechasEmp = class(TForm)
    Label19: TLabel;
    DBComboBox1: TDBComboBox;
    DSFechasEmp: TDataSource;
    TFechasEmp: TADOTable;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    btnGuardar: TBitBtn;
    btnCancelar: TBitBtn;
    btnEditar: TBitBtn;
    DBEdit1: TDBEdit;
    DBEdit2: TDBEdit;
    DBEdit3: TDBEdit;
    DBEdit4: TDBEdit;
    procedure btnEditarClick(Sender: TObject);
    procedure btnGuardarClick(Sender: TObject);
    procedure btnCancelarClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure TFechasEmpBeforePost(DataSet: TDataSet);
    procedure DSFechasEmpStateChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FechasEmp: TFechasEmp;

implementation

{$R *.dfm}

uses Udm, UPrincipal;

procedure TFechasEmp.btnCancelarClick(Sender: TObject);
begin
TFechasEmp.Cancel;
close;
end;

procedure TFechasEmp.btnEditarClick(Sender: TObject);
begin
 TFechasEmp.Edit;
end;

procedure TFechasEmp.btnGuardarClick(Sender: TObject);
begin
  TFechasEmp.Post;
end;

procedure TFechasEmp.DSFechasEmpStateChange(Sender: TObject);
begin
    btnGuardar.Enabled:= not(btnGuardar.Enabled);
    btnCancelar.Enabled:= not(btnCancelar.Enabled);
    BtnEditar.Enabled:= not(BtnEditar.Enabled);
end;

procedure TFechasEmp.FormCreate(Sender: TObject);
begin
   TFechasEmp.Active:= true;
end;

procedure TFechasEmp.TFechasEmpBeforePost(DataSet: TDataSet);
begin
 TFechasEmp.FieldByName('Empleado').AsInteger :=  Form1.TEmpleados.FieldByName('ide').AsInteger;
end;

end.
