156 lines
6.4 KiB
VB.net
156 lines
6.4 KiB
VB.net
Imports System.Data
|
|
Imports Extensiones
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
Partial Class Ventas_RepPedidosDevolucionesXContrato
|
|
Inherits ClsPaginas
|
|
|
|
#Region "P R O P I E D A D E S"
|
|
Private Property DsDatos As DataSet
|
|
Get
|
|
DsDatos = DirectCast(ViewState("DtDatos"), DataSet)
|
|
End Get
|
|
|
|
Set(ByVal value As DataSet)
|
|
ViewState("DtDatos") = value
|
|
End Set
|
|
End Property
|
|
Private Property TCEspecifico As Double
|
|
#End Region
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
txtFechaI.Text = Now.FirstDayOfMonth.AddYears(-1).ToShortDateString
|
|
txtFechaF.Text = Now.ToShortDateString
|
|
|
|
CargaContratos()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
Dim ObjContratos As New ClsContratos
|
|
If ObjContratos.GetRepDevolucionesPedidos(DdlContratos.SelectedValue.ToEntero, txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, -1, DdlTipo.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
|
DsDatos = ObjContratos.DsResultados
|
|
|
|
GvDatos.DataSource = DsDatos.Tables(0)
|
|
GvDevs.DataSource = DsDatos.Tables(1)
|
|
End If
|
|
ObjContratos.Dispose()
|
|
|
|
GvDatos.DataBind()
|
|
GvDevs.DataBind()
|
|
|
|
UPDatos.Update()
|
|
End Sub
|
|
|
|
#Region "C O M B O S"
|
|
Public Sub CargaContratos()
|
|
DdlContratos.DataSource = GlobalDTContratos().FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}")
|
|
DdlContratos.DataBind()
|
|
End Sub
|
|
|
|
Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region "R E P O R T E S"
|
|
Private Sub GenerarPDF(Optional Formato As String = "PDF")
|
|
If DsDatos Is Nothing Then
|
|
Alert("No se ha consultado ningun contrato", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
Dim Contrato = DdlContratos.SelectedItem
|
|
|
|
Dim FechaI As String = txtFechaI.Text
|
|
Dim FechaF As String = txtFechaF.Text
|
|
|
|
If txtFechaI.Text = "" Then FechaI = "-1"
|
|
If txtFechaF.Text = "" Then FechaF = "-1"
|
|
|
|
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 params As New List(Of ReportParameter)
|
|
|
|
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("FechaInicio", FechaI))
|
|
params.Add(New ReportParameter("FechaFin", FechaF))
|
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
|
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
|
|
params.Add(New ReportParameter("Contrato", Contrato.Text))
|
|
params.Add(New ReportParameter("Estatus", ""))
|
|
params.Add(New ReportParameter("Tipo", DdlTipo.SelectedItem.Text))
|
|
|
|
If Imagen.Exists Then
|
|
params.Add(New ReportParameter("LogoPath", logouri))
|
|
Else
|
|
params.Add(New ReportParameter("LogoPath", ""))
|
|
End If
|
|
|
|
Dim lrds As New List(Of ReportDataSource)
|
|
lrds.Add(New ReportDataSource("DataSet1", DsDatos.Tables(0)))
|
|
lrds.Add(New ReportDataSource("DataSet2", DsDatos.Tables(1)))
|
|
|
|
ImprimirPDF("Empresas/Grales/Formatos/RepPedDevolucionesXContrato.rdlc", lrds, params, "ReportePedidosDevoluciones", Formato)
|
|
|
|
End Sub
|
|
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs)
|
|
GenerarPDF("Excel")
|
|
End Sub
|
|
Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs)
|
|
GenerarPDF()
|
|
End Sub
|
|
#End Region
|
|
|
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.DBCampo("CodigoPS") = "" Then
|
|
e.Row.CssClass = "SubTotales2"
|
|
e.Row.Attributes.Add("style", "background-color:#B9B5B4 !important;")
|
|
e.Row.Cells(1).Text = ""
|
|
e.Row.Cells(5).Text = ""
|
|
e.Row.Cells(6).Text = ""
|
|
e.Row.Cells(7).Text = ""
|
|
|
|
Dim Texto = $"Pedido: <b><a href='/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveVenta")}' target='_blank'>{e.Row.DBCampo("SerieFolio")}</a></b> | "
|
|
Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: <b><a href ='/Inventarios/EntradasSalidas.aspx?CveMovimiento={e.Row.DBCampo("CveMovimiento")}' target='_blank'>{e.Row.DBCampo("Folio")}</a></b>")
|
|
|
|
e.Row.Cells(1).ColumnSpan = 2
|
|
e.Row.Cells(2).Visible = False
|
|
e.Row.Cells(1).Text = Texto
|
|
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
|
|
Else
|
|
If e.Row.DBCampo("CveMovimiento").ToString = "" Then
|
|
e.Row.Cells(2).Text = "SIN MOVIMIENTO DE ALMACÉN"
|
|
End If
|
|
End If
|
|
End If
|
|
End Sub
|
|
Protected Sub GvDevs_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.DBCampo("CodigoPS") = "" Then
|
|
e.Row.CssClass = "SubTotales2"
|
|
e.Row.Attributes.Add("style", "background-color:#B9B5B4 !important;")
|
|
e.Row.Cells(1).Text = ""
|
|
e.Row.Cells(5).Text = ""
|
|
e.Row.Cells(6).Text = ""
|
|
e.Row.Cells(7).Text = ""
|
|
|
|
Dim Texto = $"Devolución: <b><a href='/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveVenta")}' target='_blank'>{e.Row.DBCampo("SerieFolio")}</a></b> | "
|
|
Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: <b><a href ='/Inventarios/EntradasSalidas.aspx?CveMovimiento={e.Row.DBCampo("CveMovimiento")}' target='_blank'>{e.Row.DBCampo("Folio")}</a></b>")
|
|
|
|
e.Row.Cells(1).ColumnSpan = 2
|
|
e.Row.Cells(2).Visible = False
|
|
e.Row.Cells(1).Text = Texto
|
|
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
|
|
Else
|
|
If e.Row.DBCampo("CveMovimiento").ToString = "" Then
|
|
e.Row.Cells(2).Text = "SIN MOVIMIENTO DE ALMACÉN"
|
|
End If
|
|
End If
|
|
End If
|
|
End Sub
|
|
End Class
|