- En proveedores, la descripción (tipo de material que sirve) se ha cambiado a un combobox para que sea más fácil. git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@240 0c75b7a4-871f-7646-8a2f-f78d34cc349f
122 lines
3.5 KiB
ObjectPascal
122 lines
3.5 KiB
ObjectPascal
unit uViewEmpleado;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, uViewContacto, dxLayoutLookAndFeels, DB, uDADataTable,
|
|
dxLayoutControl, cxMemo, cxDBEdit, cxContainer, cxEdit, cxTextEdit, cxControls,
|
|
cxMaskEdit, cxSpinEdit, ImgList, PngImageList, ActnList, cxHyperLinkEdit,
|
|
Buttons, PngSpeedButton, cxDropDownEdit, cxCalendar, cxGraphics, uGruposEmpleadoController,
|
|
uDAInterfaces;
|
|
|
|
type
|
|
IViewEmpleado = interface(IViewContacto)
|
|
['{245F4A36-39A4-4081-9826-F05FBBC729AE}']
|
|
end;
|
|
|
|
TfrViewEmpleado = class(TfrViewContacto, IViewEmpleado)
|
|
eFechaNacimiento: TcxDBDateEdit;
|
|
dxLayoutControlContactoItem16: TdxLayoutItem;
|
|
dxLayoutControlContactoItem19: TdxLayoutItem;
|
|
eFechaAltaEmpresa: TcxDBDateEdit;
|
|
dxLayoutControlContactoGroup10: TdxLayoutGroup;
|
|
dxLayoutControlContactoItem20: TdxLayoutItem;
|
|
cbCategoria: TcxDBComboBox;
|
|
dxLayoutControlContactoItem21: TdxLayoutItem;
|
|
cbContrato: TcxDBComboBox;
|
|
procedure CustomViewCreate(Sender: TObject);
|
|
procedure CustomViewDestroy(Sender: TObject);
|
|
procedure cbCategoriaPropertiesInitPopup(Sender: TObject);
|
|
procedure cbCategoriaPropertiesValidate(Sender: TObject;
|
|
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
|
procedure cbContratoPropertiesInitPopup(Sender: TObject);
|
|
protected
|
|
FGrupoController: IGruposEmpleadoController;
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
implementation
|
|
{$R *.dfm}
|
|
|
|
uses
|
|
uBizGruposEmpleado, uBizContactos, uEmpleadosController;
|
|
|
|
procedure TfrViewEmpleado.cbCategoriaPropertiesInitPopup(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
with cbCategoria.Properties.Items do
|
|
begin
|
|
ShowHourglassCursor;
|
|
BeginUpdate;
|
|
try
|
|
Clear;
|
|
AddStrings(FGrupoController.DarListaGruposEmpleado);
|
|
finally
|
|
EndUpdate;
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TfrViewEmpleado.cbCategoriaPropertiesValidate(Sender: TObject;
|
|
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
|
var
|
|
AGrupo : IBizGrupoEmpleado;
|
|
begin
|
|
inherited;
|
|
with (Sender as TcxDBComboBox) do
|
|
begin
|
|
if (Length(DisplayValue) > 0) and (DisplayValue <> (Contacto as IBizEmpleado).CATEGORIA) then
|
|
if Properties.LookupItems.IndexOf(DisplayValue) < 0 then
|
|
begin
|
|
ShowHourglassCursor;
|
|
Properties.LookupItems.BeginUpdate;
|
|
AGrupo := FGrupoController.BuscarTodos;
|
|
AGrupo.DataTable.Active := True;
|
|
try
|
|
FGrupoController.Anadir(AGrupo);
|
|
AGrupo.DESCRIPCION := DisplayValue;
|
|
FGrupoController.Guardar(AGrupo);
|
|
Properties.LookupItems.Add(DisplayValue);
|
|
finally
|
|
Properties.LookupItems.EndUpdate;
|
|
AGrupo := NIL;
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TfrViewEmpleado.cbContratoPropertiesInitPopup(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
with cbContrato.Properties.Items do
|
|
begin
|
|
ShowHourglassCursor;
|
|
BeginUpdate;
|
|
try
|
|
Clear;
|
|
AddStrings((FController as IEmpleadosController).DarListaContratosEmpleado);
|
|
finally
|
|
EndUpdate;
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TfrViewEmpleado.CustomViewCreate(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
FGrupoController := TGruposEmpleadoController.Create;
|
|
end;
|
|
|
|
procedure TfrViewEmpleado.CustomViewDestroy(Sender: TObject);
|
|
begin
|
|
FGrupoController := NIL;
|
|
inherited;
|
|
end;
|
|
|
|
end.
|