-- considerar fechainicio de vigencia de meses de garantía

This commit is contained in:
2023-03-07 19:11:49 -07:00
parent 513f08f2cf
commit f263726e8b
2 changed files with 48 additions and 33 deletions

View File

@@ -3102,7 +3102,8 @@
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtEtiqueta" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox> <asp:TextBox ID="TxtEtiqueta" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
<label for="<%= TxtEtiqueta.ClientID.ToString()%>">Etiqueta:</label> <ajax:MaskedEditExtender ID="MEEEtiqueta" runat="server" TargetControlID="TxtEtiqueta" Mask="99\/99" MaskType="None" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<label for="<%= TxtEtiqueta.ClientID.ToString()%>">Etiqueta (mm/yy):</label>
</div> </div>
</div> </div>
</div> </div>
@@ -3129,7 +3130,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" 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" /> <asp:CustomValidator ID="CVCodEnsamble" runat="server" ControlToValidate="TxtCodEnsamble" ValidateEmptyText="true" Display="None" ClientValidationFunction="ValidarCodigoEnsamble" 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>

View File

@@ -7118,7 +7118,7 @@ Partial Class PV
Else Else
'TxtPUFactura.Enabled = True 'TxtPUFactura.Enabled = True
'TxtPUFactura.Text = "" 'TxtPUFactura.Text = ""
DdlPSAjuste.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) ' DdlPSAjuste.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
End If End If
DdlPSAjuste.DataBind() DdlPSAjuste.DataBind()
' DdlPSAjuste.Items.Insert(0, New ListItem("Seleccione", "-1")) ' DdlPSAjuste.Items.Insert(0, New ListItem("Seleccione", "-1"))
@@ -7410,6 +7410,10 @@ Partial Class PV
Alert("No se ha especificado producto de ajuste a entregar") Alert("No se ha especificado producto de ajuste a entregar")
Exit Sub Exit Sub
End If End If
If TxtEtiqueta.Text <> "" OrElse TxtEtiqueta.Text.Length <> 4 Then
Alert("No se ha especificado la etiqueta.")
Exit Sub
End If
If Not CalculaMesesUso() Then If Not CalculaMesesUso() Then
Exit Sub Exit Sub
End If End If
@@ -7419,53 +7423,63 @@ Partial Class PV
If DdlTipoUso.SelectedValue.ToEntero > 0 AndAlso DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso TxtMesesUso.Text <> "" AndAlso DdlPS.SelectedValue.ToEntero > 0 Then If DdlTipoUso.SelectedValue.ToEntero > 0 AndAlso DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso TxtMesesUso.Text <> "" AndAlso DdlPS.SelectedValue.ToEntero > 0 Then
Dim CveMarca As Integer = -1 Dim CveMarca As Integer = -1
CveMarca = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).FiltroPrimeroValor("CveMarca", "").ToEntero CveMarca = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlPSAjuste.SelectedValue.ToEntero).FiltroPrimeroValor("CveMarca", "").ToEntero
Dim ImportePagarCliente As Decimal = 0 Dim ImportePagarCliente As Decimal = 0
Dim ObjAcum As New ClsAcumuladores Dim ObjAcum As New ClsAcumuladores
If ObjAcum.GarantiasMesesGet(-1, UsuarioActual.CveEmpresa, CveMarca, DdlTipoUso.SelectedValue.ToEntero, TxtMesesUso.Text.ToEntero) Then If ObjAcum.GarantiasMesesGet(-1, UsuarioActual.CveEmpresa, CveMarca, DdlTipoUso.SelectedValue.ToEntero, TxtMesesUso.Text.ToEntero) Then
If ObjAcum.DtResultados.Rows.Count > 0 Then If ObjAcum.DtResultados.Rows.Count > 0 Then
TxtPorcentajeAjuste.Text = (ObjAcum.DtResultados.Rows(0)("Valor").ToString.ToDouble / 100).ToString ''obtener siempre y cuando la fecha de inicio sea mayor
Dim strDate As Date = ($"01/{TxtEtiqueta.Text.Substring(0, 2)}/{TxtEtiqueta.Text.Substring(2, 2)}").ToDate
Dim drg As DataRow = ObjAcum.DtResultados.FiltroPrimero($" #{strDate.ToString("yyyy/MM/dd")}# > FechaInicioVigencia ", "FechaInicioVigencia")
If drg IsNot Nothing Then
TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDecimal * TxtPUFactura.Text.ToDecimal).FormatoNumero TxtPorcentajeAjuste.Text = (drg("Valor").ToString.ToDouble / 100).ToString
ImportePagarCliente = TxtImporteAjuste.Text.ToDecimal TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDecimal * TxtPUFactura.Text.ToDecimal).FormatoNumero
ImportePagarCliente = TxtImporteAjuste.Text.ToDecimal
Dim CargoVendido As Decimal = 0 Dim CargoVendido As Decimal = 0
Dim CargoGarantia As Decimal = 0 Dim CargoGarantia As Decimal = 0
Dim CveTamaño As Integer = 0 Dim CveTamaño As Integer = 0
If DdlPSAjuste.SelectedValue.ToEntero > 0 Then If DdlPSAjuste.SelectedValue.ToEntero > 0 Then
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).FiltroPrimero("") Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).FiltroPrimero("")
If Dr IsNot Nothing Then If Dr IsNot Nothing Then
CargoGarantia = Dr("Cargo").ToString.ToDecimal CargoGarantia = Dr("Cargo").ToString.ToDecimal
End If
End If End If
End If
If DdlPS.SelectedValue.ToEntero > 0 Then If DdlPS.SelectedValue.ToEntero > 0 Then
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPS.SelectedValue.ToEntero).FiltroPrimero("") Dim Dr As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
If Dr IsNot Nothing Then If Dr IsNot Nothing Then
CveTamaño = Dr("CveTamaño").ToString.ToEntero CveTamaño = Dr("CveTamaño").ToString.ToEntero
End If
End If End If
End If
Dim DrCargo As DataRow = GlobalDTAcumTamaños(UsuarioActual.CveEmpresa).FiltroPrimero($" CveTamaño = {CveTamaño}") Dim DrCargo As DataRow = GlobalDTAcumTamaños(UsuarioActual.CveEmpresa).FiltroPrimero($" CveTamaño = {CveTamaño}")
If DrCargo IsNot Nothing Then If DrCargo IsNot Nothing Then
CargoVendido = DrCargo("Cargo").ToString.ToDecimal CargoVendido = DrCargo("Cargo").ToString.ToDecimal
End If End If
'el ajuste no puede ser mayor al precio de lo vendido de nuevo 'el ajuste no puede ser mayor al precio de lo vendido de nuevo
If (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))) < 0 Then If (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))) < 0 Then
TxtImporteAjuste.Text = "0.00"
CargoGarantia = CargoVendido
ImportePagarCliente = 0
End If
ImportePagarCliente = (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))).ToDecimal
TxtImporteAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoVendido - CargoGarantia).FormatoNumero}."
TxtImporteAjuste.Text = ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia)).FormatoNumero
'TxtPagarCliente.Text = ImportePagarCliente.FormatoNumero
Else
Alert("El producto no tiene ajuste en ese periodo", TipoMensaje.MsgAdvertencia)
'cuando no está registrada, no da ajuste
TxtImporteAjuste.ToolTip = "El producto no tiene ajuste en ese periodo"
TxtImporteAjuste.Text = "0.00" TxtImporteAjuste.Text = "0.00"
CargoGarantia = CargoVendido
ImportePagarCliente = 0
End If End If
ImportePagarCliente = (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))).ToDecimal
TxtImporteAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoVendido - CargoGarantia).FormatoNumero}."
TxtImporteAjuste.Text = ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia)).FormatoNumero
'TxtPagarCliente.Text = ImportePagarCliente.FormatoNumero
Else Else
Alert("El producto no tiene ajuste en ese periodo", TipoMensaje.MsgAdvertencia) Alert("El producto no tiene ajuste en ese periodo", TipoMensaje.MsgAdvertencia)
'cuando no está registrada, no da ajuste 'cuando no está registrada, no da ajuste