diff --git a/App_Code/CFDITimbre.vb b/App_Code/CFDITimbre.vb
index da170c392..6600b448e 100644
--- a/App_Code/CFDITimbre.vb
+++ b/App_Code/CFDITimbre.vb
@@ -16,6 +16,9 @@ Public Class CFDITimbre
Public Property Nomina As CFDINomina
Public Property ComplementoPagos As CFDIComplementoPagos
Public Property Complementos As CFDIComplementos
+ Public Property Timbrado As Boolean
+ Public Property IStimbreFiniquito As Boolean
+
Public ReadOnly Property TotalImpuestosRetenidos As Decimal
Get
Return (From c In Conceptos
@@ -128,6 +131,8 @@ Public Class CFDINomina
Public Property OtrosPagos As List(Of CFDINominaOtrosPagos)
Public Property HorasExtras As List(Of CFDINominaHorasExtras)
Public Property CveNomina As Integer
+ Public Property Antiguedad As Integer
+ Public Property UltimoSueldoOrdinario As Decimal
Public ReadOnly Property TotalPercepciones As Double
Get
diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb
index c65001d7d..78496ee91 100644
--- a/App_Code/ClsNominas.vb
+++ b/App_Code/ClsNominas.vb
@@ -215,6 +215,24 @@ Public Class ClsNominas
End Function
+ Public Function ReportedePercepcionesDeduccionesGet(cveEmpresa As Integer, FechaInicio As DateTime, FechaFin As DateTime, CveTipoPeriodo As Integer) As Boolean
+ Dim retorno As Boolean = False
+ DTSet = New DataSet()
+ DataAdapter("[PA_RH_ReportedePercepcionesDeducciones]", CommandType.StoredProcedure)
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa
+ .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
+ .Add("@FechaFin", SqlDbType.Date).Value = FechaFin
+ .Add("@TipoPeriodo", SqlDbType.Int).Value = CveTipoPeriodo
+ End With
+ Try
+ SqlAdapter.Fill(DTSet)
+ retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al obtener el reporte de Percepciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+ Return retorno
+ End Function
Public Function ReportedeincidenciasGET(cveEmpresa As Integer, FechaInicio As DateTime, FechaFin As DateTime, CveTipoPeriodo As Integer) As Boolean
Dim retorno As Boolean = False
DTSet = New DataSet()
@@ -834,7 +852,7 @@ Public Class ClsNominas
Return Retorno
End Function
- Public Function UpdateEstatusNomNominas(Estatus As Integer, CvePAC As Integer, FolioFiscal As String, SelloSAT As String, FechaCancelacion As DateTime, CveNomina As Integer, Optional SubTotal As Double = -1, Optional Descuento As Double = -1, Optional ISR As Double = -1, Optional Total As Double = -1, Optional DiasPagados As Double = -1) As Boolean
+ Public Function UpdateEstatusNomNominas(Estatus As Integer, CvePAC As Integer, FolioFiscal As String, SelloSAT As String, FechaCancelacion As DateTime, CveNomina As Integer, Optional SubTotal As Double = -1, Optional Descuento As Double = -1, Optional ISR As Double = -1, Optional Total As Double = -1, Optional DiasPagados As Double = -1, Optional isFiniquito As Boolean = False) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Nom_NominasUpdateEstatus")
@@ -852,6 +870,7 @@ Public Class ClsNominas
.Add("@Total", SqlDbType.Money).Value = Total
.Add("@DiasPagados", SqlDbType.Int).Value = DiasPagados
.Add("@CveNomina", SqlDbType.Int).Value = CveNomina
+ .Add("@isFiniquito", SqlDbType.Bit).Value = isFiniquito
End With
Try
@@ -2164,7 +2183,7 @@ Public Class ClsNominas
End Try
Return retorno
End Function
- Public Function GetNominaEmpleado(CveProyecto As Integer, CveSubProyecto As Integer, CveTurno As Integer, CvePeriodo As Integer, CveEmpresa As Integer, Agrupador As Integer, Optional RegimenContratacion As Integer = 1, Optional CvePersonal As Integer = -1) As Boolean
+ Public Function GetNominaEmpleado(CveProyecto As Integer, CveSubProyecto As Integer, CveTurno As Integer, CvePeriodo As Integer, CveEmpresa As Integer, Agrupador As Integer, Optional RegimenContratacion As Integer = 1, Optional CvePersonal As Integer = -1, Optional SalarioDiario As Decimal = 0) As Boolean
Dim retorno As Boolean = False
Try
DTSet = New DataSet()
@@ -2178,6 +2197,7 @@ Public Class ClsNominas
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@RegimenContratacion", SqlDbType.Int).Value = RegimenContratacion
.Add("@CvePersonal", SqlDbType.Decimal).Value = CvePersonal
+ .Add("@SalarioDiario", SqlDbType.Decimal).Value = SalarioDiario
End With
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index c8e653938..15411ebe9 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -3855,6 +3855,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Nomina/CatConceptos2.aspx".ToUpper(), -1)
PaginaDict.Add("/Nomina/Aguinaldo.aspx".ToUpper(), -1)
PaginaDict.Add("/Nomina/RepInversiondeNomina.aspx".ToUpper(), 906)
+ PaginaDict.Add("/RH/DiasFestivos.aspx".ToUpper(), -1)
PaginaDict.Add("/Nomina/FiniquitoB.aspx".ToUpper(), -1)
''CONFIGURACIONES GENERALES
PaginaDict.Add("/Sistemas/SistemaSIG.aspx".ToUpper(), 9999)
@@ -7836,7 +7837,7 @@ Public Class ClsPaginas
#Region "PDF NOMINA"
- Public Function GeneraPDFNomina(CvePersonal As Integer, CvePeriodo As Integer, CveEmpresa As Integer, RutaEmpresa As String) As Byte()
+ Public Function GeneraPDFNomina(CvePersonal As Integer, CvePeriodo As Integer, CveEmpresa As Integer, RutaEmpresa As String, Optional indemnizacion As Boolean = False) As Byte()
Dim ObjNomina As New ClsNominas
Dim ObjPersonal As New ClsRH
@@ -7856,7 +7857,7 @@ Public Class ClsPaginas
Dim DTDeducciones2 As New Data.DataTable
Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{CveEmpresa}\"
- Dim PathXML As String = $"{Ruta}XML\Nomina\{ObjNomina.SerieFolio}.xml"
+ Dim PathXML As String = $"{Ruta}XML\Nomina\{ObjNomina.Serie }{If(indemnizacion, "F", "")}-{ObjNomina.Folio}.xml"
Dim FechaEmision, FechaCertificacion As DateTime
Dim FolioFiscal, NoSerieCertificado, NoSerieCertificadoContribuyente, SelloCFDi, SelloSAT As String
FolioFiscal = ""
@@ -7936,7 +7937,32 @@ Public Class ClsPaginas
'Datos Empresa
RptParametro.Add(New ReportParameter("RegistroPatronal", ObjNomina.RegistroPatronal))
+ Dim ajusteindemnizacion As Double = 0
+ 'PERCECIONES - DEDUCCIONES
+ If ObjNomina.GetNom_NominasDetalles(CveNomina, CvePersonal, CvePeriodo, "-1") Then
+ Dim filtrop As String = " AND CveSistema NOT IN(10,11,32)"
+ Dim friltrod As String = " AND CveSistema <>47"
+ If indemnizacion Then
+ filtrop = "AND CveSistema IN(10,11,32)"
+ friltrod = " AND CveSistema =47"
+ End If
+ DTPercepciones = ObjNomina.DtResultados.FiltraParametros($"((Tipo = 'P' OR (Tipo = 'D' AND Importe <0)) AND Importe <>0 AND EsPadre = 1 AND SoloVisible =0) {filtrop}")
+ DTDeducciones = ObjNomina.DtResultados.FiltraParametros($"(Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) {friltrod}")
+ DTDeducciones2 = ObjNomina.DtResultados.FiltraParametros($"((Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) OR CveSistema IN (20,21)){friltrod}")
+ ajusteindemnizacion = ObjNomina.DtResultados.FiltraParametros($"((Tipo = 'P' OR (Tipo = 'D' AND Importe <0)) AND Importe <>0 AND EsPadre = 1 AND SoloVisible =0) AND CveSistema IN(10,11,32)").SUM("Importe") -
+ ObjNomina.DtResultados.FiltraParametros($"(Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) AND CveSistema =47").SUM("Importe")
+ For Each row As DataRow In DTPercepciones.Rows
+ If row("Tipo").ToString() = "D" Then
+ row("Codigo") = row("Codigo").ToString().Replace("D", "OP")
+ row("Importe") = row("Importe").ToString().ToDecimal() * -1
+ End If
+ Next
+
+ Else
+ DTPercepciones = Nothing
+ DTDeducciones = Nothing
+ End If
'DATOS DEL EMPLEADO
If ObjPersonal.GetPersonal(CvePersonal, CveEmpresa) Then
@@ -7978,7 +8004,7 @@ Public Class ClsPaginas
RptParametro.Add(New ReportParameter("Cantidad", "1"))
RptParametro.Add(New ReportParameter("Unidad", "ACT"))
RptParametro.Add(New ReportParameter("Descripcion", "PAGO DE NÓMINA"))
- RptParametro.Add(New ReportParameter("Total", ObjNomina.Total.ToString()))
+ RptParametro.Add(New ReportParameter("Total", If(indemnizacion, ajusteindemnizacion, ObjNomina.Total - ajusteindemnizacion).ToString()))
Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar()
cQr = CBB.GenerarCBBBytes(UsuarioActual.Empresa.RFC, ObjPersonal.RFC, ObjNomina.Total.ToString().ToDecimal(), FolioFiscal)
@@ -8000,22 +8026,6 @@ Public Class ClsPaginas
End If
End If
- 'PERCECIONES - DEDUCCIONES
- If ObjNomina.GetNom_NominasDetalles(CveNomina, CvePersonal, CvePeriodo, "-1") Then
- DTPercepciones = ObjNomina.DtResultados.FiltraParametros("(Tipo = 'P' OR (Tipo = 'D' AND Importe <0)) AND Importe <>0 AND EsPadre = 1 AND SoloVisible =0")
- DTDeducciones = ObjNomina.DtResultados.FiltraParametros("Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0")
- DTDeducciones2 = ObjNomina.DtResultados.FiltraParametros("(Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) OR CveConcepto IN (1471,1491)")
- For Each row As DataRow In DTPercepciones.Rows
- If row("Tipo").ToString() = "D" Then
- row("Codigo") = row("Codigo").ToString().Replace("D", "OP")
- row("Importe") = row("Importe").ToString().ToDecimal() * -1
- End If
- Next
-
- Else
- DTPercepciones = Nothing
- DTDeducciones = Nothing
- End If
RptParametro.Add(New ReportParameter("PU", DTPercepciones.SUM("Importe").ToString()))
RptParametro.Add(New ReportParameter("Importe", DTPercepciones.SUM("Importe").ToString()))
diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb
index 678bccbbc..196f5f3bf 100644
--- a/App_Code/ClsRH.vb
+++ b/App_Code/ClsRH.vb
@@ -122,9 +122,74 @@ Public Class ClsRH
CveConexion = 0
End If
- End Sub
+ End Sub
#End Region
+
+#Region "DiasFestivos"
+
+ Public Function DiasFestivosGet(CveEmpresa As Int32) As Boolean
+ Dim retorno As Boolean = False
+ DataAdapter("PA_RH_DiasFestivosGet", CommandType.StoredProcedure)
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ retorno = True
+ Catch Ex1 As SqlException
+
+ Me.OnError("Ocurrió un error al obtener los días festivos", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ Catch ex As Exception
+ OnError("Ocurrió un error al Guardar el Tipo de A-I", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ Return retorno
+ End Function
+ Public Function DiasFestivosAdd(fecha As DateTime, cveEmpresa As Int32, CveUsuario As Int32) As Boolean
+ Dim retorno As Boolean = False
+ DataAdapter("PA_RH_DiasFestivosAdd", CommandType.StoredProcedure)
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
+ .Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa
+ .Add("@Fecha", SqlDbType.DateTime).Value = fecha
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ retorno = True
+ Catch Ex1 As SqlException
+ If Ex1.Message.Contains("Número: 2627;") Then
+ Alert($"Ya existe un día festivo con fecha '{fecha:dd/MM/yyyy}'.", TipoMensaje.MsgAdvertencia)
+ Else
+ Me.OnError("Ocurrió un error al guardar el día festivo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End If
+ Catch ex As Exception
+ OnError("Ocurrió un error al Guardar el Tipo de A-I", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ Return retorno
+ End Function
+ Public Function DiasFestivosRemove(fecha As DateTime, cveEmpresa As Int32) As Boolean
+ Dim retorno As Boolean = False
+ DataAdapter("PA_RH_DiasFestivosRemove", CommandType.StoredProcedure)
+
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
+ .Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa
+ .Add("@Fecha", SqlDbType.DateTime).Value = fecha
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ retorno = True
+ Catch Ex1 As SqlException
+ Me.OnError("Ocurrió un error al eliminar el día festivo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ Catch ex As Exception
+ OnError("Ocurrió un error al eliminar el día festivo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+ Return retorno
+ End Function
+#End Region
+
#Region "ClsRHAsistenciasInasistencias"
Public Function GetAsistenciasInasistencias() As Boolean
Dim Retorno As Boolean = False
@@ -2145,7 +2210,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo
Return Retorno
End Function
- Public Function UpPersonalAltas(CvePersonal As Integer, fechaInicio As String, fechaFin As String, CvePeriodoFiniquito As Integer, CveMotivoBaja As Integer, esLiquidacion As Boolean) As Boolean
+ Public Function UpPersonalAltas(CvePersonal As Integer, fechaInicio As String, fechaFin As String, CvePeriodoFiniquito As Integer, CveMotivoBaja As Integer, esLiquidacion As Boolean, ValIndemnizacion As Boolean, ValSeparacionunica As Boolean, ValPrimadeantiguedad As Boolean) As Boolean
Dim Retorno As Boolean = False
SqlDataAdapter("PA_RH_PersonalAltasUp")
@@ -2156,6 +2221,9 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo
.Add("@CvePeriodoFiniquito", SqlDbType.Int).Value = CvePeriodoFiniquito
.Add("@CveMotivoBaja", SqlDbType.Int).Value = CveMotivoBaja
.Add("@esLiquidacion", SqlDbType.Int).Value = If(esLiquidacion, 1, 0)
+ .Add("@ValIndemnizacion", SqlDbType.Bit).Value = If(ValIndemnizacion, 1, 0)
+ .Add("@ValSeparacionunica", SqlDbType.Bit).Value = If(ValSeparacionunica, 1, 0)
+ .Add("@ValPrimadeantiguedad", SqlDbType.Bit).Value = If(ValPrimadeantiguedad, 1, 0)
End With
Try
SqlAdapter.Fill(Data)
diff --git a/App_Code/LogicNominas.vb b/App_Code/LogicNominas.vb
index ae2fbadef..6ac889921 100644
--- a/App_Code/LogicNominas.vb
+++ b/App_Code/LogicNominas.vb
@@ -20,20 +20,53 @@ Public Class LogicNominas
sw.Start()
End If
- Dim cfdi As CFDITimbre = PreTimbrar(CveNomina, UsuarioActual) 'CvePersonal, CvePeriodo,
+ Dim cfdi As CFDITimbre = PreTimbrar(CveNomina, UsuarioActual, False) 'CvePersonal, CvePeriodo,
If cfdi IsNot Nothing AndAlso cfdi.Mensaje = "" Then
- Dim ObjTimbrado As New Timbrado
- Dim ObjFactura As New Modelos.Factura
- ObjFactura.TipoDocto = "Nomina"
- ObjFactura.Folio = cfdi.Comprobante.Folio.ToEntero()
- ObjFactura.Serie = cfdi.Comprobante.Serie
- ObjFactura.Timbre = cfdi
- If Not ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura, CvePAC) Then
- Retorno = ObjTimbrado.MensajeErrorCFDI
+ If Not cfdi.Timbrado Then
+ Dim ObjTimbrado As New Timbrado
+ Dim ObjFactura As New Modelos.Factura
+ ObjFactura.TipoDocto = "Nomina"
+ ObjFactura.Folio = cfdi.Comprobante.Folio.ToEntero()
+ ObjFactura.Serie = cfdi.Comprobante.Serie
+ ObjFactura.Timbre = cfdi
+ If Not ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura, CvePAC) Then
+ Retorno = ObjTimbrado.MensajeErrorCFDI
+ End If
End If
If Retorno <> "" Then
Retorno = $"{Retorno} - {cfdi.Receptor.Nombre}"
Else
+ If hasfiniquito Then
+
+ cfdi = PreTimbrar(CveNomina, UsuarioActual, True) 'CvePersonal, CvePeriodo,
+ If cfdi IsNot Nothing AndAlso cfdi.Mensaje = "" Then
+
+ If Not cfdi.Timbrado Then
+ Dim ObjTimbrado As New Timbrado
+ Dim ObjFactura As New Modelos.Factura
+ ObjFactura.TipoDocto = "Nomina"
+ ObjFactura.Folio = cfdi.Comprobante.Folio.ToEntero()
+ ObjFactura.Serie = cfdi.Comprobante.Serie
+ ObjFactura.Timbre = cfdi
+ If Not ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura, CvePAC) Then
+ Retorno = ObjTimbrado.MensajeErrorCFDI
+ End If
+ If Retorno <> "" Then
+ Retorno = $"{Retorno} - {cfdi.Receptor.Nombre}"
+ Else
+
+ End If
+
+ End If
+ Else
+ If cfdi Is Nothing Then
+ Retorno = $"No se pudo generar el pretimbre(GetError): {GetError}"
+ Else
+ Retorno = $"No se pudo generar el pretimbre: {cfdi.Mensaje}"
+ End If
+ End If
+
+ End If
End If
Else
If cfdi Is Nothing Then
@@ -48,10 +81,10 @@ Public Class LogicNominas
End If
Return Retorno
End Function
-
- Private Function PreTimbrar(CveNomina As Integer, UsuarioActual As Usuario) As CFDITimbre
+ Dim hasfiniquito As Boolean
+ Private Function PreTimbrar(CveNomina As Integer, UsuarioActual As Usuario, TimbreIndemnizacion As Boolean) As CFDITimbre
Dim continuar As Boolean = True
-
+ hasfiniquito = False
Dim CvePersonal As Integer = -1
Dim CvePeriodo As Integer = -1
Dim DtPercepciones As Data.DataTable = Nothing
@@ -107,13 +140,26 @@ Public Class LogicNominas
Dim ObjIncapacidades As New List(Of CFDINominaIncapacidades)
'Conexiones a la Base de Datos
+ Dim cfdi As New CFDITimbre
+ cfdi.Nomina = New CFDINomina
Using objNomina As ClsNominas = New ClsNominas()
Using objPersonal As ClsRH = New ClsRH()
If objNomina.GetNom_Nominas(CveNomina, -1, -1, -1, UsuarioActual.CveEmpresa) AndAlso objNomina.DtResultados.Rows.Count > 0 Then
- CvePersonal = objNomina.DtResultados.Rows(0)("CvePersonal").ToString().ToEntero()
- CvePeriodo = objNomina.DtResultados.Rows(0)("CvePeriodo").ToString().ToEntero()
+ Dim drow As DataRow = objNomina.DtResultados.Rows(0)
+ CvePersonal = drow("CvePersonal").ToString().ToEntero()
+ CvePeriodo = drow("CvePeriodo").ToString().ToEntero()
+ cfdi.Nomina.Antiguedad = drow("Antiguedad").ToString().ToEntero()
+ cfdi.Nomina.UltimoSueldoOrdinario = drow("UltimoSueldoOrdinario").ToString().ToDecimal()
Serie = objNomina.Serie
Folio = objNomina.Folio.ToString()
+ If TimbreIndemnizacion Then
+ cfdi.Timbrado = drow("SeTimbroFiniquitoVal").ToString().ToEntero() = 1
+ cfdi.IStimbreFiniquito = True
+ Serie = $"{objNomina.Serie}F"
+ Else
+ cfdi.Timbrado = drow("SeTimbroVal").ToString().ToEntero() = 1
+ cfdi.IStimbreFiniquito = False
+ End If
Else
If continuar Then GetError = "No se pudo obtener la información de la nomina" 'si continuar= true el error se origino en este nodo y se le asigno el error
continuar = False
@@ -148,18 +194,27 @@ Public Class LogicNominas
End If
If continuar AndAlso objNomina.GetNom_NominasDetalles(CveNomina, CvePersonal, CvePeriodo, "-1") Then
If objNomina.DtResultados.Rows.Count > 0 Then
- Dim filtropercepciones As String = "Tipo = 'P' AND EsPadre = 1 AND SoloVisible =0"
+ Dim filtropercepciones As String = "Tipo = 'P' AND EsPadre = 1 AND SoloVisible =0 AND SATCveConcepto NOT IN ('022', '023','025')"
+ If TimbreIndemnizacion Then
+ filtropercepciones = " Tipo = 'P' AND SATCveConcepto IN ('022', '023','025')"
+ End If
DtPercepciones = objNomina.DtResultados.FiltraParametros(filtropercepciones)
- Dim filtrodeduc As String = "Tipo = 'D' AND EsPadre = 1 AND SoloVisible =0 AND (TipoConceptoSAT<>'O' OR TipoConceptoSAT IS NULL)"
+ Dim filtrodeduc As String = "Tipo = 'D' AND EsPadre = 1 AND SoloVisible =0 AND (TipoConceptoSAT<>'O' OR TipoConceptoSAT IS NULL) AND CveSistema <> 47"
+ If TimbreIndemnizacion Then
+ filtrodeduc = " Tipo = 'D' AND CveSistema =47"
+ End If
DtDeducciones = objNomina.DtResultados.FiltraParametros(filtrodeduc)
- DtOtrosPagos = objNomina.DtResultados.FiltraParametros(" TipoConceptoSAT='O'")
+ If Not TimbreIndemnizacion Then
+ DtOtrosPagos = objNomina.DtResultados.FiltraParametros(" TipoConceptoSAT='O'")
+
+ End If
Dim disrcomp As DataRow = DtOtrosPagos.FiltroPrimero("Codigo ='D999'")
For Each drow As DataRow In DtDeducciones.Rows
If drow("Codigo").ToString() = "D038" Then
End If
Next
-
+ hasfiniquito = objNomina.DtResultados.COUNT("SATCveConcepto", "(Tipo = 'P' AND SATCveConcepto IN ('022', '023','025')) OR (Tipo = 'D' AND SATCveConcepto = '101')") > 0
TotalPercepciones = DtPercepciones.SUM("Importe").ToString().ToDecimal()
@@ -170,53 +225,70 @@ Public Class LogicNominas
If continuar Then GetError = "No se pudo obtener el detalle de la nomina" 'si continuar= true el error se origino en este nodo y le asigno el error
continuar = False
End If
- If continuar AndAlso objNomina.GetHorasExtras(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then
- DtHorasExtras = objNomina.DtResultados
+ If Not TimbreIndemnizacion Then
+ If continuar AndAlso objNomina.GetHorasExtras(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then
+ DtHorasExtras = objNomina.DtResultados
+ Else
+ continuar = False
+ End If
Else
- continuar = False
+ DtHorasExtras = New DataTable()
End If
If continuar AndAlso objNomina.GetPeriodos(-1, UsuarioActual.CveEmpresa, -1, -1, CvePeriodo) AndAlso objNomina.DtResultados.Rows().Count > 0 Then
Dim DrPeriodo As DataRow = objNomina.DtResultados.Rows(0)
- FechaInicio = DrPeriodo("FechaInicio").ToString().ToDate
- FechaFin = DrPeriodo("FechaFin").ToString().ToDate
- FechaPago = DrPeriodo("FechaPago").ToString().ToDate
- TipoNomina = If(objNomina.CveTipoPeriodo = 6, "E", "O")
+ FechaFin = DrPeriodo("FechaFin").ToString().ToDate()
+ FechaPago = DrPeriodo("FechaPago").ToString().ToDate()
+
+ If Not TimbreIndemnizacion Then
+ FechaInicio = DrPeriodo("FechaInicio").ToString().ToDate()
+ TipoNomina = If(objNomina.CveTipoPeriodo = 6, "E", "O")
+ Else
+ FechaInicio = FechaFin
+ TipoNomina = "E"
+ End If
Else
If continuar Then GetError = "No se pudo obtener la información del periodo" 'si continuar= true el error se origino en este nodo y le asigno el error
continuar = False
End If
- If continuar AndAlso objPersonal.GetAsistencias(CvePersonal, -1, -1, -1, -1, -1, FechaInicio, FechaFin, UsuarioActual.CveEmpresa) Then
+ If Not TimbreIndemnizacion Then
+ If continuar AndAlso objPersonal.GetAsistencias(CvePersonal, -1, -1, -1, -1, -1, FechaInicio, FechaFin, UsuarioActual.CveEmpresa) Then
- Dim Asistencias As Integer = objPersonal.DtResultados.SUM("AplicaAsistencia").ToEntero()
- 'If Asistencias > 15 Then
- ' Asistencias = 15
- 'End If
- Dim Vacaciones As Integer = objPersonal.DtResultados.SUM("AplicaVacacion").ToEntero()
- DiasIncapacitados = objPersonal.DtResultados.SUM("AplicaIncapacidad").ToEntero()
- DiasPagados = Asistencias - Vacaciones
- If DiasPagados < 0 Then DiasPagados = 0
- Else
- continuar = False
- End If
- If DiasIncapacitados > 0 Then
- If objNomina.GetIncapacidades(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then
- If objNomina.DtResultados IsNot Nothing AndAlso objNomina.DtResultados.Rows.Count > 0 Then
- For Each dr As DataRow In objNomina.DtResultados.Rows
- ObjIncapacidades.Add(New CFDINominaIncapacidades With {.DiasIncapacidad = dr("Dias").ToString().ToEntero().ToString(), .TipoIncapacidad = dr("ClaveTipoIncapacidad").ToString(), .Importe = dr("Descuento").ToString().ToDecimal})
- Next
- End If
+
+ Dim Asistencias As Integer = objPersonal.DtResultados.SUM("AplicaAsistencia").ToEntero()
+ 'If Asistencias > 15 Then
+ ' Asistencias = 15
+ 'End If
+ Dim Vacaciones As Integer = objPersonal.DtResultados.SUM("AplicaVacacion").ToEntero()
+ DiasIncapacitados = objPersonal.DtResultados.SUM("AplicaIncapacidad").ToEntero()
+ DiasPagados = Asistencias - Vacaciones
+ If DiasPagados < 0 Then DiasPagados = 0
Else
- If continuar Then GetError = "No se pudo obtener las incapacidades del periodo" 'si continuar= true el error se origino en este nodo y le asigno el error
continuar = False
End If
+ Else
+ DiasPagados = 1
+ DiasIncapacitados = 0
+ End If
+ If continuar AndAlso DiasIncapacitados > 0 Then
+ If Not TimbreIndemnizacion Then
+
+ If objNomina.GetIncapacidades(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then
+ If objNomina.DtResultados IsNot Nothing AndAlso objNomina.DtResultados.Rows.Count > 0 Then
+ For Each dr As DataRow In objNomina.DtResultados.Rows
+ ObjIncapacidades.Add(New CFDINominaIncapacidades With {.DiasIncapacidad = dr("Dias").ToString().ToEntero().ToString(), .TipoIncapacidad = dr("ClaveTipoIncapacidad").ToString(), .Importe = dr("Descuento").ToString().ToDecimal})
+ Next
+ End If
+ Else
+ If continuar Then GetError = "No se pudo obtener las incapacidades del periodo" 'si continuar= true el error se origino en este nodo y le asigno el error
+ continuar = False
+ End If
+ End If
End If
End Using
End Using
- 'Lnado del CFDITimbre
- Dim cfdi As New CFDITimbre
- cfdi.Nomina = New CFDINomina
+ 'Lnado del CFDITimbre
cfdi.Nomina.Version = "1.2"
cfdi.Nomina.TipoNomina = TipoNomina
cfdi.Nomina.FechaPago = FechaPago
@@ -326,7 +398,7 @@ Public Class LogicNominas
Next
End If
- If CveRegimenContratacion.ToEntero() = 2 AndAlso ((ObjOtrosPagos.FirstOrDefault(Function(m) m.TipoOtroPago.ToEntero().Contiene(2, 7, 8))) Is Nothing) Then
+ If Not TimbreIndemnizacion AndAlso CveRegimenContratacion.ToEntero() = 2 AndAlso ((ObjOtrosPagos.FirstOrDefault(Function(m) m.TipoOtroPago.ToEntero().Contiene(2, 7, 8))) Is Nothing) Then
ObjOtrosPagos.Add(New CFDINominaOtrosPagos With {.TipoOtroPago = "002", ' codigo fijo, por ser referente a subsidio al empleo
.Clave = "D051", .Concepto = "Subs al Empleo acreditado", .Importe = 0D, .Subsidiocausado = 0D})
@@ -361,9 +433,9 @@ Public Class LogicNominas
cfdi.Nomina.Receptor.NSS = NumeroSS
cfdi.Nomina.Receptor.FechaInicioContrato = FechaInicioContrato
cfdi.Nomina.Receptor.Antiguedad = $"P{AntiguedadSemanas}W"
- cfdi.Nomina.Receptor.TipoContrato = CodigoTipoContrato
+ cfdi.Nomina.Receptor.TipoContrato = If(TimbreIndemnizacion, "99", CodigoTipoContrato)
cfdi.Nomina.Receptor.CodigoTipoJornada = ClaveTipoJornada
- cfdi.Nomina.Receptor.CodigoRegimenContratacion = CveRegimenContratacion
+ cfdi.Nomina.Receptor.CodigoRegimenContratacion = If(TimbreIndemnizacion, "13", CveRegimenContratacion)
cfdi.Nomina.Receptor.CodigoEmpleado = Codigo
cfdi.Nomina.Receptor.Departamento = Departamento
cfdi.Nomina.Receptor.Puesto = Puesto
diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb
index b7d9bbabb..6dba27799 100644
--- a/App_Code/Timbrado.vb
+++ b/App_Code/Timbrado.vb
@@ -2021,57 +2021,66 @@ Public Class Timbrado
End If
#End Region
If ObjCFDITimbre.Nomina IsNot Nothing Then
-
+ 'If cfdi.Nomina12SeparacionIndemnizacion Then
If ObjCFDITimbre.Nomina.Percepciones IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Percepciones.Count > 0 Then
- cfdi.Nomina12Percepciones(ObjCFDITimbre.Nomina.TotalSueldos, ObjCFDITimbre.Nomina.TotalIndemnizacion, ObjCFDITimbre.Nomina.TotalJubilacion, ObjCFDITimbre.Nomina.TotalPercepcionesGravado, ObjCFDITimbre.Nomina.TotalPercepcionesExento)
- For Each percep As CFDINominaPercepciones In ObjCFDITimbre.Nomina.Percepciones
- cfdi.Nomina12Percepcion(percep.TipoPercepcion, percep.Clave, percep.Concepto, Math.Round(percep.ImporteGravado, 2), Math.Round(percep.ImporteExento, 2))
- If percep.TipoPercepcion.ToEntero() = 19 Then
+ cfdi.Nomina12Percepciones(ObjCFDITimbre.Nomina.TotalSueldos, ObjCFDITimbre.Nomina.TotalIndemnizacion, ObjCFDITimbre.Nomina.TotalJubilacion, ObjCFDITimbre.Nomina.TotalPercepcionesGravado, ObjCFDITimbre.Nomina.TotalPercepcionesExento)
+ For Each percep As CFDINominaPercepciones In ObjCFDITimbre.Nomina.Percepciones
+ cfdi.Nomina12Percepcion(percep.TipoPercepcion, percep.Clave, percep.Concepto, Math.Round(percep.ImporteGravado, 2), Math.Round(percep.ImporteExento, 2))
+ If percep.TipoPercepcion.ToEntero() = 19 Then
- If ObjCFDITimbre.Nomina.HorasExtras IsNot Nothing AndAlso ObjCFDITimbre.Nomina.HorasExtras.Count > 0 Then
- For Each HoraExtra As CFDINominaHorasExtras In ObjCFDITimbre.Nomina.HorasExtras
- cfdi.Nomina12HorasExtra(HoraExtra.Dias.ToEntero, HoraExtra.TipoHoras, HoraExtra.HorasExtra, HoraExtra.ImportePagado)
- Next
- End If
- End If
- Next
- End If
-
- 'deducciones al final
- If ObjCFDITimbre.Nomina.Deducciones IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Deducciones.Count > 0 Then
- cfdi.Nomina12Deducciones(ObjCFDITimbre.Nomina.TotalDeduccionesOtras, Math.Round(ObjCFDITimbre.Nomina.TotalDeduccionesImpuestosRetenidos, 2))
- For Each deduc As CFDINominaDeducciones In ObjCFDITimbre.Nomina.Deducciones
- cfdi.Nomina12Deduccion(deduc.TipoDeduccion, deduc.Clave, deduc.Concepto, Math.Round(deduc.Importe, 2))
- Next
- End If
- If ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing Then
- ' cfdi.agregarNominaOtrosPagosOtroPago12("002", "002", "Subsidio", "10.00");
- ' cfdi.agregarNominaOtrosPagosOtroPagoSubsidioAlEmpleo12("10.00");
- If ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing AndAlso ObjCFDITimbre.Nomina.OtrosPagos.Count > 0 Then
- For Each otpag As CFDINominaOtrosPagos In ObjCFDITimbre.Nomina.OtrosPagos
- cfdi.Nomina12OtroPago(otpag.TipoOtroPago, otpag.Clave, otpag.Concepto, otpag.Importe)
- If otpag.TipoOtroPago = "002" Then
- cfdi.Nomina12SubsidioAlEmpleo(otpag.Subsidiocausado)
- End If
-
- If otpag.TipoOtroPago = "004" AndAlso otpag.Importe > 0 Then
- If otpag.ejercicio > 0 Then
- cfdi.CompensacionSaldosAFavor(otpag.SaldoAFavor, otpag.ejercicio, otpag.RemanenteSalFav) 'otpag.SaldoAFavor
+ If ObjCFDITimbre.Nomina.HorasExtras IsNot Nothing AndAlso ObjCFDITimbre.Nomina.HorasExtras.Count > 0 Then
+ For Each HoraExtra As CFDINominaHorasExtras In ObjCFDITimbre.Nomina.HorasExtras
+ cfdi.Nomina12HorasExtra(HoraExtra.Dias.ToEntero, HoraExtra.TipoHoras, HoraExtra.HorasExtra, HoraExtra.ImportePagado)
+ Next
End If
End If
+ Next
+ End If
+ If ObjCFDITimbre.IStimbreFiniquito Then
+ 'ObjCFDITimbre.Nomina.
+ Dim UltimoSueldoOrdinario As Double = ObjCFDITimbre.Nomina.UltimoSueldoOrdinario.ToString().ToDouble()
+ Dim TotalIndemnizacion As Double = ObjCFDITimbre.Nomina.TotalIndemnizacion
+ Dim t1 As Double = If(UltimoSueldoOrdinario < TotalIndemnizacion, UltimoSueldoOrdinario, TotalIndemnizacion)
+ Dim t2 As Double = If(UltimoSueldoOrdinario < TotalIndemnizacion, TotalIndemnizacion, UltimoSueldoOrdinario)
+ cfdi.Nomina12SeparacionIndemnizacion(TotalIndemnizacion, ObjCFDITimbre.Nomina.Antiguedad, UltimoSueldoOrdinario, t1, t2 - t1)
+
+ End If
+ 'deducciones al final
+ If ObjCFDITimbre.Nomina.Deducciones IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Deducciones.Count > 0 Then
+ cfdi.Nomina12Deducciones(ObjCFDITimbre.Nomina.TotalDeduccionesOtras, Math.Round(ObjCFDITimbre.Nomina.TotalDeduccionesImpuestosRetenidos, 2))
+ For Each deduc As CFDINominaDeducciones In ObjCFDITimbre.Nomina.Deducciones
+ cfdi.Nomina12Deduccion(deduc.TipoDeduccion, deduc.Clave, deduc.Concepto, Math.Round(deduc.Importe, 2))
+ Next
+ End If
+ If ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing Then
+ ' cfdi.agregarNominaOtrosPagosOtroPago12("002", "002", "Subsidio", "10.00");
+ ' cfdi.agregarNominaOtrosPagosOtroPagoSubsidioAlEmpleo12("10.00");
+ If ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing AndAlso ObjCFDITimbre.Nomina.OtrosPagos.Count > 0 Then
+ For Each otpag As CFDINominaOtrosPagos In ObjCFDITimbre.Nomina.OtrosPagos
+ cfdi.Nomina12OtroPago(otpag.TipoOtroPago, otpag.Clave, otpag.Concepto, otpag.Importe)
+ If otpag.TipoOtroPago = "002" Then
+ cfdi.Nomina12SubsidioAlEmpleo(otpag.Subsidiocausado)
+ End If
+
+ If otpag.TipoOtroPago = "004" AndAlso otpag.Importe > 0 Then
+ If otpag.ejercicio > 0 Then
+ cfdi.CompensacionSaldosAFavor(otpag.SaldoAFavor, otpag.ejercicio, otpag.RemanenteSalFav) 'otpag.SaldoAFavor
+ End If
+ End If
+
+ Next
+ End If
+ End If
+ If ObjCFDITimbre.Nomina.Incapacidades IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Incapacidades.Count > 0 Then
+ For Each Incap As CFDINominaIncapacidades In ObjCFDITimbre.Nomina.Incapacidades
+ cfdi.Nomina12Incapacidad(Incap.DiasIncapacidad.ToEntero, Incap.TipoIncapacidad, Incap.Importe)
Next
End If
End If
- If ObjCFDITimbre.Nomina.Incapacidades IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Incapacidades.Count > 0 Then
- For Each Incap As CFDINominaIncapacidades In ObjCFDITimbre.Nomina.Incapacidades
- cfdi.Nomina12Incapacidad(Incap.DiasIncapacidad.ToEntero, Incap.TipoIncapacidad, Incap.Importe)
- Next
- End If
- End If
#End Region
- sw.Stop()
+ sw.Stop()
swTiempo.AppendFormat("Armado: ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds)
swmili = sw.ElapsedMilliseconds
sw.Start()
@@ -2150,7 +2159,7 @@ Public Class Timbrado
If ObjCFDITimbre.Comprobante.TipoComprobante = "N" Then
Using ObjNomina2 As New ClsNominas()
- If ObjNomina2.UpdateEstatusNomNominas(3, CvePACEspecial, FolioFiscal, "", ("01/01/2000").ToDate, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0) Then
+ If ObjNomina2.UpdateEstatusNomNominas(3, CvePACEspecial, FolioFiscal, "", ("01/01/2000").ToDate, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0, isFiniquito:=Ventas.Timbre.IStimbreFiniquito) Then
Retorno = ""
Else
Retorno = "Error"
diff --git a/Bin/Microsoft.IdentityModel.JsonWebTokens.dll.refresh b/Bin/Microsoft.IdentityModel.JsonWebTokens.dll.refresh
deleted file mode 100644
index e8ab0af2c..000000000
Binary files a/Bin/Microsoft.IdentityModel.JsonWebTokens.dll.refresh and /dev/null differ
diff --git a/Bin/Microsoft.IdentityModel.Logging.dll.refresh b/Bin/Microsoft.IdentityModel.Logging.dll.refresh
deleted file mode 100644
index 62ecc0c56..000000000
--- a/Bin/Microsoft.IdentityModel.Logging.dll.refresh
+++ /dev/null
@@ -1 +0,0 @@
-C:\Users\Caudillo\source\repos\localhost_85\packages\Microsoft.IdentityModel.Logging.6.11.0\lib\net461\Microsoft.IdentityModel.Logging.dll
\ No newline at end of file
diff --git a/Bin/Microsoft.IdentityModel.Tokens.dll.refresh b/Bin/Microsoft.IdentityModel.Tokens.dll.refresh
deleted file mode 100644
index fd11383f4..000000000
Binary files a/Bin/Microsoft.IdentityModel.Tokens.dll.refresh and /dev/null differ
diff --git a/Bin/System.IdentityModel.Tokens.Jwt.dll.refresh b/Bin/System.IdentityModel.Tokens.Jwt.dll.refresh
deleted file mode 100644
index c2fd62bfd..000000000
Binary files a/Bin/System.IdentityModel.Tokens.Jwt.dll.refresh and /dev/null differ
diff --git a/Bin/System.Net.Http.Formatting.dll.refresh b/Bin/System.Net.Http.Formatting.dll.refresh
deleted file mode 100644
index 1b363176e..000000000
Binary files a/Bin/System.Net.Http.Formatting.dll.refresh and /dev/null differ
diff --git a/Bin/System.Web.Cors.dll.refresh b/Bin/System.Web.Cors.dll.refresh
deleted file mode 100644
index 61854e850..000000000
Binary files a/Bin/System.Web.Cors.dll.refresh and /dev/null differ
diff --git a/Bin/System.Web.Http.Cors.dll.refresh b/Bin/System.Web.Http.Cors.dll.refresh
deleted file mode 100644
index 4d7262108..000000000
Binary files a/Bin/System.Web.Http.Cors.dll.refresh and /dev/null differ
diff --git a/Bin/System.Web.Http.WebHost.dll.refresh b/Bin/System.Web.Http.WebHost.dll.refresh
deleted file mode 100644
index 4f2702c6a..000000000
--- a/Bin/System.Web.Http.WebHost.dll.refresh
+++ /dev/null
@@ -1 +0,0 @@
-C:\Users\Caudillo\source\repos\localhost_85\packages\Microsoft.AspNet.WebApi.WebHost.5.2.4\lib\net45\System.Web.Http.WebHost.dll
\ No newline at end of file
diff --git a/Bin/System.Web.Http.dll.refresh b/Bin/System.Web.Http.dll.refresh
deleted file mode 100644
index 8f16a752a..000000000
Binary files a/Bin/System.Web.Http.dll.refresh and /dev/null differ
diff --git a/Contabilidad/RegPrePoliza.aspx b/Contabilidad/RegPrePoliza.aspx
index 0ef7196ce..1d6823ab4 100644
--- a/Contabilidad/RegPrePoliza.aspx
+++ b/Contabilidad/RegPrePoliza.aspx
@@ -67,16 +67,22 @@
-
-
+
- Cargar Excel
+ Cargar Excel
Crear Complemento de Pago
-
-
+
+ Paquete Egresos
+
+
+ Cargar Comprobante
+
+
+
+
@@ -136,7 +142,7 @@
-
+
@@ -151,7 +157,7 @@
-
+
@@ -401,7 +407,7 @@
-
+ Movimiento
@@ -613,7 +619,7 @@
-
+
@@ -783,7 +789,50 @@
+
+
+
+
+
+
+
Subir Archivo
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%--
+
+
--%>
+
+
+
+
+
+
+
diff --git a/Contabilidad/RegPrePoliza.aspx.vb b/Contabilidad/RegPrePoliza.aspx.vb
index c5225c895..259ae97cc 100644
--- a/Contabilidad/RegPrePoliza.aspx.vb
+++ b/Contabilidad/RegPrePoliza.aspx.vb
@@ -5,6 +5,9 @@ Imports Extensiones
Imports System.Linq
Imports System.Web.Services
Imports GemBox.Spreadsheet
+Imports System.IO
+Imports iTextSharp.text.pdf
+Imports Microsoft.Reporting.WebForms
Partial Class ContabilidadC_RegPrePoliza
Inherits ClsPaginas
@@ -53,14 +56,14 @@ Partial Class ContabilidadC_RegPrePoliza
End Property
Private ReadOnly Property CvePrePoliza As Integer
Get
- Return ViewState("CvePrePoliza").ToString.ToEntero
+ Return ViewState("CvePrePoliza").ToString().ToEntero()
End Get
End Property
'PARA CREAR IE
Private Property CveConcepto As Integer
Get
- Return ViewState("CveConcepto").ToString.ToEntero
+ Return ViewState("CveConcepto").ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("CveConcepto") = value
@@ -68,7 +71,7 @@ Partial Class ContabilidadC_RegPrePoliza
End Property
Private Property CveTipoTransaccion As Integer
Get
- Return ViewState("CveTipoTransaccion").ToString.ToEntero
+ Return ViewState("CveTipoTransaccion").ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("CveTipoTransaccion") = value
@@ -76,7 +79,7 @@ Partial Class ContabilidadC_RegPrePoliza
End Property
Private Property CveCuenta As Integer
Get
- Return ViewState("CveCuenta").ToString.ToEntero
+ Return ViewState("CveCuenta").ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("CveCuenta") = value
@@ -84,7 +87,7 @@ Partial Class ContabilidadC_RegPrePoliza
End Property
Private Property Folio As String
Get
- Return ViewState("Folio").ToString
+ Return ViewState("Folio").ToString()
End Get
Set(value As String)
ViewState("Folio") = value
@@ -92,7 +95,7 @@ Partial Class ContabilidadC_RegPrePoliza
End Property
Private Property ImporteDocumento As Decimal
Get
- Return ViewState("ImporteDocumento").ToString.ToDecimal
+ Return ViewState("ImporteDocumento").ToString().ToDecimal()
End Get
Set(value As Decimal)
ViewState("ImporteDocumento") = value
@@ -100,7 +103,7 @@ Partial Class ContabilidadC_RegPrePoliza
End Property
Private Property Observaciones As String
Get
- Return ViewState("Observaciones").ToString
+ Return ViewState("Observaciones").ToString()
End Get
Set(value As String)
ViewState("Observaciones") = value
@@ -108,7 +111,7 @@ Partial Class ContabilidadC_RegPrePoliza
End Property
Private Property Beneficiario As String
Get
- Return ViewState("Beneficiario").ToString
+ Return ViewState("Beneficiario").ToString()
End Get
Set(value As String)
ViewState("Beneficiario") = value
@@ -116,7 +119,7 @@ Partial Class ContabilidadC_RegPrePoliza
End Property
Private Property RowIndex As Integer
Get
- Return ViewState("RowIndex").ToString.ToEntero
+ Return ViewState("RowIndex").ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("RowIndex") = value
@@ -124,7 +127,7 @@ Partial Class ContabilidadC_RegPrePoliza
End Property
Private Property Actualizar As Boolean
Get
- Return CBool(ViewState("Actualizar").ToString)
+ Return CBool(ViewState("Actualizar").ToString())
End Get
Set(value As Boolean)
ViewState("Actualizar") = value
@@ -167,12 +170,39 @@ Partial Class ContabilidadC_RegPrePoliza
ViewState("IdPoliza") = value
End Set
End Property
+
+ Public Property Tick As String
+ Get
+ Return CType(ViewState("Tick"), String)
+ End Get
+ Set(value As String)
+ ViewState("Tick") = value
+ End Set
+ End Property
+
+ Public Property CveIE As Integer
+ Get
+ Return CType(ViewState("CveIE"), Integer)
+ End Get
+ Set(value As Integer)
+ ViewState("CveIE") = value
+ End Set
+ End Property
+
+ Public Property TipoPoliza As String
+ Get
+ Return CType(ViewState("TipoPoliza"), String)
+ End Get
+ Set(value As String)
+ ViewState("TipoPoliza") = value
+ End Set
+ End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
-
+ Tick = DateTime.Now.Ticks.ToString()
If UsuarioActual.Empresa.TipoContabilizacion = 1 OrElse UsuarioActual.Empresa.TipoContabilidad = 1 Then
Response.Redirect(Request.Url.PathAndQuery.Replace("RegPrePoliza", "RegPrePolizaS"))
@@ -205,24 +235,24 @@ Partial Class ContabilidadC_RegPrePoliza
End If
- If IfNull(Request("Tipo"), "").ToString = "NOMPROV" Then
+ If IfNull(Request("Tipo"), "").ToString() = "NOMPROV" Then
DivTipoGasto.Visible = True
ThTipoGasto.Visible = True
CargaTiposGasto()
End If
- If Request("CvePrePoliza") IsNot Nothing AndAlso IsNumeric(Request("CvePrePoliza")) AndAlso Request("CvePrePoliza").ToEntero > 0 Then
- ViewState("CvePrePoliza") = Request("CvePrePoliza").ToEntero
+ If Request("CvePrePoliza") IsNot Nothing AndAlso IsNumeric(Request("CvePrePoliza")) AndAlso Request("CvePrePoliza").ToEntero() > 0 Then
+ ViewState("CvePrePoliza") = Request("CvePrePoliza").ToEntero()
CreaDT()
CargaPrePoliza()
CargaGvBitacora()
- If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then
+ If IfNull(Request("Tipo"), "").ToString() <> "NOMPROV" Then
GvPrePoliza.Columns(4).Visible = False
GvConcepto.Columns(4).Visible = False
GvMov.Columns(5).Visible = False
End If
- If IfNull(Request("Conta"), "").ToString = "1" Then
+ If IfNull(Request("Conta"), "").ToString() = "1" Then
Contabilizar()
End If
Exit Sub
@@ -241,7 +271,7 @@ Partial Class ContabilidadC_RegPrePoliza
TipoPlantilla = 0
- If IfNull(Request("Tipo"), "").ToString = "Ing" Then
+ If IfNull(Request("Tipo"), "").ToString() = "Ing" Then
TipoPlantilla = 1
LblEncabezado.Text = "Otros Ingresos"
End If
@@ -259,14 +289,14 @@ Partial Class ContabilidadC_RegPrePoliza
CargaCuentas()
- If Request("CvePeriodo") IsNot Nothing AndAlso IsNumeric(Request("CvePeriodo")) AndAlso Request("CvePeriodo").ToEntero > 0 Then
- ViewState("CvePeriodo") = Request("CvePeriodo").ToEntero
- ViewState("CveProyecto") = Request("CveProyecto").ToEntero
- ViewState("CveSubProyecto") = Request("CveSubProyecto").ToEntero
- ViewState("CveTurno") = Request("CveTurno").ToEntero
+ If Request("CvePeriodo") IsNot Nothing AndAlso IsNumeric(Request("CvePeriodo")) AndAlso Request("CvePeriodo").ToEntero() > 0 Then
+ ViewState("CvePeriodo") = Request("CvePeriodo").ToEntero()
+ ViewState("CveProyecto") = Request("CveProyecto").ToEntero()
+ ViewState("CveSubProyecto") = Request("CveSubProyecto").ToEntero()
+ ViewState("CveTurno") = Request("CveTurno").ToEntero()
- DdlPlantilla.Items.Add(New ListItem("Pago Nomina", "61"))
- DdlPlantilla.SelectedValue = "61"
+ 'DdlPlantilla.Items.Add(New ListItem("Pago Nomina", "61"))
+ 'DdlPlantilla.SelectedValue = "61"
DdlPlantilla.Enabled = False
DivAgregarConceptos.Visible = False
@@ -277,7 +307,7 @@ Partial Class ContabilidadC_RegPrePoliza
RegistraScript("$(document).ready(function () { comparar(); Sys.Application.add_load(function (s, e) { comparar(); }); } );", 3)
End If
- If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then
+ If IfNull(Request("Tipo"), "").ToString() <> "NOMPROV" Then
GvPrePoliza.Columns(3).Visible = False
GvConcepto.Columns(3).Visible = False
GvMov.Columns(4).Visible = False
@@ -331,7 +361,7 @@ Partial Class ContabilidadC_RegPrePoliza
End Sub
Private Sub CargaNomina()
- Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero
+ Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero()
Dim ObjNomina As New ClsNominas
Dim ObjConta As New ClsContabilidad
@@ -353,18 +383,18 @@ Partial Class ContabilidadC_RegPrePoliza
For Each drt As DataRow In Dt.Rows
Dim dr As DataRow = DtMovimientos.NewRow
- If drt("NombreCompleto").ToString = "" AndAlso ObjConta.GetRetCuenta(31, UsuarioActual.CveEmpresa) Then
+ If drt("NombreCompleto").ToString() = "" AndAlso ObjConta.GetRetCuenta(31, UsuarioActual.CveEmpresa) Then
CveConcepto = 98
Cuenta = "Nominas por Pagar"
- IdCuenta = ObjConta.DtResultados(0)("IdCtaContable").ToString.ToEntero
+ IdCuenta = ObjConta.DtResultados(0)("IdCtaContable").ToString().ToEntero()
Concepto = "Pago Nomina"
Referencia = "Pago Nomina"
Else
Concepto = drt("NombreCompleto")
Referencia = ""
- CveConcepto = drt("CveConceptoContable").ToString.ToEntero
- Cuenta = drt("ConceptoContable").ToString
- IdCuenta = drt("IdCtaContable").ToString.ToEntero
+ CveConcepto = drt("CveConceptoContable").ToString().ToEntero()
+ Cuenta = drt("ConceptoContable").ToString()
+ IdCuenta = drt("IdCtaContable").ToString().ToEntero()
End If
Dim drr As DataRow = DtCuentasContables.FiltroPrimero($"Id={IdCuenta}")
@@ -374,11 +404,11 @@ Partial Class ContabilidadC_RegPrePoliza
TipoMovto = drt("TipoMovto")
If TipoMovto = 0 Then
- dr("Cargo") = Math.Abs(drt("Importe").ToString.ToDecimal)
+ dr("Cargo") = Math.Abs(drt("Importe").ToString().ToDecimal())
dr("Abono") = 0
Else
dr("Cargo") = 0
- dr("Abono") = Math.Abs(drt("Importe").ToString.ToDecimal)
+ dr("Abono") = Math.Abs(drt("Importe").ToString().ToDecimal())
End If
dr("IdCuenta") = IdCuenta
@@ -418,6 +448,9 @@ Partial Class ContabilidadC_RegPrePoliza
TxtFechaDocumento.Text = dr("Fecha")
TxtConcepto.Text = dr("Concepto")
DivDatosPoliza.Visible = True
+ TipoPoliza = DdlTipoPoliza.SelectedItem.Text
+ Folio = dr("FolioPoliza").ToString()
+
If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then
DivAgregarConceptos.Visible = True
@@ -436,8 +469,8 @@ Partial Class ContabilidadC_RegPrePoliza
LnkComplementoPago.Visible = True
End If
- IdPoliza = dr("IdPoliza").ToString.ToEntero
- If dr("IdPoliza").ToString.ToEntero > 0 Then
+ IdPoliza = dr("IdPoliza").ToString().ToEntero()
+ If dr("IdPoliza").ToString().ToEntero() > 0 Then
HplContabilizada.NavigateUrl = String.Format("RegPoliza.aspx?IdPoliza={0}", dr("IdPoliza"))
divContabilziada.Visible = True
BtnEliminar.Visible = False
@@ -459,7 +492,7 @@ Partial Class ContabilidadC_RegPrePoliza
RegistraScript("comparar();")
- If Request("Tipo") IsNot Nothing AndAlso IsNumeric(Request("Tipo")) AndAlso Request("Tipo").ToEntero = 1 AndAlso UsuarioActual.CveUsuario <> 100 Then
+ If Request("Tipo") IsNot Nothing AndAlso IsNumeric(Request("Tipo")) AndAlso Request("Tipo").ToEntero() = 1 AndAlso UsuarioActual.CveUsuario <> 100 Then
For Each row As GridViewRow In GvPrePoliza.Rows
row.FCTextBox("TxtCargo").Enabled = False
row.FCTextBox("TxtAbono").Enabled = False
@@ -485,25 +518,25 @@ Partial Class ContabilidadC_RegPrePoliza
'Asignamos los Subproyectos
e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
e.Row.FCDropDownList("DdlSubProyecto").DataBind()
- e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1"))
+ 'e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1"))
e.Row.FCDropDownList("DdlSubProyecto").SelectedValueExist(e.Row.DataKey("CveSubProyecto"))
'Asignamos los Tipos de Gasto
e.Row.FCDropDownList("DdlTipoGasto").DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa)
e.Row.FCDropDownList("DdlTipoGasto").DataBind()
- e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1"))
+ 'e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1"))
e.Row.FCDropDownList("DdlTipoGasto").SelectedValueExist(e.Row.DataKey("CveTipoGasto"))
'ASignamos las CuentasContables
e.Row.FCDropDownList("DdlCtaContable").DataSource = Session("DtCuentas")
e.Row.FCDropDownList("DdlCtaContable").DataBind()
- e.Row.FCDropDownList("DdlCtaContable").Items.Insert(0, New ListItem("Sin Asignar", "0"))
+ 'e.Row.FCDropDownList("DdlCtaContable").Items.Insert(0, New ListItem("Sin Asignar", "0"))
e.Row.FCDropDownList("DdlCtaContable").SelectedValueExist(e.Row.DataKey("IdCtaContable"))
- TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + e.Row.FCTextBox("TxtCargo").Text.ToDouble).ToString.FormatoNumero
- TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + e.Row.FCTextBox("TxtAbono").Text.ToDouble).ToString.FormatoNumero
+ TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + e.Row.FCTextBox("TxtCargo").Text.ToDouble).ToString().FormatoNumero
+ TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + e.Row.FCTextBox("TxtAbono").Text.ToDouble).ToString().FormatoNumero
- Dim CveConceptoContable As Integer = e.Row.DataKey("CveConceptoContable").ToEntero
+ Dim CveConceptoContable As Integer = e.Row.DataKey("CveConceptoContable").ToEntero()
If CveConceptoContable.Contiene(1, 2, 12, 13, 38, 207, 203, 39, 61, 62, 63, 150, 251, 226) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DataKey("CveVenta"))
If CveConceptoContable.Contiene(5, 6, 17, 18, 14, 19, 25, 26, 60, 205, 225, 234, 235, 240) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DataKey("CveCompra"))
@@ -511,6 +544,11 @@ Partial Class ContabilidadC_RegPrePoliza
If CveConceptoContable.Contiene(68) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}", e.Row.DBCampo("CveMovimientoAlmacen"))
If CveConceptoContable.Contiene(30, 204) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE"))
+ If CveConceptoContable.Contiene(30) Then
+ LnkImprimirPDF.Visible = True
+ LnkComprobante.Visible = True
+ CveIE = e.Row.DBCampo("CveIE").ToString().ToEntero()
+ End If
'e.Row.FCHyperLink("HlReferencia").NavigateUrl = CveConceptoContable
@@ -553,7 +591,7 @@ Partial Class ContabilidadC_RegPrePoliza
End Sub
Private Sub DdlConceptosContables_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConceptosContables.SelectedIndexChanged
- If DdlConceptosContables.SelectedValue.ToEntero.Contiene(5, 17, 201, 205, 206, 14, 15, 16, 19, 25, 26, 21, 18, 60) Then
+ If DdlConceptosContables.SelectedValue.ToEntero().Contiene(5, 17, 201, 205, 206, 14, 15, 16, 19, 25, 26, 21, 18, 60) Then
CargaProveedores()
DdlProveedores.Visible = True
DdlCompras.Visible = True
@@ -562,13 +600,13 @@ Partial Class ContabilidadC_RegPrePoliza
DdlCompras.Visible = False
End If
- If DdlConceptosContables.SelectedValue.ToEntero.Contiene(28, 29) Then
+ If DdlConceptosContables.SelectedValue.ToEntero().Contiene(28, 29) Then
CargaPersonal()
DdlPersonal.Visible = True
Else
DdlPersonal.Visible = False
End If
- If DdlConceptosContables.SelectedValue.ToEntero.Contiene(1, 2, 203, 207, 13, 61, 8, 9, 62, 63, 38, 39, 12, 91) Then
+ If DdlConceptosContables.SelectedValue.ToEntero().Contiene(1, 2, 203, 207, 13, 61, 8, 9, 62, 63, 38, 39, 12, 91) Then
CargaClientes()
DdlClientes.Visible = True
DdlVentas.Visible = True
@@ -577,14 +615,14 @@ Partial Class ContabilidadC_RegPrePoliza
DdlVentas.Visible = False
End If
- If DdlConceptosContables.SelectedValue.ToEntero.Contiene(51) Then
+ If DdlConceptosContables.SelectedValue.ToEntero().Contiene(51) Then
CargaClasificacionesE()
DdlClasificacionesE.Visible = True
Else
DdlClasificacionesE.Visible = False
End If
- If DdlConceptosContables.SelectedValue.ToEntero.Contiene(201, 202, 203, 204, 206, 207, 226, 227, 229, 233, 234, 235, 239, 242, 256, 266) Then
+ If DdlConceptosContables.SelectedValue.ToEntero().Contiene(201, 202, 203, 204, 206, 207, 226, 227, 229, 233, 234, 235, 239, 242, 256, 266) Then
TxtTC.Text = "2"
TxtTC.Visible = True
Else
@@ -592,7 +630,7 @@ Partial Class ContabilidadC_RegPrePoliza
TxtTC.Visible = False
End If
- If DdlConceptosContables.SelectedValue.ToEntero.Contiene(69) Then
+ If DdlConceptosContables.SelectedValue.ToEntero().Contiene(69) Then
CargaClasificaciones()
DdlClasificaciones.Visible = True
Else
@@ -605,19 +643,19 @@ Partial Class ContabilidadC_RegPrePoliza
End Sub
Private Sub DdlProveedores_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProveedores.SelectedIndexChanged
- If DdlConceptosContables.SelectedValue.ToEntero.Contiene(18, 60) Then
- CargaNotasCreditoCompras(DdlProveedores.SelectedValue.ToEntero, DdlCompras)
+ If DdlConceptosContables.SelectedValue.ToEntero().Contiene(18, 60) Then
+ CargaNotasCreditoCompras(DdlProveedores.SelectedValue.ToEntero(), DdlCompras)
Else
- CargaCompras(DdlProveedores.SelectedValue.ToEntero)
+ CargaCompras(DdlProveedores.SelectedValue.ToEntero())
End If
End Sub
Private Sub DdlClientes_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClientes.selectedindexchange
- If DdlConceptosContables.SelectedValue.ToEntero.Contiene(12, 91) Then
- CargaVentas(DdlClientes.SelectedValue.ToEntero)
+ If DdlConceptosContables.SelectedValue.ToEntero().Contiene(12, 91) Then
+ CargaVentas(DdlClientes.SelectedValue.ToEntero())
Else
- CargaVentas(DdlClientes.SelectedValue.ToEntero)
+ CargaVentas(DdlClientes.SelectedValue.ToEntero())
End If
End Sub
@@ -650,7 +688,7 @@ Partial Class ContabilidadC_RegPrePoliza
End Sub
Private Sub CargaCompras(CveProveedor As Integer)
- If Not DdlConceptosContables.SelectedValue.ToEntero.Contiene(21) Then
+ If Not DdlConceptosContables.SelectedValue.ToEntero().Contiene(21) Then
Dim ObjCompras As New ClsCompras
DdlCompras.ClearSelection()
@@ -668,7 +706,7 @@ Partial Class ContabilidadC_RegPrePoliza
End Sub
Private Sub CargaNotasCreditoCompras(CveProveedor As Integer, ddl As DropDownList)
- If DdlConceptosContables.SelectedValue.ToEntero.Contiene(18, 60) Then
+ If DdlConceptosContables.SelectedValue.ToEntero().Contiene(18, 60) Then
Dim ObjCompras As New ClsCompras
ddl.ClearSelection()
@@ -747,13 +785,13 @@ Partial Class ContabilidadC_RegPrePoliza
TxtTotalAbonos.Text = ""
TxtTotalCargos.Text = ""
- If DdlPlantilla.SelectedValue.ToEntero <= 0 Then
+ If DdlPlantilla.SelectedValue.ToEntero() <= 0 Then
Alert("Seleccione un Movimiento Válido", TipoMensaje.MsgAdvertencia)
DdlPlantilla.SelectedValue = "-1"
Exit Sub
End If
- If DdlPlantilla.SelectedValue.ToEntero = 53 Then 'Plantilla Personalizada
+ If DdlPlantilla.SelectedValue.ToEntero() = 53 Then 'Plantilla Personalizada
DivAgregarConceptos.Visible = True
Else
DivAgregarConceptos.Visible = False
@@ -761,7 +799,7 @@ Partial Class ContabilidadC_RegPrePoliza
- Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero
+ Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero()
Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla).FiltraParametros(String.Format("CveEmpresa={0}", UsuarioActual.CveEmpresa), "Orden")
Dim Cuenta As String = ""
@@ -773,23 +811,23 @@ Partial Class ContabilidadC_RegPrePoliza
For Each drt As DataRow In Dt.Rows
- Cuenta = drt("ConceptoContable").ToString
+ Cuenta = drt("ConceptoContable").ToString()
IdCuenta = 0
CodigoCuenta = ""
NombreCuenta = ""
- If drt("IdCtaContable").ToString.ToEntero > 0 Then 'DtCuentasContables
- Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", drt("IdCtaContable").ToString))
+ If drt("IdCtaContable").ToString().ToEntero() > 0 Then 'DtCuentasContables
+ Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", drt("IdCtaContable").ToString()))
If drr IsNot Nothing Then
- IdCuenta = drt("IdCtaContable").ToString.ToEntero
+ IdCuenta = drt("IdCtaContable").ToString().ToEntero()
CodigoCuenta = drr("CuentaFormato").ToString()
NombreCuenta = drr("Nombre").ToString()
- 'Cuenta = drr("Nombre").ToString()
+ 'Cuenta = drr("Nombre").Tostring()
NombreCuenta = CodigoCuenta & " " & NombreCuenta
End If
EsComodin = 0
End If
- If drt("CveCuenta").ToString.ToEntero > 0 Then
+ If drt("CveCuenta").ToString().ToEntero() > 0 Then
NombreCuenta = String.Format("{0} {1}", drt("Codigo"), drt("Nombre"))
End If
@@ -797,9 +835,9 @@ Partial Class ContabilidadC_RegPrePoliza
dr("IdCuenta") = IdCuenta
dr("CodigoCuenta") = NombreCuenta
dr("Cuenta") = Cuenta 'TxtCuentaContable.Text
- dr("Referencia") = If(drt("CveConcepto").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial"))
+ dr("Referencia") = If(drt("CveConcepto").ToString().Contiene("29", "130"), drt("Personal"), drt("RazonSocial"))
dr("Concepto") = TxtObservaciones.Text
- dr("TipoMovto") = If(drt("TipoMovto").ToString = "False", 0, 1)
+ dr("TipoMovto") = If(drt("TipoMovto").ToString() = "False", 0, 1)
dr("EsComodin") = EsComodin
dr("CveConcepto") = drt("CveConcepto")
dr("CveSubProyecto") = drt("CveSubProyectoNegativo")
@@ -811,6 +849,8 @@ Partial Class ContabilidadC_RegPrePoliza
dr("MultipleSubProyecto") = drt("MultipleSubProyecto")
dr("PorcentajeImpuesto") = drt("PorcentajeImpuesto")
dr("CveCuenta") = drt("CveCuenta")
+ dr("FolioPoliza") = drt("FolioPoliza")
+
DtMovimientos.Rows.Add(dr)
@@ -856,7 +896,7 @@ Partial Class ContabilidadC_RegPrePoliza
e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1"))
e.Row.FCDropDownList("DdlTipoGasto").SelectedValue = e.Row.DBCampo("CveTipoGasto")
- If DdlPlantilla.SelectedValue.ToEntero = 53 Then 'Plantilla Personalizada
+ If DdlPlantilla.SelectedValue.ToEntero() = 53 Then 'Plantilla Personalizada
e.Row.FCDropDownList("DdlSubProyecto").Enabled = True
e.Row.FCImageButton("imgD").Visible = True
Else
@@ -868,17 +908,17 @@ Partial Class ContabilidadC_RegPrePoliza
End If
'Agregamos la opcion para vincular los movimientos bancarios
- If e.Row.DataKey("CveConcepto").ToEntero.Contiene(41) Then
+ If e.Row.DataKey("CveConcepto").ToEntero().Contiene(41) Then
Dim ObjMovimientos As New ClsMovimientos
Dim DdlSaldos As DropDownList = e.Row.FCDropDownList("DdlSaldos")
- Select Case e.Row.DataKey("CveConcepto").ToEntero
+ Select Case e.Row.DataKey("CveConcepto").ToEntero()
'Acreedores
Case 41
If (ObjMovimientos.GetAcreedoresSaldosDetalles(-1, CveMoneda, UsuarioActual.CveEmpresa)) Then
DdlSaldos.Visible = True
- DdlSaldos.DataSource = ObjMovimientos.DtResultados.FiltraParametros($"CveIE > 0 AND CveProveedor = {e.Row.DataKey("CveProveedor").ToEntero}")
+ DdlSaldos.DataSource = ObjMovimientos.DtResultados.FiltraParametros($"CveIE > 0 AND CveProveedor = {e.Row.DataKey("CveProveedor").ToEntero()}")
DdlSaldos.DataBind()
DdlSaldos.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
@@ -888,16 +928,15 @@ Partial Class ContabilidadC_RegPrePoliza
ObjMovimientos.Dispose()
End If
- If e.Row.DataKey("CveConcepto").ToEntero.Contiene(30) Then
+ If e.Row.DataKey("CveConcepto").ToEntero().Contiene(30) Then
e.Row.FCLinkButton("ImgBancos").Visible = True
-
If CveTipoTransaccion > 0 And CveCuenta > 0 And Folio.Length > 0 And ImporteDocumento > 0 And Beneficiario.Length > 0 Then
e.Row.FCLinkButton("ImgBancos").CssClass = "btn btn-circle btn-sm green"
End If
End If
- If e.Row.DataKey("CveConcepto").ToEntero.Contiene(17) Then
+ If e.Row.DataKey("CveConcepto").ToEntero().Contiene(17) Then
e.Row.FCDropDownList("DdlProveedores").Visible = True
e.Row.FCDropDownList("DdlProveedores").DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
e.Row.FCDropDownList("DdlProveedores").DataBind()
@@ -915,12 +954,12 @@ Partial Class ContabilidadC_RegPrePoliza
Dim TotalCargos, TotalAbonos As Decimal
If CvePrePoliza > 0 Then
- TotalCargos = TxtTotalCargos.Text.ToDecimal
- TotalAbonos = TxtTotalAbonos.Text.ToDecimal
+ TotalCargos = TxtTotalCargos.Text.ToDecimal()
+ TotalAbonos = TxtTotalAbonos.Text.ToDecimal()
Else
For Each Gvr As GridViewRow In GvMov.Rows
- TotalCargos += Gvr.FCTextBox("TxtCargo").Text.ToDecimal
- TotalAbonos += Gvr.FCTextBox("TxtAbono").Text.ToDecimal
+ TotalCargos += Gvr.FCTextBox("TxtCargo").Text.ToDecimal()
+ TotalAbonos += Gvr.FCTextBox("TxtAbono").Text.ToDecimal()
Next
End If
@@ -951,7 +990,7 @@ Partial Class ContabilidadC_RegPrePoliza
Try
Dim CvePrePoliza As Integer
Dim ConceptoPoliza As String = TxtObservaciones.Text
- CvePrePoliza = ObjMov.AddPrePolizas("Contabilidad/RegPrePoliza", DdlPlantilla.SelectedValue.ToEntero, TotalCargos, TotalAbonos, 1, TxtFecha.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPolizaAdd.SelectedValue.ToEntero)
+ CvePrePoliza = ObjMov.AddPrePolizas("Contabilidad/RegPrePoliza", DdlPlantilla.SelectedValue.ToEntero(), TotalCargos, TotalAbonos, 1, TxtFecha.Text.ToDate(), ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPolizaAdd.SelectedValue.ToEntero())
If CvePrePoliza > 0 Then
Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:
"
@@ -970,12 +1009,12 @@ Partial Class ContabilidadC_RegPrePoliza
'inserto las compras que voy a pagarDdlSaldos
For Each gvr As GridViewRow In GvMov.Rows
- If gvr.DataKey("IDCuenta").ToEntero > 0 Then
+ If gvr.DataKey("IDCuenta").ToEntero() > 0 Then
IdCtaContable = gvr.DataKey("IDCuenta")
End If
- CveProveedor = gvr.DataKey("CveProveedor").ToEntero
- CveCompra = gvr.DataKey("CveCompra").ToEntero
- CveConcepto = gvr.DataKey("CveConcepto").ToEntero
+ CveProveedor = gvr.DataKey("CveProveedor").ToEntero()
+ CveCompra = gvr.DataKey("CveCompra").ToEntero()
+ CveConcepto = gvr.DataKey("CveConcepto").ToEntero()
If gvr.DataKey("TipoMovto").ToDouble <> 0 Then
Importe = gvr.FCTextBox("TxtAbono").Text.ToDouble
@@ -986,12 +1025,12 @@ Partial Class ContabilidadC_RegPrePoliza
End If
'Registra pago de compra
If CveConcepto = 17 Then
- CveProveedor = gvr.FCDropDownList("DdlProveedores").SelectedValue.ToEntero
- CveCompra = gvr.FCDropDownList("DdlCompras").SelectedValue.ToEntero
+ CveProveedor = gvr.FCDropDownList("DdlProveedores").SelectedValue.ToEntero()
+ CveCompra = gvr.FCDropDownList("DdlCompras").SelectedValue.ToEntero()
End If
If CveConcepto = 41 Then
- CveIE = gvr.FCDropDownList("DdlSaldos").SelectedValue.ToEntero
+ CveIE = gvr.FCDropDownList("DdlSaldos").SelectedValue.ToEntero()
Else
If CveConcepto = 30 AndAlso Importe <> 0 Then
'Registra movimieno bancario
@@ -1017,14 +1056,14 @@ Partial Class ContabilidadC_RegPrePoliza
End If
If Importe <> 0 Then
- If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, gvr.FCLiteral("LtlReferencia").Text, gvr.DataKey("CveConcepto").ToEntero, gvr.FCTextBox("TxtConcepto").Text,
- TxtFecha.Text.ToDate, IdCtaContable, -1, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CveIE:=CveIE,
+ If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, gvr.FCLiteral("LtlReferencia").Text, gvr.DataKey("CveConcepto").ToEntero(), gvr.FCTextBox("TxtConcepto").Text,
+ TxtFecha.Text.ToDate(), IdCtaContable, -1, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero(), CveIE:=CveIE,
CveProveedor:=CveProveedor, CveCompra:=CveCompra,
- CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero,
- ImporteMX:=Importe, CveTipoGasto:=gvr.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero,
- CveCliente:=gvr.DataKey("CveCliente").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero, TipoCambio:=If(gvr.DataKey("TC").ToString.ToDecimal > 0, gvr.DataKey("TC").ToString.ToDecimal, 1),
- ImporteME:=If(gvr.DataKey("TC").ToString.ToDecimal > 0, (Importe / (gvr.DataKey("TC").ToString.ToDecimal - 1)).RoundSQL, 0),
- PorcentajeImpuesto:=gvr.DataKey("PorcentajeImpuesto").ToDecimal, CveCuenta:=gvr.DataKey("CveCuenta").ToEntero) Then
+ CvePersonal:=gvr.DataKey("CvePersonal").ToEntero(), CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero(),
+ ImporteMX:=Importe, CveTipoGasto:=gvr.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero(),
+ CveCliente:=gvr.DataKey("CveCliente").ToEntero(), CveVenta:=gvr.DataKey("CveVenta").ToEntero(), TipoCambio:=If(gvr.DataKey("TC").ToString().ToDecimal() > 0, gvr.DataKey("TC").ToString().ToDecimal(), 1),
+ ImporteME:=If(gvr.DataKey("TC").ToString().ToDecimal() > 0, (Importe / (gvr.DataKey("TC").ToString().ToDecimal() - 1)).RoundSQL, 0),
+ PorcentajeImpuesto:=gvr.DataKey("PorcentajeImpuesto").ToDecimal(), CveCuenta:=gvr.DataKey("CveCuenta").ToEntero()) Then
Else
MsgError = "No se pudo insertar el detalle de la póliza2"
Exit For
@@ -1054,7 +1093,7 @@ Partial Class ContabilidadC_RegPrePoliza
'MENSAJE PRINCIPAL
MensajeAlert.AppendFormat("
Folio de Póliza: {1}", ObjMov.ContaIdPoliza, ObjMov.ContaFolio)
MensajeAlert.AppendFormat("
Prepóliza: {1}", CvePrePoliza, ObjMov.ContaFolio)
- 'Alert(MensajeAlert.ToString, ModExtensiones.TipoMensaje.MsgInformacion)
+ 'Alert(MensajeAlert.Tostring(), ModExtensiones.TipoMensaje.MsgInformacion)
Else
Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico")
End If
@@ -1072,9 +1111,9 @@ Partial Class ContabilidadC_RegPrePoliza
'MENSAJE IE
If CveIE > 0 Then
MensajeAlert.AppendFormat("
Folio Bancario: {1}", CveIE, FolioIE)
- Alert(MensajeAlert.ToString, ModExtensiones.TipoMensaje.MsgInformacion, "window.location.reload()")
+ Alert(MensajeAlert.ToString(), ModExtensiones.TipoMensaje.MsgInformacion, "window.location.reload()")
Else
- Alert(If(MensajeAlert.ToString = "", "Se registro con exito.", MensajeAlert.ToString), TipoMensaje.MsgInformacion, "window.location.reload()")
+ Alert(If(MensajeAlert.ToString() = "", "Se registro con exito.", MensajeAlert.ToString()), TipoMensaje.MsgInformacion, "window.location.reload()")
End If
ObjIE.Commit()
@@ -1107,62 +1146,79 @@ Partial Class ContabilidadC_RegPrePoliza
End Sub
Private Sub ActualizarPrePoliza()
-
+ Dim contador As Integer = 0
+ 'Dim diferencia As String = ""
Dim OcurrioError As Boolean = False
- Dim ObjContabilidad As New ClsContabilidad
- ObjContabilidad.IniciaTransacSQL()
+ Using ObjContabilidad As New ClsContabilidad
+
+ ObjContabilidad.IniciaTransacSQL()
- If Not ObjContabilidad.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
- OcurrioError = True
- End If
+ If Not ObjContabilidad.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
+ OcurrioError = True
+ End If
+ If ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero(), -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate(), CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
- If ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero, -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
+ For Each row As GridViewRow In GvPrePoliza.Rows
+ Dim CvePrePolizaDetalle As Integer = row.DataKey("CvePrePolizaDetalle").ToEntero()
+ Dim Concepto As String = row.FCTextBox("TxtConcepto").Text
+ Dim CveSubProyecto As Integer = row.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero()
+ Dim CtaContable As Integer = row.FCDropDownList("DdlCtaContable").SelectedValue.ToEntero()
+ Dim TipoMovto As Boolean = If(row.FCTextBox("TxtCargo").Text.ToDecimal() <> 0, False, True)
+ Dim TipoMovtoOld As Boolean = (row.DataKey("TipoMovto").ToString = "True")
+ Dim ImporteMN As Decimal = If(row.FCTextBox("TxtCargo").Text.ToDecimal() <> 0, row.FCTextBox("TxtCargo").Text.ToDecimal(), row.FCTextBox("TxtAbono").Text.ToDecimal())
+ Dim CveTipoGastonew As Integer = If(DdlTipoGasto.Visible, row.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero(), row.DataKey("CveTipoGasto").ToEntero())
-
-
- For Each row As GridViewRow In GvPrePoliza.Rows
- If row.DataKey("CvePrePolizaDetalle").ToEntero > 0 Then
- If Not ObjContabilidad.UpdatePrepolizasDetalle(row.DataKey("CvePrePolizaDetalle").ToEntero, row.FCTextBox("TxtConcepto").Text, row.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero,
- row.FCDropDownList("DdlCtaContable").SelectedValue.ToEntero, If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0,
- row.FCTextBox("TxtCargo").Text.ToDecimal, row.FCTextBox("TxtAbono").Text.ToDecimal), CveTipoGasto:=If(DdlTipoGasto.Visible, row.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, row.DataKey("CveTipoGasto").ToEntero), CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
- OcurrioError = True
- Exit For
+ If row.DataKey("CvePrePolizaDetalle").ToEntero() > 0 Then
+ Dim actualizar As Boolean
+ actualizar = (Concepto <> row.DataKey("Concepto") OrElse CveSubProyecto <> row.DataKey("CveSubProyecto").ToEntero() OrElse CtaContable <> row.DataKey("IdCtaContable").ToEntero() OrElse
+ TipoMovto <> TipoMovtoOld OrElse ImporteMN <> row.DataKey("ImporteMN").ToDecimal() OrElse CveTipoGastonew <> row.DataKey("CveTipoGasto").ToEntero())
+ 'diferencia = $"{diferencia}\r\n /*{actualizar}*/actualizar = '{Concepto}' <> '{row.DataKey("Concepto")}' || '{CveSubProyecto}' <> '{row.DataKey("CveSubProyecto").ToEntero()}' || '{CtaContable}' <> '{row.DataKey("IdCtaContable").ToEntero()}' ||"
+ 'diferencia = $"{diferencia} '{TipoMovto}' <> '{TipoMovtoOld}' OrElse '{ImporteMN}' <> '{row.DataKey("ImporteMN").ToEntero()}' OrElse '{CveTipoGastonew}' <> '{row.DataKey("CveTipoGasto").ToEntero()}'"
+ If actualizar Then
+ contador = contador + 1
+ If Not ObjContabilidad.UpdatePrepolizasDetalle(CvePrePolizaDetalle, Concepto, CveSubProyecto,
+ CtaContable, TipoMovto, ImporteMN, CveTipoGasto:=CveTipoGastonew, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
+ OcurrioError = True
+ Exit For
+ End If
+ End If
+ Else
+ contador = contador + 1
+ If Not ObjContabilidad.AddPrePolizasDetalle(CvePrePoliza, If(row.FCTextBox("TxtCargo").Text.ToDecimal() <> 0, False, True), If(row.FCTextBox("TxtCargo").Text.ToDecimal() <> 0,
+ row.FCTextBox("TxtCargo").Text.ToDecimal(), row.FCTextBox("TxtAbono").Text.ToDecimal()), row.DataKey("Referencia").ToString(),
+ row.DataKey("CveConceptoContable").ToEntero(), row.FCTextBox("TxtConcepto").Text, Now,
+ row.FCDropDownList("DdlCtaContable").SelectedValue.ToEntero(), 0, CveSubProyecto:=row.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero(),
+ CveTipoGasto:=If(DdlTipoGasto.Visible, row.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero(), row.DataKey("CveTipoGasto").ToEntero()),
+ ImporteMX:=If(row.FCTextBox("TxtCargo").Text.ToDecimal() <> 0,
+ row.FCTextBox("TxtCargo").Text.ToDecimal(), row.FCTextBox("TxtAbono").Text.ToDecimal()), CveProveedor:=DdlProveedores.SelectedValue.ToEntero()) Then
+ OcurrioError = True
+ Exit For
+ End If
End If
- Else
- If Not ObjContabilidad.AddPrePolizasDetalle(CvePrePoliza, If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0,
- row.FCTextBox("TxtCargo").Text.ToDecimal, row.FCTextBox("TxtAbono").Text.ToDecimal), row.DataKey("Referencia").ToString,
- row.DataKey("CveConceptoContable").ToEntero, row.FCTextBox("TxtConcepto").Text, Now,
- row.FCDropDownList("DdlCtaContable").SelectedValue.ToEntero, 0, CveSubProyecto:=row.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero,
- CveTipoGasto:=If(DdlTipoGasto.Visible, row.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, row.DataKey("CveTipoGasto").ToEntero),
- ImporteMX:=If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0,
- row.FCTextBox("TxtCargo").Text.ToDecimal, row.FCTextBox("TxtAbono").Text.ToDecimal), CveProveedor:=DdlProveedores.SelectedValue.ToEntero) Then
- OcurrioError = True
- Exit For
- End If
- End If
- Next
- Else
- OcurrioError = True
- End If
+ Next
+ Else
+ OcurrioError = True
+ End If
- If Not OcurrioError Then
- ObjContabilidad.Commit()
- Alert("La PrePoliza se actualizó correctamente.", TipoMensaje.MsgInformacion)
- Else
- ObjContabilidad.RollBack()
- Alert("Ocurrio un error al actualizar la PrePoliza.", TipoMensaje.MsgError)
- End If
+ If Not OcurrioError Then
+ ObjContabilidad.Commit()
+ Alert($"La Prepoliza se actualizó correctamente. se actualizaron {contador} registros.", TipoMensaje.MsgInformacion)
+ Else
+ ObjContabilidad.RollBack()
+ Alert($"Ocurrio un error al actualizar la PrePoliza. {contador} registros.", TipoMensaje.MsgError)
+ End If
+ 'RegistraScript($"console.log(""{diferencia}"")".Replace("'", "\'"))
+ End Using
- ObjContabilidad.Dispose()
CargaPrePoliza()
If Not OcurrioError Then
- If IdPoliza > 0 Then
+ If IdPoliza > 0 AndAlso contador Then
BtnContabilizar_Click(Nothing, Nothing)
End If
@@ -1186,9 +1242,9 @@ Partial Class ContabilidadC_RegPrePoliza
Dim ConceptoContable As String = GvPrePoliza.Rows(IndiceGrid).FCLiteral("LtlConceptoContable").Text
Dim FolioFactura As String = GvPrePoliza.Rows(IndiceGrid).FCHyperLink("HlReferencia").Text
Dim Concepto As String = GvPrePoliza.Rows(IndiceGrid).FCTextBox("TxtConcepto").Text
- Dim CveSubProyecto As Integer = GvPrePoliza.Rows(IndiceGrid).FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero
- Dim CveTipoGasto As Integer = GvPrePoliza.Rows(IndiceGrid).FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero
- Dim Id As Integer = GvPrePoliza.Rows(IndiceGrid).FCDropDownList("DdlCtaContable").SelectedValue.ToEntero
+ Dim CveSubProyecto As Integer = GvPrePoliza.Rows(IndiceGrid).FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero()
+ Dim CveTipoGasto As Integer = GvPrePoliza.Rows(IndiceGrid).FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero()
+ Dim Id As Integer = GvPrePoliza.Rows(IndiceGrid).FCDropDownList("DdlCtaContable").SelectedValue.ToEntero()
Dim Cargo As Double = GvPrePoliza.Rows(IndiceGrid).FCTextBox("TxtCargo").Text.ToDouble
Dim Abono As Double = GvPrePoliza.Rows(IndiceGrid).FCTextBox("TxtAbono").Text.ToDouble
@@ -1235,10 +1291,10 @@ Partial Class ContabilidadC_RegPrePoliza
- 'TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + e.Row.FCTextBox("TxtCargo").Text.ToDouble).ToString.FormatoNumero
- 'TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + e.Row.FCTextBox("TxtAbono").Text.ToDouble).ToString.FormatoNumero
+ 'TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + e.Row.FCTextBox("TxtCargo").Text.ToDouble).Tostring().FormatoNumero
+ 'TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + e.Row.FCTextBox("TxtAbono").Text.ToDouble).Tostring().FormatoNumero
- 'Dim CveConceptoContable As Integer = e.Row.DataKey("CveConceptoContable").ToEntero
+ 'Dim CveConceptoContable As Integer = e.Row.DataKey("CveConceptoContable").ToEntero()
'If CveConceptoContable.Contiene(1, 2, 13, 38, 207, 203, 39, 61, 62, 63) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DataKey("CveVenta"))
'If CveConceptoContable.Contiene(5, 6, 17, 18, 14, 19, 25, 26, 60, 234, 235) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DataKey("CveCompra"))
@@ -1262,7 +1318,7 @@ Partial Class ContabilidadC_RegPrePoliza
Protected Sub GvMov_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvMov.RowDeleting
- Dim idMov As Integer = GvMov.DataKeys(e.RowIndex).Value.ToString.ToEntero
+ Dim idMov As Integer = GvMov.DataKeys(e.RowIndex).Value.ToString().ToEntero()
Dim Rows As DataRow() = DtMovimientos.Select("IDMov = " & idMov)
If Rows.Count > 0 Then
@@ -1294,7 +1350,7 @@ Partial Class ContabilidadC_RegPrePoliza
Dim NombreCuenta As String = ""
dr("IdCuenta") = DdlCtaContable.SelectedValue
- If DdlCtaContable.SelectedValue.ToEntero > 0 Then
+ If DdlCtaContable.SelectedValue.ToEntero() > 0 Then
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContable.SelectedValue))
If drr IsNot Nothing Then
CodigoCuenta = drr("CuentaFormato").ToString()
@@ -1313,12 +1369,12 @@ Partial Class ContabilidadC_RegPrePoliza
dr("Abono") = TxtAbono.Text.ToDouble
dr("Descripcion") = TxtDescripcion.Text
dr("CveSubProyecto") = DdlSubProyecto.SelectedValue
- dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero
- dr("CveCompra") = DdlCompras.SelectedValue.ToEntero
- dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero
- dr("CveClasificacion") = DdlClasificaciones.SelectedValue.ToEntero
- dr("CveCliente") = DdlClientes.SelectedValue.ToEntero
- dr("CveVenta") = DdlVentas.SelectedValue.ToEntero
+ dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero()
+ dr("CveCompra") = DdlCompras.SelectedValue.ToEntero()
+ dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero()
+ dr("CveClasificacion") = DdlClasificaciones.SelectedValue.ToEntero()
+ dr("CveCliente") = DdlClientes.SelectedValue.ToEntero()
+ dr("CveVenta") = DdlVentas.SelectedValue.ToEntero()
End If
GvMov.DataSource = DtMovimientos
@@ -1344,8 +1400,8 @@ Partial Class ContabilidadC_RegPrePoliza
dr("CveSubProyecto") = DdlSubProyecto.SelectedValue
- TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero
- TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero
+ TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString().FormatoNumero
+ TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString().FormatoNumero
DtMovimientos.Rows.Add(dr)
DtMovimientos.AcceptChanges()
@@ -1361,7 +1417,7 @@ Partial Class ContabilidadC_RegPrePoliza
dr("IdCuenta") = DdlCtaContable.SelectedValue
- If DdlCtaContable.SelectedValue.ToEntero > 0 Then
+ If DdlCtaContable.SelectedValue.ToEntero() > 0 Then
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContable.SelectedValue))
If drr IsNot Nothing Then
CodigoCuenta = drr("CuentaFormato").ToString()
@@ -1382,16 +1438,16 @@ Partial Class ContabilidadC_RegPrePoliza
dr("Abono") = TxtAbono.Text.ToDouble
dr("Descripcion") = TxtDescripcion.Text
dr("CveSubProyecto") = DdlSubProyecto.SelectedValue
- dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero
- dr("CveCompra") = DdlCompras.SelectedValue.ToEntero
- dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero
- dr("CveClasificacion") = DdlClasificaciones.SelectedValue.ToEntero
- dr("CveCliente") = DdlClientes.SelectedValue.ToEntero
- dr("CveVenta") = DdlVentas.SelectedValue.ToEntero
+ dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero()
+ dr("CveCompra") = DdlCompras.SelectedValue.ToEntero()
+ dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero()
+ dr("CveClasificacion") = DdlClasificaciones.SelectedValue.ToEntero()
+ dr("CveCliente") = DdlClientes.SelectedValue.ToEntero()
+ dr("CveVenta") = DdlVentas.SelectedValue.ToEntero()
dr("TC") = TxtTC.Text.ToDouble
- TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero
- TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero
+ TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString().FormatoNumero
+ TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString().FormatoNumero
DtMovimientos.Rows.Add(dr)
DtMovimientos.AcceptChanges()
@@ -1446,10 +1502,10 @@ Partial Class ContabilidadC_RegPrePoliza
End Sub
Private Sub BtnContado_Click(sender As Object, e As EventArgs) Handles BtnContado.Click
CveConcepto = 30
- CveTipoTransaccion = DdlTipoTransaccion.SelectedValue.ToEntero
- CveCuenta = DdlCuenta.SelectedValue.ToEntero
+ CveTipoTransaccion = DdlTipoTransaccion.SelectedValue.ToEntero()
+ CveCuenta = DdlCuenta.SelectedValue.ToEntero()
Folio = TxtDocumentoFolio.Text
- ImporteDocumento = TxtDocumentoImporte.Text.ToDecimal
+ ImporteDocumento = TxtDocumentoImporte.Text.ToDecimal()
Observaciones = TxtDocumentoObservaciones.Text
Beneficiario = TxtDocumentoBeneficiario.Text
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivContadoModal"))
@@ -1506,8 +1562,8 @@ Partial Class ContabilidadC_RegPrePoliza
Protected Sub DdlSubProyectoFiltro_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim Ddl As DropDownList = CType(sender, DropDownList)
For Each Gvr As GridViewRow In GvPrePoliza.Rows
- If Ddl.SelectedValue.ToEntero > 0 Then
- If Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero = Ddl.SelectedValue.ToEntero Or Not Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero > 0 Or Gvr.FCDropDownList("DdlSubProyecto").Enabled Then
+ If Ddl.SelectedValue.ToEntero() > 0 Then
+ If Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero() = Ddl.SelectedValue.ToEntero() Or Not Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero() > 0 Or Gvr.FCDropDownList("DdlSubProyecto").Enabled Then
Gvr.Visible = True
Gvr.FCDropDownList("DdlSubProyecto").SelectedValueExist(Ddl.SelectedValue)
Else
@@ -1524,8 +1580,8 @@ Partial Class ContabilidadC_RegPrePoliza
End Sub
Protected Sub DdlSubProyectoFiltroMov_SelectedIndexChanged(sender As Object, e As EventArgs)
For Each Gvr As GridViewRow In GvMov.Rows
- If DdlSubProyectoFiltroMov.SelectedValue.ToEntero > 0 Then
- If Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero = DdlSubProyectoFiltroMov.SelectedValue.ToEntero Or Not Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero > 0 Or Gvr.FCDropDownList("DdlSubProyecto").Enabled Then
+ If DdlSubProyectoFiltroMov.SelectedValue.ToEntero() > 0 Then
+ If Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero() = DdlSubProyectoFiltroMov.SelectedValue.ToEntero() Or Not Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero() > 0 Or Gvr.FCDropDownList("DdlSubProyecto").Enabled Then
Gvr.Visible = True
Gvr.FCDropDownList("DdlSubProyecto").SelectedValueExist(DdlSubProyectoFiltroMov.SelectedValue)
Else
@@ -1543,22 +1599,22 @@ Partial Class ContabilidadC_RegPrePoliza
Private Sub GvMov_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvMov.RowEditing
Actualizar = True
- GvMov.DataKeys(e.NewEditIndex).Value.ToString.ToEntero
- Dim idMov As Integer = GvMov.DataKeys(e.NewEditIndex).Value.ToString.ToEntero
+ GvMov.DataKeys(e.NewEditIndex).Value.ToString().ToEntero()
+ Dim idMov As Integer = GvMov.DataKeys(e.NewEditIndex).Value.ToString().ToEntero()
Dim DrM As DataRow = DtMovimientos.Rows(e.NewEditIndex)
If DrM IsNot Nothing Then
- HdnCve.Value = idMov.ToString
+ HdnCve.Value = idMov.ToString()
DdlCtaContable.SelectedValue = DrM("IdCuenta")
TxtReferencia.Text = DrM("Referencia")
TxtObservaciones.Text = DrM("Concepto")
' (Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) = dr("TipoMovto")
DrM("EsComodin") = 0
- DdlConceptosContables.SelectedValue = DrM("CveConcepto").ToString
- TxtCargo.Text = DrM("Cargo").ToString
- TxtAbono.Text = DrM("Abono").ToString
+ DdlConceptosContables.SelectedValue = DrM("CveConcepto").ToString()
+ TxtCargo.Text = DrM("Cargo").ToString()
+ TxtAbono.Text = DrM("Abono").ToString()
TxtDescripcion.Text = DrM("Descripcion")
DdlSubProyecto.SelectedValue = DrM("CveSubProyecto")
DdlProveedores.SelectedValue = DrM("CveProveedor")
@@ -1584,11 +1640,11 @@ Partial Class ContabilidadC_RegPrePoliza
'dr("IdCuenta") = DdlCtaContable.SelectedValue
- 'If DdlCtaContable.SelectedValue.ToEntero > 0 Then
+ 'If DdlCtaContable.SelectedValue.ToEntero() > 0 Then
' Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContable.SelectedValue))
' If drr IsNot Nothing Then
- ' CodigoCuenta = drr("CuentaFormato").ToString()
- ' NombreCuenta = drr("Nombre").ToString()
+ ' CodigoCuenta = drr("CuentaFormato").Tostring()
+ ' NombreCuenta = drr("Nombre").Tostring()
' End If
'End If
@@ -1603,15 +1659,15 @@ Partial Class ContabilidadC_RegPrePoliza
'dr("Abono") = TxtAbono.Text.ToDouble
'dr("Descripcion") = TxtDescripcion.Text
'dr("CveSubProyecto") = DdlSubProyecto.SelectedValue
- 'dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero
- 'dr("CveCompra") = DdlCompras.SelectedValue.ToEntero
- 'dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero
+ 'dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero()
+ 'dr("CveCompra") = DdlCompras.SelectedValue.ToEntero()
+ 'dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero()
'dr("CveClasificacion") = -1
- 'dr("CveCliente") = DdlClientes.SelectedValue.ToEntero
- 'dr("CveVenta") = DdlVentas.SelectedValue.ToEntero
+ 'dr("CveCliente") = DdlClientes.SelectedValue.ToEntero()
+ 'dr("CveVenta") = DdlVentas.SelectedValue.ToEntero()
- 'TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero
- 'TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero
+ 'TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).Tostring().FormatoNumero
+ 'TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).Tostring().FormatoNumero
'DtMovimientos.Rows.Add(dr)
'If CvePrePoliza > 0 Then
@@ -1653,7 +1709,7 @@ Partial Class ContabilidadC_RegPrePoliza
ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False)
End If
- If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, pIDPoliza:=If(IdPoliza > 0, IdPoliza, -1), Concepto:=TxtConcepto.Text, Fecha:=TxtFechaDocumento.Text.ToDateTime) Then
+ If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, pIDPoliza:=If(IdPoliza > 0, IdPoliza, -1), Concepto:=TxtConcepto.Text, Fecha:=TxtFechaDocumento.Text.ToDateTime()) Then
Alert(String.Format("Prepóliza contabilizada.
Folio:Ver Póliza", ObjConta.ContaIdPoliza), ModExtensiones.TipoMensaje.MsgInformacion)
Else
@@ -1685,7 +1741,7 @@ Partial Class ContabilidadC_RegPrePoliza
Str.AppendFormat("No se genero complemento por el siguiente motivo: {0}", Banco.Mensaje)
End If
Banco.Dispose()
- Alert(Str.ToString, TipoMensaje.MsgInformacion, "self.parent.tb_remove();self.parent.location.reload();")
+ Alert(Str.ToString(), TipoMensaje.MsgInformacion, "self.parent.tb_remove();self.parent.location.reload();")
End Sub
Private Sub MandaCorreo(NombreArchivo As String, Correo As String, Optional ConAlerta As Boolean = True)
@@ -1724,6 +1780,239 @@ Partial Class ContabilidadC_RegPrePoliza
Protected Sub LnkComplementoPago_Click(sender As Object, e As EventArgs)
GeneraTimbre(CvePrePoliza)
End Sub
+
+ Protected Sub LnkImprimirPDF_Click(sender As Object, e As EventArgs)
+ Dim filtro() As String = {"CveCompra", "CveIE", "CveConceptoContable"}
+ Dim filtroComplemento() As String = {"CveIE"}
+ Dim Pathpdf As New List(Of String)
+ Dim pdfs = New List(Of Byte())
+ Dim Path As String
+ Dim dt As DataTable = DtMovimientos.FiltraParametros("", "", filtro)
+ Dim ObjCompra As New ClsCompras
+ Dim ObjIE As New ClsBancos()
+ Dim pathPoliza As String = ""
+ Dim TieneComprobante As Boolean
+
+ Try
+ TieneComprobante = VerificarComprobante()
+ If TieneComprobante Then
+
+ Path = ImprimirPolizaPDF(IdPoliza)
+ pathPoliza = Path
+ If File.Exists(Path) Then
+ Pathpdf.Add(Path)
+ End If
+
+ For Each Row As DataRow In dt.Rows
+ If Row("CveConceptoContable").ToString().ToEntero() = 30 Then
+ If Row("CveIE").ToString().ToEntero() > 0 Then
+ 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
+ Dim formato As String = System.IO.Path.GetExtension(Path)
+ If formato.ToLower.Contiene(".jpg", ".png", ".jpeg") Then
+ Dim ComprobantePDF As String = String.Format("{0}\{1}\comprobante.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick)
+ Using crea_archivo = New iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 18, 18, 18, 18)
+ PdfWriter.GetInstance(crea_archivo, New FileStream(ComprobantePDF, FileMode.Create))
+ crea_archivo.Open()
+ Dim image As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(Path)
+ If image.Height > image.Width Then
+ Dim percentage As Double = 0.0F
+ percentage = 700 / image.Height
+ image.ScalePercent(percentage * 100)
+ Else
+ Dim percentage As Double = 0.0F
+ percentage = 540 / image.Width
+ image.ScalePercent(percentage * 100)
+ End If
+ crea_archivo.Add(image)
+ End Using
+ Pathpdf.Add(ComprobantePDF)
+ Else
+ Pathpdf.Add(Path)
+ End If
+ End If
+ End If
+ End If
+ End If
+ End If
+ If Row("CveConceptoContable").ToString().ToEntero().Contiene(17, 309, 312, 308) Then
+ If ObjCompra.GetCompras(Row("CveCompra").ToString().ToEntero(), "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) 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("RFC").ToString()
+ Dim CveFactura As String = dr("CveFactura").ToString()
+ 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
+ End If
+ Next
+
+
+ dt = DtMovimientos.FiltraParametros("", "", filtroComplemento)
+ For Each Row As DataRow In dt.Rows
+ If ObjCompra.GetCompraComplementoPago(-1, UsuarioActual.CveEmpresa, Row("CveIE").ToString().ToEntero()) Then
+ Console.WriteLine(Row("CveIE").ToString())
+ 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)
+ End If
+ End If
+ End If
+ End If
+ Next
+
+ MergePdfFiles(Pathpdf.ToArray)
+ If File.Exists(pathPoliza) Then
+ Directory.Delete(String.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, Tick), True)
+ End If
+
+ Else
+ Alert("No se tiene cargado comprobante de pago", TipoMensaje.MsgAdvertencia)
+ End If
+
+
+ Catch ex As Exception
+ Alert("Error al descargar el paquete", TipoMensaje.MsgError)
+ End Try
+ ObjCompra.Dispose()
+ ObjIE.Dispose()
+ End Sub
+ Private Function ImprimirPolizaPDF(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
+ 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 Archivo.Exists Then
+ ruta = UsuarioActual.Empresa.Ruta & "Formatos/Polizas.rdlc"
+ Else
+ ruta = "Empresas/Grales/Formatos/Polizas.rdlc"
+ End If
+ Bytes = StreamPDF(ruta, dtVC, params, "ppoliza")
+ If Not File.Exists(String.Format("{0}{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString())) Then
+ DirectoryExistsCreate(String.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, Tick))
+ File.WriteAllBytes(String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString()), Bytes)
+ End If
+ End If
+ Return String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString())
+ ObjConta.Dispose()
+
+ End Function
+ Private Sub MergePdfFiles(ByVal pdfFiles() As String)
+ Dim result As Boolean = False
+ Dim pdfCount As Integer = 0
+ Dim f As Integer = 0
+ Dim fileName As String
+ Dim reader As iTextSharp.text.pdf.PdfReader = Nothing
+ Dim pageCount As Integer = 0
+ Dim pdfDoc As iTextSharp.text.Document = Nothing
+ Dim writer As PdfWriter = Nothing
+ Dim cb As PdfContentByte = Nothing
+
+ Dim page As PdfImportedPage = Nothing
+ Dim rotation As Integer = 0
+
+
+ Try
+ pdfCount = pdfFiles.Length
+ If pdfCount > 0 Then
+ fileName = pdfFiles(f)
+ reader = New iTextSharp.text.pdf.PdfReader(fileName)
+ pageCount = reader.NumberOfPages
+ pdfDoc = New iTextSharp.text.Document(reader.GetPageSizeWithRotation(1), 18, 18, 18, 18)
+ writer = PdfWriter.GetInstance(pdfDoc, New FileStream(String.Format("{0}\{1}\{2}-{3}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, TipoPoliza, Folio), FileMode.Create))
+
+ With pdfDoc
+ .Open()
+ End With
+ cb = writer.DirectContent
+ While f < pdfCount
+ Dim i As Integer = 0
+ While i < pageCount
+ i += 1
+ pdfDoc.SetPageSize(reader.GetPageSizeWithRotation(i))
+ pdfDoc.NewPage()
+ page = writer.GetImportedPage(reader, i)
+ rotation = reader.GetPageRotation(i)
+ If rotation = 90 Then
+ cb.AddTemplate(page, 0, -1.0F, 1.0F, 0, 0, reader.GetPageSizeWithRotation(i).Height)
+ ElseIf rotation = 270 Then
+ cb.AddTemplate(page, 0, 1.0F, -1.0F, 0, reader.GetPageSizeWithRotation(i).Width + 60, -30)
+ Else
+ cb.AddTemplate(page, 1.0F, 0, 0, 1.0F, 0, 0)
+ End If
+ End While
+ f += 1
+ If f < pdfCount Then
+ fileName = pdfFiles(f)
+ reader = New iTextSharp.text.pdf.PdfReader(fileName)
+ pageCount = reader.NumberOfPages
+ End If
+ End While
+
+
+ pdfDoc.Close()
+
+ Dim Archivo As New System.IO.FileInfo(String.Format("{0}\{1}\{2}-{3}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, TipoPoliza, Folio))
+
+ If Archivo.Exists Then
+ HttpContext.Current.Response.Clear()
+ HttpContext.Current.Response.ClearContent()
+ HttpContext.Current.Response.ContentType = "application/octet-stream"
+ HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name))
+ HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
+ HttpContext.Current.Response.TransmitFile(String.Format("{0}\{1}\{2}-{3}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, TipoPoliza, Folio))
+ Response.Flush() ' send it to the client to download
+ HttpContext.Current.Response.SuppressContent = True
+ HttpContext.Current.ApplicationInstance.CompleteRequest()
+ Response.End()
+
+ End If
+ result = True
+ End If
+ Catch ex As Exception
+ End Try
+
+
+
+ End Sub
+
#End Region
@@ -1731,10 +2020,10 @@ Partial Class ContabilidadC_RegPrePoliza
Protected Sub DdlProveedores_SelectedIndexChanged1(sender As Object, e As EventArgs)
Dim ddl As DropDownList = CType(sender, DropDownList)
Dim ddl2 As DropDownList = DirectCast(ddl.BindingContainer, GridViewRow).FCDropDownList("DdlCompras")
- If DdlConceptosContables.SelectedValue.ToEntero.Contiene(18, 60) Then
- CargaNotasCreditoCompras(ddl.SelectedValue.ToEntero, ddl2)
+ If DdlConceptosContables.SelectedValue.ToEntero().Contiene(18, 60) Then
+ CargaNotasCreditoCompras(ddl.SelectedValue.ToEntero(), ddl2)
Else
- CargaCompras2(ddl.SelectedValue.ToEntero, ddl2)
+ CargaCompras2(ddl.SelectedValue.ToEntero(), ddl2)
End If
End Sub
@@ -1777,9 +2066,9 @@ Partial Class ContabilidadC_RegPrePoliza
Dim NombreArchivo As String
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim workbook As New ExcelFile()
- Dim worksheet = workbook.Worksheets.Add(DdlPlantilla2.SelectedItem.Text.ToString)
+ Dim worksheet = workbook.Worksheets.Add(DdlPlantilla2.SelectedItem.Text.ToString())
- Dim CvePlantilla As Integer = DdlPlantilla2.SelectedValue.ToEntero
+ Dim CvePlantilla As Integer = DdlPlantilla2.SelectedValue.ToEntero()
Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla).FiltraParametros(String.Format("CveEmpresa={0}", UsuarioActual.CveEmpresa), "Orden")
Dim DtExcel As DataTable = (From row As DataRow In Dt.Rows
@@ -1794,8 +2083,8 @@ Partial Class ContabilidadC_RegPrePoliza
.Concepto = "",
.SubProyecto = row.Item("SubProyecto"),
.CveConceptoContable = row.Item("CveConcepto"),
- .CveSubProyecto = IIf(row.Item("CveSubProyecto").ToString.ToEntero > 0, row.Item("CveSubProyecto"), -1),
- .IdCtaContable = IIf(row.Item("IdCtaContable").ToString.ToEntero > 0, row.Item("IdCtaContable"), -1)
+ .CveSubProyecto = IIf(row.Item("CveSubProyecto").ToString().ToEntero() > 0, row.Item("CveSubProyecto"), -1),
+ .IdCtaContable = IIf(row.Item("IdCtaContable").ToString().ToEntero() > 0, row.Item("IdCtaContable"), -1)
}).QueryToDataTable(True)
worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With
@@ -1814,7 +2103,7 @@ Partial Class ContabilidadC_RegPrePoliza
worksheet.Columns("K").Hidden = True
- NombreArchivo = DdlPlantilla2.SelectedItem.Text.ToString
+ NombreArchivo = DdlPlantilla2.SelectedItem.Text.ToString()
workbook.Save(Response, $"{NombreArchivo}.xlsx", SaveOptions.XlsxDefault)
@@ -1894,26 +2183,26 @@ Partial Class ContabilidadC_RegPrePoliza
Dim TotalAbonos As Integer = 0
- CvePrePoliza = ObjConta.AddPrePolizas("Contabilidad/RegPrePolizaExcel", DdlPlantilla2.SelectedValue.ToEntero, TotalCargos, TotalAbonos, 1, TxtFecha.Text.ToDate, DdlPlantilla2.SelectedItem.Text.ToString, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPolizaAdd.SelectedValue.ToEntero)
+ CvePrePoliza = ObjConta.AddPrePolizas("Contabilidad/RegPrePolizaExcel", DdlPlantilla2.SelectedValue.ToEntero(), TotalCargos, TotalAbonos, 1, TxtFecha.Text.ToDate(), DdlPlantilla2.SelectedItem.Text.ToString(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPolizaAdd.SelectedValue.ToEntero())
For Each Row As DataRow In dt.Rows
- NombreCuenta = Row("NombreCuenta").ToString
- Cuenta = Row("Cuenta").ToString
+ NombreCuenta = Row("NombreCuenta").ToString()
+ Cuenta = Row("Cuenta").ToString()
- Dim Importe As Decimal = If(Row("Cargo").ToString.ToDecimal <> 0, Row("Cargo").ToString.ToDecimal, Row("Abono").ToString.ToDecimal)
- Dim Concepto As String = Row("Concepto").ToString
- Dim Referencia As String = Row("Referencia").ToString
+ Dim Importe As Decimal = If(Row("Cargo").ToString().ToDecimal() <> 0, Row("Cargo").ToString().ToDecimal(), Row("Abono").ToString().ToDecimal())
+ Dim Concepto As String = Row("Concepto").ToString()
+ Dim Referencia As String = Row("Referencia").ToString()
Dim IdCuenta As Integer = -1
- Dim CveSubProyecto As Integer = Row("CveSubProyecto").ToString.ToEntero
- Dim TipoMovto As Boolean = If(Row("Cargo").ToString.ToDecimal <> 0, False, True)
+ Dim CveSubProyecto As Integer = Row("CveSubProyecto").ToString().ToEntero()
+ Dim TipoMovto As Boolean = If(Row("Cargo").ToString().ToDecimal() <> 0, False, True)
Dim YaExiste As Boolean = False
- Dim CveConceptoContable As Integer = Row("CveConceptoContable").ToString.ToEntero
- Dim IdCtaContable As Integer = Row("IdCtaContable").ToString.ToEntero
+ Dim CveConceptoContable As Integer = Row("CveConceptoContable").ToString().ToEntero()
+ Dim IdCtaContable As Integer = Row("IdCtaContable").ToString().ToEntero()
If ObjConta.GetCuentas(-1, Cuenta.Replace("-", ""), 1, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
- IdCuenta = ObjConta.DtResultados().FiltroPrimeroValor("CveCuenta").ToEntero
+ IdCuenta = ObjConta.DtResultados().FiltroPrimeroValor("CveCuenta").ToEntero()
'TipoCuenta = ObjConta.DtResultados().FiltroPrimeroValor("Tipo")
Else
Reporte.AppendLine($"{Cuenta} - {NombreCuenta} - {Importe} ")
@@ -1932,7 +2221,7 @@ Partial Class ContabilidadC_RegPrePoliza
If YaExiste = False Then
If IdCuenta > 0 Then
- If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, "", CveConceptoContable, Concepto, Now.ToDate, IdCtaContable, -1, ImporteMX:=Importe, CveSubProyecto:=CveSubProyecto, CveCuenta:=IdCuenta) Then
+ If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, "", CveConceptoContable, Concepto, Now.ToDate(), IdCtaContable, -1, ImporteMX:=Importe, CveSubProyecto:=CveSubProyecto, CveCuenta:=IdCuenta) Then
TieneError = True
Exit For
End If
@@ -1945,12 +2234,12 @@ Partial Class ContabilidadC_RegPrePoliza
Next
If Not TieneError Then
ObjConta.Commit()
- Alert(String.Format("