Cambios BDH, ajuste y garantia

This commit is contained in:
2021-02-24 12:26:32 -07:00
parent db74d1d48a
commit dbe3b28c4c
22 changed files with 3474 additions and 2749 deletions

View File

@@ -1144,6 +1144,11 @@ Partial Class PV
CargaVenta()
End If
If CveVenta > 0 Then
CargaTmpDTAjustes()
End If
'CARGA PARA FACTURAR
ViewState("CveRemision") = IfNull(Request("CveRemision").ToEntero, 0)
ViewState("CveCotizacion") = IfNull(Request("CveCotizacion").ToEntero, 0)
@@ -1807,6 +1812,28 @@ Partial Class PV
OcurrioError = True
Exit For
End If
If TmpDTRecepcionUsados IsNot Nothing Then
If TmpDTRecepcionUsados.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then
Dim rowInv As DataRow = TmpDTRecepcionUsados.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0)
rowInv("CveVentaDetalle") = CveVentaDetalle
End If
End If
If TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0 Then
If TmpDTAjustes.Select($"ConsecutivoVenta={Row("Consec").ToString.ToEntero}").Length > 0 Then
Dim DrAju As DataRow = TmpDTAjustes.Select($"ConsecutivoVenta={Row("Consec").ToString.ToEntero}")(0)
DrAju("CveVentaDetalle") = CveVentaDetalle
End If
End If
If TmpDTPolizaVirtual IsNot Nothing Then
If TmpDTPolizaVirtual.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then
Dim RowPoliza As DataRow = TmpDTPolizaVirtual.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0)
RowPoliza("CveVentaDetalle") = CveVentaDetalle
End If
End If
Else
If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("CveUM").ToString.ToEntero,
Row("PU").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("ImporteIVA").ToString.ToDouble, Math.Round((Row("Total").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)) * (1 + Row("PorcentajeIVA").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)))), 6),
@@ -1901,9 +1928,11 @@ Partial Class PV
If Not OcurrioError AndAlso TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0 Then
For Each Dr As DataRow In TmpDTAjustes.Rows
If Not ObjAcum.AddGarantiasDetalle(Dr("CveVentaDetalle").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("CveFolioGarantia").ToString.ToEntero, Dr("CveTipoUso").ToString.ToEntero,
Dr("CodigoEnsamble").ToString, Dr("CodigoLinea").ToString, Dr("CodigoInspeccion").ToString, Dr("CveTipoDefecto").ToString.ToEntero,
Dr("NumPoliza").ToString, Dr("Importe").ToString.ToDouble, Dr("Consecutivo").ToString, Dr("FechaAjuste").ToString.ToDateTime(), Dr("PorcentajeAjuste").ToString.ToDecimal()) Then
ErrorList.Add("Ocurrió un error al agregar la garantia detalle.")
Dr("CodigoEnsamble").ToString, Dr("CodigoLinea").ToString, Dr("CodigoInspeccion").ToString, Dr("CveTipoDefecto").ToString.ToEntero, Dr("CodigoTD").ToString, Dr("TipoComprobante").ToString.ToEntero,
Dr("Comprobante").ToString, Dr("Importe").ToString.ToDouble, Dr("Consecutivo").ToString, Dr("FechaAjuste").ToString.ToDateTime(), Dr("PorcentajeAjuste").ToString.ToDecimal(),
Dr("CveBCIAjuste").ToString.ToEntero(), Dr("Etiqueta").ToString, Dr("CveClienteDistribuidor").ToString.ToEntero(), Dr("CveModeloAuto").ToString.ToEntero(), Dr("Año").ToString) Then
OcurrioError = True
Exit For
End If
Next
End If
@@ -2451,9 +2480,9 @@ Partial Class PV
End If
If CveVenta <= 0 Then
CveMetodoPagoCliente = ObjCliente.DtResultados.Rows(0)("CveMetodoPago").ToString.ToEntero
CveMetodoPagoCliente = ObjCliente.DtResultados.Rows(0)("CveMetodoPago33").ToString.ToEntero
DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI.ToString)
DdlMetodoPago.SelectedValueExist(ObjCliente.CveMetodoPago.ToString)
'DdlMetodoPago.SelectedValueExist(ObjCliente.CveMetodoPago.ToString)
DdlMetodoPago33.SelectedValueExist(ObjCliente.CveMetodoPago33.ToString)
'DdlMetodoPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveMetodoPago33").ToString)
DdlMetodoPago33_SelectedIndexChanged(DdlMetodoPago33, EventArgs.Empty)
@@ -2652,7 +2681,7 @@ Partial Class PV
PlazoCobranza = ObjCliente.PlazoCobranza
If CveVenta <= 0 Then
CveMetodoPagoCliente = ObjCliente.CveMetodoPago
'CveMetodoPagoCliente = ObjCliente.CveMetodoPago
DdlMetodoPago.SelectedValueExist(CveMetodoPagoCliente.ToString)
DdlFormaPago33.SelectedValueExist(ObjCliente.CveFormaPago33)
@@ -3156,10 +3185,19 @@ Partial Class PV
If TmpDT.Rows.Count > 0 Then
Dim Retorno = ObjFactura.EmitirFactura()
If Retorno.CveVenta > 0 Then
Dim SbAlert As New StringBuilder
SbAlert.AppendFormat("{0}<br>", Retorno.Mensajes(Retorno.Mensajes.Count - 1))
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)))
SbAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF Factura</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta)))
Using ObjAcum As New ClsAcumuladores
If ObjAcum.GetGarantiasDetalle(Retorno.CveVenta) Then
Dim RowGarantia As DataRow = ObjAcum.DtResultados.FiltroPrimero("")
If RowGarantia IsNot Nothing Then
SbAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF Ajuste</a></li></ul><br/>", Encripta(String.Format("OP=AJUSTE&CVEGARANTIADETALLE={0}", RowGarantia("CveGarantiaDetalle"))))
End If
End If
End Using
Retorno.Mensajes(Retorno.Mensajes.Count - 1) = SbAlert.ToString()
End If
@@ -3432,7 +3470,7 @@ Partial Class PV
'SI LA SUCURSAL NO TIENE ENTREGA POR ADELANTADO
If ObjFactura.CveAlmacenTraspasoDestino <= 0 And ObjFactura.TipoDocto = "Rem" Then
ErrorList.Add("Ocurrió un error al seleccionar el almacen de entrega por adelantado de la sucursal.")
ObjFactura.ErrorList.Add("Ocurrió un error al seleccionar el almacen de entrega por adelantado de la sucursal.")
End If
End If
@@ -4687,10 +4725,10 @@ Partial Class PV
LblTotalPS.Text = GvRow.DataKey("Total")
ChkAgregar.Checked = False
divagregrarotrops.Visible = False
If CveVenta <= 0 Then
Ajuste()
End If
Ajuste()
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
UpVenta.Update()
RegistraScript("$('#DivAddVenta').modal({backdrop: 'static', keyboard: false});", "EdicionVenta")
End Sub
@@ -5967,6 +6005,7 @@ Partial Class PV
TmpDTAjustes.Columns.Add("CveFolioGarantia", GetType(Integer))
TmpDTAjustes.Columns.Add("CveTipoUso", GetType(Integer))
TmpDTAjustes.Columns.Add("CveTipoDefecto", GetType(Integer))
TmpDTAjustes.Columns.Add("CodigoTD", GetType(String))
TmpDTAjustes.Columns.Add("CodigoEnsamble", GetType(String))
TmpDTAjustes.Columns.Add("CodigoLinea", GetType(String))
TmpDTAjustes.Columns.Add("CodigoInspeccion", GetType(String))
@@ -5975,7 +6014,8 @@ Partial Class PV
TmpDTAjustes.Columns.Add("FechaAjuste", GetType(Date))
TmpDTAjustes.Columns.Add("Meses", GetType(String))
TmpDTAjustes.Columns.Add("PorcentajeAjuste", GetType(Double))
TmpDTAjustes.Columns.Add("NumPoliza", GetType(String))
TmpDTAjustes.Columns.Add("TipoComprobante", GetType(Integer))
TmpDTAjustes.Columns.Add("Comprobante", GetType(String))
TmpDTAjustes.Columns.Add("Importe", GetType(Double))
TmpDTAjustes.Columns.Add("CvePS", GetType(Integer))
TmpDTAjustes.Columns.Add("PS", GetType(String))
@@ -5984,6 +6024,93 @@ Partial Class PV
TmpDTAjustes.Columns.Add("CveVentaDetalle", GetType(Integer))
TmpDTAjustes.Columns.Add("CveVenta", GetType(Integer))
TmpDTAjustes.Columns.Add("PUFactura", GetType(Double))
TmpDTAjustes.Columns.Add("CveBCIAjuste", GetType(Integer))
TmpDTAjustes.Columns.Add("Etiqueta", GetType(String))
TmpDTAjustes.Columns.Add("CveClienteDistribuidor", GetType(Integer))
TmpDTAjustes.Columns.Add("Distribuidor", GetType(String))
TmpDTAjustes.Columns.Add("CveModeloAuto", GetType(Integer))
TmpDTAjustes.Columns.Add("Año", GetType(String))
End Sub
Private Sub CargaTmpDTAjustes()
Dim DtGarantias As DataTable = Nothing
Using ObjAcum As New ClsAcumuladores
If ObjAcum.GetGarantiasDetalle(CveVenta) Then
Dim RowGarantia As DataRow = ObjAcum.DtResultados.FiltroPrimero("")
If RowGarantia IsNot Nothing Then
If ObjAcum.GetFoliosGarantiasDetalle(-1, CveGarantiaDetalle:=RowGarantia("CveGarantiaDetalle").ToString().ToEntero()) Then
DtGarantias = ObjAcum.DtResultados.Copy()
End If
End If
End If
End Using
If DtGarantias IsNot Nothing Then
For Each Row As DataRow In DtGarantias.Rows
Dim RowAjuste As DataRow = TmpDTAjustes.NewRow
RowAjuste("CveFolioGarantia") = Row("CveFolioGarantia")
RowAjuste("CveTipoUso") = Row("CveTipoUso")
RowAjuste("CveTipoDefecto") = Row("CveTipoDefecto")
RowAjuste("CodigoTD") = Row("CodigoTipoDefecto")
RowAjuste("CodigoEnsamble") = Row("CodigoEnsamble")
RowAjuste("CodigoLinea") = Row("CodigoLinea")
RowAjuste("CodigoInspeccion") = Row("CodigoInspeccion")
RowAjuste("Consecutivo") = Row("Consecutivo")
RowAjuste("FechaAjuste") = Row("FechaAjuste")
Dim FechaAjuste As DateTime = Row("FechaVenta").ToString.ToDateTime()
Dim FechaReclamacion As DateTime = Row("FechaReclamacion").ToString.ToDateTime()
Dim FechaI As Date = FechaAjuste.AddDays(1)
Dim FechaF As Date = FechaReclamacion
Dim Dia As Integer = FechaI.Day
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
If FechaT > FechaF Then
'todavía está en el mes actual.
MesesTrascurridos = MesesTrascurridos
Else
MesesTrascurridos = MesesTrascurridos + 1
End If
RowAjuste("Meses") = MesesTrascurridos.ToString
Catch ex As Exception
OnError("Ocurrió un error al calcular los meses de uso", ex)
End Try
RowAjuste("PorcentajeAjuste") = Row("PorcentajeAjuste")
RowAjuste("TipoComprobante") = Row("TipoComprobante")
RowAjuste("Comprobante") = Row("Comprobante")
RowAjuste("Importe") = Row("Importe")
If TmpDT IsNot Nothing Then
RowAjuste("ConsecutivoVenta") = TmpDT.FiltroPrimeroValor("Consec", $"CveVentaDetalle={Row("CveVentaDetalle")}")
End If
RowAjuste("CvePS") = Row("CvePS")
RowAjuste("PS") = Row("PS")
RowAjuste("CveVenta") = Row("CveRemision")
RowAjuste("PUFactura") = Row("Importe")
RowAjuste("Cantidad") = 1
RowAjuste("CveBCIAjuste") = Row("CveBCIAjuste")
RowAjuste("Etiqueta") = Row("Etiqueta")
RowAjuste("CveClienteDistribuidor") = Row("CveClienteDistribuidor")
RowAjuste("Distribuidor") = Row("Distribuidor")
RowAjuste("CveModeloAuto") = Row("CveModeloAuto")
RowAjuste("Año") = Row("Año")
TmpDTAjustes.Rows.Add(RowAjuste)
Next
End If
End Sub
@@ -6047,6 +6174,7 @@ Partial Class PV
CreaDTmpDTPolizaVirtual()
DdlDistribuidor.setEsWebService(True)
DivChkAjuste.Visible = True
End Sub
Private Sub CargaModelos()
@@ -6087,7 +6215,9 @@ Partial Class PV
' DdlPSAjuste.Items.Insert(0, New ListItem("Seleccione", "-1"))
DtPUFacturas.AcceptChanges()
UpAjuste.Update()
CalculaPorcentajeAjuste()
If CveVenta < 0 Then
CalculaPorcentajeAjuste()
End If
End Sub
Private Sub Ajuste()
@@ -6097,11 +6227,16 @@ Partial Class PV
TxtPrecio.Attributes.Add("onKeyUp", $"CambiaAjuste(this,{TxtPrecio.ClientID});")
ChkAjuste.Checked = True
DivAjuste.Visible = True
ChkAjuste_CheckedChanged(ChkAjuste, EventArgs.Empty)
CargaAjusteDetalle()
Else
ModalidadAjuste = "A"
TxtPrecio.Attributes.Add("onKeyUp ", "Recalcula();")
End If
UpAjuste.Update()
End Sub
Private Sub LimpiaAjuste()
@@ -6117,11 +6252,15 @@ Partial Class PV
TxtMesesUso.Text = ""
DdlTipoDefecto.SelectedIndex = -1
TxtPorcentajeAjuste.Text = ""
TxtPoliza.Text = ""
TxtComprobante.Text = ""
TxtImporteAjuste.Text = ""
DdlPSAjuste.SelectedValue = "-1"
ChkAjuste.Checked = False
DivAjuste.Visible = False
DdlBCIAjuste.SelectedValueExist(-1)
TxtEtiqueta.Text = ""
DdlModeloAuto.SelectedValueExist(-1)
TxtAnioVehiculo.Text = ""
End Sub
@@ -6137,6 +6276,18 @@ Partial Class PV
Next
If Dr IsNot Nothing Then
IndexAjuste = TmpDTAjustes.Rows.IndexOf(Dr)
CargaPSAjuste()
DdlPSAjuste.SelectedValue = Dr("CvePS").ToString()
DdlPSAjuste.SelectedText = Dr("PS").ToString()
DdlPSAjuste_selectedindexchange(DdlPSAjuste, EventArgs.Empty)
If Dr("CveClienteDistribuidor").ToString().ToEntero() > 0 Then
DdlDistribuidor.SelectedValue = Dr("CveClienteDistribuidor").ToString()
DdlDistribuidor.SelectedText = Dr("Distribuidor").ToString()
End If
DdlFolioGarantia.SelectedValueExist(Dr("CveFolioGarantia").ToString)
TxtConsecutivoAjuste.Text = Dr("Consecutivo").ToString
TxtCodEnsamble.Text = Dr("CodigoEnsamble").ToString
@@ -6145,15 +6296,32 @@ Partial Class PV
TxtCodInspeccion.Text = Dr("CodigoInspeccion").ToString
TxtMesesUso.Text = Dr("Meses").ToString
DdlTipoDefecto.SelectedValueExist(Dr("CveTipoDefecto").ToString)
TxtCodigoTD.Text = Dr("CodigoTD").ToString
TxtPorcentajeAjuste.Text = Dr("PorcentajeAjuste").ToString
TxtPoliza.Text = Dr("NumPoliza").ToString
DdlTipoComprobanteAjuste.SelectedValueExist(Dr("TipoComprobante").ToString())
TxtComprobante.Text = Dr("Comprobante").ToString
TxtImporteAjuste.Text = Dr("Importe").ToString
DdlFacturas.SelectedValueExist(Dr("CveVenta").ToString)
CargaPSAjuste()
DdlPSAjuste.SelectedValue = (Dr("CvePS").ToString)
If TxtDescuento.Text.ToDecimal() > 0 AndAlso Dr("Importe").ToString.ToDecimal() > 0 Then
Dim DescuentoSinAjuste As Decimal = TxtDescuento.Text.ToDecimal - Dr("Importe").ToString.ToDecimal
If DescuentoSinAjuste <= 0 Then
TxtDescuento.Text = "0"
Else
TxtDescuento.Text = DescuentoSinAjuste.FormatoNumero(2)
End If
End If
TxtFechaAjuste.Text = Dr("FechaAjuste").ToString.ToDate.ToShortDateString
TxtPrecio.Text = Dr("PUFactura").ToString.ToDecimal.FormatoNumero(2)
TxtPrecio.Enabled = Not Dr("CveVenta").ToString.ToEntero > 0
'TxtPrecio.Enabled = Dr("CveVenta").ToString.ToEntero > 0
DdlBCIAjuste.SelectedValueExist(Dr("CveBCIAjuste").ToString())
TxtEtiqueta.Text = Dr("Etiqueta").ToString
DdlModeloAuto.SelectedValueExist(Dr("CveModeloAuto").ToString())
TxtAnioVehiculo.Text = Dr("Año").ToString
End If
End Sub
'Protected Sub BtnCalculaMesesUso_Click(sender As Object, e As EventArgs)
@@ -6188,7 +6356,7 @@ Partial Class PV
TxtMesesUso.Text = MesesTrascurridos.ToString
Catch ex As Exception
OnError("Ocurrió un error al calcular los meses de uso", ex)
OnError("Ocurrió un Error al calcular los meses de uso", ex)
End Try
Return True
@@ -6342,7 +6510,7 @@ Partial Class PV
End If
End If
Dim DrCargo As DataRow = GlobalDTAcumTamaños.FiltroPrimero($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveTamaño = {CveTamaño}")
Dim DrCargo As DataRow = GlobalDTAcumTamaños.FiltroPrimero($"CveEmpresa = {UsuarioActual.CveEmpresa} And CveTamaño = {CveTamaño}")
If DrCargo IsNot Nothing Then
CargoVendido = DrCargo("Cargo").ToString.ToDecimal
@@ -6395,6 +6563,7 @@ Partial Class PV
Row("CveFolioGarantia") = DdlFolioGarantia.SelectedValue.ToEntero
Row("CveTipoUso") = DdlTipoUso.SelectedValue.ToEntero
Row("CveTipoDefecto") = DdlTipoDefecto.SelectedValue.ToEntero
Row("CodigoTD") = TxtCodigoTD.Text
Row("CodigoEnsamble") = TxtCodEnsamble.Text
Row("CodigoLinea") = TxtCodLinea.Text
Row("CodigoInspeccion") = TxtCodInspeccion.Text
@@ -6402,7 +6571,8 @@ Partial Class PV
Row("FechaAjuste") = TxtFechaAjuste.Text.ToDate
Row("Meses") = TxtMesesUso.Text.ToEntero
Row("PorcentajeAjuste") = TxtPorcentajeAjuste.Text.ToDouble
Row("NumPoliza") = TxtPoliza.Text
Row("TipoComprobante") = DdlTipoComprobanteAjuste.SelectedValue.ToEntero()
Row("Comprobante") = TxtComprobante.Text
Row("Importe") = TxtImporteAjuste.Text.ToDouble
Row("ConsecutivoVenta") = ConsecutivoVenta
Row("CvePS") = DdlPSAjuste.SelectedValue
@@ -6420,11 +6590,17 @@ Partial Class PV
End If
Row("CveUM") = CveUM
Row("CveVentaDetalle") = -1
Row("CveBCIAjuste") = DdlBCIAjuste.SelectedValue.ToEntero()
Row("Etiqueta") = TxtEtiqueta.Text.TrimStart.TrimEnd
Row("CveClienteDistribuidor") = DdlDistribuidor.SelectedValue.ToEntero()
Row("CveModeloAuto") = DdlModeloAuto.SelectedValue.ToEntero()
Row("Año") = TxtAnioVehiculo.Text.TrimStart.TrimEnd
TmpDTAjustes.Rows.Add(Row)
ElseIf ModalidadAjuste = "U" Then
TmpDTAjustes.Rows(IndexAjuste)("CveFolioGarantia") = DdlFolioGarantia.SelectedValue.ToEntero
TmpDTAjustes.Rows(IndexAjuste)("CveTipoUso") = DdlTipoUso.SelectedValue.ToEntero
TmpDTAjustes.Rows(IndexAjuste)("CveTipoDefecto") = DdlTipoDefecto.SelectedValue.ToEntero
TmpDTAjustes.Rows(IndexAjuste)("CodigoTD") = TxtCodigoTD.Text
TmpDTAjustes.Rows(IndexAjuste)("CodigoEnsamble") = TxtCodEnsamble.Text
TmpDTAjustes.Rows(IndexAjuste)("CodigoLinea") = TxtCodLinea.Text
TmpDTAjustes.Rows(IndexAjuste)("CodigoInspeccion") = TxtCodInspeccion.Text
@@ -6432,7 +6608,8 @@ Partial Class PV
TmpDTAjustes.Rows(IndexAjuste)("FechaAjuste") = TxtFechaAjuste.Text.ToDate
TmpDTAjustes.Rows(IndexAjuste)("Meses") = TxtMesesUso.Text.ToDouble
TmpDTAjustes.Rows(IndexAjuste)("PorcentajeAjuste") = TxtPorcentajeAjuste.Text.ToDecimal
TmpDTAjustes.Rows(IndexAjuste)("NumPoliza") = TxtPoliza.Text.ToDouble
TmpDTAjustes.Rows(IndexAjuste)("TipoComprobante") = DdlTipoComprobanteAjuste.SelectedValue.ToEntero()
TmpDTAjustes.Rows(IndexAjuste)("Comprobante") = TxtComprobante.Text.ToDouble
TmpDTAjustes.Rows(IndexAjuste)("Importe") = TxtImporteAjuste.Text.ToDouble
TmpDTAjustes.Rows(IndexAjuste)("ConsecutivoVenta") = ConsecutivoVenta
TmpDTAjustes.Rows(IndexAjuste)("CvePS") = DdlPSAjuste.SelectedValue
@@ -6440,6 +6617,11 @@ Partial Class PV
TmpDTAjustes.Rows(IndexAjuste)("CveVenta") = DdlFacturas.SelectedValue
TmpDTAjustes.Rows(IndexAjuste)("PUFactura") = TxtPrecio.Text.ToDouble
TmpDTAjustes.Rows(IndexAjuste)("Cantidad") = 1
TmpDTAjustes.Rows(IndexAjuste)("CveBCIAjuste") = DdlBCIAjuste.SelectedValue.ToEntero()
TmpDTAjustes.Rows(IndexAjuste)("Etiqueta") = TxtEtiqueta.Text.TrimStart.TrimEnd
TmpDTAjustes.Rows(IndexAjuste)("CveClienteDistribuidor") = DdlDistribuidor.SelectedValue.ToEntero()
TmpDTAjustes.Rows(IndexAjuste)("CveModeloAuto") = DdlModeloAuto.SelectedValue.ToEntero()
TmpDTAjustes.Rows(IndexAjuste)("Año") = TxtAnioVehiculo.Text.TrimStart.TrimEnd
Dim CveUM As Integer = -1
If DdlPSAjuste.SelectedValue.ToEntero > 0 Then
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).Rows(0)
@@ -7028,11 +7210,19 @@ Partial Class PV
If (DdlDistribuidor.SelectedValue.ToEntero > 0) Then
Dim DatosClienteSeleccionado As DataRow = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCliente = {0}", DdlDistribuidor.SelectedValue.ToEntero))
Dim Ciudad As String = DatosClienteSeleccionado.Item("Ciudad").ToString
Dim Estado As String = DatosClienteSeleccionado.Item("Estado").ToString
params.Add(New ReportParameter("NombreDistribuidor", DdlDistribuidor.SelectedText))
params.Add(New ReportParameter("CiudadEstado", String.Format("{0}, {1}", Ciudad.Trim, Estado)))
params.Add(New ReportParameter("TelCliente", DatosClienteSeleccionado.Item("Telefono").ToString))
Dim CiudadEstado As String = ""
Dim Telefono As String = ""
Dim Nombre As String = ""
If DatosClienteSeleccionado IsNot Nothing Then
CiudadEstado = String.Format("{0}, {1}", DatosClienteSeleccionado("Ciudad"), DatosClienteSeleccionado("Estado"))
Telefono = DatosClienteSeleccionado("Telefono").ToString
Nombre = DatosClienteSeleccionado("Nombre").ToString
End If
params.Add(New ReportParameter("NombreDistribuidor", Nombre))
params.Add(New ReportParameter("CiudadEstado", CiudadEstado))
params.Add(New ReportParameter("TelCliente", Telefono))
End If
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
@@ -7052,14 +7242,26 @@ Partial Class PV
params.Add(New ReportParameter("CodInspeccion", TxtCodInspeccion.Text.Trim))
params.Add(New ReportParameter("Tipo", DdlBCIAjuste.SelectedItem.Text))
params.Add(New ReportParameter("Marca", MarcaPS))
params.Add(New ReportParameter("Etiqueta", TxtEtiqueta.Text))
'Informacion Vehiculo
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("NombreCliente", LtlCliente.Text))
params.Add(New ReportParameter("Direccion", LblDireccion.Text))
'Informacion Distribuidor
If (CveCliente > 0) Then
Dim DatosClienteSeleccionado As DataRow = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCliente = {0}", DdlDistribuidor.SelectedValue.ToEntero))
Dim Ciudad As String = DatosClienteSeleccionado.Item("Ciudad").ToString
Dim Estado As String = DatosClienteSeleccionado.Item("Estado").ToString
params.Add(New ReportParameter("NombreCliente", LtlCliente.Text))
params.Add(New ReportParameter("Direccion", LblDireccion.Text))
params.Add(New ReportParameter("CiudadEstadoConsumidor", String.Format("{0}, {1}", Ciudad.Trim, Estado)))
params.Add(New ReportParameter("TelConsumidor", DatosClienteSeleccionado.Item("Telefono").ToString))
End If
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
@@ -7067,6 +7269,10 @@ Partial Class PV
params.Add(New ReportParameter("LogoPath", ""))
End If
params.Add(New ReportParameter("Anio", TxtAnioVehiculo.Text))
params.Add(New ReportParameter("Comprobante", TxtComprobante.Text))
ImprimirPDF("Empresas/Grales/Formatos/Ajuste.rdlc", DtDatos, params, "Reporte de Ajuste", "PDF")
End Sub