unit UPrincipal;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Mask, Vcl.DBCtrls,
  Vcl.Buttons, Vcl.ExtCtrls, Data.DB, Data.Win.ADODB, JvExStdCtrls, JvCombobox,
  JvDBCombobox, Vcl.ComCtrls, JvExComCtrls, JvDateTimePicker, JvDBDateTimePicker;

type
  TFPrincipal = class(TForm)
    Panel1: TPanel;
    btnPrimero: TBitBtn;
    btnAtras: TBitBtn;
    BtnSiguiente: TBitBtn;
    BtnUltimo: TBitBtn;
    BtnNuevo: TBitBtn;
    BtnEditar: TBitBtn;
    BtnGuardar: TBitBtn;
    BtnCancelar: TBitBtn;
    BtnEliminar: TBitBtn;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    DBEdit1: TDBEdit;
    DBEdit2: TDBEdit;
    DBEdit3: TDBEdit;
    Label4: TLabel;
    DBEdit4: TDBEdit;
    Label5: TLabel;
    DBEdit5: TDBEdit;
    Label6: TLabel;
    DBEdit6: TDBEdit;
    Label7: TLabel;
    DBEdit7: TDBEdit;
    BitBtn1: TBitBtn;
    Label9: TLabel;
    DBEdit9: TDBEdit;
    TEmpleados: TADOTable;
    DSEmpleados: TDataSource;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    BitBtn4: TBitBtn;
    BitBtn5: TBitBtn;
    BitBtn6: TBitBtn;
    BitBtn7: TBitBtn;
    Label8: TLabel;
    DBEdit8: TDBEdit;
    Label10: TLabel;
    DBEdit10: TDBEdit;
    BitBtn8: TBitBtn;
    Label11: TLabel;
    JvDBDateTimePicker1: TJvDBDateTimePicker;
    Label12: TLabel;
    Label13: TLabel;
    JvDBComboBox1: TJvDBComboBox;
    Label14: TLabel;
    JvDBComboBox2: TJvDBComboBox;
    JvDBComboBox3: TJvDBComboBox;
    procedure BitBtn1Click(Sender: TObject);
    procedure btnPrimeroClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure DSEmpleadosStateChange(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
    procedure BitBtn5Click(Sender: TObject);
    procedure BitBtn6Click(Sender: TObject);
    procedure BitBtn7Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BitBtn8Click(Sender: TObject);
  private
    { Private declarations }
  protected
    procedure CreateParams(var Params: TCreateParams); override;
  public
    { Public declarations }
  end;

var
  FPrincipal: TFPrincipal;

implementation

{$R *.dfm}

uses UBimestre, Uconexion, Udm, UBuscarEmp, UAcerca, UEncabezado, Uusuarios,UExtempo, Ulogin,
  UImportarSiri;

procedure TFPrincipal.CreateParams(var Params: TCreateParams);
begin
  inherited;
  Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
end;

procedure TFPrincipal.BitBtn1Click(Sender: TObject);
begin
 close
end;

procedure TFPrincipal.BitBtn2Click(Sender: TObject);
begin
 with FBimestre do
 begin
 TBimestres.Active:= false;
 TBimestres.Active:= true;
 ShowModal;
 end;
end;

procedure TFPrincipal.BitBtn3Click(Sender: TObject);
begin
 FBuscarEmp.txtBus.clear;
 if FBuscarEmp.showmodal = mrok then
   TEmpleados.locate('IdEmpleado', FBuscarEmp.Qbuscar.FieldByname('IdEmpleado').Asinteger, []);
end;

procedure TFPrincipal.BitBtn4Click(Sender: TObject);
begin
 FAcerca.ShowModal
end;

procedure TFPrincipal.BitBtn5Click(Sender: TObject);
begin
 FEncabezado.TEncabezado.Active:=false;
 FEncabezado.TEncabezado.Active:=true;
 FEncabezado.ShowModal
end;

procedure TFPrincipal.BitBtn6Click(Sender: TObject);
begin
 FUsuarios.Tusuarios.Active:= false;
 FUsuarios.Tusuarios.Active:= true;
 FUsuarios.ShowModal
end;

procedure TFPrincipal.BitBtn7Click(Sender: TObject);
begin
with Extemporaneos do
 begin
 TBimestresExt.Active:= false;
 TBimestresExt.Active:= true;
 ShowModal;
 end;
end;

procedure TFPrincipal.BitBtn8Click(Sender: TObject);
begin
 FImportarSiri.QElegidos.Active:= false;
 FImportarSiri.QElegidos.Active:= true;
 FImportarSiri.TEncabezado.Active:= false;
 FImportarSiri.TEncabezado.Active:= true;
 FImportarSiri.TBim.Active:=true;
 FImportarSiri.ShowModal;
end;

procedure TFPrincipal.btnPrimeroClick(Sender: TObject);
begin
DBControles((Sender As Tbitbtn).Tag, TEmpleados, btnPrimero, btnAtras, btnSiguiente, btnUltimo, btnNuevo, btnEditar, btnEliminar, btnGuardar, btnCancelar);
end;

procedure TFPrincipal.DSEmpleadosStateChange(Sender: TObject);
begin
if TEmpleados.State = dsEdit then
   btnPrimeroClick(btnEditar);
end;

procedure TFPrincipal.FormClose(Sender: TObject; var Action: TCloseAction);
begin
application.Terminate;
end;

procedure TFPrincipal.FormCreate(Sender: TObject);
begin
TEmpleados.Active:= true;

end;

end.
