This commit is contained in:
Oscar Irigoyen
2023-01-19 20:52:45 -07:00
10 changed files with 275 additions and 193 deletions

View File

@@ -3910,7 +3910,7 @@ Public Class ClsGenerales
Public Function AddInvEntregaAlmacenRuta(CveSubProyecto As Integer, CveDireccionOrigen As Integer, CveDireccionDestino As Integer, CveMovimientoAlmacen As Integer, CveChofer As Integer, CveCamion As Integer, FechaEntrega As Date, FechaLlegada As DateTime, Tipo As String,
FolioReferencia As String, Referencia As String, FechaLimite As Date, Orden As Integer, Estatus As Integer, Distancia As Integer, Optional CveConfigAutoTransporte As Integer = -1,
Optional CveCamionRemolque1 As Integer = -1, Optional CveCamionRemolque2 As Integer = -1) As Integer
Optional CveCamionRemolque1 As Integer = -1, Optional CveCamionRemolque2 As Integer = -1, Optional CveCliente As Integer = -1) As Integer
Dim Retorno As Integer = -1
DataAdapter("PA_Inv_EntregaAlmacenRutaAdd")
@@ -3936,6 +3936,7 @@ Public Class ClsGenerales
.Add("@CveCamionRemolque1", SqlDbType.Int).Value = CveCamionRemolque1
.Add("@CveCamionRemolque2", SqlDbType.Int).Value = CveCamionRemolque2
.Add("@CveConfigAutoTransporte", SqlDbType.Int).Value = CveConfigAutoTransporte
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveEntregaAlmacen", SqlDbType.Int).Direction = ParameterDirection.Output
End With

View File

@@ -2,16 +2,17 @@
Option Explicit On
Option Strict On
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Extensiones
Public Class ClsMovimientos
Implements IDisposable
Implements IDisposable
#Region "Campos"
'SQL
'SQL
Private SqlConexion As SqlConnection
Private SqlAdapter As SqlDataAdapter
Private SqlTransacc As SqlTransaction
@@ -20,12 +21,12 @@ Public Class ClsMovimientos
Private DS As DataSet
'Atributos de la clase
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
'REGISTRAR CONEXIONES ABIERTAS
Private CveConexion As Integer = 0
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
'REGISTRAR CONEXIONES ABIERTAS
Private CveConexion As Integer = 0
#End Region
#Region "Propiedades"
Public ReadOnly Property DtResultados() As DataTable
Get
@@ -36,12 +37,13 @@ Public Class ClsMovimientos
Public ReadOnly Property DSResultados() As DataSet
Get
DSResultados = DS
End Get
End Get
End Property
Public Property AlertaMensaje As New StringBuilder
Public Property AlertaMensaje As New StringBuilder
#End Region
Sub New()
SqlConexion = New SqlConnection
SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString
@@ -62,9 +64,10 @@ Public Class ClsMovimientos
End With
If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
Data = New DataTable
End Sub
End Sub
#Region "Conexiones"
Private Sub ConexionAdd()
If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
Try
@@ -97,9 +100,9 @@ Public Class ClsMovimientos
CveConexion = 0
End If
End Sub
End Sub
#End Region
Public Sub IniciaTransacSQL()
SqlTransacc = SqlConexion.BeginTransaction()
End Sub
@@ -485,13 +488,13 @@ Public Class ClsMovimientos
Retorno = True
Catch ex As SqlException
OnError("Ocurrió un error al descargar los segmentos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
End Try
Return Retorno
End Function
End Function
#End Region
#Region "Anticipos de Clientes"
Public Function GetAnticiposCliente(CveCliente As Integer, Optional SelectTop As Integer = -1, Optional CveMoneda As Integer = 1) As Boolean
Dim Retorno As Boolean = False
@@ -569,12 +572,14 @@ Public Class ClsMovimientos
End Try
Return Retorno
End Function
End Function
#End Region
#Region "CxP"
Public Function GetCxPEmpresa(CveProveedor As Integer, FechaVencimientoInicio As String, FechaVencimientoFin As String, CveSubProyecto As Integer, DiasVencidos As Integer, CveUsuarioRegistro As Integer,
CveUsuarioProgramo As Integer, CveUsuarioResponsable As Integer, CveClasificacion As Integer, CveMoneda As Integer, CveTipoPagoProgramo As Integer, CveEstatusFactura As Integer,
CveAplicaNC As Integer, CveEmpresa As Integer, Optional FechaVI As String = "-1", Optional FechaVF As String = "-1", Optional CodigoProgramacion As String = "-1", Optional CveTipoProveedor As Integer = 0,
@@ -1201,6 +1206,29 @@ Public Class ClsMovimientos
Return Retorno
End Function
Public Function GetDocumentosxPagarDetalle(CveCliente As Integer, CveMoneda As Integer, Opcion As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Banc_DocumentosxPagarSaldosDetalle")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda
.Add("@Opcion", SqlDbType.Int).Value = Opcion
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener el Reporte de documentos por pagar.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function GetCajaChicaDetalle(CveCajaChica As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
@@ -1462,9 +1490,9 @@ Public Class ClsMovimientos
End Try
Return Retorno
End Function
End Function
#End Region
#Region "Anticipos de Proveedores"
Public Function GetAnticiposProveedor(CveProveedor As Integer, CveProveedorSucursal As Integer, Optional CveMoneda As Integer = -1, Optional SelectTop As Integer = -1, Optional FechaI As String = "-1", Optional FechaF As String = "-1", Optional TipoDocto As String = "-1") As Boolean
Dim Retorno As Boolean = False
@@ -1486,33 +1514,32 @@ Public Class ClsMovimientos
Retorno = True
Catch ex As SqlException
OnError("Ocurrió un error al consultar los Anticipos del proveedor.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
'Public Function GetAnticiposClienteAuxiliar(CveCliente As Integer, CveVenta As Integer) As Boolean
' Dim Retorno As Boolean = False
' 'Data = New DataTable
' 'SqlAdapter = New SqlDataAdapter("PA_ClienteAnticiposAuxiliar", SqlConexion)
' 'SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
' DataAdapter("PA_ClienteAnticiposAuxiliar")
' With SqlAdapter.SelectCommand.Parameters
' .Add("@CveCliente", SqlDbType.Int).Value = CveCliente
' .Add("@CveVenta", SqlDbType.Int).Value = CveVenta
' End With
' Try
' SqlAdapter.Fill(Data)
' Retorno = True
' Catch ex As SqlException
' OnError("Ocurrió un error al consultar el Auxiliar Contable de Anticipos del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
' End Try
' Return Retorno
'End Function
End Try
Return Retorno
End Function
'Public Function GetAnticiposClienteAuxiliar(CveCliente As Integer, CveVenta As Integer) As Boolean
' Dim Retorno As Boolean = False
' 'Data = New DataTable
' 'SqlAdapter = New SqlDataAdapter("PA_ClienteAnticiposAuxiliar", SqlConexion)
' 'SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
' DataAdapter("PA_ClienteAnticiposAuxiliar")
' With SqlAdapter.SelectCommand.Parameters
' .Add("@CveCliente", SqlDbType.Int).Value = CveCliente
' .Add("@CveVenta", SqlDbType.Int).Value = CveVenta
' End With
' Try
' SqlAdapter.Fill(Data)
' Retorno = True
' Catch ex As SqlException
' OnError("Ocurrió un error al consultar el Auxiliar Contable de Anticipos del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
' End Try
' Return Retorno
'End Function
#End Region
#Region "REP RECUPERACION"
Public Function GetRepRecuperacion(FechaI As Date, FechaF As Date, CveCliente As Integer, CveSubProyecto As Integer,
CveVendedor As Integer, CveUsuario As Integer, CveEstatus As Integer, IVA As String,
@@ -1658,9 +1685,9 @@ Public Class ClsMovimientos
End Try
Return Retorno
End Function
End Function
#End Region
#Region "REP COBRADO"
Public Function GetRepCobrado(FechaI As Date, FechaF As Date, CveProveedor As Integer, CveSubProyecto As Integer,
CveUsuario As Integer, IVA As String, CveEmpresa As Integer, Gpo As Integer, CveResponsable As Integer,
@@ -1730,11 +1757,13 @@ Public Class ClsMovimientos
End Try
Return Retorno
End Function
End Function
#End Region
#Region "EDITAR FECHA DE MOVIMIENTO"
Public Function UpdateMovimientoFecha(Fecha As DateTime, CveMovimiento As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Mov_MovimientoFechaUpdate")
@@ -1749,12 +1778,16 @@ Public Class ClsMovimientos
OnError("Ocurrió un error al actualizar la fecha del movimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
End Function
#End Region
#Region "Registros Contables"
Public Function AddMovimiento(CveConcepto As Integer, Tipo As String, Referencia1 As String, Referencia2 As String, CveMoneda As Integer, Cargo As Double, Abono As Double,
Fecha As Date, FechaVencimiento As Date, Folio As String, IdCtaContable As Integer, CveUsuario As Integer, CveEmprea As Integer) As Boolean
Dim Retorno As Boolean = False
@@ -1828,14 +1861,14 @@ Public Class ClsMovimientos
End Try
Return Retorno
End Function
End Function
#End Region
#Region "IDisposable Support"
' IDisposable
' IDisposable
Protected Overridable Sub Dispose(disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
@@ -1868,9 +1901,10 @@ Public Class ClsMovimientos
ConexionClose()
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
End Sub
#End Region
Public Function GetPersonalCajaChica(CveEmpresa As Integer, CveCompra As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_PersonalCajaChica")

View File

@@ -145,6 +145,26 @@ Namespace Extensiones
End If
End Function
Public Function Truncate(value As String, length As Integer) As String
' If argument is too big, return the original string.
' ... Otherwise take a substring from the string's start index.
If length > value.Length Then
Return value
Else
Return value.Substring(0, length)
End If
End Function
Public Function ValidFileName(name As String, Optional maxChars As Integer = -1) As String
For Each c As Char In System.IO.Path.GetInvalidFileNameChars()
name = name.Replace(c.ToString(), "_")
Next
If maxChars > 0 AndAlso maxChars < 256 Then
Return Truncate(name, maxChars)
End If
Return Truncate(name, 255)
End Function
Public Class RespuestaCancelacionSAT
Public Property Verificado As Boolean = False
Public Property CveEstatus As Integer = 0
@@ -2516,7 +2536,7 @@ Namespace Extensiones
Dim sw As New StringWriter()
Dim htw As New HtmlTextWriter(sw)
Gv.RenderControl(htw)
GemBox.Spreadsheet.SpreadsheetInfo.SetLicense("ESWN-4QFD-26JF-1SZ8")
GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet)
Dim excel As GemBox.Spreadsheet.ExcelFile
Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault
@@ -2527,9 +2547,11 @@ Namespace Extensiones
Dim TotalRowFooter As Integer = 2
Dim worksheet = excel.Worksheets(0)
worksheet.Name = ValidFileName(NombreArchivoXLSx, 31)
worksheet.Rows.InsertEmpty(0, TotalRowHeader)
Dim celdasConTexto = worksheet.GetUsedCellRange(True)
celdasConTexto.Style.Font.Name = "Calibri Light"
celdasConTexto.Style.Borders = Nothing
Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex)
RangoNombreEmpresa.Merged = True
@@ -2539,7 +2561,6 @@ Namespace Extensiones
RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
Dim RangoFiltros = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex)
RangoFiltros.Merged = True
RangoFiltros.Value = Filtros
@@ -2548,27 +2569,28 @@ Namespace Extensiones
RangoFiltros.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left
RangoFiltros.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex)
RangoTitulo.Merged = True
RangoTitulo.Value = Titulo
RangoTitulo.Style.Font.Size = 20 * 20
RangoTitulo.Style.Font.Name = "Calibri Light"
RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
Dim RangoColTitulos = worksheet.Cells.GetSubrangeAbsolute(8, celdasConTexto.FirstColumnIndex, 8, celdasConTexto.LastColumnIndex)
RangoColTitulos.Style.Font.Size = 12 * 20
RangoColTitulos.Style.Font.Name = "Calibri"
RangoColTitulos.Style.Font.Weight = GemBox.Spreadsheet.ExcelFont.BoldWeight
RangoColTitulos.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoColTitulos.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
RangoColTitulos.Style.FillPattern.SetSolid(GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190))
RangoColTitulos.Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20
worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255))
worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
If i > 0 Then
Try
worksheet.Columns(i).AutoFit(1)
Catch ex As Exception
End Try
End If
Try
worksheet.Columns(i).AutoFit(0.95)
Catch ex As Exception
End Try
Next
Dim IndexEndTable As Integer = Gv.Rows.Count + TotalRowHeader + TotalRowFooter
@@ -2579,10 +2601,10 @@ Namespace Extensiones
worksheet.Rows(IndexEndTable).Cells(6).Value = "Fecha Impresión"
worksheet.Rows(IndexEndTable + 1).Cells(6).Value = DateTime.Now.ToString("dd/MM/yyyy")
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta))
Dim Imagen As New System.IO.FileInfo($"{Usuario.Empresa.Ruta}/Logo.png")
If Imagen.Exists Then
Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)
Dim Ruta As String = $"{Usuario.Empresa.Ruta}/Logo.png"
Using sr As New StreamReader(Ruta)
Dim ms As New MemoryStream()
sr.BaseStream.CopyTo(ms)
@@ -2597,6 +2619,96 @@ Namespace Extensiones
excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx")
End Sub
<Runtime.CompilerServices.Extension()>
Public Sub ExportToExcelG(Dt As DataTable, NombreArchivoXLSx As String, Optional Titulo As String = "Reporte", Optional Usuario As Usuario = Nothing, Optional Filtros As String = "", Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100)
GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet)
If Dt.TableName Is Nothing Then Dt.TableName = NombreArchivoXLSx
Dim excel As New GemBox.Spreadsheet.ExcelFile
Dim item = excel.Worksheets.Add(ValidFileName(Dt.TableName, 31))
item.InsertDataTable(Dt, New InsertDataTableOptions() With
{
.ColumnHeaders = True,
.StartRow = 0,
.StartColumn = 0
})
If Usuario IsNot Nothing Then
Dim TotalRowHeader As Integer = 8
Dim TotalRowFooter As Integer = 2
Dim worksheet = excel.Worksheets(0)
'worksheet.Name = ValidFileName(NombreArchivoXLSx, 31)
worksheet.Rows.InsertEmpty(0, TotalRowHeader)
Dim celdasConTexto = worksheet.GetUsedCellRange(True)
celdasConTexto.Style.Font.Name = "Calibri Light"
celdasConTexto.Style.Borders = Nothing
Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex)
RangoNombreEmpresa.Merged = True
RangoNombreEmpresa.Value = Usuario.Empresa.Empresa
RangoNombreEmpresa.Style.Font.Size = 18 * 20
RangoNombreEmpresa.Style.Font.Name = "Calibri Light"
RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
Dim RangoFiltros = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex)
RangoFiltros.Merged = True
RangoFiltros.Value = Filtros
RangoFiltros.Style.Font.Size = 15 * 20
RangoFiltros.Style.Font.Name = "Calibri Light"
RangoFiltros.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left
RangoFiltros.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex)
RangoTitulo.Merged = True
RangoTitulo.Value = Titulo
RangoTitulo.Style.Font.Size = 20 * 20
RangoTitulo.Style.Font.Name = "Calibri Light"
RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
Dim RangoColTitulos = worksheet.Cells.GetSubrangeAbsolute(8, celdasConTexto.FirstColumnIndex, 8, celdasConTexto.LastColumnIndex)
RangoColTitulos.Style.Font.Size = 12 * 20
RangoColTitulos.Style.Font.Name = "Calibri"
RangoColTitulos.Style.Font.Weight = GemBox.Spreadsheet.ExcelFont.BoldWeight
RangoColTitulos.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoColTitulos.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
RangoColTitulos.Style.FillPattern.SetSolid(GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190))
RangoColTitulos.Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
Try
worksheet.Columns(i).AutoFit(0.95)
Catch ex As Exception
End Try
Next
Dim IndexEndTable As Integer = Dt.Rows.Count + TotalRowHeader + TotalRowFooter
worksheet.Rows(IndexEndTable).Cells(2).Value = "Usuario Imprimió"
worksheet.Rows(IndexEndTable + 1).Cells(2).Value = Usuario.Nombre
worksheet.Rows(IndexEndTable).Cells(6).Value = "Fecha Impresión"
worksheet.Rows(IndexEndTable + 1).Cells(6).Value = DateTime.Now.ToString("dd/MM/yyyy")
Dim Imagen As New System.IO.FileInfo($"{Usuario.Empresa.Ruta}/Logo.png")
If Imagen.Exists Then
Dim Ruta As String = $"{Usuario.Empresa.Ruta}/Logo.png"
Using sr As New StreamReader(Ruta)
Dim ms As New MemoryStream()
sr.BaseStream.CopyTo(ms)
worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel)
End Using
End If
End If
excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx")
End Sub
Private Sub RecursivoLimpiaControlesExcel(Controls As ControlCollection)
For Each c As Control In Controls

View File

@@ -280,114 +280,21 @@ Partial Class Compras_CatProveedores
Protected Sub LnkCtasBancSinProveedor_Click(sender As Object, e As EventArgs)
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim DtDatos As DataTable = Nothing
'Dim GvDatosSC As New GridView With { .AutoGenerateColumns = True }
Dim ObjComp As New ClsCompProveedores
If ObjComp.GetProveedoresSinCuentas(UsuarioActual.CveEmpresa) Then
DtDatos = ObjComp.DtResultados.Copy()
DtDatos = ObjComp.DtResultados
'GvDatosSC.DataBind()
End If
ObjComp.Dispose()
If DtDatos IsNot Nothing Then
DtDatos.TableName = "Proveedores"
GenerarReporteProveedoresSinCuentaExcel("Proveedores sin Cuentas Bancarias", DtDatos)
DtDatos.ExportToExcelG("Proveedores Sin Cuentas", "Proveedores sin Cuentas Bancarias", UsuarioActual)
End If
End Sub
Private Sub GenerarReporteProveedoresSinCuentaExcel(Titulo As String, DtDatos As DataTable)
Dim Retorno As New MemoryStream()
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim excel As ExcelFile = New ExcelFile
Dim item = excel.Worksheets.Add(DtDatos.TableName)
item.InsertDataTable(DtDatos, New InsertDataTableOptions() With
{
.ColumnHeaders = True,
.StartRow = 0,
.StartColumn = 0
})
item.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255))
item.Rows(0).Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255)
Dim columnCount = item.CalculateMaxUsedColumns()
For i = 0 To columnCount
item.Columns(i).AutoFit(1, item.Rows(i), item.Rows(item.Rows.Count - 1))
Next
Dim TotalRowHeader As Integer = 8
Dim TotalRowFooter As Integer = 2
Dim worksheet = excel.Worksheets(0)
worksheet.Rows.InsertEmpty(0, TotalRowHeader)
Dim celdasConTexto = worksheet.GetUsedCellRange(True)
celdasConTexto.Style.Font.Name = "Calibri Light"
Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex)
RangoNombreEmpresa.Merged = True
RangoNombreEmpresa.Value = UsuarioActual.Empresa.Empresa
RangoNombreEmpresa.Style.Font.Size = 18 * 20
RangoNombreEmpresa.Style.Font.Name = "Calibri Light"
RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
'Dim RangoFiltros = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex)
'RangoFiltros.Merged = True
'RangoFiltros.Value = Filtros
'RangoFiltros.Style.Font.Size = 15 * 20
'RangoFiltros.Style.Font.Name = "Calibri Light"
'RangoFiltros.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left
'RangoFiltros.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex)
RangoTitulo.Merged = True
RangoTitulo.Value = Titulo
RangoTitulo.Style.Font.Size = 20 * 20
RangoTitulo.Style.Font.Name = "Calibri Light"
RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20
worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255))
worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
If i > 0 Then
Try
worksheet.Columns(i).AutoFit(1)
Catch ex As Exception
End Try
End If
Next
Dim IndexEndTable As Integer = DtDatos.Rows.Count + TotalRowHeader + TotalRowFooter
worksheet.Rows(IndexEndTable).Cells(2).Value = "Usuario Imprimió"
worksheet.Rows(IndexEndTable + 1).Cells(2).Value = UsuarioActual.Nombre
worksheet.Rows(IndexEndTable).Cells(6).Value = "Fecha Impresión"
worksheet.Rows(IndexEndTable + 1).Cells(6).Value = DateTime.Now.ToString("dd/MM/yyyy")
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
If Imagen.Exists Then
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, UsuarioActual.CveEmpresa)
Using webClient As New Net.WebClient()
Dim imageBytes = webClient.DownloadData(logouri)
Dim stream As New MemoryStream(imageBytes)
worksheet.Pictures.Add(stream, ExcelPictureFormat.Png, "A1", 100, 100, LengthUnit.Pixel)
'worksheet.Pictures.Add(stream, GemBox.Spreadsheet.ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, GemBox.Document.LengthUnit.Pixel)
End Using
End If
excel.Save(Response, "Proveedores Sin Cuentas.xlsx", SaveOptions.XlsxDefault)
End Sub
End Class

View File

@@ -311,7 +311,7 @@
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="100">
<asp:TemplateField ItemStyle-Width="100" Visible="False">
<HeaderTemplate>
Folio Fiscal

View File

@@ -165,8 +165,7 @@ Partial Class Compras_RepComprasDetalle
ChkDesc.Checked = True
ChkTotal.Checked = True
ChkAbre.Checked = True
ChkRazon.Checked = True
ChkFolio.Checked = True
ChkRazon.Checked = True
ChkFecha.Checked = True
ChkObs.Checked = True

View File

@@ -418,6 +418,21 @@
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UPSaldoCxP" runat="server" class="portlet light xspadding bordered " align="center" style="" UpdateMode="Conditional" Visible="false">
<ContentTemplate>
<div class="portlet-title" style="border-bottom:none!important; margin-top: 5px">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span id="PLSaldoCxP" runat="server" class="caption-subject bold uppercase">Saldo conjunto de Cuentas por Pagar </span>
</div>
<div class="caption font-green portlet-total">
<span id="PLSaldoCxPTot" class="caption-subject bold uppercase" runat="server" />
<a href="javascript:;" class="collapse"></a>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>

View File

@@ -83,6 +83,8 @@ Partial Class General_RepIndicadorResumen
GvCxC.HeaderRow.Cells(2).Text = "<a href=""/Ventas/RepRecuperacion.aspx"" target=""_blank"">Recuperado</a>"
End If
Dim SaldoConjCxP = 0
'Mostrar gráficos y totales en portlets solo si hay datos en su respectiva tabla
If GvVxP.Rows.Count > 0 Then
UPGraficaVxP.Visible = True
@@ -110,26 +112,38 @@ Partial Class General_RepIndicadorResumen
UPGraficaCxC.Visible = True
PLCxCTot.InnerHtml = "<span style=""font-weight:800"">" + "Saldo: " + "</span>" + String.Format("{0:c} MXN", CType(GvCxC.DataSource, DataTable).SUM("SaldoMN", "CveCliente IS NOT NULL"))
Dim Recuper As Double = CType(GvCxC.DataSource, DataTable).SUM("RecuperadoMN", "CveCliente IS NOT NULL")
If (Recuper > 0) Then PLCxCTot.InnerHtml += "<span style="" font-weight:800; margin-left:1em"">" + "Rec: " + "</span>" + String.Format("{0:c} MXN", CType(GvCxC.DataSource, DataTable).SUM("RecuperadoMN", "CveCliente IS NOT NULL"))
If (Recuper > 0) Then PLCxCTot.InnerHtml += "<span style="" font-weight:800; margin-left:1em"">" + "Rec: " + "</span>" + String.Format("{0:c} MXN", Recuper)
Else
UPGraficaCxC.Visible = False
PLCxCTot.InnerHtml = Nothing
End If
If GvCxP192.Rows.Count > 0 Then
UPGraficaCxP192.Visible = True
PLCxP192Tot.InnerHtml = "<span style=""font-weight:800"">" + "Saldo: " + "</span>" + String.Format("{0:c} MXN", CType(GvCxP192.DataSource, DataTable).SUM("SaldoMN", "CveProveedor IS NOT NULL"))
Dim SaldoCxP192 = CType(GvCxP192.DataSource, DataTable).SUM("SaldoMN", "CveProveedor IS NOT NULL")
SaldoConjCxP += SaldoCxP192
PLCxP192Tot.InnerHtml = "<span style=""font-weight:800"">" + "Saldo: " + "</span>" + String.Format("{0:c} MXN", SaldoCxP192)
Else
UPGraficaCxP192.Visible = False
PLCxP192Tot.InnerHtml = Nothing
End If
If GvCxP.Rows.Count > 0 Then
UPGraficaCxP.Visible = True
PLCxPTot.InnerHtml = "<span style=""font-weight:800"">" + "Saldo: " + "</span>" + String.Format("{0:c} MXN", CType(GvCxP.DataSource, DataTable).SUM("SaldoMN", "CveProveedor IS NOT NULL"))
Dim SaldoCxP = CType(GvCxP.DataSource, DataTable).SUM("SaldoMN", "CveProveedor IS NOT NULL")
SaldoConjCxP += SaldoCxP
PLCxPTot.InnerHtml = "<span style=""font-weight:800"">" + "Saldo: " + "</span>" + String.Format("{0:c} MXN", SaldoCxP)
Else
UPGraficaCxP.Visible = False
PLCxPTot.InnerHtml = Nothing
End If
If SaldoConjCxP > 0 Then
UPSaldoCxP.Visible = True
PLSaldoCxPTot.InnerHtml = String.Format("{0:c} MXN", SaldoConjCxP)
Else
UPSaldoCxP.Visible = False
PLSaldoCxPTot.InnerHtml = Nothing
End If
'Si no había datos en ninguna tabla no cargar función de gráficos
If GvVxP.Rows.Count = 0 _
AndAlso GvCompProductores.Rows.Count = 0 _

View File

@@ -2055,7 +2055,7 @@ Partial Class Inventarios_EntradasSalidas
Dim Fechallegada As DateTime = (TxtFechaLlegada.Text & " 23:59:59").ToDateTime
Dim CveEntregaAlmacen As Integer = ObjGral.AddInvEntregaAlmacenRuta(CveSubProyectoTimbre, -1, DdlDireccionEnvio.SelectedValue.ToEntero, CveMovimiento, DdlChofer.SelectedValue.ToEntero, DdlUnidadCamion.SelectedValue.ToEntero, TxtFechaEntrega.Text.ToDate, TxtFechaLlegada.Text.ToDate, "T", "", "", MinFecha, 1, 1, TxtDistancia.Text.ToEntero,
CveConfigAutoTransporte:=DdlConfigAuto.SelectedValue.ToEntero, CveCamionRemolque1:=DdlRemolque1.SelectedValue.ToEntero, CveCamionRemolque2:=DdlRemolque2.SelectedValue.ToEntero)
CveConfigAutoTransporte:=DdlConfigAuto.SelectedValue.ToEntero, CveCamionRemolque1:=DdlRemolque1.SelectedValue.ToEntero, CveCamionRemolque2:=DdlRemolque2.SelectedValue.ToEntero, CveCliente:=DdlClientes.SelectedValue.ToEntero)
If CveEntregaAlmacen > 0 Then
CveTimbre = ObjGral.AddGralTimbre("Tra", CveSubProyectoTimbre, TxtFechaEntrega.Text.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEntregaAlmacen:=CveEntregaAlmacen, AplicaCP:=ChkEmitirCartaPorte.Checked)

View File

@@ -3479,7 +3479,7 @@
<td align="left">Forma de entrega:</td>
<td align="left">
<asp:DropDownList ID="DdlFormaEntrega" DataTextField="CondicionEntrega" DataValueField="CveCondicionEntrega" CssClass=" form-control input-sm select2me" runat="server" Width="200px">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
<asp:ListItem Selected="True" Text="-" Value="-1"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>