Cambios BDH, ajuste y garantia
This commit is contained in:
@@ -485,6 +485,13 @@ Partial Class PopUpVerFactura
|
||||
If UrlParametros("CVEASIGNACIONENTREGA") IsNot Nothing And UrlParametros("USUARIOENTREGA") IsNot Nothing Then
|
||||
ImprimeEntregasPorRealizar(UrlParametros("CVEASIGNACIONENTREGA").ToString.ToLong, UrlParametros("USUARIOENTREGA").ToString)
|
||||
End If
|
||||
End If
|
||||
|
||||
'PDF AJUSTE
|
||||
If UrlParametros("OP").ToString = "AJUSTE" Then
|
||||
If UrlParametros("CVEGARANTIADETALLE") IsNot Nothing Then
|
||||
ImprimirPDFAjuste(UrlParametros("CVEGARANTIADETALLE").ToString.ToEntero)
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
@@ -1296,7 +1303,7 @@ Partial Class PopUpVerFactura
|
||||
Dim ResponsableRecibio As String = ObjInventarios.ResponsableRecibio
|
||||
Dim UsuarioCapturo As String = ObjInventarios.DtResultados.FiltroPrimeroValor("UsuarioCapturo")
|
||||
|
||||
If Recibio.Trim = "" Then
|
||||
If String.IsNullOrEmpty(Recibio) Then
|
||||
Dim ObjRH As New ClsRH
|
||||
If ObjRH.GetPersonal(ObjInventarios.CvePersonal, UsuarioActual.CveEmpresa) AndAlso ObjRH.DtResultados.Rows.Count > 0 Then
|
||||
Recibio = ObjRH.DtResultados.Rows(0)("NombreCompleto").ToString
|
||||
@@ -4445,4 +4452,153 @@ Partial Class PopUpVerFactura
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region "OP = AJUSTE"
|
||||
Private Sub ImprimirPDFAjuste(CveGarantiaDetalle As Integer)
|
||||
' Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
Dim RowAjuste As DataRow = Nothing
|
||||
|
||||
Using ObjAcum As New ClsAcumuladores
|
||||
If ObjAcum.GetFoliosGarantiasDetalle(-1, CveGarantiaDetalle) Then
|
||||
If ObjAcum.DtResultados.Rows.Count > 0 Then
|
||||
RowAjuste = ObjAcum.DtResultados.Rows(0)
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
|
||||
Dim CvePSAjuste As Integer = RowAjuste("CvePS").ToString.ToEntero()
|
||||
Dim CveCliente As Integer = RowAjuste("CveCliente").ToString.ToEntero()
|
||||
Dim CveClienteDistribuidor As Integer = RowAjuste("CveClienteDistribuidor").ToString.ToEntero()
|
||||
Dim Consec As String = RowAjuste("Consecutivo").ToString
|
||||
Dim FolioGarantia As String = RowAjuste("FolioGarantia").ToString
|
||||
Dim FechaAjuste As DateTime = RowAjuste("FechaVenta").ToString.ToDateTime()
|
||||
Dim FechaReclamacion As DateTime = RowAjuste("FechaReclamacion").ToString.ToDateTime()
|
||||
Dim TipoDefecto As String = RowAjuste("TipoDefecto").ToString
|
||||
Dim CveTipoUso As Integer = RowAjuste("CveTipoUso").ToString.ToEntero()
|
||||
Dim CodigoEnsamble As String = RowAjuste("CodigoEnsamble").ToString
|
||||
Dim CodigoLinea As String = RowAjuste("CodigoLinea").ToString
|
||||
Dim CodigoInspeccion As String = RowAjuste("CodigoInspeccion").ToString
|
||||
|
||||
Dim MesesUso As String = "0"
|
||||
Dim PorcentajeAjuste As String = RowAjuste("PorcentajeAjuste").ToString
|
||||
Dim BCIAjuste As String = RowAjuste("BCIAjuste").ToString
|
||||
Dim Etiqueta As String = RowAjuste("Etiqueta").ToString
|
||||
|
||||
Dim Año As String = RowAjuste("Año").ToString
|
||||
Dim Comprobante As String = RowAjuste("Comprobante").ToString
|
||||
|
||||
Dim ModeloAuto As String = RowAjuste("ModeloAuto").ToString
|
||||
Dim MarcaAuto As String = RowAjuste("MarcaAuto").ToString
|
||||
|
||||
Dim MarcaPS As String = ""
|
||||
Dim CveMarca As Integer = -1
|
||||
|
||||
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
|
||||
|
||||
MesesUso = MesesTrascurridos.ToString
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al calcular los meses de uso", ex)
|
||||
End Try
|
||||
|
||||
|
||||
Dim ObjPS As New ClsProductosServicios
|
||||
If ObjPS.GetPS(CvePSAjuste, -1, UsuarioActual.CveEmpresa) Then
|
||||
MarcaPS = ObjPS.DtResultados.FiltroPrimeroValor("Marca", String.Format("CvePS = {0}", CvePSAjuste))
|
||||
End If
|
||||
ObjPS.Dispose()
|
||||
|
||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
||||
Dim DtDatos As New DataTable
|
||||
|
||||
Dim params As New List(Of ReportParameter)
|
||||
|
||||
|
||||
'Informacion Distribuidor
|
||||
If (CveClienteDistribuidor > 0) Then
|
||||
|
||||
Dim DatosClienteSeleccionado As DataRow = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCliente = {0}", CveClienteDistribuidor))
|
||||
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))
|
||||
params.Add(New ReportParameter("Consec", Consec))
|
||||
params.Add(New ReportParameter("FolioAcuse", FolioGarantia))
|
||||
|
||||
'Informacion de Garantia o ajuste
|
||||
params.Add(New ReportParameter("FechaInst", FechaAjuste.ToString("dd/MM/yyyy")))
|
||||
params.Add(New ReportParameter("Fecha", FechaReclamacion.ToString("dd/MM/yyyy")))
|
||||
params.Add(New ReportParameter("Defecto", TipoDefecto))
|
||||
params.Add(New ReportParameter("MesesUso", MesesUso))
|
||||
params.Add(New ReportParameter("PorcentajeAjuste", PorcentajeAjuste))
|
||||
|
||||
'Informacion Acumulador
|
||||
params.Add(New ReportParameter("CodEnsamble", CodigoEnsamble))
|
||||
params.Add(New ReportParameter("CodLinea", CodigoLinea))
|
||||
params.Add(New ReportParameter("CodInspeccion", CodigoInspeccion))
|
||||
params.Add(New ReportParameter("Tipo", BCIAjuste))
|
||||
params.Add(New ReportParameter("Marca", MarcaPS))
|
||||
params.Add(New ReportParameter("Etiqueta", Etiqueta))
|
||||
|
||||
'Informacion Vehiculo
|
||||
params.Add(New ReportParameter("MarcaAuto", MarcaAuto))
|
||||
params.Add(New ReportParameter("TipoAuto", ModeloAuto))
|
||||
|
||||
'Informacion Consumidor
|
||||
'Informacion Distribuidor
|
||||
If (CveCliente > 0) Then
|
||||
|
||||
Dim DatosClienteSeleccionado As DataRow = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCliente = {0}", CveCliente))
|
||||
Dim Nombre As String = DatosClienteSeleccionado.Item("Nombre").ToString
|
||||
Dim Ciudad As String = DatosClienteSeleccionado.Item("Ciudad").ToString
|
||||
Dim Estado As String = DatosClienteSeleccionado.Item("Estado").ToString
|
||||
|
||||
params.Add(New ReportParameter("NombreCliente", Nombre))
|
||||
params.Add(New ReportParameter("Direccion", String.Format("{0}, {1}", Ciudad.Trim, Estado)))
|
||||
params.Add(New ReportParameter("CiudadEstadoConsumidor", String.Format("{0}, {1}", Ciudad.Trim, Estado)))
|
||||
params.Add(New ReportParameter("TelConsumidor", DatosClienteSeleccionado.Item("Telefono").ToString))
|
||||
End If
|
||||
|
||||
params.Add(New ReportParameter("Anio", Año))
|
||||
params.Add(New ReportParameter("Comprobante", Comprobante))
|
||||
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
|
||||
ImprimirPDF("Empresas/Grales/Formatos/Ajuste.rdlc", DtDatos, params, "Reporte de Ajuste", "PDF")
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user