Subida segundo repaso de documentos asociados en presupuestos de cliente

git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@540 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
roberto 2008-08-27 16:15:43 +00:00
parent b7ef06ed1b
commit 4feb1db491
19 changed files with 302 additions and 180 deletions

View File

@ -1,7 +1,7 @@
MAINICON ICON "C:\Codigo Tecsitel\Resources\Iconos\Factuges.ico" MAINICON ICON "C:\Codigo Tecsitel\Resources\Iconos\Factuges.ico"
1 VERSIONINFO 1 VERSIONINFO
FILEVERSION 1,2,5,0 FILEVERSION 1,2,6,0
PRODUCTVERSION 1,2,5,0 PRODUCTVERSION 1,2,6,0
FILEFLAGSMASK 0x3FL FILEFLAGSMASK 0x3FL
FILEFLAGS 0x00L FILEFLAGS 0x00L
FILEOS 0x40004L FILEOS 0x40004L
@ -13,10 +13,10 @@ BEGIN
BLOCK "0C0A04E4" BLOCK "0C0A04E4"
BEGIN BEGIN
VALUE "CompanyName", "Rodax Software S.L.\0" VALUE "CompanyName", "Rodax Software S.L.\0"
VALUE "FileVersion", "1.2.5.0\0" VALUE "FileVersion", "1.2.6.0\0"
VALUE "InternalName", "FactuGES\0" VALUE "InternalName", "FactuGES\0"
VALUE "ProductName", "FactuGES\0" VALUE "ProductName", "FactuGES\0"
VALUE "ProductVersion", "1.2.5.0\0" VALUE "ProductVersion", "1.2.6.0\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

Binary file not shown.

View File

@ -66,6 +66,7 @@ inherited frViewDocumentos: TfrViewDocumentos
end end
object actActualizarServidor: TAction object actActualizarServidor: TAction
Caption = 'Actualizar Servidor' Caption = 'Actualizar Servidor'
Visible = False
OnExecute = actActualizarServidorExecute OnExecute = actActualizarServidorExecute
end end
end end

View File

@ -32,20 +32,27 @@ type
procedure actModificarExecute(Sender: TObject); procedure actModificarExecute(Sender: TObject);
procedure actEliminarExecute(Sender: TObject); procedure actEliminarExecute(Sender: TObject);
procedure actEliminarTodoExecute(Sender: TObject); procedure actEliminarTodoExecute(Sender: TObject);
procedure actActualizarServidorExecute(Sender: TObject);
procedure CustomViewCreate(Sender: TObject); procedure CustomViewCreate(Sender: TObject);
procedure CustomViewDestroy(Sender: TObject); procedure CustomViewDestroy(Sender: TObject);
procedure actActualizarServidorExecute(Sender: TObject);
private private
FDirectorio: Variant; FDirectorio: Variant;
function GetDirectorio: Variant; function GetDirectorio: Variant;
function DarFicherosSeleccionados: TStringList; function DarFicherosSeleccionados: TStringList;
protected protected
FListaDocumentos: TStringList; FListaFicheros: TStringList;
procedure Sincronizar; virtual; abstract;
function RecuperarFicheroServidor(const NombreFichero: String; const DestinoFichero: String): Boolean; virtual; abstract;
procedure Refrescar; virtual;
public
property Directorio: Variant read GetDirectorio; property Directorio: Variant read GetDirectorio;
//Son los metodos que se sobreescribiran en la vista hija
procedure Sincronizar; virtual; abstract;
function RecuperarFicheroServidor(const NombreFichero: String; const DirectorioDestino: String): Boolean; virtual; abstract;
procedure RefrescarVisualizador; virtual;
public
property ListaFicheros: TStringList read FListaFicheros;
end; end;
var var
@ -66,7 +73,7 @@ end;
procedure TfrViewDocumentos.actAnadirExecute(Sender: TObject); procedure TfrViewDocumentos.actAnadirExecute(Sender: TObject);
var var
openDialog : TOpenDialog; openDialog : TOpenDialog;
FicheroOrigen : String; ANombreFichero : String;
i : Integer; i : Integer;
begin begin
openDialog := TOpenDialog.Create(self); openDialog := TOpenDialog.Create(self);
@ -88,18 +95,20 @@ begin
begin begin
for i:=0 to openDialog.Files.Count - 1 do for i:=0 to openDialog.Files.Count - 1 do
begin begin
FicheroOrigen := openDialog.Files.Strings[i]; ANombreFichero := openDialog.Files.Strings[i];
if Length(FicheroOrigen) > 0 then if Length(ANombreFichero) > 0 then
CopiarFichero(FicheroOrigen, (Directorio + ExtractFileName(FicheroOrigen))); CopiarFichero(ANombreFichero, (Directorio + ExtractFileName(ANombreFichero)));
//Lo añadimos a la lista de documentos local //Lo añadimos a la lista de documentos local
FListaDocumentos.Add(ExtractFileName(FicheroOrigen)) FListaFicheros.Add(ExtractFileName(ANombreFichero))
end; end;
end; end;
finally finally
openDialog.Free; openDialog.Free;
Refrescar; //Now, We compact the process memory:
SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF);
RefrescarVisualizador;
end; end;
end; end;
@ -107,34 +116,35 @@ procedure TfrViewDocumentos.actEliminarExecute(Sender: TObject);
var var
i, j: Integer; i, j: Integer;
FicherosSeleccionados: TStringList; FicherosSeleccionados: TStringList;
ANombreDocumento: String; ANombreFichero: String;
begin begin
inherited;
FicherosSeleccionados := DarFicherosSeleccionados; FicherosSeleccionados := DarFicherosSeleccionados;
for i := 0 to FicherosSeleccionados.Count - 1 do try
begin for i := 0 to FicherosSeleccionados.Count - 1 do
if FileExists(FicherosSeleccionados.Strings[i]) then begin
if not DeleteFile(FicherosSeleccionados.Strings[i]) then //Buscamos si existen fisicamente y si es así los eliminamos
Application.MessageBox('No se pudo borrar el fichero', 'Error', MB_ICONEXCLAMATION); if FileExists(FicherosSeleccionados.Strings[i]) then
if not DeleteFile(FicherosSeleccionados.Strings[i]) then
Application.MessageBox('No se pudo borrar el fichero', 'Error', MB_ICONEXCLAMATION);
ANombreDocumento := ExtractFileName(FicherosSeleccionados.Strings[i]); //Lo quitamos de la propiedad donde guardamos lista de documentos
if FListaDocumentos.Find(ANombreDocumento, j) then ANombreFichero := ExtractFileName(FicherosSeleccionados.Strings[i]);
FListaDocumentos.Delete(j); if FListaFicheros.Find(ANombreFichero, j) then
FListaFicheros.Delete(j);
end;
finally
FreeAndNil(FicherosSeleccionados);
RefrescarVisualizador;
end; end;
Refrescar;
end; end;
procedure TfrViewDocumentos.actEliminarTodoExecute(Sender: TObject); procedure TfrViewDocumentos.actEliminarTodoExecute(Sender: TObject);
begin begin
// if (ShowConfirmMessage('¿Desea borrar todos los documentos asociados a este presupuesto de cliente?', '') = IDYES) then Deltree(Directorio, True);
// begin FListaFicheros.Clear;
Deltree(Directorio, True); FDirectorio := Null;
FListaDocumentos.Clear; RefrescarVisualizador;
FDirectorio := Null;
// end;
Refrescar;
end; end;
procedure TfrViewDocumentos.actModificarExecute(Sender: TObject); procedure TfrViewDocumentos.actModificarExecute(Sender: TObject);
@ -142,40 +152,40 @@ var
i: Integer; i: Integer;
FicherosSeleccionados: TStringList; FicherosSeleccionados: TStringList;
begin begin
inherited;
FicherosSeleccionados := DarFicherosSeleccionados; FicherosSeleccionados := DarFicherosSeleccionados;
for i := 0 to FicherosSeleccionados.Count - 1 do try
if FileExists(FicherosSeleccionados.Strings[i]) then for i := 0 to FicherosSeleccionados.Count - 1 do
begin if FileExists(FicherosSeleccionados.Strings[i]) then
// showmessage('Existe: ' + FicherosSeleccionados.Strings[i]); begin
if ShellExecute(Handle, nil, pchar(FicherosSeleccionados.Strings[i]), if ShellExecute(Handle, nil, pchar(FicherosSeleccionados.Strings[i]),
nil, nil, SW_SHOWNORMAL) <= 32 then nil, nil, SW_SHOWNORMAL) <= 32 then
Application.MessageBox('No se pudo editar el fichero', 'Error', MB_ICONEXCLAMATION); Application.MessageBox('No se pudo editar el fichero', 'Error', MB_ICONEXCLAMATION);
end end
else else
begin begin
// showmessage('No existe: ' + FicherosSeleccionados.Strings[i]); if not RecuperarFicheroServidor(ExtractFileName(FicherosSeleccionados.Strings[i]), ExtractFilePath(FicherosSeleccionados.Strings[i])) then
if not RecuperarFicheroServidor(ExtractFileName(FicherosSeleccionados.Strings[i]), ExtractFilePath(FicherosSeleccionados.Strings[i])) then Application.MessageBox('No se pudo RecuperarFicheroServidor', 'Error', MB_ICONEXCLAMATION);
Application.MessageBox('No se pudo RecuperarFicheroServidor', 'Error', MB_ICONEXCLAMATION);
if ShellExecute(Handle, nil, pchar(FicherosSeleccionados.Strings[i]), if ShellExecute(Handle, nil, pchar(FicherosSeleccionados.Strings[i]),
nil, nil, SW_SHOWNORMAL) <= 32 then nil, nil, SW_SHOWNORMAL) <= 32 then
Application.MessageBox('No se pudo editar el fichero', 'Error', MB_ICONEXCLAMATION); Application.MessageBox('No se pudo editar el fichero', 'Error', MB_ICONEXCLAMATION);
end; end;
finally
FreeAndNil(FicherosSeleccionados)
end;
end; end;
procedure TfrViewDocumentos.CustomViewCreate(Sender: TObject); procedure TfrViewDocumentos.CustomViewCreate(Sender: TObject);
begin begin
inherited; inherited;
FDirectorio := Null; FDirectorio := Null;
FListaDocumentos := Nil; FListaFicheros := Nil;
end; end;
procedure TfrViewDocumentos.CustomViewDestroy(Sender: TObject); procedure TfrViewDocumentos.CustomViewDestroy(Sender: TObject);
begin begin
FDirectorio := Null; FDirectorio := Null;
FreeAndNil(FListaDocumentos); FreeAndNil(FListaFicheros);
inherited; inherited;
end; end;
@ -202,18 +212,10 @@ begin
Result := FDirectorio; Result := FDirectorio;
end; end;
procedure TfrViewDocumentos.Refrescar; procedure TfrViewDocumentos.RefrescarVisualizador;
var
ADocumentos: TStringList;
i: Integer;
begin begin
// ADocumentos := FindFile(Directorio + '*.*');
// for i := 0 to ADocumentos.Count - 1 do
// ADocumentos.Strings[i] := ExtractFileName(ADocumentos.Strings[i]);
ListaDocumentos.Clear; ListaDocumentos.Clear;
ListaDocumentos.Items.AddStrings(FListaDocumentos); ListaDocumentos.Items.AddStrings(FListaFicheros);
// FreeAndNil(ADocumentos);
end; end;
end. end.

View File

@ -13,4 +13,4 @@ BEGIN
END END
/* C:\Codigo Tecsitel\Source\Modulos\Gestion de documentos\Controller\GestorDocumentos_Controller.res */ /* C:\Codigo Tecsitel\Source\Modulos\Gestion de documentos\Controller\GestorDocumentos_Controller.res */
/* C:\DOCUME~1\Usuario\CONFIG~1\Temp\dtf146.tmp */ /* C:\DOCUME~1\Usuario\CONFIG~1\Temp\dtf373.tmp */

View File

@ -12,6 +12,7 @@ type
function DescargarFichero(const ID:Integer; const NombreFichero: String; const DestinoFichero: String): Boolean; function DescargarFichero(const ID:Integer; const NombreFichero: String; const DestinoFichero: String): Boolean;
function SubirFichero(const ID:Integer; const NombreFichero: String; const Fichero: Binary): Boolean; function SubirFichero(const ID:Integer; const NombreFichero: String; const Fichero: Binary): Boolean;
procedure SincronizarDocumentos(const ID: Integer; FListaDocumentos: TStringList; Directorio: String); procedure SincronizarDocumentos(const ID: Integer; FListaDocumentos: TStringList; Directorio: String);
function EliminarDirectorio(const ID: Integer): Boolean;
end; end;
TGestorDocumentosController = class(TControllerBase, IGestorDocumentosController) TGestorDocumentosController = class(TControllerBase, IGestorDocumentosController)
@ -30,6 +31,7 @@ type
function DescargarFichero(const ID:Integer; const NombreFichero: String; const DestinoFichero: String): Boolean; function DescargarFichero(const ID:Integer; const NombreFichero: String; const DestinoFichero: String): Boolean;
function SubirFichero(const ID:Integer; const NombreFichero: String; const Fichero: Binary): Boolean; function SubirFichero(const ID:Integer; const NombreFichero: String; const Fichero: Binary): Boolean;
procedure SincronizarDocumentos(const ID: Integer; FListaDocumentos: TStringList; Directorio: String); procedure SincronizarDocumentos(const ID: Integer; FListaDocumentos: TStringList; Directorio: String);
function EliminarDirectorio(const ID: Integer): Boolean;
end; end;
implementation implementation
@ -66,6 +68,11 @@ begin
inherited; inherited;
end; end;
function TGestorDocumentosController.EliminarDirectorio(const ID: Integer): Boolean;
begin
Result := FDataModule.EliminarID(ID);
end;
procedure TGestorDocumentosController.SincronizarDocumentos(const ID: Integer; procedure TGestorDocumentosController.SincronizarDocumentos(const ID: Integer;
FListaDocumentos: TStringList; Directorio: String); FListaDocumentos: TStringList; Directorio: String);
var var

View File

@ -14,4 +14,4 @@ END
/* C:\Codigo Tecsitel\Source\Modulos\Gestion de documentos\Data\uDataModuleGestorDocumentos.dfm */ /* C:\Codigo Tecsitel\Source\Modulos\Gestion de documentos\Data\uDataModuleGestorDocumentos.dfm */
/* C:\Codigo Tecsitel\Source\Modulos\Gestion de documentos\Data\GestorDocumentos_data.res */ /* C:\Codigo Tecsitel\Source\Modulos\Gestion de documentos\Data\GestorDocumentos_data.res */
/* C:\DOCUME~1\Usuario\CONFIG~1\Temp\dtf144.tmp */ /* C:\DOCUME~1\Usuario\CONFIG~1\Temp\dtf371.tmp */

View File

@ -13,6 +13,7 @@ type
function DescargarFichero(const ID : Integer; const NombreFichero: String; const DestinoFichero: String): Boolean; function DescargarFichero(const ID : Integer; const NombreFichero: String; const DestinoFichero: String): Boolean;
function SubirFichero(const ID : Integer; const NombreFichero: String; const Fichero: Binary): Boolean; function SubirFichero(const ID : Integer; const NombreFichero: String; const Fichero: Binary): Boolean;
function EliminarFichero(const ID : Integer; const NombreFichero: String): Boolean; function EliminarFichero(const ID : Integer; const NombreFichero: String): Boolean;
function EliminarID(const ID : Integer): Boolean;
end; end;
TDataModuleGestorDocumentos = class(TDataModuleBase, IDataModuleGestorDocumentos) TDataModuleGestorDocumentos = class(TDataModuleBase, IDataModuleGestorDocumentos)
@ -28,7 +29,7 @@ type
function DescargarFichero(const ID : Integer; const NombreFichero: String; const DestinoFichero: String): Boolean; function DescargarFichero(const ID : Integer; const NombreFichero: String; const DestinoFichero: String): Boolean;
function SubirFichero(const ID : Integer; const NombreFichero: String; const Fichero: Binary): Boolean; function SubirFichero(const ID : Integer; const NombreFichero: String; const Fichero: Binary): Boolean;
function EliminarFichero(const ID : Integer; const NombreFichero: String): Boolean; function EliminarFichero(const ID : Integer; const NombreFichero: String): Boolean;
function EliminarID(const ID : Integer): Boolean;
end; end;
implementation implementation
@ -91,6 +92,16 @@ begin
end; end;
end; end;
function TDataModuleGestorDocumentos.EliminarID(const ID: Integer): Boolean;
begin
Result := False;
try
Result := (RORemoteService as IsrvGestorDocumentos).EliminarID(TRdxAlmacenes_Presupuestos, ID);
finally
//
end;
end;
function TDataModuleGestorDocumentos.SubirFichero(const ID: Integer; const NombreFichero: String; const Fichero: Binary): Boolean; function TDataModuleGestorDocumentos.SubirFichero(const ID: Integer; const NombreFichero: String; const Fichero: Binary): Boolean;
begin begin
Result := False; Result := False;

View File

@ -31,6 +31,7 @@ type
function DescargarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Binary; function DescargarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Binary;
function SubirFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String; const Fichero: Binary): Boolean; function SubirFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String; const Fichero: Binary): Boolean;
function EliminarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Boolean; function EliminarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Boolean;
function EliminarID(const Almacen: TRdxAlmacenes; const ID: Integer): Boolean;
end; end;
implementation implementation
@ -99,7 +100,7 @@ begin
try try
GetClassFactory('srvConfiguracion').CreateInstance(AClientID, Intf); GetClassFactory('srvConfiguracion').CreateInstance(AClientID, Intf);
AConfiguracionService := Intf as IsrvConfiguracion; AConfiguracionService := Intf as IsrvConfiguracion;
Result := AConfiguracionService.darValor('RUTA'); Result := AConfiguracionService.darValor('RUTA_DOCUMENTOS');
finally finally
AConfiguracionService := Nil; AConfiguracionService := Nil;
end; end;
@ -148,6 +149,28 @@ begin
end; end;
end; end;
function TsrvGestorDocumentos.EliminarID(const Almacen: TRdxAlmacenes; const ID: Integer): Boolean;
var
Ruta: String;
begin
Result := False;
try
Ruta := DarRutaDocumentos;
case Almacen of
TRdxAlmacenes_Presupuestos:
begin
Ruta := Ruta + '\presupuestos\' + IntToStr(ID);
Deltree(Ruta, True);
Result := True;
end;
end;
finally
//
end;
end;
function TsrvGestorDocumentos.SubirFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String; function TsrvGestorDocumentos.SubirFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String;
const Fichero: Binary): Boolean; const Fichero: Binary): Boolean;
var var
@ -160,7 +183,11 @@ begin
case Almacen of case Almacen of
TRdxAlmacenes_Presupuestos: TRdxAlmacenes_Presupuestos:
begin begin
Ruta := Ruta + '\presupuestos\' + IntToStr(ID) + '\' + NombreFichero; Ruta := Ruta + '\presupuestos\' + IntToStr(ID);
if not DirectoryExists(Ruta) then
CreateDir(Ruta);
Ruta := Ruta + '\' + NombreFichero;
Fichero.SaveToFile(Ruta); Fichero.SaveToFile(Ruta);
Result := True; Result := True;
end; end;

View File

@ -20,6 +20,7 @@ type
procedure SetDetallesController(const Value: IDetallesPresupuestoClienteController); procedure SetDetallesController(const Value: IDetallesPresupuestoClienteController);
property DetallesController: IDetallesPresupuestoClienteController read GetDetallesController write SetDetallesController; property DetallesController: IDetallesPresupuestoClienteController read GetDetallesController write SetDetallesController;
//GESTION_DOCUMENTOS
function GetGestorDocumentosController: IGestorDocumentosController; function GetGestorDocumentosController: IGestorDocumentosController;
procedure SetGestorDocumentosController(const Value: IGestorDocumentosController); procedure SetGestorDocumentosController(const Value: IGestorDocumentosController);
property GestorDocumentosController: IGestorDocumentosController read GetGestorDocumentosController write SetGestorDocumentosController; property GestorDocumentosController: IGestorDocumentosController read GetGestorDocumentosController write SetGestorDocumentosController;
@ -58,13 +59,6 @@ type
procedure EnviarPresupuestoPorEMail(APresupuesto : IBizPresupuestoCliente); procedure EnviarPresupuestoPorEMail(APresupuesto : IBizPresupuestoCliente);
function GenerarCertificados(APresupuesto : IBizPresupuestoCliente; AllItems: Boolean = false): Boolean; function GenerarCertificados(APresupuesto : IBizPresupuestoCliente; AllItems: Boolean = false): Boolean;
function CambiarSituacion(APresupuesto : IBizPresupuestoCliente; Situacion: String; FechaDecision: TDateTime; AllItems: Boolean = false): Boolean; function CambiarSituacion(APresupuesto : IBizPresupuestoCliente; Situacion: String; FechaDecision: TDateTime; AllItems: Boolean = false): Boolean;
{
function DarListaDocumentos(const ID: Integer): TStringList;
function DescargarFichero(const ID:Integer; const NombreFichero: String; const DestinoFichero: String): Boolean;
function SubirFichero(const ID:Integer; const NombreFichero: String; const Fichero: Binary): Boolean;
procedure SincronizarDocumentos(const ID: Integer; FListaDocumentos: TStringList; Directorio: String);
}
end; end;
TPresupuestosClienteController = class(TControllerBase, IPresupuestosClienteController) TPresupuestosClienteController = class(TControllerBase, IPresupuestosClienteController)
@ -78,6 +72,8 @@ type
procedure SetClienteController(const Value: IClientesController); procedure SetClienteController(const Value: IClientesController);
function GetDetallesController: IDetallesPresupuestoClienteController; function GetDetallesController: IDetallesPresupuestoClienteController;
procedure SetDetallesController(const Value: IDetallesPresupuestoClienteController); procedure SetDetallesController(const Value: IDetallesPresupuestoClienteController);
//GESTION_DOCUMENTOS
function GetGestorDocumentosController: IGestorDocumentosController; function GetGestorDocumentosController: IGestorDocumentosController;
procedure SetGestorDocumentosController(const Value: IGestorDocumentosController); procedure SetGestorDocumentosController(const Value: IGestorDocumentosController);
@ -133,13 +129,6 @@ type
function GenerarCertificados(APresupuesto : IBizPresupuestoCliente; AllItems: Boolean = false): Boolean; function GenerarCertificados(APresupuesto : IBizPresupuestoCliente; AllItems: Boolean = false): Boolean;
procedure EnviarPresupuestoPorEMail(APresupuesto : IBizPresupuestoCliente); procedure EnviarPresupuestoPorEMail(APresupuesto : IBizPresupuestoCliente);
function CambiarSituacion(APresupuesto : IBizPresupuestoCliente; Situacion: String; FechaDecision: TDateTime; AllItems: Boolean = false): Boolean; function CambiarSituacion(APresupuesto : IBizPresupuestoCliente; Situacion: String; FechaDecision: TDateTime; AllItems: Boolean = false): Boolean;
{
function DarListaDocumentos(const ID: Integer): TStringList;
function DescargarFichero(const ID:Integer; const NombreFichero: String; const DestinoFichero: String): Boolean;
function SubirFichero(const ID:Integer; const NombreFichero: String; const Fichero: Binary): Boolean;
procedure SincronizarDocumentos(const ID: Integer; FListaDocumentos: TStringList; Directorio: String);
}
end; end;
implementation implementation
@ -356,7 +345,10 @@ begin
FClienteController := TClientesController.Create; FClienteController := TClientesController.Create;
FDetallesController := TDetallesPresupuestoClienteController.Create; FDetallesController := TDetallesPresupuestoClienteController.Create;
FGestorDocumentosController := TGestorDocumentosController.Create;
//GESTION_DOCUMENTOS
FGestorDocumentosController := TGestorDocumentosController.Create;
FDetallesController.addObservador(Self); FDetallesController.addObservador(Self);
end; end;
@ -399,7 +391,9 @@ begin
FDataModule := Nil; FDataModule := Nil;
FClienteController := Nil; FClienteController := Nil;
FDetallesController := Nil; FDetallesController := Nil;
FGestorDocumentosController := Nil;
//GESTION_DOCUMENTOS
FGestorDocumentosController := Nil;
inherited; inherited;
end; end;
@ -624,6 +618,9 @@ begin
//Siempre eliminaremos el seleccionado //Siempre eliminaremos el seleccionado
if EsEliminable(APresupuesto) then if EsEliminable(APresupuesto) then
begin begin
//GESTION_DOCUMENTOS
FGestorDocumentosController.EliminarDirectorio(APresupuesto.ID);
APresupuesto.Delete; APresupuesto.Delete;
bEliminado := True; bEliminado := True;
end; end;
@ -638,6 +635,9 @@ begin
begin begin
if EsEliminable(APresupuesto) then if EsEliminable(APresupuesto) then
begin begin
//GESTION_DOCUMENTOS
FGestorDocumentosController.EliminarDirectorio(APresupuesto.ID);
APresupuesto.Delete; APresupuesto.Delete;
bEliminado := True bEliminado := True
end end
@ -867,8 +867,6 @@ begin
try try
APresupuesto.DataTable.ApplyUpdates; APresupuesto.DataTable.ApplyUpdates;
// ApplyUpdatesDocumentos;
Result := True; Result := True;
finally finally
HideHourglassCursor; HideHourglassCursor;

View File

@ -199,108 +199,116 @@ inherited fEditorPresupuestoCliente: TfEditorPresupuestoCliente
ExplicitHeight = 386 ExplicitHeight = 386
inherited ToolBar1: TToolBar inherited ToolBar1: TToolBar
Width = 735 Width = 735
Height = 78 Height = 46
ExplicitWidth = 735 ExplicitWidth = 735
ExplicitHeight = 78 ExplicitHeight = 46
inherited ToolButton4: TToolButton [1] inherited ToolButton4: TToolButton
Left = 109 Left = 109
Top = 0 Top = 0
ExplicitLeft = 109 ExplicitLeft = 109
ExplicitTop = 0 ExplicitTop = 0
end end
inherited ToolButton14: TToolButton [2] inherited FontName: TJvFontComboBox [2]
Left = 165 Left = 165
Top = 0 Top = 0
ExplicitLeft = 165 ExplicitLeft = 165
ExplicitTop = 0 ExplicitTop = 0
end end
inherited FontName: TJvFontComboBox [3] inherited FontSize: TEdit [3]
Left = 230 Left = 310
Top = 0 Top = 0
ExplicitLeft = 230 Width = 200
ExplicitLeft = 310
ExplicitTop = 0
ExplicitWidth = 200
end
inherited UpDown1: TUpDown [4]
Left = 510
Top = 0
ExplicitLeft = 510
ExplicitTop = 0 ExplicitTop = 0
end end
inherited FontSize: TEdit [4] inherited ToolButton3: TToolButton [5]
Left = 375 Left = 527
Top = 0 Top = 0
Width = 184
ExplicitLeft = 375
ExplicitTop = 0
ExplicitWidth = 184
end
inherited UpDown1: TUpDown [5]
Left = 559
Top = 0
ExplicitLeft = 559
ExplicitTop = 0
end
inherited ToolButton13: TToolButton [6]
Left = 0
Wrap = True Wrap = True
ExplicitLeft = 527
ExplicitTop = 0
end
inherited ToolButton2: TToolButton [6]
Top = 22
Wrap = True
end
inherited ToolButton14: TToolButton
Left = 0
Top = 44
ExplicitLeft = 0 ExplicitLeft = 0
ExplicitHeight = 27 ExplicitTop = 44
end end
inherited ToolButton2: TToolButton [7] inherited ToolButton13: TToolButton [8]
Left = 65
Top = 44
ExplicitLeft = 65
ExplicitTop = 44
end end
inherited ToolButton6: TToolButton [8] inherited ToolButton6: TToolButton [9]
Left = 114 Left = 73
Top = 27 Top = 44
ExplicitLeft = 114 ExplicitLeft = 73
ExplicitTop = 27 ExplicitTop = 44
end end
inherited ToolButton7: TToolButton [9] inherited ToolButton7: TToolButton [10]
Left = 180 Left = 139
Top = 27 Top = 44
ExplicitLeft = 180 ExplicitLeft = 139
ExplicitTop = 27 ExplicitTop = 44
end end
inherited ToolButton8: TToolButton [10] inherited ToolButton8: TToolButton [11]
Left = 247 Left = 206
Top = 27 Top = 44
ExplicitLeft = 247 ExplicitLeft = 206
ExplicitTop = 27 ExplicitTop = 44
end end
inherited ToolButton12: TToolButton [11] inherited ToolButton12: TToolButton [12]
Top = 27 Left = 289
ExplicitTop = 27 Top = 44
end Wrap = False
inherited ToolButton3: TToolButton [12] ExplicitLeft = 289
Top = 54 ExplicitTop = 44
ExplicitTop = 54 ExplicitHeight = 22
end end
inherited ToolButton9: TToolButton [13] inherited ToolButton9: TToolButton [13]
Left = 55 Left = 297
Top = 54 Top = 44
Wrap = False ExplicitLeft = 297
ExplicitLeft = 55 ExplicitTop = 44
ExplicitTop = 54
end end
inherited ToolButton10: TToolButton [14] inherited ToolButton10: TToolButton [14]
Left = 200 Left = 442
Top = 54 Top = 44
Wrap = False Wrap = False
ExplicitLeft = 200 ExplicitLeft = 442
ExplicitTop = 54 ExplicitTop = 44
end end
inherited ToolButton11: TToolButton inherited ToolButton11: TToolButton
Left = 325 Left = 567
Top = 54 Top = 44
ExplicitLeft = 325 ExplicitLeft = 567
ExplicitTop = 54 ExplicitTop = 44
end end
end end
inherited cxGrid: TcxGrid inherited cxGrid: TcxGrid
Top = 104 Top = 72
Width = 735 Width = 735
Height = 282 Height = 314
ExplicitTop = 99 ExplicitTop = 72
ExplicitWidth = 735 ExplicitWidth = 735
ExplicitHeight = 287 ExplicitHeight = 314
end end
inherited TBXDock1: TTBXDock inherited TBXDock1: TTBXDock
Top = 78 Top = 46
Width = 735 Width = 735
ExplicitTop = 73 ExplicitTop = 46
ExplicitWidth = 735 ExplicitWidth = 735
inherited TBXToolbar1: TTBXToolbar inherited TBXToolbar1: TTBXToolbar
ExplicitWidth = 702 ExplicitWidth = 702

View File

@ -57,6 +57,7 @@ type
procedure pgPaginasChanging(Sender: TObject; var AllowChange: Boolean); procedure pgPaginasChanging(Sender: TObject; var AllowChange: Boolean);
procedure actEnviarPorEMailExecute(Sender: TObject); procedure actEnviarPorEMailExecute(Sender: TObject);
procedure actEnviarPorEMailUpdate(Sender: TObject); procedure actEnviarPorEMailUpdate(Sender: TObject);
procedure actEliminarUpdate(Sender: TObject);
private private
procedure RecalcularPortePorUnidad; procedure RecalcularPortePorUnidad;
@ -108,6 +109,13 @@ uses
{ {
**************************** TfEditorPresupuestoCliente **************************** **************************** TfEditorPresupuestoCliente ****************************
} }
procedure TfEditorPresupuestoCliente.actEliminarUpdate(Sender: TObject);
begin
inherited;
if (Sender as TAction).Enabled then
(Sender as TAction).Enabled := (FPresupuesto.SITUACION = SITUACION_PRESUPUESTO_PENDIENTE);
end;
procedure TfEditorPresupuestoCliente.actEnviarPorEMailExecute(Sender: TObject); procedure TfEditorPresupuestoCliente.actEnviarPorEMailExecute(Sender: TObject);
begin begin
inherited; inherited;
@ -161,6 +169,9 @@ procedure TfEditorPresupuestoCliente.CustomEditorClose(Sender: TObject;
var Action: TCloseAction); var Action: TCloseAction);
begin begin
inherited; inherited;
//GESTION_DOCUMENTOS
//Este método eliminará el directorio temporal si se ha creado
frViewDocumentosPresupuestoCliente1.actEliminarTodo.Execute;
FViewPresupuesto := NIL; FViewPresupuesto := NIL;
FPresupuesto := NIL; FPresupuesto := NIL;
end; end;
@ -233,10 +244,10 @@ begin
frViewDetallesPresupuestoCliente1.BeginUpdate; frViewDetallesPresupuestoCliente1.BeginUpdate;
try try
bEsNuevo := FPresupuesto.EsNuevo; bEsNuevo := FPresupuesto.EsNuevo;
FController.Guardar(FPresupuesto); //GESTION_DOCUMENTOS
if FController.Guardar(FPresupuesto) then
frViewDocumentosPresupuestoCliente1.actActualizarServidor.Execute;
//Obligamos a sincronizar documentos con servidor
// frViewDocumentosPresupuestoCliente1.actActualizarServidor.Execute;
finally finally
frViewDetallesPresupuestoCliente1.EndUpdate; frViewDetallesPresupuestoCliente1.EndUpdate;
// frViewDetallesPresupuestoCliente1.RestoreGridStatus; // frViewDetallesPresupuestoCliente1.RestoreGridStatus;
@ -365,6 +376,8 @@ begin
begin begin
ViewPresupuesto.ViewClientePresupuesto.Controller := Controller.ClienteController; ViewPresupuesto.ViewClientePresupuesto.Controller := Controller.ClienteController;
frViewDetallesPresupuestoCliente1.Controller := Controller.DetallesController; frViewDetallesPresupuestoCliente1.Controller := Controller.DetallesController;
//GESTION_DOCUMENTOS
frViewDocumentosPresupuestoCliente1.Controller := Controller; frViewDocumentosPresupuestoCliente1.Controller := Controller;
end; end;
end; end;
@ -386,6 +399,8 @@ begin
ViewPresupuesto.ViewClientePresupuesto.OnClienteChanged := OnClienteChanged; ViewPresupuesto.ViewClientePresupuesto.OnClienteChanged := OnClienteChanged;
frViewDetallesPresupuestoCliente1.Detalles := FPresupuesto.Detalles; frViewDetallesPresupuestoCliente1.Detalles := FPresupuesto.Detalles;
frViewDetallesPresupuestoCliente1.Presupuesto := FPresupuesto; //Para poder sacar los descuento del articulos segun el cliente seleccionado frViewDetallesPresupuestoCliente1.Presupuesto := FPresupuesto; //Para poder sacar los descuento del articulos segun el cliente seleccionado
//GESTION_DOCUMENTOS
frViewDocumentosPresupuestoCliente1.Presupuesto := FPresupuesto; frViewDocumentosPresupuestoCliente1.Presupuesto := FPresupuesto;
end; end;
end; end;

View File

@ -36,8 +36,7 @@ type
protected protected
procedure Sincronizar; override; procedure Sincronizar; override;
function RecuperarFicheroServidor(const NombreFichero: String; const DestinoFichero: String): Boolean; override; function RecuperarFicheroServidor(const NombreFichero: String; const DirectorioDestino: String): Boolean; override;
procedure Refrescar; override;
public public
property Controller : IPresupuestosClienteController read GetController write SetController; property Controller : IPresupuestosClienteController read GetController write SetController;
@ -63,21 +62,10 @@ begin
Result := FPresupuesto; Result := FPresupuesto;
end; end;
function TfrViewDocumentosPresupuestoCliente.RecuperarFicheroServidor(const NombreFichero: String; const DestinoFichero: String): Boolean; function TfrViewDocumentosPresupuestoCliente.RecuperarFicheroServidor(const NombreFichero: String; const DirectorioDestino: String): Boolean;
begin begin
inherited; inherited;
Result := Controller.GestorDocumentosController.DescargarFichero(Presupuesto.ID, NombreFichero, DestinoFichero); Result := Controller.GestorDocumentosController.DescargarFichero(Presupuesto.ID, NombreFichero, DirectorioDestino);
end;
procedure TfrViewDocumentosPresupuestoCliente.Refrescar;
var
ADocumentos: TStringList;
begin
inherited;
// ADocumentos := Controller.DarListaDocumentos(Presupuesto.ID);
// ListaDocumentos.Items.AddStrings(ADocumentos);
// FreeAndNil(ADocumentos);
end; end;
procedure TfrViewDocumentosPresupuestoCliente.SetController(const Value: IPresupuestosClienteController); procedure TfrViewDocumentosPresupuestoCliente.SetController(const Value: IPresupuestosClienteController);
@ -90,14 +78,27 @@ begin
FPresupuesto := Value; FPresupuesto := Value;
//Inicializamos la lista de documentos local con los ficheros del servidor //Inicializamos la lista de documentos local con los ficheros del servidor
if Assigned(FPresupuesto) and Assigned(FController) then if Assigned(FPresupuesto) and Assigned(FController) then
FListaDocumentos := Controller.GestorDocumentosController.DarListaDocumentos(Presupuesto.ID); FListaFicheros := Controller.GestorDocumentosController.DarListaDocumentos(Presupuesto.ID);
Refrescar;
RefrescarVisualizador;
end; end;
procedure TfrViewDocumentosPresupuestoCliente.Sincronizar; procedure TfrViewDocumentosPresupuestoCliente.Sincronizar;
begin begin
inherited; inherited;
Controller.GestorDocumentosController.SincronizarDocumentos(Presupuesto.ID, FListaDocumentos, Directorio);
//De momento el action actSincronizar con el servidor estará 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 +
'¿Desea guardarlos ahora?') = IDYES) then
actGuardar.Execute
else
ShowInfoMessage('Recuerde guardar los cambios si quiere previsualizar o imprimir.');
end;
}
Controller.GestorDocumentosController.SincronizarDocumentos(Presupuesto.ID, FListaFicheros, Directorio);
end; end;
end. end.

View File

@ -509,6 +509,16 @@
</Parameter> </Parameter>
</Parameters> </Parameters>
</Operation> </Operation>
<Operation Name="EliminarID" UID="{4E7F02BF-0422-415F-A5FB-D61BDCC45F03}">
<Parameters>
<Parameter Name="Result" DataType="Boolean" Flag="Result">
</Parameter>
<Parameter Name="Almacen" DataType="TRdxAlmacenes" Flag="In" >
</Parameter>
<Parameter Name="ID" DataType="Integer" Flag="In" >
</Parameter>
</Parameters>
</Operation>
</Operations> </Operations>
</Interface> </Interface>
</Interfaces> </Interfaces>

View File

@ -722,6 +722,7 @@ type
function DescargarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Binary; function DescargarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Binary;
function SubirFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String; const Fichero: Binary): Boolean; function SubirFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String; const Fichero: Binary): Boolean;
function EliminarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Boolean; function EliminarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Boolean;
function EliminarID(const Almacen: TRdxAlmacenes; const ID: Integer): Boolean;
end; end;
{ CosrvGestorDocumentos } { CosrvGestorDocumentos }
@ -738,6 +739,7 @@ type
function DescargarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Binary; function DescargarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Binary;
function SubirFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String; const Fichero: Binary): Boolean; function SubirFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String; const Fichero: Binary): Boolean;
function EliminarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Boolean; function EliminarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Boolean;
function EliminarID(const Almacen: TRdxAlmacenes; const ID: Integer): Boolean;
end; end;
implementation implementation
@ -2049,6 +2051,23 @@ begin
end end
end; end;
function TsrvGestorDocumentos_Proxy.EliminarID(const Almacen: TRdxAlmacenes; const ID: Integer): Boolean;
begin
try
__Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'EliminarID');
__Message.Write('Almacen', TypeInfo(FactuGES_Intf.TRdxAlmacenes), Almacen, []);
__Message.Write('ID', TypeInfo(Integer), ID, []);
__Message.Finalize;
__TransportChannel.Dispatch(__Message);
__Message.Read('Result', TypeInfo(Boolean), result, []);
finally
__Message.UnsetAttributes(__TransportChannel);
__Message.FreeStream;
end
end;
initialization initialization
RegisterROClass(TRdxLoginInfo); RegisterROClass(TRdxLoginInfo);
RegisterROClass(TRdxEmpresasArray); RegisterROClass(TRdxEmpresasArray);

View File

@ -218,6 +218,7 @@ type
procedure Invoke_DescargarFichero(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); procedure Invoke_DescargarFichero(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
procedure Invoke_SubirFichero(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); procedure Invoke_SubirFichero(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
procedure Invoke_EliminarFichero(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); procedure Invoke_EliminarFichero(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
procedure Invoke_EliminarID(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
end; end;
implementation implementation
@ -1114,5 +1115,27 @@ begin
end; end;
end; end;
procedure TsrvGestorDocumentos_Invoker.Invoke_EliminarID(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
{ function EliminarID(const Almacen: TRdxAlmacenes; const ID: Integer): Boolean; }
var
Almacen: FactuGES_Intf.TRdxAlmacenes;
ID: Integer;
lResult: Boolean;
begin
try
__Message.Read('Almacen', TypeInfo(FactuGES_Intf.TRdxAlmacenes), Almacen, []);
__Message.Read('ID', TypeInfo(Integer), ID, []);
lResult := (__Instance as IsrvGestorDocumentos).EliminarID(Almacen, ID);
__Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvGestorDocumentos', 'EliminarIDResponse');
__Message.Write('Result', TypeInfo(Boolean), lResult, []);
__Message.Finalize;
__Message.UnsetAttributes(__Transport);
finally
end;
end;
initialization initialization
end. end.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
MAINICON ICON "C:\Codigo Tecsitel\Resources\Iconos\Servidor.ico" MAINICON ICON "C:\Codigo Tecsitel\Resources\Iconos\Servidor.ico"
1 VERSIONINFO 1 VERSIONINFO
FILEVERSION 1,2,5,0 FILEVERSION 1,2,4,0
PRODUCTVERSION 1,2,5,0 PRODUCTVERSION 1,2,4,0
FILEFLAGSMASK 0x3FL FILEFLAGSMASK 0x3FL
FILEFLAGS 0x00L FILEFLAGS 0x00L
FILEOS 0x40004L FILEOS 0x40004L
@ -12,9 +12,9 @@ BEGIN
BEGIN BEGIN
BLOCK "0C0A04E4" BLOCK "0C0A04E4"
BEGIN BEGIN
VALUE "FileVersion", "1.2.5.0\0" VALUE "FileVersion", "1.2.4.0\0"
VALUE "ProductVersion", "1.2.5.0\0" VALUE "ProductVersion", "1.2.4.0\0"
VALUE "CompileDate", "martes, 26 de agosto de 2008 12:42\0" VALUE "CompileDate", "miércoles, 27 de agosto de 2008 18:08\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"