CACULO CORRECTO DE CODIGOS DE INSPECCION,LINEA,ENSAMBLE
This commit is contained in:
@@ -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