Libro mayor SIG

This commit is contained in:
rakcsle
2024-08-28 22:53:45 -07:00
parent 473bdbced3
commit a49f1de1ca
12 changed files with 4309 additions and 4021 deletions

View File

@@ -25,15 +25,15 @@
<asp:Content ID="Content1" ContentPlaceHolderID="H" runat="Server">
<li>
<asp:LinkButton ID="ImgExcel" runat="server"><i class="fa fa-ad-excel"></i> Generar EXCEL</asp:LinkButton>
<asp:LinkButton ID="ImgExcel" runat="server" Visible="false"><i class="fa fa-ad-excel" ></i> Generar EXCEL</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="Imprimir" runat="server"><i class="fa fa-print"></i> Imprimir</asp:LinkButton>
<asp:LinkButton ID="Imprimir" runat="server" Visible="false"><i class="fa fa-print"></i> Imprimir</asp:LinkButton>
</li>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
Movimientos Auxiliares del Catálogo
Libro Mayor
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server">
@@ -97,10 +97,10 @@
</div>
<div class="portlet-body" <%= IIf(chkexpand.Checked = True, "", "style=""display:none;""")%>>
<div class="row">
<div class="col-md-1 truncate">
<div class="col-md-1 ">
Tipo Movto
</div>
<div class="col-md-2 truncate">
<div class="col-md-3 ">
<asp:DropDownList ID="DdlOpcionCuentas" runat="server" DataTextField="Cuenta" DataValueField="CveCuenta" TabIndex="4" CssClass="form-control input-sm select2me" Width="100%">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="Con movimientos" Value="1"></asp:ListItem>
@@ -109,7 +109,7 @@
<asp:ListItem Text="Con movimientos o saldo no igual a cero" Value="4"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-1 truncate" id="tdTipoReporte" visible="false" runat="server">
<div class="col-md-1 " id="tdTipoReporte" visible="false" runat="server">
Tipo
</div>
<div class="col-md-2" id="tdTipoReporte2" visible="false" runat="server">

View File

@@ -212,7 +212,7 @@ Partial Class Conta_LibroMayor2
Cuenta = DdlCuentas.SelectedItem.ToString
Dim ObjConta As New ClsContabilidad
If ObjConta.GetMovimientosAuxiliaresCatalogo(DdlCuentas.SelectedValue.ToEntero, FechaInicio, FechaFin, -1, CveProyecto, CveSubProyecto, UsuarioActual.CveEmpresa, TipoReporte, DdlOpcionCuentas.SelectedValue.ToEntero) Then
If ObjConta.GetLibroMayor2(DdlCuentas.SelectedValue.ToEntero, FechaInicio, FechaFin, -1, CveProyecto, CveSubProyecto, UsuarioActual.CveEmpresa, TipoReporte, DdlOpcionCuentas.SelectedValue.ToEntero) Then
DtDatos = ObjConta.DtResultados
DtTotales = DtDatos.Clone

View File

@@ -10,6 +10,9 @@
<asp:LinkButton ID="BtnImprimir" runat="server"><i class="fa fa-print"></i> Imprimir</asp:LinkButton>
<%--<asp:ImageButton ID="BtnImprimir" runat="server" alt="Imprimir" src="/Imagenes/btnImprimir.gif" Style="cursor: pointer; height: 20px" Visible="true" /> &nbsp;--%>
</li>
<li>
<asp:LinkButton ID="BtnImprimirPoSubProyecto" runat="server" OnClick="BtnImprimirPoSubProyecto_Click" Visible="false" ><i class="fa fa-print"></i> Imprimir por Sub Proyecto</asp:LinkButton>
</li>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">

View File

@@ -5,6 +5,12 @@ Imports System
Imports System.Data
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Imports ClosedXML.Excel
Imports Profact.TimbraCFDI40
Imports System.IO
Imports System.Drawing
Partial Class Contabilidad2_RepBalanzaComprobacion
Inherits ClsPaginas
@@ -105,6 +111,10 @@ Partial Class Contabilidad2_RepBalanzaComprobacion
End If
CargarCentrosDeCosto(DdlProyecto, DdlSubproyecto, LblProyecto, LblSubProyecto)
If UsuarioActual.CveRol = 1 Then
BtnImprimirPoSubProyecto.Visible = True
End If
End If
End Sub
@@ -254,4 +264,238 @@ Partial Class Contabilidad2_RepBalanzaComprobacion
ImprimirPDF(reportpath, DtDatos, params, fileName, Formato)
End Sub
Protected Sub BtnImprimirPoSubProyecto_Click(sender As Object, e As EventArgs)
Dim WBAnexoBalanza = New ClosedXML.Excel.XLWorkbook
Dim TipoReporte = DdlTipoReporte.SelectedValue.ToEntero
FechaInicio = If(TxtFechaDel.Text = "" Or TxtFechaDel.Text = "__/__/____", NowADS(), TxtFechaDel.Text.ToDate)
FechaFin = If(TxtFechaAl.Text = "" Or TxtFechaAl.Text = "__/__/____", NowADS(), TxtFechaAl.Text.ToDate)
Dim SPCounter As Integer = 1
For Each drSP As DataRow In GlobalDTSubProyectos(UsuarioActual.CveEmpresa).Rows
Dim ObjConta As New ClsContabilidad
If ObjConta.GetBalanzaComprobacion(FechaInicio, FechaFin, 2, TipoReporte, -1, drSP("CveSubProyecto").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlVista.SelectedValue.ToEntero, DdlNivel.SelectedValue.ToEntero) Then
DtDatos = ObjConta.DtResultados
Else
DtDatos = Nothing
Alert("Ocurrio un error al cargar los datos del Anexo del Catálogo", TipoMensaje.MsgError)
Exit For
End If
ObjConta.Dispose()
If DtDatos.Rows.Count > 0 Then
WBAnexoBalanza.AddWorksheet(WSDocumento(drSP("SubProyecto").ToString, DtDatos))
Dim spNombre As String = drSP("SubProyecto").ToString().Replace(":", "_").Replace("/", "_").Replace("\", "_").Replace("?", "_").Replace("*", "_").Replace("[", "_").Replace("]", "_")
WBAnexoBalanza.Worksheet(SPCounter).Name = $"{SPCounter}_{spNombre}"
SPCounter = SPCounter + 1
End If
Next
Dim msB = New MemoryStream()
WBAnexoBalanza.SaveAs(msB)
Dim BB As Byte() = msB.ToArray
msB.Dispose()
Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition", "attachment; filename=Balanza_" & Now.ToString("yyyyMMddhhmmss") & ".xlsx")
Response.ContentType = "application/vnd.ms-excel"
Response.BinaryWrite(BB)
Response.End()
End Sub
Function WSDocumento(SubProyecto As String, DtDatos As DataTable) As IXLWorksheet
Dim WBAnexoSalvar = New ClosedXML.Excel.XLWorkbook
Dim WBReporte = New ClosedXML.Excel.XLWorkbook()
WBReporte.Worksheets.Add("1")
Dim WSReporte = WBReporte.Worksheet(1)
Dim RutaLogo As String = String.Format("{0}Logo.png", UsuarioActual.Empresa.Ruta)
If File.Exists(RutaLogo) Then
Dim imagePath As String = RutaLogo
Dim img As Bitmap = New Bitmap(imagePath)
Dim picture = WSReporte.AddPicture(img).MoveTo(WSReporte.Cell("A1"))
picture.Scale(0.5)
End If
Dim Tamaniofuente As Integer = 13
Dim Range = WSReporte.Range("A1:D1")
WSReporte.Style.Font.FontSize = 10
WSReporte.Style.Font.FontName = "Arial Narrow"
WSReporte.Style.Alignment.WrapText = True
Range.Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A1:F1").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A2:F2").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A3:F3").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A4:F4").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A5:F5").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A1:A5").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
WSReporte.Column(1).Width = 15
WSReporte.Column(2).Width = 35
WSReporte.Column(3).Width = 14
WSReporte.Column(4).Width = 14
WSReporte.Column(5).Width = 14
WSReporte.Column(6).Width = 14
WSReporte.Column(7).Width = 14
WSReporte.Cell(1, 1).Value = UsuarioActual.Empresa.Empresa
WSReporte.Cell(2, 1).Value = $"Balanza de Comprobación del {TxtFechaDel.Text} al {TxtFechaAl.Text}"
WSReporte.Cell(5, 1).Value = $"Sub Proyecto: {SubProyecto}"
WSReporte.Cell(5, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left
WSReporte.Cell(5, 1).Style.Font.Bold = True
WSReporte.Cell(6, 1).Value = "Cuenta"
WSReporte.Cell(6, 2).Value = "Nombre"
WSReporte.Cell(6, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center
WSReporte.Cell(6, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center
WSReporte.Cell(6, 3).Value = $"Saldos Iniciales{vbCrLf}Deudor Acreedor"
WSReporte.Cell(6, 4).Value = $"Cargos"
WSReporte.Cell(6, 5).Value = $"Abonos"
WSReporte.Cell(6, 6).Value = $"Saldo Actuales{vbCrLf} Deudor Acreedo"
WSReporte.Range("A6:F6").Style.Font.Bold = True
WSReporte.Range("A6:F6").Style.Font.FontSize = 10
WSReporte.Range("A6:F6").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
WSReporte.Range("A6:F6").Style.Border.TopBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Range("A6:F6").Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Range("A6:F6").Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
Dim CuerrentRow As Integer = 7
CuerrentRow = CuerrentRow + 1
For Each Drow As DataRow In DtDatos.Rows
WSReporte.Cell(CuerrentRow, 1).Value = Drow("Codigo").ToString
WSReporte.Cell(CuerrentRow, 2).Value = Drow("Nombre").ToString
WSReporte.Cell(CuerrentRow, 3).Value = Drow("SaldoInicial").ToString
WSReporte.Cell(CuerrentRow, 4).Value = Drow("Cargos").ToString
WSReporte.Cell(CuerrentRow, 5).Value = Drow("Abonos").ToString
WSReporte.Cell(CuerrentRow, 6).Value = Drow("SaldoActual").ToString
If Drow("CtaMayor").ToString.ToEntero.Contiene(1) Then
WSReporte.Cell(CuerrentRow, 1).Style.Font.Bold = True
WSReporte.Cell(CuerrentRow, 2).Style.Font.Bold = True
WSReporte.Cell(CuerrentRow, 3).Style.Font.Bold = True
WSReporte.Cell(CuerrentRow, 4).Style.Font.Bold = True
WSReporte.Cell(CuerrentRow, 5).Style.Font.Bold = True
WSReporte.Cell(CuerrentRow, 6).Style.Font.Bold = True
If Drow("CtaMayor").ToString.ToEntero.Contiene(1) Then
WSReporte.Cell(CuerrentRow, 1).Style.Alignment.Indent = 1
WSReporte.Cell(CuerrentRow, 1).Style.Font.Italic = True
End If
Else
WSReporte.Cell(CuerrentRow, 1).Style.Alignment.WrapText = True
WSReporte.Cell(CuerrentRow, 1).Style.Alignment.Indent = 2
End If
WSReporte.Cell(CuerrentRow, 2).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
WSReporte.Cell(CuerrentRow, 3).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
WSReporte.Cell(CuerrentRow, 4).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
WSReporte.Cell(CuerrentRow, 5).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
WSReporte.Cell(CuerrentRow, 6).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
CuerrentRow = CuerrentRow + 1
Next
For xy As Integer = 6 To CuerrentRow
WSReporte.Cell(xy, 6).Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Cell(xy, 1).Style.Border.LeftBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
Next
CuerrentRow = CuerrentRow + 1
WSReporte.Cell(CuerrentRow, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center
WSReporte.Cell(CuerrentRow, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center
WSReporte.Cell(CuerrentRow, 3).Value = $"Saldos Iniciales{vbCrLf}Deudor Acreedor"
WSReporte.Cell(CuerrentRow, 4).Value = $"Cargos"
WSReporte.Cell(CuerrentRow, 5).Value = $"Abonos"
WSReporte.Cell(CuerrentRow, 6).Value = $"Saldo Actuales{vbCrLf} Deudor Acreedo"
WSReporte.Cell(CuerrentRow, 1).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Cell(CuerrentRow, 2).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Cell(CuerrentRow, 3).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Cell(CuerrentRow, 4).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Cell(CuerrentRow, 5).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Cell(CuerrentRow, 6).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Font.Bold = True
WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Font.FontSize = 10
WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Border.TopBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Range($"A{CuerrentRow}:F{CuerrentRow}").Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
CuerrentRow = CuerrentRow + 1
Dim ultimaFila As DataRow = DtDatos.Rows(DtDatos.Rows.Count - 1)
Dim LastSaldoID As Decimal = ultimaFila("SaldoID").ToString.ToDecimal
Dim LastTotalAbonos As Decimal = ultimaFila("TotalAbonos").ToString.ToDecimal
Dim LastTotalCargos As Decimal = ultimaFila("TotalCargos").ToString.ToDecimal
Dim LastSaldoAD As Decimal = ultimaFila("SaldoAD").ToString.ToDecimal
Dim LastSaldoIA As Decimal = ultimaFila("SaldoIA").ToString.ToDecimal
Dim LastSaldoAA As Decimal = ultimaFila("SaldoAA").ToString.ToDecimal
WSReporte.Cell(CuerrentRow, 2).Value = "Sumas Iguales"
WSReporte.Cell(CuerrentRow, 3).Value = LastSaldoID
WSReporte.Cell(CuerrentRow, 4).Value = LastTotalCargos
WSReporte.Cell(CuerrentRow, 5).Value = LastTotalAbonos
WSReporte.Cell(CuerrentRow, 6).Value = LastSaldoAD
WSReporte.Cell(CuerrentRow, 3).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
WSReporte.Cell(CuerrentRow, 4).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
WSReporte.Cell(CuerrentRow, 5).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
WSReporte.Cell(CuerrentRow, 6).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
CuerrentRow = CuerrentRow + 1
WSReporte.Cell(CuerrentRow, 3).Value = LastSaldoIA
WSReporte.Cell(CuerrentRow, 6).Value = LastSaldoAA
WSReporte.Cell(CuerrentRow, 3).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
WSReporte.Cell(CuerrentRow, 6).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
WSReporte.Range($"B{CuerrentRow}:F{CuerrentRow}").Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.PageSetup.PrintAreas.Add($"A1:G{CuerrentRow + 0 + 1}")
WSReporte.PageSetup.Margins.Top = 0.3
WSReporte.PageSetup.Margins.Left = 0.8
WSReporte.PageSetup.Margins.Right = 0.8
WSReporte.PageSetup.FitToPages(1, 1)
WBReporte.Worksheet(1).CopyTo(WBAnexoSalvar, "SubProyecto")
Return WBReporte.Worksheet(1)
End Function
End Class