diff --git a/Source/ApplicationBase/Ejercicios/Controller/uEjerciciosController.pas b/Source/ApplicationBase/Ejercicios/Controller/uEjerciciosController.pas index c7175e00..33c66ec7 100644 --- a/Source/ApplicationBase/Ejercicios/Controller/uEjerciciosController.pas +++ b/Source/ApplicationBase/Ejercicios/Controller/uEjerciciosController.pas @@ -224,21 +224,20 @@ var AEditor : IEditorEjercicio; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorEjercicio', IEditorEjercicio, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorEjercicio) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Ejercicio := AEjercicio; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorEjercicio', IEditorEjercicio, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorEjercicio) do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Ejercicio := AEjercicio; + ShowModal; + finally + Release; + AEditor := NIL + end; + end; end; procedure TEjerciciosController.VerTodos(AEjercicios: IBizEjercicio); @@ -246,20 +245,15 @@ var AEditor : IEditorEjercicios; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorEjercicios', IEditorEjercicios, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Ejercicios := AEjercicios; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorEjercicios', IEditorEjercicios, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Ejercicios := AEjercicios; + ShowEmbedded; + end; end; function TEjerciciosController.Eliminar(AEjercicio: IBizEjercicio): Boolean; diff --git a/Source/ApplicationBase/Empresas/Controller/uDatosBancariosEmpresaController.pas b/Source/ApplicationBase/Empresas/Controller/uDatosBancariosEmpresaController.pas index e7fce7dc..e4fc5d02 100644 --- a/Source/ApplicationBase/Empresas/Controller/uDatosBancariosEmpresaController.pas +++ b/Source/ApplicationBase/Empresas/Controller/uDatosBancariosEmpresaController.pas @@ -31,21 +31,20 @@ var AEditor : IEditorDatosBancariosEmpresa; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorDatosBancariosEmpresa', IEditorDatosBancariosEmpresa, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - DatosBancarios := ADatosBancarios; - Controller := Self; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorDatosBancariosEmpresa', IEditorDatosBancariosEmpresa, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + DatosBancarios := ADatosBancarios; + Controller := Self; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; end. diff --git a/Source/ApplicationBase/Empresas/Controller/uEmpresasController.pas b/Source/ApplicationBase/Empresas/Controller/uEmpresasController.pas index 30e609cf..b32e80ab 100644 --- a/Source/ApplicationBase/Empresas/Controller/uEmpresasController.pas +++ b/Source/ApplicationBase/Empresas/Controller/uEmpresasController.pas @@ -262,21 +262,20 @@ var AEditor : IEditorEmpresa; begin AEditor := NIL; - ShowHourglassCursor; - try + CreateEditor('EditorEmpresa', IEditorEmpresa, AEditor); if Assigned(AEditor) then - with AEditor do - begin - Empresa := AEmpresa; - Controller := Self; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + with AEditor do + begin + try + Empresa := AEmpresa; + Controller := Self; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TEmpresasController.VerTodos(AEmpresas: IBizEmpresa); @@ -284,8 +283,6 @@ procedure TEmpresasController.VerTodos(AEmpresas: IBizEmpresa); AEditor : IEditorEmpresas;} begin { AEditor := NIL; - ShowHourglassCursor; - try CreateEditor('EditorEmpresas', IEditorEmpresas, AEditor); if Assigned(AEditor) then with AEditor do @@ -294,10 +291,7 @@ begin Controller := Self; ShowEmbedded; end; - finally - AEditor := NIL; - HideHourglassCursor; - end;} +} end; end. diff --git a/Source/ApplicationBase/Empresas/Controller/uTiendasEmpresaController.pas b/Source/ApplicationBase/Empresas/Controller/uTiendasEmpresaController.pas index 7c63bbec..5120e69a 100644 --- a/Source/ApplicationBase/Empresas/Controller/uTiendasEmpresaController.pas +++ b/Source/ApplicationBase/Empresas/Controller/uTiendasEmpresaController.pas @@ -79,21 +79,20 @@ var AEditor : IEditorTiendaEmpresa; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorTiendaEmpresa', IEditorTiendaEmpresa, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Tienda := ATienda; - Controller := Self; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorTiendaEmpresa', IEditorTiendaEmpresa, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Tienda := ATienda; + Controller := Self; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; diff --git a/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas b/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas index b6eceb96..2514f1b3 100644 --- a/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas +++ b/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas @@ -781,21 +781,20 @@ begin raise Exception.Create('Perfil no asignado (VerPerfil)'); APerfil.Active := True; - ShowHourglassCursor; - try - CreateEditor('EditorPerfilUsuario', IEditorPerfilUsuario, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorPerfilUsuario) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - PerfilUsuario := APerfil; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorPerfilUsuario', IEditorPerfilUsuario, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorPerfilUsuario) do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + PerfilUsuario := APerfil; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TUsuariosController.VerPerfiles; @@ -804,24 +803,18 @@ var APerfilesUsuario: IBizPerfilUsuario; begin APerfilesUsuario := FDataModule.GetPerfiles; + if Assigned(APerfilesUsuario) then begin APerfilesUsuario.Active := True; - ShowHourglassCursor; - try - CreateEditor('EditorPerfilesUsuario', IEditorPerfilesUsuario, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorPerfilesUsuario) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - PerfilesUsuario := APerfilesUsuario; - ShowEmbedded; - end; - finally - AEditor := NIL; - APerfilesUsuario := NIL; - HideHourglassCursor; - end; + CreateEditor('EditorPerfilesUsuario', IEditorPerfilesUsuario, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorPerfilesUsuario) do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + PerfilesUsuario := APerfilesUsuario; + ShowEmbedded; + end; end; end; @@ -841,21 +834,20 @@ begin raise Exception.Create('Usuario no asignado (VerUsuario)'); AUser.Active := True; - ShowHourglassCursor; - try - CreateEditor('EditorUsuario', IEditorUsuario, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorUsuario) do - begin + + CreateEditor('EditorUsuario', IEditorUsuario, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorUsuario) do + begin + try Controller := Self; //OJO ORDEN MUY IMPORTANTE Usuario := AUser; ShowModal; + finally Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + AEditor := NIL; + end; + end; end; procedure TUsuariosController.VerUsuarios; @@ -867,21 +859,14 @@ begin if Assigned(FUsuarios) then begin FUsuarios.Active := True; - ShowHourglassCursor; - try - CreateEditor('EditorUsuarios', IEditorUsuarios, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorUsuarios) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Usuarios := FUsuarios; - ShowEmbedded; - end; - finally - AEditor := NIL; - FUsuarios := NIL; - HideHourglassCursor; - end; + CreateEditor('EditorUsuarios', IEditorUsuarios, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorUsuarios) do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Usuarios := FUsuarios; + ShowEmbedded; + end; end; end; @@ -896,20 +881,19 @@ var begin Result := False; AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorLogin', IEditorLogin, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Result := (AEditor.ShowModal = mrOk); - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorLogin', IEditorLogin, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Result := (AEditor.ShowModal = mrOk); + finally + Release; + AEditor := NIL; + end; + end; end; diff --git a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas index 62ccc765..efff4517 100644 --- a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas +++ b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas @@ -547,40 +547,37 @@ var AEditor : IEditorDBItem; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(AAlbaran); - if (AAlbaran.TIPO = CTE_TIPO_ALBARAN) then - CreateEditor('EditorAlbaranCliente', IEditorAlbaranCliente, AEditor) - else - CreateEditor('EditorAlbaranDevCliente', IEditorAlbaranDevCliente, AEditor); + RecuperarObjetos(AAlbaran); - if Assigned(AEditor) then - with (AEditor as IEditorAlbaranCliente) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Albaran := AAlbaran; + if (AAlbaran.TIPO = CTE_TIPO_ALBARAN) then + CreateEditor('EditorAlbaranCliente', IEditorAlbaranCliente, AEditor) + else + CreateEditor('EditorAlbaranDevCliente', IEditorAlbaranDevCliente, AEditor); + + if Assigned(AEditor) then + with (AEditor as IEditorAlbaranCliente) do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Albaran := AAlbaran; //MODO CONSULTAR if not EsModificable(AAlbaran) then begin - SetDataTableReadOnly(AAlbaran.DataTable, True); - ReadOnly := True; + SetDataTableReadOnly(AAlbaran.DataTable, True); + ReadOnly := True; end; ShowModal; //MODO CONSULTAR (Se deja la tabla como estaba) if ReadOnly then - SetDataTableReadOnly(AAlbaran.DataTable, False); - - AEditor.Release; + SetDataTableReadOnly(AAlbaran.DataTable, False); + finally + AEditor.Release; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; procedure TAlbaranesClienteController.VerDireccionEntrega( @@ -589,21 +586,18 @@ var AEditor : IEditorDireccionEntregaAlbaranCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - //RecuperarObjetos(AAlbaran); <- No descomentar. No hace falta - CreateEditor('EditorDireccionEntregaAlbaranCliente', IEditorDireccionEntregaAlbaranCliente, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorDireccionEntregaAlbaranCliente) do - begin - Albaran := AAlbaran; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + //RecuperarObjetos(AAlbaran); <- No descomentar. No hace falta + CreateEditor('EditorDireccionEntregaAlbaranCliente', IEditorDireccionEntregaAlbaranCliente, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorDireccionEntregaAlbaranCliente) do + try + Albaran := AAlbaran; + ShowModal; + finally + Release; + AEditor := NIL; + end; end; procedure TAlbaranesClienteController.VerTodosAlbaranes(AAlbarans: IBizAlbaranCliente); @@ -611,21 +605,16 @@ var AEditor : IEditorAlbaranesCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorAlbaranesCliente', IEditorAlbaranesCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Albaranes := AAlbarans; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorAlbaranesCliente', IEditorAlbaranesCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Albaranes := AAlbarans; + MultiSelect := True; + ShowEmbedded; + end; end; procedure TAlbaranesClienteController.VerTodosAlbaranesDev(AAlbarans: IBizAlbaranCliente); @@ -633,21 +622,16 @@ var AEditor : IEditorAlbaranesDevCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorAlbaranesDevCliente', IEditorAlbaranesDevCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Albaranes := AAlbarans; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorAlbaranesDevCliente', IEditorAlbaranesDevCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Albaranes := AAlbarans; + MultiSelect := True; + ShowEmbedded; + end; end; function TAlbaranesClienteController._Vacio: IBizAlbaranCliente; @@ -673,24 +657,23 @@ var AEditor : IEditorElegirAlbaranesCliente; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirAlbaranesCliente', IEditorElegirAlbaranesCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Albaranes := AAlbaran; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := AlbaranesClienteSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorElegirAlbaranesCliente', IEditorElegirAlbaranesCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Albaranes := AAlbaran; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := AlbaranesClienteSeleccionados; + finally + Release; + AEditor := NIL; + end; + end; end; function TAlbaranesClienteController.Eliminar(AAlbaran: IBizAlbaranCliente; AllItems: Boolean = false): Boolean; diff --git a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteReportController.pas b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteReportController.pas index c46e3017..aaa3d124 100644 --- a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteReportController.pas +++ b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteReportController.pas @@ -68,24 +68,23 @@ var AEditor : IEditorAlbaranesClientePreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetEtiquetas(AID, withRefCliente); try - AStream := FDataModule.GetEtiquetas(AID, withRefCliente); - try - CreateEditor('EditorAlbaranesClientePreview', IEditorAlbaranesClientePreview, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorAlbaranesClientePreview', IEditorAlbaranesClientePreview, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try LoadFromStream(AStream); Preview; + finally Release; + AEditor := NIL; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); end; end; @@ -95,6 +94,7 @@ var AEditor : IEditorAlbaranesClientePreview; begin AEditor := NIL; + ShowHourglassCursor; try AStream := FDataModule.GetEtiquetas(AID, withRefCliente); @@ -103,13 +103,16 @@ begin if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Print; - Release; + try + LoadFromStream(AStream); + Print; + finally + Release; + AEditor := Nil; + end; end; finally FreeAndNil(AStream); - AEditor := Nil; end; finally HideHourglassCursor; @@ -145,29 +148,25 @@ var AEditor : IEditorAlbaranesClientePreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetRptAlbaranes(AListaID); try - AStream := FDataModule.GetRptAlbaranes(AListaID); - try - CreateEditor('EditorAlbaranesClientePreview', IEditorAlbaranesClientePreview, AEditor); - if Assigned(AEditor) then - begin - try - AEditor.Controller := Self; - AEditor.ListaID := AListaID; - AEditor.Title := 'Albarán - ' + AppFactuGES.EmpresaActiva.NOMBRE; - AEditor.LoadFromStream(AStream); - AEditor.Preview; - finally - AEditor.Release; - end; + CreateEditor('EditorAlbaranesClientePreview', IEditorAlbaranesClientePreview, AEditor); + if Assigned(AEditor) then + begin + try + AEditor.Controller := Self; + AEditor.ListaID := AListaID; + AEditor.Title := 'Albarán - ' + AppFactuGES.EmpresaActiva.NOMBRE; + AEditor.LoadFromStream(AStream); + AEditor.Preview; + finally + AEditor.Release; + AEditor := Nil; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); end; end; @@ -177,6 +176,7 @@ var AEditor : IEditorAlbaranesClientePreview; begin AEditor := NIL; + ShowHourglassCursor; try AStream := FDataModule.GetRptAlbaranes(AListaID); @@ -192,11 +192,11 @@ begin AEditor.Print; finally AEditor.Release; + AEditor := Nil; end; end; finally FreeAndNil(AStream); - AEditor := Nil; end; finally HideHourglassCursor; diff --git a/Source/Modulos/Albaranes de cliente/Controller/uArticulosAlbaranClienteController.pas b/Source/Modulos/Albaranes de cliente/Controller/uArticulosAlbaranClienteController.pas index fa1531ad..126ef5e5 100644 --- a/Source/Modulos/Albaranes de cliente/Controller/uArticulosAlbaranClienteController.pas +++ b/Source/Modulos/Albaranes de cliente/Controller/uArticulosAlbaranClienteController.pas @@ -27,24 +27,23 @@ var AEditor : IEditorElegirArticulosAlbaranesCliente; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirArticulosAlbaranesCliente', IEditorElegirArticulosAlbaranesCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Articulos := AArticulos; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := ArticulosSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorElegirArticulosAlbaranesCliente', IEditorElegirArticulosAlbaranesCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Articulos := AArticulos; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := ArticulosSeleccionados; + finally + Release; + AEditor := NIL; + end; + end; end; end. diff --git a/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorController.pas b/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorController.pas index 83268066..82b1e78d 100644 --- a/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorController.pas +++ b/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorController.pas @@ -616,18 +616,18 @@ var AEditor : IEditorDBItem; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(AAlbaran); - if (AAlbaran.TIPO = CTE_TIPO_ALBARAN) then - CreateEditor('EditorAlbaranProveedor', IEditorAlbaranProveedor, AEditor) - else - CreateEditor('EditorAlbaranDevProveedor', IEditorAlbaranDevProveedor, AEditor); + RecuperarObjetos(AAlbaran); - if Assigned(AEditor) then - with (AEditor as IEditorAlbaranProveedor) do - begin + if (AAlbaran.TIPO = CTE_TIPO_ALBARAN) then + CreateEditor('EditorAlbaranProveedor', IEditorAlbaranProveedor, AEditor) + else + CreateEditor('EditorAlbaranDevProveedor', IEditorAlbaranDevProveedor, AEditor); + + if Assigned(AEditor) then + with (AEditor as IEditorAlbaranProveedor) do + begin + try Controller := Self; //OJO ORDEN MUY IMPORTANTE Albaran := AAlbaran; @@ -643,12 +643,9 @@ begin //MODO CONSULTAR (Se deja la tabla como estaba) if ReadOnly then SetDataTableReadOnly(AAlbaran.DataTable, False); - + finally AEditor.Release; end; - finally - AEditor := NIL; - HideHourglassCursor; end; end; @@ -657,21 +654,20 @@ var AEditor : IEditorDireccionEntregaAlbaranProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - //RecuperarObjetos(AAlbaran); <- No descomentar. No hace falta - CreateEditor('EditorDireccionEntregaAlbaranProveedor', IEditorDireccionEntregaAlbaranProveedor, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorDireccionEntregaAlbaranProveedor) do - begin - Albaran := AAlbaran; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + //RecuperarObjetos(AAlbaran); <- No descomentar. No hace falta + CreateEditor('EditorDireccionEntregaAlbaranProveedor', IEditorDireccionEntregaAlbaranProveedor, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorDireccionEntregaAlbaranProveedor) do + begin + try + Albaran := AAlbaran; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TAlbaranesProveedorController.VerTodosAlbaranes(AAlbarans: IBizAlbaranProveedor); @@ -679,21 +675,16 @@ var AEditor : IEditorAlbaranesProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorAlbaranesProveedor', IEditorAlbaranesProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Albaranes := AAlbarans; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorAlbaranesProveedor', IEditorAlbaranesProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Albaranes := AAlbarans; + MultiSelect := True; + ShowEmbedded; + end; end; procedure TAlbaranesProveedorController.VerTodosAlbaranesDev(AAlbarans: IBizAlbaranProveedor); @@ -701,21 +692,16 @@ var AEditor : IEditorAlbaranesDevProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorAlbaranesDevProveedor', IEditorAlbaranesDevProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Albaranes := AAlbarans; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorAlbaranesDevProveedor', IEditorAlbaranesDevProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Albaranes := AAlbarans; + MultiSelect := True; + ShowEmbedded; + end; end; function TAlbaranesProveedorController._Vacio: IBizAlbaranProveedor; @@ -741,24 +727,23 @@ var AEditor : IEditorElegirAlbaranesProveedor; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirAlbaranesProveedor', IEditorElegirAlbaranesProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Albaranes := AAlbaran; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := AlbaranesProveedorSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorElegirAlbaranesProveedor', IEditorElegirAlbaranesProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Albaranes := AAlbaran; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := AlbaranesProveedorSeleccionados; + finally + Release; + AEditor := NIL; + end; + end; end; function TAlbaranesProveedorController.Eliminar(AAlbaran: IBizAlbaranProveedor; AllItems: Boolean = false): Boolean; diff --git a/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorReportController.pas b/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorReportController.pas index fad9b88a..011a9c5a 100644 --- a/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorReportController.pas +++ b/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorReportController.pas @@ -60,24 +60,23 @@ var AEditor : IEditorAlbaranesProveedorPreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetReport(AID); try - AStream := FDataModule.GetReport(AID); - try - CreateEditor('EditorAlbaranesProveedorPreview', IEditorAlbaranesProveedorPreview, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorAlbaranesProveedorPreview', IEditorAlbaranesProveedorPreview, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try LoadFromStream(AStream); Preview; + finally Release; + AEditor := NIL; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); end; end; @@ -95,13 +94,16 @@ begin if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Print; - Release; + try + LoadFromStream(AStream); + Print; + finally + Release; + AEditor := Nil; + end; end; finally FreeAndNil(AStream); - AEditor := Nil; end; finally HideHourglassCursor; diff --git a/Source/Modulos/Albaranes de proveedor/Controller/uArticulosAlbaranProveedorController.pas b/Source/Modulos/Albaranes de proveedor/Controller/uArticulosAlbaranProveedorController.pas index f500c3f3..cc520339 100644 --- a/Source/Modulos/Albaranes de proveedor/Controller/uArticulosAlbaranProveedorController.pas +++ b/Source/Modulos/Albaranes de proveedor/Controller/uArticulosAlbaranProveedorController.pas @@ -27,25 +27,24 @@ var AEditor : IEditorElegirArticulosAlbaranesProveedor; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirArticulosAlbaranesProveedor', IEditorElegirArticulosAlbaranesProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Articulos := AArticulos; - Proveedor := AProveedor; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := ArticulosSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorElegirArticulosAlbaranesProveedor', IEditorElegirArticulosAlbaranesProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Articulos := AArticulos; + Proveedor := AProveedor; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := ArticulosSeleccionados; + finally + Release; + AEditor := NIL; + end; + end; end; end. diff --git a/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas b/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas index 394af6d4..3944f557 100644 --- a/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas +++ b/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas @@ -208,22 +208,21 @@ var AEditor : IEditorDBItem; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(AAlmacen); - CreateEditor('EditorAlmacen', IEditorAlmacen, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorAlmacen) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Almacen := AAlmacen; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + RecuperarObjetos(AAlmacen); + CreateEditor('EditorAlmacen', IEditorAlmacen, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorAlmacen) do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Almacen := AAlmacen; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; function TAlmacenesController.VerLista(AAlmacenes: IBizAlmacen): IBizAlmacen; @@ -232,21 +231,20 @@ var begin AEditor := NIL; Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorListaAlmacenes', IEditorListaAlmacenes, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Almacenes := AAlmacenes; - if IsPositiveResult(ShowModal) then + + CreateEditor('EditorListaAlmacenes', IEditorListaAlmacenes, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Almacenes := AAlmacenes; + if IsPositiveResult(ShowModal) then Result := AlmacenSeleccionado; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TAlmacenesController.VerTodos(AAlmacenes: IBizAlmacen); @@ -254,19 +252,15 @@ var AEditor : IEditorAlmacenes; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorAlmacenes', IEditorAlmacenes, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Almacenes := AAlmacenes; - ShowEmbedded; - end; - finally - HideHourglassCursor; - end; + + CreateEditor('EditorAlmacenes', IEditorAlmacenes, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Almacenes := AAlmacenes; + ShowEmbedded; + end; end; function TAlmacenesController._Vacio: IBizAlmacen; diff --git a/Source/Modulos/Articulos/Controller/uArticulosController.pas b/Source/Modulos/Articulos/Controller/uArticulosController.pas index 3e9337a8..45a7060e 100644 --- a/Source/Modulos/Articulos/Controller/uArticulosController.pas +++ b/Source/Modulos/Articulos/Controller/uArticulosController.pas @@ -395,23 +395,22 @@ var AEditor : IEditorArticulo; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(AArticulo); - CreateEditor('EditorArticulo', IEditorArticulo, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorArticulo) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Articulo := AArticulo; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + RecuperarObjetos(AArticulo); + + CreateEditor('EditorArticulo', IEditorArticulo, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorArticulo) do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Articulo := AArticulo; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TArticulosController.VerProveedor(AArticulo: IBizArticulo); @@ -435,22 +434,17 @@ var AEditor : IEditorArticulos; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(AArticulos); - CreateEditor('EditorArticulos', IEditorArticulos, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorArticulos) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Articulos := AArticulos; - ShowEmbedded; - end; - finally - AEditor := Nil; - HideHourglassCursor; - end; + RecuperarObjetos(AArticulos); + + CreateEditor('EditorArticulos', IEditorArticulos, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorArticulos) do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Articulos := AArticulos; + ShowEmbedded; + end; end; function TArticulosController._Vacio: IBizArticulo; @@ -476,24 +470,23 @@ var AEditor : IEditorElegirArticulos; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirArticulos', IEditorElegirArticulos, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Articulos := AArticulos; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then + + CreateEditor('EditorElegirArticulos', IEditorElegirArticulos, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Articulos := AArticulos; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then Result := ArticulosSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TArticulosController.ElegirProveedor(AArticulo: IBizArticulo); diff --git a/Source/Modulos/Banca electronica/Controller/uBancaElectronicaController.pas b/Source/Modulos/Banca electronica/Controller/uBancaElectronicaController.pas index 68452d95..bcf67ef2 100644 --- a/Source/Modulos/Banca electronica/Controller/uBancaElectronicaController.pas +++ b/Source/Modulos/Banca electronica/Controller/uBancaElectronicaController.pas @@ -182,31 +182,30 @@ var begin Result := False; AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorExportacionNorma19', IEditorExportacionNorma19, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - CodigoEntidad := Entidad; - CodigoAgencia := Oficina; - FechaCargo := AFechaCargo; - Fichero := AFileName; - if (ShowModal = mrOk) then - begin - Entidad := CodigoEntidad; - Oficina := CodigoAgencia; - AFechaCargo := FechaCargo; - AFileName := Fichero; - Result := True; - end; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + CreateEditor('EditorExportacionNorma19', IEditorExportacionNorma19, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + CodigoEntidad := Entidad; + CodigoAgencia := Oficina; + FechaCargo := AFechaCargo; + Fichero := AFileName; + + if (ShowModal = mrOk) then + begin + Entidad := CodigoEntidad; + Oficina := CodigoAgencia; + AFechaCargo := FechaCargo; + AFileName := Fichero; + Result := True; + end; + finally + Release; + AEditor := NIL; + end; + end; end; diff --git a/Source/Modulos/Comisiones/Controller/uComisionesController.pas b/Source/Modulos/Comisiones/Controller/uComisionesController.pas index 248e7071..4c9cfd1b 100644 --- a/Source/Modulos/Comisiones/Controller/uComisionesController.pas +++ b/Source/Modulos/Comisiones/Controller/uComisionesController.pas @@ -308,23 +308,21 @@ var AEditor : IEditorComision; begin AEditor := NIL; - ShowHourglassCursor; - try // RecuperarObjetos(ARemesaCliente); - CreateEditor('EditorComision', IEditorComision, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorComision) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Comision := AComision; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + CreateEditor('EditorComision', IEditorComision, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorComision) do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Comision := AComision; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TComisionesController.VerTodos(AComision: IBizComisiones); @@ -332,20 +330,15 @@ var AEditor : IEditorComisiones; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorComisiones', IEditorComisiones, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Comisiones := AComision; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorComisiones', IEditorComisiones, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Comisiones := AComision; + ShowEmbedded; + end; end; function TComisionesController.ElegirFacturasComision(AComision: IBizComisiones): Boolean; diff --git a/Source/Modulos/Comisiones/Controller/uComisionesReportController.pas b/Source/Modulos/Comisiones/Controller/uComisionesReportController.pas index d723698b..8fb4a933 100644 --- a/Source/Modulos/Comisiones/Controller/uComisionesReportController.pas +++ b/Source/Modulos/Comisiones/Controller/uComisionesReportController.pas @@ -60,24 +60,23 @@ var AEditor : IEditorComisionesPreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetReport(AComisionID); try - AStream := FDataModule.GetReport(AComisionID); - try - CreateEditor('EditorComisionesPreview', IEditorComisionesPreview, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - LoadFromStream(AStream); - Preview; - Release; - end; - finally - FreeAndNil(AStream); - AEditor := Nil; - end; + CreateEditor('EditorComisionesPreview', IEditorComisionesPreview, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + LoadFromStream(AStream); + Preview; + finally + Release; + AEditor := NIL; + end; + end; finally - HideHourglassCursor; + FreeAndNil(AStream); end; end; @@ -87,6 +86,7 @@ var AEditor : IEditorComisionesPreview; begin AEditor := NIL; + ShowHourglassCursor; try AStream := FDataModule.GetReport(AComisionID); @@ -95,13 +95,16 @@ begin if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Print; - Release; + try + LoadFromStream(AStream); + Print; + finally + Release; + AEditor := NIL; + end; end; finally FreeAndNil(AStream); - AEditor := Nil; end; finally HideHourglassCursor; diff --git a/Source/Modulos/Contabilidad/Controller/uApuntesController.pas b/Source/Modulos/Contabilidad/Controller/uApuntesController.pas index 194ac2b5..9f6dfbf3 100644 --- a/Source/Modulos/Contabilidad/Controller/uApuntesController.pas +++ b/Source/Modulos/Contabilidad/Controller/uApuntesController.pas @@ -275,21 +275,20 @@ var AEditor : IEditorApunte; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorApunte', IEditorApunte, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + + CreateEditor('EditorApunte', IEditorApunte, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try // Controller := Self; //OJO ORDEN MUY IMPORTANTE - Apunte := AApunte; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + Apunte := AApunte; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; { @@ -298,20 +297,15 @@ var AEditor : IEditorApuntes; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorApuntes', IEditorApuntes, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Apuntes := AApuntes; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorApuntes', IEditorApuntes, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Apuntes := AApuntes; + ShowEmbedded; + end; end; } diff --git a/Source/Modulos/Contabilidad/Controller/uAsientosController.pas b/Source/Modulos/Contabilidad/Controller/uAsientosController.pas index efc62c21..0b0bc134 100644 --- a/Source/Modulos/Contabilidad/Controller/uAsientosController.pas +++ b/Source/Modulos/Contabilidad/Controller/uAsientosController.pas @@ -238,21 +238,20 @@ var AEditor : IEditorAsiento; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorAsiento', IEditorAsiento, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Asiento := AAsiento; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorAsiento', IEditorAsiento, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Asiento := AAsiento; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TAsientosController.VerDiario(ADiario: IBizDiario); @@ -260,20 +259,15 @@ var AEditor : IEditorDiario; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorDiario', IEditorDiario, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Diario := ADiario; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorDiario', IEditorDiario, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Diario := ADiario; + ShowEmbedded; + end; end; procedure TAsientosController.VerExtracto; @@ -281,20 +275,15 @@ var AEditor : IEditorExtractoMovimientos; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorExtractoMovimientos', IEditorExtractoMovimientos, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - //En este caso el objeto de negocio recae sobre la vista - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorExtractoMovimientos', IEditorExtractoMovimientos, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + //En este caso el objeto de negocio recae sobre la vista + ShowEmbedded; + end; end; function TAsientosController.Eliminar(AAsiento: IBizAsiento): Boolean; diff --git a/Source/Modulos/Contabilidad/Controller/uBalancesController.pas b/Source/Modulos/Contabilidad/Controller/uBalancesController.pas index f60095c6..d547b914 100644 --- a/Source/Modulos/Contabilidad/Controller/uBalancesController.pas +++ b/Source/Modulos/Contabilidad/Controller/uBalancesController.pas @@ -178,20 +178,18 @@ var AEditor : IEditorBalance; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorBalance', IEditorBalance, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Balance := ABalance; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorBalance', IEditorBalance, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Balance := ABalance; + ShowModal; + finally + Release; + end; + end; end; procedure TBalancesController.VerTodos(ABalances: IBizBalance); @@ -199,21 +197,20 @@ var AEditor : IEditorBalances; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorBalances', IEditorBalances, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Balances := ABalances; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorBalances', IEditorBalances, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Balances := ABalances; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; function TBalancesController.ElegirBalance(ABalances: IBizBalance; AMensaje: String; AMultiSelect: Boolean): IBizBalance; @@ -223,19 +220,20 @@ begin Result := NIL; CreateEditor('EditorElegirBalances', IEditorElegirBalances, AEditor); - try + if Assigned(AEditor) then with AEditor do begin - Balances := ABalances; - Controller := Self; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := BalancesSeleccionados; - Release; + try + Balances := ABalances; + Controller := Self; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := BalancesSeleccionados; + finally + Release; + AEditor := NIL; + end; end; - finally - AEditor := NIL; - end; end; function TBalancesController.Eliminar(ABalance: IBizBalance): Boolean; diff --git a/Source/Modulos/Contabilidad/Controller/uCuentasController.pas b/Source/Modulos/Contabilidad/Controller/uCuentasController.pas index d950854d..88ebe389 100644 --- a/Source/Modulos/Contabilidad/Controller/uCuentasController.pas +++ b/Source/Modulos/Contabilidad/Controller/uCuentasController.pas @@ -194,21 +194,20 @@ var AEditor : IEditorCuenta; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorCuenta', IEditorCuenta, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Cuenta := ACuenta; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorCuenta', IEditorCuenta, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Cuenta := ACuenta; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TCuentasController.VerTodos(ACuentas: IBizCuenta); @@ -216,20 +215,15 @@ var AEditor : IEditorCuentas; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorCuentas', IEditorCuentas, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Cuentas := ACuentas; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorCuentas', IEditorCuentas, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Cuentas := ACuentas; + ShowEmbedded; + end; end; procedure TCuentasController.ElegirBalance(ACuenta: IBizCuenta); @@ -268,18 +262,18 @@ begin Result := NIL; CreateEditor('EditorElegirCuentas', IEditorElegirCuentas, AEditor); - try - with AEditor do - begin + with AEditor do + begin + try Cuentas := ACuentas; Controller := Self; Mensaje := AMensaje; if IsPositiveResult(ShowModal) then Result := CuentasSeleccionados; - Release; + finally + Release; + AEditor := NIL; end; - finally - AEditor := NIL; end; end; diff --git a/Source/Modulos/Contabilidad/Controller/uCuentasEspecialesController.pas b/Source/Modulos/Contabilidad/Controller/uCuentasEspecialesController.pas index e44a2322..0cfb889c 100644 --- a/Source/Modulos/Contabilidad/Controller/uCuentasEspecialesController.pas +++ b/Source/Modulos/Contabilidad/Controller/uCuentasEspecialesController.pas @@ -178,20 +178,19 @@ var AEditor : IEditorCuentaEspecial; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorCuentaEspecial', IEditorCuentaEspecial, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - CuentaEspecial := ACuentaEspecial; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorCuentaEspecial', IEditorCuentaEspecial, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + CuentaEspecial := ACuentaEspecial; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TCuentasEspecialesController.VerTodos(ACuentasEspeciales: IBizCuentaEspecial); @@ -199,21 +198,20 @@ var AEditor : IEditorCuentasEspeciales; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorCuentasEspeciales', IEditorCuentasEspeciales, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - CuentasEspeciales := ACuentasEspeciales; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorCuentasEspeciales', IEditorCuentasEspeciales, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + CuentasEspeciales := ACuentasEspeciales; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; function TCuentasEspecialesController.ElegirCuentaEspecial(ACuentasEspeciales: IBizCuentaEspecial; AMensaje: String; @@ -224,19 +222,20 @@ begin Result := NIL; CreateEditor('EditorElegirCuentasEspeciales', IEditorElegirCuentasEspeciales, AEditor); - try + if Assigned(AEditor) then with AEditor do begin - CuentasEspeciales := ACuentasEspeciales; - Controller := Self; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := CuentasEspecialesSeleccionados; - Release; + try + CuentasEspeciales := ACuentasEspeciales; + Controller := Self; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := CuentasEspecialesSeleccionados; + finally + Release; + AEditor := NIL; + end; end; - finally - AEditor := NIL; - end; end; function TCuentasEspecialesController.Eliminar(ACuentaEspecial: IBizCuentaEspecial): Boolean; diff --git a/Source/Modulos/Contabilidad/Controller/uEpigrafesController.pas b/Source/Modulos/Contabilidad/Controller/uEpigrafesController.pas index 85ded567..f6b16685 100644 --- a/Source/Modulos/Contabilidad/Controller/uEpigrafesController.pas +++ b/Source/Modulos/Contabilidad/Controller/uEpigrafesController.pas @@ -202,21 +202,20 @@ var AEditor : IEditorEpigrafe; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorEpigrafe', IEditorEpigrafe, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Epigrafe := AEpigrafe; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorEpigrafe', IEditorEpigrafe, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Epigrafe := AEpigrafe; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TEpigrafesController.VerTodos(AEpigrafes: IBizEpigrafe); @@ -224,20 +223,15 @@ var AEditor : IEditorEpigrafes; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorEpigrafes', IEditorEpigrafes, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Epigrafes := AEpigrafes; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorEpigrafes', IEditorEpigrafes, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Epigrafes := AEpigrafes; + ShowEmbedded; + end; end; function TEpigrafesController.ElegirEpigrafe(AEpigrafes: IBizEpigrafe; AMensaje: String; AMultiSelect: Boolean): IBizEpigrafe; @@ -247,19 +241,20 @@ begin Result := NIL; CreateEditor('EditorElegirEpigrafes', IEditorElegirEpigrafes, AEditor); - try + if Assigned(AEditor) then with AEditor do begin - Epigrafes := AEpigrafes; - Controller := Self; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := EpigrafesSeleccionados; - Release; + try + Epigrafes := AEpigrafes; + Controller := Self; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := EpigrafesSeleccionados; + finally + Release; + AEditor := NIL; + end; end; - finally - AEditor := NIL; - end; end; function TEpigrafesController.Eliminar(AEpigrafe: IBizEpigrafe): Boolean; diff --git a/Source/Modulos/Contabilidad/Controller/uSubCuentasController.pas b/Source/Modulos/Contabilidad/Controller/uSubCuentasController.pas index 4f90689f..0afe0f2d 100644 --- a/Source/Modulos/Contabilidad/Controller/uSubCuentasController.pas +++ b/Source/Modulos/Contabilidad/Controller/uSubCuentasController.pas @@ -408,21 +408,20 @@ var AEditor : IEditorSubCuenta; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorSubCuenta', IEditorSubCuenta, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - SubCuenta := ASubCuenta; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorSubCuenta', IEditorSubCuenta, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + SubCuenta := ASubCuenta; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TSubCuentasController.VerSubCuentaContacto(ASubCuentaContacto: IBizSubCuentasContacto); @@ -455,20 +454,15 @@ var AEditor : IEditorSubCuentas; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorSubCuentas', IEditorSubCuentas, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - SubCuentas := ASubCuentas; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorSubCuentas', IEditorSubCuentas, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + SubCuentas := ASubCuentas; + ShowEmbedded; + end; end; function TSubCuentasController._Vacio: IBizSubCuenta; @@ -511,19 +505,20 @@ begin Result := NIL; CreateEditor('EditorElegirSubCuentas', IEditorElegirSubCuentas, AEditor); - try + if Assigned(AEditor) then with AEditor do begin - SubCuentas := ASubCuentas; - Controller := Self; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := SubCuentasSeleccionados; - Release; + try + SubCuentas := ASubCuentas; + Controller := Self; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := SubCuentasSeleccionados; + finally + Release; + AEditor := NIL; + end; end; - finally - AEditor := NIL; - end; end; procedure TSubCuentasController.ElegirSubCuentaContacto(ASubCuentaContacto: IBizSubCuentasContacto; TipoCuenta: Integer); diff --git a/Source/Modulos/Contactos/Controller/uClientesController.pas b/Source/Modulos/Contactos/Controller/uClientesController.pas index e565b8db..1940ecd9 100644 --- a/Source/Modulos/Contactos/Controller/uClientesController.pas +++ b/Source/Modulos/Contactos/Controller/uClientesController.pas @@ -106,20 +106,21 @@ begin Result := NIL; CreateEditor('EditorElegirClientes', IEditorElegirClientes, AEditor); - try + if Assigned(AEditor) then with AEditor do begin - Contactos := AContactos; - Controller := Self; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := ContactosSeleccionados; - Release; + try + Contactos := AContactos; + Controller := Self; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := ContactosSeleccionados; + finally + Release; + AEditor := NIL; + end; end; - finally - AEditor := NIL; - end; end; function TClientesController.Eliminar(ACliente: IBizContacto; AllItems: Boolean): Boolean; @@ -385,21 +386,20 @@ var AEditor : IEditorCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorCliente', IEditorCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Contacto := AContacto; - Controller := Self; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorCliente', IEditorCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Contacto := AContacto; + Controller := Self; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TClientesController.VerTodos(AContactos: IBizContacto); @@ -407,21 +407,16 @@ var AEditor : IEditorClientes; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorClientes', IEditorClientes, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Contactos := AContactos; - Controller := Self; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + 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/uDireccionesContactoController.pas b/Source/Modulos/Contactos/Controller/uDireccionesContactoController.pas index e8d11ec2..0d9bb6d5 100644 --- a/Source/Modulos/Contactos/Controller/uDireccionesContactoController.pas +++ b/Source/Modulos/Contactos/Controller/uDireccionesContactoController.pas @@ -102,21 +102,20 @@ var AEditor : IEditorEditorDireccion; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorDireccion', IEditorEditorDireccion, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Direccion := ADireccion; - Controller := Self; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorDireccion', IEditorEditorDireccion, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Direccion := ADireccion; + Controller := Self; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; end. diff --git a/Source/Modulos/Contactos/Controller/uEtiquetasContactosReportController.pas b/Source/Modulos/Contactos/Controller/uEtiquetasContactosReportController.pas index f7effbd9..c60e3845 100644 --- a/Source/Modulos/Contactos/Controller/uEtiquetasContactosReportController.pas +++ b/Source/Modulos/Contactos/Controller/uEtiquetasContactosReportController.pas @@ -58,24 +58,23 @@ var AEditor : IEditorEtiquetasContactosPreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetReport(AContactosID); try - AStream := FDataModule.GetReport(AContactosID); - try - CreateEditor('EditorEtiquetasContactosPreview', IEditorEtiquetasContactosPreview, AEditor); - if Assigned(AEditor) then + CreateEditor('EditorEtiquetasContactosPreview', IEditorEtiquetasContactosPreview, AEditor); + if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Preview; - Release; + try + LoadFromStream(AStream); + Preview; + finally + Release; + AEditor := NIL; + end; end; - finally - FreeAndNil(AStream); - AEditor := Nil; - end; finally - HideHourglassCursor; + FreeAndNil(AStream); end; end; @@ -93,13 +92,16 @@ begin if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Print; - Release; + try + LoadFromStream(AStream); + Print; + finally + Release; + AEditor := Nil; + end; end; finally FreeAndNil(AStream); - AEditor := Nil; end; finally HideHourglassCursor; diff --git a/Source/Modulos/Contactos/Controller/uGruposClienteController.pas b/Source/Modulos/Contactos/Controller/uGruposClienteController.pas index c25db669..8e60538d 100644 --- a/Source/Modulos/Contactos/Controller/uGruposClienteController.pas +++ b/Source/Modulos/Contactos/Controller/uGruposClienteController.pas @@ -142,21 +142,20 @@ var AEditor : IEditorGruposCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorGruposCliente', IEditorGruposCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - GruposCliente := AGruposCliente; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorGruposCliente', IEditorGruposCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + GruposCliente := AGruposCliente; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; function TGruposClienteController.Eliminar(AGrupoCliente: IBizGrupoCliente): Boolean; diff --git a/Source/Modulos/Contactos/Controller/uGruposProveedorController.pas b/Source/Modulos/Contactos/Controller/uGruposProveedorController.pas index f15f485b..9f0782ed 100644 --- a/Source/Modulos/Contactos/Controller/uGruposProveedorController.pas +++ b/Source/Modulos/Contactos/Controller/uGruposProveedorController.pas @@ -142,21 +142,20 @@ var AEditor : IEditorGruposProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorGruposProveedor', IEditorGruposProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - GruposProveedor := AGruposProveedor; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorGruposProveedor', IEditorGruposProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + GruposProveedor := AGruposProveedor; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; function TGruposProveedorController.Eliminar(AGrupoProveedor: IBizGrupoProveedor): Boolean; diff --git a/Source/Modulos/Contactos/Controller/uProcedenciasClienteController.pas b/Source/Modulos/Contactos/Controller/uProcedenciasClienteController.pas index f03d847d..5a7ce527 100644 --- a/Source/Modulos/Contactos/Controller/uProcedenciasClienteController.pas +++ b/Source/Modulos/Contactos/Controller/uProcedenciasClienteController.pas @@ -142,21 +142,20 @@ var AEditor : IEditorProcedenciasCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorProcedenciasCliente', IEditorProcedenciasCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - ProcedenciasCliente := AProcedenciasCliente; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorProcedenciasCliente', IEditorProcedenciasCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + ProcedenciasCliente := AProcedenciasCliente; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; function TProcedenciasClienteController.Eliminar(AProcedenciaCliente: IBizProcedenciaCliente): Boolean; diff --git a/Source/Modulos/Contactos/Controller/uProveedoresController.pas b/Source/Modulos/Contactos/Controller/uProveedoresController.pas index e3f4facf..6bb9d10f 100644 --- a/Source/Modulos/Contactos/Controller/uProveedoresController.pas +++ b/Source/Modulos/Contactos/Controller/uProveedoresController.pas @@ -90,24 +90,23 @@ var AEditor : IEditorElegirProveedores; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirProveedores', IEditorElegirProveedores, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Contactos := AContactos; - Controller := Self; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := ContactosSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorElegirProveedores', IEditorElegirProveedores, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Contactos := AContactos; + Controller := Self; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := ContactosSeleccionados; + finally + Release; + AEditor := NIL; + end; + end; end; function TProveedoresController.Eliminar(AProveedor: IBizContacto; AllItems: Boolean): Boolean; @@ -326,21 +325,20 @@ var AEditor : IEditorProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorProveedor', IEditorProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Contacto := AContacto; - Controller := Self; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorProveedor', IEditorProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Contacto := AContacto; + Controller := Self; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TProveedoresController.VerTodos(AContactos: IBizContacto); @@ -348,21 +346,16 @@ var AEditor : IEditorProveedores; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorProveedores', IEditorProveedores, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Contactos := AContactos; - Controller := Self; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + 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/Contactos/Controller/uVendedoresController.pas b/Source/Modulos/Contactos/Controller/uVendedoresController.pas index 1b246e6f..fcc424f2 100644 --- a/Source/Modulos/Contactos/Controller/uVendedoresController.pas +++ b/Source/Modulos/Contactos/Controller/uVendedoresController.pas @@ -139,20 +139,21 @@ begin Result := NIL; CreateEditor('EditorElegirVendedores', IEditorElegirVendedores, AEditor); - try + if Assigned(AEditor) then with AEditor do begin - Contactos := AContactos; - Controller := Self; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := ContactosSeleccionados; - Release; + try + Contactos := AContactos; + Controller := Self; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := ContactosSeleccionados; + finally + Release; + AEditor := NIL; + end; end; - finally - AEditor := NIL; - end; end; function TVendedoresController.Eliminar(AVendedor: IBizContacto; AllItems: Boolean = false): Boolean; @@ -235,21 +236,20 @@ var AEditor : IEditorVendedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorVendedor', IEditorVendedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Contacto := AContacto; - Controller := Self; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorVendedor', IEditorVendedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Contacto := AContacto; + Controller := Self; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TVendedoresController.VerTodos(AContactos: IBizContacto); @@ -257,21 +257,16 @@ var AEditor : IEditorVendedores; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorVendedores', IEditorVendedores, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Contactos := AContactos; - Controller := Self; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorVendedores', IEditorVendedores, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Contactos := AContactos; + Controller := Self; + MultiSelect := True; + ShowEmbedded; + end; end; end. diff --git a/Source/Modulos/Facturas de cliente/Controller/uArticulosFacturaClienteController.pas b/Source/Modulos/Facturas de cliente/Controller/uArticulosFacturaClienteController.pas index 1ac9bd21..8d3bcd56 100644 --- a/Source/Modulos/Facturas de cliente/Controller/uArticulosFacturaClienteController.pas +++ b/Source/Modulos/Facturas de cliente/Controller/uArticulosFacturaClienteController.pas @@ -27,24 +27,23 @@ var AEditor : IEditorElegirArticulosFacturasCliente; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirArticulosFacturaCliente', IEditorElegirArticulosFacturasCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Articulos := AArticulos; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := ArticulosSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorElegirArticulosFacturaCliente', IEditorElegirArticulosFacturasCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Articulos := AArticulos; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := ArticulosSeleccionados; + finally + Release; + AEditor := NIL; + end; + end; end; end. diff --git a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas index e214b7d0..7da42fe8 100644 --- a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas +++ b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas @@ -682,36 +682,33 @@ var AEditor : IEditorFacturaCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarCliente(AFactura); - CreateEditor('EditorFacturaCliente', IEditorFacturaCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Factura := AFactura; + RecuperarCliente(AFactura); - //MODO CONSULTAR - if not EsModificable(AFactura) then - begin - SetDataTableReadOnly(AFactura.DataTable, True); - ReadOnly := True; + CreateEditor('EditorFacturaCliente', IEditorFacturaCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Factura := AFactura; + + //MODO CONSULTAR + if not EsModificable(AFactura) then + begin + SetDataTableReadOnly(AFactura.DataTable, True); + ReadOnly := True; + end; + + ShowModal; + + //MODO CONSULTAR (Se deja la tabla como estaba) + if ReadOnly then + SetDataTableReadOnly(AFactura.DataTable, False); + finally + Release; end; - - ShowModal; - - //MODO CONSULTAR (Se deja la tabla como estaba) - if ReadOnly then - SetDataTableReadOnly(AFactura.DataTable, False); - - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; procedure TFacturasClienteController.VerTodos(AFacturas: IBizFacturaCliente); @@ -719,21 +716,16 @@ var AEditor : IEditorFacturasCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorFacturasCliente', IEditorFacturasCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Facturas := AFacturas; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := Nil; - HideHourglassCursor; - end; + + CreateEditor('EditorFacturasCliente', IEditorFacturasCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Facturas := AFacturas; + MultiSelect := True; + ShowEmbedded; + end; end; function TFacturasClienteController._Vacio: IBizFacturaCliente; @@ -760,24 +752,24 @@ var AEditor : IEditorElegirFacturasCliente; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirFacturasCliente', IEditorElegirFacturasCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Facturas := AFacturas; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := FacturasClienteSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorElegirFacturasCliente', IEditorElegirFacturasCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Facturas := AFacturas; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := FacturasClienteSeleccionados; + + finally + Release; + AEditor := NIL; + end; + end; end; function TFacturasClienteController.Eliminar(AFactura: IBizFacturaCliente; AllItems: Boolean = false): Boolean; diff --git a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteReportController.pas b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteReportController.pas index a7abd7ba..04a3a3fe 100644 --- a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteReportController.pas +++ b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteReportController.pas @@ -60,24 +60,23 @@ var AEditor : IEditorFacturasClientePreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetReport(AFacturaID); try - AStream := FDataModule.GetReport(AFacturaID); - try - CreateEditor('EditorFacturasClientePreview', IEditorFacturasClientePreview, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorFacturasClientePreview', IEditorFacturasClientePreview, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try LoadFromStream(AStream); Preview; + finally Release; + AEditor := Nil; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); end; end; @@ -95,13 +94,16 @@ begin if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Print; - Release; + try + LoadFromStream(AStream); + Print; + finally + Release; + AEditor := Nil; + end; end; finally FreeAndNil(AStream); - AEditor := Nil; end; finally HideHourglassCursor; diff --git a/Source/Modulos/Facturas de proveedor/Controller/uArticulosFacturaProveedorController.pas b/Source/Modulos/Facturas de proveedor/Controller/uArticulosFacturaProveedorController.pas index 50d54fbf..5f1c73dc 100644 --- a/Source/Modulos/Facturas de proveedor/Controller/uArticulosFacturaProveedorController.pas +++ b/Source/Modulos/Facturas de proveedor/Controller/uArticulosFacturaProveedorController.pas @@ -28,25 +28,23 @@ var AEditor : IEditorElegirArticulosFacturasProveedor; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirArticulosFacturaProveedor', IEditorElegirArticulosFacturasProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Articulos := AArticulos; - Proveedor := AProveedor; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := ArticulosSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + CreateEditor('EditorElegirArticulosFacturaProveedor', IEditorElegirArticulosFacturasProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Articulos := AArticulos; + Proveedor := AProveedor; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := ArticulosSeleccionados; + finally + Release; + AEditor := NIL; + end; + end; end; end. diff --git a/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorController.pas b/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorController.pas index 328d5b3e..1f765a6b 100644 --- a/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorController.pas +++ b/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorController.pas @@ -688,14 +688,14 @@ var AEditor : IEditorFacturaProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarProveedor(AFactura); - CreateEditor('EditorFacturaProveedor', IEditorFacturaProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + RecuperarProveedor(AFactura); + + CreateEditor('EditorFacturaProveedor', IEditorFacturaProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try Controller := Self; //OJO ORDEN MUY IMPORTANTE Factura := AFactura; @@ -711,13 +711,11 @@ begin //MODO CONSULTAR (Se deja la tabla como estaba) if ReadOnly then SetDataTableReadOnly(AFactura.DataTable, False); - + finally AEditor.Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; procedure TFacturasProveedorController.VerTodos(AFacturas: IBizFacturaProveedor); @@ -725,19 +723,14 @@ var AEditor : IEditorFacturasProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorFacturasProveedor', IEditorFacturasProveedor, AEditor); - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Facturas := AFacturas; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := Nil; - HideHourglassCursor; + + CreateEditor('EditorFacturasProveedor', IEditorFacturasProveedor, AEditor); + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Facturas := AFacturas; + MultiSelect := True; + ShowEmbedded; end; end; @@ -766,25 +759,23 @@ function TFacturasProveedorController.ElegirFacturas(AFacturas: IBizFacturaProve begin Result := NIL; { - ShowHourglassCursor; - try - CreateEditor('EditorElegirFacturasProveedor', IEditorElegirFacturasProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Facturas := AFacturas; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := FacturasProveedoreSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; -} + CreateEditor('EditorElegirFacturasProveedor', IEditorElegirFacturasProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Facturas := AFacturas; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := FacturasProveedoreSeleccionados; + finally + Release; + AEditor := NIL; + end; + end; +} end; function TFacturasProveedorController.Eliminar(AFactura: IBizFacturaProveedor; AllItems: Boolean = false): Boolean; diff --git a/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorReportController.pas b/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorReportController.pas index 35dabf1c..40c82151 100644 --- a/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorReportController.pas +++ b/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorReportController.pas @@ -59,24 +59,23 @@ var AEditor : IEditorFacturasProveedorPreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetReport(AFacturaID); try - AStream := FDataModule.GetReport(AFacturaID); - try - CreateEditor('EditorFacturasProveedorPreview', IEditorFacturasProveedorPreview, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - LoadFromStream(AStream); - Preview; - Release; - end; - finally - FreeAndNil(AStream); - AEditor := Nil; - end; + CreateEditor('EditorFacturasProveedorPreview', IEditorFacturasProveedorPreview, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + LoadFromStream(AStream); + Preview; + finally + Release; + AEditor := NIL; + end; + end; finally - HideHourglassCursor; + FreeAndNil(AStream); end; end; @@ -95,13 +94,16 @@ begin if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Print; - Release; + try + LoadFromStream(AStream); + Print; + finally + Release; + AEditor := NIL; + end; end; finally FreeAndNil(AStream); - AEditor := Nil; end; finally HideHourglassCursor; diff --git a/Source/Modulos/Familias/Controller/uFamiliasController.pas b/Source/Modulos/Familias/Controller/uFamiliasController.pas index 2d279b4a..c01ae375 100644 --- a/Source/Modulos/Familias/Controller/uFamiliasController.pas +++ b/Source/Modulos/Familias/Controller/uFamiliasController.pas @@ -152,21 +152,20 @@ var AEditor : IEditorFamilias; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorFamilias', IEditorFamilias, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Familias := AFamilias; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorFamilias', IEditorFamilias, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Familias := AFamilias; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; function TFamiliasController.Eliminar(AFamilia: IBizFamilia): Boolean; diff --git a/Source/Modulos/Formas de pago/Controller/uFormasPagoController.pas b/Source/Modulos/Formas de pago/Controller/uFormasPagoController.pas index f20c72ab..5bac6949 100644 --- a/Source/Modulos/Formas de pago/Controller/uFormasPagoController.pas +++ b/Source/Modulos/Formas de pago/Controller/uFormasPagoController.pas @@ -199,19 +199,20 @@ var AEditor : IEditorFormaPago; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorFormaPago', IEditorFormaPago, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - FormaPago := AFormaPago; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; + + CreateEditor('EditorFormaPago', IEditorFormaPago, AEditor); + if Assigned(AEditor) then + begin + with AEditor do + begin + try + FormaPago := AFormaPago; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; end; @@ -220,20 +221,19 @@ var AEditor : IEditorFormasPago; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorFormasPago', IEditorFormasPago, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - FormasPago := AFormasPago; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorFormasPago', IEditorFormasPago, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + FormasPago := AFormasPago; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; function TFormasPagoController.Eliminar(AFormaPago: IBizFormaPago): Boolean; diff --git a/Source/Modulos/Historico de movimientos/Controller/uHistoricoMovimientosController.pas b/Source/Modulos/Historico de movimientos/Controller/uHistoricoMovimientosController.pas index 1c2df3d0..37f00e55 100644 --- a/Source/Modulos/Historico de movimientos/Controller/uHistoricoMovimientosController.pas +++ b/Source/Modulos/Historico de movimientos/Controller/uHistoricoMovimientosController.pas @@ -120,23 +120,22 @@ var begin Result := False; AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorEntradaSalidaArticulos', IEditorEntradaSalidaArticulos, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Articulos := AArticulos; - HistoricoMovimientos := AHistoricoMovimientos; - ShowModal; - Result := ResultadoModalOK; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorEntradaSalidaArticulos', IEditorEntradaSalidaArticulos, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Articulos := AArticulos; + HistoricoMovimientos := AHistoricoMovimientos; + ShowModal; + Result := ResultadoModalOK; + finally + Release; + AEditor := NIL; + end; + end; end;} procedure THistoricoMovimientosController.VerTodos(AHistoricoMovimientos: IBizHistoricoMovimientos); @@ -144,21 +143,16 @@ var AEditor : IEditorHistoricoMovimientos; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorHistoricoMovimientos', IEditorHistoricoMovimientos, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - HistoricoMovimientos := AHistoricoMovimientos; - MultiSelect := False; - ShowEmbedded; - end; - finally - AEditor := Nil; - HideHourglassCursor; - end; + + CreateEditor('EditorHistoricoMovimientos', IEditorHistoricoMovimientos, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + HistoricoMovimientos := AHistoricoMovimientos; + MultiSelect := False; + ShowEmbedded; + end; end; function THistoricoMovimientosController._Vacio: IBizHistoricoMovimientos; diff --git a/Source/Modulos/Inventario/Controller/uArticulosInventarioController.pas b/Source/Modulos/Inventario/Controller/uArticulosInventarioController.pas index d52d1981..55818e6f 100644 --- a/Source/Modulos/Inventario/Controller/uArticulosInventarioController.pas +++ b/Source/Modulos/Inventario/Controller/uArticulosInventarioController.pas @@ -27,23 +27,22 @@ var AEditor : IEditorElegirArticulosCatalogo; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirArticulosCatalogo', IEditorElegirArticulosCatalogo, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Articulos := AArticulos; - MultiSelect := AMultiSelect; - if IsPositiveResult(ShowModal) then - Result := ArticulosSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorElegirArticulosCatalogo', IEditorElegirArticulosCatalogo, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Articulos := AArticulos; + MultiSelect := AMultiSelect; + if IsPositiveResult(ShowModal) then + Result := ArticulosSeleccionados; + finally + Release; + AEditor := NIL; + end; + end; end; end. diff --git a/Source/Modulos/Inventario/Controller/uInventarioController.pas b/Source/Modulos/Inventario/Controller/uInventarioController.pas index 63c17eed..9647fc0d 100644 --- a/Source/Modulos/Inventario/Controller/uInventarioController.pas +++ b/Source/Modulos/Inventario/Controller/uInventarioController.pas @@ -326,24 +326,23 @@ var AEditor : IEditorElegirArticulosAlmacen; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirArticulosAlmacen', IEditorElegirArticulosAlmacen, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Inventario := AArticulos; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then + + CreateEditor('EditorElegirArticulosAlmacen', IEditorElegirArticulosAlmacen, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Inventario := AArticulos; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then Result := ArticulosSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + finally + Release; + AEditor := NIL; + end; + end; end; function TInventarioController.Eliminar(AInventario: IBizInventario; Todos: Boolean; ApplyUpdates: Boolean): Boolean; @@ -452,25 +451,24 @@ var begin Result := False; AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorEntradaSalidaArticulos', IEditorEntradaSalidaArticulos, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Articulos := AArticulos; - Inventario := AInventario; - if Assigned(APedido) then - PedidoProveedor := APedido; - ShowModal; - Result := ResultadoModalOK; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorEntradaSalidaArticulos', IEditorEntradaSalidaArticulos, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Articulos := AArticulos; + Inventario := AInventario; + if Assigned(APedido) then + PedidoProveedor := APedido; + ShowModal; + Result := ResultadoModalOK; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TInventarioController.VerReservas(AArticulo: IBizInventario); @@ -478,23 +476,22 @@ var AEditor : IEditorDetalleReservas; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorDetalleReservas', IEditorDetalleReservas, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - // Controller := Self; //OJO ORDEN MUY IMPORTANTE - DetalleReservas := FDataModule.GetDetalleReservas; - Articulo := AArticulo; - // MultiSelect := False; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorDetalleReservas', IEditorDetalleReservas, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + // Controller := Self; //OJO ORDEN MUY IMPORTANTE + DetalleReservas := FDataModule.GetDetalleReservas; + Articulo := AArticulo; + // MultiSelect := False; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TInventarioController.VerTodos(AInventario: IBizInventario); @@ -502,21 +499,16 @@ var AEditor : IEditorInventario; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorInventario', IEditorInventario, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Inventario := AInventario; - MultiSelect := False; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorInventario', IEditorInventario, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Inventario := AInventario; + MultiSelect := False; + ShowEmbedded; + end; end; function TInventarioController._Vacio: IBizInventario; diff --git a/Source/Modulos/Pedidos a proveedor/Controller/uArticulosPedidoProveedorController.pas b/Source/Modulos/Pedidos a proveedor/Controller/uArticulosPedidoProveedorController.pas index 12c6c85d..2b052438 100644 --- a/Source/Modulos/Pedidos a proveedor/Controller/uArticulosPedidoProveedorController.pas +++ b/Source/Modulos/Pedidos a proveedor/Controller/uArticulosPedidoProveedorController.pas @@ -28,25 +28,24 @@ var AEditor : IEditorElegirArticulosPedidosProveedor; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirArticulosPedidoProveedor', IEditorElegirArticulosPedidosProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Articulos := AArticulos; - Proveedor := AProveedor; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := ArticulosSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorElegirArticulosPedidoProveedor', IEditorElegirArticulosPedidosProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Articulos := AArticulos; + Proveedor := AProveedor; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := ArticulosSeleccionados; + finally + Release; + AEditor := NIL; + end; + end; end; end. diff --git a/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorController.pas b/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorController.pas index 0172ab53..dc5b16df 100644 --- a/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorController.pas +++ b/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorController.pas @@ -240,23 +240,22 @@ var begin Result := False; AEditor := NIL; - ShowHourglassCursor; - try - RecuperarProveedor(APedido); - CreateEditor('EditorSituacionPedidoProveedor', IEditorSituacionPedidoProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - PedidoProveedor := APedido; - ShowModal; - Release; - Result := True; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + RecuperarProveedor(APedido); + CreateEditor('EditorSituacionPedidoProveedor', IEditorSituacionPedidoProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + PedidoProveedor := APedido; + ShowModal; + Result := True; + finally + Release; + AEditor := NIL; + end; + end; end; destructor TPedidosProveedorController.Destroy; @@ -368,14 +367,14 @@ var AEditor : IEditorPedidoProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(APedido); - CreateEditor('EditorPedidoProveedor', IEditorPedidoProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + RecuperarObjetos(APedido); + CreateEditor('EditorPedidoProveedor', IEditorPedidoProveedor, AEditor); + + if Assigned(AEditor) then + with AEditor do + begin + try Controller := Self; //OJO ORDEN MUY IMPORTANTE Pedido := APedido; @@ -391,13 +390,11 @@ begin //MODO CONSULTAR (Se deja la tabla como estaba) if ReadOnly then SetDataTableReadOnly(APedido.DataTable, False); - + finally AEditor.Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; procedure TPedidosProveedorController.VerTodos(APedidos: IBizPedidoProveedor); @@ -405,21 +402,16 @@ var AEditor : IEditorPedidosProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorPedidosProveedor', IEditorPedidosProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Pedidos := APedidos; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorPedidosProveedor', IEditorPedidosProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Pedidos := APedidos; + MultiSelect := True; + ShowEmbedded; + end; end; procedure TPedidosProveedorController.VerDireccionEntrega( @@ -428,21 +420,20 @@ var AEditor : IEditorDireccionEntregaPedidoProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - //RecuperarObjetos(APedido); <- No descomentar. No hace falta - CreateEditor('EditorDireccionEntregaPedidoProveedor', IEditorDireccionEntregaPedidoProveedor, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorDireccionEntregaPedidoProveedor) do - begin - Pedido := APedido; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + //RecuperarObjetos(APedido); <- No descomentar. No hace falta + CreateEditor('EditorDireccionEntregaPedidoProveedor', IEditorDireccionEntregaPedidoProveedor, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorDireccionEntregaPedidoProveedor) do + begin + try + Pedido := APedido; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; function TPedidosProveedorController._Vacio: IBizPedidoProveedor; @@ -468,24 +459,23 @@ var AEditor : IEditorElegirPedidosProveedor; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirPedidosProveedor', IEditorElegirPedidosProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Pedidos := APedido; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := PedidosProveedorSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorElegirPedidosProveedor', IEditorElegirPedidosProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Pedidos := APedido; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := PedidosProveedorSeleccionados; + finally + Release; + AEditor := NIL; + end; + end; end; function TPedidosProveedorController.Eliminar(APedido: IBizPedidoProveedor; AllItems: Boolean = false): Boolean; diff --git a/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorReportController.pas b/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorReportController.pas index f7bd47c3..5a63b3ef 100644 --- a/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorReportController.pas +++ b/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorReportController.pas @@ -60,24 +60,23 @@ var AEditor : IEditorPedidosProveedorPreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetReport(AID); try - AStream := FDataModule.GetReport(AID); - try - CreateEditor('EditorPedidosProveedorPreview', IEditorPedidosProveedorPreview, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorPedidosProveedorPreview', IEditorPedidosProveedorPreview, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try LoadFromStream(AStream); Preview; + finally Release; + AEditor := NIL; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); end; end; @@ -87,21 +86,25 @@ var AEditor : IEditorPedidosProveedorPreview; begin AEditor := NIL; + ShowHourglassCursor; try - AStream := FDataModule.GetReport(AID); + AStream := FDataModule.GetReport(AID); try CreateEditor('EditorPedidosProveedorPreview', IEditorPedidosProveedorPreview, AEditor); if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Print; - Release; + try + LoadFromStream(AStream); + Print; + finally + Release; + AEditor := NIL; + end; end; finally FreeAndNil(AStream); - AEditor := Nil; end; finally HideHourglassCursor; diff --git a/Source/Modulos/Presupuestos de cliente/Controller/uArticulosPresupuestoClienteController.pas b/Source/Modulos/Presupuestos de cliente/Controller/uArticulosPresupuestoClienteController.pas index 5255e968..f14c7105 100644 --- a/Source/Modulos/Presupuestos de cliente/Controller/uArticulosPresupuestoClienteController.pas +++ b/Source/Modulos/Presupuestos de cliente/Controller/uArticulosPresupuestoClienteController.pas @@ -27,24 +27,23 @@ var AEditor : IEditorElegirArticulosPresupuestosCliente; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirArticulosPresupuestosCliente', IEditorElegirArticulosPresupuestosCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Articulos := AArticulos; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := ArticulosSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorElegirArticulosPresupuestosCliente', IEditorElegirArticulosPresupuestosCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Articulos := AArticulos; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := ArticulosSeleccionados; + finally + Release; + AEditor := NIL; + end; + end; end; end. diff --git a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas index 3d58eca8..fbee5d18 100644 --- a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas +++ b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas @@ -355,14 +355,14 @@ var AEditor : IEditorPresupuestoCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(APresupuesto); - CreateEditor('EditorPresupuestoCliente', IEditorPresupuestoCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + RecuperarObjetos(APresupuesto); + CreateEditor('EditorPresupuestoCliente', IEditorPresupuestoCliente, AEditor); + + if Assigned(AEditor) then + with AEditor do + begin + try Controller := Self; //OJO ORDEN MUY IMPORTANTE Presupuesto := APresupuesto; @@ -378,13 +378,11 @@ begin //MODO CONSULTAR (Se deja la tabla como estaba) if ReadOnly then SetDataTableReadOnly(APresupuesto.DataTable, False); - + finally AEditor.Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; procedure TPresupuestosClienteController.VerDireccionEntrega( @@ -394,22 +392,20 @@ var begin { AEditor := NIL; - ShowHourglassCursor; - try //RecuperarObjetos(APresupuesto); <- No descomentar. No hace falta CreateEditor('EditorDireccionEntregaPresupuestoCliente', IEditorDireccionEntregaPresupuestoCliente, AEditor); if Assigned(AEditor) then with (AEditor as IEditorDireccionEntregaPresupuestoCliente) do begin - Presupuesto := APresupuesto; - ShowModal; - Release; + try + Presupuesto := APresupuesto; + ShowModal; + finally + Release; + AEditor := NIL; + end; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; -} +} end; procedure TPresupuestosClienteController.VerTodos(APresupuestos: IBizPresupuestoCliente); @@ -417,21 +413,16 @@ var AEditor : IEditorPresupuestosCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorPresupuestosCliente', IEditorPresupuestosCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Presupuestos := APresupuestos; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorPresupuestosCliente', IEditorPresupuestosCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Presupuestos := APresupuestos; + MultiSelect := True; + ShowEmbedded; + end; end; function TPresupuestosClienteController._Vacio: IBizPresupuestoCliente; @@ -457,24 +448,23 @@ var AEditor : IEditorElegirPresupuestosCliente; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirPresupuestosCliente', IEditorElegirPresupuestosCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - Presupuestos := APresupuesto; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := PresupuestosClienteSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorElegirPresupuestosCliente', IEditorElegirPresupuestosCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Presupuestos := APresupuesto; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := PresupuestosClienteSeleccionados; + finally + Release; + AEditor := NIL; + end; + end; end; function TPresupuestosClienteController.Eliminar(APresupuesto: IBizPresupuestoCliente; AllItems: Boolean = false): Boolean; diff --git a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteReportController.pas b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteReportController.pas index d9d50df0..a1150719 100644 --- a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteReportController.pas +++ b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteReportController.pas @@ -86,29 +86,24 @@ var AEditor : IEditorPresupuestosClientePreview; begin AEditor := NIL; - ShowHourglassCursor; + AStream := FDataModule.GetRptPresupuestos(AListaID); try - AStream := FDataModule.GetRptPresupuestos(AListaID); - try - CreateEditor('EditorPresupuestosClientePreview', IEditorPresupuestosClientePreview, AEditor); - if Assigned(AEditor) then - begin - try - AEditor.Controller := Self; - AEditor.ListaID := AListaID; - AEditor.Title := 'Presupuesto - ' + AppFactuGES.EmpresaActiva.NOMBRE; - AEditor.LoadFromStream(AStream); - AEditor.Preview; - finally - AEditor.Release; - end; + CreateEditor('EditorPresupuestosClientePreview', IEditorPresupuestosClientePreview, AEditor); + if Assigned(AEditor) then + begin + try + AEditor.Controller := Self; + AEditor.ListaID := AListaID; + AEditor.Title := 'Presupuesto - ' + AppFactuGES.EmpresaActiva.NOMBRE; + AEditor.LoadFromStream(AStream); + AEditor.Preview; + finally + AEditor.Release; + AEditor := Nil; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); end; end; @@ -133,11 +128,11 @@ begin AEditor.Print; finally AEditor.Release; + AEditor := Nil; end; end; finally FreeAndNil(AStream); - AEditor := Nil; end; finally HideHourglassCursor; diff --git a/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteController.pas b/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteController.pas index 344c3e7a..2cb6b23c 100644 --- a/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteController.pas +++ b/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteController.pas @@ -553,22 +553,21 @@ var AEditor : IEditorReciboCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarCliente(ARecibosCliente); - CreateEditor('EditorReciboCliente', IEditorReciboCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Recibo := ARecibosCliente; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + RecuperarCliente(ARecibosCliente); + CreateEditor('EditorReciboCliente', IEditorReciboCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Recibo := ARecibosCliente; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TRecibosClienteController.VerTodos(ARecibosCliente: IBizRecibosCliente); @@ -576,21 +575,16 @@ var AEditor : IEditorRecibosCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorRecibosCliente', IEditorRecibosCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - RecibosCliente := ARecibosCliente; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorRecibosCliente', IEditorRecibosCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + RecibosCliente := ARecibosCliente; + MultiSelect := True; + ShowEmbedded; + end; end; function TRecibosClienteController.ElegirRecibos(ARecibos: IBizRecibosCliente; AMensaje: String; AMultiSelect: Boolean): IBizRecibosCliente; @@ -598,21 +592,23 @@ var AEditor : IEditorElegirRecibosCliente; begin Result := NIL; + CreateEditor('EditorElegirRecibosCliente', IEditorElegirRecibosCliente, AEditor); - try + if Assigned(AEditor) then with AEditor do begin - Controller := Self; - RecibosCliente := ARecibos; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := RecibosClienteSeleccionados; - Release; + try + Controller := Self; + RecibosCliente := ARecibos; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := RecibosClienteSeleccionados; + finally + Release; + AEditor := NIL; + end; end; - finally - AEditor := NIL; - end; end; function TRecibosClienteController.ElegirRecibosCompensados(ARecibo: IBizRecibosCliente): Boolean; diff --git a/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteReportController.pas b/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteReportController.pas index f2937aed..2d1c65d0 100644 --- a/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteReportController.pas +++ b/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteReportController.pas @@ -59,24 +59,22 @@ var AEditor : IEditorRecibosClientePreview; begin AEditor := NIL; - ShowHourglassCursor; + AStream := FDataModule.GetReport(ID); try - AStream := FDataModule.GetReport(ID); - try - CreateEditor('EditorRecibosClientePreview', IEditorRecibosClientePreview, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorRecibosClientePreview', IEditorRecibosClientePreview, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try LoadFromStream(AStream); Preview; + finally Release; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); + AEditor := Nil; end; end; @@ -94,13 +92,16 @@ begin if Assigned(AEditor) then with AEditor do begin - AEditor.LoadFromStream(AStream); - AEditor.Print; - AEditor.Release; + try + AEditor.LoadFromStream(AStream); + AEditor.Print; + finally + AEditor.Release; + AEditor := NIL; + end; end; finally FreeAndNil(AStream); - AEditor := Nil; end; finally HideHourglassCursor; diff --git a/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorController.pas b/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorController.pas index 0b85970f..76ca5732 100644 --- a/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorController.pas +++ b/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorController.pas @@ -546,22 +546,21 @@ var AEditor : IEditorReciboProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarProveedor(ARecibosProveedor); - CreateEditor('EditorReciboProveedor', IEditorReciboProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Recibo := ARecibosProveedor; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + RecuperarProveedor(ARecibosProveedor); + CreateEditor('EditorReciboProveedor', IEditorReciboProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Recibo := ARecibosProveedor; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TRecibosProveedorController.VerTodos(ARecibosProveedor: IBizRecibosProveedor); @@ -569,21 +568,16 @@ var AEditor : IEditorRecibosProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorRecibosProveedor', IEditorRecibosProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - RecibosProveedor := ARecibosProveedor; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorRecibosProveedor', IEditorRecibosProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + RecibosProveedor := ARecibosProveedor; + MultiSelect := True; + ShowEmbedded; + end; end; function TRecibosProveedorController.ElegirRecibos(ARecibos: IBizRecibosProveedor; AMensaje: String; @@ -592,22 +586,23 @@ var AEditor : IEditorElegirRecibosProveedor; begin Result := NIL; - try - CreateEditor('EditorElegirRecibosProveedor', IEditorElegirRecibosProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; - RecibosProveedor := ARecibos; - MultiSelect := AMultiSelect; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := RecibosProveedorSeleccionados; - Release; - end; - finally - AEditor := NIL; - end; + + CreateEditor('EditorElegirRecibosProveedor', IEditorElegirRecibosProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + RecibosProveedor := ARecibos; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := RecibosProveedorSeleccionados; + finally + Release; + AEditor := NIL; + end; + end; end; function TRecibosProveedorController.ElegirRecibosCompensados(ARecibo: IBizRecibosProveedor): Boolean; diff --git a/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorReportController.pas b/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorReportController.pas index 413f0014..b0f2c21f 100644 --- a/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorReportController.pas +++ b/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorReportController.pas @@ -59,24 +59,23 @@ var AEditor : IEditorRecibosProveedorPreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetReport(ID); try - AStream := FDataModule.GetReport(ID); - try - CreateEditor('EditorRecibosProveedorPreview', IEditorRecibosProveedorPreview, AEditor); - if Assigned(AEditor) then + CreateEditor('EditorRecibosProveedorPreview', IEditorRecibosProveedorPreview, AEditor); + if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Preview; - Release; + try + LoadFromStream(AStream); + Preview; + finally + Release; + AEditor := Nil; + end; end; - finally - FreeAndNil(AStream); - AEditor := Nil; - end; finally - HideHourglassCursor; + FreeAndNil(AStream); end; end; @@ -92,15 +91,18 @@ begin try CreateEditor('EditorRecibosProveedorPreview', IEditorRecibosProveedorPreview, AEditor); if Assigned(AEditor) then - with AEditor do - begin - LoadFromStream(AStream); - Print; - Release; - end; + with AEditor do + begin + try + LoadFromStream(AStream); + Print; + finally + Release; + AEditor := NIL; + end; + end; finally FreeAndNil(AStream); - AEditor := Nil; end; finally HideHourglassCursor; diff --git a/Source/Modulos/Referencias/Controller/uReferenciasController.pas b/Source/Modulos/Referencias/Controller/uReferenciasController.pas index 4ffb3e66..4c488f4d 100644 --- a/Source/Modulos/Referencias/Controller/uReferenciasController.pas +++ b/Source/Modulos/Referencias/Controller/uReferenciasController.pas @@ -132,21 +132,21 @@ var AEditor : IEditorReferencias; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorReferencias', IEditorReferencias, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Referencias := AReferencias; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorReferencias', IEditorReferencias, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Referencias := AReferencias; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; + { procedure TReferenciasController.RecibirAviso(ASujeto: ISujeto; ADataTable: IDAStronglyTypedDataTable); begin diff --git a/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteController.pas b/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteController.pas index 3f5d7ccd..2f2cef95 100644 --- a/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteController.pas +++ b/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteController.pas @@ -222,14 +222,14 @@ var AEditor : IEditorRemesaCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(ARemesaCliente); - CreateEditor('EditorRemesaCliente', IEditorRemesaCliente, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorRemesaCliente) do - begin + RecuperarObjetos(ARemesaCliente); + + CreateEditor('EditorRemesaCliente', IEditorRemesaCliente, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorRemesaCliente) do + begin + try Controller := Self; //OJO ORDEN MUY IMPORTANTE RemesaCliente := ARemesaCliente; @@ -245,13 +245,11 @@ begin //MODO CONSULTAR (Se deja la tabla como estaba) if ReadOnly then SetDataTableReadOnly(ARemesaCliente.DataTable, False); - + finally AEditor.Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; procedure TRemesasClienteController.VerTodos(ARemesasCliente: IBizRemesaCliente); @@ -259,21 +257,16 @@ var AEditor : IEditorRemesasCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorRemesasCliente', IEditorRemesasCliente, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorRemesasCliente) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - RemesasCliente := ARemesasCliente; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := Nil; - HideHourglassCursor; - end; + + CreateEditor('EditorRemesasCliente', IEditorRemesasCliente, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorRemesasCliente) do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + RemesasCliente := ARemesasCliente; + MultiSelect := True; + ShowEmbedded; + end; end; function TRemesasClienteController._Vacio: IBizRemesaCliente; diff --git a/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteReportController.pas b/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteReportController.pas index 73293542..79338452 100644 --- a/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteReportController.pas +++ b/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteReportController.pas @@ -59,24 +59,23 @@ var AEditor : IEditorRemesasClientePreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetReport(ID); try - AStream := FDataModule.GetReport(ID); - try - CreateEditor('EditorRemesasClientePreview', IEditorRemesasClientePreview, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorRemesasClientePreview', IEditorRemesasClientePreview, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try LoadFromStream(AStream); Preview; + finally Release; + AEditor := NIL; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); end; end; @@ -86,21 +85,25 @@ var AEditor : IEditorRemesasClientePreview; begin AEditor := NIL; + ShowHourglassCursor; try - AStream := FDataModule.GetReport(ID); + AStream := FDataModule.GetReport(ID); try CreateEditor('EditorRemesasClientePreview', IEditorRemesasClientePreview, AEditor); if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Print; - Release; + try + LoadFromStream(AStream); + Print; + finally + Release; + AEditor := NIL; + end; end; finally FreeAndNil(AStream); - AEditor := Nil; end; finally HideHourglassCursor; diff --git a/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorController.pas b/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorController.pas index 143731c4..95edc485 100644 --- a/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorController.pas +++ b/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorController.pas @@ -222,14 +222,13 @@ var AEditor : IEditorRemesaProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(ARemesaProveedor); - CreateEditor('EditorRemesaProveedor', IEditorRemesaProveedor, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorRemesaProveedor) do - begin + RecuperarObjetos(ARemesaProveedor); + CreateEditor('EditorRemesaProveedor', IEditorRemesaProveedor, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorRemesaProveedor) do + begin + try Controller := Self; //OJO ORDEN MUY IMPORTANTE RemesaProveedor := ARemesaProveedor; @@ -245,12 +244,10 @@ begin //MODO CONSULTAR (Se deja la tabla como estaba) if ReadOnly then SetDataTableReadOnly(ARemesaProveedor.DataTable, False); - + finally AEditor.Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; + AEditor := NIL; + end; end; end; @@ -259,21 +256,16 @@ var AEditor : IEditorRemesasProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorRemesasProveedor', IEditorRemesasProveedor, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorRemesasProveedor) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - RemesasProveedor := ARemesasProveedor; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := Nil; - HideHourglassCursor; - end; + + CreateEditor('EditorRemesasProveedor', IEditorRemesasProveedor, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorRemesasProveedor) do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE + RemesasProveedor := ARemesasProveedor; + MultiSelect := True; + ShowEmbedded; + end; end; function TRemesasProveedorController._Vacio: IBizRemesaProveedor; diff --git a/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorReportController.pas b/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorReportController.pas index fd8b5e8d..4cef2e11 100644 --- a/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorReportController.pas +++ b/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorReportController.pas @@ -59,24 +59,23 @@ var AEditor : IEditorRemesasProveedorPreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetReport(ID); try - AStream := FDataModule.GetReport(ID); - try - CreateEditor('EditorRemesasProveedorPreview', IEditorRemesasProveedorPreview, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorRemesasProveedorPreview', IEditorRemesasProveedorPreview, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try LoadFromStream(AStream); Preview; + finally Release; + AEditor := NIL; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); end; end; @@ -89,19 +88,22 @@ begin ShowHourglassCursor; try - AStream := FDataModule.GetReport(ID); + AStream := FDataModule.GetReport(ID); try CreateEditor('EditorRemesasProveedorPreview', IEditorRemesasProveedorPreview, AEditor); if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Print; - Release; + try + LoadFromStream(AStream); + Print; + finally + Release; + AEditor := NIL; + end; end; finally FreeAndNil(AStream); - Release; end; finally HideHourglassCursor; diff --git a/Source/Modulos/Tipos de IVA/Controller/uTiposIVAController.pas b/Source/Modulos/Tipos de IVA/Controller/uTiposIVAController.pas index c9e52448..dc459592 100644 --- a/Source/Modulos/Tipos de IVA/Controller/uTiposIVAController.pas +++ b/Source/Modulos/Tipos de IVA/Controller/uTiposIVAController.pas @@ -234,20 +234,18 @@ var AEditor : IEditorTipoIVA; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorTipoIVA', IEditorTipoIVA, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - TipoIVA := ATipoIVA; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + CreateEditor('EditorTipoIVA', IEditorTipoIVA, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + TipoIVA := ATipoIVA; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TTiposIVAController.VerTodos(ATiposIVA: IBizTipoIVA); @@ -255,20 +253,19 @@ var AEditor : IEditorTiposIVA; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorTiposIVA', IEditorTiposIVA, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - TiposIVA := ATiposIVA; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorTiposIVA', IEditorTiposIVA, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + TiposIVA := ATiposIVA; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; function TTiposIVAController.Eliminar(ATipoIVA: IBizTipoIVA): Boolean; @@ -283,7 +280,6 @@ begin ATipoIVA.Delete; ATipoIVA.DataTable.ApplyUpdates; - HideHourglassCursor; Result := True; finally HideHourglassCursor; diff --git a/Source/Modulos/Tipos de venta/Controller/uTiposVentaController.pas b/Source/Modulos/Tipos de venta/Controller/uTiposVentaController.pas index 1f79e606..5615652b 100644 --- a/Source/Modulos/Tipos de venta/Controller/uTiposVentaController.pas +++ b/Source/Modulos/Tipos de venta/Controller/uTiposVentaController.pas @@ -138,20 +138,19 @@ var AEditor : IEditorTiposVenta; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorTiposVenta', IEditorTiposVenta, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - TiposVenta := ATiposVenta; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorTiposVenta', IEditorTiposVenta, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + TiposVenta := ATiposVenta; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; { procedure TTiposVentaController.RecibirAviso(ASujeto: ISujeto; ADataTable: IDAStronglyTypedDataTable); diff --git a/Source/Modulos/Unidades de medida/Controller/uUnidadesMedidaController.pas b/Source/Modulos/Unidades de medida/Controller/uUnidadesMedidaController.pas index 2d38b040..3a965aea 100644 --- a/Source/Modulos/Unidades de medida/Controller/uUnidadesMedidaController.pas +++ b/Source/Modulos/Unidades de medida/Controller/uUnidadesMedidaController.pas @@ -152,21 +152,20 @@ var AEditor : IEditorUnidadesMedida; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorUnidadesMedida', IEditorUnidadesMedida, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - UnidadesMedida := AUnidadesMedida; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorUnidadesMedida', IEditorUnidadesMedida, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + UnidadesMedida := AUnidadesMedida; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; function TUnidadesMedidaController.Eliminar(AUnidadMedida: IBizUnidadMedida): Boolean;