This commit is contained in:
2024-09-12 13:24:53 -07:00
6 changed files with 107 additions and 6 deletions

View File

@@ -180,7 +180,7 @@
<label class="col-md-4">Observaciones</label>
<div class="col-md-8">
<div class="input-group">
<asp:TextBox ID="TxtObservaciones" runat="server" MaxLength="70" Width="100%"
<asp:TextBox ID="TxtObservaciones" runat="server" MaxLength="500" Width="100%"
TextMode="MultiLine"
Rows="3"></asp:TextBox>
<div class="input-group-addon">
@@ -248,7 +248,7 @@
<div class="col-md-8">
<div class="input-group">
<asp:TextBox ID="TxtCantidadPasajeros" runat="server" CssClass="form-control" CausesValidation="True"
<asp:TextBox ID="Uti" runat="server" CssClass="form-control" CausesValidation="True"
Width="100%"
type="number"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVCantidadPasajeros" runat="server" ControlToValidate="TxtCantidadPasajeros"

View File

@@ -325,7 +325,7 @@
<label class="col-md-4">Observaciones</label>
<div class="col-md-8">
<div class="input-group">
<asp:TextBox ID="TxtObservaciones" runat="server" MaxLength="200" Width="100%"
<asp:TextBox ID="TxtObservaciones" runat="server" MaxLength="500" Width="100%"
TextMode="MultiLine"
Rows="3"></asp:TextBox>
<div class="input-group-addon">

View File

@@ -385,7 +385,7 @@
<div class="row">
<label class="col-md-3">Observaciones:</label>
<div class="col-md-9">
<asp:TextBox ID="TxtObservaciones" runat="server" Width="100%" TextMode="MultiLine"
<asp:TextBox ID="TxtObservaciones" runat="server" Width="100%" TextMode="MultiLine" MaxLength="500"
Rows="6"></asp:TextBox>
</div>
</div>

View File

@@ -237,6 +237,7 @@
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Ventas Utilidad con los filtros especificados" ToolTip="Listado de Ventas"
DataKeyNames=""
CssClass="table table-advance table-hover Widthall ScrollAD" data-sort="true" GridLines="None" Width="99%" OnRowDataBound="GvDatos_RowDataBound">
<Columns>
<asp:HyperLinkField ItemStyle-HorizontalAlign="Left" Target="_blank" HeaderText="Grupo" DataTextField="GPO" DataNavigateUrlFields="FechaI,FechaF,CveSubProyecto,CveCliente,CveVendedor,Grupo,GPO,CvePS,CveClasificacion,CveMarca,CveCategoria" DataNavigateUrlFormatString="RepVentasUtilidad.aspx?FechaI={0}&FechaF={1}&CveSubProyecto={2}&CveCliente={3}&CveVendedor={4}&Gpo={5}&CveGpo={6}&CvePS={7}&CveClasificacion={8}&CveMarca={9}&CveCategoria={10}" />
@@ -244,7 +245,7 @@
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="Crédito" DataField="Credito" DataFormatString="{0:N2}" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="% Crédito" DataField="PorcentajeCredito" ItemStyle-Width="30px" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="Contado" DataField="Contado" DataFormatString="{0:N2}" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="% Contado" DataField="PorcentajeCredito" ItemStyle-Width="30px" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="% Contado" DataField="PorcentajeContado" ItemStyle-Width="30px" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="%" DataField="ProcentajeVentas" DataFormatString="{0:N2}" ItemStyle-Width="30px" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="Descuento" DataField="Descuento" DataFormatString="{0:N2}" />

View File

@@ -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("<a class=""{0}"" href=""{1}"">{2}</a>", 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

View File

@@ -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