diff --git a/Source/Informes/5/InfAlbaranCliente.fr3 b/Source/Informes/5/InfAlbaranCliente.fr3 index 3dac159c..e73b0d78 100644 --- a/Source/Informes/5/InfAlbaranCliente.fr3 +++ b/Source/Informes/5/InfAlbaranCliente.fr3 @@ -1,5 +1,5 @@ - + @@ -13,23 +13,23 @@ - - - - - + + + + + - + - - - - + + + + - + @@ -41,6 +41,6 @@ - + diff --git a/Source/Modulos/Albaranes de cliente/Reports/uRptAlbaranesCliente_Server.dfm b/Source/Modulos/Albaranes de cliente/Reports/uRptAlbaranesCliente_Server.dfm index 19f99216..ed5c59e1 100644 --- a/Source/Modulos/Albaranes de cliente/Reports/uRptAlbaranesCliente_Server.dfm +++ b/Source/Modulos/Albaranes de cliente/Reports/uRptAlbaranesCliente_Server.dfm @@ -1,8 +1,8 @@ object RptAlbaranesCliente: TRptAlbaranesCliente OldCreateOrder = True OnCreate = DataModuleCreate - Height = 425 - Width = 527 + Height = 439 + Width = 529 object DADataCabecera: TDADataSource DataSet = tbl_Cabecera.Dataset DataTable = tbl_Cabecera @@ -1075,7 +1075,7 @@ object RptAlbaranesCliente: TRptAlbaranesCliente PrintOptions.Printer = 'Default' PrintOptions.PrintOnSheet = 0 ReportOptions.CreateDate = 37871.995398692100000000 - ReportOptions.LastChange = 40142.519712557870000000 + ReportOptions.LastChange = 42583.535851493060000000 ReportOptions.VersionBuild = '1' ReportOptions.VersionMajor = '12' ReportOptions.VersionMinor = '13' diff --git a/Source/Modulos/Albaranes de cliente/Reports/uRptAlbaranesCliente_Server.pas b/Source/Modulos/Albaranes de cliente/Reports/uRptAlbaranesCliente_Server.pas index d1a2c614..f9d22703 100644 --- a/Source/Modulos/Albaranes de cliente/Reports/uRptAlbaranesCliente_Server.pas +++ b/Source/Modulos/Albaranes de cliente/Reports/uRptAlbaranesCliente_Server.pas @@ -71,6 +71,7 @@ begin frxReport.EngineOptions.NewSilentMode := simReThrow; end; + function TRptAlbaranesCliente.GenerarAlbaran(const ListaID : TIntegerArray): Binary; var i: Integer; diff --git a/Source/Modulos/Relaciones/Contratos de cliente - Albaranes de cliente/uGenerarAlbaranesCliUtils.pas b/Source/Modulos/Relaciones/Contratos de cliente - Albaranes de cliente/uGenerarAlbaranesCliUtils.pas index 48b9beae..eda34c36 100644 --- a/Source/Modulos/Relaciones/Contratos de cliente - Albaranes de cliente/uGenerarAlbaranesCliUtils.pas +++ b/Source/Modulos/Relaciones/Contratos de cliente - Albaranes de cliente/uGenerarAlbaranesCliUtils.pas @@ -64,12 +64,14 @@ begin AAlbaran.DataTable.FieldByName(fld_AlbaranesClienteOBSERVACIONES).AsVariant := AContrato.DataTable.FieldByName(fld_ContratosClienteOBSERVACIONES).AsVariant; AAlbaran.IMPORTE_NETO := AContrato.IMPORTE_NETO; - AAlbaran.IMPORTE_PORTE := AContrato.IMPORTE_PORTE; - AAlbaran.DESCUENTO := AContrato.DESCUENTO; - AAlbaran.IMPORTE_DESCUENTO := AContrato.IMPORTE_DESCUENTO; + +// Los albaranes no tienen Descuento +// AAlbaran.IMPORTE_PORTE := AContrato.IMPORTE_PORTE; +// AAlbaran.DESCUENTO := AContrato.DESCUENTO; +// AAlbaran.IMPORTE_DESCUENTO := AContrato.IMPORTE_DESCUENTO; AAlbaran.BASE_IMPONIBLE := AContrato.BASE_IMPONIBLE; - // Los albaranes no tienen IVA +// Los albaranes no tienen IVA // AAlbaran.ID_TIPO_IVA := AContrato.ID_TIPO_IVA; // AAlbaran.IVA := AContrato.IVA; // AAlbaran.IMPORTE_IVA := AContrato.IMPORTE_IVA; @@ -149,6 +151,21 @@ begin end; end; +procedure RecalcularImporteAlbaran(AAlbaran : IBizAlbaranCliente); +begin + if not Assigned(AAlbaran) then + raise Exception.Create ('Albarán no asignado (RecalcularImporteAlbaran)'); + + AAlbaran.Edit; + try + AAlbaran.IMPORTE_NETO := AAlbaranesClienteController.DetallesController.DarTotalImporteTotal(AAlbaran.Detalles); + AAlbaran.BASE_IMPONIBLE := AAlbaran.IMPORTE_NETO; + AAlbaran.IMPORTE_TOTAL := AAlbaran.BASE_IMPONIBLE; + finally + AAlbaran.Post; + end; +end; + procedure Inicializar; begin dmGenerarAlbaranesCli := TdmGenerarAlbaranesCli.Create(nil); @@ -205,6 +222,7 @@ begin AAlbaran := AAlbaranesClienteController.Nuevo; CopiarContratoAAlbaran(AContrato, AAlbaran); CopiarDetallesAAlbaran(AContrato, AAlbaran, AContrato.Detalles); + RecalcularImporteAlbaran(AAlbaran); //Sustituir por if de guardar if AAlbaranesClienteController.Guardar(AAlbaran) then