2008-08-27 14:17:04 +00:00
|
|
|
|
unit uViewDocumentosPresupuestoCliente;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
2008-08-27 16:48:20 +00:00
|
|
|
|
Dialogs, uViewDocumentos, ActnList,
|
2008-09-01 09:30:59 +00:00
|
|
|
|
TB2Item, TBX, TB2Dock, TB2Toolbar, cxControls, cxContainer,
|
|
|
|
|
|
uBizPresupuestosCliente, uPresupuestosClienteController, ImgList,
|
2008-09-04 17:49:18 +00:00
|
|
|
|
PngImageList, ComCtrls, Menus;
|
2008-08-27 14:17:04 +00:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
IViewDocumentosPresupuestoCliente = interface
|
|
|
|
|
|
['{564599A5-ECEB-4A1F-8791-22B37282A11C}']
|
|
|
|
|
|
function GetController : IPresupuestosClienteController;
|
|
|
|
|
|
procedure SetController (const Value : IPresupuestosClienteController);
|
|
|
|
|
|
property Controller : IPresupuestosClienteController read GetController write SetController;
|
|
|
|
|
|
|
|
|
|
|
|
function GetPresupuesto: IBizPresupuestoCliente;
|
|
|
|
|
|
procedure SetPresupuesto(const Value: IBizPresupuestoCliente);
|
|
|
|
|
|
property Presupuesto: IBizPresupuestoCliente read GetPresupuesto write SetPresupuesto;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
TfrViewDocumentosPresupuestoCliente = class(TfrViewDocumentos, IViewDocumentosPresupuestoCliente)
|
|
|
|
|
|
private
|
|
|
|
|
|
FController : IPresupuestosClienteController;
|
|
|
|
|
|
FPresupuesto: IBizPresupuestoCliente;
|
|
|
|
|
|
function GetController : IPresupuestosClienteController;
|
|
|
|
|
|
procedure SetController (const Value : IPresupuestosClienteController);
|
|
|
|
|
|
function GetPresupuesto: IBizPresupuestoCliente;
|
|
|
|
|
|
procedure SetPresupuesto(const Value: IBizPresupuestoCliente);
|
|
|
|
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
procedure Sincronizar; override;
|
2008-08-27 16:15:43 +00:00
|
|
|
|
function RecuperarFicheroServidor(const NombreFichero: String; const DirectorioDestino: String): Boolean; override;
|
2008-08-27 14:17:04 +00:00
|
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
|
property Controller : IPresupuestosClienteController read GetController write SetController;
|
|
|
|
|
|
property Presupuesto: IBizPresupuestoCliente read GetPresupuesto write SetPresupuesto;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
|
frViewDocumentosPresupuestoCliente: TfrViewDocumentosPresupuestoCliente;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
{ TfrViewDocumentosPresupuesto }
|
|
|
|
|
|
|
|
|
|
|
|
function TfrViewDocumentosPresupuestoCliente.GetController: IPresupuestosClienteController;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FController;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfrViewDocumentosPresupuestoCliente.GetPresupuesto: IBizPresupuestoCliente;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FPresupuesto;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2008-08-27 16:15:43 +00:00
|
|
|
|
function TfrViewDocumentosPresupuestoCliente.RecuperarFicheroServidor(const NombreFichero: String; const DirectorioDestino: String): Boolean;
|
2008-08-27 14:17:04 +00:00
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2008-08-27 16:15:43 +00:00
|
|
|
|
Result := Controller.GestorDocumentosController.DescargarFichero(Presupuesto.ID, NombreFichero, DirectorioDestino);
|
2008-08-27 14:17:04 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDocumentosPresupuestoCliente.SetController(const Value: IPresupuestosClienteController);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FController := Value;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDocumentosPresupuestoCliente.SetPresupuesto(const Value: IBizPresupuestoCliente);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FPresupuesto := Value;
|
|
|
|
|
|
//Inicializamos la lista de documentos local con los ficheros del servidor
|
|
|
|
|
|
if Assigned(FPresupuesto) and Assigned(FController) then
|
2008-08-28 15:12:50 +00:00
|
|
|
|
ListaFicheros := Controller.GestorDocumentosController.DarListaDocumentos(Presupuesto.ID);
|
2008-08-27 16:15:43 +00:00
|
|
|
|
|
|
|
|
|
|
RefrescarVisualizador;
|
2008-08-27 14:17:04 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewDocumentosPresupuestoCliente.Sincronizar;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2008-08-27 16:15:43 +00:00
|
|
|
|
|
|
|
|
|
|
//De momento el action actSincronizar con el servidor estar<61> oculto y se activa, hay que tener en cuenta lo comentado
|
|
|
|
|
|
{
|
|
|
|
|
|
if Presupuesto.EsNuevo then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (ShowConfirmMessage('Se han producido cambios', 'Se han producido cambios y no se puede sincronizar hasta que no se guarden.' + #10#13 +
|
|
|
|
|
|
'<27>Desea guardarlos ahora?') = IDYES) then
|
|
|
|
|
|
actGuardar.Execute
|
|
|
|
|
|
else
|
|
|
|
|
|
ShowInfoMessage('Recuerde guardar los cambios si quiere previsualizar o imprimir.');
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
2008-08-28 15:12:50 +00:00
|
|
|
|
Controller.GestorDocumentosController.SincronizarDocumentos(Presupuesto.ID, ListaFicheros, Directorio);
|
2008-08-27 14:17:04 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|