diff --git a/Source/Modulos/Contactos/Controller/uClientesController.pas b/Source/Modulos/Contactos/Controller/uClientesController.pas
deleted file mode 100644
index a46d9a3..0000000
--- a/Source/Modulos/Contactos/Controller/uClientesController.pas
+++ /dev/null
@@ -1,537 +0,0 @@
-unit uClientesController;
-
-interface
-
-uses
- uCustomEditor, Classes,
- uContactosController, uBizContactos, uBizDireccionesContacto,
- uIEditorClientes, uIEditorCliente, uIDataModuleContactos, uIDataModuleClientes,
- uDireccionesContactoController, uBizContactosPersonal;
-
-type
- IClientesController = interface(IContactosController)
- ['{AAC3C51A-37F7-4961-B39F-FBC6B6A2B0F1}']
- function BuscarTodosTiendaWeb: IBizCliente;
- function BuscarEtiquetadosFelicitacion: IBizCliente;
- function TieneDatosBancarios(ACliente: IBizCliente) : Boolean;
- function ElegirDireccionEntrega(ACliente: IBizCliente; AMensaje: String): IBizDireccionesContacto;
- function EsEliminable(ACliente: IBizContacto): Boolean;
- function Eliminar(ACliente: IBizContacto; AllItems: Boolean = false): Boolean; overload;
- procedure Preview(ACliente : IBizCliente; AllItems: Boolean = false);
- procedure Print(ACliente : IBizCliente; AllItems: Boolean = false);
- procedure VerPresupuestosDeCliente(ACliente : IBizCliente);
- procedure VerAlbaranesDeCliente(ACliente : IBizCliente);
- procedure VerFacturasDeCliente(ACliente : IBizCliente);
- procedure VerRecibosDeCliente(ACliente : IBizCliente);
- function DarListaCuentasBancarias(const IdCliente: Integer): TStringList;
- end;
-
- TClientesController = class(TContactosController, IClientesController)
- protected
- FDireccionesController : IDireccionesContactoController;
- function ValidarContacto(AContacto: IBizContacto): Boolean; override;
- public
- constructor Create; override;
- destructor Destroy; override;
-
- function Duplicar(AContacto: IBizContacto): IBizContacto; override;
-
- function Buscar(const ID: Integer): IBizContacto; override;
- function BuscarTodos: IBizContacto; override;
- function BuscarTodosTiendaWeb: IBizCliente;
- function BuscarEtiquetadosFelicitacion: IBizCliente;
- 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 TieneDatosBancarios(ACliente: IBizCliente) : Boolean;
- function ElegirDireccionEntrega(ACliente: IBizCliente;
- AMensaje: String): IBizDireccionesContacto;
- function EsEliminable(ACliente: IBizContacto): Boolean;
- function Eliminar(ACliente: IBizContacto; AllItems: Boolean = false): Boolean; overload;
- procedure Preview(ACliente : IBizCliente; AllItems: Boolean = false);
- procedure Print(ACliente : IBizCliente; AllItems: Boolean = false);
- procedure VerPresupuestosDeCliente(ACliente : IBizCliente);
- procedure VerAlbaranesDeCliente(ACliente : IBizCliente);
- procedure VerFacturasDeCliente(ACliente : IBizCliente);
- procedure VerRecibosDeCliente(ACliente : IBizCliente);
- function DarListaCuentasBancarias(const IdCliente: Integer): TStringList;
- end;
-
-implementation
-
-uses
- Forms, Windows, SysUtils, Controls, cxControls, uDialogUtils, uDataModuleClientes, uEditorRegistryUtils,
- uDataTableUtils, uDADataTable, DB, schContactosClient_Intf, uEtiquetasContactosReportController,
- uIEditorElegirClientes, uIEditorElegirDireccionEntrega, uEditorGridBase, uModuleController,
- Dialogs, uIntegerListUtils, uFactuGES_App,
- uPlugins_Intf;
-
-{ TClientesController }
-
-function TClientesController.Buscar(const ID: Integer): IBizContacto;
-begin
- Result := (FDataModule as IDataModuleClientes).GetItem(ID);
- FiltrarEmpresa(Result);
-end;
-
-function TClientesController.BuscarEtiquetadosFelicitacion: IBizCliente;
-begin
- Result := (FDataModule as IDataModuleClientes).GetItemsFelicitacion;
- FiltrarEmpresa(Result);
-end;
-
-function TClientesController.BuscarTodos: IBizContacto;
-begin
- Result := (FDataModule as IDataModuleClientes).GetItems;
- FiltrarEmpresa(Result);
-end;
-
-function TClientesController.BuscarTodosTiendaWeb: IBizCliente;
-begin
- Result := (FDataModule as IDataModuleClientes).GetItemsTiendaWeb;
- FiltrarEmpresa(Result);
-end;
-
-constructor TClientesController.Create;
-begin
- inherited;
- FDataModule := TDataModuleClientes.Create(Nil);
- FDireccionesController := TDireccionesContactoController.Create;
-end;
-
-function TClientesController.DarListaCuentasBancarias(const IdCliente: Integer): TStringList;
-var
- ACliente: IBizCliente;
- Aux : String;
-
-begin
- ACliente := (Buscar(IdCliente) as IBizCliente);
- ACliente.DataTable.Active := True;
-
- Result := TStringList.Create;
- ShowHourglassCursor;
- try
- with Result do
- begin
- ACliente.DatosBancarios.DataTable.First;
- while not ACliente.DatosBancarios.DataTable.EOF do
- begin
- Aux := Format('Nº de cuenta: %s %s %s %s - Titular: %s ', [ACliente.DatosBancarios.ENTIDAD,
- ACliente.DatosBancarios.SUCURSAL, ACliente.DatosBancarios.DC, ACliente.DatosBancarios.CUENTA, ACliente.DatosBancarios.TITULAR]);
- Add(Format('%s=%d', [Aux, ACliente.DatosBancarios.ID]));
- ACliente.DatosBancarios.DataTable.Next;
- end;
- end;
- finally
- ACliente := NIL;
- HideHourglassCursor;
- end;
-end;
-
-destructor TClientesController.Destroy;
-begin
- FDireccionesController := NIL;
- inherited;
-end;
-
-function TClientesController.Duplicar(AContacto: IBizContacto): IBizContacto;
-begin
- Result := inherited Duplicar(AContacto);
-
- if Assigned((Result as IBizCliente).Descuentos) then
- DuplicarRegistros((AContacto as IBizCliente).Descuentos.DataTable, (Result as IBizCliente).Descuentos.DataTable, mdrTodos);
-end;
-
-function TClientesController.ElegirContacto(AContactos : IBizContacto;
- AMensaje: String; AMultiSelect: Boolean): IBizContacto;
-var
- AEditor : IEditorElegirClientes;
-begin
- Result := NIL;
-
- CreateEditor('EditorElegirClientes', IEditorElegirClientes, AEditor);
- if Assigned(AEditor) then
- begin
- 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;
- Application.ProcessMessages;
- end;
- end;
-end;
-
-function TClientesController.ElegirDireccionEntrega(ACliente: IBizCliente;
- AMensaje: String): IBizDireccionesContacto;
-var
- AEditor : IEditorElegirDireccionEntrega;
-begin
- Result := NIL;
-
- CreateEditor('EditorElegirDireccionEntrega', IEditorElegirDireccionEntrega, AEditor);
- if Assigned(AEditor) then
- begin
- try
- AEditor.Contacto := ACliente;
- AEditor.Mensaje := AMensaje;
- if IsPositiveResult(AEditor.ShowModal) then
- Result := AEditor.DireccionSeleccionada;
- finally
- AEditor.Release;
- AEditor := NIL;
- Application.ProcessMessages;
- end;
- end;
-end;
-
-function TClientesController.Eliminar(ACliente: IBizContacto; AllItems: Boolean): Boolean;
-//En el caso de eliminar almenos un elemento del conjunto se devuelve true
-var
- bEliminado: Boolean;
-begin
- bEliminado := False;
-
- if not Assigned(ACliente) then
- raise Exception.Create ('Contacto no asignado');
-
- ShowHourglassCursor;
- try
- if not ACliente.DataTable.Active then
- ACliente.DataTable.Active := True;
-
- if (ACliente.State in dsEditModes) then
- ACliente.Cancel;
-
- //Siempre eliminaremos el seleccionado
- if EsEliminable(ACliente) then
- begin
- ACliente.Delete;
- bEliminado := True;
- end;
-
- //En el caso de querer eliminar todos los items del objeto ACliente
- if AllItems then
- begin
- with ACliente.DataTable do
- begin
- First;
- while not EOF do
- begin
- if EsEliminable(ACliente) then
- begin
- ACliente.Delete;
- bEliminado := True
- end
- else Next;
- end;
- end;
- end;
-
- if bEliminado then
- begin
- ACliente.DataTable.ApplyUpdates;
- Result := True;
- end
- else
- Result := False;
-
- HideHourglassCursor;
- except
- on E: Exception do
- begin
- ACliente.DataTable.CancelUpdates;
- HideHourglassCursor;
- if (Pos('FOREIGN KEY', E.Message) > 0) then
- MessageBox(0, 'No se pueden borrar el/los cliente/s seleccionado/s porque, alguno/s de ellos tiene documentos dados de alta en la aplicación (presupuestos, albaranes, facturas, etc)', 'Atención', MB_ICONWARNING or MB_OK);
- end;
- end;
-end;
-
-function TClientesController.EsEliminable(ACliente: IBizContacto): Boolean;
-begin
- if not Assigned(ACliente) then
- raise Exception.Create ('Contacto no asignado: EsEliminable');
-
- Result := True;
-end;
-
-function TClientesController.Nuevo: IBizContacto;
-var
- AContacto : IBizCliente;
-begin
- AContacto := (FDataModule as IDataModuleClientes).NewItem;
- FiltrarEmpresa(AContacto);
- AContacto.DataTable.Active := True;
- AContacto.Insert;
- Result := AContacto;
-end;
-
-procedure TClientesController.Preview(ACliente: IBizCliente; AllItems: Boolean);
-var
- AReportController : IEtiquetasContactosReportController;
- ListaID: TIntegerList;
-begin
- AReportController := TEtiquetasContactosReportController.Create;
- ListaID := TIntegerList.Create;
-
- if not Assigned(ACliente) then
- raise Exception.Create ('Cliente no asignado (TieneDatosBancarios)');
-
- if not ACliente.DataTable.Active then
- ACliente.DataTable.Active := True;
-
- try
- //Si deseamos previsualizar todos los items del objeto albaran
- if AllItems then
- begin
- with ACliente.DataTable do
- begin
- First;
- while not EOF do
- begin
- ListaID.Add(ACliente.ID);
- Next;
- end;
- end;
- end
- //Solo previsualizamos el item seleccionado
- else
- ListaID.Add(ACliente.ID);
-
- AReportController.Preview(ListaID);
- finally
- AReportController := NIL;
- FreeANDNIL(ListaID);
- end;
-end;
-
-procedure TClientesController.Print(ACliente: IBizCliente; AllItems: Boolean);
-var
- AReportController : IEtiquetasContactosReportController;
- ListaID: TIntegerList;
-
-begin
- AReportController := TEtiquetasContactosReportController.Create;
- ListaID := TIntegerList.Create;
-
- if not Assigned(ACliente) then
- raise Exception.Create ('Cliente no asignado (TieneDatosBancarios)');
-
- if not ACliente.DataTable.Active then
- ACliente.DataTable.Active := True;
-
- try
- //Si deseamos previsualizar todos los items del objeto albaran
- if AllItems then
- begin
- with ACliente.DataTable do
- begin
- First;
- while not EOF do
- begin
- ListaID.Add(ACliente.ID);
- Next;
- end;
- end;
- end
- //Solo previsualizamos el item seleccionado
- else
- ListaID.Add(ACliente.ID);
-
- AReportController.Print(ListaID);
-
- finally
- AReportController := NIL;
- FreeANDNil(ListaID);
- end;
-end;
-
-function TClientesController.TieneDatosBancarios(
- ACliente: IBizCliente): Boolean;
-begin
- if not Assigned(ACliente) then
- raise Exception.Create ('Cliente no asignado (TieneDatosBancarios)');
-
- if not ACliente.DataTable.Active then
- ACliente.DataTable.Active := True;
-
- with ACliente.DatosBancarios do
- begin
- Result := (DataTable.RecordCount > 0) and
- (
- (Length(ENTIDAD) > 0) and
- (Length(SUCURSAL) > 0) and
- (Length(DC) > 0) and
- (Length(CUENTA) > 0)
- );
- end;
-end;
-
-function TClientesController.ValidarContacto(AContacto: IBizContacto): Boolean;
-begin
- Result := inherited ValidarContacto(AContacto);
- if Result then
- begin
- with (AContacto as IBizCliente) do
- begin
- if (BLOQUEADO = 0) then
- begin
- Edit;
- MOTIVO_BLOQUEO := '';
- Post;
- end;
-
- if (TIENDA_WEB = 1) and (Length(EMAIL_1) = 0) then
- begin
- {ShowWarningMessage('Acceso a la tienda web',
- 'Para que el cliente pueda tener acceso a la tienda web es necesario indicar una dirección de e-mail en el campo ''Correo de trabajo''' +
- #10#13 + #10#13 +
- 'Por favor, indique una dirección o desactive el acceso a la tienda.');
- Result := False;}
- raise Exception.Create('Para que el cliente pueda tener acceso a la tienda web es necesario indicar una dirección de e-mail en el campo ''Correo de trabajo''' +
- #10#13 + #10#13 +
- 'Por favor, indique una dirección o desactive el acceso a la tienda.');
- end;
- end;
-
- {
- // Por ahora no existe el concepto de direcciones de entrega asi que esto está desactivado
- if Result and (AContacto.Direcciones.RecordCount = 0) then
- if (ShowConfirmMessage('El cliente no tiene direcciones asociadas',
- AContacto.NOMBRE + ' no tiene ninguna dirección de envío dada de alta, ' + #10#13 +
- '¿Desea utilizar el domicilio fiscal para dar de alta una dirección de entrega?') = IDYES) then
- begin
- FDireccionesController.CopiarDireccionFiscal(AContacto, AContacto.Direcciones);
- FDireccionesController.Ver(AContacto.Direcciones);
- end;}
- end;
-end;
-
-procedure TClientesController.Ver(AContacto: IBizContacto);
-var
- AEditor : IEditorCliente;
-begin
- AEditor := NIL;
-
- CreateEditor('EditorCliente', IEditorCliente, AEditor);
- if Assigned(AEditor) then
- try
- AEditor.Contacto := AContacto;
- AEditor.Controller := Self;
- AEditor.ShowModal;
- finally
- AEditor.Release;
- AEditor := NIL;
- end;
-end;
-
-procedure TClientesController.VerAlbaranesDeCliente(ACliente: IBizCliente);
-var
- AModule : TModuleController;
- APlugin : IMCAlbaranesCliente;
-begin
- if not Assigned(ACliente) then
- raise Exception.Create ('Cliente no asignado (VerAlbaranesDeCliente)');
-
- if not ACliente.DataTable.Active then
- ACliente.DataTable.Active := True;
-
- AModule := AppFactuGES.GetModule(MODULENAME_ALBARANES_CLIENTE);
- if Assigned(AModule) then
- try
- if Supports(AModule, IMCAlbaranesCliente, APlugin) then
- APlugin.VerAlbaranes(ACliente.ID, ACliente.NOMBRE);
- finally
- APlugin := NIL;
- end;
-end;
-
-procedure TClientesController.VerFacturasDeCliente(ACliente: IBizCliente);
-var
- AModule : TModuleController;
- APlugin : IMCFacturasCliente;
-begin
- if not Assigned(ACliente) then
- raise Exception.Create ('Cliente no asignado (VerFacturasDeCliente)');
-
- if not ACliente.DataTable.Active then
- ACliente.DataTable.Active := True;
-
- AModule := AppFactuGES.GetModule(MODULENAME_FACTURAS_CLIENTE);
- if Assigned(AModule) then
- try
- if Supports(AModule, IMCFacturasCliente, APlugin) then
- APlugin.VerFacturas(ACliente.ID, ACliente.NOMBRE);
- finally
- APlugin := NIL;
- end;
-end;
-
-procedure TClientesController.VerPresupuestosDeCliente(ACliente : IBizCliente);
-var
- AModule : TModuleController;
- APlugin : IMCPresupuestosCliente;
-begin
- if not Assigned(ACliente) then
- raise Exception.Create ('Cliente no asignado (VerPresupuestosDeCliente)');
-
- if not ACliente.DataTable.Active then
- ACliente.DataTable.Active := True;
-
- AModule := AppFactuGES.GetModule(MODULENAME_PRESUPUESTOS_CLIENTE);
- if Assigned(AModule) then
- try
- if Supports(AModule, IMCPresupuestosCliente, APlugin) then
- APlugin.VerPresupuestos(ACliente.ID, ACliente.NOMBRE);
- finally
- APlugin := NIL;
- end;
-end;
-
-procedure TClientesController.VerRecibosDeCliente(ACliente: IBizCliente);
-var
- AModule : TModuleController;
- APlugin : IMCRecibosCliente;
-begin
- if not Assigned(ACliente) then
- raise Exception.Create ('Cliente no asignado (VerFacturasDeCliente)');
-
- if not ACliente.DataTable.Active then
- ACliente.DataTable.Active := True;
-
- AModule := AppFactuGES.GetModule(MODULENAME_RECIBOS_CLIENTE);
- if Assigned(AModule) then
- try
- if Supports(AModule, IMCRecibosCliente, APlugin) then
- APlugin.VerRecibos(ACliente.ID, ACliente.NOMBRE);
- finally
- APlugin := NIL;
- end;
-end;
-
-procedure TClientesController.VerTodos(AContactos: IBizContacto);
-var
- AEditor : IEditorClientes;
-begin
- AEditor := NIL;
-
- CreateEditor('EditorClientes', IEditorClientes, AEditor);
- if Assigned(AEditor) then
- with AEditor do
- begin
- Contactos := AContactos;
- Controller := Self;
- MultiSelect := True;
- ShowEmbedded;
- end;
-end;
-
-end.
diff --git a/Source/Modulos/Contactos/Controller/uPacientesController.pas b/Source/Modulos/Contactos/Controller/uPacientesController.pas
index df2e8fe..ed1b60d 100644
--- a/Source/Modulos/Contactos/Controller/uPacientesController.pas
+++ b/Source/Modulos/Contactos/Controller/uPacientesController.pas
@@ -183,7 +183,7 @@ begin
AReportController := TFichasPacienteReportController.Create;
ID_Fichas := TIntegerList.Create;
try
- //Si deseamos previsualizar todos los items del objeto albaran
+ //Si deseamos previsualizar todos los items del objeto
if AllItems then
begin
with APaciente.DataTable do
@@ -217,7 +217,7 @@ begin
ID_Fichas := TIntegerList.Create;
try
- //Si deseamos previsualizar todos los items del objeto albaran
+ //Si deseamos previsualizar todos los items del objeto
if AllItems then
begin
with APaciente.DataTable do
diff --git a/Source/Modulos/Contactos/Controller/uProveedoresController.pas b/Source/Modulos/Contactos/Controller/uProveedoresController.pas
deleted file mode 100644
index efd1c22..0000000
--- a/Source/Modulos/Contactos/Controller/uProveedoresController.pas
+++ /dev/null
@@ -1,488 +0,0 @@
-unit uProveedoresController;
-
-interface
-
-uses
- Classes, uCustomEditor, uContactosController, uBizContactos,
- uBizDireccionesContacto, uDireccionesContactoController,
- uIEditorProveedores, uIEditorProveedor, uIDataModuleContactos,
- uIDataModuleProveedores;
-
-type
- IProveedoresController = interface(IContactosController)
- ['{50F10D01-5120-470D-A61D-99FE8A76DF93}']
- function BuscarSubcontratas: IBizProveedor;
- function BuscarTodosTiendaWeb: IBizProveedor;
- function ElegirDireccionEntrega(AProveedor: IBizProveedor; AMensaje: String): IBizDireccionesContacto;
- function EsEliminable(AProveedor: IBizContacto): Boolean;
- function Eliminar(AProveedor: IBizContacto; AllItems: Boolean = false): Boolean; overload;
- procedure Preview(AProveedor : IBizProveedor; AllItems: Boolean = false);
- procedure Print(AProveedor : IBizProveedor; AllItems: Boolean = false);
- function DarListaDescripcionesProveedores: TStringList;
- procedure VerPedidosDeProveedor(AProveedor : IBizProveedor);
- procedure VerAlbaranesDeProveedor(AProveedor : IBizProveedor);
- procedure VerDevolucionesDeProveedor(AProveedor : IBizProveedor);
- procedure VerFacturasDeProveedor(AProveedor : IBizProveedor);
- procedure VerRecibosDeProveedor(AProveedor : IBizProveedor);
- function DarListaCuentasBancarias(const IdProveedor: Integer): TStringList;
- end;
-
- TProveedoresController = class(TContactosController, IProveedoresController)
- protected
- FDireccionesController : IDireccionesContactoController;
- public
- constructor Create; override;
- destructor Destroy; override;
-
- function Buscar(const ID: Integer): IBizContacto; override;
- function BuscarTodos: IBizContacto; override;
- function BuscarTodosTiendaWeb: IBizProveedor;
- function BuscarSubcontratas: IBizProveedor;
- 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 ElegirDireccionEntrega(AProveedor: IBizProveedor;
- AMensaje: String): IBizDireccionesContacto;
- function EsEliminable(AProveedor: IBizContacto): Boolean;
- function Eliminar(AProveedor: IBizContacto; AllItems: Boolean = false): Boolean; overload;
- procedure Preview(AProveedor : IBizProveedor; AllItems: Boolean = false);
- procedure Print(AProveedor : IBizProveedor; AllItems: Boolean = false);
- function DarListaDescripcionesProveedores: TStringList;
- procedure VerPedidosDeProveedor(AProveedor : IBizProveedor);
- procedure VerAlbaranesDeProveedor(AProveedor : IBizProveedor);
- procedure VerDevolucionesDeProveedor(AProveedor : IBizProveedor);
- procedure VerFacturasDeProveedor(AProveedor : IBizProveedor);
- procedure VerRecibosDeProveedor(AProveedor : IBizProveedor);
- function DarListaCuentasBancarias(const IdProveedor: Integer): TStringList;
- end;
-
-implementation
-
-uses
- SysUtils, Windows, cxControls, Dialogs, uDataModuleProveedores, uEditorRegistryUtils,
- uDataTableUtils, uDADataTable, DB, schContactosClient_Intf, uEtiquetasContactosReportController,
- uIEditorElegirProveedores, Controls, uIEditorElegirDireccionEntrega,
- uEditorGridBase, uDAInterfaces, uIntegerListUtils, uFactuGES_App,
- uPlugins_Intf, uModuleController;
-
-{ TProveedoresController }
-
-function TProveedoresController.Buscar(const ID: Integer): IBizContacto;
-begin
- Result := (FDataModule as IDataModuleProveedores).GetItem(ID);
- FiltrarEmpresa(Result);
-end;
-
-function TProveedoresController.BuscarSubcontratas: IBizProveedor;
-var
- Condicion: TDAWhereExpression;
-begin
- Result := BuscarTodos as IBizProveedor;
- with Result.DataTable.DynamicWhere do
- begin
- Condicion := NewBinaryExpression(NewField('', fld_ProveedoresSUBCONTRATA), NewConstant(1, datInteger), dboEqual);
- Clear;
- Expression := Condicion
- end;
-end;
-
-function TProveedoresController.BuscarTodos: IBizContacto;
-begin
- Result := (FDataModule as IDataModuleProveedores).GetItems;
- FiltrarEmpresa(Result);
-end;
-
-function TProveedoresController.BuscarTodosTiendaWeb: IBizProveedor;
-begin
- Result := (FDataModule as IDataModuleProveedores).GetItemsTiendaWeb;
- FiltrarEmpresa(Result);
-end;
-
-constructor TProveedoresController.Create;
-begin
- inherited;
- FDataModule := TDataModuleProveedores.Create(Nil);
- FDireccionesController := TDireccionesContactoController.Create;
-end;
-
-function TProveedoresController.DarListaCuentasBancarias(const IdProveedor: Integer): TStringList;
-var
- AProveedor: IBizProveedor;
- Aux : String;
-
-begin
- AProveedor := (Buscar(IdProveedor) as IBizProveedor);
- AProveedor.DataTable.Active := True;
-
- Result := TStringList.Create;
- ShowHourglassCursor;
- try
- with Result do
- begin
- AProveedor.DatosBancarios.DataTable.First;
- while not AProveedor.DatosBancarios.DataTable.EOF do
- begin
- Aux := Format('Nº de cuenta: %s %s %s %s - Titular: %s ', [AProveedor.DatosBancarios.ENTIDAD,
- AProveedor.DatosBancarios.SUCURSAL, AProveedor.DatosBancarios.DC, AProveedor.DatosBancarios.CUENTA, AProveedor.DatosBancarios.TITULAR]);
- Add(Format('%s=%d', [Aux, AProveedor.DatosBancarios.ID]));
- AProveedor.DatosBancarios.DataTable.Next;
- end;
- end;
- finally
- AProveedor := NIL;
- HideHourglassCursor;
- end;
-end;
-
-function TProveedoresController.DarListaDescripcionesProveedores: TStringList;
-begin
- Result := (FDataModule as IDataModuleProveedores).DarListaDescripcionesProveedores;
-end;
-
-destructor TProveedoresController.Destroy;
-begin
- FDireccionesController := NIL;
- inherited;
-end;
-
-function TProveedoresController.ElegirContacto(AContactos: IBizContacto;
- AMensaje: String; AMultiSelect: Boolean): IBizContacto;
-var
- AEditor : IEditorElegirProveedores;
-begin
- Result := NIL;
-
- CreateEditor('EditorElegirProveedores', IEditorElegirProveedores, 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 TProveedoresController.ElegirDireccionEntrega(AProveedor: IBizProveedor;
- AMensaje: String): IBizDireccionesContacto;
-var
- AEditor : IEditorElegirDireccionEntrega;
-begin
- Result := NIL;
-
- CreateEditor('EditorElegirDireccionEntrega', IEditorElegirDireccionEntrega, AEditor);
- if Assigned(AEditor) then
- try
- AEditor.Contacto := AProveedor;
- AEditor.Mensaje := AMensaje;
- if IsPositiveResult(AEditor.ShowModal) then
- Result := AEditor.DireccionSeleccionada;
- finally
- AEditor.Release;
- AEditor := NIL;
- end;
-end;
-
-function TProveedoresController.Eliminar(AProveedor: IBizContacto; AllItems: Boolean): Boolean;
-//En el caso de eliminar almenos un elemento del conjunto se devuelve true
-var
- bEliminado: Boolean;
-begin
- bEliminado := False;
-
- if not Assigned(AProveedor) then
- raise Exception.Create ('Contacto no asignado');
-
- ShowHourglassCursor;
- try
- if not AProveedor.DataTable.Active then
- AProveedor.DataTable.Active := True;
-
- if (AProveedor.State in dsEditModes) then
- AProveedor.Cancel;
-
- //Siempre eliminaremos el seleccionado
- if EsEliminable(AProveedor) then
- begin
- AProveedor.Delete;
- bEliminado := True;
- end;
-
- //En el caso de querer eliminar todos los items del objeto AProveedor
- if AllItems then
- begin
- with AProveedor.DataTable do
- begin
- First;
- while not EOF do
- begin
- if EsEliminable(AProveedor) then
- begin
- AProveedor.Delete;
- bEliminado := True
- end
- else Next;
- end;
- end;
- end;
-
- if bEliminado then
- begin
- AProveedor.DataTable.ApplyUpdates;
- Result := True;
- end
- else
- Result := False;
-
- HideHourglassCursor;
- except
- on E: Exception do
- begin
- AProveedor.DataTable.CancelUpdates;
- HideHourglassCursor;
- if (Pos('FOREIGN KEY', E.Message) > 0) then
- MessageBox(0, 'No se pueden borrar el/los proveedor/es seleccionado/s porque, alguno/s de ellos tiene documentos dados de alta en la aplicación (pedidos, albaranes, facturas, etc)', 'Atención', MB_ICONWARNING or MB_OK);
- end;
- end;
-end;
-
-function TProveedoresController.EsEliminable(AProveedor: IBizContacto): Boolean;
-begin
- if not Assigned(AProveedor) then
- raise Exception.Create ('Contacto no asignado: EsEliminable');
-
- Result := True;
-end;
-
-function TProveedoresController.Nuevo: IBizContacto;
-var
- AContacto : IBizProveedor;
-begin
- AContacto := (FDataModule as IDataModuleProveedores).NewItem;
- FiltrarEmpresa(AContacto);
- AContacto.DataTable.Active := True;
- AContacto.Insert;
- Result := AContacto;
-end;
-
-procedure TProveedoresController.Preview(AProveedor: IBizProveedor; AllItems: Boolean);
-var
- AReportController : IEtiquetasContactosReportController;
- ListaID: TIntegerList;
-
-begin
- AReportController := TEtiquetasContactosReportController.Create;
- ListaID := TIntegerList.Create;
-
- try
- //Si deseamos previsualizar todos los items del objeto albaran
- if AllItems then
- begin
- with AProveedor.DataTable do
- begin
- First;
- while not EOF do
- begin
- ListaID.Add(AProveedor.ID);
- Next;
- end;
- end;
- end
- //Solo previsualizamos el item seleccionado
- else
- ListaID.Add(AProveedor.ID);
-
- AReportController.Preview(ListaID);
- finally
- AReportController := NIL;
- FreeANDNil(ListaID);
- end;
-end;
-
-procedure TProveedoresController.Print(AProveedor: IBizProveedor; AllItems: Boolean);
-var
- AReportController : IEtiquetasContactosReportController;
- ListaID: TIntegerList;
-
-begin
- AReportController := TEtiquetasContactosReportController.Create;
- ListaID := TIntegerList.Create;
-
- try
- //Si deseamos previsualizar todos los items del objeto albaran
- if AllItems then
- begin
- with AProveedor.DataTable do
- begin
- First;
- while not EOF do
- begin
- ListaID.Add(AProveedor.ID);
- Next;
- end;
- end;
- end
- //Solo previsualizamos el item seleccionado
- else
- ListaID.Add(AProveedor.ID);
-
- AReportController.Print(ListaID);
-
- finally
- AReportController := NIL;
- FreeANDNil(ListaID);
- end;
-end;
-
-procedure TProveedoresController.Ver(AContacto: IBizContacto);
-var
- AEditor : IEditorProveedor;
-begin
- AEditor := NIL;
-
- CreateEditor('EditorProveedor', IEditorProveedor, AEditor);
- if Assigned(AEditor) then
- try
- AEditor.Contacto := AContacto;
- AEditor.Controller := Self;
- AEditor.ShowModal;
- finally
- AEditor.Release;
- AEditor := NIL;
- end;
-end;
-
-procedure TProveedoresController.VerAlbaranesDeProveedor(
- AProveedor: IBizProveedor);
-var
- AModule : TModuleController;
- APlugin : IMCAlbaranesProveedor;
-begin
- if not Assigned(AProveedor) then
- raise Exception.Create ('Proveedor no asignado (VerAlbaranesDeProveedor)');
-
- if AProveedor.DataTable.Active then
- AProveedor.DataTable.Active := True;
-
- AModule := AppFactuGES.GetModule(MODULENAME_ALBARANES_PROVEEDOR);
- if Assigned(AModule) then
- try
- if Supports(AModule, IMCAlbaranesProveedor, APlugin) then
- APlugin.VerAlbaranes(AProveedor.ID, AProveedor.NOMBRE);
- finally
- APlugin := NIL;
- end;
-end;
-
-procedure TProveedoresController.VerDevolucionesDeProveedor(
- AProveedor: IBizProveedor);
-var
- AModule : TModuleController;
- APlugin : IMCAlbaranesProveedor;
-begin
- if not Assigned(AProveedor) then
- raise Exception.Create ('Proveedor no asignado (VerDevolucionesDeProveedor)');
-
- if AProveedor.DataTable.Active then
- AProveedor.DataTable.Active := True;
-
- AModule := AppFactuGES.GetModule(MODULENAME_ALBARANES_PROVEEDOR);
- if Assigned(AModule) then
- try
- if Supports(AModule, IMCAlbaranesProveedor, APlugin) then
- APlugin.VerDevoluciones(AProveedor.ID, AProveedor.NOMBRE);
- finally
- APlugin := NIL;
- end;
-end;
-
-procedure TProveedoresController.VerFacturasDeProveedor(
- AProveedor: IBizProveedor);
-var
- AModule : TModuleController;
- APlugin : IMCFacturasProveedor;
-begin
- if not Assigned(AProveedor) then
- raise Exception.Create ('Proveedor no asignado (VerFacturasDeProveedor)');
-
- if AProveedor.DataTable.Active then
- AProveedor.DataTable.Active := True;
-
- AModule := AppFactuGES.GetModule(MODULENAME_FACTURAS_PROVEEDOR);
- if Assigned(AModule) then
- try
- if Supports(AModule, IMCFacturasProveedor, APlugin) then
- APlugin.VerFacturas(AProveedor.ID, AProveedor.NOMBRE);
- finally
- APlugin := NIL;
- end;
-end;
-
-procedure TProveedoresController.VerPedidosDeProveedor(
- AProveedor: IBizProveedor);
-var
- AModule : TModuleController;
- APlugin : IMCPedidosProveedor;
-begin
- if not Assigned(AProveedor) then
- raise Exception.Create ('Proveedor no asignado (VerPedidosDeProveedor)');
-
- if AProveedor.DataTable.Active then
- AProveedor.DataTable.Active := True;
-
- AModule := AppFactuGES.GetModule(MODULENAME_PEDIDOS_PROVEEDOR);
- if Assigned(AModule) then
- try
- if Supports(AModule, IMCPedidosProveedor, APlugin) then
- APlugin.VerPedidos(AProveedor.ID, AProveedor.NOMBRE);
- finally
- APlugin := NIL;
- end;
-end;
-
-procedure TProveedoresController.VerRecibosDeProveedor(
- AProveedor: IBizProveedor);
-var
- AModule : TModuleController;
- APlugin : IMCRecibosProveedor;
-begin
- if not Assigned(AProveedor) then
- raise Exception.Create ('Proveedor no asignado (VerRecibosDeProveedor)');
-
- if AProveedor.DataTable.Active then
- AProveedor.DataTable.Active := True;
-
- AModule := AppFactuGES.GetModule(MODULENAME_RECIBOS_PROVEEDOR);
- if Assigned(AModule) then
- try
- if Supports(AModule, IMCRecibosProveedor, APlugin) then
- APlugin.VerRecibos(AProveedor.ID, AProveedor.NOMBRE);
- finally
- APlugin := NIL;
- end;
-end;
-
-procedure TProveedoresController.VerTodos(AContactos: IBizContacto);
-var
- AEditor : IEditorProveedores;
-begin
- AEditor := NIL;
-
- CreateEditor('EditorProveedores', IEditorProveedores, AEditor);
- if Assigned(AEditor) then
- with AEditor do
- begin
- Contactos := AContactos;
- Controller := Self;
- MultiSelect := True;
- ShowEmbedded;
- end;
-end;
-
-end.
diff --git a/Source/Modulos/Medicaciones/Controller/uDetallesMedicacionController.pas b/Source/Modulos/Medicaciones/Controller/uDetallesMedicacionController.pas
index 37b7891..6bcec15 100644
--- a/Source/Modulos/Medicaciones/Controller/uDetallesMedicacionController.pas
+++ b/Source/Modulos/Medicaciones/Controller/uDetallesMedicacionController.pas
@@ -104,12 +104,12 @@ begin
//Si nueva fila es false, quiere decir que se sustituye un determinado artículo, por ello la lista a seleccionar no debe ser multiselect
if ANuevaFila then
begin
- AArticulos := (FArticulosController as IArticulosMedicacionController).ElegirArticulos(AArticulos, 'Elija los artículos que desea añadir a este albarán de cliente', True);
+ AArticulos := (FArticulosController as IArticulosMedicacionController).ElegirArticulos(AArticulos, 'Elija los artículos que desea añadir', True);
Add(ADetalles, AArticulos, ACantidad)
end
else
begin
- AArticulos := (FArticulosController as IArticulosMedicacionController).ElegirArticulos(AArticulos, 'Elija el artículo que desea añadir a este albarán de cliente', False);
+ AArticulos := (FArticulosController as IArticulosMedicacionController).ElegirArticulos(AArticulos, 'Elija el artículo que desea añadir', False);
RellenarDetalle(ADetalles, AArticulos, ACantidad);
end;
@@ -124,19 +124,6 @@ begin
FArticulosController := TArticulosMedicacionController.Create;
end;
-{procedure TDetallesMedicacionController.AsignarDatos(ADetalles: IDAStronglyTypedDataTable; IDCabecera: Integer);
-begin
- inherited;
-
- with (ADetalles as IBizDetallesMedicacion) do
- begin
- Edit;
-// ID := FDataModule.GetNextID(DataTable.LogicalName);
- ID_ALBARAN := IDCabecera;
- Post
- end;
-end;}
-
function TDetallesMedicacionController.CalcularImporteTotalConcepto(DataTable: TDADataTable): Double;
begin
Result := CalcularLineaConcepto(DataTable);
diff --git a/Source/Modulos/Medicaciones/Controller/uMedicacionesController.pas b/Source/Modulos/Medicaciones/Controller/uMedicacionesController.pas
index 861cd4d..eb53a56 100644
--- a/Source/Modulos/Medicaciones/Controller/uMedicacionesController.pas
+++ b/Source/Modulos/Medicaciones/Controller/uMedicacionesController.pas
@@ -48,8 +48,6 @@ type
procedure RecuperarPaciente(AMedicacion: IBizMedicacion);
- {function DarListaAnosAlbaranes: TStringList;
- procedure FiltrarAno(AMedicacion: IBizMedicacion; ADynWhereDataTable: WideString; const Ano: String);}
end;
TMedicacionesController = class(TControllerBase, IMedicacionesController)
@@ -198,15 +196,10 @@ begin
Result := Supports(EditorRegistry.CreateEditor(AName), IID, Intf);
end;
-{function TMedicacionesController.DarListaAnosAlbaranes: TStringList;
-begin
- Result := FDataModule.GetAnosItems;
-end;}
-
procedure TMedicacionesController.DescartarCambios(AMedicacion: IBizMedicacion);
begin
if not Assigned(AMedicacion) then
- raise Exception.Create ('Albarán no asignado');
+ raise Exception.Create ('Medicación no asignada');
ShowHourglassCursor;
try
@@ -277,11 +270,6 @@ begin
if (AMedicacion.Detalles.DataTable.RecordCount = 0) then
raise Exception.Create('La medicación debe tener en su contenido al menos un concepto');
- //Validamos las fechas del albarán
-// if not (EsFechaVacia(AMedicacion.FECHA_ENVIO)) then
-// if AMedicacion.FECHA_ENVIO < AMedicacion.FECHA_PREVISTA_ENVIO then
-// raise Exception.Create('La fecha de envio debe ser posterior a la fecha prevista de envio');
-
if AMedicacion.FECHA_HASTA < AMedicacion.FECHA_DESDE then
raise Exception.Create('La fecha final debe ser posterior a la fecha inicial');
@@ -370,7 +358,7 @@ begin
AMedicacion := Buscar(ID);
if not Assigned(AMedicacion) then
- raise Exception.Create(Format('No se ha encontrado el albarán con ID = %d', [ID]));
+ raise Exception.Create(Format('No se ha encontrado la medicación con ID = %d', [ID]));
Result := Eliminar(AMedicacion);
AMedicacion := NIL;
@@ -405,7 +393,7 @@ begin
bEliminado := False;
if not Assigned(AMedicacion) then
- raise Exception.Create ('Albarán no asignada');
+ raise Exception.Create ('Medicación no asignada');
ShowHourglassCursor;
try
@@ -453,7 +441,7 @@ end;
function TMedicacionesController.EsEliminable(AMedicacion: IBizMedicacion): Boolean;
begin
if not Assigned(AMedicacion) then
- raise Exception.Create ('Albarán no asignado: EsModificable');
+ raise Exception.Create ('Medicación no asignado: EsModificable');
Result := EsModificable(AMedicacion);
end;
@@ -533,35 +521,6 @@ begin
Result := ASeleccionados;
end;
-{procedure TMedicacionesController.FiltrarAno(AMedicacion: IBizMedicacion; ADynWhereDataTable: WideString; const Ano: String);
-var
- Condicion: TDAWhereExpression;
- FechaIni: String;
- FechaFin: String;
-
-begin
- AMedicacion.DataTable.DynamicWhere.Clear;
- AMedicacion.DataTable.DynamicWhere.Xml := ADynWhereDataTable;
-
- if (Ano <> 'Todos') then
- begin
- // Filtrar las facturas actuales por empresa
- FechaIni := '01/01/' + Ano;
- FechaFin := '31/12/' + Ano;
- with AMedicacion.DataTable.DynamicWhere do
- begin
- // (FECHA_INICIO between FECHA_FIN)
- Condicion := NewBinaryExpression(NewField('', fld_MedicacionFECHA_ALBARAN), NewConstant(FechaIni, datString), dboGreaterOrEqual);
- Condicion := NewBinaryExpression(NewBinaryExpression(NewField('', fld_MedicacionFECHA_ALBARAN), NewConstant(FechaFin, datString), dboLessOrEqual), Condicion, dboAnd);
-
- if IsEmpty then
- Expression := Condicion
- else
- Expression := NewBinaryExpression(Condicion, Expression, dboAnd);
- end;
- end;
-end; }
-
procedure TMedicacionesController.SetPacienteController(const Value: IPacientesController);
begin
FPacienteController := Value;
@@ -577,7 +536,7 @@ begin
Result := False;
if not Assigned(AMedicacion) then
- raise Exception.Create ('Albarán no asignada');
+ raise Exception.Create ('Medicación no asignada');
if not Assigned(FDetallesController) then
raise Exception.Create ('Controller detalles no asignado');
diff --git a/Source/Modulos/Medicaciones/Data/uDataModuleMedicaciones.pas b/Source/Modulos/Medicaciones/Data/uDataModuleMedicaciones.pas
index 102b556..075178c 100644
--- a/Source/Modulos/Medicaciones/Data/uDataModuleMedicaciones.pas
+++ b/Source/Modulos/Medicaciones/Data/uDataModuleMedicaciones.pas
@@ -26,7 +26,7 @@ type
function _GetDetalles : IBizDetallesMedicacion;
protected
- procedure AsignarClaseNegocio(AAlbaran: TDADataTable); virtual;
+ procedure AsignarClaseNegocio(AMedicacion: TDADataTable); virtual;
public
function GetItems : IBizMedicacion; virtual;
@@ -47,9 +47,9 @@ uses
{ TdmMedicacion }
-procedure TDataModuleMedicacion.AsignarClaseNegocio(AAlbaran: TDADataTable);
+procedure TDataModuleMedicacion.AsignarClaseNegocio(AMedicacion: TDADataTable);
begin
- AAlbaran.BusinessRulesID := BIZ_CLIENT_MEDICACION;
+ AMedicacion.BusinessRulesID := BIZ_CLIENT_MEDICACION;
end;
procedure TDataModuleMedicacion.DAClientDataModuleCreate(Sender: TObject);
diff --git a/Source/Modulos/Medicaciones/Model/Medicaciones_model.dproj b/Source/Modulos/Medicaciones/Model/Medicaciones_model.dproj
index d35a46b..5ef726b 100644
--- a/Source/Modulos/Medicaciones/Model/Medicaciones_model.dproj
+++ b/Source/Modulos/Medicaciones/Model/Medicaciones_model.dproj
@@ -38,23 +38,23 @@
MainSource
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-