Validaciones de año del vehiculo, cod ensamble en motobaterias

This commit is contained in:
2022-04-05 17:16:38 -07:00
parent a7ca580fcc
commit 28dfee3776
2 changed files with 226 additions and 217 deletions

View File

@@ -2783,6 +2783,7 @@
<asp:HiddenField ID="HdnAplicaIEPS" runat="server" Value="-1" /> <asp:HiddenField ID="HdnAplicaIEPS" runat="server" Value="-1" />
<asp:HiddenField ID="HdnPorcentajeIEPS" runat="server" Value="-1" /> <asp:HiddenField ID="HdnPorcentajeIEPS" runat="server" Value="-1" />
<asp:HiddenField ID="HdnCvePS" runat="server" Value="-1" /> <asp:HiddenField ID="HdnCvePS" runat="server" Value="-1" />
<asp:HiddenField ID="HdnCveClasificacion" runat="server" Value="-1" ClientIDMode="Static" />
<div class="row" runat="server" visible="false"> <div class="row" runat="server" visible="false">
<div class="col-md-12"> <div class="col-md-12">
@@ -2847,10 +2848,6 @@
</div> </div>
</div> </div>
<div class="portlet-body form"> <div class="portlet-body form">
<asp:UpdatePanel runat="server" ID="UPPDatosUsado" UpdateMode="Conditional">
<ContentTemplate>
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<label>Tipo Servicio:</label> <label>Tipo Servicio:</label>
@@ -2871,7 +2868,7 @@
<div class="col-md-4"> <div class="col-md-4">
<label>Año:</label> <label>Año:</label>
<br /> <br />
<asp:TextBox ID="TxtAnioVehiculo" type="number" runat="server" Height="100%" Width="100%" CssClass="form-control" ></asp:TextBox> <asp:TextBox ID="TxtAnioVehiculo" type="number" runat="server" Height="100%" Width="100%" CssClass="form-control"></asp:TextBox>
<asp:CustomValidator ID="CVAnio" runat="server" ClientValidationFunction="ValidaAnioVehiculo" ValidateEmptyText="true" ControlToValidate="TxtAnioVehiculo" Display="Dynamic" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Año''</b> esta vacío o no tiene el formato correcto, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:CustomValidator> <asp:CustomValidator ID="CVAnio" runat="server" ClientValidationFunction="ValidaAnioVehiculo" ValidateEmptyText="true" ControlToValidate="TxtAnioVehiculo" Display="Dynamic" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Año''</b> esta vacío o no tiene el formato correcto, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:CustomValidator>
</div> </div>
</div> </div>
@@ -2913,15 +2910,10 @@
</div> </div>
</div> </div>
</div> </div>
</ContentTemplate>
</asp:UpdatePanel>
</div> </div>
</div> </div>
</div> </div>
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
@@ -3087,7 +3079,7 @@
<div class="col-md-8"> <div class="col-md-8">
<div id="DivCodEnsamble" runat="server" class="form-group form-md-line-input input-iconright"> <div id="DivCodEnsamble" runat="server" class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCodEnsamble" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox> <asp:TextBox ID="TxtCodEnsamble" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
<asp:CustomValidator ID="CVCodEnsamble" runat="server" ControlToValidate="TxtCodEnsamble" ClientValidationFunction="ValidarCodigoEnsamble" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Ensamble''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" /> <asp:CustomValidator ID="CVCodEnsamble" runat="server" ControlToValidate="TxtCodEnsamble" ValidateEmptyText="true" ClientValidationFunction="ValidarCodigoEnsamble" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Ensamble''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
<label for="<%= TxtCodEnsamble.ClientID.ToString()%>">Cod.Ensamble:</label> <label for="<%= TxtCodEnsamble.ClientID.ToString()%>">Cod.Ensamble:</label>
</div> </div>
</div> </div>
@@ -3278,13 +3270,16 @@
} }
function ValidaAnioVehiculo(val, args) { function ValidaAnioVehiculo(val, args) {
//VALIDA SOLO SI SE SELECCIONO UN USADO var today = new Date();
var cveUsado = ToDouble($get("C_DdlRecepcionUsados").value); var anioActual = today.getFullYear();
if (cveUsado > 0) {
let CveClasificacion = HdnCveClasificacion.value;
const acumuladores = "20520, 20522, 20513, 20511, 20521, 20512, 20514, 20229";
if (acumuladores.includes(CveClasificacion)) {
var anio = ToDouble(args.Value); var anio = ToDouble(args.Value);
if (anio > 0) { if (anio > 0) {
var valido = true; var valido = true;
if (anio < 1900) { if (anio <= 1900 || anio > anioActual) {
valido = false; valido = false;
} }
if (anio.toString().length != 4) { if (anio.toString().length != 4) {
@@ -3305,18 +3300,33 @@
//MARCA OPTIMA //MARCA OPTIMA
if (CveMarca == "1086") { if (CveMarca == "1086") {
//SI NO ES REQUERIDO, PONER COMO VALIDO
if (!arguments.Value) {
arguments.IsValid = true;
} else {
let regex = new RegExp("^[0-9]+$"); let regex = new RegExp("^[0-9]+$");
arguments.IsValid = regex.test(arguments.Value); arguments.IsValid = regex.test(arguments.Value);
}
return; return;
//MARCA MOTOBATERIAS //MARCA MOTOBATERIAS
} else if ((CveMarca == "1090" || CveMarca == "1091") || CveClasificacion == "20517") { } else if ((CveMarca == "1090" || CveMarca == "1091") || CveClasificacion == "20517") {
//EN MOTOBATERIAS ES REQUERIDO
if (!arguments.Value) {
arguments.IsValid = false;
} else {
let regex = new RegExp("^[A-L][0-9][0-9A-Z][A-Q][JAVY]$"); let regex = new RegExp("^[A-L][0-9][0-9A-Z][A-Q][JAVY]$");
arguments.IsValid = regex.test(arguments.Value); arguments.IsValid = regex.test(arguments.Value);
}
return; return;
//AUTOMOTRIZ-ACUMULADORES //AUTOMOTRIZ-ACUMULADORES
} else {
//SI NO ES REQUERIDO, PONER COMO VALIDO
if (!arguments.Value) {
arguments.IsValid = true;
} else { } else {
let regex = new RegExp("^[1X]|^[0-9][A-HJ-M][0-3][0-9][A-Z][ACEN][2-5]$"); let regex = new RegExp("^[1X]|^[0-9][A-HJ-M][0-3][0-9][A-Z][ACEN][2-5]$");
arguments.IsValid = regex.test(arguments.Value); arguments.IsValid = regex.test(arguments.Value);
}
return; return;
} }
} }
@@ -3547,7 +3557,7 @@
$get("LblPrecioFinal").innerText = formato_numero(Monto - ((Monto * Descuento) / 100), 2, '.', ','); $get("LblPrecioFinal").innerText = formato_numero(Monto - ((Monto * Descuento) / 100), 2, '.', ',');
$get("LblTotalPS").innerText = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ','); $get("LblTotalPS").innerText = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ',');
var Total = (Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""))) ; var Total = (Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")));
$get("LblDescuentoAdicional").innerText = formato_numero(Total, 2, '.', ','); $get("LblDescuentoAdicional").innerText = formato_numero(Total, 2, '.', ',');
@@ -3694,8 +3704,7 @@
$("#LblSubTotal1").text($("#TxtSubTotal").val()); $("#LblSubTotal1").text($("#TxtSubTotal").val());
} }
function AbrirModalDescuentoAdicional() function AbrirModalDescuentoAdicional() {
{
$('#ModalDescuento').modal(); $('#ModalDescuento').modal();
$get('LblTitulo1').style.display = ''; $get('LblTitulo1').style.display = '';
$get('LblTitulo2').style.display = 'none'; $get('LblTitulo2').style.display = 'none';

View File

@@ -4031,6 +4031,7 @@ Partial Class PV
HdnTipoInv.Value = drPS("Inv_CveMetodoInventario").ToString HdnTipoInv.Value = drPS("Inv_CveMetodoInventario").ToString
HdnAplicaIEPS.Value = drPS("AplicaIEPS").ToString HdnAplicaIEPS.Value = drPS("AplicaIEPS").ToString
HdnPorcentajeIEPS.Value = drPS("IEPSPorcentaje").ToString HdnPorcentajeIEPS.Value = drPS("IEPSPorcentaje").ToString
HdnCveClasificacion.Value = drPS("CveClasificacion").ToString
'Muestra la tabla de tamaños 'Muestra la tabla de tamaños
If drPS("CveTamaño").ToString().ToEntero() > 0 Then If drPS("CveTamaño").ToString().ToEntero() > 0 Then
DivRecepcionUsados.Visible = True DivRecepcionUsados.Visible = True
@@ -4736,6 +4737,7 @@ Partial Class PV
HdnCodigoPS.Value = "-1" HdnCodigoPS.Value = "-1"
HdnTipoPS.Value = "-1" HdnTipoPS.Value = "-1"
HdnTipoInv.Value = "-1" HdnTipoInv.Value = "-1"
HdnCveClasificacion.Value = "-1"
DdlClasificacion.SelectedIndex = 0 DdlClasificacion.SelectedIndex = 0
If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then
@@ -5360,6 +5362,8 @@ Partial Class PV
Exit Sub Exit Sub
End If End If
End If
If DrPS IsNot Nothing Then If DrPS IsNot Nothing Then
'SOLO DEBE AGREGAR POLIZA VIRTUAL SI ES ACUMULADOR 'SOLO DEBE AGREGAR POLIZA VIRTUAL SI ES ACUMULADOR
If DrPS("CveClasificacion").ToString().ToEntero().Contiene(20520, 20522, 20513, 20511, 20521, 20512, 20514, 20229) Then If DrPS("CveClasificacion").ToString().ToEntero().Contiene(20520, 20522, 20513, 20511, 20521, 20512, 20514, 20229) Then
@@ -5368,26 +5372,17 @@ Partial Class PV
Exit Sub Exit Sub
End If End If
If TxtAnioVehiculo.Text.ToDecimal() < 1900 Then If TxtAnioVehiculo.Text.ToDecimal() <= 1900 Then
Alert("El campo año debe ser mayor a 1900.", TipoMensaje.MsgAdvertencia) Alert("El campo año debe ser mayor a 1900.", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
End If
End If If TxtAnioVehiculo.Text.ToDecimal() > Now.Year Then
Else Alert("El campo año no puede ser mayor al año actual.", TipoMensaje.MsgAdvertencia)
If DrPS IsNot Nothing Then
'SOLO DEBE AGREGAR POLIZA VIRTUAL SI ES ACUMULADOR
If DrPS("CveClasificacion").ToString().ToEntero().Contiene(20520, 20522, 20513, 20511, 20521, 20512, 20514, 20229) Then
If Not String.IsNullOrEmpty(TxtAnioVehiculo.Text.Trim()) Then
If TxtAnioVehiculo.Text.ToDecimal() < 1900 Then
Alert("El año del vehiculo del vehículo no tiene el formato correcto.", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
End If End If
End If End If
End If
End If
If AgregarPS() Then If AgregarPS() Then
@@ -5448,9 +5443,14 @@ Partial Class PV
PU = ObjDescuento.PU PU = ObjDescuento.PU
End If End If
Dim RowSP As DataRow = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)
Dim CveProyecto As Integer = -1 '
Dim Proyecto As String = ""
Dim CveProyecto As Integer = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("CveProyecto").ToString.ToEntero If RowSP IsNot Nothing Then
Dim Proyecto As String = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("Proyecto").ToString CveProyecto = RowSP("CveProyecto").ToString.ToEntero
Proyecto = RowSP("Proyecto").ToString
End If
Dim Consec = AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, Dim Consec = AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
CvePS, "", TxtObsPS.Text.Trim, PU, ObjDescuento.ImporteDescuento, CvePS, "", TxtObsPS.Text.Trim, PU, ObjDescuento.ImporteDescuento,