diff --git a/Source/Modulos/Contactos/Controller/Contactos_controller.dpk b/Source/Modulos/Contactos/Controller/Contactos_controller.dpk
index bee6acaf..21bafd1f 100644
Binary files a/Source/Modulos/Contactos/Controller/Contactos_controller.dpk and b/Source/Modulos/Contactos/Controller/Contactos_controller.dpk differ
diff --git a/Source/Modulos/Contactos/Controller/Contactos_controller.dproj b/Source/Modulos/Contactos/Controller/Contactos_controller.dproj
index 8940bc7d..790f04f3 100644
--- a/Source/Modulos/Contactos/Controller/Contactos_controller.dproj
+++ b/Source/Modulos/Contactos/Controller/Contactos_controller.dproj
@@ -42,7 +42,7 @@
Delphi.Personality
Package
-FalseTrueFalseTrueFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0
+FalseTrueFalseFalseFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0
@@ -59,34 +59,34 @@
MainSource
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -95,16 +95,20 @@
-
-
+
-
-
+
+
+
+
+
+
+
diff --git a/Source/Modulos/Contactos/Controller/View/uIEditorElegirVendedores.pas b/Source/Modulos/Contactos/Controller/View/uIEditorElegirVendedores.pas
new file mode 100644
index 00000000..d1b5dc20
--- /dev/null
+++ b/Source/Modulos/Contactos/Controller/View/uIEditorElegirVendedores.pas
@@ -0,0 +1,16 @@
+unit uIEditorElegirVendedores;
+
+interface
+
+uses
+ uIEditorContactos, uIEditorElegirContactos, uBizContactos, uGUIBase;
+
+type
+ IEditorElegirVendedores = interface(IEditorElegirContactos)
+ ['{1CBDF31A-A9C5-43FB-B7D4-09148E0BD071}']
+ end;
+
+
+implementation
+
+end.
diff --git a/Source/Modulos/Contactos/Controller/View/uIEditorFichasEmpleadoPreview.pas b/Source/Modulos/Contactos/Controller/View/uIEditorFichasEmpleadoPreview.pas
deleted file mode 100644
index dea9a810..00000000
--- a/Source/Modulos/Contactos/Controller/View/uIEditorFichasEmpleadoPreview.pas
+++ /dev/null
@@ -1,16 +0,0 @@
-unit uIEditorFichasEmpleadoPreview;
-
-interface
-
-uses
- uEditorPreview, uBizContactos, uFichasEmpleadoReportController;
-
-type
- IEditorFichasEmpleadoPreview = interface(IEditorPreview)
- ['{CED11B0E-2A7E-4CF2-A9CF-60A82BEEE9F2}']
- end;
-
-
-implementation
-
-end.
diff --git a/Source/Modulos/Contactos/Controller/View/uIEditorGruposEmpleado.pas b/Source/Modulos/Contactos/Controller/View/uIEditorGruposEmpleado.pas
deleted file mode 100644
index 7fc79bef..00000000
--- a/Source/Modulos/Contactos/Controller/View/uIEditorGruposEmpleado.pas
+++ /dev/null
@@ -1,23 +0,0 @@
-unit uIEditorGruposEmpleado;
-
-interface
-
-uses
- uEditorDBBase, uBizGruposEmpleado, uGruposEmpleadoController;
-
-type
- IEditorGruposEmpleado = interface(IEditorDBBase)
- ['{02981B41-9986-48D8-927C-A08A45168EDE}']
- function GetGruposEmpleado: IBizGrupoEmpleado;
- procedure SetGruposEmpleado(const Value: IBizGrupoEmpleado);
- property GruposEmpleado: IBizGrupoEmpleado read GetGruposEmpleado write SetGruposEmpleado;
-
- function GetController : IGruposEmpleadoController;
- procedure SetController (const Value : IGruposEmpleadoController);
- property Controller : IGruposEmpleadoController read GetController write SetController;
- end;
-
-
-implementation
-
-end.
diff --git a/Source/Modulos/Contactos/Controller/View/uIEditorEmpleado.pas b/Source/Modulos/Contactos/Controller/View/uIEditorVendedor.pas
similarity index 57%
rename from Source/Modulos/Contactos/Controller/View/uIEditorEmpleado.pas
rename to Source/Modulos/Contactos/Controller/View/uIEditorVendedor.pas
index a56bd519..76191528 100644
--- a/Source/Modulos/Contactos/Controller/View/uIEditorEmpleado.pas
+++ b/Source/Modulos/Contactos/Controller/View/uIEditorVendedor.pas
@@ -1,4 +1,4 @@
-unit uIEditorEmpleado;
+unit uIEditorVendedor;
interface
@@ -6,7 +6,7 @@ uses
uIEditorContacto;
type
- IEditorEmpleado = interface(IEditorContacto)
+ IEditorVendedor = interface(IEditorContacto)
['{DB41E4F5-1D48-4B13-8370-5D3FEB0586C0}']
end;
diff --git a/Source/Modulos/Contactos/Controller/View/uIEditorEmpleados.pas b/Source/Modulos/Contactos/Controller/View/uIEditorVendedores.pas
similarity index 61%
rename from Source/Modulos/Contactos/Controller/View/uIEditorEmpleados.pas
rename to Source/Modulos/Contactos/Controller/View/uIEditorVendedores.pas
index a5b2cf5a..dbdc9193 100644
--- a/Source/Modulos/Contactos/Controller/View/uIEditorEmpleados.pas
+++ b/Source/Modulos/Contactos/Controller/View/uIEditorVendedores.pas
@@ -1,4 +1,4 @@
-unit uIEditorEmpleados;
+unit uIEditorVendedores;
interface
@@ -6,7 +6,7 @@ uses
uIEditorContactos, uBizContactos, uGUIBase;
type
- IEditorEmpleados = interface(IEditorContactos)
+ IEditorVendedores = interface(IEditorContactos)
['{982A8AC8-5D43-4C91-9E46-35326CD65C2F}']
end;
diff --git a/Source/Modulos/Contactos/Controller/uEmpleadosController.pas b/Source/Modulos/Contactos/Controller/uEmpleadosController.pas
deleted file mode 100644
index 26cee6da..00000000
--- a/Source/Modulos/Contactos/Controller/uEmpleadosController.pas
+++ /dev/null
@@ -1,315 +0,0 @@
-unit uEmpleadosController;
-
-interface
-
-uses
- Classes, uCustomEditor,
- uContactosController, uBizContactos,
- uIEditorEmpleados, uIEditorEmpleado, uIDataModuleContactos, uIDataModuleEmpleados;
-
-const
- CTE_VENDEDOR = 'Vendedor';
-
-type
- IEmpleadosController = interface(IContactosController)
- ['{A3841871-7EF6-4847-9758-EA2B1C521D4A}']
- function EsEliminable(AEmpleado: IBizContacto): Boolean;
- function Eliminar(AEmpleado: IBizContacto; AllItems: Boolean = false): Boolean; overload;
- procedure Preview(AEmpleado : IBizEmpleado; AllItems: Boolean = false);
- procedure Print(AEmpleado : IBizEmpleado; AllItems: Boolean = false);
- function BuscarVendedores: IBizContacto;
- function DarListaVendedores : TStringList;
- end;
-
- TEmpleadosController = class(TContactosController, IEmpleadosController)
- public
- constructor Create; override;
-
- function Duplicar(AContacto: IBizContacto): IBizContacto; override;
-
- function Buscar(const ID: Integer): IBizContacto; override;
- function BuscarTodos: IBizContacto; override;
- function BuscarVendedores: IBizContacto;
- function Nuevo : IBizContacto; override;
- procedure Ver(AContacto : IBizContacto); override;
- procedure VerTodos(AContactos: IBizContacto); override;
-
- function DarListaVendedores : TStringList;
-
- function Eliminar(AEmpleado: IBizContacto; AllItems: Boolean = false): Boolean; overload;
- function EsEliminable(AEmpleado: IBizContacto): Boolean;
-
- procedure Preview(AEmpleado : IBizEmpleado; AllItems: Boolean = false);
- procedure Print(AEmpleado : IBizEmpleado; AllItems: Boolean = false);
- end;
-
-implementation
-
-uses
- Windows, SysUtils, cxControls, Dialogs, uDataModuleEmpleados, uEditorRegistryUtils,
- uDataTableUtils, uDADataTable, DB, schContactosClient_Intf, uFichasEmpleadoReportController,
- uEditorGridBase, uDAInterfaces;
-
-{ TEmpleadoController }
-
-function TEmpleadosController.Buscar(const ID: Integer): IBizContacto;
-begin
- Result := (FDataModule as IDataModuleEmpleados).GetItem(ID);
- FiltrarEmpresa(Result);
-end;
-
-function TEmpleadosController.BuscarTodos: IBizContacto;
-begin
- Result := (FDataModule as IDataModuleEmpleados).GetItems;
- FiltrarEmpresa(Result);
-end;
-
-function TEmpleadosController.BuscarVendedores: IBizContacto;
-var
- Condicion: TDAWhereExpression;
-begin
- ShowHourglassCursor;
- try
- Result := BuscarTodos;
- // Filtrar los empleados que sean vendedores
- with Result.DataTable.DynamicWhere do
- begin
- // (CATEGORIA <> 'VENDEDOR')
- Condicion := NewBinaryExpression(NewField('', fld_EmpleadosCATEGORIA), NewConstant(CTE_VENDEDOR, datString), dboEqual);
-
- if IsEmpty then
- Expression := Condicion
- else
- Expression := NewBinaryExpression(Expression, Condicion, dboAnd);
- end;
- finally
- HideHourglassCursor;
- end;
-end;
-
-constructor TEmpleadosController.Create;
-begin
- inherited;
- FDataModule := TDataModuleEmpleados.Create(Nil);
-end;
-
-function TEmpleadosController.DarListaVendedores: TStringList;
-var
- AVendedores: IBizContacto;
- i : integer;
-begin
- AVendedores := BuscarVendedores;
- AVendedores.DataTable.Active := True;
-
- Result := TStringList.Create;
- try
- with Result do
- begin
- AVendedores.DataTable.First;
- while not AVendedores.DataTable.EOF do
- begin
- Add(Format('%s=%d', [AVendedores.NOMBRE, AVendedores.ID]));
- AVendedores.DataTable.Next;
- end;
- end;
- finally
- AVendedores := NIL;
- end;
-end;
-
-function TEmpleadosController.Duplicar(AContacto: IBizContacto): IBizContacto;
-begin
- Result := inherited Duplicar(AContacto);
-end;
-
-function TEmpleadosController.Eliminar(AEmpleado: IBizContacto; AllItems: Boolean = false): Boolean;
-//En el caso de eliminar almenos un elemento del conjunto se devuelve true
-var
- bEliminado: Boolean;
-
-begin
- Result := False;
-
- if not Assigned(AEmpleado) then
- raise Exception.Create ('Contacto no asignado');
-
- ShowHourglassCursor;
- try
- if not AEmpleado.DataTable.Active then
- AEmpleado.DataTable.Active := True;
-
- if (AEmpleado.State in dsEditModes) then
- AEmpleado.Cancel;
-
- //Siempre eliminaremos el seleccionado
- if EsEliminable(AEmpleado) then
- begin
- AEmpleado.Delete;
- bEliminado := True;
- end;
-
- //En el caso de querer eliminar todos los items del objeto AEmpleado
- if AllItems then
- begin
- with AEmpleado.DataTable do
- begin
- First;
- while not EOF do
- begin
- if EsEliminable(AEmpleado) then
- begin
- AEmpleado.Delete;
- bEliminado := True
- end
- else Next;
- end;
- end;
- end;
-
- if bEliminado then
- begin
- AEmpleado.DataTable.ApplyUpdates;
- Result := True;
- end
- else
- Result := False;
-
- finally
- HideHourglassCursor;
- end;
-end;
-
-function TEmpleadosController.EsEliminable(AEmpleado: IBizContacto): Boolean;
-begin
- if not Assigned(AEmpleado) then
- raise Exception.Create ('Contacto no asignado: EsEliminable');
-
- Result := True;
-end;
-
-function TEmpleadosController.Nuevo: IBizContacto;
-var
- AContacto : IBizEmpleado;
-begin
- AContacto := (FDataModule as IDataModuleEmpleados).NewItem;
- FiltrarEmpresa(AContacto);
- AContacto.DataTable.Active := True;
- AContacto.Insert;
- Result := AContacto;
-end;
-
-procedure TEmpleadosController.Preview(AEmpleado: IBizEmpleado; AllItems: Boolean);
-var
- AReportController : IFichasEmpleadoReportController;
- ID_Fichas: TStringList;
-
-begin
- AReportController := TFichasEmpleadoReportController.Create;
- try
- ID_Fichas := TStringList.Create;
-
- //Si deseamos previsualizar todos los items del objeto albaran
- if AllItems then
- begin
- with AEmpleado.DataTable do
- begin
- First;
- while not EOF do
- begin
- ID_Fichas.Add(IntToStr(AEmpleado.ID));
- Next;
- end;
- end;
- end
- //Solo previsualizamos el item seleccionado
- else
- ID_Fichas.Add(IntToStr(AEmpleado.ID));
-
- AReportController.Preview(ID_Fichas.CommaText);
-
- finally
- AReportController := NIL;
- ID_Fichas.Free;
- end;
-end;
-
-procedure TEmpleadosController.Print(AEmpleado: IBizEmpleado; AllItems: Boolean);
-var
- AReportController : IFichasEmpleadoReportController;
- ID_Fichas: TStringList;
-
-begin
- AReportController := TFichasEmpleadoReportController.Create;
- try
- ID_Fichas := TStringList.Create;
-
- //Si deseamos previsualizar todos los items del objeto albaran
- if AllItems then
- begin
- with AEmpleado.DataTable do
- begin
- First;
- while not EOF do
- begin
- ID_Fichas.Add(IntToStr(AEmpleado.ID));
- Next;
- end;
- end;
- end
- //Solo previsualizamos el item seleccionado
- else
- ID_Fichas.Add(IntToStr(AEmpleado.ID));
-
- AReportController.Print(ID_Fichas.CommaText);
-
- finally
- AReportController := NIL;
- ID_Fichas.Free;
- end;
-end;
-
-procedure TEmpleadosController.Ver(AContacto: IBizContacto);
-var
- AEditor : IEditorEmpleado;
-begin
- AEditor := NIL;
- ShowHourglassCursor;
- try
- CreateEditor('EditorEmpleado', IEditorEmpleado, AEditor);
- if Assigned(AEditor) then
- with AEditor do
- begin
- Contacto := AContacto;
- Controller := Self;
- ShowModal;
- Release;
- end;
- finally
- AEditor := NIL;
- HideHourglassCursor;
- end;
-end;
-
-procedure TEmpleadosController.VerTodos(AContactos: IBizContacto);
-var
- AEditor : IEditorEmpleados;
-begin
- AEditor := NIL;
- ShowHourglassCursor;
- try
- CreateEditor('EditorEmpleados', IEditorEmpleados, AEditor);
- if Assigned(AEditor) then
- with AEditor do
- begin
- Contactos := AContactos;
- Controller := Self;
- MultiSelect := True;
- ShowEmbedded;
- end;
- finally
- AEditor := NIL;
- HideHourglassCursor;
- end;
-end;
-
-end.
diff --git a/Source/Modulos/Contactos/Controller/uEtiquetasContactosReportController.pas b/Source/Modulos/Contactos/Controller/uEtiquetasContactosReportController.pas
index fe7e7aa9..b1dd4759 100644
--- a/Source/Modulos/Contactos/Controller/uEtiquetasContactosReportController.pas
+++ b/Source/Modulos/Contactos/Controller/uEtiquetasContactosReportController.pas
@@ -4,7 +4,7 @@ interface
uses
Classes, SysUtils, uDADataTable, uControllerBase, uIDataModuleEtiquetasContactosReport,
- uEmpleadosController;
+ uVendedoresController;
type
IEtiquetasContactosReportController = interface
diff --git a/Source/Modulos/Contactos/Controller/uFichasEmpleadoReportController.pas b/Source/Modulos/Contactos/Controller/uFichasEmpleadoReportController.pas
deleted file mode 100644
index e8ec757a..00000000
--- a/Source/Modulos/Contactos/Controller/uFichasEmpleadoReportController.pas
+++ /dev/null
@@ -1,109 +0,0 @@
-unit uFichasEmpleadoReportController;
-
-interface
-
-uses
- Classes, SysUtils, uDADataTable, uControllerBase, uIDataModuleFichasEmpleadoReport,
- uEmpleadosController;
-
-type
- IFichasEmpleadoReportController = interface
- ['{8E43F55F-7D5A-4778-8523-7C105EAEB1AB}']
- procedure Preview(const AFichaID : String);
- procedure Print(const AFichaID : String);
- end;
-
- TFichasEmpleadoReportController = class(TInterfacedObject, IFichasEmpleadoReportController)
- private
- FDataModule : IDataModuleFichasEmpleadoReport;
- function CreateEditor(const AName: String; const IID: TGUID; out Intf): Boolean;
- public
- constructor Create;
- destructor Destroy; override;
-
- procedure Preview(const AFichaID : String);
- procedure Print(const AFichaID : String);
- end;
-
-
-implementation
-
-uses
- uROTypes, uEditorRegistryUtils, uIEditorFichasEmpleadoPreview,
- uEditorPreview, uDataModuleEmpleados, uEditorBase, cxControls;
-
-{ TFichasEmpleadoReportController }
-
-constructor TFichasEmpleadoReportController.Create;
-begin
- FDataModule := TDataModuleEmpleados.Create(Nil);
-end;
-
-function TFichasEmpleadoReportController.CreateEditor(const AName: String; const IID: TGUID; out Intf): Boolean;
-begin
- Result := Supports(EditorRegistry.CreateEditor(AName), IID, Intf);
-end;
-
-
-destructor TFichasEmpleadoReportController.Destroy;
-begin
- FDataModule := NIL;
- inherited;
-end;
-
-procedure TFichasEmpleadoReportController.Preview(const AFichaID : String);
-var
- AStream: Binary;
- AEditor : IEditorFichasEmpleadoPreview;
-begin
- AEditor := NIL;
- ShowHourglassCursor;
- try
- AStream := FDataModule.GetReport(AFichaID);
- try
- CreateEditor('EditorFichasEmpleadoPreview', IEditorFichasEmpleadoPreview, AEditor);
- if Assigned(AEditor) then
- with AEditor do
- begin
- LoadFromStream(AStream);
- Preview;
- Release;
- end;
- finally
- FreeAndNil(AStream);
- AEditor := Nil;
- end;
- finally
- HideHourglassCursor;
- end;
-end;
-
-procedure TFichasEmpleadoReportController.Print(const AFichaID : String);
-var
- AStream: Binary;
- AEditor : IEditorFichasEmpleadoPreview;
-begin
- AEditor := NIL;
-
- ShowHourglassCursor;
- try
- AStream := FDataModule.GetReport(AFichaID);
- try
- CreateEditor('EditorFichasEmpleadoPreview', IEditorFichasEmpleadoPreview, AEditor);
- if Assigned(AEditor) then
- with AEditor do
- begin
- LoadFromStream(AStream);
- Print;
- Release;
- end;
- finally
- FreeAndNil(AStream);
- AEditor := Nil;
- end;
- finally
- HideHourglassCursor;
- end;
-end;
-
-end.
diff --git a/Source/Modulos/Contactos/Controller/uGruposEmpleadoController.pas b/Source/Modulos/Contactos/Controller/uGruposEmpleadoController.pas
deleted file mode 100644
index 8a98aba7..00000000
--- a/Source/Modulos/Contactos/Controller/uGruposEmpleadoController.pas
+++ /dev/null
@@ -1,227 +0,0 @@
-unit uGruposEmpleadoController;
-
-interface
-
-
-uses
- Classes, SysUtils, uDADataTable, uControllerBase, uEditorDBItem,
- uIDataModuleEmpleados, uBizGruposEmpleado;
-
-type
- IGruposEmpleadoController = interface(IObservador)
- ['{6820BA19-5E5E-459F-9001-FB4A712ACC4C}']
- function BuscarTodos: IBizGrupoEmpleado;
- procedure VerTodos(AGruposEmpleado: IBizGrupoEmpleado);
- procedure Anadir(AGrupoEmpleado : IBizGrupoEmpleado);
- function Eliminar(AGrupoEmpleado : IBizGrupoEmpleado): Boolean;
- function Guardar(AGrupoEmpleado : IBizGrupoEmpleado): Boolean;
- procedure DescartarCambios(AGrupoEmpleado : IBizGrupoEmpleado);
- function Localizar(AGruposEmpleado: IBizGrupoEmpleado; ADescripcion:String): Boolean;
- function DarListaGruposEmpleado: TStringList;
- end;
-
- TGruposEmpleadoController = class(TObservador, IGruposEmpleadoController)
- protected
- FDataModule : IDataModuleEmpleados;
- procedure RecibirAviso(ASujeto: ISujeto; ADataTable: IDAStronglyTypedDataTable); override;
- function CreateEditor(const AName : String; const IID: TGUID; out Intf): Boolean;
- function ValidarGrupoEmpleado(AGrupoEmpleado: IBizGrupoEmpleado): Boolean;
- procedure AsignarDataModule; virtual;
- public
- constructor Create; override;
- destructor Destroy; override;
-
- function Eliminar(AGrupoEmpleado : IBizGrupoEmpleado): Boolean;
- function Guardar(AGrupoEmpleado : IBizGrupoEmpleado): Boolean;
- procedure DescartarCambios(AGrupoEmpleado : IBizGrupoEmpleado); virtual;
- procedure Anadir(AGrupoEmpleado : IBizGrupoEmpleado);
- function BuscarTodos: IBizGrupoEmpleado;
- procedure VerTodos(AGruposEmpleado: IBizGrupoEmpleado);
- function Localizar(AGruposEmpleado: IBizGrupoEmpleado; ADescripcion:String): Boolean;
- function DarListaGruposEmpleado: TStringList;
- end;
-
-implementation
-
-uses
- cxControls, DB, uEditorRegistryUtils,
- uIEditorGruposEmpleado, uDataModuleEmpleados,
- uDAInterfaces, uDataTableUtils,
- uDateUtils, uROTypes, DateUtils, Controls, Windows, schContactosClient_Intf;
-
-{ TGruposEmpleadoController }
-
-procedure TGruposEmpleadoController.Anadir(AGrupoEmpleado: IBizGrupoEmpleado);
-begin
- AGrupoEmpleado.Insert;
-end;
-
-procedure TGruposEmpleadoController.AsignarDataModule;
-begin
- FDataModule := TDataModuleEmpleados.Create(Nil);
-end;
-
-function TGruposEmpleadoController.BuscarTodos: IBizGrupoEmpleado;
-begin
- Result := FDataModule.GetGruposEmpleado;
-end;
-
-constructor TGruposEmpleadoController.Create;
-begin
- inherited;
- AsignarDataModule;
-end;
-
-function TGruposEmpleadoController.CreateEditor(const AName: String; const IID: TGUID; out Intf): Boolean;
-begin
- Result := Supports(EditorRegistry.CreateEditor(AName), IID, Intf);
-end;
-
-function TGruposEmpleadoController.DarListaGruposEmpleado: TStringList;
-var
- AGruposEmpleado: IBizGrupoEmpleado;
-begin
- AGruposEmpleado := BuscarTodos;
- AGruposEmpleado.DataTable.Active := True;
- Result := TStringList.Create;
- try
- with Result do
- begin
- AGruposEmpleado.DataTable.First;
- while not AGruposEmpleado.DataTable.EOF do
- begin
- Add(AGruposEmpleado.DESCRIPCION);
- AGruposEmpleado.DataTable.Next;
- end;
- end;
- finally
- AGruposEmpleado := NIL;
- end;
-end;
-
-procedure TGruposEmpleadoController.DescartarCambios(AGrupoEmpleado: IBizGrupoEmpleado);
-begin
- if not Assigned(AGrupoEmpleado) then
- raise Exception.Create ('GrupoEmpleado no asignado');
-
- ShowHourglassCursor;
- try
- if (AGrupoEmpleado.State in dsEditModes) then
- AGrupoEmpleado.Cancel;
-
- AGrupoEmpleado.DataTable.CancelUpdates;
- finally
- HideHourglassCursor;
- end;
-end;
-
-destructor TGruposEmpleadoController.Destroy;
-begin
- FDataModule := Nil;
- inherited;
-end;
-
-function TGruposEmpleadoController.ValidarGrupoEmpleado(AGrupoEmpleado: IBizGrupoEmpleado): Boolean;
-begin
- Result := False;
-
- if not Assigned(AGrupoEmpleado) then
- raise Exception.Create ('GrupoEmpleado no asignada');
-
- if (AGrupoEmpleado.DataTable.State in dsEditModes) then
- AGrupoEmpleado.DataTable.Post;
-
- if Length(AGrupoEmpleado.DESCRIPCION) = 0 then
- raise Exception.Create('Debe indicar al menos la descripción de este grupo.');
-
- Result := True;
-end;
-
-procedure TGruposEmpleadoController.VerTodos(AGruposEmpleado: IBizGrupoEmpleado);
-var
- AEditor : IEditorGruposEmpleado;
-begin
- AEditor := NIL;
- ShowHourglassCursor;
- try
- CreateEditor('EditorGruposEmpleado', IEditorGruposEmpleado, AEditor);
- if Assigned(AEditor) then
- with AEditor do
- begin
- Controller := Self; //OJO ORDEN MUY IMPORTANTE
- GruposEmpleado := AGruposEmpleado;
- ShowModal;
- Release;
- end;
- finally
- AEditor := NIL;
- HideHourglassCursor;
- end;
-end;
-
-function TGruposEmpleadoController.Eliminar(AGrupoEmpleado: IBizGrupoEmpleado): Boolean;
-begin
- Result := False;
-
- if not Assigned(AGrupoEmpleado) then
- raise Exception.Create ('GrupoEmpleado no asignada');
-
- ShowHourglassCursor;
- try
- if (AGrupoEmpleado.State in dsEditModes) then
- AGrupoEmpleado.Cancel;
-
- AGrupoEmpleado.Delete;
- AGrupoEmpleado.DataTable.ApplyUpdates;
- HideHourglassCursor;
- Result := True;
- finally
- HideHourglassCursor;
- end;
-end;
-
-procedure TGruposEmpleadoController.RecibirAviso(ASujeto: ISujeto; ADataTable: IDAStronglyTypedDataTable);
-begin
- inherited;
-//
-end;
-
-function TGruposEmpleadoController.Guardar(AGrupoEmpleado: IBizGrupoEmpleado): Boolean;
-begin
- Result := False;
-
- if ValidarGrupoEmpleado(AGrupoEmpleado) then
- begin
- ShowHourglassCursor;
- try
- if (AGrupoEmpleado.DataTable.State in dsEditModes) then
- AGrupoEmpleado.DataTable.Post;
-
- AGrupoEmpleado.DataTable.ApplyUpdates;
-
- Result := True;
- finally
- HideHourglassCursor;
- end;
- end;
-end;
-
-function TGruposEmpleadoController.Localizar(AGruposEmpleado: IBizGrupoEmpleado; ADescripcion: String): Boolean;
-begin
- Result := True;
- ShowHourglassCursor;
- try
- with AGruposEmpleado.DataTable do
- begin
- DisableControls;
- First;
- if not Locate(fld_GruposEmpleadoDESCRIPCION, ADescripcion, []) then
- Result := False;
- EnableControls;
- end;
- finally
- HideHourglassCursor;
- end;
-end;
-
-end.
diff --git a/Source/Modulos/Contactos/Controller/uVendedoresController.pas b/Source/Modulos/Contactos/Controller/uVendedoresController.pas
new file mode 100644
index 00000000..d9861481
--- /dev/null
+++ b/Source/Modulos/Contactos/Controller/uVendedoresController.pas
@@ -0,0 +1,279 @@
+unit uVendedoresController;
+
+interface
+
+uses
+ Classes, uCustomEditor,
+ uContactosController, uBizContactos,
+ uIEditorVendedores, uIEditorVendedor, uIDataModuleContactos, uIDataModuleVendedores;
+
+const
+ CTE_VENDEDOR = 'Vendedor';
+
+type
+ IVendedoresController = interface(IContactosController)
+ ['{A3841871-7EF6-4847-9758-EA2B1C521D4A}']
+ function EsEliminable(AVendedor: IBizContacto): Boolean;
+ function Eliminar(AVendedor: IBizContacto; AllItems: Boolean = false): Boolean; overload;
+ function DarListaVendedores : TStringList;
+ function BuscarTodos: IBizContacto; overload;
+ function BuscarTodos(const CadenaIDs: String): IBizContacto; overload;
+ end;
+
+ TVendedoresController = class(TContactosController, IVendedoresController)
+ public
+ constructor Create; override;
+ function Duplicar(AContacto: IBizContacto): IBizContacto; override;
+ function Buscar(const ID: Integer): IBizContacto; override;
+ function BuscarTodos: IBizContacto; overload; override;
+ function BuscarTodos(const CadenaIDs: String): IBizContacto; overload;
+ function Nuevo : IBizContacto; override;
+ procedure Ver(AContacto : IBizContacto); override;
+ procedure VerTodos(AContactos: IBizContacto); override;
+ function ElegirContacto(AContactos : IBizContacto;
+ AMensaje: String; AMultiSelect: Boolean): IBizContacto; override;
+
+ function DarListaVendedores : TStringList;
+
+ function Eliminar(AVendedor: IBizContacto; AllItems: Boolean = false): Boolean; overload;
+ function EsEliminable(AVendedor: IBizContacto): Boolean;
+ end;
+
+implementation
+
+uses
+ Windows, SysUtils, Controls, cxControls, Dialogs, uDataModuleVendedores, uEditorRegistryUtils,
+ uDataTableUtils, uDADataTable, DB, schContactosClient_Intf,
+ uEditorGridBase, uDAInterfaces, uIEditorElegirVendedores;
+
+{ TVendedorController }
+
+function TVendedoresController.Buscar(const ID: Integer): IBizContacto;
+begin
+ Result := (FDataModule as IDataModuleVendedores).GetItem(ID);
+ FiltrarEmpresa(Result);
+end;
+
+function TVendedoresController.BuscarTodos: IBizContacto;
+begin
+ Result := (FDataModule as IDataModuleVendedores).GetItems;
+ FiltrarEmpresa(Result);
+end;
+
+function TVendedoresController.BuscarTodos(const CadenaIDs: String): IBizContacto;
+var
+ Cadena : TStringList;
+ Condicion: TDAWhereExpression;
+ i: Integer;
+
+begin
+ ShowHourglassCursor;
+ try
+ Result := BuscarTodos;
+
+ if (Length(CadenaIDs) > 0) then
+ begin
+ Cadena := TStringList.Create;
+ Cadena.CommaText := CadenaIDs;
+
+ //Vamos generando todas las where de cada uno de los ID recibidos
+ for i := 0 to Cadena.Count - 1 do
+ with Result.DataTable.DynamicWhere do
+ begin
+ //Todas aquellos vendedores que no esten asociados a la liquidación actual
+ Condicion := NewBinaryExpression(NewField('', fld_VendedoresID), NewConstant(StrToInt(Cadena.Strings[i]), datInteger), dboNotEqual);
+
+ if IsEmpty then
+ Expression := Condicion
+ else
+ Expression := NewBinaryExpression(Expression, Condicion, dboAnd);
+ end;
+
+ Cadena.Free;
+ end;
+
+ finally
+ HideHourglassCursor;
+ end;
+end;
+
+constructor TVendedoresController.Create;
+begin
+ inherited;
+ FDataModule := TDataModuleVendedores.Create(Nil);
+end;
+
+function TVendedoresController.DarListaVendedores: TStringList;
+var
+ AVendedores: IBizContacto;
+ i : integer;
+begin
+ AVendedores := BuscarTodos;
+ AVendedores.DataTable.Active := True;
+
+ Result := TStringList.Create;
+ try
+ with Result do
+ begin
+ AVendedores.DataTable.First;
+ while not AVendedores.DataTable.EOF do
+ begin
+ Add(Format('%s=%d', [AVendedores.NOMBRE, AVendedores.ID]));
+ AVendedores.DataTable.Next;
+ end;
+ end;
+ finally
+ AVendedores := NIL;
+ end;
+end;
+
+function TVendedoresController.Duplicar(AContacto: IBizContacto): IBizContacto;
+begin
+ Result := inherited Duplicar(AContacto);
+end;
+
+function TVendedoresController.ElegirContacto(AContactos: IBizContacto;
+ AMensaje: String; AMultiSelect: Boolean): IBizContacto;
+var
+ AEditor : IEditorElegirVendedores;
+begin
+ Result := NIL;
+
+ CreateEditor('EditorElegirVendedores', IEditorElegirVendedores, AEditor);
+ try
+ with AEditor do
+ begin
+ Contactos := AContactos;
+ Controller := Self;
+ MultiSelect := AMultiSelect;
+ Mensaje := AMensaje;
+ if IsPositiveResult(ShowModal) then
+ Result := ContactosSeleccionados;
+ Release;
+ end;
+ finally
+ AEditor := NIL;
+ end;
+end;
+
+function TVendedoresController.Eliminar(AVendedor: IBizContacto; AllItems: Boolean = false): Boolean;
+//En el caso de eliminar almenos un elemento del conjunto se devuelve true
+var
+ bEliminado: Boolean;
+
+begin
+ Result := False;
+
+ if not Assigned(AVendedor) then
+ raise Exception.Create ('Contacto no asignado');
+
+ ShowHourglassCursor;
+ try
+ if not AVendedor.DataTable.Active then
+ AVendedor.DataTable.Active := True;
+
+ if (AVendedor.State in dsEditModes) then
+ AVendedor.Cancel;
+
+ //Siempre eliminaremos el seleccionado
+ if EsEliminable(AVendedor) then
+ begin
+ AVendedor.Delete;
+ bEliminado := True;
+ end;
+
+ //En el caso de querer eliminar todos los items del objeto AVendedor
+ if AllItems then
+ begin
+ with AVendedor.DataTable do
+ begin
+ First;
+ while not EOF do
+ begin
+ if EsEliminable(AVendedor) then
+ begin
+ AVendedor.Delete;
+ bEliminado := True
+ end
+ else Next;
+ end;
+ end;
+ end;
+
+ if bEliminado then
+ begin
+ AVendedor.DataTable.ApplyUpdates;
+ Result := True;
+ end
+ else
+ Result := False;
+
+ finally
+ HideHourglassCursor;
+ end;
+end;
+
+function TVendedoresController.EsEliminable(AVendedor: IBizContacto): Boolean;
+begin
+ if not Assigned(AVendedor) then
+ raise Exception.Create ('Contacto no asignado: EsEliminable');
+
+ Result := True;
+end;
+
+function TVendedoresController.Nuevo: IBizContacto;
+var
+ AContacto : IBizVendedor;
+begin
+ AContacto := (FDataModule as IDataModuleVendedores).NewItem;
+ FiltrarEmpresa(AContacto);
+ AContacto.DataTable.Active := True;
+ AContacto.Insert;
+ Result := AContacto;
+end;
+
+procedure TVendedoresController.Ver(AContacto: IBizContacto);
+var
+ AEditor : IEditorVendedor;
+begin
+ AEditor := NIL;
+ ShowHourglassCursor;
+ try
+ CreateEditor('EditorVendedor', IEditorVendedor, AEditor);
+ if Assigned(AEditor) then
+ with AEditor do
+ begin
+ Contacto := AContacto;
+ Controller := Self;
+ ShowModal;
+ Release;
+ end;
+ finally
+ AEditor := NIL;
+ HideHourglassCursor;
+ end;
+end;
+
+procedure TVendedoresController.VerTodos(AContactos: IBizContacto);
+var
+ AEditor : IEditorVendedores;
+begin
+ AEditor := NIL;
+ ShowHourglassCursor;
+ try
+ CreateEditor('EditorVendedores', IEditorVendedores, AEditor);
+ if Assigned(AEditor) then
+ with AEditor do
+ begin
+ Contactos := AContactos;
+ Controller := Self;
+ MultiSelect := True;
+ ShowEmbedded;
+ end;
+ finally
+ AEditor := NIL;
+ HideHourglassCursor;
+ end;
+end;
+
+end.
diff --git a/Source/Modulos/Contactos/Data/Contactos_data.dpk b/Source/Modulos/Contactos/Data/Contactos_data.dpk
index d040598f..2744d1d2 100644
Binary files a/Source/Modulos/Contactos/Data/Contactos_data.dpk and b/Source/Modulos/Contactos/Data/Contactos_data.dpk differ
diff --git a/Source/Modulos/Contactos/Data/Contactos_data.dproj b/Source/Modulos/Contactos/Data/Contactos_data.dproj
index b5ddf1fe..ce45f511 100644
--- a/Source/Modulos/Contactos/Data/Contactos_data.dproj
+++ b/Source/Modulos/Contactos/Data/Contactos_data.dproj
@@ -49,12 +49,11 @@
MainSource
-
-
-
-
-
-
+
+
+
+
+
TDAClientDataModule
@@ -63,14 +62,15 @@
TDAClientDataModule
-
-
- TDAClientDataModule
-
TDAClientDataModule
+
+
+ TDAClientDataModule
+
+
diff --git a/Source/Modulos/Contactos/Data/uDataModuleContactos.pas b/Source/Modulos/Contactos/Data/uDataModuleContactos.pas
index 9672624e..afdc296e 100644
--- a/Source/Modulos/Contactos/Data/uDataModuleContactos.pas
+++ b/Source/Modulos/Contactos/Data/uDataModuleContactos.pas
@@ -111,7 +111,7 @@ begin
case IDCategoria of
CATEGORIA_CLIENTE : BusinessRulesID := BIZ_CLIENT_CLIENTE;
CATEGORIA_PROVEEDOR : BusinessRulesID := BIZ_CLIENT_PROVEEDOR;
- CATEGORIA_EMPLEADO : BusinessRulesID := BIZ_CLIENT_EMPLEADO;
+ CATEGORIA_VENDEDOR : BusinessRulesID := BIZ_CLIENT_VENDEDOR;
end;
with TBizContacto(AContacto.BusinessEventsObj) do
diff --git a/Source/Modulos/Contactos/Data/uDataModuleEmpleados.pas b/Source/Modulos/Contactos/Data/uDataModuleEmpleados.pas
deleted file mode 100644
index 0365426f..00000000
--- a/Source/Modulos/Contactos/Data/uDataModuleEmpleados.pas
+++ /dev/null
@@ -1,109 +0,0 @@
-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,
- uDAInterfaces, uDAMemDataTable, uDADataStreamer, uDABin2DataStreamer,
- uDARemoteDataAdapter;
-
-type
- TDataModuleEmpleados = class(TDataModuleContactos, IDataModuleEmpleados, IDataModuleFichasEmpleadoReport)
- tbl_Empleados: TDAMemDataTable;
- ds_Empleados: TDADataSource;
- tbl_GruposEmpleado: TDAMemDataTable;
- ds_GruposEmpleado: TDADataSource;
- protected
- public
- function GetItem(const ID : Integer) : IBizEmpleado;
- function NewItem : IBizEmpleado;
- function GetItems : IBizEmpleado;
- function GetGruposEmpleado : IBizGrupoEmpleado;
-
- // Report
- function GetReport(const AFichaID: String): Binary;
- end;
-
-
-implementation
-
-{$R *.dfm}
-
-uses
- FactuGES_Intf, cxControls, schContactosClient_Intf, uDataTableUtils;
-
-{ TDataModuleVendedores }
-
-function TDataModuleEmpleados.GetGruposEmpleado: IBizGrupoEmpleado;
-var
- AGrupoEmpleado : TDAMemDataTable;
-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;
-var
- Condicion: TDAWhereExpression;
-begin
- ShowHourglassCursor;
- try
- Result := Self.GetItems;
-
- with Result.DataTable.DynamicWhere do
- begin
- // (ID = :ID)
- Condicion := NewBinaryExpression(NewField('', fld_ContactosID), NewConstant(ID, datInteger), dboEqual);
-
- if IsEmpty then
- Expression := Condicion
- else
- Expression := NewBinaryExpression(Expression, Condicion, dboAnd);
- end;
-
- finally
- HideHourglassCursor;
- end;
-end;
-
-function TDataModuleEmpleados.GetItems: IBizEmpleado;
-var
- AContacto : TDAMemDataTable;
-begin
- ShowHourglassCursor;
- try
- AContacto := CloneDataTable(tbl_Empleados);
- AContacto.BusinessRulesID := BIZ_CLIENT_EMPLEADO;
-
- with TBizEmpleado(AContacto.BusinessEventsObj) do
- begin
- DatosBancarios := _GetDatosBancarios;
- end;
-
- Result := (AContacto as IBizEmpleado);
- finally
- HideHourglassCursor;
- end;
-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.
diff --git a/Source/Modulos/Contactos/Data/uDataModuleEmpleados.dfm b/Source/Modulos/Contactos/Data/uDataModuleVendedores.dfm
similarity index 60%
rename from Source/Modulos/Contactos/Data/uDataModuleEmpleados.dfm
rename to Source/Modulos/Contactos/Data/uDataModuleVendedores.dfm
index c643b98a..a7c1f86b 100644
--- a/Source/Modulos/Contactos/Data/uDataModuleEmpleados.dfm
+++ b/Source/Modulos/Contactos/Data/uDataModuleVendedores.dfm
@@ -1,4 +1,4 @@
-inherited DataModuleEmpleados: TDataModuleEmpleados
+inherited DataModuleVendedores: TDataModuleVendedores
inherited ds_Contactos: TDADataSource
DataSet = tbl_Contactos.Dataset
end
@@ -8,7 +8,7 @@ inherited DataModuleEmpleados: TDataModuleEmpleados
inherited ds_DatosBancarios: TDADataSource
DataSet = tbl_DatosBancarios.Dataset
end
- object tbl_Empleados: TDAMemDataTable
+ object tbl_Vendedores: TDAMemDataTable
RemoteUpdatesOptions = []
Fields = <
item
@@ -50,14 +50,14 @@ inherited DataModuleEmpleados: TDataModuleEmpleados
Name = 'CALLE'
DataType = datString
Size = 255
- DisplayLabel = 'Direcci'#243'n'
+ DisplayLabel = 'Direcci'#195#179'n'
DictionaryEntry = 'Contactos_CALLE'
end
item
Name = 'POBLACION'
DataType = datString
Size = 255
- DisplayLabel = 'Poblaci'#243'n'
+ DisplayLabel = 'Poblaci'#195#179'n'
DictionaryEntry = 'Contactos_POBLACION'
end
item
@@ -71,7 +71,7 @@ inherited DataModuleEmpleados: TDataModuleEmpleados
Name = 'CODIGO_POSTAL'
DataType = datString
Size = 10
- DisplayLabel = 'C'#243'digo postal'
+ DisplayLabel = 'C'#195#179'digo postal'
DictionaryEntry = 'Contactos_CODIGO_POSTAL'
end
item
@@ -92,7 +92,7 @@ inherited DataModuleEmpleados: TDataModuleEmpleados
Name = 'MOVIL_1'
DataType = datString
Size = 25
- DisplayLabel = 'M'#243'vil'
+ DisplayLabel = 'M'#195#179'vil'
DictionaryEntry = 'Contactos_MOVIL_1'
end
item
@@ -178,47 +178,8 @@ inherited DataModuleEmpleados: TDataModuleEmpleados
DictionaryEntry = 'Contactos_TIENDA'
end
item
- Name = 'FECHA_NACIMIENTO'
- DataType = datDateTime
- DisplayLabel = 'Fecha nacimiento'
- DictionaryEntry = 'Empleados_FECHA_NACIMIENTO'
- end
- item
- Name = 'CATEGORIA'
- DataType = datString
- Size = 255
- DisplayLabel = 'Categor'#237'a'
- DictionaryEntry = 'Empleados_CATEGORIA'
- end
- item
- Name = 'FECHA_ALTA_EMPRESA'
- DataType = datDateTime
- DisplayLabel = 'Fecha de alta'
- DictionaryEntry = 'Empleados_FECHA_ALTA_EMPRESA'
- end
- item
- Name = 'FORMACION_BASE'
- DataType = datMemo
- DisplayLabel = 'Formaci'#243'n base'
- DictionaryEntry = 'Empleados_FORMACION_BASE'
- end
- item
- Name = 'FORMACION_COMPLE'
- DataType = datMemo
- DisplayLabel = 'Formaci'#243'n complementaria'
- DictionaryEntry = 'Empleados_FORMACION_COMPLE'
- end
- item
- Name = 'FORMACION_RECIBIDA'
- DataType = datMemo
- DisplayLabel = 'Formaci'#243'n recibida'
- DictionaryEntry = 'Empleados_FORMACION_RECIBIDA'
- end
- item
- Name = 'EXPERIENCIA'
- DataType = datMemo
- DisplayLabel = 'Experiencia'
- DictionaryEntry = 'Empleados_EXPERIENCIA'
+ Name = 'COMISION'
+ DataType = datFloat
end
item
Name = 'ID_USUARIO'
@@ -227,53 +188,17 @@ inherited DataModuleEmpleados: TDataModuleEmpleados
Params = <>
StreamingOptions = [soDisableEventsWhileStreaming]
RemoteDataAdapter = rda_Contactos
- LocalDataStreamer = Bin2DataStreamer
DetailOptions = [dtCascadeOpenClose, dtCascadeApplyUpdates, dtAutoFetch, dtCascadeDelete, dtCascadeUpdate, dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates, dtIncludeInAllInOneFetch]
MasterOptions = [moCascadeOpenClose, moCascadeApplyUpdates, moCascadeDelete, moCascadeUpdate, moDisableLogOfCascadeDeletes, moDisableLogOfCascadeUpdates]
- LogicalName = 'Empleados'
+ LogicalName = 'Vendedores'
IndexDefs = <>
- Left = 296
- Top = 168
+ Left = 392
+ Top = 208
end
- object ds_Empleados: TDADataSource
- DataSet = tbl_Empleados.Dataset
- DataTable = tbl_Empleados
- Left = 296
- Top = 232
- end
- object tbl_GruposEmpleado: TDAMemDataTable
- RemoteUpdatesOptions = []
- Fields = <
- item
- Name = 'ID'
- DataType = datAutoInc
- GeneratorName = 'GEN_EMPLEADOS_GRUPOS_ID'
- Required = True
- DictionaryEntry = 'GruposEmpleado_ID'
- InPrimaryKey = True
- end
- item
- Name = 'DESCRIPCION'
- DataType = datString
- Size = 255
- DisplayLabel = 'Descripci'#243'n'
- DictionaryEntry = 'GruposEmpleado_DESCRIPCION'
- end>
- Params = <>
- StreamingOptions = [soDisableEventsWhileStreaming]
- RemoteDataAdapter = rda_Contactos
- LocalDataStreamer = Bin2DataStreamer
- DetailOptions = [dtCascadeOpenClose, dtCascadeApplyUpdates, dtAutoFetch, dtCascadeDelete, dtCascadeUpdate, dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates, dtIncludeInAllInOneFetch]
- MasterOptions = [moCascadeOpenClose, moCascadeApplyUpdates, moCascadeDelete, moCascadeUpdate, moDisableLogOfCascadeDeletes, moDisableLogOfCascadeUpdates]
- LogicalName = 'GruposEmpleado'
- IndexDefs = <>
- Left = 448
- Top = 168
- end
- object ds_GruposEmpleado: TDADataSource
- DataSet = tbl_GruposEmpleado.Dataset
- DataTable = tbl_GruposEmpleado
- Left = 448
- Top = 232
+ object ds_Vendedores: TDADataSource
+ DataSet = tbl_Vendedores.Dataset
+ DataTable = tbl_Vendedores
+ Left = 392
+ Top = 152
end
end
diff --git a/Source/Modulos/Contactos/Data/uDataModuleVendedores.pas b/Source/Modulos/Contactos/Data/uDataModuleVendedores.pas
new file mode 100644
index 00000000..39d4d356
--- /dev/null
+++ b/Source/Modulos/Contactos/Data/uDataModuleVendedores.pas
@@ -0,0 +1,83 @@
+unit uDataModuleVendedores;
+
+interface
+
+uses
+ Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
+ Dialogs, uDataModuleContactos, DB, uDADataTable, uDAScriptingProvider,
+ uDACDSDataTable, uDABINAdapter, uROServiceComponent, uRORemoteService,
+ uROClient, uROBinMessage, uROWinInetHttpChannel, uROTypes,
+ uIDataModuleVendedores, uBizContactos, uDADesigntimeCall,
+ uDAInterfaces, uDAMemDataTable, uDADataStreamer, uDABin2DataStreamer,
+ uDARemoteDataAdapter;
+
+type
+ TDataModuleVendedores = class(TDataModuleContactos, IDataModuleVendedores)
+ tbl_Vendedores: TDAMemDataTable;
+ ds_Vendedores: TDADataSource;
+ public
+ function GetItem(const ID : Integer) : IBizVendedor;
+ function NewItem : IBizVendedor;
+ function GetItems : IBizVendedor;
+ end;
+
+
+implementation
+
+{$R *.dfm}
+
+uses
+ FactuGES_Intf, cxControls, schContactosClient_Intf, uDataTableUtils;
+
+{ TDataModuleVendedores }
+
+function TDataModuleVendedores.GetItem(const ID: Integer): IBizVendedor;
+var
+ Condicion: TDAWhereExpression;
+begin
+ ShowHourglassCursor;
+ try
+ Result := Self.GetItems;
+
+ with Result.DataTable.DynamicWhere do
+ begin
+ // (ID = :ID)
+ Condicion := NewBinaryExpression(NewField('', fld_ContactosID), NewConstant(ID, datInteger), dboEqual);
+
+ if IsEmpty then
+ Expression := Condicion
+ else
+ Expression := NewBinaryExpression(Expression, Condicion, dboAnd);
+ end;
+
+ finally
+ HideHourglassCursor;
+ end;
+end;
+
+function TDataModuleVendedores.GetItems: IBizVendedor;
+var
+ AContacto : TDAMemDataTable;
+begin
+ ShowHourglassCursor;
+ try
+ AContacto := CloneDataTable(tbl_Vendedores);
+ AContacto.BusinessRulesID := BIZ_CLIENT_VENDEDOR;
+
+ with TBizVendedor(AContacto.BusinessEventsObj) do
+ begin
+ DatosBancarios := _GetDatosBancarios;
+ end;
+
+ Result := (AContacto as IBizVendedor);
+ finally
+ HideHourglassCursor;
+ end;
+end;
+
+function TDataModuleVendedores.NewItem: IBizVendedor;
+begin
+ Result := GetItem(ID_NULO)
+end;
+
+end.
diff --git a/Source/Modulos/Contactos/Model/Contactos_model.dpk b/Source/Modulos/Contactos/Model/Contactos_model.dpk
index 6b22ce5e..54d94731 100644
Binary files a/Source/Modulos/Contactos/Model/Contactos_model.dpk and b/Source/Modulos/Contactos/Model/Contactos_model.dpk differ
diff --git a/Source/Modulos/Contactos/Model/Contactos_model.dproj b/Source/Modulos/Contactos/Model/Contactos_model.dproj
index eaab2bdc..26fb6dd7 100644
--- a/Source/Modulos/Contactos/Model/Contactos_model.dproj
+++ b/Source/Modulos/Contactos/Model/Contactos_model.dproj
@@ -42,7 +42,7 @@
Delphi.Personality
Package
-FalseTrueFalseTrueFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0Contactos_model.dpk
+FalseTrueFalseFalseFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0Contactos_model.dpk
@@ -50,21 +50,22 @@
MainSource
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
@@ -72,12 +73,9 @@
-
-
-