VyA addContrato valida unidad

This commit is contained in:
rakcsle
2024-09-02 09:27:38 -07:00
parent a6176df862
commit 59ccd7e281
12 changed files with 3519 additions and 3077 deletions

View File

@@ -4,6 +4,8 @@ Public Class CalendarEvent
Public Property id As Integer Public Property id As Integer
Public Property title As String Public Property title As String
Public Property colorfont As String
Public Property description As String Public Property description As String
Public Property start As String Public Property start As String
Public Property [end] As String Public Property [end] As String

File diff suppressed because it is too large Load Diff

View File

@@ -554,7 +554,44 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState
Dim cevent As CalendarEvent = New CalendarEvent() Dim cevent As CalendarEvent = New CalendarEvent()
cevent.id = dr("CveContrato").ToString.ToEntero cevent.id = dr("CveContrato").ToString.ToEntero
cevent.title = If(dr("CodigoAF").ToString.Trim.Length > 0, $"#{dr("CodigoAF").ToString}-{dr("DescripcionContrato").ToString}", $"-{dr("DescripcionContrato").ToString}") cevent.CveTipoAF = dr("CveTipoAF").ToString.ToEntero
cevent.title = $"-{dr("DescripcionContrato").ToString}"
If usuarioActual_.CveEmpresa = 188 AndAlso dr("CveTipoAF").ToString.Trim.Length > 0 Then
Dim TipoAfAbrebiado As String = ""
Select Case cevent.CveTipoAF
Case 181
TipoAfAbrebiado = "Bus"
Exit Select
'Case 183
' TipoAfAbrebiado = ""
' Exit Select
Case 184
TipoAfAbrebiado = "Spr"
Exit Select
'Case 185
' TipoAfAbrebiado = "Uti"
' Exit Select
Case 191
TipoAfAbrebiado = "Van"
Exit Select
Case 192
TipoAfAbrebiado = "Sed"
Exit Select
Case Else
Exit Select
End Select
cevent.title = $"-{TipoAfAbrebiado}#{dr("CodigoAF").ToString}-{dr("DescripcionContrato").ToString}"
'cevent.colorfont = "blue"
Else
cevent.title = $"#{dr("CodigoAF").ToString}-{dr("DescripcionContrato").ToString}"
End If
cevent.description = dr("DescripcionContrato").ToString cevent.description = dr("DescripcionContrato").ToString
cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime)
cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)) cevent.end = If(tipoVista = "fecha", String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime.AddHours(1)), String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime))
@@ -570,7 +607,7 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState
cevent.Pesos = dr("ImporteMax").ToString.ToDecimal cevent.Pesos = dr("ImporteMax").ToString.ToDecimal
cevent.Anticipo = dr("ImporteMin").ToString.ToDecimal cevent.Anticipo = dr("ImporteMin").ToString.ToDecimal
cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero
cevent.CveTipoAF = dr("CveTipoAF").ToString.ToEntero
cevent.CantidadPasajeros = dr("CantidadPasajeros").ToString cevent.CantidadPasajeros = dr("CantidadPasajeros").ToString
cevent.NumeroContrato = dr("NumeroContrato").ToString cevent.NumeroContrato = dr("NumeroContrato").ToString
cevent.Observaciones = dr("Observaciones").ToString cevent.Observaciones = dr("Observaciones").ToString

View File

@@ -23,13 +23,21 @@
</style> </style>
</asp:Content> </asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="H" runat="Server"> <asp:Content ID="Content1" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel ID="UpAcciones" runat="server" >
<ContentTemplate>
<li>
<asp:LinkButton ID="ImgExcel" runat="server" Visible="true"><i class="fa fa-file-excel-o" ></i> Generar EXCEL</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="ImgExcel" />
</Triggers>
</asp:UpdatePanel>
<li>
<asp:LinkButton ID="ImgExcel" runat="server" Visible="false"><i class="fa fa-ad-excel" ></i> Generar EXCEL</asp:LinkButton> <%-- <li>
</li>
<li>
<asp:LinkButton ID="Imprimir" runat="server" Visible="false"><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> </li>--%>
</asp:Content> </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server"> <asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
@@ -143,13 +151,16 @@
</div> </div>
<asp:UpdatePanel ID="UpDatos" UpdateMode="Conditional" runat="server"> <asp:UpdatePanel ID="UpDatos" UpdateMode="Conditional" runat="server">
<ContentTemplate> <ContentTemplate>
<div style='color:red'></div>
<asp:GridView ID="GvDatos" runat="server" <asp:GridView ID="GvDatos" runat="server"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" AutoGenerateColumns="False" CssClass="table table-striped table-advance table-hover " AutoGenerateColumns="False"
EmptyDataText="No se encontrarios movimientos." EmptyDataText="No se encontrarios movimientos."
DataKeyNames="" OnRowDataBound="GvDatos_RowDataBound"> DataKeyNames="" OnRowDataBound="GvDatos_RowDataBound">
<Columns> <Columns>
<asp:TemplateField ControlStyle-CssClass="Widthall"> <asp:TemplateField ControlStyle-CssClass="Widthall">
<HeaderTemplate> <HeaderTemplate>
<table width="100%" style="border: none"> <table width="100%" style="border: none">
<tr> <tr>
<td colspan="3"><font size="2">Cuenta</font></td> <td colspan="3"><font size="2">Cuenta</font></td>
@@ -164,15 +175,19 @@
<td width="300px" align="left">Concepto</td> <td width="300px" align="left">Concepto</td>
<td width="100px" align="center">Referencia</td> <td width="100px" align="center">Referencia</td>
<td width="100px" align="center">Referencia Movto</td> <td width="100px" align="center">Referencia Movto</td>
<td width="100px" align="center">SubProyecto</td> <td width="100px" align="center">SubProyecto <asp:Label ID="LblSubProyecto" runat="server"></asp:Label> </td>
<td width="100px" align="center">Cargos</td> <td width="100px" align="center">Cargos</td>
<td width="100px" align="center">Abonos</td> <td width="100px" align="center">Abonos</td>
<td width="100px" align="center">Saldo</td> <td width="100px" align="center">Saldo</td>
</tr> </tr>
</table> </table>
</HeaderTemplate> </HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<table width="100%" style="border: none"> <table width="100%" style="border: none">
<tr runat="server" id="tr1"> <tr runat="server" id="tr1">
<td colspan="3" align="left" width="180px"> <td colspan="3" align="left" width="180px">
<asp:Label ID="LbCuenta" runat="server" Text='<%# Eval("Codigo")%>'></asp:Label> <asp:Label ID="LbCuenta" runat="server" Text='<%# Eval("Codigo")%>'></asp:Label>
@@ -187,6 +202,7 @@
<asp:Label ID="LbSaldoInicial" runat="server" Text='<%# Eval("SaldoInicial", "{0:N2}")%>'></asp:Label> <asp:Label ID="LbSaldoInicial" runat="server" Text='<%# Eval("SaldoInicial", "{0:N2}")%>'></asp:Label>
</td> </td>
</tr> </tr>
<tr runat="server" id="tr2"> <tr runat="server" id="tr2">
<td width="60px" style="border: 0px;" align="center"> <td width="60px" style="border: 0px;" align="center">
<asp:Literal ID="LbFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}")%>'></asp:Literal> <asp:Literal ID="LbFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}")%>'></asp:Literal>
@@ -222,6 +238,7 @@
<asp:Label ID="LbSaldo" runat="server"></asp:Label> <asp:Label ID="LbSaldo" runat="server"></asp:Label>
</td> </td>
</tr> </tr>
</table> </table>
</ItemTemplate> </ItemTemplate>
<ItemStyle /> <ItemStyle />
@@ -229,6 +246,9 @@
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
@@ -239,8 +259,7 @@
</asp:Content> </asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="JS" runat="Server">
<script type="text/javascript">
</script>
</asp:Content> </asp:Content>

View File

@@ -2,8 +2,12 @@
Option Strict On Option Strict On
Imports System.Data Imports System.Data
Imports ADServerControl.DragableList
Imports System.IO
Imports Extensiones Imports Extensiones
Imports Microsoft.Reporting.WebForms Imports Microsoft.Reporting.WebForms
Imports ClosedXML.Excel
Imports System.Drawing
Partial Class Conta_LibroMayor2 Partial Class Conta_LibroMayor2
Inherits ClsPaginas Inherits ClsPaginas
@@ -12,7 +16,11 @@ Partial Class Conta_LibroMayor2
#Region "PROPIEDADES" #Region "PROPIEDADES"
Private Property DtDatos As DataTable Private Property DtDatos As DataTable
Get Get
DtDatos = DirectCast(ViewState("DtDatos"), DataTable) If ViewState("DtDatos") Is Nothing Then
ViewState("DtDatos") = New DataTable
End If
Return DirectCast(ViewState("DtDatos"), DataTable)
End Get End Get
Set(ByVal value As DataTable) Set(ByVal value As DataTable)
@@ -82,14 +90,12 @@ Partial Class Conta_LibroMayor2
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then If Not Page.IsPostBack Then
'If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.CveEmpresa <> 119 Then
' Response.Redirect($"/Contabilidad/RepMovimientosAuxiliaresCatalogo.aspx")
'End If
Dim ErrorParametros As Boolean = True Dim ErrorParametros As Boolean = True
CargaTipoCuentas() CargaTipoCuentas()
'TxtCuenta.Enabled = False
txtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString txtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString
txtFechaF.Text = NowADS().LastDayOfMonth.ToShortDateString txtFechaF.Text = NowADS().LastDayOfMonth.ToShortDateString
@@ -109,7 +115,7 @@ Partial Class Conta_LibroMayor2
txtFechaI.Text = FechaInicio.ToShortDateString txtFechaI.Text = FechaInicio.ToShortDateString
Else Else
FechaInicio = DateSerial(Year(FechaFin), Month(FechaFin), 1) FechaInicio = DateSerial(Year(FechaFin), Month(FechaFin), 1)
TxtFechaF.Text = FechaInicio.ToShortDateString txtFechaF.Text = FechaInicio.ToShortDateString
End If End If
If Request("CveProyecto") IsNot Nothing AndAlso IsNumeric(Request("CveProyecto")) Then If Request("CveProyecto") IsNot Nothing AndAlso IsNumeric(Request("CveProyecto")) Then
@@ -126,20 +132,9 @@ Partial Class Conta_LibroMayor2
If Request("TP") IsNot Nothing AndAlso IsNumeric(Request("TP")) AndAlso Request("TP").ToEntero > 0 Then If Request("TP") IsNot Nothing AndAlso IsNumeric(Request("TP")) AndAlso Request("TP").ToEntero > 0 Then
TipoReporte = Request("TP").ToString TipoReporte = Request("TP").ToString
' DdlTipoReporte.SelectedValue = TipoReporte.ToString
End If End If
''If DdlTipoCuentas.Items.FindByValue(IdCuenta.ToString) IsNot Nothing Then
'' DdlTipoCuentas.SelectedValue = IdCuenta.ToString
''Else
'' DdlTipoCuentas.SelectedValue = "-2"
'' TxtCuenta.Enabled = True
'' If DTCuentas.FiltraParametros(String.Format("Cvecuenta = {0}", IdCuenta)).Rows.Count > 0 Then
'' TxtCuenta.Text = DTCuentas.FiltraParametros(String.Format("CveCuenta = {0}", IdCuenta)).Rows(0)("Codigo").ToString
'' End If
''End If
End If End If
End If End If
@@ -163,23 +158,11 @@ Partial Class Conta_LibroMayor2
CargaDatos() CargaDatos()
End If End If
' Imprimir_click(sender, e)
'RegistraScript("Enable();")
End Sub End Sub
#Region "C A R G A - D A T O S" #Region "C A R G A - D A T O S"
Public Function WSCuentas() As String
Dim Str As New StringBuilder
Dim i As Integer = 0
Dim dt As DataTable = DTCuentas
For Each dr As DataRow In dt.Rows
i += 1
Str.AppendFormat("{{value:""{0}"",label:""{1}""}}{2}", dr("CveCuenta"), dr("Codigo").ToString.Replace("""", ""), If(i < dt.Rows.Count, ",", ""))
Next
Return Str.ToString
End Function
Private Sub CargaTipoCuentas() Private Sub CargaTipoCuentas()
Dim ObjTipoCuenta As New ClsContabilidad Dim ObjTipoCuenta As New ClsContabilidad
@@ -200,15 +183,11 @@ Partial Class Conta_LibroMayor2
Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProyecto.SelectedIndexChanged Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProyecto.SelectedIndexChanged
CargarSubProyecto(DdlSubproyecto, DdlProyecto.SelectedValue, "Todos") CargarSubProyecto(DdlSubproyecto, DdlProyecto.SelectedValue, "Todos")
End Sub End Sub
Private Sub CargaDatos() Private Sub CargaDatos(Optional RenderGv As Boolean = True)
Dim CveProyecto As Integer = DdlProyecto.SelectedValue.ToEntero Dim CveProyecto As Integer = DdlProyecto.SelectedValue.ToEntero
Dim CveSubProyecto As Integer = DdlSubproyecto.SelectedValue.ToEntero Dim CveSubProyecto As Integer = DdlSubproyecto.SelectedValue.ToEntero
TipoReporte = DdlTipoReporte.SelectedValue.ToString TipoReporte = DdlTipoReporte.SelectedValue.ToString
'If TipoReporte = "1" And DdlCuentas.SelectedValue.ToEntero < 0 Then
' Alert("No ha seleccionado cuenta, Favor de especificar una", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
Cuenta = DdlCuentas.SelectedItem.ToString Cuenta = DdlCuentas.SelectedItem.ToString
Dim ObjConta As New ClsContabilidad Dim ObjConta As New ClsContabilidad
@@ -216,7 +195,10 @@ Partial Class Conta_LibroMayor2
DtDatos = ObjConta.DtResultados DtDatos = ObjConta.DtResultados
DtTotales = DtDatos.Clone DtTotales = DtDatos.Clone
CargaGrid() If RenderGv Then
CargaGrid()
End If
Else Else
DtDatos = Nothing DtDatos = Nothing
End If End If
@@ -287,6 +269,11 @@ Partial Class Conta_LibroMayor2
UpDatos.Update() UpDatos.Update()
End Sub End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.Header Then
e.Row.FCLabel("LblSubProyecto").Text = LblSubProyecto.Text
End If
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("Concepto") = "" Then If e.Row.DBCampo("Concepto") = "" Then
@@ -378,7 +365,7 @@ Partial Class Conta_LibroMayor2
#End Region #End Region
Protected Sub Imprimir_click(sender As Object, e As EventArgs) Handles Imprimir.Click Protected Sub Imprimir_click(sender As Object, e As EventArgs)
If DdlCuentas.SelectedValue.ToEntero = -1 Then If DdlCuentas.SelectedValue.ToEntero = -1 Then
Alert("El campo Cuenta es obligatorio.", TipoMensaje.MsgError) Alert("El campo Cuenta es obligatorio.", TipoMensaje.MsgError)
Else Else
@@ -392,62 +379,365 @@ Partial Class Conta_LibroMayor2
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
ImprimirReporte("Excel") ImprimirReporte("Excel")
'Dim htmlTabe As New HtmlTable
'Dim RutaLogo As String = $"{UsuarioActual.Empresa.Ruta}Logo.png"
'Dim strinLiteral As String = ""
'Dim EncabezadoLiteral As New LiteralControl
'If System.IO.File.Exists(RutaLogo) Then
' RutaLogo = $"http://{Request.Url.Host }/Empresas/{UsuarioActual.CveEmpresa}/Logo.png"
' strinLiteral = $"<table style='width:{ GvDatos.Width }px'><tr>
' <td colspan='3' style='width:15%;height:150px; text-align:center; vertical-align:middle;font-weight: bold;'><img width='200px' height='150px' style='max-height:150px!important;max-width:200px!important' src='{RutaLogo}' /> </td>
' <td colspan='3' style='width:70%;height:150px; text-align:center; vertical-align:middle;font-weight: bold; display: block;'><p><span>{UsuarioActual.Empresa.Empresa} </span><br><span> Movimientos Auxiliares del Catálogo<p></td>
' <td colspan='3' style='width:15%;height:150px; text-align:center; vertical-align:middle;font-weight: bold;'> Fecha:{NowADS().ToString("dd/MM/yyyy")}</td>
' </tr>
' <tr>
' <td style='text-align:left;' colspan='6'>
' <b>Filtros Cuenta:</b> {DdlCuentas.SelectedItem.Text} <b>Fecha inicio: </b>{ TxtFechaDel.Text} <b>Fecha Fin:</b> {TxtFechaAl.Text}
' <td>
' </tr>
' </table>"
'Else
' strinLiteral = $"<table style='width:{ GvDatos.Width }px'><tr>
' <td colspan='3' style='width:15%;height:150px; text-align:center; vertical-align:middle;font-weight: bold;'> </td>
' <td colspan='3' style='width:70%;height:150px; text-align:center; vertical-align:middle;font-weight: bold; display: block;'><p><span>{UsuarioActual.Empresa.Empresa} </span><br><span> Movimientos Auxiliares del Catálogo<p></td>
' <td colspan='3' style='width:15%;height:150px; text-align:center; vertical-align:middle;font-weight: bold;'> Fecha:{NowADS().ToString("dd/MM/yyyy")}</td>
' </tr>
' <tr>
' <td style='text-align:left;' colspan='9'>
' <b>Filtros Cuenta:</b> {DdlCuentas.SelectedItem.Text} <b>Fecha inicio: </b>{ TxtFechaDel.Text} <b>Fecha Fin:</b> {TxtFechaAl.Text}
' <td>
' <tr>
' </table>"
'End If
'EncabezadoLiteral.Text = strinLiteral
'GvDatos.ExportToExcel($"MovimientosAuxiliares_{NowADS().ToString("yyyyMMddmmss")}", Encabezado2:=EncabezadoLiteral)
End Sub End Sub
Private Sub ImprimirReporte(Optional Formato As String = "PDF") Private Sub ImprimirReporte(Optional Formato As String = "PDF")
Dim params As New List(Of ReportParameter) Dim WBLibroMayor = New ClosedXML.Excel.XLWorkbook
params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa)) Dim TipoReporte = DdlTipoReporte.SelectedValue.ToEntero
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
params.Add(New ReportParameter("pImg", If(Imagen.Exists, $"file://{Imagen.FullName}", ""))) FechaInicio = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", NowADS(), txtFechaI.Text.ToDate)
params.Add(New ReportParameter("pFechaFin", FechaFin.ToString("dd/MM/yyyy"))) FechaFin = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", NowADS(), txtFechaF.Text.ToDate)
params.Add(New ReportParameter("pFechaInicio", FechaInicio.ToString("dd/MM/yyyy")))
params.Add(New ReportParameter("CveMoneda", "1")) DtDatos.Rows.Clear()
params.Add(New ReportParameter("Cuenta", Cuenta)) CargaDatos(False)
ImprimirPDF("Empresas/Grales/Formatos/RepMovimientosAuxiliaresCatalogo.rdlc", DtDatos, params, "MovimientosAuxiliares", Formato)
If DtDatos.Rows.Count > 0 Then
Dim sp As String = If(DdlSubproyecto.SelectedValue.ToEntero > 0, DdlSubproyecto.SelectedItem.Text, "")
WBLibroMayor.AddWorksheet(WSDocumento(sp, DtDatos))
WBLibroMayor.Worksheet(1).Name = $"LibroMayor"
End If
Dim msB = New MemoryStream()
WBLibroMayor.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 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:J1").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A2:J2").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A3:J3").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A4:J4").Merge().Style.Font.SetBold().Font.FontSize = Tamaniofuente
WSReporte.Range("A5:J5").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 = 15
WSReporte.Column(3).Width = 14
WSReporte.Column(4).Width = 70
WSReporte.Column(5).Width = 35
WSReporte.Column(6).Width = 20
WSReporte.Column(7).Width = 14
WSReporte.Column(8).Width = 14
WSReporte.Column(9).Width = 14
WSReporte.Column(10).Width = 14
WSReporte.Cell(1, 1).Value = UsuarioActual.Empresa.Empresa
WSReporte.Cell(2, 1).Value = $"Libro Mayor del {txtFechaI.Text} al {txtFechaF.Text}"
If SubProyecto.Length > 0 Then
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
End If
WSReporte.Cell(6, 1).Value = "Fecha"
WSReporte.Cell(6, 2).Value = $"Cuenta{vbCrLf}Tipo"
WSReporte.Cell(6, 1).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center
WSReporte.Cell(6, 2).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center
WSReporte.Cell(6, 3).Value = $"Número"
WSReporte.Cell(6, 4).Value = $"Concepto"
WSReporte.Cell(6, 5).Value = $"Referencia"
WSReporte.Cell(6, 6).Value = $"Referencia Movto"
WSReporte.Cell(6, 7).Value = $"{LblSubProyecto.Text}"
WSReporte.Cell(6, 8).Value = $"Cargos"
WSReporte.Cell(6, 9).Value = $"Abonos"
WSReporte.Cell(6, 10).Value = $"Saldo"
WSReporte.Range("A6:J6").Style.Font.Bold = True
WSReporte.Range("A6:J6").Style.Font.FontSize = 10
WSReporte.Range("A6:J6").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center)
WSReporte.Range("A6:J6").Style.Border.TopBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Range("A6:J6").Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
WSReporte.Range("A6:J6").Style.Border.RightBorder = ClosedXML.Excel.XLBorderStyleValues.Medium
Dim CuerrentRow As Integer = 7
CuerrentRow = CuerrentRow + 1
For Each Drow As DataRow In DtDatos.Rows
If Drow("Concepto").ToString = "" Then
WSReporte.Range($"A{CuerrentRow }:J{CuerrentRow }").Style.Font.Bold = True
WSReporte.Range($"A{CuerrentRow }:J{CuerrentRow }").Style.Font.FontSize = FontSize.XXLarge '35
If Drow("SaldoActual").ToString = "" Then
'CType(e.Row.FindControl("tr2"), HtmlTableRow).Visible = False
'Cuando Es Total
WSReporte.Cell(CuerrentRow, 1).Value = Drow("Codigo").ToString
WSReporte.Cell(CuerrentRow, 4).Value = Drow("Nombre").ToString
WSReporte.Cell(CuerrentRow, 9).Value = "Saldo Inicial:"
WSReporte.Cell(CuerrentRow, 10).Value = Drow("SaldoInicial").ToString
WSReporte.Cell(CuerrentRow, 10).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSReporte.Cell(CuerrentRow, 10).Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
If Drow("SaldoInicial").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 10).Style.Font.FontColor = XLColor.Red
End If
Else
'CType(e.Row.FindControl("tr1"), HtmlTableRow).Visible = False
WSReporte.Cell(CuerrentRow, 1).Value = Drow("Fecha").ToString
WSReporte.Cell(CuerrentRow, 2).Value = Drow("TipoPoliza").ToString
WSReporte.Cell(CuerrentRow, 3).Value = Drow("Folio").ToString
WSReporte.Cell(CuerrentRow, 4).Value = Drow("Concepto").ToString
WSReporte.Cell(CuerrentRow, 5).Value = Drow("Referencia").ToString
WSReporte.Cell(CuerrentRow, 6).Value = Drow("ReferenciaAdmin").ToString
WSReporte.Cell(CuerrentRow, 7).Value = Drow("SubProyecto").ToString
If TotalPadre Then
WSReporte.Cell(CuerrentRow, 5).Value = String.Format("Total {0}:", Drow("Nombre").ToString)
WSReporte.Cell(CuerrentRow, 5).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
Else
TotalPadre = True
WSReporte.Cell(CuerrentRow, 5).Style.Font.Bold = False
WSReporte.Cell(CuerrentRow, 5).Value = "Total:"
WSReporte.Cell(CuerrentRow, 5).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
End If
WSReporte.Cell(CuerrentRow, 8).Value = Drow("Cargos").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Cell(CuerrentRow, 9).Value = Drow("Abonos").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Cell(CuerrentRow, 10).Value = Drow("SaldoActual").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Range($"H{CuerrentRow}:J{CuerrentRow}").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSReporte.Range($"H{CuerrentRow}:J{CuerrentRow}").Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
If Drow("Cargos").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 8).Style.Font.FontColor = XLColor.Red
End If
If Drow("Abonos").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 9).Style.Font.FontColor = XLColor.Red
End If
If Drow("SaldoActual").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 10).Style.Font.FontColor = XLColor.Red
End If
End If
Else
WSReporte.Cell(CuerrentRow, 1).Value = Drow("Fecha").ToString
WSReporte.Cell(CuerrentRow, 2).Value = Drow("TipoPoliza").ToString
WSReporte.Cell(CuerrentRow, 3).Value = Drow("Folio").ToString
WSReporte.Cell(CuerrentRow, 4).Value = Drow("Concepto").ToString
WSReporte.Cell(CuerrentRow, 5).Value = Drow("Referencia").ToString
WSReporte.Cell(CuerrentRow, 6).Value = Drow("ReferenciaAdmin").ToString
WSReporte.Cell(CuerrentRow, 7).Value = Drow("SubProyecto").ToString
TotalPadre = False
WSReporte.Range($"A{CuerrentRow }:J{CuerrentRow }").Style.Font.Bold = False
WSReporte.Cell(CuerrentRow, 10).Value = Drow("Folio").ToString
WSReporte.Cell(CuerrentRow, 8).Value = Drow("CargosMovto").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Cell(CuerrentRow, 9).Value = Drow("AbonosMovto").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Cell(CuerrentRow, 10).Value = Drow("Saldo").ToString.FormatoNumero(If("1" = "1", 2, 4))
WSReporte.Range($"H{CuerrentRow}:J{CuerrentRow}").Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Right)
WSReporte.Range($"H{CuerrentRow}:J{CuerrentRow}").Style.NumberFormat.Format = "#,##0.00; [Black] - #,##0.00 ;""-"""
If Drow("CargosMovto").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 8).Style.Font.FontColor = XLColor.Red
End If
If Drow("AbonosMovto").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 9).Style.Font.FontColor = XLColor.Red
End If
If Drow("Saldo").ToString.ToDecimal < 0 Then
WSReporte.Cell(CuerrentRow, 10).Style.Font.FontColor = XLColor.Red
End If
End If
CuerrentRow = CuerrentRow + 1
Next
For xy As Integer = 6 To CuerrentRow
WSReporte.Cell(xy, 10).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.Range($"A{CuerrentRow}:J{CuerrentRow}").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, "LibroMayor")
Return WBReporte.Worksheet(1)
End Function
Public Function CloneGridView(ByVal originalGridView As GridView) As GridView
' Crear un nuevo GridView
Dim clonedGridView As New GridView()
' Copiar propiedades básicas del GridView
clonedGridView.ID = originalGridView.ID & "_Copy"
clonedGridView.AutoGenerateColumns = originalGridView.AutoGenerateColumns
clonedGridView.CssClass = originalGridView.CssClass
clonedGridView.GridLines = originalGridView.GridLines
clonedGridView.HeaderStyle.CopyFrom(originalGridView.HeaderStyle)
clonedGridView.RowStyle.CopyFrom(originalGridView.RowStyle)
clonedGridView.AlternatingRowStyle.CopyFrom(originalGridView.AlternatingRowStyle)
clonedGridView.FooterStyle.CopyFrom(originalGridView.FooterStyle)
clonedGridView.EmptyDataText = originalGridView.EmptyDataText
clonedGridView.ShowHeader = originalGridView.ShowHeader
clonedGridView.ShowFooter = originalGridView.ShowFooter
' Copiar columnas
For Each col As DataControlField In originalGridView.Columns
' Crear una copia de la columna
Dim clonedCol As DataControlField = CType(Activator.CreateInstance(col.GetType()), DataControlField)
clonedCol.HeaderStyle.CopyFrom(col.HeaderStyle)
clonedCol.ItemStyle.CopyFrom(col.ItemStyle)
clonedCol.FooterStyle.CopyFrom(col.FooterStyle)
' Si es un BoundField, copiar propiedades específicas
If TypeOf col Is BoundField Then
Dim originalBoundField As BoundField = CType(col, BoundField)
Dim clonedBoundField As BoundField = CType(clonedCol, BoundField)
clonedBoundField.DataField = originalBoundField.DataField
clonedBoundField.HeaderText = originalBoundField.HeaderText
clonedBoundField.SortExpression = originalBoundField.SortExpression
clonedBoundField.ReadOnly = originalBoundField.ReadOnly
End If
' Añadir la columna clonada al nuevo GridView
clonedGridView.Columns.Add(clonedCol)
Next
' Copiar el DataSource (opcional, dependiendo de si deseas copiar los datos actuales)
clonedGridView.DataSource = originalGridView.DataSource
clonedGridView.DataBind()
Return clonedGridView
End Function
Public Overrides Sub VerifyRenderingInServerForm(control As Control) Public Overrides Sub VerifyRenderingInServerForm(control As Control)
End Sub End Sub

View File

@@ -3,16 +3,22 @@
<asp:Content ID="Content1" ContentPlaceHolderID="H" runat="Server"> <asp:Content ID="Content1" ContentPlaceHolderID="H" runat="Server">
<li> <li>
<asp:LinkButton ID="ImgExcel" runat="server"><i class="fa fa-ad-excel"></i> Exporta Excel</asp:LinkButton> <asp:LinkButton ID="ImgExcel" runat="server"><i class="fa fa-file-excel-o"></i> Exporta Excel</asp:LinkButton>
<%--<asp:ImageButton ID="ImgExcel" runat="server" ImageUrl="/Imagenes/IconoExcel.gif" Width="20px" Height="20px" />&nbsp; &nbsp;--%> <%--<asp:ImageButton ID="ImgExcel" runat="server" ImageUrl="/Imagenes/IconoExcel.gif" Width="20px" Height="20px" />&nbsp; &nbsp;--%>
</li> </li>
<li>
<a id="BtnImprimirPoSubProyecto" runat="server" href="javascript:void(0);" onclick="javascript:BtnImprimirPoSubProyecto_Click(); return false;" >
<i class="fa fa-file-excel-o"></i> Exportar por <asp:Label runat="server" ID="LblAccionesSubProyecto" ></asp:Label>
</a>
<div style="display:none">
<asp:Button runat="server" ID="BtnImprimirPorsubProyecto" OnClick="BtnImprimirPorsubProyecto_Click" ClientIDMode="Static" />
</div>
</li>
<li> <li>
<asp:LinkButton ID="BtnImprimir" runat="server"><i class="fa fa-print"></i> Imprimir</asp:LinkButton> <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;--%> <%--<asp:ImageButton ID="BtnImprimir" runat="server" alt="Imprimir" src="/Imagenes/btnImprimir.gif" Style="cursor: pointer; height: 20px" Visible="true" /> &nbsp;--%>
</li> </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>
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server"> <asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
@@ -218,3 +224,63 @@
</asp:Content> </asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="JS" runat="Server">
<script>
function BtnImprimirPoSubProyecto_Click() {
setTimeout(checkFileStatus, 5000);
$('#BtnImprimirPorsubProyecto').click();
//checkFileStatus();
}
function callMyStaticFunction() {
$.ajax({
type: "POST",
url: "MyPage.aspx/MyStaticFunction",
data: JSON.stringify({ parameter: "TuParametro" }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
alert("Resultado: " + response.d);
},
error: function (xhr, status, error) {
console.error("Error: " + error);
}
});
}
function checkFileStatus() {
//$.ajax({
// url: 'RepBalanzaComprobacion.aspx',
// success: function (response) {
// setTimeout(checkFileStatus, 20000);
// }
//});
$.ajax({
type: "POST",
url: 'RepBalanzaComprobacion.aspx',
data: JSON.stringify({ parameter: "TuParametro" }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
//alert("Resultado: " + response.d);
setTimeout(checkFileStatus, 20000);
},
error: function (xhr, status, error) {
console.error("Error: " + error);
}
});
}
</script>
</asp:Content>

View File

@@ -9,6 +9,7 @@ Imports ClosedXML.Excel
Imports Profact.TimbraCFDI40 Imports Profact.TimbraCFDI40
Imports System.IO Imports System.IO
Imports System.Drawing Imports System.Drawing
Imports System.Web.Services
@@ -111,9 +112,7 @@ Partial Class Contabilidad2_RepBalanzaComprobacion
End If End If
CargarCentrosDeCosto(DdlProyecto, DdlSubproyecto, LblProyecto, LblSubProyecto) CargarCentrosDeCosto(DdlProyecto, DdlSubproyecto, LblProyecto, LblSubProyecto)
If UsuarioActual.CveRol = 1 Then LblAccionesSubProyecto.Text = LblSubProyecto.Text
BtnImprimirPoSubProyecto.Visible = True
End If
End If End If
End Sub End Sub
@@ -265,52 +264,11 @@ Partial Class Contabilidad2_RepBalanzaComprobacion
End Sub End Sub
Protected Sub BtnImprimirPoSubProyecto_Click(sender As Object, e As EventArgs) '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() 'End Sub
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 Function WSDocumento(SubProyecto As String, DtDatos As DataTable) As IXLWorksheet
@@ -498,4 +456,59 @@ Partial Class Contabilidad2_RepBalanzaComprobacion
End Function End Function
Protected Sub BtnImprimirPorsubProyecto_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
Dim DtSP As DataTable = GlobalDTSubProyectos(UsuarioActual.CveEmpresa, Estatus:=-1).FiltraParametros("", "SubProyecto")
For Each drSP As DataRow In DtSP.Rows
Dim ObjConta As New ClsContabilidad
If ObjConta.GetBalanzaComprobacion(FechaInicio, FechaFin, 1, 1, -1, drSP("CveSubProyecto").ToString.ToEntero, UsuarioActual.CveEmpresa, 0, -1) 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.Write("Ready")
Response.End()
End Sub
<WebMethod>
Public Shared Function MyStaticFunction(ByVal parameter As String) As String
' Lógica de tu función aquí
Return "Resultado: " & parameter
End Function
End Class End Class

View File

@@ -72,16 +72,16 @@
<TablixBody> <TablixBody>
<TablixColumns> <TablixColumns>
<TablixColumn> <TablixColumn>
<Width>1.94437cm</Width> <Width>1.09771cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>3.27787cm</Width> <Width>3.27787cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>2.19837cm</Width> <Width>1.5514cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>9.27592cm</Width> <Width>10.76955cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>1.41521cm</Width> <Width>1.41521cm</Width>
@@ -187,7 +187,7 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Unidad Medida</Value> <Value>U.M.</Value>
<Style> <Style>
<FontSize>8pt</FontSize> <FontSize>8pt</FontSize>
<FontWeight>Bold</FontWeight> <FontWeight>Bold</FontWeight>
@@ -363,13 +363,13 @@
<Value>=Fields!Cantidad.Value</Value> <Value>=Fields!Cantidad.Value</Value>
<Style> <Style>
<FontSize>8pt</FontSize> <FontSize>8pt</FontSize>
<Format>#,0</Format> <Format>#,0.######</Format>
<Language>es-MX</Language> <Language>es-MX</Language>
</Style> </Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style> <Style>
<TextAlign>Left</TextAlign> <TextAlign>Right</TextAlign>
</Style> </Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
@@ -503,7 +503,7 @@
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style> <Style>
<TextAlign>Left</TextAlign> <TextAlign>Right</TextAlign>
</Style> </Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
@@ -537,7 +537,7 @@
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style> <Style>
<TextAlign>Left</TextAlign> <TextAlign>Right</TextAlign>
</Style> </Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
@@ -552,6 +552,7 @@
<PaddingTop>=IIf(rownumber(nothing) = 1, "2pt", "0pt")</PaddingTop> <PaddingTop>=IIf(rownumber(nothing) = 1, "2pt", "0pt")</PaddingTop>
</Style> </Style>
</Textbox> </Textbox>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
</TablixCells> </TablixCells>

View File

@@ -1673,11 +1673,14 @@
<asp:RequiredFieldValidator ID="RFVCantidad" runat="server" ControlToValidate="txtCantidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario, por favor ingréselo." <asp:RequiredFieldValidator ID="RFVCantidad" runat="server" ControlToValidate="txtCantidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpAgregarPS"></asp:RequiredFieldValidator> ValidationGroup="GrpAgregarPS"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOCantidad1" runat="server" HighlightCssClass="vco" TargetControlID="RFVCantidad" Width="300px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="VCOCantidad1" runat="server" HighlightCssClass="vco" TargetControlID="RFVCantidad" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVCantidad" runat="server" ClientValidationFunction="ValidaDecimal6digitsM0" ControlToValidate="TxtCantidad" Display="None" <asp:CustomValidator ID="CVCantidad" runat="server" ClientValidationFunction="ValidaDecimal6digitsM0" ControlToValidate="TxtCantidad" Display="None"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> no tiene el formato correcto (6 decimales) y mayor a cero. Por favor rectifique y vuelva a intentar." ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> no tiene el formato correcto (6 decimales) y mayor a cero. Por favor rectifique y vuelva a intentar."
ValidateEmptyText="True" ValidationGroup="GrpAgregarPS"></asp:CustomValidator> ValidateEmptyText="True" ValidationGroup="GrpAgregarPS"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VCECantidad" runat="server" HighlightCssClass="vco" TargetControlID="CVCantidad" Width="300px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="VCECantidad" runat="server" HighlightCssClass="vco" TargetControlID="CVCantidad" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= txtCantidad.ClientID.ToString()%>">Cantidad</label> <label for="<%= txtCantidad.ClientID.ToString()%>">Cantidad</label>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
@@ -1982,8 +1985,8 @@
function ValidaDecimal6digitsM0(val, args) { function ValidaDecimal6digitsM0(val, args) {
if (args.Value.match(/^[1-9]\d*(\.\d{1,6})?$/)) if (args.Value.match(/^(0|[1-9]\d*)(\.\d{1,6})?$/))
args.IsValid = true; args.IsValid = true;
else else
args.IsValid = false; args.IsValid = false;

View File

@@ -284,9 +284,12 @@
<div class="input-group"> <div class="input-group">
<asp:DropDownList runat="server" ID="DdlSubProyectoModal" Width="100%" DataValueField="CveSubProyecto" DataTextField="SubProyecto" CssClass="select2me"></asp:DropDownList> <asp:DropDownList runat="server" ID="DdlSubProyectoModal" Width="100%" DataValueField="CveSubProyecto" DataTextField="SubProyecto" CssClass="select2me"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RfvDdlSubProyectoModal" runat="server" ControlToValidate="DdlSubProyectoModal" InitialValue="-1" ErrorMessage="Campo sub Proyecto requerido." <asp:RequiredFieldValidator ID="RfvDdlSubProyectoModal" runat="server" ControlToValidate="DdlSubProyectoModal" InitialValue="-1" ErrorMessage="Campo sub Proyecto requerido." Display="None"
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator> ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCERfvDdlSubProyectoModal" runat="server" HighlightCssClass="vco" TargetControlID="RfvDdlSubProyectoModal" Width="300px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="VceRfvDdlSubProyectoModal" runat="server" HighlightCssClass="vco" TargetControlID="RfvDdlSubProyectoModal" Width="300px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco"
TargetControlID="RFVTipoAF" Width="400px">
</ajax:ValidatorCalloutExtender>
<%-- <div class="input-group-addon" style="background-color: #428bca"> <%-- <div class="input-group-addon" style="background-color: #428bca">
<asp:LinkButton runat="server" ForeColor="White" Text="<i class='fa fa-add'></i>" <asp:LinkButton runat="server" ForeColor="White" Text="<i class='fa fa-add'></i>"
@@ -409,7 +412,7 @@
DataValueField="CveTipoActivoFijo" Class="table-group-action-input form-control input-inline select2me" DataValueField="CveTipoActivoFijo" Class="table-group-action-input form-control input-inline select2me"
Width="100%" runat="server"> Width="100%" runat="server">
</asp:DropDownList> </asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVTipoAF" runat="server" ControlToValidate="DdlTipoAF" <asp:RequiredFieldValidator ID="RFVTipoAF" runat="server" ControlToValidate="DdlTipoAF" InitialValue="-1"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo de Unidad''</b> es necesario, por favor ingréselo." Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo de Unidad''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator> ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCETipoAF" runat="server" HighlightCssClass="vco" <ajax:ValidatorCalloutExtender ID="VCETipoAF" runat="server" HighlightCssClass="vco"

View File

@@ -119,6 +119,7 @@ Partial Class ListadoContratos
'Dim CveSubProyecto As Integer = GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", "TipoSucursal = 1").ToEntero 'Dim CveSubProyecto As Integer = GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", "TipoSucursal = 1").ToEntero
'Agregamos Contrato 'Agregamos Contrato
Exit Sub
Dim ObjContratos As New ClsContratos Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL() ObjContratos.IniciaTransacSQL()

View File

@@ -931,85 +931,91 @@
updateEventOnDropResize(event); updateEventOnDropResize(event);
} }
function Calendario(mes = -1, anio = -1) { function Calendario(mes = -1, anio = -1) {
let fechaActual = new Date(); let fechaActual = new Date();
if (mes === -1) { if (mes === -1) {
mes = fechaActual.getMonth() + 1; mes = fechaActual.getMonth() + 1;
} }
if (anio === -1) { if (anio === -1) {
anio = fechaActual.getFullYear(); anio = fechaActual.getFullYear();
} }
let mesFormateado = ('0' + mes).slice(-2); let mesFormateado = ('0' + mes).slice(-2);
let fechaInicio = `${anio}-${mesFormateado}-01`; let fechaInicio = `${anio}-${mesFormateado}-01`;
var date = new Date(); var date = new Date();
var d = date.getDate(); var d = date.getDate();
var m = date.getMonth(); var m = date.getMonth();
var y = date.getFullYear(); var y = date.getFullYear();
var h = {}; var h = {};
//alert(fechaInicio); //alert(fechaInicio);
if ($('#calendar').width() <= 400) { if ($('#calendar').width() <= 400) {
$('#calendar').addClass("mobile"); $('#calendar').addClass("mobile");
h = { h = {
left: 'title, prev, next', left: 'title, prev, next',
center: '', center: '',
right: 'today,month,agendaWeek,agendaDay' right: 'today,month,agendaWeek,agendaDay'
}; };
} else { } else {
$('#calendar').removeClass("mobile"); $('#calendar').removeClass("mobile");
h = { h = {
left: 'title', left: 'title',
center: '', center: '',
right: 'prev,next,today,month,agendaWeek,agendaDay' right: 'prev,next,today,month,agendaWeek,agendaDay'
}; };
} }
$('#calendar').fullCalendar('destroy'); $('#calendar').fullCalendar('destroy');
$('#calendar').fullCalendar({ $('#calendar').fullCalendar({
defaultDate: fechaInicio, defaultDate: fechaInicio,
header: h, header: h,
monthNames: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"], monthNames: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
monthNamesShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'], monthNamesShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
dayNames: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'], dayNames: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb'], dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb'],
buttonText: { buttonText: {
today: 'Hoy', today: 'Hoy',
week: 'Semana', week: 'Semana',
month: 'Mes', month: 'Mes',
day: 'Día' day: 'Día'
}, },
eventClick: updateEvent, eventClick: updateEvent,
selectable: true, selectable: true,
selectHelper: true, selectHelper: true,
select: selectDate, select: selectDate,
editable: true, editable: true,
minTime: "00:00:00", minTime: "00:00:00",
maxTime: "24:00:00", maxTime: "24:00:00",
eventOverlap: false, // No permitir la superposición de eventos eventOverlap: false, // No permitir la superposición de eventos
slotEventOverlap: false, // No permitir la superposición en vistas de agenda slotEventOverlap: false, // No permitir la superposición en vistas de agenda
eventRender: function (event, element) { eventRender: function (event, element) {
element.css({ element.css({
'margin-bottom': '1px', 'margin-bottom': '1px',
'margin-left': '1px', 'margin-left': '1px',
'white-space': 'normal', // Permitir el ajuste de texto 'white-space': 'normal', // Permitir el ajuste de texto
'height': 'auto', // Ajustar la altura automáticamente 'height': 'auto', // Ajustar la altura automáticamente
'overflow': 'hidden' // Ocultar cualquier desbordamiento 'overflow': 'hidden' // Ocultar cualquier desbordamiento
}); });
element.find('.fc-title').css({ element.find('.fc-title').css({
'white-space': 'normal', // Asegurar que el texto se ajuste 'white-space': 'normal', // Asegurar que el texto se ajuste
'line-height': '1.2em' // Ajustar la altura de línea para mejor legibilidad 'line-height': '1.2em' // Ajustar la altura de línea para mejor legibilidad
}); });
},
events: { var firstFourChars = event.title.substring(0, 4);
url: '/Ashx/CargaEventos.ashx', var restOfTitle = event.title.substring(4);
type: 'GET',
data: { // Aplica el HTML personalizado al elemento del título del evento
U: ' <%= UsuarioActual.CveUsuario %>', //element.find('.fc-title').html('<span style="color:' + event.colorfont +';">' + firstFourChars + '</span>' + restOfTitle);
},
events: {
url: '/Ashx/CargaEventos.ashx',
type: 'GET',
data: {
U: ' <%= UsuarioActual.CveUsuario %>',
E: '<%= UsuarioActual.CveEmpresa %>', E: '<%= UsuarioActual.CveEmpresa %>',
tipoVista: '<%= RBTipoVista.Text %>', tipoVista: '<%= RBTipoVista.Text %>',
METODO: 'contrato_transportes', METODO: 'contrato_transportes',
@@ -1023,15 +1029,16 @@
}, },
eventDrop: eventDropped, eventDrop: eventDropped,
eventResize: eventResized, eventResize: eventResized,
viewRender: function(view, element) { viewRender: function (view, element) {
let pointDate = view.intervalStart; let pointDate = view.intervalStart;
let currentMonth = pointDate.month() + 1; let currentMonth = pointDate.month() + 1;
let currentYear = pointDate.year(); let currentYear = pointDate.year();
$('#<%=HidCurrentMonth.ClientID%>').val(currentMonth); $('#<%=HidCurrentMonth.ClientID%>').val(currentMonth);
$('#<%=HidCurrentYear.ClientID%>').val(currentYear); $('#<%=HidCurrentYear.ClientID%>').val(currentYear);
} }
}); });
} }