Validacion en PV

This commit is contained in:
2020-01-27 13:14:47 -07:00
parent e104209faa
commit def0645042
2 changed files with 55 additions and 23 deletions

View File

@@ -2832,6 +2832,7 @@
<div class="form-group form-md-line-input input-iconright">
<ADS:DropDownLost ID="DdlPSAjuste" CssStyle="width: 100%;" CssClass=" form-control input-sm DdlPS" IncluyeTodos="false" CssClassDdl="select2me form-control" runat="server" CausesValidation="true" DataTextField="PSCodigo" DataValueField="CvePS" Onselectedindexchange="DdlPSAjuste_selectedindexchange" >
</ADS:DropDownLost>
<asp:HiddenField ID="HdnPSAjusteMarca" ClientIDMode="Static" runat="server" Value="-1" />
<label for="<%= DdlPSAjuste.ClientID.ToString()%>">Producto/Servicio a Recibir:</label>
</div>
</div>
@@ -2875,11 +2876,9 @@
</div>
<div class="row">
<div class="col-md-8">
<div 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:RegularExpressionValidator ID="REVCodEnsamble" runat="server" ControlToValidate="TxtCodEnsamble" 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" ValidationExpression="^[0-9][A-HJ-M]([[0-2][0-9]|3[0-1])[0-9A-Z][ACEN][2-5]$"></asp:RegularExpressionValidator>
<%--<asp:RequiredFieldValidator ID="RFVCodEnsamble" runat="server" ControlToValidate="TxtCodEnsamble" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Folio''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%
<%--<ajax:ValidatorCalloutExtender ID="VCECodEnsamble" runat="server" HighlightCssClass="vco" TargetControlID="RFVCodEnsamble"></ajax:ValidatorCalloutExtender>--%>
<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" />
<label for="<%= TxtCodEnsamble.ClientID.ToString()%>">Cod.Ensamble:</label>
</div>
</div>
@@ -2898,9 +2897,7 @@
<div class="col-md-8">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCodLinea" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TxtCodLinea" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Linea''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" ValidationExpression="^[*]$"></asp:RegularExpressionValidator>
<%--<asp:RequiredFieldValidator ID="RFVCodLinea" runat="server" ControlToValidate="TxtCodLinea" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod. Linea''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%>
<%--<ajax:ValidatorCalloutExtender ID="VCECodLinea" runat="server" HighlightCssClass="vco" TargetControlID="RFVCodLinea"></ajax:ValidatorCalloutExtender>--%>
<asp:CustomValidator id="CVCodLinea" runat="server" ControlToValidate="TxtCodEnsamble" ClientValidationFunction="ValidarCodigoLinea" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Linea''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
<label for="<%= TxtCodLinea.ClientID.ToString()%>">Cod.Linea:</label>
</div>
</div>
@@ -2986,7 +2983,7 @@
</div>
</div>
<div class="col-md-4">
<asp:Button ID="BtnCalcularImporteAjuste" CssClass="btn green-haze btn-outline btn-circle btn-sm" OnClick="BtnCalcularImporteAjuste_Click" runat="server" Text="Recalcular" />
<asp:Button ID="BtnCalcularImporteAjuste" CssClass="btn green-haze btn-outline btn-circle btn-sm" OnClick="BtnCalcularImporteAjuste_Click" runat="server" Text="Recalcular" ValidationGroup="GrpAddVenta" />
</div>
</div>
</div>
@@ -3016,6 +3013,26 @@
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script type="text/javascript">
function ValidarCodigoEnsamble(source, arguments) {
var CveMarca = HdnPSAjusteMarca.value;
if (CveMarca == "1086") {
var re = new RegExp("^[0-9]+$");
arguments.IsValid = re.test(parseInt(arguments.Value));
} else {
var re = new RegExp("^[0-9][A-HJ-M]([[0-2][0-9]|3[0-1])[0-9A-Z][ACEN][2-5]$");
arguments.IsValid = re.test(arguments.Value);
}
}
function ValidarCodigoLinea(source, arguments) {
var CveMarca = HdnPSAjusteMarca.value;
if (CveMarca == "1086") {
var re = new RegExp("^[0-9]+$");
arguments.IsValid = re.test(parseInt(arguments.Value));
} else {
var re = new RegExp("^[*]$");
arguments.IsValid = re.test(arguments.Value);
}
}
function CalculaMesesUso() {
$get("BtnCalculaMesesUso").click();

View File

@@ -2330,9 +2330,6 @@ Partial Class PV
If Retorno.CveVenta > 0 Then
Dim SbAlert As New StringBuilder
SbAlert.AppendFormat("{0}<br>", Retorno.Mensajes(Retorno.Mensajes.Count - 1))
DescargarFactura(Retorno.CveVenta, UsuarioActual.CveEmpresa)
SbAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))
@@ -2343,6 +2340,9 @@ Partial Class PV
Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), If(Retorno.TieneError, "", Retorno.LigaPV))
Next
Dim facBytes = DescargarFactura(Retorno.CveVenta, UsuarioActual.CveEmpresa)
ImprimirbytesPDF(facBytes, ObjFactura.SerieFolio)
End If
End If
@@ -2354,7 +2354,7 @@ Partial Class PV
Using httpClient = New HttpClient()
httpClient.Timeout = New TimeSpan(0, 15, 0)
Using request = New HttpRequestMessage(HttpMethod.Get, Url)
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CveUsuario={2}", CveEmpresa, DateTime.UtcNow.Ticks, UsuarioActual.CveUsuario)))
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CveUsuario=100", CveEmpresa, DateTime.UtcNow.Ticks)))
Dim response = httpClient.SendAsync(request).Result
If GetBytes AndAlso response.StatusCode = Net.HttpStatusCode.OK Then
File = response.Content.ReadAsByteArrayAsync().Result
@@ -5244,12 +5244,16 @@ Partial Class PV
DdlTipoUso.DataSource = GlobalDTAcumGarantiasMesesTipoUso(UsuarioActual.CveEmpresa, CveMarca)
DdlTipoUso.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlTipoUso.DataBind()
HdnPSAjusteMarca.Value = CveMarca.ToString()
End If
If Not DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then
TxtPUFactura.Text = ""
End If
CalculaPorcentajeAjuste()
End Sub
@@ -5509,13 +5513,7 @@ Partial Class PV
TmpDTPolizaVirtual.Columns.Add("CveBCIUsado", GetType(Integer))
End Sub
Private Function AddPolizaVirtual(CvePS As Integer) As Boolean
Dim Retorno As Boolean = False
'Dim CvePS As Integer = DdlPS.SelectedValue.ToEntero()
Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal()
Dim PU As Decimal = TxtPrecio.Text.ToDecimal()
Dim Descuento As Decimal = TxtDescuento.Text.ToDecimal()
Dim ImporteAjuste As Decimal = TxtImporteAjuste.Text.ToDecimal().RoundSQL(2)
Dim Retorno As Boolean = True
If Modalidad = "U" Then
If TmpDTRecepcionUsados.Rows.Count > 0 Then
@@ -5532,18 +5530,35 @@ Partial Class PV
End If
End If
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If DrPS IsNot Nothing Then
'SOLO DEBE AGREGAR POLIZA VIRTUAL SI ES ACUMULADOR
If Not DrPS("CveClasificacion").ToString().ToEntero().Contiene(20520, 20522, 20513, 20511, 20521, 20512, 20514, 20229) Then
Return Retorno
End If
Else
Retorno = False
Return Retorno
End If
Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal()
Dim PU As Decimal = TxtPrecio.Text.ToDecimal()
Dim Descuento As Decimal = TxtDescuento.Text.ToDecimal()
Dim ImporteAjuste As Decimal = TxtImporteAjuste.Text.ToDecimal().RoundSQL(2)
Dim Total As Decimal = ((Cantidad * PU) - Descuento).RoundSQL(2)
Dim TipoServicio As Integer = DdlTipoServicio.SelectedValue.ToEntero()
Dim FechaUsado As DateTime = TxtFechaAjuste.Text.ToDateTime()
Dim CveModeloAuto As Integer = DdlModeloAuto.SelectedValue.ToEntero()
Dim AnioVehiculo As Integer = TxtAnioVehiculo.Text.ToEntero()
Dim TipoPoliza As Integer = 1
Dim TipoPoliza As Integer = 1 'VENTA
If ChkAjuste.Checked Then
If Total = ImporteAjuste Then
TipoPoliza = 3
TipoPoliza = 3 'GARANTIA
Else
TipoPoliza = 2
TipoPoliza = 2 'AJUSTE
End If
End If
@@ -5555,7 +5570,7 @@ Partial Class PV
For Each GvRow As GridViewRow In GvRecepcionUsados.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0 Then
CvePS = GvRow.DataKey("CvePSCargo").ToEntero()
CvePSUsado = GvRow.DataKey("CvePSCargo").ToEntero()
CveBCIUsado = GvRow.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero()
Exit For