diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index 4c4d73133..ccb61fddf 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -4802,7 +4802,6 @@ Public Class ClsPaginas
#End Region
#Region "Planeacion"
'PLANEACIÓN
- PaginaDict.Add("/Planeacion/CatSucursales.aspx".ToUpper(), 17)
PaginaDict.Add("/Planeacion/Sucursal.aspx".ToUpper(), 17)
PaginaDict.Add("/Planeacion/CatProyectos.aspx".ToUpper(), 34)
PaginaDict.Add("/Planeacion/CatSubProyectos.aspx".ToUpper(), 35)
diff --git a/App_Code/ClsSucursales.vb b/App_Code/ClsSucursales.vb
new file mode 100644
index 000000000..b7d3f0f00
--- /dev/null
+++ b/App_Code/ClsSucursales.vb
@@ -0,0 +1,383 @@
+Option Explicit On
+Option Strict On
+
+Imports System.Data
+Imports System.Data.SqlClient
+Imports Extensiones
+Imports System
+Imports System.Configuration
+
+Public Class ClsSucursales
+ Implements IDisposable
+
+#Region "Campos"
+
+ 'SQL
+ Private SqlConexion As SqlConnection
+ Private SqlAdapter As SqlDataAdapter
+ Private SqlTransacc As SqlTransaction
+ Private SqlCommand As SqlCommand
+ Private Data As DataTable
+
+ Private disposedValue As Boolean = False
+
+ 'Atributos de la clase
+ Private _Calle As String
+ Private _NoExt As String
+ Private _NoInt As String
+ Private _Colonia As String
+ Private _Localidad As String
+ Private _Municipio As String
+ Private _Estado As String
+ Private _Pais As String
+ Private _CP As Integer
+ 'PARA REGISTRAR CONEXION
+ Private CveConexion As Integer = 0
+#End Region
+
+#Region "Propiedades"
+ Public ReadOnly Property Calle As String
+ Get
+ Return _Calle
+ End Get
+ End Property
+
+ Public ReadOnly Property NoExt As String
+ Get
+ Return _NoExt
+ End Get
+ End Property
+
+ Public ReadOnly Property NoInt As String
+ Get
+ Return _NoInt
+ End Get
+ End Property
+
+ Public ReadOnly Property Colonia As String
+ Get
+ Return _Colonia
+ End Get
+ End Property
+
+ Public ReadOnly Property Localidad As String
+ Get
+ Return _Localidad
+ End Get
+ End Property
+
+ Public ReadOnly Property Municipio As String
+ Get
+ Return _Municipio
+ End Get
+ End Property
+
+ Public ReadOnly Property Estado As String
+ Get
+ Return _Estado
+ End Get
+ End Property
+
+ Public ReadOnly Property Pais As String
+ Get
+ Return _Pais
+ End Get
+ End Property
+
+ Public ReadOnly Property CP As Integer
+ Get
+ Return _CP
+ End Get
+ End Property
+
+ Public ReadOnly Property DtResultados() As DataTable
+ Get
+ DtResultados = Data
+ End Get
+ End Property
+#End Region
+
+ Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing)
+
+ If TransaccionCompartida Is Nothing Then
+ SqlConexion = New SqlConnection
+ SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString
+ Try
+ SqlConexion.Open()
+ Catch ex As Exception
+ OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex)
+ End Try
+ Else
+ SqlConexion = TransaccionCompartida.Connection
+ SqlTransacc = TransaccionCompartida
+ End If
+
+ SqlCommand = New SqlCommand("", SqlConexion)
+ SqlAdapter = New SqlDataAdapter("", SqlConexion)
+ ConexionAdd()
+ End Sub
+ Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
+ With SqlAdapter.SelectCommand
+ .Parameters.Clear()
+ .CommandText = StrSQL
+ .CommandType = TipoComando
+ End With
+ If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
+ Data = New DataTable
+ End Sub
+#Region "Conexiones"
+
+ Private Sub ConexionAdd()
+ If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
+
+ Try
+ 'DataAdapter(String.Format("INSERT INTO Sis_Conexiones (Clase,Modulo) VALUES ('ClsRH','{0}')", "RH/CatMotivosBaja"), CommandType.Text) ' pendiente de terminar parra registrar el cveconexion, falta el rarámetro de módulo
+ DataAdapter("PA_Sis_RegistrarConexion")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name
+ .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString)
+ .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output
+ End With
+ SqlAdapter.Fill(Data)
+ CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero
+ Catch ex As Exception
+ OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+
+ End If
+ End Sub
+
+ Private Sub ConexionClose()
+ If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
+
+ DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text)
+ Try
+ SqlAdapter.Fill(Data)
+
+ Catch ex As Exception
+ OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ CveConexion = 0
+
+ End If
+
+ End Sub
+#End Region
+ Private Sub DataCommand(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
+ With SqlCommand
+ .Parameters.Clear()
+ .CommandText = pStrSQL
+ .CommandType = TipoComando
+ End With
+
+ If Not SqlTransacc Is Nothing Then SqlCommand.Transaction = SqlTransacc
+
+ End Sub
+ Public Function IniciaTransacSQL() As SqlTransaction
+ If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction()
+ Return SqlTransacc
+ End Function
+
+ Public Sub RollBack()
+ If SqlTransacc IsNot Nothing Then SqlTransacc.Rollback()
+ SqlTransacc = Nothing
+ End Sub
+ Public Sub Commit()
+ If SqlTransacc IsNot Nothing Then SqlTransacc.Commit()
+ SqlTransacc = Nothing
+ End Sub
+
+ 'Public Function GetSucursalesEmpresa(CveEmpresa As Integer) As Boolean
+ ' Dim Retorno As Boolean = False
+ ' Data = New DataTable
+ ' SqlAdapter = New SqlDataAdapter("PA_GetSucursalesEmpresa", SqlConexion)
+ ' SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
+
+ ' With SqlAdapter.SelectCommand.Parameters
+ ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ ' End With
+
+
+ ' Try
+ ' SqlAdapter.Fill(Data)
+ ' Retorno = True
+ ' Catch ex As SqlException
+ ' OnError("Ocurrió un error al consultar las Sucursales.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ ' End Try
+ ' SqlAdapter.Dispose()
+ ' Return Retorno
+ 'End Function
+
+
+
+
+ Public Function GetSucursales(Optional CveEmpresa As Integer = -1) As Boolean
+ Dim Retorno As Boolean = False
+ Data = New DataTable
+ SqlAdapter = New SqlDataAdapter("PA_SucursalesGet", SqlConexion)
+ SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
+
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As SqlException
+ OnError("Ocurrió un error al consultar las Sucursales.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ SqlAdapter.Dispose()
+ Return Retorno
+ End Function
+
+
+
+
+ Public Function AddSucursal(Sucursal As String, Serie As String, IVA As Double, FormatoFactura As String, CveUsuario As Integer, CveEmpresa As Integer,
+ Calle As String, NoExt As String, NoInt As String, Colonia As String, Localidad As String, Municipio As String, Estado As String, Pais As String, CP As String, TipoSucursal As Integer) As Integer
+ Dim Retorno = -1
+
+ DataAdapter("PA_SucursalAdd")
+
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@Sucursal", SqlDbType.VarChar).Value = Sucursal
+ .Add("@Serie", SqlDbType.VarChar).Value = Serie
+ .Add("@IVA", SqlDbType.Float).Value = IVA
+ .Add("@FormatoFactura", SqlDbType.VarChar).Value = FormatoFactura
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
+
+ .Add("@Calle", SqlDbType.VarChar).Value = Calle
+ .Add("@NoExt", SqlDbType.VarChar).Value = NoExt
+ .Add("@NoInt", SqlDbType.VarChar).Value = NoInt
+ .Add("@Colonia", SqlDbType.VarChar).Value = Colonia
+ .Add("@Localidad", SqlDbType.VarChar).Value = Localidad
+ .Add("@Municipio", SqlDbType.VarChar).Value = Municipio
+ .Add("@Estado", SqlDbType.VarChar).Value = Estado
+ .Add("@Pais", SqlDbType.VarChar).Value = Pais
+ .Add("@CP", SqlDbType.VarChar).Value = CP
+ .Add("@TipoSucursal", SqlDbType.Int).Value = TipoSucursal
+ .Add("@pCveSucursal", SqlDbType.Int).Direction = ParameterDirection.Output
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = SqlAdapter.SelectCommand.Parameters("@pCveSucursal").Value.ToString.ToEntero
+ Catch Ex1 As SqlException
+ If Ex1.Message.Contains("Número: 2627;") Then
+ Alert("Ya existe una Sucursal con el mismo nombre: " & Sucursal & ".", TipoMensaje.MsgAdvertencia)
+ Else
+ Me.OnError("Ocurrió un error al Guardar la Sucursal.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End If
+ Catch ex As Exception
+ OnError("Ocurrió un error al Guardar la Sucursal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ SqlAdapter.Dispose()
+ Return Retorno
+ End Function
+
+ Public Function UpdateSucursal(Sucursal As String, Serie As String, IVA As Double, FormatoFactura As String, Estatus As Boolean, CveUsuario As Integer, CveSucursal As Integer,
+ Calle As String, NoExt As String, NoInt As String, Colonia As String, Localidad As String, Municipio As String, Estado As String, Pais As String, CP As String, TipoSucursal As Integer) As Boolean
+ Dim Retorno As Boolean = False
+ Data = New DataTable
+ SqlAdapter = New SqlDataAdapter("PA_SucursalUpdate", SqlConexion)
+ SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@Sucursal", SqlDbType.VarChar).Value = Sucursal
+ .Add("@Serie", SqlDbType.VarChar).Value = Serie
+ .Add("@IVA", SqlDbType.Float).Value = IVA
+ .Add("@FormatoFactura", SqlDbType.VarChar).Value = FormatoFactura
+ .Add("@Estatus", SqlDbType.Bit).Value = If(Estatus, 1, 0)
+ .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
+ .Add("@CveSucursal", SqlDbType.Int).Value = CveSucursal
+ .Add("@Calle", SqlDbType.VarChar).Value = Calle
+ .Add("@NoExt", SqlDbType.VarChar).Value = NoExt
+ .Add("@NoInt", SqlDbType.VarChar).Value = NoInt
+ .Add("@Colonia", SqlDbType.VarChar).Value = Colonia
+ .Add("@Localidad", SqlDbType.VarChar).Value = Localidad
+ .Add("@Municipio", SqlDbType.VarChar).Value = Municipio
+ .Add("@Estado", SqlDbType.VarChar).Value = Estado
+ .Add("@Pais", SqlDbType.VarChar).Value = Pais
+ .Add("@CP", SqlDbType.VarChar).Value = CP
+ .Add("@TipoSucursal", SqlDbType.Int).Value = TipoSucursal
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch Ex1 As SqlException
+ If Ex1.Message.Contains("Número: 2627;") Then
+ Alert("Ya existe una Sucursal con el mismo nombre: " & Sucursal & ".", TipoMensaje.MsgAdvertencia)
+ Else
+ Me.OnError("Ocurrió un error al guardar los cambios en la Sucursal", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End If
+ Catch ex As Exception
+ OnError("Ocurrió un error al guardar los cambios en la Sucursal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ SqlAdapter.Dispose()
+ Return Retorno
+ End Function
+
+ Public Function RemoveSucursal(CveSucursal As Integer) As Boolean
+ Dim OnError As Boolean = False
+ SqlAdapter = New SqlDataAdapter("PA_SucursalRemove", SqlConexion)
+ SqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveSucursal", SqlDbType.Int).Value = CveSucursal
+ End With
+ Data = New DataTable()
+ Try
+ SqlAdapter.Fill(Data)
+ OnError = True
+ Catch Ex1 As SqlException
+ If Ex1.Message.Contains("Número: 547;") Then
+ Alert("La Sucursal no se pudo eliminar por que esta siendo usada por un registro.", TipoMensaje.MsgAdvertencia)
+ Else
+ Me.OnError("Ocurrió un error al eliminar la Sucursal.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End If
+ Catch ex As Exception
+ Me.OnError("Ocurrió un error al eliminar la Sucursal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ SqlAdapter.Dispose()
+ Return OnError
+ End Function
+
+#Region "IDisposable Support"
+
+
+ ' IDisposable
+ Protected Overridable Sub Dispose(disposing As Boolean)
+ If Not Me.disposedValue Then
+ If disposing Then
+ ' TODO: dispose managed state (managed objects).
+ If Not Data Is Nothing Then Data.Dispose()
+ If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose()
+ If Not SqlCommand Is Nothing Then SqlCommand.Dispose()
+ If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
+ If Not SqlConexion Is Nothing Then SqlConexion.Dispose()
+ End If
+
+ ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
+ ' TODO: set large fields to null.
+ End If
+ Me.disposedValue = True
+ End Sub
+
+ ' TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources.
+ 'Protected Overrides Sub Finalize()
+ ' ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
+ ' Dispose(False)
+ ' MyBase.Finalize()
+ 'End Sub
+
+ ' This code added by Visual Basic to correctly implement the disposable pattern.
+ Public Sub Dispose() Implements IDisposable.Dispose
+ ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
+ ConexionClose()
+ Dispose(True)
+ GC.SuppressFinalize(Me)
+ End Sub
+#End Region
+
+End Class
diff --git a/Compras/RepComprasAFDetalle.aspx.vb b/Compras/RepComprasAFDetalle.aspx.vb
index c75979d6e..1f5ae872f 100644
--- a/Compras/RepComprasAFDetalle.aspx.vb
+++ b/Compras/RepComprasAFDetalle.aspx.vb
@@ -86,7 +86,6 @@ Partial Class Compras_RepComprasAFDetalle
If Not IsPostBack Then
CargaCombos()
'ImgPersonalizar.Attributes.Add("onclick", "javascript:$('#DivPersonalizar').show(1000); PosicionaObjeto(this.id,'DivPersonalizar');")
- DdlPS.ddl.Visible = False
@@ -190,6 +189,17 @@ Partial Class Compras_RepComprasAFDetalle
DdlActivoFijo.DataBind()
DdlActivoFijo.Items.Insert(0, New ListItem("Seleccione", "-1"))
+ DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
+ If DdlPS.UsaWebService Then
+ DdlPS.ddlWS.Attributes.Add("data-Estatus", "-1")
+ DdlPS.ddlWS.Attributes.Add("data-pagina", "Inventarios")
+ DdlPS.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacion.SelectedValue)
+
+ 'DdlClasificacion.AutoPostBack = False
+ Else
+ DdlPS.ddl.Items.Add(New ListItem("Seleccione", "-1"))
+ DdlPS.ddl.Items.Add(New ListItem("*** Actualizar listado de Productos o Servicios ***", "-2"))
+ End If
If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Then
DdlProyecto.Visible = False
diff --git a/Contabilidad/FiltraPolizas.aspx.vb b/Contabilidad/FiltraPolizas.aspx.vb
index efeb1b6c0..cf6c11e5c 100644
--- a/Contabilidad/FiltraPolizas.aspx.vb
+++ b/Contabilidad/FiltraPolizas.aspx.vb
@@ -234,7 +234,7 @@ Partial Class Contabilidad_FiltraPolizas
Dim ObjCompra As New ClsCompras
Dim ObjIE As New ClsBancos()
Dim pathPoliza As String = ""
- Dim TieneComprobante As Boolean
+ Dim TieneComprobante As String = ""
Tick = DateTime.Now.Ticks.ToString
Dim ObjContabilidad As New ClsContabilidad
Dim CvePrePoliza As Integer
@@ -252,7 +252,7 @@ Partial Class Contabilidad_FiltraPolizas
ObjContabilidad.GetContabilizacionDiarioDetalle(CvePrePoliza)
TieneComprobante = VerificarComprobante(ObjContabilidad.DtResultados)
- If TieneComprobante And SinComprobante Then
+ If TieneComprobante = "" And Not SinComprobante Then
Path = ImprimirPolizaPDF(CvePrePoliza)
pathPoliza = Path
@@ -331,8 +331,8 @@ Partial Class Contabilidad_FiltraPolizas
End If
Next
Else
- If Not TieneComprobante Then
- PolizasSinComprobante += String.Format("{1} {2} ", TempPolizas.DataKey("CvePrePoliza").ToString, TempPolizas.DataKey("TipoPol").ToString, TempPolizas.DataKey("Folio").ToString)
+ If TieneComprobante <> "" Then
+ PolizasSinComprobante += String.Format("{1} {2} ", TieneComprobante, TempPolizas.DataKey("TipoPol").ToString, TempPolizas.DataKey("Folio").ToString)
SinComprobante = True
End If
@@ -381,7 +381,7 @@ Partial Class Contabilidad_FiltraPolizas
If ObjConta.GetPrePolizasDetalle(CvePrePoliza) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then
Dim dtVC As DataTable
Dim dr As DataRow
- dtVC = ObjConta.DtResultados
+ dtVC = ObjConta.DtResultados.FiltraParametros("Contabilizable = 1", "Orden")
dr = dtVC.Rows(0)
Dim ruta As String = ""
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
@@ -493,12 +493,12 @@ Partial Class Contabilidad_FiltraPolizas
End Sub
- Private Function VerificarComprobante(ByVal PrepolizaDetalle As DataTable) As Boolean
+ Private Function VerificarComprobante(ByVal PrepolizaDetalle As DataTable) As String
Dim filtro() As String = {"CveIE", "CveConceptoContable"}
Dim Path As String
Dim dt As DataTable = PrepolizaDetalle.FiltraParametros("", "", filtro)
Dim ObjIE As New ClsBancos()
- Dim TieneComprobante As Boolean = False
+ Dim TieneComprobante As String = ""
For Each Row As DataRow In dt.FiltraParametros("CveConceptoContable = 30").Rows
@@ -506,14 +506,14 @@ Partial Class Contabilidad_FiltraPolizas
If ObjIE.DtResultados.Rows.Count > 0 Then
Path = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString)
If File.Exists(Path) Then
- TieneComprobante = True
+ TieneComprobante = ""
Exit For
Else
- TieneComprobante = False
+ TieneComprobante = Row("CveIE").ToString
Exit For
End If
Else
- TieneComprobante = False
+ TieneComprobante = Row("CveIE").ToString
Exit For
End If
End If
diff --git a/Contabilidad/RegPrePoliza.aspx b/Contabilidad/RegPrePoliza.aspx
index 57d916c51..5f72a908d 100644
--- a/Contabilidad/RegPrePoliza.aspx
+++ b/Contabilidad/RegPrePoliza.aspx
@@ -80,6 +80,9 @@
Cargar Comprobante
+
+ Imprimir Poliza
+
diff --git a/Contabilidad/RegPrePoliza.aspx.vb b/Contabilidad/RegPrePoliza.aspx.vb
index 5ada370a1..91c34414b 100644
--- a/Contabilidad/RegPrePoliza.aspx.vb
+++ b/Contabilidad/RegPrePoliza.aspx.vb
@@ -250,14 +250,16 @@ Partial Class ContabilidadC_RegPrePoliza
GvConcepto.Columns(4).Visible = False
GvMov.Columns(5).Visible = False
End If
+ LnkExcel.Visible = False
+ LnkImprimirPoliza.Visible = True
If IfNull(Request("Conta"), "").ToString = "1" Then
Contabilizar()
End If
Exit Sub
- LnkExcel.Visible = False
Else
LnkExcel.Visible = True
+ LnkImprimirPoliza.Visible = False
CreaDT()
BtnEliminar.Visible = False
@@ -1840,21 +1842,21 @@ Partial Class ContabilidadC_RegPrePoliza
Next
- dt = DtMovimientos.FiltraParametros("", "", filtroComplemento)
- For Each Row As DataRow In dt.Rows
+
+ For Each Row As DataRow In dt.FiltraParametros("CveConceptoContable = 30").Rows
If ObjCompra.GetCompraComplementoPago(-1, UsuarioActual.CveEmpresa, Row("CveIE").ToString.ToEntero) Then
If ObjCompra.DtResultados IsNot Nothing AndAlso ObjCompra.DtResultados.Rows.Count > 0 Then
- Dim dr As DataRow = ObjCompra.DtResultados.Rows(0)
- Dim RFC As String = dr("RFCde").ToString
- Dim CveFactura As String = dr("CveFactura").ToString
- Console.WriteLine(RFC & CveFactura)
- If CveFactura <> "" Then
- Path = String.Format("{0}Compras\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, RFC, CveFactura)
- Console.WriteLine(Path)
- If File.Exists(Path) Then
- Pathpdf.Add(Path)
+ For Each RowComple As DataRow In ObjCompra.DtResultados.FiltraParametros("", "", {"RFCde", "CveFactura"}).Rows
+ Dim RFC As String = RowComple.Item("RFCde").ToString
+ Dim CveFactura As String = RowComple.Item("CveFactura").ToString
+ If CveFactura <> "" Then
+ Path = String.Format("{0}Compras\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, RFC, CveFactura)
+ If File.Exists(Path) Then
+ Pathpdf.Add(Path)
+ End If
End If
- End If
+ Next
+
End If
End If
Next
@@ -1889,7 +1891,7 @@ Partial Class ContabilidadC_RegPrePoliza
If ObjConta.GetPrePolizasDetalle(CvePrePoliza) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then
Dim dtVC As DataTable
Dim dr As DataRow
- dtVC = ObjConta.DtResultados
+ dtVC = ObjConta.DtResultados.FiltraParametros("Contabilizable = 1", "Orden")
dr = dtVC.Rows(0)
Dim ruta As String = ""
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
@@ -2343,20 +2345,20 @@ Partial Class ContabilidadC_RegPrePoliza
For Each Row As DataRow In dt.FiltraParametros("CveConceptoContable = 30").Rows
If ObjIE.GetBancosIE(Row("CveIE").ToString.ToEntero, UsuarioActual.CveEmpresa) Then
- If ObjIE.DtResultados.Rows.Count > 0 Then
- Path = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString)
- If File.Exists(Path) Then
- TieneComprobante = True
- Exit For
- Else
- TieneComprobante = False
- Exit For
- End If
+ If ObjIE.DtResultados.Rows.Count > 0 Then
+ Path = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString)
+ If File.Exists(Path) Then
+ TieneComprobante = True
+ Exit For
Else
TieneComprobante = False
Exit For
End If
+ Else
+ TieneComprobante = False
+ Exit For
End If
+ End If
Next
ObjIE.Dispose()
@@ -2364,5 +2366,53 @@ Partial Class ContabilidadC_RegPrePoliza
End Function
+ Protected Sub LnkImprimirPoliza_Click(sender As Object, e As EventArgs)
+ ImprimirPolizaPDFRunTime(IdPoliza)
+ End Sub
+ Private Function ImprimirPolizaPDFRunTime(IdPoliza As Integer) As String
+ Dim ObjConta As New ClsContabilidad
+ 'Dim ObjPoliza As New ClsContPAQi(UsuarioActual.Empresa)
+
+ Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/Polizas.rdlc", UsuarioActual.Empresa.Ruta))
+ Dim params As New List(Of ReportParameter)
+ Dim Bytes As Byte() = Nothing
+
+
+ 'If ObjPoliza.GetPoliza(IdPoliza, -1, -1, -1, -1) AndAlso ObjPoliza.DtResultados.Rows.Count > 0 Then
+ If ObjConta.GetPrePolizasDetalle(CvePrePoliza) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then
+ Dim dtVC As DataTable
+ Dim dr As DataRow
+ dtVC = ObjConta.DtResultados.FiltraParametros("Contabilizable = 1", "Orden")
+ dr = dtVC.Rows(0)
+ Dim ruta As String = ""
+ params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
+ params.Add(New ReportParameter("TipoPoliza", dr("TipoPoliza").ToString))
+ params.Add(New ReportParameter("Finicio", dr("Fecha").ToString.ToDate.ToShortDateString))
+ params.Add(New ReportParameter("FFin", dr("Fecha").ToString.ToDate.ToShortDateString))
+ params.Add(New ReportParameter("Fecha", dr("Fecha").ToString.ToDate.ToShortDateString))
+ 'params.Add(New ReportParameter("Nombre", dr("Cuenta").ToString))
+ 'params.Add(New ReportParameter("Cuenta", dr("Codigo").ToString))
+ params.Add(New ReportParameter("Numero", dr("FolioPoliza").ToString))
+ params.Add(New ReportParameter("Moneda", ""))
+ params.Add(New ReportParameter("CodigoPostal", ""))
+ If UsuarioActual.CveEmpresa = 119 Then
+ params.Add(New ReportParameter("UsuarioRegistro", GlobalDTUsuarios(dr("CveUsuario").ToString.ToEntero).FiltroPrimeroValor("Nombre")))
+ End If
+ If UsuarioActual.CveEmpresa = 140 Then
+ params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
+ End If
+ If Archivo.Exists Then
+ ruta = UsuarioActual.Empresa.Ruta & "Formatos/Polizas.rdlc"
+ Else
+ ruta = "Empresas/Grales/Formatos/Polizas.rdlc"
+ End If
+ ImprimirbytesPDF(StreamPDF(ruta, dtVC, params, "ppoliza"), String.Format("{0}-{1}", TipoPoliza, dr("FolioPoliza").ToString), "PDF", True)
+
+ End If
+ Return String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString)
+ ObjConta.Dispose()
+
+ End Function
+
End Class
diff --git a/Contabilidad/RegPrePolizaS.aspx b/Contabilidad/RegPrePolizaS.aspx
index 434d07f95..858da02e8 100644
--- a/Contabilidad/RegPrePolizaS.aspx
+++ b/Contabilidad/RegPrePolizaS.aspx
@@ -75,14 +75,14 @@
Crear Complemento de Pago