From 2d2dc116046d7f9e7b411aca609811e6e0921bff Mon Sep 17 00:00:00 2001 From: david Date: Thu, 20 Dec 2007 20:36:56 +0000 Subject: [PATCH] - Arreglado error al recalcular los totales en los detalles. - En el editor de la factura no se mostraban los totales (no estaban enlazados a la tabla). git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@192 0c75b7a4-871f-7646-8a2f-f78d34cc349f --- .../Controller/uFacturasClienteController.pas | 9 ++- .../Views/uEditorFacturaCliente.dfm | 64 +++++++++---------- .../Views/uEditorFacturaCliente.pas | 14 ++-- .../Views/uViewDetallesFacturaCliente.dfm | 6 -- .../Views/uViewDetallesFacturaCliente.pas | 2 +- 5 files changed, 49 insertions(+), 46 deletions(-) diff --git a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas index 8a8771a3..f9d6a1dd 100644 --- a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas +++ b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas @@ -117,7 +117,6 @@ uses uDataModuleUsuarios, uDAInterfaces, uDataTableUtils, uDateUtils, uAlbaranesClienteController, schAlbaranesClienteClient_Intf, uROTypes, uDetallesAlbaranClienteController, uBizDetallesAlbaranCliente, uFacturasClienteReportController, -// uBizPedidosCliente, uPedidosClienteController, uBizDetallesPedidoCliente, DateUtils, Forms, Dialogs, uFormasPagoController, uBizFormasPago, uIEditorElegirFacturasCliente, uRecibosClienteController, uBizRecibosCliente; @@ -786,6 +785,7 @@ procedure TFacturasClienteController.RecalcularImportes( AFactura: IBizFacturaCliente); var bEnEdicion : Boolean; + ADetallePosAct : Integer; begin if not Assigned(AFactura) then raise Exception.Create ('Factura no asignado (RecalcularImportes)'); @@ -793,18 +793,23 @@ begin if AFactura.DataTable.Active then AFactura.DataTable.Active := True; + ADetallePosAct := AFactura.Detalles.POSICION; + bEnEdicion := (AFactura.DataTable.State in dsEditModes); if not bEnEdicion then AFactura.Edit; ShowHourglassCursor; - AFactura.Edit; try AFactura.IMPORTE_NETO := FDetallesController.DarTotalImporteTotal(AFactura.Detalles); AFactura.IMPORTE_PORTE := FDetallesController.DarTotalPorteTotal(AFactura.Detalles); + FDetallesController.LocalizarPosicion(AFactura.Detalles, ADetallePosAct); if not bEnEdicion then AFactura.Post; finally + + + HideHourglassCursor; end; end; diff --git a/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.dfm b/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.dfm index d226b9bf..9a624b78 100644 --- a/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.dfm +++ b/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.dfm @@ -7,7 +7,7 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente Position = poScreenCenter OnClose = CustomEditorClose ExplicitWidth = 796 - ExplicitHeight = 602 + ExplicitHeight = 609 PixelsPerInch = 96 TextHeight = 13 inherited JvNavPanelHeader: TJvNavPanelHeader @@ -69,21 +69,21 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente end end inherited pgPaginas: TPageControl - Width = 788 - Height = 317 + Width = 782 + Height = 311 OnChanging = pgPaginasChanging - ExplicitWidth = 788 - ExplicitHeight = 317 + ExplicitWidth = 782 + ExplicitHeight = 311 inherited pagGeneral: TTabSheet ExplicitLeft = 4 ExplicitTop = 24 - ExplicitWidth = 780 - ExplicitHeight = 289 + ExplicitWidth = 774 + ExplicitHeight = 283 inline frViewFacturaCliente1: TfrViewFacturaCliente Left = 0 Top = 0 - Width = 780 - Height = 289 + Width = 774 + Height = 283 Align = alClient Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -93,16 +93,16 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente ParentFont = False TabOrder = 0 ReadOnly = False - ExplicitWidth = 780 - ExplicitHeight = 289 + ExplicitWidth = 774 + ExplicitHeight = 283 inherited dxLayoutControl1: TdxLayoutControl - Width = 780 - Height = 289 - ExplicitWidth = 780 - ExplicitHeight = 289 + Width = 774 + Height = 283 + ExplicitWidth = 774 + ExplicitHeight = 283 DesignSize = ( - 780 - 289) + 774 + 283) inherited eReferencia: TcxDBTextEdit ExplicitWidth = 393 Width = 393 @@ -118,9 +118,9 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente Width = 473 end inherited frViewClienteFactura: TfrViewDatosYSeleccionCliente - Left = 474 + Left = 471 Width = 332 - ExplicitLeft = 474 + ExplicitLeft = 471 ExplicitWidth = 332 inherited dxLayoutControl1: TdxLayoutControl Width = 332 @@ -161,8 +161,8 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente Width = 255 end inherited bFormasPago: TButton - Left = 314 - ExplicitLeft = 314 + Left = 311 + ExplicitLeft = 311 end end end @@ -173,8 +173,8 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente inline frViewDetallesFacturaCliente1: TfrViewDetallesFacturaCliente Left = 0 Top = 0 - Width = 780 - Height = 289 + Width = 774 + Height = 283 Align = alClient BiDiMode = bdLeftToRight Font.Charset = DEFAULT_CHARSET @@ -186,11 +186,11 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente ParentFont = False TabOrder = 0 ReadOnly = False - ExplicitWidth = 780 - ExplicitHeight = 289 + ExplicitWidth = 774 + ExplicitHeight = 283 inherited ToolBar1: TToolBar - Width = 780 - ExplicitWidth = 780 + Width = 774 + ExplicitWidth = 774 inherited ToolButton4: TToolButton Wrap = False end @@ -249,13 +249,13 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente end end inherited cxGrid: TcxGrid - Width = 780 - Height = 217 - ExplicitWidth = 780 - ExplicitHeight = 217 + Width = 774 + Height = 211 + ExplicitWidth = 774 + ExplicitHeight = 211 end inherited TBXDock1: TTBXDock - Width = 780 + Width = 774 ExplicitWidth = 780 inherited TBXToolbar1: TTBXToolbar ExplicitWidth = 548 diff --git a/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.pas b/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.pas index 78cb432a..130ecebe 100644 --- a/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.pas +++ b/Source/Modulos/Facturas de cliente/Views/uEditorFacturaCliente.pas @@ -176,10 +176,14 @@ procedure TfEditorFacturaCliente.frViewTotales1cbRecargoEquivalenciaPropertiesEd Sender: TObject); begin inherited; - if frViewTotales1.cbRecargoEquivalencia.Checked then - Factura.RECARGO_EQUIVALENCIA := 1 - else - Factura.RECARGO_EQUIVALENCIA := 0; + if Assigned(Factura) then + begin + Factura.Edit; + if frViewTotales1.cbRecargoEquivalencia.Checked then + Factura.RECARGO_EQUIVALENCIA := 1 + else + Factura.RECARGO_EQUIVALENCIA := 0; + end; end; procedure TfEditorFacturaCliente.frViewTotales1edtDescuentoPropertiesValidate( @@ -391,7 +395,7 @@ begin if Assigned(FFactura) then begin dsDataTable.DataTable := FFactura.DataTable; -// frViewTotales1.DADataSource.DataTable := FFactura.DataTable; + frViewTotales1.DADataSource.DataTable := FFactura.DataTable; FTiposIVA := FTiposIVAController.BuscarTodos; frViewTotales1.dsTiposIVA.DataTable := FTiposIVA.DataTable; diff --git a/Source/Modulos/Facturas de cliente/Views/uViewDetallesFacturaCliente.dfm b/Source/Modulos/Facturas de cliente/Views/uViewDetallesFacturaCliente.dfm index 44b33ab1..bae69888 100644 --- a/Source/Modulos/Facturas de cliente/Views/uViewDetallesFacturaCliente.dfm +++ b/Source/Modulos/Facturas de cliente/Views/uViewDetallesFacturaCliente.dfm @@ -1,12 +1,6 @@ inherited frViewDetallesFacturaCliente: TfrViewDetallesFacturaCliente inherited cxGrid: TcxGrid inherited cxGridView: TcxGridDBTableView - inherited cxGridViewID: TcxGridDBColumn - Visible = False - end - inherited cxGridViewPOSICION: TcxGridDBColumn - Visible = False - end inherited cxGridViewTIPO: TcxGridDBColumn Visible = False end diff --git a/Source/Modulos/Facturas de cliente/Views/uViewDetallesFacturaCliente.pas b/Source/Modulos/Facturas de cliente/Views/uViewDetallesFacturaCliente.pas index 264d05df..57fd3ce0 100644 --- a/Source/Modulos/Facturas de cliente/Views/uViewDetallesFacturaCliente.pas +++ b/Source/Modulos/Facturas de cliente/Views/uViewDetallesFacturaCliente.pas @@ -12,7 +12,7 @@ uses Grids, DBGrids, StdCtrls, ExtCtrls, cxRichEdit, StdActns, ExtActns, JvExStdCtrls, JvCombobox, JvColorCombo, TB2Item, TBX, TB2Dock, TB2Toolbar, uControllerDetallesArticulos, uViewDetallesArticulos, uBizFacturasCliente, - uDAInterfaces; + uDAInterfaces, cxDropDownEdit; type IViewDetallesFacturaCliente = interface(IViewDetallesArticulos)