Version 4.3.2 - Comerciales, instaladores y pasar facturas de cliente de abeto a facturas de proveedor a graden
git-svn-id: https://192.168.0.254/svn/Proyectos.AbetoDesign_FactuGES/trunk@174 93f398dd-4eb6-7a46-baf6-13f46f578da2
This commit is contained in:
parent
622dffcfe8
commit
b19508de31
@ -0,0 +1,16 @@
|
||||
unit uIEditorComercial;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
uIEditorContacto;
|
||||
|
||||
type
|
||||
IEditorComercial = interface(IEditorContacto)
|
||||
['{E8CCE5D6-400E-4720-BFFF-5BDBB522869F}']
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
@ -0,0 +1,16 @@
|
||||
unit uIEditorComerciales;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
uIEditorContactos, uBizContactos, uGUIBase;
|
||||
|
||||
type
|
||||
IEditorComerciales = interface(IEditorContactos)
|
||||
['{9DAB8672-D862-4D38-9D1D-371A631561A9}']
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
@ -0,0 +1,16 @@
|
||||
unit uIEditorElegirComerciales;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
uIEditorContactos, uIEditorElegirContactos, uBizContactos, uGUIBase;
|
||||
|
||||
type
|
||||
IEditorElegirComerciales = interface(IEditorElegirContactos)
|
||||
['{75167832-8965-481F-81AF-33A862A27696}']
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
@ -0,0 +1,16 @@
|
||||
unit uIEditorElegirInstaladores;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
uIEditorContactos, uIEditorElegirContactos, uBizContactos, uGUIBase;
|
||||
|
||||
type
|
||||
IEditorElegirInstaladores = interface(IEditorElegirContactos)
|
||||
['{5B347F2F-4AD8-408A-8FA9-FCDBFF267DD2}']
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
@ -0,0 +1,16 @@
|
||||
unit uIEditorInstalador;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
uIEditorContacto;
|
||||
|
||||
type
|
||||
IEditorInstalador = interface(IEditorContacto)
|
||||
['{999C00D3-AFD1-4BF0-A649-19328A5F2042}']
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
@ -0,0 +1,16 @@
|
||||
unit uIEditorInstaladores;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
uIEditorContactos, uBizContactos, uGUIBase;
|
||||
|
||||
type
|
||||
IEditorInstaladores = interface(IEditorContactos)
|
||||
['{1B585DD8-DD18-4648-A69D-C1C9D4627DE1}']
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
291
Source/Modulos/Contactos/Controller/uComercialesController.pas
Normal file
291
Source/Modulos/Contactos/Controller/uComercialesController.pas
Normal file
@ -0,0 +1,291 @@
|
||||
unit uComercialesController;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, uCustomEditor,
|
||||
uContactosController, uBizContactos,
|
||||
uIEditorComerciales, uIEditorComercial, uIDataModuleContactos, uIDataModuleComerciales;
|
||||
|
||||
const
|
||||
CTE_COMERCIAL = 'Comercial';
|
||||
|
||||
type
|
||||
IComercialesController = interface(IContactosController)
|
||||
['{855E9797-7DE1-4138-84CE-7AD0E8AAA330}']
|
||||
function EsEliminable(AComercial: IBizContacto): Boolean;
|
||||
function Eliminar(AComercial: IBizContacto; AllItems: Boolean = false): Boolean; overload;
|
||||
function DarListaComerciales : TStringList;
|
||||
function BuscarTodos: IBizContacto; overload;
|
||||
function BuscarTodos(const CadenaIDs: String): IBizContacto; overload;
|
||||
// function DarIDComercialDeUsuario(const AUsuario: Integer): Integer;
|
||||
end;
|
||||
|
||||
TComercialesController = class(TContactosController, IComercialesController)
|
||||
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 DarListaComerciales : TStringList;
|
||||
|
||||
function Eliminar(AComercial: IBizContacto; AllItems: Boolean = false): Boolean; overload;
|
||||
function EsEliminable(AComercial: IBizContacto): Boolean;
|
||||
// function DarIDComercialDeUsuario(const AUsuario: Integer): Integer;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Windows, SysUtils, Controls, cxControls, Dialogs, uDataModuleComerciales, uEditorRegistryUtils,
|
||||
uDataTableUtils, uDADataTable, DB, schContactosClient_Intf,
|
||||
uEditorGridBase, uDAInterfaces, uIEditorElegirComerciales;
|
||||
|
||||
{ TComercialController }
|
||||
|
||||
function TComercialesController.Buscar(const ID: Integer): IBizContacto;
|
||||
begin
|
||||
Result := (FDataModule as IDataModuleComerciales).GetItem(ID);
|
||||
FiltrarEmpresa(Result);
|
||||
end;
|
||||
|
||||
function TComercialesController.BuscarTodos: IBizContacto;
|
||||
begin
|
||||
Result := (FDataModule as IDataModuleComerciales).GetItems;
|
||||
FiltrarEmpresa(Result);
|
||||
end;
|
||||
|
||||
function TComercialesController.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 Comerciales que no esten asociados a la liquidación actual
|
||||
Condicion := NewBinaryExpression(NewField('', fld_ComercialesID), 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 TComercialesController.Create;
|
||||
begin
|
||||
inherited;
|
||||
FDataModule := TDataModuleComerciales.Create(Nil);
|
||||
end;
|
||||
|
||||
{function TComercialesController.DarIDComercialDeUsuario(
|
||||
const AUsuario: Integer): Integer;
|
||||
var
|
||||
AComerciales: IBizComercial;
|
||||
begin
|
||||
AComerciales := (BuscarTodos as IBizComercial);
|
||||
AComerciales.DataTable.Active := True;
|
||||
|
||||
with AComerciales.DataTable do
|
||||
begin
|
||||
First;
|
||||
while not EOF do
|
||||
begin
|
||||
if (AComerciales.ID_USUARIO = AUsuario) then
|
||||
begin
|
||||
Result := AComerciales.ID;
|
||||
Break;
|
||||
end
|
||||
else Next;
|
||||
end;
|
||||
end;
|
||||
end; }
|
||||
|
||||
function TComercialesController.DarListaComerciales: TStringList;
|
||||
var
|
||||
AComerciales: IBizContacto;
|
||||
begin
|
||||
AComerciales := BuscarTodos;
|
||||
AComerciales.DataTable.Active := True;
|
||||
|
||||
Result := TStringList.Create;
|
||||
try
|
||||
with Result do
|
||||
begin
|
||||
AComerciales.DataTable.First;
|
||||
while not AComerciales.DataTable.EOF do
|
||||
begin
|
||||
Add(Format('%s=%d', [AComerciales.NOMBRE, AComerciales.ID]));
|
||||
AComerciales.DataTable.Next;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
AComerciales := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TComercialesController.Duplicar(AContacto: IBizContacto): IBizContacto;
|
||||
begin
|
||||
Result := inherited Duplicar(AContacto);
|
||||
end;
|
||||
|
||||
function TComercialesController.ElegirContacto(AContactos: IBizContacto;
|
||||
AMensaje: String; AMultiSelect: Boolean): IBizContacto;
|
||||
var
|
||||
AEditor : IEditorElegirComerciales;
|
||||
begin
|
||||
Result := NIL;
|
||||
|
||||
CreateEditor('EditorElegirComerciales', IEditorElegirComerciales, AEditor);
|
||||
if Assigned(AEditor) then
|
||||
try
|
||||
AEditor.Contactos := AContactos;
|
||||
AEditor.Controller := Self;
|
||||
AEditor.MultiSelect := AMultiSelect;
|
||||
AEditor.Mensaje := AMensaje;
|
||||
if IsPositiveResult(AEditor.ShowModal) then
|
||||
Result := AEditor.ContactosSeleccionados;
|
||||
finally
|
||||
AEditor.Release;
|
||||
AEditor := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TComercialesController.Eliminar(AComercial: IBizContacto; AllItems: Boolean = false): Boolean;
|
||||
//En el caso de eliminar almenos un elemento del conjunto se devuelve true
|
||||
var
|
||||
bEliminado: Boolean;
|
||||
begin
|
||||
bEliminado := False;
|
||||
|
||||
if not Assigned(AComercial) then
|
||||
raise Exception.Create ('Contacto no asignado');
|
||||
|
||||
ShowHourglassCursor;
|
||||
try
|
||||
if not AComercial.DataTable.Active then
|
||||
AComercial.DataTable.Active := True;
|
||||
|
||||
if (AComercial.State in dsEditModes) then
|
||||
AComercial.Cancel;
|
||||
|
||||
//Siempre eliminaremos el seleccionado
|
||||
if EsEliminable(AComercial) then
|
||||
begin
|
||||
AComercial.Delete;
|
||||
bEliminado := True;
|
||||
end;
|
||||
|
||||
//En el caso de querer eliminar todos los items del objeto AComercial
|
||||
if AllItems then
|
||||
begin
|
||||
with AComercial.DataTable do
|
||||
begin
|
||||
First;
|
||||
while not EOF do
|
||||
begin
|
||||
if EsEliminable(AComercial) then
|
||||
begin
|
||||
AComercial.Delete;
|
||||
bEliminado := True
|
||||
end
|
||||
else Next;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if bEliminado then
|
||||
begin
|
||||
AComercial.DataTable.ApplyUpdates;
|
||||
Result := True;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
|
||||
finally
|
||||
HideHourglassCursor;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TComercialesController.EsEliminable(AComercial: IBizContacto): Boolean;
|
||||
begin
|
||||
if not Assigned(AComercial) then
|
||||
raise Exception.Create ('Contacto no asignado: EsEliminable');
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function TComercialesController.Nuevo: IBizContacto;
|
||||
var
|
||||
AContacto : IBizComercial;
|
||||
begin
|
||||
AContacto := (FDataModule as IDataModuleComerciales).NewItem;
|
||||
FiltrarEmpresa(AContacto);
|
||||
AContacto.DataTable.Active := True;
|
||||
AContacto.Insert;
|
||||
Result := AContacto;
|
||||
end;
|
||||
|
||||
procedure TComercialesController.Ver(AContacto: IBizContacto);
|
||||
var
|
||||
AEditor : IEditorComercial;
|
||||
begin
|
||||
AEditor := NIL;
|
||||
|
||||
CreateEditor('EditorComercial', IEditorComercial, AEditor);
|
||||
if Assigned(AEditor) then
|
||||
try
|
||||
AEditor.Contacto := AContacto;
|
||||
AEditor.Controller := Self;
|
||||
AEditor.ShowModal;
|
||||
finally
|
||||
AEditor.Release;
|
||||
AEditor := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TComercialesController.VerTodos(AContactos: IBizContacto);
|
||||
var
|
||||
AEditor : IEditorComerciales;
|
||||
begin
|
||||
AEditor := NIL;
|
||||
|
||||
CreateEditor('EditorComerciales', IEditorComerciales, AEditor);
|
||||
if Assigned(AEditor) then
|
||||
with AEditor do
|
||||
begin
|
||||
Contactos := AContactos;
|
||||
Controller := Self;
|
||||
MultiSelect := True;
|
||||
ShowEmbedded;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
291
Source/Modulos/Contactos/Controller/uInstaladoresController.pas
Normal file
291
Source/Modulos/Contactos/Controller/uInstaladoresController.pas
Normal file
@ -0,0 +1,291 @@
|
||||
unit uInstaladoresController;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, uCustomEditor,
|
||||
uContactosController, uBizContactos,
|
||||
uIEditorInstaladores, uIEditorInstalador, uIDataModuleContactos, uIDataModuleInstaladores;
|
||||
|
||||
const
|
||||
CTE_INSTALADOR = 'Instalador';
|
||||
|
||||
type
|
||||
IInstaladoresController = interface(IContactosController)
|
||||
['{EB88FC03-720E-47FA-9864-11BB096DDD35}']
|
||||
function EsEliminable(AInstalador: IBizContacto): Boolean;
|
||||
function Eliminar(AInstalador: IBizContacto; AllItems: Boolean = false): Boolean; overload;
|
||||
function DarListaInstaladores : TStringList;
|
||||
function BuscarTodos: IBizContacto; overload;
|
||||
function BuscarTodos(const CadenaIDs: String): IBizContacto; overload;
|
||||
// function DarIDInstaladorDeUsuario(const AUsuario: Integer): Integer;
|
||||
end;
|
||||
|
||||
TInstaladoresController = class(TContactosController, IInstaladoresController)
|
||||
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 DarListaInstaladores : TStringList;
|
||||
|
||||
function Eliminar(AInstalador: IBizContacto; AllItems: Boolean = false): Boolean; overload;
|
||||
function EsEliminable(AInstalador: IBizContacto): Boolean;
|
||||
// function DarIDInstaladorDeUsuario(const AUsuario: Integer): Integer;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Windows, SysUtils, Controls, cxControls, Dialogs, uDataModuleInstaladores, uEditorRegistryUtils,
|
||||
uDataTableUtils, uDADataTable, DB, schContactosClient_Intf,
|
||||
uEditorGridBase, uDAInterfaces, uIEditorElegirInstaladores;
|
||||
|
||||
{ TInstaladorController }
|
||||
|
||||
function TInstaladoresController.Buscar(const ID: Integer): IBizContacto;
|
||||
begin
|
||||
Result := (FDataModule as IDataModuleInstaladores).GetItem(ID);
|
||||
FiltrarEmpresa(Result);
|
||||
end;
|
||||
|
||||
function TInstaladoresController.BuscarTodos: IBizContacto;
|
||||
begin
|
||||
Result := (FDataModule as IDataModuleInstaladores).GetItems;
|
||||
FiltrarEmpresa(Result);
|
||||
end;
|
||||
|
||||
function TInstaladoresController.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 Instaladores que no esten asociados a la liquidación actual
|
||||
Condicion := NewBinaryExpression(NewField('', fld_InstaladoresID), 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 TInstaladoresController.Create;
|
||||
begin
|
||||
inherited;
|
||||
FDataModule := TDataModuleInstaladores.Create(Nil);
|
||||
end;
|
||||
|
||||
{function TInstaladoresController.DarIDInstaladorDeUsuario(
|
||||
const AUsuario: Integer): Integer;
|
||||
var
|
||||
AInstaladores: IBizInstalador;
|
||||
begin
|
||||
AInstaladores := (BuscarTodos as IBizInstalador);
|
||||
AInstaladores.DataTable.Active := True;
|
||||
|
||||
with AInstaladores.DataTable do
|
||||
begin
|
||||
First;
|
||||
while not EOF do
|
||||
begin
|
||||
if (AInstaladores.ID_USUARIO = AUsuario) then
|
||||
begin
|
||||
Result := AInstaladores.ID;
|
||||
Break;
|
||||
end
|
||||
else Next;
|
||||
end;
|
||||
end;
|
||||
end; }
|
||||
|
||||
function TInstaladoresController.DarListaInstaladores: TStringList;
|
||||
var
|
||||
AInstaladores: IBizContacto;
|
||||
begin
|
||||
AInstaladores := BuscarTodos;
|
||||
AInstaladores.DataTable.Active := True;
|
||||
|
||||
Result := TStringList.Create;
|
||||
try
|
||||
with Result do
|
||||
begin
|
||||
AInstaladores.DataTable.First;
|
||||
while not AInstaladores.DataTable.EOF do
|
||||
begin
|
||||
Add(Format('%s=%d', [AInstaladores.NOMBRE, AInstaladores.ID]));
|
||||
AInstaladores.DataTable.Next;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
AInstaladores := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TInstaladoresController.Duplicar(AContacto: IBizContacto): IBizContacto;
|
||||
begin
|
||||
Result := inherited Duplicar(AContacto);
|
||||
end;
|
||||
|
||||
function TInstaladoresController.ElegirContacto(AContactos: IBizContacto;
|
||||
AMensaje: String; AMultiSelect: Boolean): IBizContacto;
|
||||
var
|
||||
AEditor : IEditorElegirInstaladores;
|
||||
begin
|
||||
Result := NIL;
|
||||
|
||||
CreateEditor('EditorElegirInstaladores', IEditorElegirInstaladores, AEditor);
|
||||
if Assigned(AEditor) then
|
||||
try
|
||||
AEditor.Contactos := AContactos;
|
||||
AEditor.Controller := Self;
|
||||
AEditor.MultiSelect := AMultiSelect;
|
||||
AEditor.Mensaje := AMensaje;
|
||||
if IsPositiveResult(AEditor.ShowModal) then
|
||||
Result := AEditor.ContactosSeleccionados;
|
||||
finally
|
||||
AEditor.Release;
|
||||
AEditor := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TInstaladoresController.Eliminar(AInstalador: IBizContacto; AllItems: Boolean = false): Boolean;
|
||||
//En el caso de eliminar almenos un elemento del conjunto se devuelve true
|
||||
var
|
||||
bEliminado: Boolean;
|
||||
begin
|
||||
bEliminado := False;
|
||||
|
||||
if not Assigned(AInstalador) then
|
||||
raise Exception.Create ('Contacto no asignado');
|
||||
|
||||
ShowHourglassCursor;
|
||||
try
|
||||
if not AInstalador.DataTable.Active then
|
||||
AInstalador.DataTable.Active := True;
|
||||
|
||||
if (AInstalador.State in dsEditModes) then
|
||||
AInstalador.Cancel;
|
||||
|
||||
//Siempre eliminaremos el seleccionado
|
||||
if EsEliminable(AInstalador) then
|
||||
begin
|
||||
AInstalador.Delete;
|
||||
bEliminado := True;
|
||||
end;
|
||||
|
||||
//En el caso de querer eliminar todos los items del objeto AInstalador
|
||||
if AllItems then
|
||||
begin
|
||||
with AInstalador.DataTable do
|
||||
begin
|
||||
First;
|
||||
while not EOF do
|
||||
begin
|
||||
if EsEliminable(AInstalador) then
|
||||
begin
|
||||
AInstalador.Delete;
|
||||
bEliminado := True
|
||||
end
|
||||
else Next;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if bEliminado then
|
||||
begin
|
||||
AInstalador.DataTable.ApplyUpdates;
|
||||
Result := True;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
|
||||
finally
|
||||
HideHourglassCursor;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TInstaladoresController.EsEliminable(AInstalador: IBizContacto): Boolean;
|
||||
begin
|
||||
if not Assigned(AInstalador) then
|
||||
raise Exception.Create ('Contacto no asignado: EsEliminable');
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function TInstaladoresController.Nuevo: IBizContacto;
|
||||
var
|
||||
AContacto : IBizInstalador;
|
||||
begin
|
||||
AContacto := (FDataModule as IDataModuleInstaladores).NewItem;
|
||||
FiltrarEmpresa(AContacto);
|
||||
AContacto.DataTable.Active := True;
|
||||
AContacto.Insert;
|
||||
Result := AContacto;
|
||||
end;
|
||||
|
||||
procedure TInstaladoresController.Ver(AContacto: IBizContacto);
|
||||
var
|
||||
AEditor : IEditorInstalador;
|
||||
begin
|
||||
AEditor := NIL;
|
||||
|
||||
CreateEditor('EditorInstalador', IEditorInstalador, AEditor);
|
||||
if Assigned(AEditor) then
|
||||
try
|
||||
AEditor.Contacto := AContacto;
|
||||
AEditor.Controller := Self;
|
||||
AEditor.ShowModal;
|
||||
finally
|
||||
AEditor.Release;
|
||||
AEditor := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TInstaladoresController.VerTodos(AContactos: IBizContacto);
|
||||
var
|
||||
AEditor : IEditorInstaladores;
|
||||
begin
|
||||
AEditor := NIL;
|
||||
|
||||
CreateEditor('EditorInstaladores', IEditorInstaladores, AEditor);
|
||||
if Assigned(AEditor) then
|
||||
with AEditor do
|
||||
begin
|
||||
Contactos := AContactos;
|
||||
Controller := Self;
|
||||
MultiSelect := True;
|
||||
ShowEmbedded;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
215
Source/Modulos/Contactos/Data/uDataModuleComerciales.dfm
Normal file
215
Source/Modulos/Contactos/Data/uDataModuleComerciales.dfm
Normal file
@ -0,0 +1,215 @@
|
||||
inherited DataModuleComerciales: TDataModuleComerciales
|
||||
inherited ds_Contactos: TDADataSource
|
||||
DataSet = tbl_Contactos.Dataset
|
||||
end
|
||||
inherited ds_DireccionesContacto: TDADataSource
|
||||
DataSet = tbl_DireccionesContacto.Dataset
|
||||
end
|
||||
inherited ds_DatosBancarios: TDADataSource
|
||||
DataSet = tbl_DatosBancarios.Dataset
|
||||
end
|
||||
inherited ds_PersonalContacto: TDADataSource
|
||||
DataSet = tbl_PersonalContacto.Dataset
|
||||
end
|
||||
inherited ds_ContactosDirecciones: TDADataSource
|
||||
DataSet = tbl_ContactosDirecciones.Dataset
|
||||
end
|
||||
object tbl_Comerciales: TDAMemDataTable
|
||||
RemoteUpdatesOptions = []
|
||||
Fields = <
|
||||
item
|
||||
Name = 'ID'
|
||||
DataType = datAutoInc
|
||||
GeneratorName = 'GEN_CONTACTOS_ID'
|
||||
ServerAutoRefresh = True
|
||||
DictionaryEntry = 'Comerciales_ID'
|
||||
InPrimaryKey = True
|
||||
end
|
||||
item
|
||||
Name = 'ID_CATEGORIA'
|
||||
DataType = datInteger
|
||||
DisplayLabel = 'Comerciales_ID_CATEGORIA'
|
||||
DictionaryEntry = 'Comerciales_ID_CATEGORIA'
|
||||
end
|
||||
item
|
||||
Name = 'NIF_CIF'
|
||||
DataType = datString
|
||||
Size = 15
|
||||
DisplayLabel = 'Comerciales_NIF_CIF'
|
||||
DictionaryEntry = 'Comerciales_NIF_CIF'
|
||||
end
|
||||
item
|
||||
Name = 'NOMBRE'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Comerciales_NOMBRE'
|
||||
DictionaryEntry = 'Comerciales_NOMBRE'
|
||||
end
|
||||
item
|
||||
Name = 'PERSONA_CONTACTO'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Comerciales_PERSONA_CONTACTO'
|
||||
DictionaryEntry = 'Comerciales_PERSONA_CONTACTO'
|
||||
end
|
||||
item
|
||||
Name = 'CALLE'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Comerciales_CALLE'
|
||||
DictionaryEntry = 'Comerciales_CALLE'
|
||||
end
|
||||
item
|
||||
Name = 'POBLACION'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Comerciales_POBLACION'
|
||||
DictionaryEntry = 'Comerciales_POBLACION'
|
||||
end
|
||||
item
|
||||
Name = 'PROVINCIA'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Comerciales_PROVINCIA'
|
||||
DictionaryEntry = 'Comerciales_PROVINCIA'
|
||||
end
|
||||
item
|
||||
Name = 'CODIGO_POSTAL'
|
||||
DataType = datString
|
||||
Size = 10
|
||||
DisplayLabel = 'Comerciales_CODIGO_POSTAL'
|
||||
DictionaryEntry = 'Comerciales_CODIGO_POSTAL'
|
||||
end
|
||||
item
|
||||
Name = 'TELEFONO_1'
|
||||
DataType = datString
|
||||
Size = 25
|
||||
DisplayLabel = 'Comerciales_TELEFONO_1'
|
||||
DictionaryEntry = 'Comerciales_TELEFONO_1'
|
||||
end
|
||||
item
|
||||
Name = 'TELEFONO_2'
|
||||
DataType = datString
|
||||
Size = 25
|
||||
DisplayLabel = 'Comerciales_TELEFONO_2'
|
||||
DictionaryEntry = 'Comerciales_TELEFONO_2'
|
||||
end
|
||||
item
|
||||
Name = 'MOVIL_1'
|
||||
DataType = datString
|
||||
Size = 25
|
||||
DisplayLabel = 'Comerciales_MOVIL_1'
|
||||
DictionaryEntry = 'Comerciales_MOVIL_1'
|
||||
end
|
||||
item
|
||||
Name = 'MOVIL_2'
|
||||
DataType = datString
|
||||
Size = 25
|
||||
DisplayLabel = 'Comerciales_MOVIL_2'
|
||||
DictionaryEntry = 'Comerciales_MOVIL_2'
|
||||
end
|
||||
item
|
||||
Name = 'FAX'
|
||||
DataType = datString
|
||||
Size = 25
|
||||
DisplayLabel = 'Comerciales_FAX'
|
||||
DictionaryEntry = 'Comerciales_FAX'
|
||||
end
|
||||
item
|
||||
Name = 'EMAIL_1'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Comerciales_EMAIL_1'
|
||||
DictionaryEntry = 'Comerciales_EMAIL_1'
|
||||
end
|
||||
item
|
||||
Name = 'EMAIL_2'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Comerciales_EMAIL_2'
|
||||
DictionaryEntry = 'Comerciales_EMAIL_2'
|
||||
end
|
||||
item
|
||||
Name = 'PAGINA_WEB'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Comerciales_PAGINA_WEB'
|
||||
DictionaryEntry = 'Comerciales_PAGINA_WEB'
|
||||
end
|
||||
item
|
||||
Name = 'NOTAS'
|
||||
DataType = datMemo
|
||||
DisplayLabel = 'Comerciales_NOTAS'
|
||||
DictionaryEntry = 'Comerciales_NOTAS'
|
||||
end
|
||||
item
|
||||
Name = 'FECHA_ALTA'
|
||||
DataType = datDateTime
|
||||
DisplayLabel = 'Comerciales_FECHA_ALTA'
|
||||
DictionaryEntry = 'Comerciales_FECHA_ALTA'
|
||||
end
|
||||
item
|
||||
Name = 'FECHA_MODIFICACION'
|
||||
DataType = datDateTime
|
||||
DisplayLabel = 'Comerciales_FECHA_MODIFICACION'
|
||||
DictionaryEntry = 'Comerciales_FECHA_MODIFICACION'
|
||||
end
|
||||
item
|
||||
Name = 'USUARIO'
|
||||
DataType = datString
|
||||
Size = 30
|
||||
DisplayLabel = 'Comerciales_USUARIO'
|
||||
DictionaryEntry = 'Comerciales_USUARIO'
|
||||
end
|
||||
item
|
||||
Name = 'ID_EMPRESA'
|
||||
DataType = datInteger
|
||||
DisplayLabel = 'Comerciales_ID_EMPRESA'
|
||||
DictionaryEntry = 'Comerciales_ID_EMPRESA'
|
||||
end
|
||||
item
|
||||
Name = 'REFERENCIA'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Comerciales_REFERENCIA'
|
||||
DictionaryEntry = 'Comerciales_REFERENCIA'
|
||||
end
|
||||
item
|
||||
Name = 'ID_TIENDA'
|
||||
DataType = datInteger
|
||||
DisplayLabel = 'Comerciales_ID_TIENDA'
|
||||
DictionaryEntry = 'Comerciales_ID_TIENDA'
|
||||
end
|
||||
item
|
||||
Name = 'TIENDA'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Comerciales_TIENDA'
|
||||
DictionaryEntry = 'Comerciales_TIENDA'
|
||||
end
|
||||
item
|
||||
Name = 'COMISION'
|
||||
DataType = datFloat
|
||||
DisplayLabel = 'Comerciales_COMISION'
|
||||
DictionaryEntry = 'Comerciales_COMISION'
|
||||
end
|
||||
item
|
||||
Name = 'DELEGACION'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
end>
|
||||
Params = <>
|
||||
StreamingOptions = [soDisableEventsWhileStreaming]
|
||||
RemoteDataAdapter = rda_Contactos
|
||||
LogicalName = 'Comerciales'
|
||||
IndexDefs = <>
|
||||
Left = 456
|
||||
Top = 224
|
||||
end
|
||||
object ds_Comerciales: TDADataSource
|
||||
DataSet = tbl_Comerciales.Dataset
|
||||
DataTable = tbl_Comerciales
|
||||
Left = 464
|
||||
Top = 160
|
||||
end
|
||||
end
|
||||
83
Source/Modulos/Contactos/Data/uDataModuleComerciales.pas
Normal file
83
Source/Modulos/Contactos/Data/uDataModuleComerciales.pas
Normal file
@ -0,0 +1,83 @@
|
||||
unit uDataModuleComerciales;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, uDataModuleContactos, DB, uDADataTable, uDAScriptingProvider,
|
||||
uDACDSDataTable, uDABINAdapter, uRORemoteService,
|
||||
uROClient, uROBinMessage, uROWinInetHttpChannel, uROTypes,
|
||||
uIDataModuleComerciales, uBizContactos, uDADesigntimeCall,
|
||||
uDAInterfaces, uDAMemDataTable, uDADataStreamer, uDABin2DataStreamer,
|
||||
uDARemoteDataAdapter;
|
||||
|
||||
type
|
||||
TDataModuleComerciales = class(TDataModuleContactos, IDataModuleComerciales)
|
||||
tbl_Comerciales: TDAMemDataTable;
|
||||
ds_Comerciales: TDADataSource;
|
||||
public
|
||||
function GetItem(const ID : Integer) : IBizComercial;
|
||||
function NewItem : IBizComercial;
|
||||
function GetItems : IBizComercial;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
uses
|
||||
FactuGES_Intf, cxControls, schContactosClient_Intf, uDataTableUtils;
|
||||
|
||||
{ TDataModuleComerciales }
|
||||
|
||||
function TDataModuleComerciales.GetItem(const ID: Integer): IBizComercial;
|
||||
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 TDataModuleComerciales.GetItems: IBizComercial;
|
||||
var
|
||||
AContacto : TDAMemDataTable;
|
||||
begin
|
||||
ShowHourglassCursor;
|
||||
try
|
||||
AContacto := CloneDataTable(tbl_Comerciales);
|
||||
AContacto.BusinessRulesID := BIZ_CLIENT_COMERCIAL;
|
||||
|
||||
with TBizComercial(AContacto.BusinessEventsObj) do
|
||||
begin
|
||||
DatosBancarios := _GetDatosBancarios;
|
||||
end;
|
||||
|
||||
Result := (AContacto as IBizComercial);
|
||||
finally
|
||||
HideHourglassCursor;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TDataModuleComerciales.NewItem: IBizComercial;
|
||||
begin
|
||||
Result := GetItem(ID_NULO)
|
||||
end;
|
||||
|
||||
end.
|
||||
204
Source/Modulos/Contactos/Data/uDataModuleInstaladores.dfm
Normal file
204
Source/Modulos/Contactos/Data/uDataModuleInstaladores.dfm
Normal file
@ -0,0 +1,204 @@
|
||||
inherited DataModuleInstaladores: TDataModuleInstaladores
|
||||
inherited ds_Contactos: TDADataSource
|
||||
DataSet = tbl_Contactos.Dataset
|
||||
end
|
||||
inherited ds_DireccionesContacto: TDADataSource
|
||||
DataSet = tbl_DireccionesContacto.Dataset
|
||||
end
|
||||
inherited ds_DatosBancarios: TDADataSource
|
||||
DataSet = tbl_DatosBancarios.Dataset
|
||||
end
|
||||
inherited ds_PersonalContacto: TDADataSource
|
||||
DataSet = tbl_PersonalContacto.Dataset
|
||||
end
|
||||
inherited ds_ContactosDirecciones: TDADataSource
|
||||
DataSet = tbl_ContactosDirecciones.Dataset
|
||||
end
|
||||
object tbl_Instaladores: TDAMemDataTable
|
||||
RemoteUpdatesOptions = []
|
||||
Fields = <
|
||||
item
|
||||
Name = 'ID'
|
||||
DataType = datAutoInc
|
||||
GeneratorName = 'GEN_CONTACTOS_ID'
|
||||
ServerAutoRefresh = True
|
||||
DictionaryEntry = 'Instaladores_ID'
|
||||
InPrimaryKey = True
|
||||
end
|
||||
item
|
||||
Name = 'ID_CATEGORIA'
|
||||
DataType = datInteger
|
||||
DisplayLabel = 'Instaladores_ID_CATEGORIA'
|
||||
DictionaryEntry = 'Instaladores_ID_CATEGORIA'
|
||||
end
|
||||
item
|
||||
Name = 'NIF_CIF'
|
||||
DataType = datString
|
||||
Size = 15
|
||||
DisplayLabel = 'Instaladores_NIF_CIF'
|
||||
DictionaryEntry = 'Instaladores_NIF_CIF'
|
||||
end
|
||||
item
|
||||
Name = 'NOMBRE'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Instaladores_NOMBRE'
|
||||
DictionaryEntry = 'Instaladores_NOMBRE'
|
||||
end
|
||||
item
|
||||
Name = 'PERSONA_CONTACTO'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Instaladores_PERSONA_CONTACTO'
|
||||
DictionaryEntry = 'Instaladores_PERSONA_CONTACTO'
|
||||
end
|
||||
item
|
||||
Name = 'CALLE'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Instaladores_CALLE'
|
||||
DictionaryEntry = 'Instaladores_CALLE'
|
||||
end
|
||||
item
|
||||
Name = 'POBLACION'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Instaladores_POBLACION'
|
||||
DictionaryEntry = 'Instaladores_POBLACION'
|
||||
end
|
||||
item
|
||||
Name = 'PROVINCIA'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Instaladores_PROVINCIA'
|
||||
DictionaryEntry = 'Instaladores_PROVINCIA'
|
||||
end
|
||||
item
|
||||
Name = 'CODIGO_POSTAL'
|
||||
DataType = datString
|
||||
Size = 10
|
||||
DisplayLabel = 'Instaladores_CODIGO_POSTAL'
|
||||
DictionaryEntry = 'Instaladores_CODIGO_POSTAL'
|
||||
end
|
||||
item
|
||||
Name = 'TELEFONO_1'
|
||||
DataType = datString
|
||||
Size = 25
|
||||
DisplayLabel = 'Instaladores_TELEFONO_1'
|
||||
DictionaryEntry = 'Instaladores_TELEFONO_1'
|
||||
end
|
||||
item
|
||||
Name = 'TELEFONO_2'
|
||||
DataType = datString
|
||||
Size = 25
|
||||
DisplayLabel = 'Instaladores_TELEFONO_2'
|
||||
DictionaryEntry = 'Instaladores_TELEFONO_2'
|
||||
end
|
||||
item
|
||||
Name = 'MOVIL_1'
|
||||
DataType = datString
|
||||
Size = 25
|
||||
DisplayLabel = 'Instaladores_MOVIL_1'
|
||||
DictionaryEntry = 'Instaladores_MOVIL_1'
|
||||
end
|
||||
item
|
||||
Name = 'MOVIL_2'
|
||||
DataType = datString
|
||||
Size = 25
|
||||
DisplayLabel = 'Instaladores_MOVIL_2'
|
||||
DictionaryEntry = 'Instaladores_MOVIL_2'
|
||||
end
|
||||
item
|
||||
Name = 'FAX'
|
||||
DataType = datString
|
||||
Size = 25
|
||||
DisplayLabel = 'Instaladores_FAX'
|
||||
DictionaryEntry = 'Instaladores_FAX'
|
||||
end
|
||||
item
|
||||
Name = 'EMAIL_1'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Instaladores_EMAIL_1'
|
||||
DictionaryEntry = 'Instaladores_EMAIL_1'
|
||||
end
|
||||
item
|
||||
Name = 'EMAIL_2'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Instaladores_EMAIL_2'
|
||||
DictionaryEntry = 'Instaladores_EMAIL_2'
|
||||
end
|
||||
item
|
||||
Name = 'PAGINA_WEB'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Instaladores_PAGINA_WEB'
|
||||
DictionaryEntry = 'Instaladores_PAGINA_WEB'
|
||||
end
|
||||
item
|
||||
Name = 'NOTAS'
|
||||
DataType = datMemo
|
||||
DisplayLabel = 'Instaladores_NOTAS'
|
||||
DictionaryEntry = 'Instaladores_NOTAS'
|
||||
end
|
||||
item
|
||||
Name = 'FECHA_ALTA'
|
||||
DataType = datDateTime
|
||||
DisplayLabel = 'Instaladores_FECHA_ALTA'
|
||||
DictionaryEntry = 'Instaladores_FECHA_ALTA'
|
||||
end
|
||||
item
|
||||
Name = 'FECHA_MODIFICACION'
|
||||
DataType = datDateTime
|
||||
DisplayLabel = 'Instaladores_FECHA_MODIFICACION'
|
||||
DictionaryEntry = 'Instaladores_FECHA_MODIFICACION'
|
||||
end
|
||||
item
|
||||
Name = 'USUARIO'
|
||||
DataType = datString
|
||||
Size = 30
|
||||
DisplayLabel = 'Instaladores_USUARIO'
|
||||
DictionaryEntry = 'Instaladores_USUARIO'
|
||||
end
|
||||
item
|
||||
Name = 'ID_EMPRESA'
|
||||
DataType = datInteger
|
||||
DisplayLabel = 'Instaladores_ID_EMPRESA'
|
||||
DictionaryEntry = 'Instaladores_ID_EMPRESA'
|
||||
end
|
||||
item
|
||||
Name = 'REFERENCIA'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Instaladores_REFERENCIA'
|
||||
DictionaryEntry = 'Instaladores_REFERENCIA'
|
||||
end
|
||||
item
|
||||
Name = 'ID_TIENDA'
|
||||
DataType = datInteger
|
||||
DisplayLabel = 'Instaladores_ID_TIENDA'
|
||||
DictionaryEntry = 'Instaladores_ID_TIENDA'
|
||||
end
|
||||
item
|
||||
Name = 'TIENDA'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
DisplayLabel = 'Instaladores_TIENDA'
|
||||
DictionaryEntry = 'Instaladores_TIENDA'
|
||||
end>
|
||||
Params = <>
|
||||
StreamingOptions = [soDisableEventsWhileStreaming]
|
||||
RemoteDataAdapter = rda_Contactos
|
||||
LogicalName = 'Instaladores'
|
||||
IndexDefs = <>
|
||||
Left = 456
|
||||
Top = 216
|
||||
end
|
||||
object ds_Instaladores: TDADataSource
|
||||
DataSet = tbl_Instaladores.Dataset
|
||||
DataTable = tbl_Instaladores
|
||||
Left = 448
|
||||
Top = 144
|
||||
end
|
||||
end
|
||||
83
Source/Modulos/Contactos/Data/uDataModuleInstaladores.pas
Normal file
83
Source/Modulos/Contactos/Data/uDataModuleInstaladores.pas
Normal file
@ -0,0 +1,83 @@
|
||||
unit uDataModuleInstaladores;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, uDataModuleContactos, DB, uDADataTable, uDAScriptingProvider,
|
||||
uDACDSDataTable, uDABINAdapter, uRORemoteService,
|
||||
uROClient, uROBinMessage, uROWinInetHttpChannel, uROTypes,
|
||||
uIDataModuleInstaladores, uBizContactos, uDADesigntimeCall,
|
||||
uDAInterfaces, uDAMemDataTable, uDADataStreamer, uDABin2DataStreamer,
|
||||
uDARemoteDataAdapter;
|
||||
|
||||
type
|
||||
TDataModuleInstaladores = class(TDataModuleContactos, IDataModuleInstaladores)
|
||||
tbl_Instaladores: TDAMemDataTable;
|
||||
ds_Instaladores: TDADataSource;
|
||||
public
|
||||
function GetItem(const ID : Integer) : IBizInstalador;
|
||||
function NewItem : IBizInstalador;
|
||||
function GetItems : IBizInstalador;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
uses
|
||||
FactuGES_Intf, cxControls, schContactosClient_Intf, uDataTableUtils;
|
||||
|
||||
{ TDataModuleInstaladores }
|
||||
|
||||
function TDataModuleInstaladores.GetItem(const ID: Integer): IBizInstalador;
|
||||
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 TDataModuleInstaladores.GetItems: IBizInstalador;
|
||||
var
|
||||
AContacto : TDAMemDataTable;
|
||||
begin
|
||||
ShowHourglassCursor;
|
||||
try
|
||||
AContacto := CloneDataTable(tbl_Instaladores);
|
||||
AContacto.BusinessRulesID := BIZ_CLIENT_Instalador;
|
||||
|
||||
with TBizInstalador(AContacto.BusinessEventsObj) do
|
||||
begin
|
||||
DatosBancarios := _GetDatosBancarios;
|
||||
end;
|
||||
|
||||
Result := (AContacto as IBizInstalador);
|
||||
finally
|
||||
HideHourglassCursor;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TDataModuleInstaladores.NewItem: IBizInstalador;
|
||||
begin
|
||||
Result := GetItem(ID_NULO)
|
||||
end;
|
||||
|
||||
end.
|
||||
@ -0,0 +1,19 @@
|
||||
unit uIDataModuleComerciales;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
uBizContactos, uIDataModuleContactos;
|
||||
|
||||
type
|
||||
IDataModuleComerciales = interface(IDataModuleContactos)
|
||||
['{C9CEA27B-106A-4864-A401-B0896CED0D38}']
|
||||
function GetItem(const ID : Integer) : IBizComercial;
|
||||
function NewItem : IBizComercial;
|
||||
function GetItems : IBizComercial;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
@ -0,0 +1,19 @@
|
||||
unit uIDataModuleInstaladores;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
uBizContactos, uIDataModuleContactos;
|
||||
|
||||
type
|
||||
IDataModuleInstaladores = interface(IDataModuleContactos)
|
||||
['{4F1A2F9B-CD77-4AF6-B301-EDE6ABDDA9D8}']
|
||||
function GetItem(const ID : Integer) : IBizInstalador;
|
||||
function NewItem : IBizInstalador;
|
||||
function GetItems : IBizInstalador;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
104
Source/Modulos/Contactos/Model/uBizComercialesServer.pas
Normal file
104
Source/Modulos/Contactos/Model/uBizComercialesServer.pas
Normal file
@ -0,0 +1,104 @@
|
||||
unit uBizComercialesServer;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
schContactosServer_Intf, uDAInterfaces, uDADelta,
|
||||
uDADataTable, uDABusinessProcessor, uBizContactosServer;
|
||||
|
||||
const
|
||||
BIZ_SERVER_COMERCIAL = 'Server.Comercial';
|
||||
|
||||
type
|
||||
TBizComercialServer = class(TBizContactosServer)
|
||||
protected
|
||||
procedure Insert_Datos_Contacto(aChange: TDADeltaChange); override;
|
||||
procedure Update_Datos_Contacto(aChange: TDADeltaChange); override;
|
||||
procedure Delete_Datos_Contacto(aChange: TDADeltaChange); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
uDataModuleServer, uDAClasses,
|
||||
schContactosClient_Intf, uBusinessUtils;
|
||||
|
||||
{ TBizComercialServer }
|
||||
|
||||
procedure TBizComercialServer.Delete_Datos_Contacto(aChange: TDADeltaChange);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
begin
|
||||
inherited;
|
||||
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
ACommand := ASchema.NewCommand(ACurrentConn, 'Delete_ComercialesDatos');
|
||||
try
|
||||
with ACommand do
|
||||
begin
|
||||
ParamByName('OLD_ID_COMERCIAL').Value := aChange.OldValueByName[fld_ComercialesID];
|
||||
Execute;
|
||||
end;
|
||||
finally
|
||||
ACommand := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBizComercialServer.Insert_Datos_Contacto(aChange: TDADeltaChange);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
begin
|
||||
inherited;
|
||||
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
ACommand := ASchema.NewCommand(ACurrentConn, 'Insert_ComercialesDatos');
|
||||
try
|
||||
with ACommand do
|
||||
begin
|
||||
ParamByName('ID_COMERCIAL').Value := aChange.NewValueByName[fld_ComercialesID];
|
||||
ParamByName('COMISION').Value := aChange.NewValueByName[fld_ComercialesCOMISION];
|
||||
ParamByName('DELEGACION').Value := aChange.NewValueByName[fld_ComercialesDELEGACION];
|
||||
Execute;
|
||||
end;
|
||||
finally
|
||||
ACommand := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBizComercialServer.Update_Datos_Contacto(aChange: TDADeltaChange);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
begin
|
||||
inherited;
|
||||
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
ACommand := ASchema.NewCommand(ACurrentConn, 'Update_ComercialesDatos');
|
||||
try
|
||||
with ACommand do
|
||||
begin
|
||||
ParamByName('OLD_ID_COMERCIAL').Value := aChange.OldValueByName[fld_ComercialesID];
|
||||
ParamByName('COMISION').Value := aChange.NewValueByName[fld_ComercialesCOMISION];
|
||||
ParamByName('DELEGACION').Value := aChange.NewValueByName[fld_ComercialesDELEGACION];
|
||||
Execute;
|
||||
end;
|
||||
finally
|
||||
ACommand := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(BIZ_SERVER_Comercial, TBizComercialServer);
|
||||
|
||||
end.
|
||||
107
Source/Modulos/Contactos/Model/uBizInstaladoresServer.pas
Normal file
107
Source/Modulos/Contactos/Model/uBizInstaladoresServer.pas
Normal file
@ -0,0 +1,107 @@
|
||||
unit uBizInstaladoresServer;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
schContactosServer_Intf, uDAInterfaces, uDADelta,
|
||||
uDADataTable, uDABusinessProcessor, uBizContactosServer;
|
||||
|
||||
const
|
||||
BIZ_SERVER_INSTALADOR = 'Server.Instalador';
|
||||
|
||||
type
|
||||
TBizInstaladorServer = class(TBizContactosServer)
|
||||
protected
|
||||
procedure Insert_Datos_Contacto(aChange: TDADeltaChange); override;
|
||||
procedure Update_Datos_Contacto(aChange: TDADeltaChange); override;
|
||||
procedure Delete_Datos_Contacto(aChange: TDADeltaChange); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
uDataModuleServer, uDAClasses,
|
||||
schContactosClient_Intf, uBusinessUtils;
|
||||
|
||||
{ TBizInstaladorServer }
|
||||
|
||||
procedure TBizInstaladorServer.Delete_Datos_Contacto(aChange: TDADeltaChange);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
begin
|
||||
inherited;
|
||||
{
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
ACommand := ASchema.NewCommand(ACurrentConn, 'Delete_InstaladoresDatos');
|
||||
try
|
||||
with ACommand do
|
||||
begin
|
||||
ParamByName('OLD_ID_Instalador').Value := aChange.OldValueByName[fld_InstaladoresID];
|
||||
Execute;
|
||||
end;
|
||||
finally
|
||||
ACommand := NIL;
|
||||
end;
|
||||
}
|
||||
end;
|
||||
|
||||
procedure TBizInstaladorServer.Insert_Datos_Contacto(aChange: TDADeltaChange);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
begin
|
||||
inherited;
|
||||
{
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
ACommand := ASchema.NewCommand(ACurrentConn, 'Insert_InstaladoresDatos');
|
||||
try
|
||||
with ACommand do
|
||||
begin
|
||||
ParamByName('ID_Instalador').Value := aChange.NewValueByName[fld_InstaladoresID];
|
||||
ParamByName('ID_USUARIO').Value := aChange.NewValueByName[fld_InstaladoresID_USUARIO];
|
||||
ParamByName('COMISION').Value := aChange.NewValueByName[fld_InstaladoresCOMISION];
|
||||
Execute;
|
||||
end;
|
||||
finally
|
||||
ACommand := NIL;
|
||||
end;
|
||||
}
|
||||
end;
|
||||
|
||||
procedure TBizInstaladorServer.Update_Datos_Contacto(aChange: TDADeltaChange);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
begin
|
||||
inherited;
|
||||
{
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
ACommand := ASchema.NewCommand(ACurrentConn, 'Update_InstaladoresDatos');
|
||||
try
|
||||
with ACommand do
|
||||
begin
|
||||
ParamByName('OLD_ID_Instalador').Value := aChange.OldValueByName[fld_InstaladoresID];
|
||||
ParamByName('ID_USUARIO').Value := aChange.NewValueByName[fld_InstaladoresID_USUARIO];
|
||||
ParamByName('COMISION').Value := aChange.NewValueByName[fld_InstaladoresCOMISION];
|
||||
Execute;
|
||||
end;
|
||||
finally
|
||||
ACommand := NIL;
|
||||
end;
|
||||
}
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(BIZ_SERVER_INSTALADOR, TBizInstaladorServer);
|
||||
|
||||
end.
|
||||
Loading…
Reference in New Issue
Block a user