Rep cxc,cxp, formatos Serverc, reporte diario
This commit is contained in:
@@ -6,6 +6,8 @@ Imports Microsoft.Reporting.WebForms
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
|
||||
|
||||
|
||||
Partial Class RepCxPDetalle
|
||||
Inherits ClsPaginas
|
||||
|
||||
@@ -214,20 +216,53 @@ Partial Class RepCxPDetalle
|
||||
ViewState("DTCuentasContables") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DTTangos As DataTable
|
||||
Get
|
||||
If ViewState("DTTangos") Is Nothing Then
|
||||
ViewState("DTTangos") = New DataTable
|
||||
End If
|
||||
Return DirectCast(ViewState("DTTangos"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DTTangos") = value
|
||||
End Set
|
||||
|
||||
End Property
|
||||
|
||||
|
||||
Public ReadOnly Property GvCountColumnasIniciales As Integer
|
||||
Get
|
||||
Return 26
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
'Private ReadOnly Property ColumnasVisibles As
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
|
||||
AgregarChecksRangos() 'Esto requiere generarse en cada postaback
|
||||
If Not IsPostBack Then
|
||||
|
||||
SePersonalizo = 0
|
||||
ViewState("Opcion") = IfNull(Request("Op"), "S")
|
||||
ViewState("Opcion") = IfNull(Request("Op"), "S")
|
||||
'GvCountColumnasIniciales = GvDatos.Columns.Count
|
||||
|
||||
|
||||
MostrarOcultarColumnas()
|
||||
CargaCombos()
|
||||
CargaCombos()
|
||||
If Request("Op") IsNot Nothing Then
|
||||
CargaDatos()
|
||||
End If
|
||||
'ImgPersonalizar.Attributes.Add("onclick", "$('#DivPersonalizar').show(1000); PosicionaObjeto(this.id,'DivPersonalizar');")
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
#Region "CARGAS"
|
||||
@@ -390,6 +425,9 @@ Partial Class RepCxPDetalle
|
||||
Else
|
||||
GvDatos.Columns(13).Visible = False
|
||||
End If
|
||||
|
||||
DTGvSourcePersonalizaRangos(DtDatos:=TMP_DTDatos)
|
||||
|
||||
DtDatos = TMP_DTDatos
|
||||
GvDatos.DataSource = DtDatos
|
||||
HplProgramar.NavigateUrl = $"/Bancos/RepProgramarRecursos.aspx{HttpContext.Current.Request.Url.PathAndQuery.Replace("/Compras/RepCxPDetalle.aspx", "")}"
|
||||
@@ -402,25 +440,100 @@ Partial Class RepCxPDetalle
|
||||
End Try
|
||||
ObjMovtos.Dispose()
|
||||
|
||||
GvDatos.DataBind()
|
||||
GvDatos.DataBind()
|
||||
|
||||
' GvDatosPersonalizaRangos()
|
||||
|
||||
RangosOcultarMostrar()
|
||||
GvDatos.DataBind()
|
||||
RangosOcultarMostrar()
|
||||
'GvDatosPersonalizaRangosAsignadatos()
|
||||
|
||||
UPDatos.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub DTGvSourcePersonalizaRangos(ByRef DtDatos As DataTable)
|
||||
|
||||
DtDatos.Columns.Add("R1", GetType(Decimal))
|
||||
DtDatos.Columns.Add("R2", GetType(Decimal))
|
||||
DtDatos.Columns.Add("R3", GetType(Decimal))
|
||||
DtDatos.Columns.Add("R4", GetType(Decimal))
|
||||
DtDatos.Columns.Add("R5", GetType(Decimal))
|
||||
DtDatos.Columns.Add("R6", GetType(Decimal))
|
||||
DtDatos.Columns.Add("R7", GetType(Decimal))
|
||||
DtDatos.Columns.Add("R8", GetType(Decimal))
|
||||
|
||||
DtDatos.AcceptChanges()
|
||||
|
||||
Dim startIndex As Integer = GvCountColumnasIniciales '- 1
|
||||
|
||||
Dim indexcontcol As Integer = startIndex
|
||||
Dim NumColActual As Integer = 1
|
||||
For Each drow As DataRow In DTTangos.Rows
|
||||
|
||||
Dim CveCxPColumna As Integer = drow("CveCxPColumna").ToString.ToEntero
|
||||
Dim RangoInicial As Integer = drow("RangoInicial").ToString.ToEntero
|
||||
Dim RangoFinal As Integer = drow("RangoFinal").ToString.ToEntero
|
||||
Dim Tipo As Integer = drow("Tipo").ToString.ToEntero
|
||||
Dim ChkID = $"Chk_{CveCxPColumna}_{RangoInicial}_{RangoFinal}_{Tipo}" ' Asignar un ID único
|
||||
|
||||
Dim chk As CheckBox = TryCast(TPersonalizar.FindControl(ChkID), CheckBox)
|
||||
|
||||
If chk.Checked Then
|
||||
|
||||
For Each dRowDT As DataRow In DtDatos.Rows
|
||||
|
||||
Dim DiasVencidos As Integer = dRowDT("DiasVencidos").ToString.ToEntero
|
||||
|
||||
If Tipo = 1 And DiasVencidos > 0 Then
|
||||
|
||||
If RangoFinal = 0 And DiasVencidos >= RangoInicial Then
|
||||
dRowDT($"R{NumColActual}") = dRowDT("Saldo")
|
||||
End If
|
||||
|
||||
If DiasVencidos >= RangoInicial And DiasVencidos <= RangoFinal Then
|
||||
dRowDT($"R{NumColActual}") = dRowDT("Saldo")
|
||||
End If
|
||||
|
||||
ElseIf Tipo = 2 And DiasVencidos < 0 Then
|
||||
|
||||
If RangoFinal = 0 And Math.Abs(DiasVencidos) >= RangoInicial Then
|
||||
dRowDT($"R{NumColActual}") = dRowDT("Saldo")
|
||||
End If
|
||||
|
||||
If Math.Abs(DiasVencidos) >= RangoInicial And Math.Abs(DiasVencidos) <= RangoFinal Then
|
||||
dRowDT($"R{NumColActual}") = dRowDT("Saldo")
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
NumColActual = NumColActual + 1
|
||||
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "CONSULTAR"
|
||||
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
|
||||
CargaDatos()
|
||||
ConfiguraEmpresa()
|
||||
'UPDatos.Update()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "CONFIGURACIONES"
|
||||
|
||||
|
||||
Private Function AddRows(ByRef DT As DataTable) As DataTable
|
||||
'Dim i As Integer = 0
|
||||
'Dim Ultima As String = String.Empty
|
||||
@@ -468,7 +581,8 @@ Partial Class RepCxPDetalle
|
||||
|
||||
#Region "GRIDVIEW"
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If DdlGrupo.SelectedValue.ToEntero = 11 Then
|
||||
@@ -517,28 +631,28 @@ Partial Class RepCxPDetalle
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 Or UsuarioActual.Empresa.Funcionalidad(134).ToEntero > 0 Then
|
||||
Dim Str As New StringBuilder
|
||||
Str.AppendFormat("Importe Almacen: ${0} ({1}%) <br/>", e.Row.DBCampo("ImporteAlmacen").FormatoNumero, e.Row.DBCampo("ImporteAlmacenPorcentaje"))
|
||||
If e.Row.DBCampo("ImporteServicios").ToDouble > 0 Then Str.AppendFormat("Importe Servicios: ${0} ({1}%) <br/>", e.Row.DBCampo("ImporteServicios").FormatoNumero, e.Row.DBCampo("ImporteServiciosPorcentaje"))
|
||||
If e.Row.DBCampo("ImporteDevolucion").ToDouble > 0 Then Str.AppendFormat("Importe Devuelto: ${0} ({1}%) <br/>", e.Row.DBCampo("ImporteDevolucion").FormatoNumero, e.Row.DBCampo("ImporteDevolucionPorcentaje"))
|
||||
Str.AppendFormat(" <i> Importes <b> SIN</b> IVA</i>")
|
||||
Dim Str As New StringBuilder
|
||||
Str.AppendFormat("Importe Almacen: ${0} ({1}%) <br/>", e.Row.DBCampo("ImporteAlmacen").FormatoNumero, e.Row.DBCampo("ImporteAlmacenPorcentaje"))
|
||||
If e.Row.DBCampo("ImporteServicios").ToDouble > 0 Then Str.AppendFormat("Importe Servicios: ${0} ({1}%) <br/>", e.Row.DBCampo("ImporteServicios").FormatoNumero, e.Row.DBCampo("ImporteServiciosPorcentaje"))
|
||||
If e.Row.DBCampo("ImporteDevolucion").ToDouble > 0 Then Str.AppendFormat("Importe Devuelto: ${0} ({1}%) <br/>", e.Row.DBCampo("ImporteDevolucion").FormatoNumero, e.Row.DBCampo("ImporteDevolucionPorcentaje"))
|
||||
Str.AppendFormat(" <i> Importes <b> SIN</b> IVA</i>")
|
||||
|
||||
e.Row.FCLabel("LbEstatusInv").Attributes.Add("title", Str.ToString)
|
||||
Select Case e.Row.DBCampo("EstatusInventario").ToEntero
|
||||
Case 1
|
||||
e.Row.FCLabel("LbEstatusInv").Text = "<i Class='fa fa-flag-o' aria-hidden='true'></i>"
|
||||
e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.Red
|
||||
Case 2
|
||||
e.Row.FCLabel("LbEstatusInv").Text = "<i Class='fa fa-flag-checkered' aria-hidden='true'></i>"
|
||||
e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.DarkOrange
|
||||
Case 3
|
||||
e.Row.FCLabel("LbEstatusInv").Text = "<i Class='fa fa-flag' aria-hidden='true'></i>"
|
||||
e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.Green
|
||||
End Select
|
||||
End If
|
||||
e.Row.FCLabel("LbEstatusInv").Attributes.Add("title", Str.ToString)
|
||||
Select Case e.Row.DBCampo("EstatusInventario").ToEntero
|
||||
Case 1
|
||||
e.Row.FCLabel("LbEstatusInv").Text = "<i Class='fa fa-flag-o' aria-hidden='true'></i>"
|
||||
e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.Red
|
||||
Case 2
|
||||
e.Row.FCLabel("LbEstatusInv").Text = "<i Class='fa fa-flag-checkered' aria-hidden='true'></i>"
|
||||
e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.DarkOrange
|
||||
Case 3
|
||||
e.Row.FCLabel("LbEstatusInv").Text = "<i Class='fa fa-flag' aria-hidden='true'></i>"
|
||||
e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.Green
|
||||
End Select
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
@@ -588,11 +702,120 @@ Partial Class RepCxPDetalle
|
||||
If Activo Then SePersonalizo = 1
|
||||
|
||||
End Sub
|
||||
Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click
|
||||
MostrarOcultarColumnas()
|
||||
Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click
|
||||
MostrarOcultarColumnas()
|
||||
CargaDatos() 'Esto se requiere por las columnas dinamicas de rangos
|
||||
RegistraScript("$('#DivPersonalizar').modal('hide');")
|
||||
End Sub
|
||||
|
||||
Private Sub RangosOcultarMostrar()
|
||||
|
||||
|
||||
Dim startIndex As Integer = GvCountColumnasIniciales ' - 1
|
||||
'startIndex = startIndex + 1
|
||||
|
||||
For x As Integer = startIndex To GvDatos.Columns.Count - 1
|
||||
GvDatos.Columns(x).Visible = False
|
||||
Next
|
||||
|
||||
|
||||
For Each drow As DataRow In DTTangos.Rows
|
||||
|
||||
Dim CveCxPColumna As Integer = drow("CveCxPColumna").ToString.ToEntero
|
||||
Dim RangoInicial As Integer = drow("RangoInicial").ToString.ToEntero
|
||||
Dim RangoFinal As Integer = drow("RangoFinal").ToString.ToEntero
|
||||
Dim Tipo As Integer = drow("Tipo").ToString.ToEntero
|
||||
Dim ChkID = $"Chk_{CveCxPColumna}_{RangoInicial}_{RangoFinal}_{Tipo}" ' Asignar un ID único
|
||||
|
||||
Dim chk As CheckBox = TryCast(TPersonalizar.FindControl(ChkID), CheckBox)
|
||||
|
||||
If chk.Checked Then
|
||||
GvDatos.Columns(startIndex).Visible = True
|
||||
If Tipo = 1 Then
|
||||
GvDatos.Columns(startIndex).HeaderText = If(RangoFinal = 0, $"Ven {RangoInicial} + ", $"Ven {RangoInicial} - {RangoFinal}")
|
||||
Else
|
||||
GvDatos.Columns(startIndex).HeaderText = If(RangoFinal = 0, $"Por Ven {RangoInicial} + ", $"Por Ven {RangoInicial} - {RangoFinal}")
|
||||
End If
|
||||
startIndex = startIndex + 1
|
||||
|
||||
End If
|
||||
Next
|
||||
UPDatos.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub AgregarChecksRangos()
|
||||
|
||||
DTTangos = New DataTable
|
||||
|
||||
Dim ObjComp As New ClsCompras
|
||||
If ObjComp.GetRepCxPColumnas(UsuarioActual.CveEmpresa) Then
|
||||
DTTangos = ObjComp.DtResultados.Copy
|
||||
End If
|
||||
ObjComp.Dispose()
|
||||
|
||||
|
||||
Dim newRowVencidoCabecera As New HtmlTableRow()
|
||||
Dim newCellVencidoCabecera As New HtmlTableCell()
|
||||
newCellVencidoCabecera.ColSpan = 4
|
||||
newCellVencidoCabecera.InnerHtml = "Vencido"
|
||||
newRowVencidoCabecera.Cells.Add(newCellVencidoCabecera)
|
||||
TPersonalizar.Rows.Add(newRowVencidoCabecera)
|
||||
|
||||
Dim newRowVencido As New HtmlTableRow()
|
||||
For Each DROW As DataRow In DTTangos.FiltraParametros(" Tipo = 1").Rows
|
||||
|
||||
Dim CveCxPColumna As Integer = DROW("CveCxPColumna").ToString.ToEntero
|
||||
Dim RangoInicial As Integer = DROW("RangoInicial").ToString.ToEntero
|
||||
Dim RangoFinal As Integer = DROW("RangoFinal").ToString.ToEntero
|
||||
Dim Tipo As Integer = DROW("Tipo").ToString.ToEntero
|
||||
|
||||
Dim newCell As New HtmlTableCell()
|
||||
Dim chk As New CheckBox()
|
||||
chk.ID = $"Chk_{CveCxPColumna}_{RangoInicial}_{RangoFinal}_{Tipo}" ' Asignar un ID único
|
||||
chk.Text = $"De {RangoInicial} a {If(RangoFinal = 0, "-", RangoFinal.ToString)}" ' Texto del CheckBox
|
||||
chk.Checked = False ' Valor inicial del CheckBox
|
||||
chk.ClientIDMode = ClientIDMode.Static
|
||||
|
||||
newCell.Controls.Add(chk)
|
||||
newRowVencido.Cells.Add(newCell)
|
||||
|
||||
Next
|
||||
TPersonalizar.Rows.Add(newRowVencido)
|
||||
|
||||
|
||||
Dim newRowPorVencerCavecera As New HtmlTableRow()
|
||||
Dim newCellPorVencerCabecera As New HtmlTableCell()
|
||||
newCellPorVencerCabecera.ColSpan = 4
|
||||
newCellPorVencerCabecera.InnerHtml = "Por Vencer"
|
||||
newRowPorVencerCavecera.Cells.Add(newCellPorVencerCabecera)
|
||||
TPersonalizar.Rows.Add(newRowPorVencerCavecera)
|
||||
|
||||
|
||||
Dim newRowPorVencer As New HtmlTableRow()
|
||||
For Each DROW As DataRow In DTTangos.FiltraParametros(" Tipo = 2").Rows
|
||||
|
||||
Dim CveCxPColumna As Integer = DROW("CveCxPColumna").ToString.ToEntero
|
||||
Dim RangoInicial As Integer = DROW("RangoInicial").ToString.ToEntero
|
||||
Dim RangoFinal As Integer = DROW("RangoFinal").ToString.ToEntero
|
||||
Dim Tipo As Integer = DROW("Tipo").ToString.ToEntero
|
||||
|
||||
Dim newCell As New HtmlTableCell()
|
||||
Dim chk As New CheckBox()
|
||||
chk.ID = $"Chk_{CveCxPColumna}_{RangoInicial}_{RangoFinal}_{Tipo}" ' Asignar un ID único
|
||||
chk.Text = $"De {RangoInicial} a {If(RangoFinal = 0, "-", RangoFinal.ToString)}" ' Texto del CheckBox
|
||||
chk.Checked = False ' Valor inicial del CheckBox
|
||||
|
||||
newCell.Controls.Add(chk)
|
||||
newRowPorVencer.Cells.Add(newCell)
|
||||
|
||||
Next
|
||||
TPersonalizar.Rows.Add(newRowPorVencer)
|
||||
|
||||
UPPersonalizar.Update()
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "IMPRESIONES"
|
||||
@@ -676,6 +899,9 @@ Partial Class RepCxPDetalle
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Protected Sub LnkPersonalizar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
RegistraScript("$('#DivPersonalizar').modal({ backdrop: 'static', keyboard: false});")
|
||||
|
||||
Reference in New Issue
Block a user