This commit is contained in:
2019-11-06 09:22:52 -07:00
27 changed files with 587 additions and 269 deletions

View File

@@ -933,6 +933,14 @@ Partial Class PV
ViewState("DtPUFacturas") = value
End Set
End Property
Private Property DtModelosAuto As DataTable
Get
Return CType(ViewState("DtModelosAuto"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtModelosAuto") = value
End Set
End Property
#End Region
#Region "PROPIEDADES ACUMULADORES"
@@ -1167,7 +1175,7 @@ Partial Class PV
DdlTipoComprobante.Items.Add(New ListItem("Remisión", "Rem"))
DdlTipoComprobante.SelectedValueExist("Rem")
End If
DdlTipoDefecto.Width = New Unit(200%)
DdlTipoDefecto.Width = New Unit(260%)
'Le quitamos el tamaño extra
'RegistraScript("window.onload = function AjustarVentana() { $('.page-content').css('min-height','100%'); }")
@@ -2779,10 +2787,8 @@ Partial Class PV
DivRecepcionUsados.Visible = True
If DdlTipoComprobante.SelectedValue <> "Rem" Then
GvRecepcionUsados.Columns(2).Visible = False
GvRecepcionUsados.Columns(3).Visible = False
Else
GvRecepcionUsados.Columns(2).Visible = True
GvRecepcionUsados.Columns(3).Visible = True
End If
End If
@@ -3479,10 +3485,10 @@ Partial Class PV
End If
Next
If CantidadUsados > TxtCantidad.Text.ToEntero() Then
Alert("No puede tener una cantidad mayor a la de los cargos", TipoMensaje.MsgAdvertencia)
Return False
End If
'If CantidadUsados > TxtCantidad.Text.ToEntero() Then
' Alert("No puede tener una cantidad mayor a la de los cargos", TipoMensaje.MsgAdvertencia)
' Return False
'End If
'VALIDA PROMOCIONES
Dim ObjVentas As New ClsVentas
@@ -4939,6 +4945,7 @@ Partial Class PV
Dim DtTamanios = GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo > 0")
CargaModelos()
GvRecepcionUsados.DataSource = DtTamanios
GvRecepcionUsadosModal.DataSource = DtTamanios
@@ -4958,6 +4965,15 @@ Partial Class PV
DivChkAjuste.Visible = True
End Sub
Private Sub CargaModelos()
Dim ObjGral As New ClsGenerales
If ObjGral.ModelosAutosGet(UsuarioActual.CveEmpresa) Then
DtModelosAuto = ObjGral.DtResultados
DdlModeloAuto.DataSource = DtModelosAuto
End If
DdlModeloAuto.DataBind()
End Sub
Protected Sub GvRecepcionUsados_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvRecepcionUsados.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
@@ -4970,10 +4986,6 @@ Partial Class PV
e.Row.FCDropDownList("DdlBCIUsado").DataBind()
'e.Row.FCDropDownList("DdlBCIUsado").SelectedValue = e.Row.DBCampo("CveBCIUsado")
If ObjGral.ModelosAutosGet(UsuarioActual.CveEmpresa) Then
e.Row.FCDropDownList("DdlModeloAuto").DataSource = ObjGral.DtResultados
End If
e.Row.FCDropDownList("DdlModeloAuto").DataBind()
End If
End Sub
@@ -5006,7 +5018,7 @@ Partial Class PV
LimpiaAjuste()
If TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.FiltraParametros($"ConsecutivoVenta = {ConsecutivoVenta}").Rows.Count > 0 Then
ModalidadAjuste = "U"
TxtPrecio.Attributes.Add("onKeyUp", $"CambiaAjuste(this,{TxtPUFactura.ClientID});")
TxtPrecio.Attributes.Add("onKeyUp", $"CambiaAjuste(this,{TxtPrecio.ClientID});")
ChkAjuste.Checked = True
DivAjuste.Visible = True
CargaAjusteDetalle()
@@ -5022,7 +5034,7 @@ Partial Class PV
TxtCodEnsamble.Text = ""
DdlTipoUso.SelectedIndex = -1
TxtCodLinea.Text = ""
TxtPUFactura.Text = ""
TxtPrecio.Text = ""
TxtFechaAjuste.Text = Now.ToShortDateString
CEEFechaAjuste.EndDate = Now
TxtCodInspeccion.Text = ""
@@ -5031,7 +5043,7 @@ Partial Class PV
TxtPorcentajeAjuste.Text = ""
TxtPoliza.Text = ""
TxtImporteAjuste.Text = ""
DdlPSAjuste.SelectedIndex = 0
DdlPSAjuste.SelectedIndex = -1
ChkAjuste.Checked = False
DivAjuste.Visible = False
End Sub
@@ -5064,8 +5076,8 @@ Partial Class PV
CargaPSAjuste()
DdlPSAjuste.SelectedValueExist(Dr("CvePS").ToString)
TxtFechaAjuste.Text = Dr("FechaAjuste").ToString.ToDate.ToShortDateString
TxtPUFactura.Text = Dr("PUFactura").ToString.ToDecimal.FormatoNumero(2)
TxtPUFactura.Enabled = Not Dr("CveVenta").ToString.ToEntero > 0
TxtPrecio.Text = Dr("PUFactura").ToString.ToDecimal.FormatoNumero(2)
TxtPrecio.Enabled = Not Dr("CveVenta").ToString.ToEntero > 0
End If
End Sub
Protected Sub BtnCalculaMesesUso_Click(sender As Object, e As EventArgs)
@@ -5073,7 +5085,7 @@ Partial Class PV
End Sub
Private Sub CalculaMesesUso()
Dim FechaI = TxtFechaAjuste.Text.ToDate
Dim FechaI = TxtFechaAjuste.Text.ToDate.AddDays(1)
Dim FechaF = Now
'Dim NumDiasAlMes As Double = (365 / 12)
'Dim DiasTranscurridos = DateDiff(DateInterval.Day, FechaI, FechaF)
@@ -5127,7 +5139,7 @@ Partial Class PV
If ObjAcum.GarantiasMesesGet(-1, UsuarioActual.CveEmpresa, CveMarca, DdlTipoUso.SelectedValue.ToEntero, TxtMesesUso.Text.ToEntero) Then
If ObjAcum.DtResultados.Rows.Count > 0 Then
TxtPorcentajeAjuste.Text = (ObjAcum.DtResultados.Rows(0)("Valor").ToString.ToDouble / 100).ToString
TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDouble * TxtPUFactura.Text.ToDouble).FormatoNumero
TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDouble * TxtPrecio.Text.ToDouble).FormatoNumero
Dim CargoActual As Decimal = 0
Dim CargoAnterior As Decimal = 0
@@ -5156,8 +5168,8 @@ Partial Class PV
End If
End If
TxtDescuentoAjuste.Text = ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior)).FormatoNumero
TxtDescuentoAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoActual - CargoAnterior).FormatoNumero}."
TxtDescuentoAjuste.Text = ((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior)).FormatoNumero
TxtDescuentoAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoActual - CargoAnterior).FormatoNumero}."
End If
End If
ObjAcum.Dispose()
@@ -5191,7 +5203,7 @@ Partial Class PV
'End Function
Private Sub GuardaAjuste()
TxtPUFactura.Text = TxtPrecio.Text
TxtPrecio.Text = TxtPrecio.Text
UpAjuste.Update()
Dim CargoAnterior As Double = 0
@@ -5215,7 +5227,7 @@ Partial Class PV
Row("CvePS") = DdlPSAjuste.SelectedValue
Row("PS") = DdlPSAjuste.SelectedItem.Text
Row("CveVenta") = DdlFacturas.SelectedValue
Row("PUFactura") = TxtPUFactura.Text.ToDouble
Row("PUFactura") = TxtPrecio.Text.ToDouble
Row("Cantidad") = 1
Dim CveUM As Integer = -1
If DdlPSAjuste.SelectedValue.ToEntero > 0 Then
@@ -5245,7 +5257,7 @@ Partial Class PV
TmpDTAjustes.Rows(IndexAjuste)("CvePS") = DdlPSAjuste.SelectedValue
TmpDTAjustes.Rows(IndexAjuste)("PS") = DdlPSAjuste.SelectedItem.Text
TmpDTAjustes.Rows(IndexAjuste)("CveVenta") = DdlFacturas.SelectedValue
TmpDTAjustes.Rows(IndexAjuste)("PUFactura") = TxtPUFactura.Text.ToDouble
TmpDTAjustes.Rows(IndexAjuste)("PUFactura") = TxtPrecio.Text.ToDouble
TmpDTAjustes.Rows(IndexAjuste)("Cantidad") = 1
Dim CveUM As Integer = -1
If DdlPSAjuste.SelectedValue.ToEntero > 0 Then
@@ -5272,7 +5284,7 @@ Partial Class PV
End If
End If
Dr("Descuento") = Math.Round((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior), NumeroDecimales)
Dr("Descuento") = Math.Round((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior), NumeroDecimales)
Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * (Dr("PU").ToString.ToDecimal)) - Dr("Descuento").ToString.ToDecimal
Dr("ImporteIVA") = Math.Round(Dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
@@ -5309,8 +5321,8 @@ Partial Class PV
DivAjuste.Attributes.Add("class", "col-md-6")
DivDatosVenta.Attributes.Remove("class")
DivDatosVenta.Attributes.Add("class", "col-md-6")
TxtPrecio.Attributes.Add("onKeyUp", $"CambiaAjuste(this,{TxtPUFactura.ClientID});")
TxtPUFactura.Text = TxtPrecio.Text
TxtPrecio.Attributes.Add("onKeyUp", $"CambiaAjuste(this,{TxtPrecio.ClientID});")
TxtPrecio.Text = TxtPrecio.Text
Else
For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
If Gvr.RowType = DataControlRowType.DataRow Then
@@ -5391,7 +5403,7 @@ Partial Class PV
Row("CveVentaDetalle") = -1
Row("PU") = Gvr.DataKey("Cargo").ToDouble
Row("CveBCIUsado") = Gvr.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero
Row("CveModeloAuto") = Gvr.FCDropDownList("DdlModeloAuto").SelectedValue.ToEntero
Row("CveModeloAuto") = DdlModeloAuto.SelectedValue.ToEntero
TmpDTRecepcionUsados.Rows.Add(Row)
End If
@@ -5404,13 +5416,13 @@ Partial Class PV
Next
StrCargos.Remove(StrCargos.Length - 1, 1)
If TotalCantidad > TmpDT.FiltraParametros($"EsCargo = True AND CvePS IN ({StrCargos})").SUMD("Cantidad") Then
Dim drt As DataRow() = TmpDT.Select("CvePS = " & CvePS)
TmpDT.Rows.Remove(drt(0))
'If TotalCantidad > TmpDT.FiltraParametros($"EsCargo = True AND CvePS IN ({StrCargos})").SUMD("Cantidad") Then
' Dim drt As DataRow() = TmpDT.Select("CvePS = " & CvePS)
' TmpDT.Rows.Remove(drt(0))
Alert("No puede tener una cantidad mayor a la de los cargos", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
' Alert("No puede tener una cantidad mayor a la de los cargos", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = True AND CvePS IN ({StrCargos})").Rows
@@ -5678,14 +5690,16 @@ Partial Class PV
params.Add(New ReportParameter("PorcentajeAjuste", TxtPorcentajeAjuste.Text.Trim))
'Informacion Acumulador
params.Add(New ReportParameter("CodEnsamble", If(TxtCodEnsamble.Text.Length > 7, TxtCodEnsamble.Text.Trim.Substring(0, 7), "")))
params.Add(New ReportParameter("CodLinea", TxtCodLinea.Text.Trim))
params.Add(New ReportParameter("CodInspeccion", TxtCodInspeccion.Text.Trim))
'Informacion Vehiculo
params.Add(New ReportParameter("MarcaAuto", ""))
params.Add(New ReportParameter("TipoAuto", ""))
params.Add(New ReportParameter("MarcaAuto", If(DdlPS.SelectedValue.ToEntero > 0, DtModelosAuto.FiltroPrimeroValor("Marca", $"CveModeloAuto ={DdlModeloAuto.SelectedValue}"), "")))
params.Add(New ReportParameter("TipoAuto", If(DdlPS.SelectedValue.ToEntero > 0, DtModelosAuto.FiltroPrimeroValor("Modelo", $"CveModeloAuto ={DdlModeloAuto.SelectedValue}"), "")))
'Informacion Consumidor
params.Add(New ReportParameter("Direccion", LblDireccion.Text))
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))