git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/branches/D2007-DA5@21 0c75b7a4-871f-7646-8a2f-f78d34cc349f
117 lines
3.0 KiB
ObjectPascal
117 lines
3.0 KiB
ObjectPascal
unit uDataModuleEmpleados;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, uDataModuleContactos, DB, uDADataTable, uDAScriptingProvider,
|
|
uDACDSDataTable, uDABINAdapter, uROServiceComponent, uRORemoteService,
|
|
uROClient, uROBinMessage, uROWinInetHttpChannel, uBizGruposEmpleado, uROTypes,
|
|
uIDataModuleEmpleados, uBizContactos, uDADesigntimeCall, uIDataModuleFichasEmpleadoReport;
|
|
|
|
type
|
|
TDataModuleEmpleados = class(TDataModuleContactos, IDataModuleEmpleados, IDataModuleFichasEmpleadoReport)
|
|
tbl_Empleados: TDACDSDataTable;
|
|
ds_Empleados: TDADataSource;
|
|
tbl_GruposEmpleado: TDACDSDataTable;
|
|
ds_GruposEmpleado: TDADataSource;
|
|
protected
|
|
public
|
|
function GetItem(const ID : Integer) : IBizEmpleado;
|
|
function NewItem : IBizEmpleado;
|
|
function GetItems : IBizEmpleado;
|
|
function GetNextID(const DataSetName : String) : Integer; override;
|
|
function GetGruposEmpleado : IBizGrupoEmpleado;
|
|
|
|
// Report
|
|
function GetReport(const AFichaID: String): Binary;
|
|
end;
|
|
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
uses
|
|
FactuGES_Intf, cxControls, schContactosClient_Intf, uDAInterfaces, uDataTableUtils;
|
|
|
|
{ TDataModuleVendedores }
|
|
|
|
function TDataModuleEmpleados.GetGruposEmpleado: IBizGrupoEmpleado;
|
|
var
|
|
AGrupoEmpleado : TDACDSDataTable;
|
|
begin
|
|
ShowHourglassCursor;
|
|
try
|
|
AGrupoEmpleado := _CloneDataTable(tbl_GruposEmpleado);
|
|
AGrupoEmpleado.BusinessRulesID := BIZ_CLIENT_GRUPOSEMPLEADO;
|
|
Result := (AGrupoEmpleado as IBizGrupoEmpleado);
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
|
|
function TDataModuleEmpleados.GetItem(const ID: Integer): IBizEmpleado;
|
|
begin
|
|
ShowHourglassCursor;
|
|
try
|
|
Result := Self.GetItems;
|
|
with Result.DataTable.Where do
|
|
begin
|
|
if NotEmpty then
|
|
AddOperator(opAND);
|
|
OpenBraket;
|
|
AddText(fld_ContactosID + ' = ' + IntToStr(ID));
|
|
CloseBraket;
|
|
end;
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
|
|
function TDataModuleEmpleados.GetItems: IBizEmpleado;
|
|
var
|
|
AContacto : TDACDSDataTable;
|
|
begin
|
|
ShowHourglassCursor;
|
|
try
|
|
AContacto := _CloneDataTable(tbl_Empleados);
|
|
AContacto.BusinessRulesID := BIZ_CLIENT_EMPLEADO;
|
|
|
|
with TBizEmpleado(AContacto.BusinessEventsObj) do
|
|
begin
|
|
DatosBancarios := _GetDatosBancarios;
|
|
_Categorias := _GetCategorias;
|
|
end;
|
|
|
|
Result := (AContacto as IBizEmpleado);
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
|
|
function TDataModuleEmpleados.GetNextID(const DataSetName: String): Integer;
|
|
var
|
|
aDataSet : String;
|
|
aGeneratorName : String;
|
|
begin
|
|
aDataSet := DataSetName;
|
|
|
|
if aDataSet = nme_Empleados then
|
|
aDataSet := nme_Contactos;
|
|
|
|
Result := inherited GetNextID(aDataSet);
|
|
end;
|
|
|
|
function TDataModuleEmpleados.GetReport(const AFichaID: String): Binary;
|
|
begin
|
|
Result := (RORemoteService as IsrvContactos).GenerateFichaEmpleadoReport(AFichaID);
|
|
end;
|
|
|
|
function TDataModuleEmpleados.NewItem: IBizEmpleado;
|
|
begin
|
|
Result := GetItem(ID_NULO)
|
|
end;
|
|
|
|
end.
|