diff --git a/Transportes/RepContratoDetalle.aspx b/Transportes/RepContratoDetalle.aspx index 8c0bf6b42..192e6d424 100644 --- a/Transportes/RepContratoDetalle.aspx +++ b/Transportes/RepContratoDetalle.aspx @@ -180,7 +180,7 @@
-
@@ -248,7 +248,7 @@
- Observaciones
-
diff --git a/Transportes/RepContratosCalendario.aspx b/Transportes/RepContratosCalendario.aspx index aa5df3eb7..2756615cb 100644 --- a/Transportes/RepContratosCalendario.aspx +++ b/Transportes/RepContratosCalendario.aspx @@ -385,7 +385,7 @@
-
diff --git a/Ventas/RepVentasUtilidadPadre.aspx b/Ventas/RepVentasUtilidadPadre.aspx index c7916d2c1..cad6b2f04 100644 --- a/Ventas/RepVentasUtilidadPadre.aspx +++ b/Ventas/RepVentasUtilidadPadre.aspx @@ -237,6 +237,7 @@ @@ -244,7 +245,7 @@ - + diff --git a/Ventas/RepVentasUtilidadPadre.aspx.vb b/Ventas/RepVentasUtilidadPadre.aspx.vb index 34f7ee3d0..eff0b437d 100644 --- a/Ventas/RepVentasUtilidadPadre.aspx.vb +++ b/Ventas/RepVentasUtilidadPadre.aspx.vb @@ -256,6 +256,9 @@ Partial Class Ventas_RepVentasUtilidadPadre e.Row.DBCampo("FechaI"), e.Row.DBCampo("FechaF"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveVendedor"), e.Row.DBCampo("Grupo"), e.Row.DBCampo("GPO"), e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveClasificacion"), e.Row.DBCampo("CveMarca"), e.Row.DBCampo("CveCategoria")) e.Row.Cells(0).Text = String.Format("{2}", Css, Liga, e.Row.Cells(0).Text) + + 'e.Row.Cells(3).Text = + ' e.Row.Cells(5).Text = Else e.Row.Cells(12).BackColor = Drawing.Color.LightGray End If diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 2a0453b04..b9860250f 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9411,6 +9411,8 @@ Partial Class Ventas TmpDT.Rows(e.RowIndex)("CantidadConversion") = CantidadConversion End If + CalculaPSPromocionFiltrosLubricantes(TmpDT.Rows(e.RowIndex)) + DrPS = Nothing @@ -9454,6 +9456,17 @@ Partial Class Ventas End If End If + 'SI SE ELIMINA EL LUBRICANTE, ELIMINAR LOS FILTROS CON PROMOCION + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + If TmpDT.Rows(e.RowIndex)("CveClasificacion").ToString().ToString().Contiene("20516") Then + Dim RowsFiltros = TmpDT.Select("CveClasificacion IN(20515) AND Descuento > 0") + For Each Row As DataRow In RowsFiltros + TmpDT.Rows.Remove(Row) + Next + End If + End If + + Dim DbRow As DataRow = Nothing DbRow = TmpDT.Rows(e.RowIndex) TmpDT.Rows.Remove(DbRow) @@ -18749,7 +18762,7 @@ Partial Class Ventas CargaListasPreciosSubProyectos(If(DdlPS.SelectedValue.ToEntero() <= 0, -1, DdlPS.SelectedValue.ToEntero())) If DdlTipoComprobante.SelectedValue = "Ant" AndAlso UsuarioActual.CveEmpresa = 189 Then - Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:="84111506").FiltroPrimero("") + Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:="84111506").FiltroPrimero("CodigoPS LIKE '%ANTICIPO%' OR CodigoPS LIKE '%anticipo%' OR CodigoPS LIKE '%Anticipo%'") If DatarowPS IsNot Nothing Then DdlPS.SelectedValue = DatarowPS("CvePS").ToString() DdlPS.SelectedText = DatarowPS("CodigoPS").ToString() @@ -19791,6 +19804,9 @@ Partial Class Ventas ListaDescuentos.Add(ObjDescuento) End If + 'CALCULA EN BASE AL ULTIMO AGREGADO + CalculaPSPromocionFiltrosLubricantes(TmpDT.Rows(TmpDT.Rows.Count - 1)) + CalculaTotalesVenta() LimpiaAgregar() @@ -19813,6 +19829,87 @@ Partial Class Ventas End Sub + Private Sub CalculaPSPromocionFiltrosLubricantes(ByRef RowEdit As DataRow) + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + Dim CantidadMinValidaPromoFiltro As Decimal = 4 + Dim CantidadMinValidaPromoLubricantes As Decimal = 5 + + 'DESCUENTO EN LUBRICANTES + If RowEdit IsNot Nothing AndAlso RowEdit("CveClasificacion").ToString().Contiene("20516") Then + Dim Cantidad As Decimal = RowEdit("Cantidad").ToString().ToDecimal() + 'CALCULA LA CANTIDAD DE DESCUENTO, REDONDEO HACIA ABAJO + Dim CantidadDescuento As Decimal = Math.DivRem(Cantidad.ToString().ToEntero(), CantidadMinValidaPromoLubricantes.ToString().ToEntero(), 1).ToString().ToDecimal() + + Dim Descuentos = CantidadDescuento * RowEdit("PU").ToString().ToDecimal() + + Dim PU As Decimal = RowEdit("PU").ToString().ToDecimal() + Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (Descuentos)) + Dim TotalCalculableImpuestosIVA As Decimal = 0 + TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + RowEdit("PorcentajeIEPS").ToString().ToDecimal) + + RowEdit("Cantidad") = Cantidad + RowEdit("Descuento") = Descuentos + RowEdit("ImporteIVA") = (RowEdit("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales) + + RowEdit("Descuento") = Descuentos + RowEdit("Total") = (Cantidad * PU) + RowEdit("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales) + RowEdit("TotalConImpuestos") = (RowEdit("Total").ToString().ToDecimal() - RowEdit("Descuento").ToString().ToDecimal() + RowEdit("ImporteIVA").ToString().ToDecimal()).RoundSQL(2) + + 'VERIFICA SI TIENE FILTROS AGREGADOS, ELIMINAR SI YA NO CUMPLE LA PROMOCION + If CantidadDescuento <= 0 Then + Dim RowsFiltros = TmpDT.Select("CveClasificacion IN(20515) AND Descuento > 0") + For Each Row As DataRow In RowsFiltros + TmpDT.Rows.Remove(Row) + Next + End If + + End If + + ' DESCUENTO EN FILTROS + If RowEdit IsNot Nothing AndAlso RowEdit("CveClasificacion").ToString().Contiene("20515") Then + Dim TotalLubricantes = TmpDT.SUMD("Cantidad", "CveClasificacion IN(20516)") + Dim TotalFiltros = TmpDT.SUMD("Cantidad", "CveClasificacion IN(20515) AND Descuento = 0") + Dim TotalFiltrosDescuento = TmpDT.SUMD("Cantidad", "CveClasificacion IN(20515) AND Descuento > 0") + + 'SI HAY LUBRICANTES, 1 FILTRO DEBE SER GRATIS + If TotalLubricantes >= CantidadMinValidaPromoFiltro Then + 'CALCULA LA CANTIDAD DE DESCUENTO, REDONDEO HACIA ABAJO + Dim CantidadDescuento As Decimal = Math.DivRem(TotalLubricantes.ToString().ToEntero(), CantidadMinValidaPromoFiltro.ToString().ToEntero(), 1).ToString().ToDecimal() + + 'VERIFICA QUE AUN SE PUEDA APLICAR DESCUENTO + If TotalFiltrosDescuento < CantidadDescuento Then + Dim Cantidad As Decimal = RowEdit("Cantidad").ToString().ToDecimal() + + 'AJUSTA PARA QUE DEL DESCUENTO NO SUPERA EL VALOR DEL FILTRO + If CantidadDescuento > Cantidad Then + CantidadDescuento = Cantidad + End If + + Dim Descuentos = CantidadDescuento * RowEdit("PU").ToString().ToDecimal() + + Dim PU As Decimal = RowEdit("PU").ToString().ToDecimal() + Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (Descuentos)) + Dim TotalCalculableImpuestosIVA As Decimal = 0 + TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + RowEdit("PorcentajeIEPS").ToString().ToDecimal) + + RowEdit("Cantidad") = Cantidad + RowEdit("Descuento") = Descuentos + RowEdit("ImporteIVA") = (RowEdit("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales) + + RowEdit("Descuento") = Descuentos + RowEdit("Total") = (Cantidad * PU) + RowEdit("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales) + RowEdit("TotalConImpuestos") = (RowEdit("Total").ToString().ToDecimal() - RowEdit("Descuento").ToString().ToDecimal() + RowEdit("ImporteIVA").ToString().ToDecimal()).RoundSQL(2) + End If + + End If + + End If + + End If + End Sub + Private Sub CalculaLineasAdicionales() If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "PA") AndAlso UsuarioActual.Empresa.Funcionalidad(705) = "1" Then DdlLineaAdicional.DataSource = Nothing