Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -1256,7 +1256,7 @@
|
|||||||
<asp:ListItem Selected="True" Text="Seleccione la Clasificación (Todas)" Value="-1"></asp:ListItem>
|
<asp:ListItem Selected="True" Text="Seleccione la Clasificación (Todas)" Value="-1"></asp:ListItem>
|
||||||
</asp:DropDownList>
|
</asp:DropDownList>
|
||||||
<asp:Literal ID="LtlPSEdit" runat="server" Visible="false" Text='<%# Eval("PS") %>'></asp:Literal>
|
<asp:Literal ID="LtlPSEdit" runat="server" Visible="false" Text='<%# Eval("PS") %>'></asp:Literal>
|
||||||
<ADS:Dropdownlost runat="server" ID="DdlPS" CssStyle="width: 100%;" CssClass="DdlPS" CssClassDdl="select2me " DataTextField="PSCodigo" DataValueField="CvePS" data-onresult="CargaExistenciaAlmacenes" />
|
<ADS:Dropdownlost runat="server" ID="DdlPS" CssStyle="width: 100%;" CssClass="DdlPS" CssClassDdl="select2me " DataTextField="PSCodigo" DataValueField="CvePS" data-onresult="CargaExistenciaAlmacenes" Onselectedindexchange="DdlPSEdit_SelectedIndexChanged" />
|
||||||
<%--<asp:RequiredFieldValidator ID="RFVPS" runat="server" ControlToValidate="DdlPS" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Producto o Servicio''</b> es necesario, por favor seleccione uno." ValidationGroup="GprGV" CssClass="select2me"></asp:RequiredFieldValidator>--%>
|
<%--<asp:RequiredFieldValidator ID="RFVPS" runat="server" ControlToValidate="DdlPS" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Producto o Servicio''</b> es necesario, por favor seleccione uno." ValidationGroup="GprGV" CssClass="select2me"></asp:RequiredFieldValidator>--%>
|
||||||
<%--<ajax:ValidatorCalloutExtender ID="VCOPS" runat="server" HighlightCssClass="vco" TargetControlID="RFVPS" Width="300px"></ajax:ValidatorCalloutExtender>--%>
|
<%--<ajax:ValidatorCalloutExtender ID="VCOPS" runat="server" HighlightCssClass="vco" TargetControlID="RFVPS" Width="300px"></ajax:ValidatorCalloutExtender>--%>
|
||||||
</EditItemTemplate>
|
</EditItemTemplate>
|
||||||
@@ -4336,6 +4336,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<asp:HiddenField ID="HdnDescPS" runat="server" ClientIDMode="Static" Value="0" />
|
<asp:HiddenField ID="HdnDescPS" runat="server" ClientIDMode="Static" Value="0" />
|
||||||
|
<asp:HiddenField ID="HdnIVADescPS" runat="server" ClientIDMode="Static" Value="0" />
|
||||||
<asp:HiddenField ID="HdnConsecPS" runat="server" ClientIDMode="Static" Value="-1" />
|
<asp:HiddenField ID="HdnConsecPS" runat="server" ClientIDMode="Static" Value="-1" />
|
||||||
<asp:HiddenField ID="HdnTotalCompra" runat="server" ClientIDMode="Static" Value="0" />
|
<asp:HiddenField ID="HdnTotalCompra" runat="server" ClientIDMode="Static" Value="0" />
|
||||||
<table style="width: 90%">
|
<table style="width: 90%">
|
||||||
@@ -4350,16 +4351,16 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>% Descuento</td>
|
<td>Descuento</td>
|
||||||
<td>
|
<td>
|
||||||
<asp:TextBox ID="TxtPorPS" runat="server" CausesValidation="true" ClientIDMode="Static" MaxLength="12" Text="0" ValidationGroup="GrpDescuentoP" Width="72px"></asp:TextBox>
|
<asp:TextBox ID="TxtPorPS" runat="server" CausesValidation="true" ClientIDMode="Static" MaxLength="12" Text="0" ValidationGroup="GrpDescuentoP" Width="72px"></asp:TextBox>
|
||||||
<asp:CompareValidator ID="CVPorPS" runat="server" ControlToValidate="TxtPorPS" Display="None" ErrorMessage="El campo <b>''Descuento por Porcentaje''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." Operator="DataTypeCheck" Type="Currency" ValidationGroup="GrpPorPS"></asp:CompareValidator>
|
<asp:CompareValidator ID="CVPorPS" runat="server" ControlToValidate="TxtPorPS" Display="None" ErrorMessage="El campo <b>''Descuento por Porcentaje''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." Operator="DataTypeCheck" Type="Currency" ValidationGroup="GrpPorPS"></asp:CompareValidator>
|
||||||
<ajax:ValidatorCalloutExtender ID="VCEPorPS" runat="server" HighlightCssClass="vco" TargetControlID="CVPorPS" Width="300px"></ajax:ValidatorCalloutExtender>
|
<ajax:ValidatorCalloutExtender ID="VCEPorPS" runat="server" HighlightCssClass="vco" TargetControlID="CVPorPS" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||||
(%)
|
(%)
|
||||||
</td>
|
</td>
|
||||||
<td>IVA</td>
|
<td><label style="display:none;">IVA</label></td>
|
||||||
<td>
|
<td>
|
||||||
<asp:Label ID="LblIVADescPS" runat="server" ClientIDMode="Static" Text="0.00"></asp:Label>
|
<asp:Label ID="LblIVADescPS" runat="server" ClientIDMode="Static" Text="0.00" style="display:none;"></asp:Label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -9752,28 +9753,32 @@
|
|||||||
var PorcentajeDescuento = parseFloat($get("TxtPorPS").value);
|
var PorcentajeDescuento = parseFloat($get("TxtPorPS").value);
|
||||||
if (PorcentajeDescuento < 0 || PorcentajeDescuento > 99) {
|
if (PorcentajeDescuento < 0 || PorcentajeDescuento > 99) {
|
||||||
alert("No se puede aplicar ese porcentaje de descuento");
|
alert("No se puede aplicar ese porcentaje de descuento");
|
||||||
|
$get("TxtPorPS").value = "0";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var ivaPor = parseFloat($get("HdnIVADescPS").value) ;
|
||||||
|
|
||||||
var subTotal = parseFloat($get("LblSubtotalDescPS").innerText.replace(",", "").replace(",", ""));
|
var subTotal = parseFloat($get("LblSubtotalDescPS").innerText.replace(",", "").replace(",", ""));
|
||||||
var Monto = parseFloat($get("LblTotalDescPS").innerText.replace(",", "").replace(",", ""));
|
|
||||||
|
|
||||||
var Total = Monto - ((Monto * PorcentajeDescuento) / 100);
|
$get("LblDescPS").innerText = formato_numero(((subTotal * PorcentajeDescuento) / 100), 2, '.', ',');
|
||||||
|
|
||||||
|
var descuento = parseFloat($get("LblDescPS").innerText.replace(",", "").replace(",", ""));
|
||||||
|
|
||||||
|
$get("LblIVADescPS").innerText = formato_numero(((subTotal - descuento) * ivaPor), 2, '.', ',');
|
||||||
|
|
||||||
|
var importeIVA =parseFloat($get("LblIVADescPS").innerText.replace(",", "").replace(",", ""));
|
||||||
|
|
||||||
|
var Total = (subTotal - descuento) + importeIVA;
|
||||||
|
|
||||||
$get("LblTotalFinalDescPS").innerText = formato_numero(Total, 2, '.', ',');
|
$get("LblTotalFinalDescPS").innerText = formato_numero(Total, 2, '.', ',');
|
||||||
|
|
||||||
var TotalRedondeado = parseFloat($get("LblTotalFinalDescPS").innerText.replace(",", "").replace(",", ""));
|
|
||||||
|
|
||||||
var descuento = - ((TotalRedondeado - (subTotal * 1.16)) / 1.16);
|
|
||||||
|
|
||||||
$get("LblIVADescPS").innerText = formato_numero(((subTotal - descuento) * 0.16), 2, '.', ',');
|
|
||||||
|
|
||||||
$get("LblDescPS").innerText = formato_numero(descuento, 2, '.', ',');
|
|
||||||
$get("HdnDescPS").value = descuento;
|
$get("HdnDescPS").value = descuento;
|
||||||
|
|
||||||
var totalCompra = parseFloat($get("HdnTotalCompra").value);
|
var totalCompra = parseFloat($get("HdnTotalCompra").value);
|
||||||
if (totalCompra > 0) {
|
if (totalCompra > 0) {
|
||||||
var utilidad = ((TotalRedondeado - totalCompra) / TotalRedondeado) * 100;
|
var totalRedondeado = parseFloat($get("LblTotalFinalDescPS").innerText.replace(",", "").replace(",", ""));
|
||||||
|
var utilidad = ((totalRedondeado - totalCompra) / totalRedondeado) * 100;
|
||||||
|
|
||||||
$get("LblUtilidadPorcentaje").innerText = formato_numero(utilidad, 2, '.', ',');
|
$get("LblUtilidadPorcentaje").innerText = formato_numero(utilidad, 2, '.', ',');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17095,6 +17095,35 @@ Partial Class Ventas
|
|||||||
Protected Sub DdlPS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPS.selectedindexchange
|
Protected Sub DdlPS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPS.selectedindexchange
|
||||||
DdlPSIndexChange(DdlPS.SelectedValue.ToEntero(), DdlPS)
|
DdlPSIndexChange(DdlPS.SelectedValue.ToEntero(), DdlPS)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Protected Sub DdlPSEdit_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||||
|
If GvPS.EditIndex >= 0 Then
|
||||||
|
Dim ddlPSEdit = DirectCast(sender, ADServerControl.Dropdownlost)
|
||||||
|
Dim GvRow = DirectCast(ddlPSEdit.NamingContainer, GridViewRow)
|
||||||
|
|
||||||
|
If (GvRow.RowState = DataControlRowState.Edit OrElse GvRow.RowState = 5) Then
|
||||||
|
Dim CvePSParametro = ddlPSEdit.SelectedValue.ToEntero()
|
||||||
|
|
||||||
|
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
|
||||||
|
If DrPS IsNot Nothing Then
|
||||||
|
'SUGIERE PRECIO
|
||||||
|
Dim PrecioSugerido As Decimal = 0
|
||||||
|
Dim tPrecioSugerido As Decimal = 0
|
||||||
|
tPrecioSugerido = DrPS("Precio").ToString().ToDecimal
|
||||||
|
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePSParametro, DrPS("CveClasificacion").ToString().ToEntero())
|
||||||
|
|
||||||
|
PrecioSugerido = ObjPrecioSugerido.PrecioSugerido
|
||||||
|
|
||||||
|
If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido
|
||||||
|
|
||||||
|
GvRow.FCTextBox("TxtPrecio").Text = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlClasificacion.SelectedIndexChanged
|
Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlClasificacion.SelectedIndexChanged
|
||||||
CargaPS(DdlClasificacion.SelectedValue.ToEntero(), DdlPS)
|
CargaPS(DdlClasificacion.SelectedValue.ToEntero(), DdlPS)
|
||||||
UpPS.Update()
|
UpPS.Update()
|
||||||
@@ -23996,24 +24025,36 @@ Partial Class Ventas
|
|||||||
ElseIf e.CommandName = "Descuento" Then
|
ElseIf e.CommandName = "Descuento" Then
|
||||||
LblSubtotalDescPS.Text = ""
|
LblSubtotalDescPS.Text = ""
|
||||||
LblTotalDescPS.Text = ""
|
LblTotalDescPS.Text = ""
|
||||||
|
LblTotalFinalDescPS.Text = ""
|
||||||
|
|
||||||
LblTituloDesc.Text = "Descuento"
|
LblTituloDesc.Text = "Descuento"
|
||||||
HdnConsecPS.Value = "-1"
|
HdnConsecPS.Value = "-1"
|
||||||
HdnTotalCompra.Value = ""
|
HdnTotalCompra.Value = ""
|
||||||
TxtPorPS.Text = ""
|
TxtPorPS.Text = ""
|
||||||
LblIVADescPS.Text = ""
|
LblIVADescPS.Text = ""
|
||||||
|
LblUtilidadPorcentaje.Text = ""
|
||||||
|
HdnIVADescPS.Value = "0"
|
||||||
|
|
||||||
Dim GvRow As GridViewRow = GvPS.Rows(e.CommandArgument.ToString().ToEntero())
|
Dim GvRow As GridViewRow = GvPS.Rows(e.CommandArgument.ToString().ToEntero())
|
||||||
LblTituloDesc.Text = $"Descuento: {GvRow.DataKey("PS")}"
|
LblTituloDesc.Text = $"Descuento: {GvRow.DataKey("PS")}"
|
||||||
HdnConsecPS.Value = GvRow.DataKey("Consec")
|
HdnConsecPS.Value = GvRow.DataKey("Consec")
|
||||||
LblSubtotalDescPS.Text = (GvRow.DataKey("Total").ToDecimal()).FormatoNumero()
|
LblSubtotalDescPS.Text = (GvRow.DataKey("Total").ToDecimal()).FormatoNumero()
|
||||||
LblTotalDescPS.Text = (GvRow.DataKey("Total").ToDecimal() + GvRow.DataKey("ImporteIVA").ToDecimal()).FormatoNumero()
|
LblTotalDescPS.Text = (GvRow.DataKey("Total").ToDecimal() + GvRow.DataKey("ImporteIVA").ToDecimal()).FormatoNumero()
|
||||||
|
LblTotalFinalDescPS.Text = (GvRow.DataKey("Total").ToDecimal() + GvRow.DataKey("ImporteIVA").ToDecimal()).FormatoNumero()
|
||||||
LblIVADescPS.Text = GvRow.DataKey("ImporteIVA").FormatoNumero()
|
LblIVADescPS.Text = GvRow.DataKey("ImporteIVA").FormatoNumero()
|
||||||
|
HdnIVADescPS.Value = GvRow.DataKey("IVA").FormatoNumero()
|
||||||
|
|
||||||
Using ObjPS As New ClsProductosServicios
|
Using ObjPS As New ClsProductosServicios
|
||||||
Dim PrecioCompra = ObjPS.GetUltimoPrecioCompra(UsuarioActual.CveEmpresa, GvRow.DataKey("CvePS").ToEntero())
|
Dim PrecioCompra = ObjPS.GetUltimoPrecioCompra(UsuarioActual.CveEmpresa, GvRow.DataKey("CvePS").ToEntero())
|
||||||
If PrecioCompra > 0 Then
|
If PrecioCompra > 0 Then
|
||||||
HdnTotalCompra.Value = (PrecioCompra * GvRow.DataKey("Cantidad").ToDouble() * 1.16).ToString()
|
Dim TotalCompra = (PrecioCompra * GvRow.DataKey("Cantidad").ToDouble() * (1 + GvRow.DataKey("IVA").ToDecimal()))
|
||||||
|
HdnTotalCompra.Value = TotalCompra.ToString()
|
||||||
LblPrecioCompra.Text = $"PU Compra: {(PrecioCompra).FormatoNumero(2)}"
|
LblPrecioCompra.Text = $"PU Compra: {(PrecioCompra).FormatoNumero(2)}"
|
||||||
|
|
||||||
|
Dim TotalRedondeado = GvRow.DataKey("Total").ToDecimal() + GvRow.DataKey("ImporteIVA").ToDecimal()
|
||||||
|
|
||||||
|
Dim PorUtilidad = ((TotalRedondeado - TotalCompra) / TotalRedondeado) * 100D
|
||||||
|
LblUtilidadPorcentaje.Text = PorUtilidad.FormatoNumero(2)
|
||||||
End If
|
End If
|
||||||
End Using
|
End Using
|
||||||
|
|
||||||
@@ -36974,16 +37015,28 @@ Partial Class Ventas
|
|||||||
If HdnDescPS.Value.ToEntero() > 0 Then
|
If HdnDescPS.Value.ToEntero() > 0 Then
|
||||||
Dim RowUpdate As DataRow = TmpDT.Select($"Consec = {HdnConsecPS.Value}").FirstOrDefault()
|
Dim RowUpdate As DataRow = TmpDT.Select($"Consec = {HdnConsecPS.Value}").FirstOrDefault()
|
||||||
If RowUpdate IsNot Nothing Then
|
If RowUpdate IsNot Nothing Then
|
||||||
RowUpdate("Descuento") = HdnDescPS.Value.ToDecimal()
|
If HdnDescPS.Value.ToDecimal().RoundSQL(2) < RowUpdate("Total").ToString().ToDecimal() Then
|
||||||
RowUpdate("ImporteIVA") = LblIVADescPS.Text.ToDecimal()
|
RowUpdate("Descuento") = HdnDescPS.Value.ToDecimal().RoundSQL(2)
|
||||||
|
|
||||||
|
Dim TotalCalculableImpuestos = (RowUpdate("Cantidad").ToString().ToDecimal * RowUpdate("PU").ToString().ToDecimal) - RowUpdate("Descuento").ToString().ToDecimal()
|
||||||
|
Dim TotalCalculableImpuestosIVA As Decimal = (TotalCalculableImpuestos * (1 + RowUpdate("PorcentajeIEPS").ToString().ToDecimal))
|
||||||
|
|
||||||
|
Dim ImporteIVA = (RowUpdate("PorcentajeIVA").ToString().ToDouble * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales)
|
||||||
|
|
||||||
|
RowUpdate("ImporteIVA") = ImporteIVA
|
||||||
|
|
||||||
|
CalculaTotalesVenta()
|
||||||
|
RegistraScript("$('#ModalDescPS').modal('hide');")
|
||||||
|
Else
|
||||||
|
Alert("El descuento no puede ser mayor o igual al total.", TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
|
||||||
CalculaTotalesVenta()
|
|
||||||
RegistraScript("$('#ModalDescPS').modal('hide');")
|
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Alert("No se pudo aplicar el descuento", TipoMensaje.MsgAdvertencia)
|
Alert("No se pudo aplicar el descuento", TipoMensaje.MsgAdvertencia)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user