CACULO CORRECTO DE CODIGOS DE INSPECCION,LINEA,ENSAMBLE
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<%@ Page Title="Ventas - Facturación" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PV.aspx.vb" Inherits="PV" EnableEventValidation="false" %>
|
||||
<%@ Page Title="Ventas - Facturación" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PV.aspx.vb" Inherits="PV" EnableEventValidation="false"%>
|
||||
|
||||
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
|
||||
<%--Necesario para el modal que no se cierra--%>
|
||||
@@ -2913,7 +2913,7 @@
|
||||
<asp:LinkButton ID="LnkFechaAjuste" class="btn default " Text=" <i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
<ajax:MaskedEditExtender ID="MEEFechaAjuste" runat="server" TargetControlID="TxtFechaAjuste" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="CEEFechaAjuste" TargetControlID="TxtFechaAjuste" PopupButtonID="LnkFechaAjuste" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="CEEFechaAjuste" TargetControlID="TxtFechaAjuste" PopupButtonID="LnkFechaAjuste" PopupPosition="BottomLeft" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
|
||||
<asp:RequiredFieldValidator ID="RFVFechaAjuste" runat="server" ControlToValidate="TxtFechaAjuste" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEFechaAjuste" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaAjuste"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
@@ -3021,75 +3021,50 @@
|
||||
function ValidarCodigoEnsamble(source, arguments) {
|
||||
let CveMarca = HdnPSAjusteMarca.value;
|
||||
let CveClasificacion = HdnPSAjusteClasificacion.value;
|
||||
let regex = "";
|
||||
|
||||
//SI ES MOTOBATERIA
|
||||
if (CveClasificacion = "20517") {
|
||||
regex = "[1X]|"
|
||||
//regex = "[*]|"
|
||||
//SI ES OPTIMA
|
||||
} else if (CveClasificacion = "20511") {
|
||||
regex = "[1X]|"
|
||||
}
|
||||
|
||||
//MARCA OPTIMA
|
||||
if (CveMarca == "1086") {
|
||||
let re = new RegExp("^" + regex + "[0-9]+$");
|
||||
arguments.IsValid = re.test(parseInt(arguments.Value));
|
||||
let regex = new RegExp("^[0-9]+$");
|
||||
arguments.IsValid = regex.test(arguments.Value);
|
||||
return;
|
||||
//MARCA MOTOBATERIAS
|
||||
} else if ((CveMarca == "1090" || CveMarca == "1091") || CveClasificacion == "20517") {
|
||||
let regex = new RegExp("^[1X]");
|
||||
arguments.IsValid = regex.test(arguments.Value);
|
||||
return;
|
||||
//AUTOMOTRIZ-ACUMULADORES
|
||||
} else {
|
||||
let re = new RegExp("^" + regex + "[0-9][A-HJ-M]([[0-2][0-9]|3[0-1])[0-9A-Z][ACEN][2-5]$");
|
||||
arguments.IsValid = re.test(arguments.Value);
|
||||
let regex = new RegExp("^[1X]|^[0-9][A-HJ-M]([[0-2][0-9]|3[0-1])[0-9A-Z][ACEN][2-5]$");
|
||||
arguments.IsValid = regex.test(arguments.Value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function ValidarCodigoLinea(source, arguments) {
|
||||
var CveMarca = HdnPSAjusteMarca.value;
|
||||
let CveClasificacion = HdnPSAjusteClasificacion.value;
|
||||
let regex = "";
|
||||
|
||||
//SI ES MOTOBATERIA
|
||||
if (CveClasificacion = "20517") {
|
||||
regex = "[*]|";
|
||||
} else {
|
||||
regex = "";
|
||||
}
|
||||
|
||||
if (CveMarca == "1086") {
|
||||
var re = new RegExp("^" + regex + "[0-9]+$");
|
||||
arguments.IsValid = re.test(parseInt(arguments.Value));
|
||||
} else {
|
||||
var re = new RegExp("^" + regex + "$");
|
||||
arguments.IsValid = re.test(arguments.Value);
|
||||
}
|
||||
var regex = new RegExp("^[*]");
|
||||
arguments.IsValid = regex.test(arguments.Value);
|
||||
}
|
||||
|
||||
function ValidarCodigoInspeccion(source, arguments) {
|
||||
let CveMarca = HdnPSAjusteMarca.value;
|
||||
let CveClasificacion = HdnPSAjusteClasificacion.value;
|
||||
|
||||
let clasificaciones = ["20517", "20511"]
|
||||
|
||||
//SI ES MOTOBATERIA
|
||||
if (CveClasificacion = "20517") {
|
||||
var re = new RegExp("^[X]|[x]|[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
||||
arguments.IsValid = re.test(arguments.Value);
|
||||
//MARCA OPTIMA
|
||||
if (CveMarca == "1086") {
|
||||
var regex = new RegExp("^\d{4}$|^[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
||||
arguments.IsValid = regex.test(arguments.Value);
|
||||
return;
|
||||
//MARCA MOTOBATERIAS
|
||||
} else if ((CveMarca == "1090" || CveMarca == "1091") || CveClasificacion == "20517") {
|
||||
var regex = new RegExp("^[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
||||
arguments.IsValid = regex.test(arguments.Value);
|
||||
return;
|
||||
//AUTOMOTRIZ-ACUMULADORES
|
||||
} else {
|
||||
var re = new RegExp("^[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
||||
arguments.IsValid = re.test(arguments.Value);
|
||||
var regex = new RegExp("^[X]|^[x]|[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
||||
arguments.IsValid = regex.test(arguments.Value);
|
||||
return;
|
||||
}
|
||||
//if (clasificaciones.includes(CveClasificacion)) {
|
||||
// //var re = new RegExp("^[*]|[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
||||
// var re = new RegExp("^[X]|[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
||||
// arguments.IsValid = re.test(parseInt(arguments.Value));
|
||||
// return;
|
||||
//} else {
|
||||
// var re = new RegExp("^[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
||||
// arguments.IsValid = re.test(arguments.Value);
|
||||
// return;
|
||||
//}
|
||||
}
|
||||
|
||||
function CalculaMesesUso() {
|
||||
|
||||
@@ -568,7 +568,7 @@ Partial Class PV
|
||||
End Property
|
||||
Private Property CveVentaDetalle As Integer
|
||||
Get
|
||||
Return ViewState("CveVentaDetalle").ToString.ToEntero
|
||||
Return If(ViewState("CveVentaDetalle") Is Nothing, -1, ViewState("CveVentaDetalle").ToString.ToEntero)
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveVentaDetalle") = value
|
||||
@@ -682,6 +682,15 @@ Partial Class PV
|
||||
ViewState("EnviarCorreoCliente") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private ReadOnly Property ClasificacionesDescuentos As Dictionary(Of Integer, Decimal)
|
||||
Get
|
||||
Return New Dictionary(Of Integer, Decimal) From {
|
||||
{20516, 0.23D}, 'Descuento para lubricantes LTH
|
||||
{20515, 0.24D} 'Descuento para filtros LTH
|
||||
}
|
||||
End Get
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
#Region "PROPIEDADES DE PUNTO DE VENTA"
|
||||
@@ -3570,11 +3579,7 @@ Partial Class PV
|
||||
End If
|
||||
'Descuento por clasificación
|
||||
If drPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then
|
||||
Dim clasificacionesDescuentos As New Dictionary(Of Integer, Double) From {
|
||||
{20516, 0.23}, 'Descuento para lubricantes LTH
|
||||
{20515, 0.24} 'Descuento para filtros LTH
|
||||
}
|
||||
TxtDescuento.Text = (PrecioSugerido * clasificacionesDescuentos(drPS("CveClasificacion").ToString.ToEntero)).ToString("F2")
|
||||
TxtDescuento.Text = (PrecioSugerido * ClasificacionesDescuentos(drPS("CveClasificacion").ToString.ToEntero)).ToString("F2")
|
||||
End If
|
||||
|
||||
If ChkAjuste.Checked Then
|
||||
@@ -3935,6 +3940,7 @@ Partial Class PV
|
||||
|
||||
TxtObsPS.Text = ""
|
||||
TxtPrecio.Text = ""
|
||||
TxtDescuento.Text = ""
|
||||
LblTotalPS.Text = "0.00"
|
||||
HdnIVAPS.Value = "-1"
|
||||
HdnIVARetAPS.Value = "-1"
|
||||
@@ -4414,7 +4420,7 @@ Partial Class PV
|
||||
ChkAgregar.Checked = True
|
||||
divagregrarotrops.Visible = True
|
||||
UpVenta.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"))
|
||||
RegistraScript("$('#DivAddVenta').modal({backdrop: 'static', keyboard: false});")
|
||||
End Sub
|
||||
Private Sub CargaBCI()
|
||||
'Dim ObjGral As New ClsGenerales
|
||||
@@ -4448,6 +4454,7 @@ Partial Class PV
|
||||
TxtCantidad.Text = GvRow.DataKey("Cantidad")
|
||||
TxtObsPS.Text = GvRow.DataKey("Obs")
|
||||
TxtPrecio.Text = GvRow.DataKey("PU")
|
||||
TxtDescuento.Text = GvRow.DataKey("Descuento")
|
||||
LblTotalPS.Text = GvRow.DataKey("Total")
|
||||
ChkAgregar.Checked = False
|
||||
divagregrarotrops.Visible = False
|
||||
@@ -4456,7 +4463,7 @@ Partial Class PV
|
||||
End If
|
||||
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
|
||||
UpVenta.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"), "EdicionVenta")
|
||||
RegistraScript("$('#DivAddVenta').modal({backdrop: 'static', keyboard: false});", "EdicionVenta")
|
||||
End Sub
|
||||
Protected Sub LnkAgregarPS_Click(sender As Object, e As EventArgs)
|
||||
If AgregarPS() Then
|
||||
@@ -4490,9 +4497,13 @@ Partial Class PV
|
||||
|
||||
'SELECCIONA EL PS DEPENDIENDO LA MODALIDAD (CODIGO BARRAS - DDL)
|
||||
Dim CvePS = DdlPS.SelectedValue.ToEntero
|
||||
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
|
||||
If ValidaAgregarPS(CvePS, DdlUnidadMedida.SelectedValue.ToEntero, TxtPrecio.Text.Trim.ToDouble, HdnTipoPS.Value.ToEntero, TxtCantidad.Text.ToDecimal) Then
|
||||
|
||||
Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal
|
||||
Dim PU As Decimal = If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal).RoundSQL(6)
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(507) = DdlPS.SelectedValue Then
|
||||
CvePSAmortizacion = DdlPS.SelectedValue.ToEntero.ToEntero
|
||||
End If
|
||||
@@ -4502,11 +4513,15 @@ Partial Class PV
|
||||
Descuento = HdnDescuento.Value.ToDecimal * TxtCantidad.Text.ToDecimal
|
||||
End If
|
||||
|
||||
If DrPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then
|
||||
Descuento = ((Cantidad * PU) * ClasificacionesDescuentos(DrPS("CveClasificacion").ToString.ToEntero))
|
||||
End If
|
||||
|
||||
Dim CveProyecto As Integer = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("CveProyecto").ToString.ToEntero
|
||||
Dim Proyecto As String = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("Proyecto").ToString
|
||||
|
||||
Dim Consec = AgregarProductoServicio(TxtCantidad.Text.ToDecimal, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
|
||||
CvePS, "", TxtObsPS.Text.Trim, If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal), Descuento,
|
||||
Dim Consec = AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
|
||||
CvePS, "", TxtObsPS.Text.Trim, PU, Descuento,
|
||||
CveProyecto, Proyecto, DdlSubProyectoDatos.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedItem.Text,
|
||||
SerieLote:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS, CveVentaDetalle:=CveVentaDetalle, EsCargo:=EsCargo)
|
||||
|
||||
@@ -5856,7 +5871,7 @@ Partial Class PV
|
||||
TxtCodEnsamble.Text = ""
|
||||
DdlTipoUso.SelectedIndex = -1
|
||||
TxtCodLinea.Text = ""
|
||||
TxtPrecio.Text = ""
|
||||
'TxtPrecio.Text = ""
|
||||
TxtFechaAjuste.Text = Now.ToShortDateString
|
||||
CEEFechaAjuste.EndDate = Now
|
||||
TxtCodInspeccion.Text = ""
|
||||
@@ -5910,22 +5925,27 @@ Partial Class PV
|
||||
Dim FechaI As Date = TxtFechaAjuste.Text.ToDate.AddDays(1)
|
||||
Dim FechaF As Date = Now
|
||||
Dim Dia As Integer = FechaI.Day
|
||||
'validación adicional, para saber si el mes tiene 31 días y el actua es menor.
|
||||
If FechaI.Day > Today.LastDayOfMonth.Day Then Dia = Today.LastDayOfMonth.Day
|
||||
Dim FechaT As Date = String.Format("{0}/{1}/{2}", Dia, FechaF.Month, FechaF.Year).ToDate 'armo la fecha con el día del mes actual
|
||||
Try
|
||||
'validación adicional, para saber si el mes tiene 31 días y el actua es menor.
|
||||
If FechaI.Day > Today.LastDayOfMonth.Day Then Dia = Today.LastDayOfMonth.Day
|
||||
Dim FechaT As Date = String.Format("{0}/{1}/{2}", Dia, FechaF.Month, FechaF.Year).ToDate 'armo la fecha con el día del mes actual
|
||||
|
||||
Dim MesesTrascurridos As Integer = Math.Round(DateDiff(DateInterval.Day, FechaI, FechaT) / 30.4, 2).ToEntero 'saco los meses y lo redondeo
|
||||
Dim MesesTrascurridos As Integer = Math.Round(DateDiff(DateInterval.Day, FechaI, FechaT) / 30.4, 2).ToEntero 'saco los meses y lo redondeo
|
||||
|
||||
If FechaT > FechaF Then
|
||||
'todavía está en el mes actual.
|
||||
MesesTrascurridos = MesesTrascurridos
|
||||
Else
|
||||
MesesTrascurridos = MesesTrascurridos + 1
|
||||
End If
|
||||
If FechaT > FechaF Then
|
||||
'todavía está en el mes actual.
|
||||
MesesTrascurridos = MesesTrascurridos
|
||||
Else
|
||||
MesesTrascurridos = MesesTrascurridos + 1
|
||||
End If
|
||||
|
||||
TxtMesesUso.Text = MesesTrascurridos.ToString
|
||||
TxtMesesUso.Text = MesesTrascurridos.ToString
|
||||
|
||||
CalculaPorcentajeAjuste()
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al calcular los meses de uso", ex)
|
||||
End Try
|
||||
|
||||
CalculaPorcentajeAjuste()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlPSAjuste_selectedindexchange(sender As Object, e As EventArgs)
|
||||
@@ -5950,15 +5970,23 @@ Partial Class PV
|
||||
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
|
||||
Dim CveMarca As Integer = -1
|
||||
Dim CveClasificacion As Integer = -1
|
||||
Dim CveTamanio As Integer = -1
|
||||
|
||||
If drPS IsNot Nothing Then
|
||||
PrecioSugerido = drPS("Precio").ToString.ToDecimal
|
||||
CveMarca = drPS("CveMarca").ToString.ToEntero
|
||||
CveClasificacion = drPS("CveClasificacion").ToString.ToEntero
|
||||
CveTamanio = drPS("CveTamaño").ToString.ToEntero
|
||||
End If
|
||||
|
||||
TxtPUFactura.Text = PrecioSugerido.FormatoNumero(2)
|
||||
|
||||
If DTBCIUsados IsNot Nothing AndAlso CveTamanio > 0 Then
|
||||
DdlBCIAjuste.Items.Clear()
|
||||
DdlBCIAjuste.DataSource = DTBCIUsados.FiltraParametros($"CveTamaño={CveTamanio}")
|
||||
DdlBCIAjuste.DataBind()
|
||||
End If
|
||||
|
||||
DdlTipoUso.Items.Clear()
|
||||
DdlTipoUso.DataSource = GlobalDTAcumGarantiasMesesTipoUso(UsuarioActual.CveEmpresa, CveMarca)
|
||||
DdlTipoUso.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
@@ -5973,8 +6001,6 @@ Partial Class PV
|
||||
TxtPUFactura.Text = ""
|
||||
End If
|
||||
|
||||
|
||||
|
||||
CalculaPorcentajeAjuste()
|
||||
End Sub
|
||||
|
||||
@@ -5991,6 +6017,10 @@ Partial Class PV
|
||||
Alert("No se ha especificado producto a entregar")
|
||||
Exit Sub
|
||||
End If
|
||||
If DdlPSAjuste.SelectedValue.ToEntero <= 0 Then
|
||||
Alert("No se ha especificado producto de ajuste a entregar")
|
||||
Exit Sub
|
||||
End If
|
||||
Try
|
||||
TxtImporteAjuste.Text = "0.00"
|
||||
If DdlTipoUso.SelectedValue.ToEntero > 0 AndAlso DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso TxtMesesUso.Text <> "" AndAlso DdlPS.SelectedValue.ToEntero > 0 Then
|
||||
@@ -6207,7 +6237,7 @@ Partial Class PV
|
||||
DivDatosVenta.Attributes.Add("class", "col-md-12")
|
||||
End If
|
||||
UpModalVenta.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"))
|
||||
RegistraScript("$('#DivAddVenta').modal({backdrop: 'static', keyboard: false});")
|
||||
RegistraScript("Recalcula();", "Recalcula")
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user