Rep cxc,cxp, formatos Serverc, reporte diario

This commit is contained in:
rakcsle
2025-01-29 09:25:44 -07:00
parent fb0b0b4e22
commit 67abc03618
18 changed files with 3459 additions and 4237 deletions

View File

@@ -572,6 +572,53 @@
<asp:BoundField HeaderText="Reg. Firmas" DataField="CreditoRegistroFirmas" Visible="false" />
<asp:BoundField HeaderText="Dirección Cliente" DataField="DireccionCliente" Visible="false" />
<asp:BoundField HeaderText="Sucursal Cobranza (C)" DataField="SucursalCobranzaCliente" DataFormatString="{0}" Visible="false" />
<%--Inicio Columnas reservadas a los rangos--%>
<asp:TemplateField Visible="false" HeaderText="" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblR1" runat="server" Text='<%# Eval("R1", "{0:N2}") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false" HeaderText="" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblR2" runat="server" Text='<%# Eval("R2", "{0:N2}") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false" HeaderText="" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblR3" runat="server" Text='<%# Eval("R3", "{0:N2}") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false" HeaderText="" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblR4" runat="server" Text='<%# Eval("R4", "{0:N2}") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false" HeaderText="" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblR5" runat="server" Text='<%# Eval("R5", "{0:N2}") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false" HeaderText="" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblR6" runat="server" Text='<%# Eval("R6", "{0:N2}") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false" HeaderText="" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblR7" runat="server" Text='<%# Eval("R7", "{0:N2}") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false" HeaderText="" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblR8" runat="server" Text='<%# Eval("R8", "{0:N2}") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%--fin Columnas reservadas a los rangos--%>
</Columns>
</asp:GridView>
</ContentTemplate>
@@ -590,7 +637,7 @@
<asp:Label ID="Label1" runat="server" ClientIDMode="Static" Text="Personalizar Columnas"></asp:Label></h4>
</div>
<div class="modal-body">
<table class="table table-striped nobordertop table-advance table-hover">
<table class="table table-striped nobordertop table-advance table-hover" runat="server" id="TPersonalizar">
<tbody>
<tr>
<td style="text-align: left;">

View File

@@ -219,9 +219,33 @@ Partial Class RepCxCDetalle
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 GvDatos.Columns.Count - 8
End Get
End Property
#End Region
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
ViewState("Opcion") = IfNull(Request("Op"), "-1")
CargaCombos()
@@ -488,9 +512,11 @@ Partial Class RepCxCDetalle
FechaCorte:=txtCorteA.Text.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveCobranzaEstatus:=DdlCobranzaEstatusFiltro.SelectedValue.ToEntero,
CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, LimiteCredito:=LimiteCredito, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero,
CveMoneda:=CveMoneda, EstatusCliente:=DdlEstatusCliente.SelectedValue.ToEntero, TieneLineaAdicional:=DdlTieneLineaAdicional.SelectedValue.ToEntero(),
CveContrato:=DdlContrato.SelectedValue.ToEntero, Aseguradora:=DdlAseguradora.SelectedValue.ToEntero, CveSubProyectoCobranza:=DdlSubProyectoCobranza.SelectedValue.ToEntero()) Then
GvDatos.DataSource = ObjMovtos.DSResultados.Tables(0)
CveContrato:=DdlContrato.SelectedValue.ToEntero, Aseguradora:=DdlAseguradora.SelectedValue.ToEntero, CveSubProyectoCobranza:=DdlSubProyectoCobranza.SelectedValue.ToEntero()) Then
Dim DTdatos As DataTable = ObjMovtos.DSResultados.Tables(0).Copy
DTGvSourcePersonalizaRangos(DTdatos)
GvDatos.DataSource = DTdatos 'ObjMovtos.DSResultados.Tables(0)
'DTaDAtos = ObjMovtos.DSResultados.Tables(0)
'DTaDAtos.TableName = "DTaDAtos"
@@ -506,8 +532,9 @@ Partial Class RepCxCDetalle
End If
ObjMovtos.Dispose()
RangosOcultarMostrar()
GvDatos.DataBind()
RangosOcultarMostrar()
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
GvCartera.DataBind()
@@ -1157,5 +1184,184 @@ Partial Class RepCxCDetalle
End Sub
Protected Sub AgregarChecksRangos()
DTTangos = New DataTable
Dim ObjComp As New ClsCompras
'If ObjComp.GetRepCxPColumnas(UsuarioActual.CveEmpresa) Then
If ObjComp.GetRepCxCColumnas(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 CveCxCColumna As Integer = DROW("CveCxCColumna").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_{CveCxCColumna}_{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 CveCxCColumna As Integer = DROW("CveCxCColumna").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_{CveCxCColumna}_{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
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 CveCxCColumna As Integer = drow("CveCxCColumna").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_{CveCxCColumna}_{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
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 CveCxCColumna As Integer = drow("CveCxCColumna").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_{CveCxCColumna}_{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
End Class