unit UPrincipal;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, DBCtrls, DB, ADODB, Buttons, StdCtrls, wwrcdpnl,
  wwdbdatetimepicker, Mask, XPMan, wwdblook, Wwdbdlg, wwDialog, Wwlocate,
  wwidlg;

type
  TForm1 = class(TForm)
    TEmpleados: TADOTable;
    DSEmpleados: TDataSource;
    DBNavigator1: TDBNavigator;
    TPuestos: TADOTable;
    DSPuestos: TDataSource;
    TProgramas: TADOTable;
    DSProgramas: TDataSource;
    TAreas: TADOTable;
    DSAreas: TDataSource;
    Label1: TLabel;
    DBEdit1: TDBEdit;
    Label2: TLabel;
    DBEdit2: TDBEdit;
    Label3: TLabel;
    DBEdit3: TDBEdit;
    Label4: TLabel;
    DBEdit4: TDBEdit;
    Label5: TLabel;
    Label6: TLabel;
    DBEdit5: TDBEdit;
    DBComboBox1: TDBComboBox;
    Label7: TLabel;
    DBEdit6: TDBEdit;
    Label8: TLabel;
    DBEdit7: TDBEdit;
    Label9: TLabel;
    DBEdit8: TDBEdit;
    Label10: TLabel;
    DBEdit9: TDBEdit;
    Label11: TLabel;
    DBLookupComboBox1: TDBLookupComboBox;
    DBLookupComboBox2: TDBLookupComboBox;
    Label12: TLabel;
    Label13: TLabel;
    DBLookupComboBox3: TDBLookupComboBox;
    Label14: TLabel;
    wwDBDateTimePicker1: TwwDBDateTimePicker;
    Label15: TLabel;
    DBEdit10: TDBEdit;
    Label16: TLabel;
    TtipoEmpleo: TADOTable;
    DSTipoEmpleo: TDataSource;
    DBLookupComboBox4: TDBLookupComboBox;
    BitBtn1: TBitBtn;
    XPManifest1: TXPManifest;
    BitBtn2: TBitBtn;
    Label17: TLabel;
    DBLookupComboBox5: TDBLookupComboBox;
    TCiudades: TADOTable;
    DSCiudades: TDataSource;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    SpeedButton4: TSpeedButton;
    SpeedButton5: TSpeedButton;
    BitBtn3: TBitBtn;
    Label18: TLabel;
    DBLookupComboBox6: TDBLookupComboBox;
    TNacionalidad: TADOTable;
    DSNacionalidad: TDataSource;
    Label19: TLabel;
    DBComboBox2: TDBComboBox;
    Label20: TLabel;
    wwDBDateTimePicker2: TwwDBDateTimePicker;
    SpeedButton6: TSpeedButton;
    DBCheckBox1: TDBCheckBox;
    Label21: TLabel;
    Bevel1: TBevel;
    Button1: TButton;
    BuscarDial: TwwSearchDialog;
    DBEdit11: TDBEdit;
    Label24: TLabel;
    DBEdit13: TDBEdit;
    Label25: TLabel;
    DBEdit14: TDBEdit;
    Label26: TLabel;
    DBEdit15: TDBEdit;
    Label27: TLabel;
    DBEdit16: TDBEdit;
    DBCheckBox2: TDBCheckBox;
    Label22: TLabel;
    DBEdit12: TDBEdit;
    BitBtn4: TBitBtn;
    Label23: TLabel;
    DBEdit17: TDBEdit;
    BitBtn5: TBitBtn;
    Label28: TLabel;
    DBEdit18: TDBEdit;
    procedure FormCreate(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure SpeedButton4Click(Sender: TObject);
    procedure SpeedButton5Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure SpeedButton6Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Udm, UReporte, Uconexion, UCatalogos, UExportaciones;

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
 InitButtons(DBNavigator1, 'Arial');
 TPuestos.Active:=true;
 TEmpleados.Active:= true;
 TProgramas.Active:= true;
 TCiudades.Active:= true;
 TAreas.Active:= true;
 TtipoEmpleo.Active:= true;
 end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
 FReporte.ShowModal
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
  with FCatalogos do
  begin
    DBEdit2.Visible:= true;
    Label2.Visible:= true;
    Label3.Visible:= true;
    DBEdit3.Visible:= true;
    Tcomodin.Active:= false;
    Tcomodin.TableName := 'CatAreas';
    Label1.Caption:= 'Área';
    DBEdit1.DataField:= 'Area';
    Label2.Caption:= 'Encargado';
    DBEdit2.DataField:= 'Encargado';
    Label3.Caption:= 'Puesto';
    DBEdit3.DataField:= 'PuestoEnc';
    Label4.Visible:= false;
    DBMemo1.Datafield:= '';
    DBMemo1.visible:= false;
    LCBAreas.DataField:= '';
    LCBAreas.Visible:= false;
    DBNavigator1.VisibleButtons:= DBNavigator1.VisibleButtons + [nbDelete, nbInsert];
    Tcomodin.Active:= true;
    ShowModal;
  end;
    TAreas.Active:=false;
    TAreas.Active:=true;
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
with FCatalogos do
  begin
    Tcomodin.Active:= false;
    Tcomodin.TableName := 'CatLugares';
    Label1.Caption:= 'Ciudad';
    DBEdit1.DataField:= 'Lugar';
    Label2.Visible:= false;
    DBEdit2.Visible:= false;
    Label3.Visible:= false;
    DBEdit3.DataField:= '';
    DBEdit3.Visible:= false;
    DBEdit2.DataField:= '';
    TAreas.Active:= false;
    Label4.Visible:= false;
    DBMemo1.Datafield:= '';
    DBMemo1.visible:= false;
    LCBAreas.DataField:= '';
    LCBAreas.Visible:= false;
    DBNavigator1.VisibleButtons:= DBNavigator1.VisibleButtons + [nbDelete, nbInsert];
    Tcomodin.Active:= true;
    ShowModal;
  end;
   Tciudades.Active:=false;
   Tciudades.Active:=true;
end;

procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
 with FCatalogos do
  begin
    Tcomodin.Active:= false;
    Tcomodin.TableName := 'CatProgramas';
    Label1.Caption:= 'Programa';
    DBEdit1.DataField:= 'Programa';
    //Label2.Caption:= ''
    Label3.Visible:= true;
    Label2.Visible:=false;
    Label3.Caption:= 'Área';
    Label4.Visible:= false;
    DBMemo1.Datafield:= '';
    DBMemo1.visible:= false;
    DBEdit2.DataField:= '';
    DBEdit2.Visible:= false;
    LCBAreas.Visible:= true;
    LCBAreas.DataField:= 'Area';
    LCBAreas.Left:= 7;
    DBEdit3.DataField:= '';
    DBEdit3.Visible:= false;
    Tcomodin.Active:= true;
    DBNavigator1.VisibleButtons:= DBNavigator1.VisibleButtons + [nbDelete, nbInsert];
    TAreas.Active:= true;
    ShowModal;
  end;
    TProgramas.Active:= false;
    TProgramas.Active:= true;
end;

procedure TForm1.SpeedButton4Click(Sender: TObject);
begin
  with FCatalogos do
  begin
    Tcomodin.Active:= false;
    Tcomodin.TableName := 'CatPuestos';
    Label1.Caption:= 'Puesto';
    DBEdit1.DataField:= 'Puesto';
    Label2.Visible:= false;
    DBEdit2.DataField:= '';
    DBEdit2.Visible:= false;
    Label3.Visible:= false;
    DBEdit3.DataField:= '';
    DBEdit3.Visible:= false;
    Label4.Visible:= true;
    DBMemo1.Visible:=true;
    DBMemo1.Datafield:= 'Descripcion';
    LCBAreas.DataField:= '';
    LCBAreas.Visible:= false;
    DBNavigator1.VisibleButtons:= DBNavigator1.VisibleButtons + [nbDelete, nbInsert];
    Tcomodin.Active:= true;
    ShowModal;
  end;
   Tpuestos.Active:= false;
   Tpuestos.Active:= true;
end;

procedure TForm1.SpeedButton5Click(Sender: TObject);
begin
with FCatalogos do
  begin
    Tcomodin.Active:= false;
    Tcomodin.TableName := 'TipoEmpleo';
    Label1.Caption:= 'Tipo de Contrato';
    DBEdit1.DataField:= 'TipoEmpleo';
    Label2.Visible:= false;
    DBEdit2.Visible:= false;
    Label3.Visible:= false;
    Label4.Visible:= false;
    DBMemo1.Datafield:= '';
    DBMemo1.visible:= false;
    DBEdit2.DataField:= '';
    DBEdit3.DataField:= '';
    DBEdit3.Visible:= false;
    LCBAreas.DataField:= '';
    LCBAreas.Visible:= false;
    Tareas.Active:= false;
    DBNavigator1.VisibleButtons:= DBNavigator1.VisibleButtons + [nbDelete, nbInsert];
    Tcomodin.Active:= true;
    ShowModal;
  end;
  TtipoEmpleo.Active:= false;
  TtipoEmpleo.Active:= true
end;

procedure TForm1.BitBtn3Click(Sender: TObject);
begin
 with FCatalogos do
  begin
    Tcomodin.Active:= false;
    Tcomodin.TableName := 'Directivos';
    Label1.Caption:= 'Oficial Mayor';
    DBEdit1.DataField:= 'OficialMay';
    Label2.Caption:= 'Director';
    Label2.Visible:= true;
    DBEdit2.Visible:= true;
    Label3.Visible:= false;
    Label4.Visible:= false;
    DBMemo1.Datafield:= '';
    DBMemo1.visible:= false;
    DBEdit2.DataField:= 'Director';
    DBEdit3.DataField:= '';
    DBEdit3.Visible:= false;
    LCBAreas.DataField:= '';
    LCBAreas.Visible:= false;
    DBNavigator1.VisibleButtons:= DBNavigator1.VisibleButtons-[nbDelete, nbInsert];
    Tareas.Active:= false;
    Tcomodin.Active:= true;
    ShowModal
  end
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
application.Terminate
end;

procedure TForm1.SpeedButton6Click(Sender: TObject);
begin
//Nacionalidad
 with FCatalogos do
  begin
    Tcomodin.Active:= false;
    Tcomodin.TableName := 'CatNacionalidad';
    Label1.Caption:= 'Nacionalidad';
    DBEdit1.DataField:= 'Nacionalidad';
    Label2.Visible:= false;
    DBEdit2.DataField:= '';
    DBEdit2.Visible:= false;
    Label3.Visible:= false;
    DBEdit3.DataField:= '';
    DBEdit3.Visible:= false;
    Label4.Visible:= false;
    DBMemo1.Visible:=false;
    DBMemo1.Datafield:= '';
    LCBAreas.DataField:= '';
    LCBAreas.Visible:= false;
    DBNavigator1.VisibleButtons:= DBNavigator1.VisibleButtons + [nbDelete, nbInsert];
    Tcomodin.Active:= true;
    ShowModal;
  end;
    TNacionalidad.Active:= false;
    TNacionalidad.Active:= true
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
//LDBuscar.Execute
BuscarDial.Execute
end;

procedure TForm1.BitBtn4Click(Sender: TObject);
begin
 FExportaciones.ShowModal
end;



end.
