diff --git a/Source/Cliente/FactuGES.rc b/Source/Cliente/FactuGES.rc index f539f2fb..1309b1cb 100644 --- a/Source/Cliente/FactuGES.rc +++ b/Source/Cliente/FactuGES.rc @@ -1,7 +1,7 @@ MAINICON ICON "C:\Codigo Tecsitel\Resources\Iconos\Factuges.ico" 1 VERSIONINFO -FILEVERSION 1,2,5,0 -PRODUCTVERSION 1,2,5,0 +FILEVERSION 1,2,6,0 +PRODUCTVERSION 1,2,6,0 FILEFLAGSMASK 0x3FL FILEFLAGS 0x00L FILEOS 0x40004L @@ -13,10 +13,10 @@ BEGIN BLOCK "0C0A04E4" BEGIN 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 "ProductName", "FactuGES\0" - VALUE "ProductVersion", "1.2.5.0\0" + VALUE "ProductVersion", "1.2.6.0\0" END END BLOCK "VarFileInfo" diff --git a/Source/Cliente/FactuGES.res b/Source/Cliente/FactuGES.res index fbb0cc36..dffeb0b9 100644 Binary files a/Source/Cliente/FactuGES.res and b/Source/Cliente/FactuGES.res differ diff --git a/Source/GUIBase/uViewDocumentos.dfm b/Source/GUIBase/uViewDocumentos.dfm index 5a688d7c..48a95b1d 100644 --- a/Source/GUIBase/uViewDocumentos.dfm +++ b/Source/GUIBase/uViewDocumentos.dfm @@ -66,6 +66,7 @@ inherited frViewDocumentos: TfrViewDocumentos end object actActualizarServidor: TAction Caption = 'Actualizar Servidor' + Visible = False OnExecute = actActualizarServidorExecute end end diff --git a/Source/GUIBase/uViewDocumentos.pas b/Source/GUIBase/uViewDocumentos.pas index b8e807ef..443517a6 100644 --- a/Source/GUIBase/uViewDocumentos.pas +++ b/Source/GUIBase/uViewDocumentos.pas @@ -32,20 +32,27 @@ type procedure actModificarExecute(Sender: TObject); procedure actEliminarExecute(Sender: TObject); procedure actEliminarTodoExecute(Sender: TObject); + procedure actActualizarServidorExecute(Sender: TObject); procedure CustomViewCreate(Sender: TObject); procedure CustomViewDestroy(Sender: TObject); - procedure actActualizarServidorExecute(Sender: TObject); + private FDirectorio: Variant; function GetDirectorio: Variant; function DarFicherosSeleccionados: TStringList; + protected - FListaDocumentos: TStringList; - procedure Sincronizar; virtual; abstract; - function RecuperarFicheroServidor(const NombreFichero: String; const DestinoFichero: String): Boolean; virtual; abstract; - procedure Refrescar; virtual; - public + FListaFicheros: TStringList; 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; var @@ -66,7 +73,7 @@ end; procedure TfrViewDocumentos.actAnadirExecute(Sender: TObject); var openDialog : TOpenDialog; - FicheroOrigen : String; + ANombreFichero : String; i : Integer; begin openDialog := TOpenDialog.Create(self); @@ -88,18 +95,20 @@ begin begin for i:=0 to openDialog.Files.Count - 1 do begin - FicheroOrigen := openDialog.Files.Strings[i]; - if Length(FicheroOrigen) > 0 then - CopiarFichero(FicheroOrigen, (Directorio + ExtractFileName(FicheroOrigen))); + ANombreFichero := openDialog.Files.Strings[i]; + if Length(ANombreFichero) > 0 then + CopiarFichero(ANombreFichero, (Directorio + ExtractFileName(ANombreFichero))); //Lo añadimos a la lista de documentos local - FListaDocumentos.Add(ExtractFileName(FicheroOrigen)) + FListaFicheros.Add(ExtractFileName(ANombreFichero)) end; end; finally openDialog.Free; - Refrescar; + //Now, We compact the process memory: + SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF); + RefrescarVisualizador; end; end; @@ -107,34 +116,35 @@ procedure TfrViewDocumentos.actEliminarExecute(Sender: TObject); var i, j: Integer; FicherosSeleccionados: TStringList; - ANombreDocumento: String; + ANombreFichero: String; begin - inherited; - FicherosSeleccionados := DarFicherosSeleccionados; - for i := 0 to FicherosSeleccionados.Count - 1 do - begin - if FileExists(FicherosSeleccionados.Strings[i]) then - if not DeleteFile(FicherosSeleccionados.Strings[i]) then - Application.MessageBox('No se pudo borrar el fichero', 'Error', MB_ICONEXCLAMATION); + try + for i := 0 to FicherosSeleccionados.Count - 1 do + begin + //Buscamos si existen fisicamente y si es así los eliminamos + 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]); - if FListaDocumentos.Find(ANombreDocumento, j) then - FListaDocumentos.Delete(j); + //Lo quitamos de la propiedad donde guardamos lista de documentos + ANombreFichero := ExtractFileName(FicherosSeleccionados.Strings[i]); + if FListaFicheros.Find(ANombreFichero, j) then + FListaFicheros.Delete(j); + end; + finally + FreeAndNil(FicherosSeleccionados); + RefrescarVisualizador; end; - Refrescar; end; procedure TfrViewDocumentos.actEliminarTodoExecute(Sender: TObject); begin -// if (ShowConfirmMessage('¿Desea borrar todos los documentos asociados a este presupuesto de cliente?', '') = IDYES) then -// begin - Deltree(Directorio, True); - FListaDocumentos.Clear; - FDirectorio := Null; -// end; - Refrescar; + Deltree(Directorio, True); + FListaFicheros.Clear; + FDirectorio := Null; + RefrescarVisualizador; end; procedure TfrViewDocumentos.actModificarExecute(Sender: TObject); @@ -142,40 +152,40 @@ var i: Integer; FicherosSeleccionados: TStringList; begin - inherited; - FicherosSeleccionados := DarFicherosSeleccionados; - for i := 0 to FicherosSeleccionados.Count - 1 do - if FileExists(FicherosSeleccionados.Strings[i]) then - begin -// showmessage('Existe: ' + FicherosSeleccionados.Strings[i]); - if ShellExecute(Handle, nil, pchar(FicherosSeleccionados.Strings[i]), - nil, nil, SW_SHOWNORMAL) <= 32 then - Application.MessageBox('No se pudo editar el fichero', 'Error', MB_ICONEXCLAMATION); - end - else - begin -// showmessage('No existe: ' + FicherosSeleccionados.Strings[i]); - if not RecuperarFicheroServidor(ExtractFileName(FicherosSeleccionados.Strings[i]), ExtractFilePath(FicherosSeleccionados.Strings[i])) then - Application.MessageBox('No se pudo RecuperarFicheroServidor', 'Error', MB_ICONEXCLAMATION); + try + for i := 0 to FicherosSeleccionados.Count - 1 do + if FileExists(FicherosSeleccionados.Strings[i]) then + begin + if ShellExecute(Handle, nil, pchar(FicherosSeleccionados.Strings[i]), + nil, nil, SW_SHOWNORMAL) <= 32 then + Application.MessageBox('No se pudo editar el fichero', 'Error', MB_ICONEXCLAMATION); + end + else + begin + if not RecuperarFicheroServidor(ExtractFileName(FicherosSeleccionados.Strings[i]), ExtractFilePath(FicherosSeleccionados.Strings[i])) then + Application.MessageBox('No se pudo RecuperarFicheroServidor', 'Error', MB_ICONEXCLAMATION); - if ShellExecute(Handle, nil, pchar(FicherosSeleccionados.Strings[i]), - nil, nil, SW_SHOWNORMAL) <= 32 then - Application.MessageBox('No se pudo editar el fichero', 'Error', MB_ICONEXCLAMATION); - end; + if ShellExecute(Handle, nil, pchar(FicherosSeleccionados.Strings[i]), + nil, nil, SW_SHOWNORMAL) <= 32 then + Application.MessageBox('No se pudo editar el fichero', 'Error', MB_ICONEXCLAMATION); + end; + finally + FreeAndNil(FicherosSeleccionados) + end; end; procedure TfrViewDocumentos.CustomViewCreate(Sender: TObject); begin inherited; FDirectorio := Null; - FListaDocumentos := Nil; + FListaFicheros := Nil; end; procedure TfrViewDocumentos.CustomViewDestroy(Sender: TObject); begin FDirectorio := Null; - FreeAndNil(FListaDocumentos); + FreeAndNil(FListaFicheros); inherited; end; @@ -202,18 +212,10 @@ begin Result := FDirectorio; end; -procedure TfrViewDocumentos.Refrescar; -var - ADocumentos: TStringList; - i: Integer; +procedure TfrViewDocumentos.RefrescarVisualizador; begin -// ADocumentos := FindFile(Directorio + '*.*'); -// for i := 0 to ADocumentos.Count - 1 do -// ADocumentos.Strings[i] := ExtractFileName(ADocumentos.Strings[i]); - ListaDocumentos.Clear; - ListaDocumentos.Items.AddStrings(FListaDocumentos); -// FreeAndNil(ADocumentos); + ListaDocumentos.Items.AddStrings(FListaFicheros); end; end. diff --git a/Source/Modulos/Gestion de documentos/Controller/GestorDocumentos_controller.drc b/Source/Modulos/Gestion de documentos/Controller/GestorDocumentos_controller.drc index 79342b73..10560082 100644 --- a/Source/Modulos/Gestion de documentos/Controller/GestorDocumentos_controller.drc +++ b/Source/Modulos/Gestion de documentos/Controller/GestorDocumentos_controller.drc @@ -13,4 +13,4 @@ BEGIN END /* 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 */ diff --git a/Source/Modulos/Gestion de documentos/Controller/uGestorDocumentosController.pas b/Source/Modulos/Gestion de documentos/Controller/uGestorDocumentosController.pas index 7d9f6de7..5b46d02f 100644 --- a/Source/Modulos/Gestion de documentos/Controller/uGestorDocumentosController.pas +++ b/Source/Modulos/Gestion de documentos/Controller/uGestorDocumentosController.pas @@ -12,6 +12,7 @@ type 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); + function EliminarDirectorio(const ID: Integer): Boolean; end; TGestorDocumentosController = class(TControllerBase, IGestorDocumentosController) @@ -30,6 +31,7 @@ type 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); + function EliminarDirectorio(const ID: Integer): Boolean; end; implementation @@ -66,6 +68,11 @@ begin inherited; end; +function TGestorDocumentosController.EliminarDirectorio(const ID: Integer): Boolean; +begin + Result := FDataModule.EliminarID(ID); +end; + procedure TGestorDocumentosController.SincronizarDocumentos(const ID: Integer; FListaDocumentos: TStringList; Directorio: String); var diff --git a/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.drc b/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.drc index b4be29cd..b52e145e 100644 --- a/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.drc +++ b/Source/Modulos/Gestion de documentos/Data/GestorDocumentos_data.drc @@ -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\GestorDocumentos_data.res */ -/* C:\DOCUME~1\Usuario\CONFIG~1\Temp\dtf144.tmp */ +/* C:\DOCUME~1\Usuario\CONFIG~1\Temp\dtf371.tmp */ diff --git a/Source/Modulos/Gestion de documentos/Data/uDataModuleGestorDocumentos.pas b/Source/Modulos/Gestion de documentos/Data/uDataModuleGestorDocumentos.pas index 015170d4..0a58a60a 100644 --- a/Source/Modulos/Gestion de documentos/Data/uDataModuleGestorDocumentos.pas +++ b/Source/Modulos/Gestion de documentos/Data/uDataModuleGestorDocumentos.pas @@ -13,6 +13,7 @@ type 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 EliminarFichero(const ID : Integer; const NombreFichero: String): Boolean; + function EliminarID(const ID : Integer): Boolean; end; TDataModuleGestorDocumentos = class(TDataModuleBase, IDataModuleGestorDocumentos) @@ -28,7 +29,7 @@ type 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 EliminarFichero(const ID : Integer; const NombreFichero: String): Boolean; - + function EliminarID(const ID : Integer): Boolean; end; implementation @@ -91,6 +92,16 @@ begin 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; begin Result := False; diff --git a/Source/Modulos/Gestion de documentos/Servidor/srvGestorDocumentos_Impl.pas b/Source/Modulos/Gestion de documentos/Servidor/srvGestorDocumentos_Impl.pas index 11e94808..338269b5 100644 --- a/Source/Modulos/Gestion de documentos/Servidor/srvGestorDocumentos_Impl.pas +++ b/Source/Modulos/Gestion de documentos/Servidor/srvGestorDocumentos_Impl.pas @@ -31,6 +31,7 @@ type 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 EliminarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Boolean; + function EliminarID(const Almacen: TRdxAlmacenes; const ID: Integer): Boolean; end; implementation @@ -99,7 +100,7 @@ begin try GetClassFactory('srvConfiguracion').CreateInstance(AClientID, Intf); AConfiguracionService := Intf as IsrvConfiguracion; - Result := AConfiguracionService.darValor('RUTA'); + Result := AConfiguracionService.darValor('RUTA_DOCUMENTOS'); finally AConfiguracionService := Nil; end; @@ -148,6 +149,28 @@ begin 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; const Fichero: Binary): Boolean; var @@ -160,7 +183,11 @@ begin case Almacen of TRdxAlmacenes_Presupuestos: 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); Result := True; end; diff --git a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas index e96bba35..af0263b7 100644 --- a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas +++ b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas @@ -20,6 +20,7 @@ type procedure SetDetallesController(const Value: IDetallesPresupuestoClienteController); property DetallesController: IDetallesPresupuestoClienteController read GetDetallesController write SetDetallesController; + //GESTION_DOCUMENTOS function GetGestorDocumentosController: IGestorDocumentosController; procedure SetGestorDocumentosController(const Value: IGestorDocumentosController); property GestorDocumentosController: IGestorDocumentosController read GetGestorDocumentosController write SetGestorDocumentosController; @@ -58,13 +59,6 @@ type procedure EnviarPresupuestoPorEMail(APresupuesto : IBizPresupuestoCliente); function GenerarCertificados(APresupuesto : IBizPresupuestoCliente; 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; TPresupuestosClienteController = class(TControllerBase, IPresupuestosClienteController) @@ -78,6 +72,8 @@ type procedure SetClienteController(const Value: IClientesController); function GetDetallesController: IDetallesPresupuestoClienteController; procedure SetDetallesController(const Value: IDetallesPresupuestoClienteController); + + //GESTION_DOCUMENTOS function GetGestorDocumentosController: IGestorDocumentosController; procedure SetGestorDocumentosController(const Value: IGestorDocumentosController); @@ -133,13 +129,6 @@ type function GenerarCertificados(APresupuesto : IBizPresupuestoCliente; AllItems: Boolean = false): Boolean; procedure EnviarPresupuestoPorEMail(APresupuesto : IBizPresupuestoCliente); 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; implementation @@ -356,7 +345,10 @@ begin FClienteController := TClientesController.Create; FDetallesController := TDetallesPresupuestoClienteController.Create; - FGestorDocumentosController := TGestorDocumentosController.Create; + + //GESTION_DOCUMENTOS + FGestorDocumentosController := TGestorDocumentosController.Create; + FDetallesController.addObservador(Self); end; @@ -399,7 +391,9 @@ begin FDataModule := Nil; FClienteController := Nil; FDetallesController := Nil; - FGestorDocumentosController := Nil; + + //GESTION_DOCUMENTOS + FGestorDocumentosController := Nil; inherited; end; @@ -624,6 +618,9 @@ begin //Siempre eliminaremos el seleccionado if EsEliminable(APresupuesto) then begin + //GESTION_DOCUMENTOS + FGestorDocumentosController.EliminarDirectorio(APresupuesto.ID); + APresupuesto.Delete; bEliminado := True; end; @@ -638,6 +635,9 @@ begin begin if EsEliminable(APresupuesto) then begin + //GESTION_DOCUMENTOS + FGestorDocumentosController.EliminarDirectorio(APresupuesto.ID); + APresupuesto.Delete; bEliminado := True end @@ -867,8 +867,6 @@ begin try APresupuesto.DataTable.ApplyUpdates; -// ApplyUpdatesDocumentos; - Result := True; finally HideHourglassCursor; diff --git a/Source/Modulos/Presupuestos de cliente/Views/uEditorPresupuestoCliente.dfm b/Source/Modulos/Presupuestos de cliente/Views/uEditorPresupuestoCliente.dfm index 03f17139..cab7c3b3 100644 --- a/Source/Modulos/Presupuestos de cliente/Views/uEditorPresupuestoCliente.dfm +++ b/Source/Modulos/Presupuestos de cliente/Views/uEditorPresupuestoCliente.dfm @@ -199,108 +199,116 @@ inherited fEditorPresupuestoCliente: TfEditorPresupuestoCliente ExplicitHeight = 386 inherited ToolBar1: TToolBar Width = 735 - Height = 78 + Height = 46 ExplicitWidth = 735 - ExplicitHeight = 78 - inherited ToolButton4: TToolButton [1] + ExplicitHeight = 46 + inherited ToolButton4: TToolButton Left = 109 Top = 0 ExplicitLeft = 109 ExplicitTop = 0 end - inherited ToolButton14: TToolButton [2] + inherited FontName: TJvFontComboBox [2] Left = 165 Top = 0 ExplicitLeft = 165 ExplicitTop = 0 end - inherited FontName: TJvFontComboBox [3] - Left = 230 + inherited FontSize: TEdit [3] + Left = 310 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 end - inherited FontSize: TEdit [4] - Left = 375 + inherited ToolButton3: TToolButton [5] + Left = 527 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 + ExplicitLeft = 527 + ExplicitTop = 0 + end + inherited ToolButton2: TToolButton [6] + Top = 22 + Wrap = True + end + inherited ToolButton14: TToolButton + Left = 0 + Top = 44 ExplicitLeft = 0 - ExplicitHeight = 27 + ExplicitTop = 44 end - inherited ToolButton2: TToolButton [7] + inherited ToolButton13: TToolButton [8] + Left = 65 + Top = 44 + ExplicitLeft = 65 + ExplicitTop = 44 end - inherited ToolButton6: TToolButton [8] - Left = 114 - Top = 27 - ExplicitLeft = 114 - ExplicitTop = 27 + inherited ToolButton6: TToolButton [9] + Left = 73 + Top = 44 + ExplicitLeft = 73 + ExplicitTop = 44 end - inherited ToolButton7: TToolButton [9] - Left = 180 - Top = 27 - ExplicitLeft = 180 - ExplicitTop = 27 + inherited ToolButton7: TToolButton [10] + Left = 139 + Top = 44 + ExplicitLeft = 139 + ExplicitTop = 44 end - inherited ToolButton8: TToolButton [10] - Left = 247 - Top = 27 - ExplicitLeft = 247 - ExplicitTop = 27 + inherited ToolButton8: TToolButton [11] + Left = 206 + Top = 44 + ExplicitLeft = 206 + ExplicitTop = 44 end - inherited ToolButton12: TToolButton [11] - Top = 27 - ExplicitTop = 27 - end - inherited ToolButton3: TToolButton [12] - Top = 54 - ExplicitTop = 54 + inherited ToolButton12: TToolButton [12] + Left = 289 + Top = 44 + Wrap = False + ExplicitLeft = 289 + ExplicitTop = 44 + ExplicitHeight = 22 end inherited ToolButton9: TToolButton [13] - Left = 55 - Top = 54 - Wrap = False - ExplicitLeft = 55 - ExplicitTop = 54 + Left = 297 + Top = 44 + ExplicitLeft = 297 + ExplicitTop = 44 end inherited ToolButton10: TToolButton [14] - Left = 200 - Top = 54 + Left = 442 + Top = 44 Wrap = False - ExplicitLeft = 200 - ExplicitTop = 54 + ExplicitLeft = 442 + ExplicitTop = 44 end inherited ToolButton11: TToolButton - Left = 325 - Top = 54 - ExplicitLeft = 325 - ExplicitTop = 54 + Left = 567 + Top = 44 + ExplicitLeft = 567 + ExplicitTop = 44 end end inherited cxGrid: TcxGrid - Top = 104 + Top = 72 Width = 735 - Height = 282 - ExplicitTop = 99 + Height = 314 + ExplicitTop = 72 ExplicitWidth = 735 - ExplicitHeight = 287 + ExplicitHeight = 314 end inherited TBXDock1: TTBXDock - Top = 78 + Top = 46 Width = 735 - ExplicitTop = 73 + ExplicitTop = 46 ExplicitWidth = 735 inherited TBXToolbar1: TTBXToolbar ExplicitWidth = 702 diff --git a/Source/Modulos/Presupuestos de cliente/Views/uEditorPresupuestoCliente.pas b/Source/Modulos/Presupuestos de cliente/Views/uEditorPresupuestoCliente.pas index b650831e..e9448427 100644 --- a/Source/Modulos/Presupuestos de cliente/Views/uEditorPresupuestoCliente.pas +++ b/Source/Modulos/Presupuestos de cliente/Views/uEditorPresupuestoCliente.pas @@ -57,6 +57,7 @@ type procedure pgPaginasChanging(Sender: TObject; var AllowChange: Boolean); procedure actEnviarPorEMailExecute(Sender: TObject); procedure actEnviarPorEMailUpdate(Sender: TObject); + procedure actEliminarUpdate(Sender: TObject); private procedure RecalcularPortePorUnidad; @@ -108,6 +109,13 @@ uses { **************************** 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); begin inherited; @@ -161,6 +169,9 @@ procedure TfEditorPresupuestoCliente.CustomEditorClose(Sender: TObject; var Action: TCloseAction); begin inherited; + //GESTION_DOCUMENTOS + //Este método eliminará el directorio temporal si se ha creado + frViewDocumentosPresupuestoCliente1.actEliminarTodo.Execute; FViewPresupuesto := NIL; FPresupuesto := NIL; end; @@ -233,10 +244,10 @@ begin frViewDetallesPresupuestoCliente1.BeginUpdate; try 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 frViewDetallesPresupuestoCliente1.EndUpdate; // frViewDetallesPresupuestoCliente1.RestoreGridStatus; @@ -365,6 +376,8 @@ begin begin ViewPresupuesto.ViewClientePresupuesto.Controller := Controller.ClienteController; frViewDetallesPresupuestoCliente1.Controller := Controller.DetallesController; + + //GESTION_DOCUMENTOS frViewDocumentosPresupuestoCliente1.Controller := Controller; end; end; @@ -386,6 +399,8 @@ begin ViewPresupuesto.ViewClientePresupuesto.OnClienteChanged := OnClienteChanged; frViewDetallesPresupuestoCliente1.Detalles := FPresupuesto.Detalles; frViewDetallesPresupuestoCliente1.Presupuesto := FPresupuesto; //Para poder sacar los descuento del articulos segun el cliente seleccionado + + //GESTION_DOCUMENTOS frViewDocumentosPresupuestoCliente1.Presupuesto := FPresupuesto; end; end; diff --git a/Source/Modulos/Presupuestos de cliente/Views/uViewDocumentosPresupuestoCliente.pas b/Source/Modulos/Presupuestos de cliente/Views/uViewDocumentosPresupuestoCliente.pas index 8689f78b..66bae2fe 100644 --- a/Source/Modulos/Presupuestos de cliente/Views/uViewDocumentosPresupuestoCliente.pas +++ b/Source/Modulos/Presupuestos de cliente/Views/uViewDocumentosPresupuestoCliente.pas @@ -36,8 +36,7 @@ type protected procedure Sincronizar; override; - function RecuperarFicheroServidor(const NombreFichero: String; const DestinoFichero: String): Boolean; override; - procedure Refrescar; override; + function RecuperarFicheroServidor(const NombreFichero: String; const DirectorioDestino: String): Boolean; override; public property Controller : IPresupuestosClienteController read GetController write SetController; @@ -63,21 +62,10 @@ begin Result := FPresupuesto; end; -function TfrViewDocumentosPresupuestoCliente.RecuperarFicheroServidor(const NombreFichero: String; const DestinoFichero: String): Boolean; +function TfrViewDocumentosPresupuestoCliente.RecuperarFicheroServidor(const NombreFichero: String; const DirectorioDestino: String): Boolean; begin inherited; - Result := Controller.GestorDocumentosController.DescargarFichero(Presupuesto.ID, NombreFichero, DestinoFichero); -end; - -procedure TfrViewDocumentosPresupuestoCliente.Refrescar; -var - ADocumentos: TStringList; - -begin - inherited; -// ADocumentos := Controller.DarListaDocumentos(Presupuesto.ID); -// ListaDocumentos.Items.AddStrings(ADocumentos); -// FreeAndNil(ADocumentos); + Result := Controller.GestorDocumentosController.DescargarFichero(Presupuesto.ID, NombreFichero, DirectorioDestino); end; procedure TfrViewDocumentosPresupuestoCliente.SetController(const Value: IPresupuestosClienteController); @@ -90,14 +78,27 @@ begin FPresupuesto := Value; //Inicializamos la lista de documentos local con los ficheros del servidor if Assigned(FPresupuesto) and Assigned(FController) then - FListaDocumentos := Controller.GestorDocumentosController.DarListaDocumentos(Presupuesto.ID); - Refrescar; + FListaFicheros := Controller.GestorDocumentosController.DarListaDocumentos(Presupuesto.ID); + + RefrescarVisualizador; end; procedure TfrViewDocumentosPresupuestoCliente.Sincronizar; begin 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. diff --git a/Source/Servicios/FactuGES.RODL b/Source/Servicios/FactuGES.RODL index 275473fd..d2610152 100644 --- a/Source/Servicios/FactuGES.RODL +++ b/Source/Servicios/FactuGES.RODL @@ -509,6 +509,16 @@ + + + + + + + + + + diff --git a/Source/Servicios/FactuGES_Intf.pas b/Source/Servicios/FactuGES_Intf.pas index 90828fe3..9438e926 100644 --- a/Source/Servicios/FactuGES_Intf.pas +++ b/Source/Servicios/FactuGES_Intf.pas @@ -722,6 +722,7 @@ type 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 EliminarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Boolean; + function EliminarID(const Almacen: TRdxAlmacenes; const ID: Integer): Boolean; end; { CosrvGestorDocumentos } @@ -738,6 +739,7 @@ type 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 EliminarFichero(const Almacen: TRdxAlmacenes; const ID: Integer; const NombreFichero: String): Boolean; + function EliminarID(const Almacen: TRdxAlmacenes; const ID: Integer): Boolean; end; implementation @@ -2049,6 +2051,23 @@ begin 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 RegisterROClass(TRdxLoginInfo); RegisterROClass(TRdxEmpresasArray); diff --git a/Source/Servicios/FactuGES_Invk.pas b/Source/Servicios/FactuGES_Invk.pas index c839c7f3..7784a65e 100644 --- a/Source/Servicios/FactuGES_Invk.pas +++ b/Source/Servicios/FactuGES_Invk.pas @@ -218,6 +218,7 @@ type 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_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; implementation @@ -1114,5 +1115,27 @@ begin 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 end. diff --git a/Source/Servicios/RODLFILE.res b/Source/Servicios/RODLFILE.res index 6ed57c5c..558c9d83 100644 Binary files a/Source/Servicios/RODLFILE.res and b/Source/Servicios/RODLFILE.res differ diff --git a/Source/Servidor/FactuGES_Server.RES b/Source/Servidor/FactuGES_Server.RES index 684eacbd..88b8d25c 100644 Binary files a/Source/Servidor/FactuGES_Server.RES and b/Source/Servidor/FactuGES_Server.RES differ diff --git a/Source/Servidor/FactuGES_Server.rc b/Source/Servidor/FactuGES_Server.rc index 47ff2e74..9f27724f 100644 --- a/Source/Servidor/FactuGES_Server.rc +++ b/Source/Servidor/FactuGES_Server.rc @@ -1,7 +1,7 @@ MAINICON ICON "C:\Codigo Tecsitel\Resources\Iconos\Servidor.ico" 1 VERSIONINFO -FILEVERSION 1,2,5,0 -PRODUCTVERSION 1,2,5,0 +FILEVERSION 1,2,4,0 +PRODUCTVERSION 1,2,4,0 FILEFLAGSMASK 0x3FL FILEFLAGS 0x00L FILEOS 0x40004L @@ -12,9 +12,9 @@ BEGIN BEGIN BLOCK "0C0A04E4" BEGIN - VALUE "FileVersion", "1.2.5.0\0" - VALUE "ProductVersion", "1.2.5.0\0" - VALUE "CompileDate", "martes, 26 de agosto de 2008 12:42\0" + VALUE "FileVersion", "1.2.4.0\0" + VALUE "ProductVersion", "1.2.4.0\0" + VALUE "CompileDate", "miércoles, 27 de agosto de 2008 18:08\0" END END BLOCK "VarFileInfo"