Correcion en calculo de usados, agregar ps desde modal
This commit is contained in:
@@ -5272,35 +5272,30 @@
|
|||||||
</div>
|
</div>
|
||||||
<asp:UpdatePanel runat="server" ID="UpClasificacionPyME" UpdateMode="Conditional">
|
<asp:UpdatePanel runat="server" ID="UpClasificacionPyME" UpdateMode="Conditional">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<div class="form-group form-md-line-input input-iconright">
|
<div id="DivAddClasificacionPyME" runat="server" class="form-group form-md-line-input input-iconright">
|
||||||
<%-- <%--<asp:HiddenField ID="HdnUnidadMedida" runat="server" Value="-1" />
|
|
||||||
<asp:HiddenField ID="HiddenField1" runat="server" Value="-1" />
|
|
||||||
<asp:HiddenField ID="HiddenField2" runat="server" Value="-1" />
|
|
||||||
<asp:HiddenField ID="HiddenField3" runat="server" Value="-1" />
|
|
||||||
<asp:HiddenField ID="HiddenField4" runat="server" Value="-1" />
|
|
||||||
<asp:HiddenField ID="HiddenField5" runat="server" Value="-1" />
|
|
||||||
<asp:HiddenField ID="HiddenField6" runat="server" Value="-1" />
|
|
||||||
<asp:HiddenField ID="HiddenField7" runat="server" Value="-1" />
|
|
||||||
<asp:HiddenField ID="HiddenField8" runat="server" Value="-1" />
|
|
||||||
<asp:HiddenField ID="HiddenField9" runat="server" Value="-1" />
|
|
||||||
<asp:HiddenField ID="HiddenField10" runat="server" Value="-1" />
|
|
||||||
<asp:HiddenField ID="HiddenField11" runat="server" Value="-1" />--%>
|
|
||||||
|
|
||||||
<asp:DropDownList ID="DdlClasificacionPyME" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Clasificacion" DataValueField="CveClasificacion" Width="50%">
|
<asp:DropDownList ID="DdlClasificacionPyME" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Clasificacion" DataValueField="CveClasificacion" Width="50%">
|
||||||
<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>
|
||||||
<label for="<%= DdlClasificacionPyME.ClientID.ToString()%>">Clasificacion:</label>
|
<label for="<%= DdlClasificacionPyME.ClientID.ToString()%>">Clasificacion:</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group form-md-line-input input-iconright">
|
<div class="row">
|
||||||
<ADS:Dropdownlost runat="server" ID="DdlPSPyME" CssStyle="width: 50%;" CssClass=" form-control input-sm DdlPS" CssClassDdl=" select2me " DataTextField="PSCodigo" DataValueField="CvePS" data-onresult="CargaExistenciaAlmacenes" />
|
<div class="col-md-12">
|
||||||
|
<div class="form-group form-md-line-input input-iconright">
|
||||||
|
<label for="<%= DdlPSPyME.ClientID.ToString()%>">Producto/Servicio:</label>
|
||||||
|
<ADS:Dropdownlost runat="server" ID="DdlPSPyME" CssStyle="width: 100%;" CssClass=" form-control input-sm DdlPS" IncluyeTodos="false" CssClassDdl="select2me form-control" DataTextField="PSCodigo" DataValueField="CvePS" data-onresult="CargaExistenciaAlmacenes" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%-- <div class="form-group form-md-line-input input-iconright">
|
||||||
|
<ADS:Dropdownlost runat="server" ID="DdlPSPyME" CssStyle="width: 50%;" CssClass="form-control input-sm DdlPS" CssClassDdl="select2me " IncluyeTodos="false" DataTextField="PSCodigo" DataValueField="CvePS" data-onresult="CargaExistenciaAlmacenes" />
|
||||||
<label for="<%= DdlPSPyME.ClientID.ToString()%>">
|
<label for="<%= DdlPSPyME.ClientID.ToString()%>">
|
||||||
Productos / Servicio:
|
Productos / Servicio:
|
||||||
<label>
|
<label>
|
||||||
</div>
|
</div>--%>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
<br />
|
<br />
|
||||||
<div class="form-group form-md-line-input input-iconright">
|
<div id="DivAddUMPyME" runat="server" class="form-group form-md-line-input input-iconright">
|
||||||
<asp:DropDownList ID="DdlUMPyME" AppendDataBoundItems="true" CssClass="form-control input-sm select2me " runat="server" DataTextField="UnidadMedida" DataValueField="CveUnidadMedida" Style="width: 50%; max-width: 150px;"></asp:DropDownList>
|
<asp:DropDownList ID="DdlUMPyME" AppendDataBoundItems="true" CssClass="form-control input-sm select2me " runat="server" DataTextField="UnidadMedida" DataValueField="CveUnidadMedida" Style="width: 50%; max-width: 150px;"></asp:DropDownList>
|
||||||
<label for="<%= DdlUMPyME.ClientID.ToString()%>">Unidad de Medida:</label>
|
<label for="<%= DdlUMPyME.ClientID.ToString()%>">Unidad de Medida:</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -5308,7 +5303,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<label>Observación:</label>
|
<label>Observación:</label>
|
||||||
<br />
|
<br />
|
||||||
<asp:TextBox ID="TxtObsPyME" runat="server" Height="50" Width="503px" TextMode="MultiLine" CausesValidation="true" MaxLength="500"></asp:TextBox>
|
<asp:TextBox ID="TxtObsPyME" runat="server" CssClass="form-control input-sm" Height="50" TextMode="MultiLine" CausesValidation="true" MaxLength="500"></asp:TextBox>
|
||||||
</div>
|
</div>
|
||||||
<div id="divproyectos" runat="server">
|
<div id="divproyectos" runat="server">
|
||||||
<asp:UpdatePanel ID="UPPProyecto" runat="server" UpdateMode="Conditional">
|
<asp:UpdatePanel ID="UPPProyecto" runat="server" UpdateMode="Conditional">
|
||||||
@@ -5328,12 +5323,23 @@
|
|||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group form-md-line-input input-iconright">
|
<div class="row">
|
||||||
<asp:TextBox ID="TxtPrecioPyME" runat="server" CausesValidation="true" lang="nb" ClientIDMode="Static" MaxLength="12" ValidationGroup="GrpAddVenta" CssClass="form-control"></asp:TextBox>
|
<div class="col-md-6">
|
||||||
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender5" runat="server" TargetControlID="TxtPrecioPyME" FilterType="Custom, Numbers" ValidChars="." />
|
<div class="form-group form-md-line-input input-iconright">
|
||||||
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtPrecioPyME" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
|
<asp:TextBox ID="TxtPrecioPyME" runat="server" CausesValidation="true" lang="nb" ClientIDMode="Static" MaxLength="12" ValidationGroup="GrpAddVenta" CssClass="form-control"></asp:TextBox>
|
||||||
<label for="<%= TxtPrecioPyME.ClientID.ToString()%>">Precio:</label>
|
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender5" runat="server" TargetControlID="TxtPrecioPyME" FilterType="Custom, Numbers" ValidChars="." />
|
||||||
|
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtPrecioPyME" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
|
||||||
|
<label for="<%= TxtPrecioPyME.ClientID.ToString()%>">Precio:</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group form-md-line-input input-iconright">
|
||||||
|
<asp:TextBox ID="TxtDescuentoPyME" runat="server" Enabled="false" CausesValidation="true" lang="nb" ClientIDMode="Static" MaxLength="12" CssClass="form-control"></asp:TextBox>
|
||||||
|
<label for="<%= TxtDescuentoPyME.ClientID.ToString()%>">Descuento:</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group form-md-line-input input-iconright">
|
<div class="form-group form-md-line-input input-iconright">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@@ -7016,17 +7022,17 @@
|
|||||||
function SetDisabledTxtTotal(valor) {
|
function SetDisabledTxtTotal(valor) {
|
||||||
DisabledTxtTotal = valor;
|
DisabledTxtTotal = valor;
|
||||||
$('#<%= TxtTotal.ClientID %>').prop('readonly', DisabledTxtTotal);
|
$('#<%= TxtTotal.ClientID %>').prop('readonly', DisabledTxtTotal);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadpage() {
|
function loadpage() {
|
||||||
$('.AjustaT').each(function () {
|
$('.AjustaT').each(function () {
|
||||||
AjustaTotales($(this));
|
AjustaTotales($(this));
|
||||||
})
|
})
|
||||||
$('.AjustaT').change(function () {
|
$('.AjustaT').change(function () {
|
||||||
AjustaTotales($(this));
|
AjustaTotales($(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#<%= TxtTotal.ClientID %>').prop('readonly', DisabledTxtTotal);
|
$('#<%= TxtTotal.ClientID %>').prop('readonly', DisabledTxtTotal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -7050,9 +7056,9 @@
|
|||||||
$get(Row).style.backgroundColor = "#82b6db";
|
$get(Row).style.backgroundColor = "#82b6db";
|
||||||
$get(Obj).focus();
|
$get(Obj).focus();
|
||||||
var total = parseFloat($('#<%= HplSaldoAuxiliar.ClientID%>').text().replace(',', ''));
|
var total = parseFloat($('#<%= HplSaldoAuxiliar.ClientID%>').text().replace(',', ''));
|
||||||
$get(Obj).value = 0;
|
$get(Obj).value = 0;
|
||||||
var suma = 0;
|
var suma = 0;
|
||||||
$('#<%= GVAnticipos.ClientID%> input[type="text"]').each(function (index) {
|
$('#<%= GVAnticipos.ClientID%> input[type="text"]').each(function (index) {
|
||||||
var currentsaldo = parseFloat($(this).val())
|
var currentsaldo = parseFloat($(this).val())
|
||||||
if (isNaN(currentsaldo)) { currentsaldo = 0 }
|
if (isNaN(currentsaldo)) { currentsaldo = 0 }
|
||||||
suma = currentsaldo + suma;
|
suma = currentsaldo + suma;
|
||||||
@@ -7068,7 +7074,7 @@
|
|||||||
$get(Obj).value = "";
|
$get(Obj).value = "";
|
||||||
$get(Row).style.backgroundColor = "#ffffff";
|
$get(Row).style.backgroundColor = "#ffffff";
|
||||||
}
|
}
|
||||||
//if ($("input:checkbox:not(:checked)"))
|
//if ($("input:checkbox:not(:checked)"))
|
||||||
SetText2($get("LblTotalAnticipos"), formato_numero($get("HdnAnticipos").value, 2, '.', ','));
|
SetText2($get("LblTotalAnticipos"), formato_numero($get("HdnAnticipos").value, 2, '.', ','));
|
||||||
}
|
}
|
||||||
function imprimircotizacion() {
|
function imprimircotizacion() {
|
||||||
@@ -7346,6 +7352,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('.DdlPS').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); });
|
$('.DdlPS').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); });
|
||||||
|
$('.DdlPSPyME').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); });
|
||||||
|
|
||||||
$("body").on("mouseenter", ".select2-container.select2-container--default.select2-container--open .select2-dropdown li", function (event) {
|
$("body").on("mouseenter", ".select2-container.select2-container--default.select2-container--open .select2-dropdown li", function (event) {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var ind = $this.index();
|
var ind = $this.index();
|
||||||
|
|||||||
@@ -2446,7 +2446,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If UsuarioActual.Empresa.CvePlataforma = 2 Then
|
If UsuarioActual.Empresa.CvePlataforma = 2 OrElse UsuarioActual.CveRol = 1 Then
|
||||||
ImgOtrosConceptos.Visible = False
|
ImgOtrosConceptos.Visible = False
|
||||||
TrFormaEntrega.Visible = False
|
TrFormaEntrega.Visible = False
|
||||||
TabDetalleVentas.Visible = False
|
TabDetalleVentas.Visible = False
|
||||||
@@ -2461,6 +2461,9 @@ Partial Class Ventas
|
|||||||
Next
|
Next
|
||||||
LnkAddVenta.Visible = True
|
LnkAddVenta.Visible = True
|
||||||
divproyectos.Visible = False
|
divproyectos.Visible = False
|
||||||
|
|
||||||
|
DivAddClasificacionPyME.Visible = False
|
||||||
|
DivAddUMPyME.Visible = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
TabVentaAF.Visible = False
|
TabVentaAF.Visible = False
|
||||||
@@ -5824,9 +5827,9 @@ Partial Class Ventas
|
|||||||
Dim objPS As New ClsProductosServicios
|
Dim objPS As New ClsProductosServicios
|
||||||
If objPS.GetPSSucursalesALL(CvePS, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero) Then
|
If objPS.GetPSSucursalesALL(CvePS, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero) Then
|
||||||
PrecioMinimo = objPS.DtResultados.FiltroPrimeroValor("PrecioMinimo", "").ToDecimal
|
PrecioMinimo = objPS.DtResultados.FiltroPrimeroValor("PrecioMinimo", "").ToDecimal
|
||||||
If PrecioMinimo > 0 Then
|
'If PrecioMinimo > 0 Then
|
||||||
Costo = PrecioMinimo
|
' Costo = PrecioMinimo
|
||||||
End If
|
'End If
|
||||||
End If
|
End If
|
||||||
objPS.Dispose()
|
objPS.Dispose()
|
||||||
|
|
||||||
@@ -5835,7 +5838,7 @@ Partial Class Ventas
|
|||||||
If ValidaExistencia AndAlso DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then
|
If ValidaExistencia AndAlso DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then
|
||||||
'VALIDA EXISTENCIA
|
'VALIDA EXISTENCIA
|
||||||
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) Then
|
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) Then
|
||||||
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS}") < TxtCantidad.Text.ToDouble Then
|
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then
|
||||||
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
|
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
@@ -13642,6 +13645,10 @@ Partial Class Ventas
|
|||||||
CargarAlmacenes()
|
CargarAlmacenes()
|
||||||
DdlPS.Attributes.Remove("data-cvesubproyecto")
|
DdlPS.Attributes.Remove("data-cvesubproyecto")
|
||||||
DdlPS.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue)
|
DdlPS.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue)
|
||||||
|
|
||||||
|
DdlPSPyME.Attributes.Remove("data-cvesubproyecto")
|
||||||
|
DdlPSPyME.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue)
|
||||||
|
|
||||||
UpPS.Update()
|
UpPS.Update()
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub CargaFolios()
|
Private Sub CargaFolios()
|
||||||
@@ -14014,9 +14021,14 @@ Partial Class Ventas
|
|||||||
Dim PU As Decimal = If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal)
|
Dim PU As Decimal = If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal)
|
||||||
|
|
||||||
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
|
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
|
||||||
|
Dim ValidaCondicionesComerciales As Boolean = True
|
||||||
|
|
||||||
|
If DrPS IsNot Nothing AndAlso DrPS("CveClasificacion").ToString.ToEntero = 20636 Then
|
||||||
|
ValidaCondicionesComerciales = False
|
||||||
|
End If
|
||||||
|
|
||||||
'VERIFICA SI APLICAN CONDICIONES COMERCIALES
|
'VERIFICA SI APLICAN CONDICIONES COMERCIALES
|
||||||
If DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then
|
If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then
|
||||||
'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA
|
'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA
|
||||||
If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then
|
If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then
|
||||||
Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}")
|
Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}")
|
||||||
@@ -14100,9 +14112,65 @@ Partial Class Ventas
|
|||||||
Dim CveSubProyecto As Integer = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedValue, "0").ToString.ToEntero
|
Dim CveSubProyecto As Integer = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedValue, "0").ToString.ToEntero
|
||||||
Dim SubProyecto As String = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedItem.Text, "").ToString
|
Dim SubProyecto As String = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedItem.Text, "").ToString
|
||||||
|
|
||||||
AgregarProductoServicio(TxtCantidadPyME.Text.ToDecimal, DdlUMPyME.SelectedValue.ToEntero, DdlUMPyME.SelectedItem.Text, DdlClasificacionPyME.SelectedValue.ToEntero, DdlClasificacionPyME.SelectedItem.Text,
|
Dim Descuento As Decimal = 0
|
||||||
DdlPSPyME.SelectedValue.ToEntero, DdlPSPyME.SelectedText, TxtObsPyME.Text, TxtPrecioPyME.Text.ToDecimal, 0, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
Dim PU As Decimal = TxtPrecioPyME.Text.ToDecimal()
|
||||||
|
Dim Cantidad As Decimal = TxtCantidadPyME.Text.ToDecimal()
|
||||||
|
|
||||||
|
Dim CvePS As Integer = DdlPSPyME.SelectedValue.ToEntero
|
||||||
|
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
|
||||||
|
Dim ValidaCondicionesComerciales As Boolean = True
|
||||||
|
|
||||||
|
If DrPS IsNot Nothing AndAlso DrPS("CveClasificacion").ToString.ToEntero = 20636 Then
|
||||||
|
ValidaCondicionesComerciales = False
|
||||||
|
End If
|
||||||
|
'VERIFICA SI APLICAN CONDICIONES COMERCIALES
|
||||||
|
If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then
|
||||||
|
'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA
|
||||||
|
If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then
|
||||||
|
Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}")
|
||||||
|
'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA
|
||||||
|
If RowPorcentaje IsNot Nothing Then
|
||||||
|
Dim PorcentajeProducto = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D
|
||||||
|
Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D
|
||||||
|
Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D
|
||||||
|
|
||||||
|
Dim TotalInicial As Decimal = (Cantidad * (PU)) - Descuento
|
||||||
|
Dim TotalFinal = TotalInicial
|
||||||
|
'SI APLICA EL PRIMER DESCUENTO
|
||||||
|
If PorcentajeProducto > 0 Then
|
||||||
|
Dim Descuento1 As Decimal = (TotalInicial * PorcentajeProducto).RoundSQL(2)
|
||||||
|
Dim Total2 = (TotalInicial - Descuento1)
|
||||||
|
|
||||||
|
'SI APLICA EL SEGUNDO DESCUENTO
|
||||||
|
If PorcentajeProducto2 > 0 Then
|
||||||
|
Dim Descuento2 As Decimal = (Total2 * PorcentajeProducto2).RoundSQL(2)
|
||||||
|
Dim Total3 = (Total2 - Descuento2)
|
||||||
|
|
||||||
|
'SI APLICA EL TERCER DESCUENTO
|
||||||
|
If PorcentajeProducto3 > 0 Then
|
||||||
|
Dim Descuento3 As Decimal = (Total3 * PorcentajeProducto3).RoundSQL(2)
|
||||||
|
TotalFinal = Total3 - Descuento3
|
||||||
|
Else
|
||||||
|
TotalFinal = Total3
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
TotalFinal = Total2
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
TotalFinal = TotalInicial
|
||||||
|
End If
|
||||||
|
|
||||||
|
Descuento += ((Cantidad * PU) - TotalFinal)
|
||||||
|
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
AgregarProductoServicio(Cantidad, DdlUMPyME.SelectedValue.ToEntero, DdlUMPyME.SelectedItem.Text, DdlClasificacionPyME.SelectedValue.ToEntero, DdlClasificacionPyME.SelectedItem.Text,
|
||||||
|
CvePS, DdlPSPyME.SelectedText, TxtObsPyME.Text, PU, Descuento, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||||
|
|
||||||
|
CalculaUsados()
|
||||||
CalculaTotalesVenta()
|
CalculaTotalesVenta()
|
||||||
|
|
||||||
|
|
||||||
@@ -14624,7 +14692,7 @@ Partial Class Ventas
|
|||||||
TmpDT.Columns.Add("CveConcepto", GetType(Integer))
|
TmpDT.Columns.Add("CveConcepto", GetType(Integer))
|
||||||
|
|
||||||
TmpDT.Columns.Add("EsOutSourcing", GetType(Boolean))
|
TmpDT.Columns.Add("EsOutSourcing", GetType(Boolean))
|
||||||
TmpDT.Columns.Add("EsUsado", GetType(Boolean))
|
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub CreaDTmpC()
|
Private Sub CreaDTmpC()
|
||||||
@@ -19545,9 +19613,10 @@ Partial Class Ventas
|
|||||||
Private Sub LnkAddVenta_Click(sender As Object, e As EventArgs) Handles LnkAddVenta.Click
|
Private Sub LnkAddVenta_Click(sender As Object, e As EventArgs) Handles LnkAddVenta.Click
|
||||||
Modalidad = "A"
|
Modalidad = "A"
|
||||||
LnkAgregarPyME.Text = "Agregar"
|
LnkAgregarPyME.Text = "Agregar"
|
||||||
TxtCantidadPyME.Text = ""
|
TxtCantidadPyME.Text = "1"
|
||||||
TxtObsPyME.Text = ""
|
TxtObsPyME.Text = ""
|
||||||
TxtPrecioPyME.Text = "0.00"
|
TxtPrecioPyME.Text = "0.00"
|
||||||
|
TxtDescuentoPyME.Text = "0.00"
|
||||||
LblTotalPyME.Text = "0.00"
|
LblTotalPyME.Text = "0.00"
|
||||||
If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then
|
If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then
|
||||||
DdlPSPyME.SelectedValue = "-1"
|
DdlPSPyME.SelectedValue = "-1"
|
||||||
@@ -19631,18 +19700,12 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Private Sub CargaPSPyME(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost)
|
Private Sub CargaPSPyME(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost)
|
||||||
|
|
||||||
DdlPSPyME.setEsWebService(If(UsuarioActual.Empresa.Funcionalidad(141).ToString = "1", True, False))
|
DdlPSPyME.setEsWebService(True)
|
||||||
|
|
||||||
If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then
|
DdlPSPyME.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue)
|
||||||
Objeto.ddl.Items.Clear()
|
DdlPSPyME.ddlWS.Attributes.Add("data-cveclasificacion", CveClasificacion.ToString)
|
||||||
'Objeto.ddl.DataSource = GlobalDTProductosServicios(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion, AplicaParaVenta:=1, Estatus:=1)
|
DdlPSPyME.ddlWS.Attributes.Add("data-pagina", "ventas/ventas")
|
||||||
Objeto.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion, AplicaParaVenta:=1, Estatus:=1)
|
DdlPSPyME.ddlWS.Attributes.Add("data-Estatus", "1")
|
||||||
Objeto.ddl.DataBind()
|
|
||||||
Objeto.ddl.Items.Insert(0, New ListItem("*** Actualizar listado de Productos o Servicios ***", "-2"))
|
|
||||||
Objeto.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1"))
|
|
||||||
Else
|
|
||||||
DdlPSPyME.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue)
|
|
||||||
End If
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -19673,6 +19736,62 @@ Partial Class Ventas
|
|||||||
'LblUnidadMedida.Text = PS.Rows(0)("UnidadMedida").ToString
|
'LblUnidadMedida.Text = PS.Rows(0)("UnidadMedida").ToString
|
||||||
TxtPrecioPyME.Text = drPS("Precio").ToString.FormatoNumero(2).Replace(","c, "")
|
TxtPrecioPyME.Text = drPS("Precio").ToString.FormatoNumero(2).Replace(","c, "")
|
||||||
|
|
||||||
|
Dim Cantidad As Decimal = TxtCantidadPyME.Text.ToDecimal()
|
||||||
|
Dim PU As Decimal = TxtPrecioPyME.Text.ToDecimal()
|
||||||
|
Dim Descuento As Decimal = 0
|
||||||
|
Dim ValidaCondicionesComerciales As Boolean = True
|
||||||
|
|
||||||
|
If drPS IsNot Nothing AndAlso drPS("CveClasificacion").ToString.ToEntero = 20636 Then
|
||||||
|
ValidaCondicionesComerciales = False
|
||||||
|
End If
|
||||||
|
'VERIFICA SI APLICAN CONDICIONES COMERCIALES
|
||||||
|
If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then
|
||||||
|
'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA
|
||||||
|
If Not String.IsNullOrEmpty(drPS("CveMarca").ToString()) AndAlso drPS("CveMarca").ToString().ToEntero() > 0 Then
|
||||||
|
Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={drPS("CveMarca").ToString()}")
|
||||||
|
'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA
|
||||||
|
If RowPorcentaje IsNot Nothing Then
|
||||||
|
Dim PorcentajeProducto = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D
|
||||||
|
Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D
|
||||||
|
Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D
|
||||||
|
|
||||||
|
Dim TotalInicial As Decimal = (Cantidad * (PU)) - Descuento
|
||||||
|
Dim TotalFinal = TotalInicial
|
||||||
|
'SI APLICA EL PRIMER DESCUENTO
|
||||||
|
If PorcentajeProducto > 0 Then
|
||||||
|
Dim Descuento1 As Decimal = (TotalInicial * PorcentajeProducto).RoundSQL(2)
|
||||||
|
Dim Total2 = (TotalInicial - Descuento1)
|
||||||
|
|
||||||
|
'SI APLICA EL SEGUNDO DESCUENTO
|
||||||
|
If PorcentajeProducto2 > 0 Then
|
||||||
|
Dim Descuento2 As Decimal = (Total2 * PorcentajeProducto2).RoundSQL(2)
|
||||||
|
Dim Total3 = (Total2 - Descuento2)
|
||||||
|
|
||||||
|
'SI APLICA EL TERCER DESCUENTO
|
||||||
|
If PorcentajeProducto3 > 0 Then
|
||||||
|
Dim Descuento3 As Decimal = (Total3 * PorcentajeProducto3).RoundSQL(2)
|
||||||
|
TotalFinal = Total3 - Descuento3
|
||||||
|
Else
|
||||||
|
TotalFinal = Total3
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
TotalFinal = Total2
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
TotalFinal = TotalInicial
|
||||||
|
End If
|
||||||
|
|
||||||
|
Descuento += ((Cantidad * PU) - TotalFinal)
|
||||||
|
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
TxtDescuentoPyME.Text = Descuento.FormatoNumero(2).Replace(","c, "")
|
||||||
|
|
||||||
|
LblTotalPyME.Text = ((Cantidad * PU) - Descuento).FormatoNumero(2).Replace(","c, "")
|
||||||
|
|
||||||
If UsuarioActual.CveEmpresa = 80 Then
|
If UsuarioActual.CveEmpresa = 80 Then
|
||||||
'busca el precio de la sucursal
|
'busca el precio de la sucursal
|
||||||
Dim ObjPS As New ClsProductosServicios
|
Dim ObjPS As New ClsProductosServicios
|
||||||
@@ -21765,7 +21884,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Dim AplicaPUEditado As Boolean = UsuarioActual.TienePermisoProceso(253)
|
Dim AplicaPUEditado As Boolean = UsuarioActual.TienePermisoProceso(253)
|
||||||
|
|
||||||
Dim DtUsados As DataTable = TmpDT.FiltraParametros("EsUsado = True")
|
Dim DtUsados As DataTable = TmpDT.FiltraParametros("EsCargo = True")
|
||||||
|
|
||||||
TmpDT.Clear()
|
TmpDT.Clear()
|
||||||
For Each Gv As GridViewRow In GvAplicaDevolucion.Rows
|
For Each Gv As GridViewRow In GvAplicaDevolucion.Rows
|
||||||
@@ -23939,6 +24058,10 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Private Sub CalculaUsados(Optional DtUsadosDevolucion As DataTable = Nothing)
|
Private Sub CalculaUsados(Optional DtUsadosDevolucion As DataTable = Nothing)
|
||||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then
|
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then
|
||||||
|
If ViewState("CargoUsado").ToString = "False" Then
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
|
Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
|
||||||
|
|
||||||
Dim DTCvePSCostos As DataTable
|
Dim DTCvePSCostos As DataTable
|
||||||
@@ -23948,7 +24071,17 @@ Partial Class Ventas
|
|||||||
TmpDT.Columns.Add("Eliminar", GetType(Integer))
|
TmpDT.Columns.Add("Eliminar", GetType(Integer))
|
||||||
End If
|
End If
|
||||||
|
|
||||||
For Each drow As DataRow In TmpDT.Rows
|
|
||||||
|
Dim TmpDTCalculo As DataRow() = Nothing
|
||||||
|
'SI ES VENTA NUEVA O SI VA SER DEVOLUCION CONSIDERAR TODOS
|
||||||
|
If Me.CveVenta <= 0 OrElse DtUsadosDevolucion IsNot Nothing Then
|
||||||
|
TmpDTCalculo = TmpDT.Rows.Cast(Of DataRow).ToArray()
|
||||||
|
'SI ES EDICION DE REMISION SOLO CONSIDERAR LOS PRODUCTOS NUEVOS
|
||||||
|
ElseIf Me.CveVenta > 0 AndAlso DtUsadosDevolucion Is Nothing AndAlso DdlTipoComprobante.SelectedValue = "Rem" Then
|
||||||
|
TmpDTCalculo = TmpDT.Select("CveVentaDetalle IS NULL OR CveVentaDetalle <=0")
|
||||||
|
End If
|
||||||
|
|
||||||
|
For Each drow As DataRow In TmpDTCalculo
|
||||||
If DTCvePSCostos IsNot Nothing Then
|
If DTCvePSCostos IsNot Nothing Then
|
||||||
For Each drow2 As DataRow In DTCvePSCostos.Rows
|
For Each drow2 As DataRow In DTCvePSCostos.Rows
|
||||||
If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then
|
If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then
|
||||||
@@ -23957,7 +24090,6 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Next
|
Next
|
||||||
|
|
||||||
Dim TmpDTView As New DataView(TmpDT)
|
Dim TmpDTView As New DataView(TmpDT)
|
||||||
@@ -23967,11 +24099,19 @@ Partial Class Ventas
|
|||||||
dRowEliminar.Delete()
|
dRowEliminar.Delete()
|
||||||
Next
|
Next
|
||||||
|
|
||||||
TmpDT.AcceptChanges()
|
'SI ES VENTA NUEVA O SI VA SER DEVOLUCION CONSIDERAR TODOS
|
||||||
If ViewState("CargoUsado").ToString = "False" Then
|
If Me.CveVenta <= 0 OrElse DtUsadosDevolucion IsNot Nothing Then
|
||||||
Exit Sub
|
TmpDTCalculo = TmpDT.Rows.Cast(Of DataRow).ToArray()
|
||||||
|
'SI ES EDICION DE REMISION SOLO CONSIDERAR LOS PRODUCTOS NUEVOS
|
||||||
|
ElseIf Me.CveVenta > 0 AndAlso DtUsadosDevolucion Is Nothing AndAlso DdlTipoComprobante.SelectedValue = "Rem" Then
|
||||||
|
TmpDTCalculo = TmpDT.Select("CveVentaDetalle IS NULL OR CveVentaDetalle <=0")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TmpDT.AcceptChanges()
|
||||||
|
|
||||||
|
|
||||||
Dim CveUnidadMedidaPSA As Integer = -1
|
Dim CveUnidadMedidaPSA As Integer = -1
|
||||||
Dim UnidadMedidaPSA As String = "Unidad"
|
Dim UnidadMedidaPSA As String = "Unidad"
|
||||||
Dim CveClasificacionPSA As Integer = -1
|
Dim CveClasificacionPSA As Integer = -1
|
||||||
@@ -23996,7 +24136,7 @@ Partial Class Ventas
|
|||||||
DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer))
|
DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer))
|
||||||
DTPSTemp.Columns.Add("SubProyecto", GetType(String))
|
DTPSTemp.Columns.Add("SubProyecto", GetType(String))
|
||||||
|
|
||||||
For Each DrowPartidas As DataRow In TmpDT.Rows
|
For Each DrowPartidas As DataRow In TmpDTCalculo
|
||||||
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString.ToEntero
|
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString.ToEntero
|
||||||
|
|
||||||
If CveTamanioTemp > 0 Then
|
If CveTamanioTemp > 0 Then
|
||||||
@@ -24527,26 +24667,26 @@ Partial Class Ventas
|
|||||||
' Dim facBytes = DescargarFactura(Me.CveVenta, UsuarioActual.CveEmpresa)
|
' Dim facBytes = DescargarFactura(Me.CveVenta, UsuarioActual.CveEmpresa)
|
||||||
' ImprimirbytesPDF(facBytes, "Factura")
|
' ImprimirbytesPDF(facBytes, "Factura")
|
||||||
'End Sub
|
'End Sub
|
||||||
'Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer) As Byte()
|
'Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer) As Byte()
|
||||||
' Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", "https://sig.adssistemas.mx/", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
|
' Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", "https://sig.adssistemas.mx/", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
|
||||||
' Dim File As Byte() = Nothing
|
' Dim File As Byte() = Nothing
|
||||||
' Try
|
' Try
|
||||||
' Using httpClient = New HttpClient()
|
' Using httpClient = New HttpClient()
|
||||||
' httpClient.Timeout = New TimeSpan(0, 15, 0)
|
' httpClient.Timeout = New TimeSpan(0, 15, 0)
|
||||||
' Using request = New HttpRequestMessage(HttpMethod.Get, Url)
|
' Using request = New HttpRequestMessage(HttpMethod.Get, Url)
|
||||||
' request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO=100", CveEmpresa, DateTime.UtcNow.Ticks)))
|
' request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO=100", CveEmpresa, DateTime.UtcNow.Ticks)))
|
||||||
' Dim response = httpClient.SendAsync(request).Result
|
' Dim response = httpClient.SendAsync(request).Result
|
||||||
' If response.StatusCode = Net.HttpStatusCode.OK Then
|
' If response.StatusCode = Net.HttpStatusCode.OK Then
|
||||||
' File = response.Content.ReadAsByteArrayAsync().Result
|
' File = response.Content.ReadAsByteArrayAsync().Result
|
||||||
' End If
|
' End If
|
||||||
' End Using
|
' End Using
|
||||||
' End Using
|
' End Using
|
||||||
' Catch ex As Exception
|
' Catch ex As Exception
|
||||||
' File = Nothing
|
' File = Nothing
|
||||||
' OnError("Ocurrió un error al descargar la factura", ex)
|
' OnError("Ocurrió un error al descargar la factura", ex)
|
||||||
' End Try
|
' End Try
|
||||||
|
|
||||||
' Return File
|
' Return File
|
||||||
'End Function
|
'End Function
|
||||||
'Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte()
|
'Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte()
|
||||||
' Dim Url = New Uri(String.Format("http://{0}:{1}/Compras/PopUpVerFactura.aspx?P={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
|
' Dim Url = New Uri(String.Format("http://{0}:{1}/Compras/PopUpVerFactura.aspx?P={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Service ID="{C0C07587-41A7-46C8-8FBD-3F9C8EBE2DDC}"/>
|
<Service ID="{C0C07587-41A7-46C8-8FBD-3F9C8EBE2DDC}"/>
|
||||||
</StartupServices>
|
</StartupServices>
|
||||||
</VisualWebDeveloper>
|
</VisualWebDeveloper>
|
||||||
Reference in New Issue
Block a user