diff --git a/Source/ApplicationBase/Empresas/Controller/uDatosBancariosEmpresaController.pas b/Source/ApplicationBase/Empresas/Controller/uDatosBancariosEmpresaController.pas index 81e99409..e40fdb8b 100644 --- a/Source/ApplicationBase/Empresas/Controller/uDatosBancariosEmpresaController.pas +++ b/Source/ApplicationBase/Empresas/Controller/uDatosBancariosEmpresaController.pas @@ -47,20 +47,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; + CreateEditor('EditorDatosBancariosEmpresa', IEditorDatosBancariosEmpresa, AEditor); + if Assigned(AEditor) then + begin + with AEditor do + begin + try + DatosBancarios := ADatosBancarios; + Controller := Self; + ShowModal; + finally + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; + end; end; end; diff --git a/Source/ApplicationBase/Empresas/Controller/uEmpresasController.pas b/Source/ApplicationBase/Empresas/Controller/uEmpresasController.pas index 02dbf01f..f03e8e94 100644 --- a/Source/ApplicationBase/Empresas/Controller/uEmpresasController.pas +++ b/Source/ApplicationBase/Empresas/Controller/uEmpresasController.pas @@ -271,21 +271,19 @@ 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); @@ -300,9 +298,13 @@ begin if Assigned(AEditor) then with AEditor do begin - Contactos := AContactos; - Controller := Self; - ShowEmbedded; + try + Contactos := AContactos; + Controller := Self; + ShowModal; + finally + Release; + end; end; finally AEditor := NIL; diff --git a/Source/ApplicationBase/Usuarios/Controller/uPerfilesUsuarioController.pas b/Source/ApplicationBase/Usuarios/Controller/uPerfilesUsuarioController.pas index d8240540..c51f7e6b 100644 --- a/Source/ApplicationBase/Usuarios/Controller/uPerfilesUsuarioController.pas +++ b/Source/ApplicationBase/Usuarios/Controller/uPerfilesUsuarioController.pas @@ -143,21 +143,25 @@ begin APerfilesUsuario := FDataModule.GetPerfiles; if Assigned(APerfilesUsuario) then begin - APerfilesUsuario.Active := True; - ShowHourglassCursor; try + APerfilesUsuario.Active := True; CreateEditor('EditorPerfilesUsuario', IEditorPerfilesUsuario, AEditor); if Assigned(AEditor) then - with (AEditor as IEditorPerfilesUsuario) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - PerfilesUsuario := APerfilesUsuario; - ShowEmbedded; - end; + begin + with (AEditor as IEditorPerfilesUsuario) do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + PerfilesUsuario := APerfilesUsuario; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; + end; finally - AEditor := NIL; APerfilesUsuario := NIL; - HideHourglassCursor; end; end; end; @@ -170,22 +174,23 @@ begin FPerfil := FDataModule.GetPerfil(AIDPerfil); if Assigned(FPerfil) then begin - FPerfil.Active := True; - ShowHourglassCursor; try + FPerfil.Active := True; CreateEditor('EditorPerfilUsuario', IEditorPerfilUsuario, AEditor); if Assigned(AEditor) then with (AEditor as IEditorPerfilUsuario) do begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - PerfilUsuario := FPerfil; - ShowModal; - Release; + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + PerfilUsuario := FPerfil; + ShowModal; + finally + Release; + AEditor := NIL; + end; end; finally - AEditor := NIL; FPerfil := NIL; - HideHourglassCursor; end; end; end; @@ -198,21 +203,23 @@ begin APerfilesUsuario := FDataModule.GetPerfiles; if Assigned(APerfilesUsuario) then begin - APerfilesUsuario.Active := True; - ShowHourglassCursor; try + APerfilesUsuario.Active := True; CreateEditor('EditorPerfilesUsuario', IEditorPerfilesUsuario, AEditor); if Assigned(AEditor) then with (AEditor as IEditorPerfilesUsuario) do begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - PerfilesUsuario := APerfilesUsuario; - ShowEmbedded; + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + PerfilesUsuario := APerfilesUsuario; + ShowModal; + finally + Release; + AEditor := NIL; + end; end; finally - AEditor := NIL; APerfilesUsuario := NIL; - HideHourglassCursor; end; end; end; diff --git a/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas b/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas index 32cbd176..0b601bf3 100644 --- a/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas +++ b/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas @@ -758,20 +758,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; + CreateEditor('EditorPerfilUsuario', IEditorPerfilUsuario, AEditor); + if Assigned(AEditor) then + begin + with (AEditor as IEditorPerfilUsuario) do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + PerfilUsuario := APerfil; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; end; @@ -783,21 +783,23 @@ begin APerfilesUsuario := FDataModule.GetPerfiles; if Assigned(APerfilesUsuario) then begin - APerfilesUsuario.Active := True; - ShowHourglassCursor; try + APerfilesUsuario.Active := True; CreateEditor('EditorPerfilesUsuario', IEditorPerfilesUsuario, AEditor); if Assigned(AEditor) then - with (AEditor as IEditorPerfilesUsuario) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - PerfilesUsuario := APerfilesUsuario; - ShowEmbedded; - end; + with (AEditor as IEditorPerfilesUsuario) do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + PerfilesUsuario := APerfilesUsuario; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; finally - AEditor := NIL; APerfilesUsuario := NIL; - HideHourglassCursor; end; end; end; @@ -818,21 +820,19 @@ 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; @@ -844,20 +844,22 @@ 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; + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Usuarios := FUsuarios; + ShowModal; + finally + Release; + AEditor := NIL; + end; end; finally - AEditor := NIL; FUsuarios := NIL; - HideHourglassCursor; end; end; end; @@ -873,20 +875,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; + + CreateEditor('EditorLogin', IEditorLogin, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; + Result := (AEditor.ShowModal = mrOk); + finally + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; procedure TUsuariosController.FiltrarEmpresa(AUsuario: IBizUsuario); diff --git a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas index 074f16bc..80a60c5a 100644 --- a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas +++ b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas @@ -575,22 +575,21 @@ var AEditor : IEditorDBItem; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(AAlbaran); + RecuperarObjetos(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 - 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 //MODO CONSULTAR + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Albaran := AAlbaran; + if not EsModificable(AAlbaran) then begin SetDataTableReadOnly(AAlbaran.DataTable, True); @@ -602,13 +601,11 @@ begin //MODO CONSULTAR (Se deja la tabla como estaba) if ReadOnly then SetDataTableReadOnly(AAlbaran.DataTable, False); - - AEditor.Release; + finally + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; procedure TAlbaranesClienteController.VerDireccionEntrega( @@ -617,21 +614,20 @@ 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 + begin + try + Albaran := AAlbaran; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TAlbaranesClienteController.VerTodosAlbaranes(AAlbarans: IBizAlbaranCliente; @@ -641,18 +637,17 @@ var AEditor : IEditorAlbaranesCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorAlbaranesCliente', IEditorAlbaranesCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorAlbaranesCliente', IEditorAlbaranesCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try if not EsCadenaVacia(AWindowCaption) then AEditor.WindowCaption := AWindowCaption; if not EsCadenaVacia(AHeaderText) then AEditor.HeaderText := AHeaderText; - + Controller := Self; //OJO ORDEN MUY IMPORTANTE Albaranes := AAlbarans; MultiSelect := True; @@ -661,11 +656,12 @@ begin ShowModal else ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + finally + if AVerModal then + Release; + AEditor := NIL; + end; + end; end; procedure TAlbaranesClienteController.VerTodosAlbaranesDev(AAlbarans: IBizAlbaranCliente; @@ -675,12 +671,11 @@ var AEditor : IEditorAlbaranesDevCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorAlbaranesDevCliente', IEditorAlbaranesDevCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorAlbaranesDevCliente', IEditorAlbaranesDevCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try if not EsCadenaVacia(AWindowCaption) then AEditor.WindowCaption := AWindowCaption; @@ -690,15 +685,17 @@ begin Controller := Self; //OJO ORDEN MUY IMPORTANTE Albaranes := AAlbarans; MultiSelect := True; - if AVerModal then - ShowModal - else - ShowEmbedded; + + if AVerModal then + ShowModal + else + ShowEmbedded; + finally + if AVerModal then + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; function TAlbaranesClienteController._Vacio: IBizAlbaranCliente; @@ -724,24 +721,22 @@ var AEditor : IEditorElegirAlbaranesCliente; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirAlbaranesCliente', IEditorElegirAlbaranesCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + 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; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + 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 2804b1c5..aa0e60a0 100644 --- a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteReportController.pas +++ b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteReportController.pas @@ -70,24 +70,22 @@ 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 + CreateEditor('EditorAlbaranesClientePreview', IEditorAlbaranesClientePreview, AEditor); + if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Preview; - Release; + try + LoadFromStream(AStream); + Preview; + finally + Release; + end; end; - finally - FreeAndNil(AStream); - AEditor := Nil; - end; finally - HideHourglassCursor; + FreeAndNil(AStream); + AEditor := Nil; end; end; @@ -97,24 +95,22 @@ 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 + CreateEditor('EditorAlbaranesClientePreview', IEditorAlbaranesClientePreview, AEditor); + if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Print; - Release; + try + LoadFromStream(AStream); + Print; + finally + Release; + end; end; - finally - FreeAndNil(AStream); - AEditor := Nil; - end; finally - HideHourglassCursor; + FreeAndNil(AStream); + AEditor := Nil; end; end; @@ -172,29 +168,24 @@ 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; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); + AEditor := Nil; end; end; diff --git a/Source/Modulos/Albaranes de cliente/Controller/uArticulosAlbaranClienteController.pas b/Source/Modulos/Albaranes de cliente/Controller/uArticulosAlbaranClienteController.pas index fa1531ad..0d22ad3b 100644 --- a/Source/Modulos/Albaranes de cliente/Controller/uArticulosAlbaranClienteController.pas +++ b/Source/Modulos/Albaranes de cliente/Controller/uArticulosAlbaranClienteController.pas @@ -27,24 +27,22 @@ 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 e2dbc9f1..483bc09e 100644 --- a/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorController.pas +++ b/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorController.pas @@ -656,18 +656,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; @@ -683,10 +683,10 @@ begin //MODO CONSULTAR (Se deja la tabla como estaba) if ReadOnly then SetDataTableReadOnly(AAlbaran.DataTable, False); + finally + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; end; end; @@ -695,20 +695,19 @@ 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; - 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; @@ -718,12 +717,11 @@ var AEditor : IEditorAlbaranesProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorAlbaranesProveedor', IEditorAlbaranesProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorAlbaranesProveedor', IEditorAlbaranesProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try if not EsCadenaVacia(AWindowCaption) then AEditor.WindowCaption := AWindowCaption; @@ -737,11 +735,12 @@ begin ShowModal else ShowEmbedded; + finally + if AVerModal then + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; procedure TAlbaranesProveedorController.VerTodosAlbaranesDev(AAlbarans: IBizAlbaranProveedor; @@ -751,12 +750,11 @@ var AEditor : IEditorAlbaranesDevProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorAlbaranesDevProveedor', IEditorAlbaranesDevProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorAlbaranesDevProveedor', IEditorAlbaranesDevProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try if not EsCadenaVacia(AWindowCaption) then AEditor.WindowCaption := AWindowCaption; @@ -770,11 +768,12 @@ begin ShowModal else ShowEmbedded; + finally + if AVerModal then + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; function TAlbaranesProveedorController._Vacio: IBizAlbaranProveedor; @@ -800,23 +799,22 @@ var AEditor : IEditorElegirAlbaranesProveedor; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirAlbaranesProveedor', IEditorElegirAlbaranesProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + 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; - finally - AEditor := NIL; - HideHourglassCursor; - 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..52062e0d 100644 --- a/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorReportController.pas +++ b/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorReportController.pas @@ -60,24 +60,22 @@ 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; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); + AEditor := Nil; end; end; @@ -95,9 +93,12 @@ begin if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Print; - Release; + try + LoadFromStream(AStream); + Print; + finally + Release; + end; end; finally FreeAndNil(AStream); diff --git a/Source/Modulos/Albaranes de proveedor/Controller/uArticulosAlbaranProveedorController.pas b/Source/Modulos/Albaranes de proveedor/Controller/uArticulosAlbaranProveedorController.pas index f500c3f3..cef0182a 100644 --- a/Source/Modulos/Albaranes de proveedor/Controller/uArticulosAlbaranProveedorController.pas +++ b/Source/Modulos/Albaranes de proveedor/Controller/uArticulosAlbaranProveedorController.pas @@ -27,12 +27,11 @@ var AEditor : IEditorElegirArticulosAlbaranesProveedor; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirArticulosAlbaranesProveedor', IEditorElegirArticulosAlbaranesProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorElegirArticulosAlbaranesProveedor', IEditorElegirArticulosAlbaranesProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try Controller := Self; Articulos := AArticulos; Proveedor := AProveedor; @@ -40,12 +39,11 @@ begin Mensaje := AMensaje; if IsPositiveResult(ShowModal) then Result := ArticulosSeleccionados; - Release; + finally + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; end. diff --git a/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas b/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas index 0b8eb242..12bfa8aa 100644 --- a/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas +++ b/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas @@ -218,22 +218,20 @@ 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; @@ -242,21 +240,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 - Result := AlmacenSeleccionado; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorListaAlmacenes', IEditorListaAlmacenes, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Almacenes := AAlmacenes; + if IsPositiveResult(ShowModal) then + Result := AlmacenSeleccionado; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TAlmacenesController.VerTodos(AAlmacenes: IBizAlmacen); @@ -264,19 +261,19 @@ 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 + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Almacenes := AAlmacenes; + ShowEmbedded; + finally + AEditor := NIL; + end; + end; end; function TAlmacenesController._Vacio: IBizAlmacen; diff --git a/Source/Modulos/Articulos/Controller/uArticulosController.pas b/Source/Modulos/Articulos/Controller/uArticulosController.pas index 56a01fab..e9e3fd7d 100644 --- a/Source/Modulos/Articulos/Controller/uArticulosController.pas +++ b/Source/Modulos/Articulos/Controller/uArticulosController.pas @@ -441,23 +441,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); @@ -483,19 +482,18 @@ var AEditor : IEditorArticulos; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorArticulos', IEditorArticulos, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorArticulos) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - ShowEmbedded; - end; - finally - AEditor := Nil; - HideHourglassCursor; - end; + + CreateEditor('EditorArticulos', IEditorArticulos, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorArticulos) do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + ShowEmbedded; + finally + AEditor := Nil; + end; + end; end; function TArticulosController._Vacio: IBizArticulo; @@ -522,24 +520,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 - Result := ArticulosSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + 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; + 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 099a9338..e87b5ef3 100644 --- a/Source/Modulos/Banca electronica/Controller/uBancaElectronicaController.pas +++ b/Source/Modulos/Banca electronica/Controller/uBancaElectronicaController.pas @@ -182,31 +182,29 @@ 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; + end; + end; end; diff --git a/Source/Modulos/Contactos/Controller/uClientesController.pas b/Source/Modulos/Contactos/Controller/uClientesController.pas index a6be7b7d..4d5b5f20 100644 --- a/Source/Modulos/Contactos/Controller/uClientesController.pas +++ b/Source/Modulos/Contactos/Controller/uClientesController.pas @@ -126,6 +126,7 @@ begin if IsPositiveResult(AEditor.ShowModal) then Result := AEditor.ContactosSeleccionados; finally + Release; AEditor := NIL; Application.ProcessMessages; end; @@ -148,6 +149,7 @@ begin if IsPositiveResult(AEditor.ShowModal) then Result := AEditor.DireccionSeleccionada; finally + Release; AEditor := NIL; Application.ProcessMessages; end; @@ -170,6 +172,7 @@ begin if IsPositiveResult(AEditor.ShowModal) then Result := AEditor.PersonaSeleccionada; finally + Release; AEditor := NIL; Application.ProcessMessages; end; @@ -385,20 +388,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; - 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.VerAlbaranesDeCliente(ACliente: IBizCliente); @@ -490,21 +493,20 @@ 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 + try + Contactos := AContactos; + Controller := Self; + MultiSelect := True; + ShowEmbedded; + finally + AEditor := NIL; + end; + end; end; end. diff --git a/Source/Modulos/Contactos/Controller/uDatosBancariosContactoController.pas b/Source/Modulos/Contactos/Controller/uDatosBancariosContactoController.pas index 5c89adb3..73eb0c6c 100644 --- a/Source/Modulos/Contactos/Controller/uDatosBancariosContactoController.pas +++ b/Source/Modulos/Contactos/Controller/uDatosBancariosContactoController.pas @@ -70,21 +70,20 @@ var AEditor : IEditorDatoBancarioContacto; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorDatoBancarioContacto', IEditorDatoBancarioContacto, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + + CreateEditor('EditorDatoBancarioContacto', IEditorDatoBancarioContacto, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try DatoBancario := ADatoBancario; Controller := Self; ShowModal; + finally Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; end. diff --git a/Source/Modulos/Contactos/Controller/uDireccionesContactoController.pas b/Source/Modulos/Contactos/Controller/uDireccionesContactoController.pas index d3fcf03d..34503b0f 100644 --- a/Source/Modulos/Contactos/Controller/uDireccionesContactoController.pas +++ b/Source/Modulos/Contactos/Controller/uDireccionesContactoController.pas @@ -135,21 +135,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/uEmpleadosController.pas b/Source/Modulos/Contactos/Controller/uEmpleadosController.pas index ae8341e8..1e2a9df0 100644 --- a/Source/Modulos/Contactos/Controller/uEmpleadosController.pas +++ b/Source/Modulos/Contactos/Controller/uEmpleadosController.pas @@ -266,21 +266,20 @@ var AEditor : IEditorEmpleado; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorEmpleado', IEditorEmpleado, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Contacto := AContacto; - Controller := Self; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorEmpleado', IEditorEmpleado, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Contacto := AContacto; + Controller := Self; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TEmpleadosController.VerTodos(AContactos: IBizContacto); @@ -288,21 +287,20 @@ var AEditor : IEditorEmpleados; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorEmpleados', IEditorEmpleados, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Contactos := AContactos; - Controller := Self; - MultiSelect := True; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorEmpleados', IEditorEmpleados, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Contactos := AContactos; + Controller := Self; + MultiSelect := True; + ShowEmbedded; + finally + AEditor := NIL; + end; + end; end; end. diff --git a/Source/Modulos/Contactos/Controller/uEtiquetasContactosReportController.pas b/Source/Modulos/Contactos/Controller/uEtiquetasContactosReportController.pas index f963a076..0771b0a9 100644 --- a/Source/Modulos/Contactos/Controller/uEtiquetasContactosReportController.pas +++ b/Source/Modulos/Contactos/Controller/uEtiquetasContactosReportController.pas @@ -58,28 +58,24 @@ var AEditor : IEditorEtiquetasContactosPreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetReport(ListaID); try - AStream := FDataModule.GetReport(ListaID); - try - CreateEditor('EditorEtiquetasContactosPreview', IEditorEtiquetasContactosPreview, AEditor); - if Assigned(AEditor) then - begin - try - AEditor.Controller := Self; - AEditor.ListaID := ListaID; - AEditor.LoadFromStream(AStream); - AEditor.Preview; - finally - AEditor.Release; - end; + CreateEditor('EditorEtiquetasContactosPreview', IEditorEtiquetasContactosPreview, AEditor); + if Assigned(AEditor) then + begin + try + AEditor.Controller := Self; + AEditor.ListaID := ListaID; + AEditor.LoadFromStream(AStream); + AEditor.Preview; + finally + AEditor.Release; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); + AEditor := Nil; end; end; diff --git a/Source/Modulos/Contactos/Controller/uFichasEmpleadoReportController.pas b/Source/Modulos/Contactos/Controller/uFichasEmpleadoReportController.pas index ac2f5026..3298c705 100644 --- a/Source/Modulos/Contactos/Controller/uFichasEmpleadoReportController.pas +++ b/Source/Modulos/Contactos/Controller/uFichasEmpleadoReportController.pas @@ -58,28 +58,24 @@ var AEditor : IEditorFichasEmpleadoPreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetReport(ListaID); try - AStream := FDataModule.GetReport(ListaID); - try - CreateEditor('EditorFichasEmpleadoPreview', IEditorFichasEmpleadoPreview, AEditor); - if Assigned(AEditor) then - begin - try - AEditor.Controller := Self; - AEditor.ListaID := ListaID; - AEditor.LoadFromStream(AStream); - AEditor.Preview; - finally - AEditor.Release; - end; + CreateEditor('EditorFichasEmpleadoPreview', IEditorFichasEmpleadoPreview, AEditor); + if Assigned(AEditor) then + begin + try + AEditor.Controller := Self; + AEditor.ListaID := ListaID; + AEditor.LoadFromStream(AStream); + AEditor.Preview; + finally + AEditor.Release; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); + AEditor := Nil; end; end; diff --git a/Source/Modulos/Contactos/Controller/uGruposClienteController.pas b/Source/Modulos/Contactos/Controller/uGruposClienteController.pas index c4e98c85..4a901736 100644 --- a/Source/Modulos/Contactos/Controller/uGruposClienteController.pas +++ b/Source/Modulos/Contactos/Controller/uGruposClienteController.pas @@ -140,21 +140,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/uGruposEmpleadoController.pas b/Source/Modulos/Contactos/Controller/uGruposEmpleadoController.pas index 40bfd1cd..2a71dff4 100644 --- a/Source/Modulos/Contactos/Controller/uGruposEmpleadoController.pas +++ b/Source/Modulos/Contactos/Controller/uGruposEmpleadoController.pas @@ -140,21 +140,20 @@ var AEditor : IEditorGruposEmpleado; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorGruposEmpleado', IEditorGruposEmpleado, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - GruposEmpleado := AGruposEmpleado; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorGruposEmpleado', IEditorGruposEmpleado, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + GruposEmpleado := AGruposEmpleado; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; function TGruposEmpleadoController.Eliminar(AGrupoEmpleado: IBizGrupoEmpleado): Boolean; diff --git a/Source/Modulos/Contactos/Controller/uGruposProveedorController.pas b/Source/Modulos/Contactos/Controller/uGruposProveedorController.pas index 335d9638..6b891b5e 100644 --- a/Source/Modulos/Contactos/Controller/uGruposProveedorController.pas +++ b/Source/Modulos/Contactos/Controller/uGruposProveedorController.pas @@ -140,21 +140,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/uPersonalContactoController.pas b/Source/Modulos/Contactos/Controller/uPersonalContactoController.pas index 51d25198..2cf04697 100644 --- a/Source/Modulos/Contactos/Controller/uPersonalContactoController.pas +++ b/Source/Modulos/Contactos/Controller/uPersonalContactoController.pas @@ -69,21 +69,19 @@ var AEditor : IEditorPersonalContacto; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorPersonalContacto', IEditorPersonalContacto, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + + CreateEditor('EditorPersonalContacto', IEditorPersonalContacto, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try Personal := APersonal; Controller := Self; ShowModal; + finally Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; + end; end; end. diff --git a/Source/Modulos/Contactos/Controller/uProveedoresController.pas b/Source/Modulos/Contactos/Controller/uProveedoresController.pas index 022d7b74..68b61d37 100644 --- a/Source/Modulos/Contactos/Controller/uProveedoresController.pas +++ b/Source/Modulos/Contactos/Controller/uProveedoresController.pas @@ -121,23 +121,23 @@ var AEditor : IEditorElegirProveedores; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirProveedores', IEditorElegirProveedores, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + + 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; + Result := ContactosSeleccionados; + finally + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; function TProveedoresController.ElegirDireccionEntrega(AProveedor: IBizProveedor; @@ -146,21 +146,21 @@ var AEditor : IEditorElegirDireccionEntrega; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirDireccionEntrega', IEditorElegirDireccionEntrega, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Contacto := AProveedor; - Mensaje := AMensaje; - if IsPositiveResult(ShowModal) then - Result := DireccionSeleccionada; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorElegirDireccionEntrega', IEditorElegirDireccionEntrega, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Contacto := AProveedor; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := DireccionSeleccionada; + finally + Release; + AEditor := NIL; + end; + end; end; function TProveedoresController.Eliminar(AProveedor: IBizContacto; AllItems: Boolean): Boolean; @@ -312,20 +312,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; - 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.VerAlbaranesDeProveedor( @@ -443,21 +443,20 @@ 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 + try + Contactos := AContactos; + Controller := Self; + MultiSelect := True; + ShowEmbedded; + finally + AEditor := NIL; + end; + end; end; end. diff --git a/Source/Modulos/Fabricantes/Controller/uFabricantesController.pas b/Source/Modulos/Fabricantes/Controller/uFabricantesController.pas index ca883bdf..984db5e3 100644 --- a/Source/Modulos/Fabricantes/Controller/uFabricantesController.pas +++ b/Source/Modulos/Fabricantes/Controller/uFabricantesController.pas @@ -152,21 +152,20 @@ var AEditor : IEditorFabricantes; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorFabricantes', IEditorFabricantes, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Fabricantes := AFabricantes; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorFabricantes', IEditorFabricantes, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Fabricantes := AFabricantes; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; function TFabricantesController.Eliminar(AFabricante: IBizFabricante): Boolean; diff --git a/Source/Modulos/Facturas de cliente/Controller/uArticulosFacturaClienteController.pas b/Source/Modulos/Facturas de cliente/Controller/uArticulosFacturaClienteController.pas index 1ac9bd21..298f9f6d 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 959b9150..e9f59fa9 100644 --- a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas +++ b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas @@ -606,36 +606,34 @@ 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); + CreateEditor('EditorFacturaCliente', IEditorFacturaCliente, AEditor); - //MODO CONSULTAR - if not EsModificable(AFactura) then - begin - SetDataTableReadOnly(AFactura.DataTable, True); - ReadOnly := True; + 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; + AEditor := NIL; 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; @@ -645,12 +643,12 @@ var AEditor : IEditorFacturasCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorFacturasCliente', IEditorFacturasCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + + CreateEditor('EditorFacturasCliente', IEditorFacturasCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try if not EsCadenaVacia(AWindowCaption) then AEditor.WindowCaption := AWindowCaption; @@ -664,11 +662,12 @@ begin ShowModal else ShowEmbedded; + finally + if AVerModal then + Release; + AEditor := Nil; end; - finally - AEditor := Nil; - HideHourglassCursor; - end; + end; end; function TFacturasClienteController._Vacio: IBizFacturaCliente; @@ -695,24 +694,23 @@ 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 c9ea1aed..30b8523f 100644 --- a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteReportController.pas +++ b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteReportController.pas @@ -115,26 +115,25 @@ var AEditor : IEditorFacturasClientePreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetRptFacturas(AListaID); try - AStream := FDataModule.GetRptFacturas(AListaID); - try - CreateEditor('EditorFacturasClientePreview', IEditorFacturasClientePreview, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - AEditor.Controller := Self; - ListaID := AListaID; - LoadFromStream(AStream); - Preview; - Release; - end; - finally - FreeAndNil(AStream); - AEditor := Nil; + CreateEditor('EditorFacturasClientePreview', IEditorFacturasClientePreview, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + AEditor.Controller := Self; + ListaID := AListaID; + LoadFromStream(AStream); + Preview; + finally + Release; + end; end; finally - HideHourglassCursor; + FreeAndNil(AStream); + AEditor := Nil; end; end; @@ -152,10 +151,13 @@ begin if Assigned(AEditor) then with AEditor do begin - AEditor.Controller := Self; - LoadFromStream(AStream); - Print; - Release; + try + AEditor.Controller := Self; + LoadFromStream(AStream); + Print; + finally + Release; + end; end; finally FreeAndNil(AStream); diff --git a/Source/Modulos/Facturas de proveedor/Controller/uArticulosFacturaProveedorController.pas b/Source/Modulos/Facturas de proveedor/Controller/uArticulosFacturaProveedorController.pas index 50d54fbf..f3249b84 100644 --- a/Source/Modulos/Facturas de proveedor/Controller/uArticulosFacturaProveedorController.pas +++ b/Source/Modulos/Facturas de proveedor/Controller/uArticulosFacturaProveedorController.pas @@ -28,25 +28,24 @@ 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 d6c7a12a..186d19f8 100644 --- a/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorController.pas +++ b/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorController.pas @@ -463,34 +463,34 @@ var AEditor : IEditorFacturaProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarProveedor(AFactura); - CreateEditor('EditorFacturaProveedor', IEditorFacturaProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Factura := AFactura; + RecuperarProveedor(AFactura); + CreateEditor('EditorFacturaProveedor', IEditorFacturaProveedor, AEditor); - //MODO CONSULTAR - if not EsModificable(AFactura) then - begin - SetDataTableReadOnly(AFactura.DataTable, True); - ReadOnly := True; - end; + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Factura := AFactura; - ShowModal; + //MODO CONSULTAR + if not EsModificable(AFactura) then + begin + SetDataTableReadOnly(AFactura.DataTable, True); + ReadOnly := True; + end; - //MODO CONSULTAR (Se deja la tabla como estaba) - if ReadOnly then - SetDataTableReadOnly(AFactura.DataTable, False); + ShowModal; + + //MODO CONSULTAR (Se deja la tabla como estaba) + if ReadOnly then + SetDataTableReadOnly(AFactura.DataTable, False); + finally + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; procedure TFacturasProveedorController.VerTodos(AFacturas: IBizFacturaProveedor; @@ -500,28 +500,29 @@ var AEditor : IEditorFacturasProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorFacturasProveedor', IEditorFacturasProveedor, AEditor); - with AEditor do - begin - if not EsCadenaVacia(AWindowCaption) then - AEditor.WindowCaption := AWindowCaption; - if not EsCadenaVacia(AHeaderText) then - AEditor.HeaderText := AHeaderText; + CreateEditor('EditorFacturasProveedor', IEditorFacturasProveedor, AEditor); + with AEditor do + begin + try + if not EsCadenaVacia(AWindowCaption) then + AEditor.WindowCaption := AWindowCaption; - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Facturas := AFacturas; - MultiSelect := True; + if not EsCadenaVacia(AHeaderText) then + AEditor.HeaderText := AHeaderText; + + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Facturas := AFacturas; + MultiSelect := True; + if AVerModal then + ShowModal + else + ShowEmbedded; + finally if AVerModal then - ShowModal - else - ShowEmbedded; + Release; + AEditor := Nil; end; - finally - AEditor := Nil; - HideHourglassCursor; end; end; @@ -550,23 +551,22 @@ 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; + try + Controller := Self; + Facturas := AFacturas; + MultiSelect := AMultiSelect; + Mensaje := AMensaje; + if IsPositiveResult(ShowModal) then + Result := FacturasProveedoreSeleccionados; + finally + Release; + AEditor := NIL; + end; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; } end; diff --git a/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorReportController.pas b/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorReportController.pas index 35dabf1c..832c56da 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; + end; + end; finally - HideHourglassCursor; + FreeAndNil(AStream); + AEditor := Nil; end; end; @@ -95,9 +94,12 @@ begin if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Print; - Release; + try + LoadFromStream(AStream); + Print; + finally + Release; + end; end; finally FreeAndNil(AStream); diff --git a/Source/Modulos/Familias/Controller/uFamiliasController.pas b/Source/Modulos/Familias/Controller/uFamiliasController.pas index a8f157cd..87ded847 100644 --- a/Source/Modulos/Familias/Controller/uFamiliasController.pas +++ b/Source/Modulos/Familias/Controller/uFamiliasController.pas @@ -145,21 +145,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 41db2d5b..be3e1dbd 100644 --- a/Source/Modulos/Formas de pago/Controller/uFormasPagoController.pas +++ b/Source/Modulos/Formas de pago/Controller/uFormasPagoController.pas @@ -178,20 +178,19 @@ 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; - end; + + CreateEditor('EditorFormaPago', IEditorFormaPago, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + FormaPago := AFormaPago; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TFormasPagoController.VerTodos(AFormasPago: IBizFormaPago); @@ -199,20 +198,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/Gestor de informes/Controller/uGestorInformesController.pas b/Source/Modulos/Gestor de informes/Controller/uGestorInformesController.pas index cd52237e..6eda7e8d 100644 --- a/Source/Modulos/Gestor de informes/Controller/uGestorInformesController.pas +++ b/Source/Modulos/Gestor de informes/Controller/uGestorInformesController.pas @@ -281,27 +281,22 @@ var AEditor : IEditorInformeIVAClientesReport; begin AEditor := NIL; - ShowHourglassCursor; - try - try - CreateEditor('EditorInformeIVAClientesReport', IEditorInformeIVAClientesReport, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorInformeIVAClientesReport', IEditorInformeIVAClientesReport, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try AEditor.Controller := Self; AEditor.Title := 'Listado de IVA de facturas de cliente'; AStream := FDataModule.GenerarInformeIVAClientes(AppFactuGES.EmpresaActiva.ID, FechaInicio, FechaFin, ListaIDClientes, DesglosadoCliente, ImporteMinimo); LoadFromStream(AStream); Preview; + finally Release; + AEditor := Nil; + FreeAndNil(AStream); end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; - finally - HideHourglassCursor; - end; end; procedure TGestorInformesController.VerInformeIVAProveedores; @@ -310,27 +305,23 @@ var AEditor : IEditorInformeIVAProveedoresReport; begin AEditor := NIL; - ShowHourglassCursor; - try - try - CreateEditor('EditorInformeIVAProveedoresReport', IEditorInformeIVAProveedoresReport, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + + CreateEditor('EditorInformeIVAProveedoresReport', IEditorInformeIVAProveedoresReport, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try AEditor.Controller := Self; AEditor.Title := 'Listado de IVA de facturas de proveedor'; AStream := FDataModule.GenerarInformeIVAProveedores(AppFactuGES.EmpresaActiva.ID, FechaInicio, FechaFin, ListaIDProveedores, DesglosadoProveedor, ImporteMinimo); LoadFromStream(AStream); Preview; + finally Release; + AEditor := Nil; + FreeAndNil(AStream); end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; - finally - HideHourglassCursor; - end; end; procedure TGestorInformesController.VerInformeListadoFacturasCli; @@ -339,27 +330,23 @@ var AEditor : IEditorInformeFacturasClienteReport; begin AEditor := NIL; - ShowHourglassCursor; - try - try - CreateEditor('EditorInformeFacturasClienteReport', IEditorInformeFacturasClienteReport, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + + CreateEditor('EditorInformeFacturasClienteReport', IEditorInformeFacturasClienteReport, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try AEditor.Controller := Self; AEditor.Title := 'Listado de facturas de cliente'; AStream := FDataModule.GenerarInformeListadoFacturasCli(AppFactuGES.EmpresaActiva.ID, FechaInicio, FechaFin, ListaIDClientes, DesglosadoCliente, ImporteMinimo); LoadFromStream(AStream); Preview; + finally Release; + AEditor := Nil; + FreeAndNil(AStream); end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; - finally - HideHourglassCursor; - end; end; procedure TGestorInformesController.VerInformeListadoFacturasCliPendientes; @@ -368,27 +355,23 @@ var AEditor : IEditorInformeFacturasClientePendientesReport; begin AEditor := NIL; - ShowHourglassCursor; - try - try - CreateEditor('EditorInformeFacturasClientePendientesReport', IEditorInformeFacturasClientePendientesReport, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + + CreateEditor('EditorInformeFacturasClientePendientesReport', IEditorInformeFacturasClientePendientesReport, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try AEditor.Controller := Self; AEditor.Title := 'Listado de facturas de cliente pendientes'; AStream := FDataModule.GenerarInformeListadoFacturasCliPendientes(AppFactuGES.EmpresaActiva.ID, FechaInicio, FechaFin, ListaIDClientes, DesglosadoCliente, ImporteMinimo); LoadFromStream(AStream); Preview; + finally Release; + AEditor := Nil; + FreeAndNil(AStream); end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; - finally - HideHourglassCursor; - end; end; procedure TGestorInformesController.VerInformeListadoFacturasProv; @@ -397,27 +380,22 @@ var AEditor : IEditorInformeFacturasProveedorReport; begin AEditor := NIL; - ShowHourglassCursor; - try - try - CreateEditor('EditorInformeFacturasProveedorReport', IEditorInformeFacturasProveedorReport, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorInformeFacturasProveedorReport', IEditorInformeFacturasProveedorReport, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try AEditor.Controller := Self; AEditor.Title := 'Listado de facturas de proveedor'; AStream := FDataModule.GenerarInformeListadoFacturasProv(AppFactuGES.EmpresaActiva.ID, FechaInicio, FechaFin, ListaIDProveedores, DesglosadoProveedor, ImporteMinimo); LoadFromStream(AStream); Preview; + finally Release; + AEditor := Nil; + FreeAndNil(AStream); end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; - finally - HideHourglassCursor; - end; end; procedure TGestorInformesController.VerInformeListadoFacturasProvPendientes; @@ -426,27 +404,22 @@ var AEditor : IEditorInformeFacturasProveedorPendientesReport; begin AEditor := NIL; - ShowHourglassCursor; - try - try - CreateEditor('EditorInformeFacturasProveedorPendientesReport', IEditorInformeFacturasProveedorPendientesReport, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorInformeFacturasProveedorPendientesReport', IEditorInformeFacturasProveedorPendientesReport, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try AEditor.Controller := Self; AEditor.Title := 'Listado de facturas de proveedor pendientes'; AStream := FDataModule.GenerarInformeListadoFacturasProvPendientes(AppFactuGES.EmpresaActiva.ID, FechaInicio, FechaFin, ListaIDProveedores, DesglosadoProveedor, ImporteMinimo); LoadFromStream(AStream); Preview; + finally Release; + AEditor := Nil; + FreeAndNil(AStream); end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; - finally - HideHourglassCursor; - end; end; procedure TGestorInformesController.VerInformeListadoPedidos; @@ -456,26 +429,22 @@ var begin AEditor := NIL; ShowHourglassCursor; - try - try - CreateEditor('EditorInformePedidosReport', IEditorInformePedidosReport, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorInformePedidosReport', IEditorInformePedidosReport, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try AEditor.Controller := Self; AEditor.Title := 'Listado de pedidos de proveedor'; AStream := FDataModule.GenerarInformeListadoPedidos(AppFactuGES.EmpresaActiva.ID, FechaInicio, FechaFin, ListaIDProveedores, DesglosadoProveedor, ImporteMinimo); LoadFromStream(AStream); Preview; + finally Release; + AEditor := Nil; + FreeAndNil(AStream); end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; - finally - HideHourglassCursor; - end; end; procedure TGestorInformesController.VerInformeListadoPresupuestos; @@ -484,27 +453,23 @@ var AEditor : IEditorInformePresupuestosReport; begin AEditor := NIL; - ShowHourglassCursor; - try - try - CreateEditor('EditorInformePresupuestosReport', IEditorInformePresupuestosReport, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + + CreateEditor('EditorInformePresupuestosReport', IEditorInformePresupuestosReport, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try AEditor.Controller := Self; AEditor.Title := 'Listado de presupuestos de cliente'; AStream := FDataModule.GenerarInformeListadoPresupuestos(AppFactuGES.EmpresaActiva.ID, FechaInicio, FechaFin, ListaIDClientes, DesglosadoCliente, ImporteMinimo); LoadFromStream(AStream); Preview; + finally Release; + AEditor := Nil; + FreeAndNil(AStream); end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; - finally - HideHourglassCursor; - end; end; procedure TGestorInformesController.VerInformeListadoRecibosCliente; @@ -513,26 +478,21 @@ var AEditor : IEditorInformeRecibosClienteReport; begin AEditor := NIL; - ShowHourglassCursor; - try - try - CreateEditor('EditorInformeRecibosClienteReport', IEditorInformeRecibosClienteReport, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorInformeRecibosClienteReport', IEditorInformeRecibosClienteReport, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try AEditor.Controller := Self; AStream := FDataModule.GenerarInformeListadoRecibosCliente(AppFactuGES.EmpresaActiva.ID, FechaInicio, FechaFin, ListaIDClientes, DesglosadoCliente, ImporteMinimo); LoadFromStream(AStream); Preview; + finally Release; + AEditor := Nil; + FreeAndNil(AStream); end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; - finally - HideHourglassCursor; - end; end; procedure TGestorInformesController.VerInformeListadoRecibosCliPendientes; @@ -541,26 +501,22 @@ var AEditor : IEditorInformeRecibosCliPendientesReport; begin AEditor := NIL; - ShowHourglassCursor; - try - try - CreateEditor('EditorInformeRecibosCliPendientesReport', IEditorInformeRecibosCliPendientesReport, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + + CreateEditor('EditorInformeRecibosCliPendientesReport', IEditorInformeRecibosCliPendientesReport, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try AEditor.Controller := Self; AStream := FDataModule.GenerarInformeListadoRecibosCliPendientes(AppFactuGES.EmpresaActiva.ID, FechaInicio, FechaFin, ListaIDClientes, DesglosadoCliente, ImporteMinimo); LoadFromStream(AStream); Preview; + finally Release; + AEditor := Nil; + FreeAndNil(AStream); end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; - finally - HideHourglassCursor; - end; end; @@ -570,26 +526,22 @@ var AEditor : IEditorInformeRecibosProveedorReport; begin AEditor := NIL; - ShowHourglassCursor; - try - try - CreateEditor('EditorInformeRecibosProveedorReport', IEditorInformeRecibosProveedorReport, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + + CreateEditor('EditorInformeRecibosProveedorReport', IEditorInformeRecibosProveedorReport, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try AEditor.Controller := Self; AStream := FDataModule.GenerarInformeListadoRecibosProveedor(AppFactuGES.EmpresaActiva.ID, FechaInicio, FechaFin, ListaIDProveedores, DesglosadoProveedor, ImporteMinimo); LoadFromStream(AStream); Preview; + finally Release; + AEditor := Nil; + FreeAndNil(AStream); end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; - finally - HideHourglassCursor; - end; end; procedure TGestorInformesController.VerInformeListadoRecibosProvPendientes; @@ -598,26 +550,22 @@ var AEditor : IEditorInformeRecibosProvPendientesReport; begin AEditor := NIL; - ShowHourglassCursor; - try - try - CreateEditor('EditorInformeRecibosProvPendientesReport', IEditorInformeRecibosProvPendientesReport, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + + CreateEditor('EditorInformeRecibosProvPendientesReport', IEditorInformeRecibosProvPendientesReport, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try AEditor.Controller := Self; AStream := FDataModule.GenerarInformeListadoRecibosProvPendientes(AppFactuGES.EmpresaActiva.ID, FechaInicio, FechaFin, ListaIDProveedores, DesglosadoProveedor, ImporteMinimo); LoadFromStream(AStream); Preview; + finally Release; + AEditor := Nil; + FreeAndNil(AStream); end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; - finally - HideHourglassCursor; - end; end; { @@ -634,23 +582,25 @@ begin if Assigned(AEditor) then with AEditor do begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Factura := AFactura; + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Factura := AFactura; - //MODO CONSULTAR - if not EsModificable(AFactura) then - begin - SetDataTableReadOnly(AFactura.DataTable, True); - ReadOnly := True; + //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; @@ -664,21 +614,19 @@ var 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; + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Facturas := AFacturas; + MultiSelect := True; + ShowEmbedded; + finally + AEditor := Nil; + end; end; - finally - AEditor := Nil; - HideHourglassCursor; - end; end; diff --git a/Source/Modulos/Historico de movimientos/Controller/uHistoricoMovimientosController.pas b/Source/Modulos/Historico de movimientos/Controller/uHistoricoMovimientosController.pas index bf8de8e7..67364df6 100644 Binary files a/Source/Modulos/Historico de movimientos/Controller/uHistoricoMovimientosController.pas and b/Source/Modulos/Historico de movimientos/Controller/uHistoricoMovimientosController.pas differ diff --git a/Source/Modulos/Inventario/Controller/uArticulosInventarioController.pas b/Source/Modulos/Inventario/Controller/uArticulosInventarioController.pas index d52d1981..a750614c 100644 --- a/Source/Modulos/Inventario/Controller/uArticulosInventarioController.pas +++ b/Source/Modulos/Inventario/Controller/uArticulosInventarioController.pas @@ -27,23 +27,21 @@ 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 + 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; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + 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 f7b6615f..ab1605e2 100644 --- a/Source/Modulos/Inventario/Controller/uInventarioController.pas +++ b/Source/Modulos/Inventario/Controller/uInventarioController.pas @@ -406,24 +406,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; @@ -532,25 +531,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 + + 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; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + ShowModal; + Result := ResultadoModalOK; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TInventarioController.VerReservas(AArticulo: IBizInventario; const ATipoReservas: String); @@ -558,24 +556,23 @@ 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 - TipoReservas := ATipoReservas; - DetalleReservas := FDataModule.GetDetalleReservas; - Articulo := AArticulo; - MultiSelect := True; - 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 + TipoReservas := ATipoReservas; + DetalleReservas := FDataModule.GetDetalleReservas; + Articulo := AArticulo; + MultiSelect := True; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TInventarioController.VerTodos(AInventario: IBizInventario; const pTipoInventario: String); @@ -583,22 +580,21 @@ 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 - TipoInventario := pTipoInventario; - Inventario := AInventario; - MultiSelect := False; - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorInventario', IEditorInventario, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + TipoInventario := pTipoInventario; + Inventario := AInventario; + MultiSelect := False; + ShowEmbedded; + finally + AEditor := NIL; + end; + end; end; function TInventarioController._Vacio: IBizInventario; diff --git a/Source/Modulos/Obras/Controller/uObrasController.pas b/Source/Modulos/Obras/Controller/uObrasController.pas index c1838a83..55743afb 100644 --- a/Source/Modulos/Obras/Controller/uObrasController.pas +++ b/Source/Modulos/Obras/Controller/uObrasController.pas @@ -191,10 +191,10 @@ begin AObra.DataTable.Active := True; CreateEditor('EditorFechaCierreObra', IEditorFechaCierreObra, AEditor); - try - if Assigned(AEditor) then - with (AEditor as IEditorFechaCierreObra) do - begin + if Assigned(AEditor) then + with (AEditor as IEditorFechaCierreObra) do + begin + try FechaCierre := DateOf(AFecha); if (ShowModal = mrOk) then begin @@ -202,10 +202,11 @@ begin AObra.Ejecuciones.FECHA_FIN := DateOf(FechaCierre); AObra.Ejecuciones.Post; end; + finally + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - end; + end; end; procedure TObrasController.CopiarDireccion(const ACliente: IBizCliente; @@ -344,22 +345,21 @@ var AEditor : IEditorDBItem; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(AObra); - CreateEditor('EditorObra', IEditorObra, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorObra) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Obra := AObra; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + RecuperarObjetos(AObra); + CreateEditor('EditorObra', IEditorObra, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorObra) do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Obra := AObra; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TObrasController.VerEjecucion(AObra: IBizObra); @@ -367,22 +367,21 @@ var AEditor : IEditorEjecucionObra; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(AObra); - CreateEditor('EditorEjecucionObra', IEditorEjecucionObra, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorEjecucionObra) do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Obra := AObra; - ShowModal; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + RecuperarObjetos(AObra); + CreateEditor('EditorEjecucionObra', IEditorEjecucionObra, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorEjecucionObra) do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Obra := AObra; + ShowModal; + finally + Release; + AEditor := NIL; + end; + end; end; function TObrasController.VerLista(AObras: IBizObra): IBizObra; @@ -391,21 +390,20 @@ var begin AEditor := NIL; Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorListaObras', IEditorListaObras, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Obras := AObras; - if IsPositiveResult(ShowModal) then - Result := ObraSeleccionado; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + CreateEditor('EditorListaObras', IEditorListaObras, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Obras := AObras; + if IsPositiveResult(ShowModal) then + Result := ObraSeleccionado; + finally + Release; + AEditor := NIL; + end; + end; end; procedure TObrasController.VerTodos(AObras: IBizObra); @@ -413,19 +411,19 @@ var AEditor : IEditorObras; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorObras', IEditorObras, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Obras := AObras; - ShowEmbedded; - end; - finally - HideHourglassCursor; - end; + + CreateEditor('EditorObras', IEditorObras, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Obras := AObras; + ShowEmbedded; + finally + AEditor := NIL; + end; + end; end; function TObrasController._Vacio: IBizObra; diff --git a/Source/Modulos/Pedidos a proveedor/Controller/uArticulosPedidoProveedorController.pas b/Source/Modulos/Pedidos a proveedor/Controller/uArticulosPedidoProveedorController.pas index 197247ec..319fab8e 100644 --- a/Source/Modulos/Pedidos a proveedor/Controller/uArticulosPedidoProveedorController.pas +++ b/Source/Modulos/Pedidos a proveedor/Controller/uArticulosPedidoProveedorController.pas @@ -29,12 +29,11 @@ var AEditor : IEditorElegirArticulosPedidosProveedor; begin Result := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorElegirArticulosPedidoProveedor', IEditorElegirArticulosPedidosProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorElegirArticulosPedidoProveedor', IEditorElegirArticulosPedidosProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try Controller := Self; Articulos := AArticulos; Proveedor := AProveedor; @@ -42,12 +41,11 @@ begin Mensaje := AMensaje; if IsPositiveResult(ShowModal) then Result := ArticulosSeleccionados; - Release; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + 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 f76b827d..4b1b5c78 100644 --- a/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorController.pas +++ b/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorController.pas @@ -342,22 +342,22 @@ var begin Result := False; AEditor := NIL; - ShowHourglassCursor; - try - RecuperarProveedor(APedido); - CreateEditor('EditorSituacionPedidoProveedor', IEditorSituacionPedidoProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + + 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; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + finally + Release; + AEditor := NIL; + end; + end; end; destructor TPedidosProveedorController.Destroy; @@ -473,34 +473,34 @@ var AEditor : IEditorPedidoProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(APedido); - CreateEditor('EditorPedidoProveedor', IEditorPedidoProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Pedido := APedido; + RecuperarObjetos(APedido); + CreateEditor('EditorPedidoProveedor', IEditorPedidoProveedor, AEditor); - //MODO CONSULTAR - if not EsModificable(APedido) then - begin - SetDataTableReadOnly(APedido.DataTable, True); - ReadOnly := True; - end; + if Assigned(AEditor) then + with AEditor do + begin + try + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Pedido := APedido; - ShowModal; + //MODO CONSULTAR + if not EsModificable(APedido) then + begin + SetDataTableReadOnly(APedido.DataTable, True); + ReadOnly := True; + end; - //MODO CONSULTAR (Se deja la tabla como estaba) - if ReadOnly then - SetDataTableReadOnly(APedido.DataTable, False); + ShowModal; + + //MODO CONSULTAR (Se deja la tabla como estaba) + if ReadOnly then + SetDataTableReadOnly(APedido.DataTable, False); + finally + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; procedure TPedidosProveedorController.VerTodos(APedidos: IBizPedidoProveedor; @@ -510,30 +510,31 @@ var AEditor : IEditorPedidosProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorPedidosProveedor', IEditorPedidosProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - if not EsCadenaVacia(AWindowCaption) then - AEditor.WindowCaption := AWindowCaption; - if not EsCadenaVacia(AHeaderText) then - AEditor.HeaderText := AHeaderText; + CreateEditor('EditorPedidosProveedor', IEditorPedidosProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + if not EsCadenaVacia(AWindowCaption) then + AEditor.WindowCaption := AWindowCaption; - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Pedidos := APedidos; - MultiSelect := True; - if AVerModal then - ShowModal - else - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + if not EsCadenaVacia(AHeaderText) then + AEditor.HeaderText := AHeaderText; + + Controller := Self; //OJO ORDEN MUY IMPORTANTE + Pedidos := APedidos; + MultiSelect := True; + if AVerModal then + ShowModal + else + ShowEmbedded; + finally + if AVerModal then + Release; + AEditor := NIL; + end; + end; end; procedure TPedidosProveedorController.VerDireccionEntrega( @@ -542,20 +543,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; - 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; @@ -581,23 +582,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; - 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 f2857c34..aaf962c7 100644 --- a/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorReportController.pas +++ b/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorReportController.pas @@ -50,6 +50,7 @@ uses constructor TPedidosProveedorReportController.Create; begin + inherited; FDataModule := TDataModulePedidosProveedor.Create(Nil); end; @@ -124,31 +125,27 @@ var AEditor : IEditorPedidosProveedorPreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetReport(AListaID, VerPrecios, VerRefProveedor); try - AStream := FDataModule.GetReport(AListaID, VerPrecios, VerRefProveedor); - try - CreateEditor('EditorPedidosProveedorPreview', IEditorPedidosProveedorPreview, AEditor); - if Assigned(AEditor) then - begin - try - AEditor.Controller := Self; - AEditor.ListaID := AListaID; - AEditor.VerPrecios := VerPrecios; - AEditor.VerRefProveedor := VerRefProveedor; - AEditor.Title := 'Pedido a proveedor - ' + AppFactuGES.EmpresaActiva.NOMBRE; - AEditor.LoadFromStream(AStream); - AEditor.Preview; - finally - AEditor.Release; - end; + CreateEditor('EditorPedidosProveedorPreview', IEditorPedidosProveedorPreview, AEditor); + if Assigned(AEditor) then + begin + try + AEditor.Controller := Self; + AEditor.ListaID := AListaID; + AEditor.VerPrecios := VerPrecios; + AEditor.VerRefProveedor := VerRefProveedor; + AEditor.Title := 'Pedido a proveedor - ' + 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; @@ -159,9 +156,10 @@ var AEditor : IEditorPedidosProveedorPreview; begin AEditor := NIL; + ShowHourglassCursor; try - AStream := FDataModule.GetReport(AListaID, VerPrecios, VerRefProveedor); + AStream := FDataModule.GetReport(AListaID, VerPrecios, VerRefProveedor); try CreateEditor('EditorPedidosProveedorPreview', IEditorPedidosProveedorPreview, AEditor); if Assigned(AEditor) then 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 8d6ec19f..58aa5b31 100644 --- a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas +++ b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas @@ -472,14 +472,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; @@ -495,13 +495,11 @@ begin //MODO CONSULTAR (Se deja la tabla como estaba) if ReadOnly then SetDataTableReadOnly(APresupuesto.DataTable, False); - - AEditor.Release; + finally + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; procedure TPresupuestosClienteController.VerDireccionEntrega( @@ -511,21 +509,19 @@ procedure TPresupuestosClienteController.VerDireccionEntrega( 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; @@ -536,12 +532,11 @@ var AEditor : IEditorPresupuestosCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorPresupuestosCliente', IEditorPresupuestosCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + CreateEditor('EditorPresupuestosCliente', IEditorPresupuestosCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try if not EsCadenaVacia(AWindowCaption) then AEditor.WindowCaption := AWindowCaption; @@ -555,11 +550,12 @@ begin ShowModal else ShowEmbedded; + finally + if AVerModal then + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; function TPresupuestosClienteController._Vacio: IBizPresupuestoCliente; @@ -585,24 +581,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 3801294c..12157b91 100644 --- a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteReportController.pas +++ b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteReportController.pas @@ -44,6 +44,7 @@ uses constructor TPresupuestosClienteReportController.Create; begin + inherited; FDataModule := TDataModulePresupuestosCliente.Create(Nil); end; @@ -138,29 +139,25 @@ 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; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); + AEditor := Nil; end; end; diff --git a/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteController.pas b/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteController.pas index b6783ca0..055335d9 100644 --- a/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteController.pas +++ b/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteController.pas @@ -184,8 +184,8 @@ begin try if (AEditor.ShowModal = mrOk) then FechaPago := DateToStr(AEditor.FechaPago); - AEditor.Release; finally + AEditor.Release; AEditor := NIL; end; end; @@ -552,22 +552,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; @@ -577,12 +576,12 @@ var AEditor : IEditorRecibosCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorRecibosCliente', IEditorRecibosCliente, AEditor); - if Assigned(AEditor) then - with AEditor do - begin + + CreateEditor('EditorRecibosCliente', IEditorRecibosCliente, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try if not EsCadenaVacia(AWindowCaption) then AEditor.WindowCaption := AWindowCaption; @@ -597,11 +596,12 @@ begin ShowModal else ShowEmbedded; + finally + if AVerModal then + Release; + AEditor := NIL; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + end; end; function TRecibosClienteController.ElegirRecibos(ARecibos: IBizRecibosCliente; AMensaje: String; AMultiSelect: Boolean): IBizRecibosCliente; @@ -609,21 +609,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; @@ -786,17 +788,21 @@ var AEditor : IEditorFechaPago; FechaPago: String; begin - try - //Pedimos la fecha del pago - CreateEditor('EditorFechaPago', IEditorFechaPago, AEditor); - if Assigned(AEditor) then - FechaPago:= ''; - if (AEditor.ShowModal = mrOk) then - FechaPago := DateToStr(AEditor.FechaPago); - AEditor.Release; - finally - AEditor := NIL; - end; + if not Assigned(ARecibosCliente) then + raise Exception.Create ('Recibos de cliente no asignado (ModificarPago)'); + + + //Pedimos la fecha del pago + CreateEditor('EditorFechaPago', IEditorFechaPago, AEditor); + if Assigned(AEditor) then + try + FechaPago := ''; + if (AEditor.ShowModal = mrOk) then + FechaPago := DateToStr(AEditor.FechaPago); + finally + AEditor.Release; + AEditor := NIL; + end; if Length(FechaPago) > 0 then PagosController.Modificar(ARecibosCliente.Pagos, FechaPago); diff --git a/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteReportController.pas b/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteReportController.pas index 94315e80..01e11251 100644 --- a/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteReportController.pas +++ b/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteReportController.pas @@ -59,28 +59,24 @@ var AEditor : IEditorRecibosClientePreview; begin AEditor := NIL; - ShowHourglassCursor; + + AStream := FDataModule.GetReport(ListaID); try - AStream := FDataModule.GetReport(ListaID); - try - CreateEditor('EditorRecibosClientePreview', IEditorRecibosClientePreview, AEditor); - if Assigned(AEditor) then - begin - try - AEditor.Controller := Self; - AEditor.ListaID := ListaID; - AEditor.LoadFromStream(AStream); - AEditor.Preview; - finally - AEditor.Release; - end; + CreateEditor('EditorRecibosClientePreview', IEditorRecibosClientePreview, AEditor); + if Assigned(AEditor) then + begin + try + AEditor.Controller := Self; + AEditor.ListaID := ListaID; + AEditor.LoadFromStream(AStream); + AEditor.Preview; + finally + AEditor.Release; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); + AEditor := Nil; end; end; diff --git a/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorController.pas b/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorController.pas index e05cf3a4..a6dae9f2 100644 --- a/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorController.pas +++ b/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorController.pas @@ -169,14 +169,15 @@ begin //Pedimos la fecha del pago if (Length(FechaPago) = 0) then begin - try - CreateEditor('EditorFechaPagoProveedor', IEditorFechaPagoProveedor, AEditor); - if Assigned(AEditor) then - if (AEditor.ShowModal = mrOk) then - FechaPago := DateToStr(AEditor.FechaPago); - finally - AEditor := NIL; - end; + CreateEditor('EditorFechaPagoProveedor', IEditorFechaPagoProveedor, AEditor); + if Assigned(AEditor) then + try + if (AEditor.ShowModal = mrOk) then + FechaPago := DateToStr(AEditor.FechaPago); + finally + Release; + AEditor := NIL; + end; end; // Se cancela la operación @@ -528,21 +529,21 @@ var AEditor : IEditorReciboProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarCliente(ARecibosProveedor); - CreateEditor('EditorReciboProveedor', IEditorReciboProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - Controller := Self; //OJO ORDEN MUY IMPORTANTE - Recibo := ARecibosProveedor; - ShowModal; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + + RecuperarCliente(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; @@ -552,29 +553,30 @@ var AEditor : IEditorRecibosProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorRecibosProveedor', IEditorRecibosProveedor, AEditor); - if Assigned(AEditor) then - with AEditor do - begin - if not EsCadenaVacia(AWindowCaption) then - AEditor.WindowCaption := AWindowCaption; - if not EsCadenaVacia(AHeaderText) then - AEditor.HeaderText := AHeaderText; + CreateEditor('EditorRecibosProveedor', IEditorRecibosProveedor, AEditor); + if Assigned(AEditor) then + with AEditor do + begin + try + if not EsCadenaVacia(AWindowCaption) then + AEditor.WindowCaption := AWindowCaption; - Controller := Self; - RecibosProveedor := ARecibosProveedor; + if not EsCadenaVacia(AHeaderText) then + AEditor.HeaderText := AHeaderText; + + Controller := Self; + RecibosProveedor := ARecibosProveedor; + if AVerModal then + ShowModal + else + ShowEmbedded; + finally if AVerModal then - ShowModal - else - ShowEmbedded; - end; - finally - AEditor := NIL; - HideHourglassCursor; - end; + Release; + AEditor := NIL; + end; + end; end; function TRecibosProveedorController.ElegirRecibos(ARecibos: IBizRecibosProveedor; AMensaje: String; @@ -583,21 +585,22 @@ 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; - 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; + end; + end; end; function TRecibosProveedorController.ElegirRecibosCompensados(ARecibo: IBizRecibosProveedor): Boolean; @@ -758,19 +761,20 @@ var AEditor : IEditorFechaPagoProveedor; FechaPago: String; begin - try - //Pedimos la fecha del pago - CreateEditor('EditorFechaPagoProveedor', IEditorFechaPagoProveedor, AEditor); - if Assigned(AEditor) then - FechaPago:= ''; - if (AEditor.ShowModal = mrOk) then - FechaPago := DateToStr(AEditor.FechaPago); - finally - AEditor := NIL; - end; + //Pedimos la fecha del pago + CreateEditor('EditorFechaPagoProveedor', IEditorFechaPagoProveedor, AEditor); + if Assigned(AEditor) then + try + FechaPago:= ''; + if (AEditor.ShowModal = mrOk) then + FechaPago := DateToStr(AEditor.FechaPago); + finally + AEditor.Release; + AEditor := NIL; + end; if Length(FechaPago) > 0 then - PagosController.Modificar(ARecibosProveedor.Pagos, FechaPago); + PagosController.Modificar(ARecibosProveedor.Pagos, FechaPago); end; function TRecibosProveedorController.Nuevo: IBizRecibosProveedor; diff --git a/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorReportController.pas b/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorReportController.pas index 70ed4170..eaa0e244 100644 --- a/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorReportController.pas +++ b/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorReportController.pas @@ -58,24 +58,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 - with AEditor do - begin + CreateEditor('EditorRecibosProveedorPreview', IEditorRecibosProveedorPreview, 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; @@ -93,9 +92,12 @@ begin if Assigned(AEditor) then with AEditor do begin - LoadFromStream(AStream); - Print; - Release; + try + LoadFromStream(AStream); + Print; + finally + Release; + end; end; finally FreeAndNil(AStream); diff --git a/Source/Modulos/Referencias/Controller/uReferenciasController.pas b/Source/Modulos/Referencias/Controller/uReferenciasController.pas index eb550bdf..57441463 100644 --- a/Source/Modulos/Referencias/Controller/uReferenciasController.pas +++ b/Source/Modulos/Referencias/Controller/uReferenciasController.pas @@ -130,21 +130,18 @@ procedure TReferenciasController.VerTodos(AReferencias: IBizReferencia); 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); diff --git a/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteController.pas b/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteController.pas index f1733b1a..b7ccf5f0 100644 --- a/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteController.pas +++ b/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteController.pas @@ -218,14 +218,13 @@ var AEditor : IEditorRemesaCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(ARemesaCliente); + RecuperarObjetos(ARemesaCliente); - CreateEditor('EditorRemesaCliente', IEditorRemesaCliente, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorRemesaCliente) do - begin + CreateEditor('EditorRemesaCliente', IEditorRemesaCliente, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorRemesaCliente) do + begin + try Controller := Self; //OJO ORDEN MUY IMPORTANTE RemesaCliente := ARemesaCliente; @@ -241,13 +240,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); @@ -255,21 +252,20 @@ var AEditor : IEditorRemesasCliente; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorRemesasCliente', IEditorRemesasCliente, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorRemesasCliente) do - begin + + CreateEditor('EditorRemesasCliente', IEditorRemesasCliente, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorRemesasCliente) do + begin + try Controller := Self; //OJO ORDEN MUY IMPORTANTE RemesasCliente := ARemesasCliente; MultiSelect := True; ShowEmbedded; + finally + AEditor := NIL; end; - finally - AEditor := Nil; - HideHourglassCursor; - end; + 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 f38012be..468f90ca 100644 --- a/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteReportController.pas +++ b/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteReportController.pas @@ -58,24 +58,22 @@ 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; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); + AEditor := Nil; end; end; @@ -87,15 +85,18 @@ 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; + end; end; finally FreeAndNil(AStream); diff --git a/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorController.pas b/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorController.pas index 8ed4c158..8f571920 100644 --- a/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorController.pas +++ b/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorController.pas @@ -218,14 +218,13 @@ var AEditor : IEditorRemesaProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - RecuperarObjetos(ARemesaProveedor); + RecuperarObjetos(ARemesaProveedor); - CreateEditor('EditorRemesaProveedor', IEditorRemesaProveedor, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorRemesaProveedor) do - begin + CreateEditor('EditorRemesaProveedor', IEditorRemesaProveedor, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorRemesaProveedor) do + begin + try Controller := Self; //OJO ORDEN MUY IMPORTANTE RemesaProveedor := ARemesaProveedor; @@ -241,13 +240,11 @@ begin //MODO CONSULTAR (Se deja la tabla como estaba) if ReadOnly then SetDataTableReadOnly(ARemesaProveedor.DataTable, False); - + finally AEditor.Release; + AEditor := NIL; + end; end; - finally - AEditor := NIL; - HideHourglassCursor; - end; end; procedure TRemesasProveedorController.VerTodos(ARemesasProveedor: IBizRemesaProveedor); @@ -255,21 +252,19 @@ var AEditor : IEditorRemesasProveedor; begin AEditor := NIL; - ShowHourglassCursor; - try - CreateEditor('EditorRemesasProveedor', IEditorRemesasProveedor, AEditor); - if Assigned(AEditor) then - with (AEditor as IEditorRemesasProveedor) do - begin + CreateEditor('EditorRemesasProveedor', IEditorRemesasProveedor, AEditor); + if Assigned(AEditor) then + with (AEditor as IEditorRemesasProveedor) do + begin + try Controller := Self; //OJO ORDEN MUY IMPORTANTE RemesasProveedor := ARemesasProveedor; MultiSelect := True; ShowEmbedded; + finally + AEditor := Nil; end; - finally - AEditor := Nil; - HideHourglassCursor; - end; + 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 8a28ad93..8654310d 100644 --- a/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorReportController.pas +++ b/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorReportController.pas @@ -58,24 +58,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; end; - finally - FreeAndNil(AStream); - AEditor := Nil; end; finally - HideHourglassCursor; + FreeAndNil(AStream); + AEditor := Nil; end; end; @@ -88,15 +87,18 @@ 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; + end; end; finally FreeAndNil(AStream); diff --git a/Source/Modulos/Tipos de IVA/Controller/uTiposIVAController.pas b/Source/Modulos/Tipos de IVA/Controller/uTiposIVAController.pas index 83a8d585..b09d5cf8 100644 --- a/Source/Modulos/Tipos de IVA/Controller/uTiposIVAController.pas +++ b/Source/Modulos/Tipos de IVA/Controller/uTiposIVAController.pas @@ -212,20 +212,17 @@ 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; + end; + end; end; procedure TTiposIVAController.VerTodos(ATiposIVA: IBizTipoIVA); @@ -233,20 +230,18 @@ 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; diff --git a/Source/Modulos/Unidades de medida/Controller/uUnidadesMedidaController.pas b/Source/Modulos/Unidades de medida/Controller/uUnidadesMedidaController.pas index 96bc3c43..bf481cac 100644 --- a/Source/Modulos/Unidades de medida/Controller/uUnidadesMedidaController.pas +++ b/Source/Modulos/Unidades de medida/Controller/uUnidadesMedidaController.pas @@ -144,21 +144,18 @@ 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; + end; + end; end; function TUnidadesMedidaController.Eliminar(AUnidadMedida: IBizUnidadMedida): Boolean;