This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2022-08-03 07:02:57 -07:00
16 changed files with 1627 additions and 1335 deletions

View File

@@ -64,7 +64,7 @@ Public Class ClsBancos
Public Property Importe As Double
Public Property CveMoneda As Integer
Public Property Moneda As String
Public Property TipoCambio As Double
Public Property TipoCambio As Decimal
Public Property ClaveFormaPagoSAT As String
Public Property Observaciones As String
Public Property NotificarA As String
@@ -762,7 +762,7 @@ Public Class ClsBancos
Me.Importe = Data.Rows(0)("Importe").ToString.ToDouble
Me.CveMoneda = Data.Rows(0)("CveMoneda").ToString.ToEntero
Me.Moneda = Data.Rows(0)("Moneda").ToString
Me.TipoCambio = Data.Rows(0)("TipoCambio").ToString.ToDouble
Me.TipoCambio = Data.Rows(0)("TipoCambio").ToString.ToDecimal
Me.Observaciones = Data.Rows(0)("Observaciones").ToString
NotificarA = Data.Rows(0)("NotificarA").ToString
Me.EsAbonoEnCuenta = CBool(Data.Rows(0)("EsAbonoEnCuenta").ToString)

View File

@@ -3238,12 +3238,14 @@ Public Class ClsNominas
End Function
#Region "CRUD_SolicitudesNominas"
Public Function SolicitudesGet(CveSolicitud As Integer, CveEmpresa As Integer, Optional CveTipoSolicitud As Integer = 1) As Boolean
Public Function SolicitudesGet(CveSolicitud As Integer, CveEmpresa As Integer, Optional CveTipoSolicitud As Integer = 1, Optional Estatus As Integer = -1, Optional Top As Integer = 100000) As Boolean
Dim retorno As Boolean = False
DataAdapter("PA_Gral_SAT_SolicitudesGet", CommandType.StoredProcedure)
addParameters("@CveSolicitud", SqlDbType.Int, CveSolicitud)
addParameters("@CveEmpresa", SqlDbType.Int, CveEmpresa)
addParameters("@CveTipoSolicitud", SqlDbType.Int, CveTipoSolicitud)
addParameters("@Estatus", SqlDbType.Int, Estatus)
addParameters("@Top", SqlDbType.Int, Top)
retorno = RunQuery("Ocurrió un error al obtener el SolicitudesNominas.")
Return retorno
End Function
@@ -3263,6 +3265,68 @@ Public Class ClsNominas
retorno = RunQuery("Ocurrió un error al agregar el SolicitudesNominas.")
Return retorno
End Function
Public Function SolicitudesAdd2(CveSolicitudCFDI As Integer, CveSolicitudMetadata As Integer, estatus As Integer, observaciones As String, fechaInicio As DateTime, fechaFin As DateTime, cveUsuarioIng As Int32, cveEmpresa As Int32, Optional CveTipoSolicitud As Integer = 1) As Integer
Dim CveSolictudAgregada As Integer = -1
Try
DataAdapter("PA_Gral_SAT_SolicitudesAdd2", CommandType.StoredProcedure)
addParameters("@CveSolicitudCFDI", SqlDbType.Int, CveSolicitudCFDI)
addParameters("@CveSolicitudMetadata", SqlDbType.Int, CveSolicitudMetadata)
addParameters("@Estatus", SqlDbType.Int, estatus)
addParameters("@Observaciones", SqlDbType.VarChar, observaciones)
addParameters("@FechaInicio", SqlDbType.DateTime, fechaInicio)
addParameters("@FechaFin", SqlDbType.DateTime, fechaFin)
addParameters("@CveUsuarioIng", SqlDbType.Int, cveUsuarioIng)
addParameters("@CveEmpresa", SqlDbType.Int, cveEmpresa)
addParameters("@CveTipoSolicitud", SqlDbType.Int, CveTipoSolicitud)
With SqlAdapter.SelectCommand.Parameters
.Add("@CveSolicitud", SqlDbType.Int).Direction = ParameterDirection.Output
End With
SqlAdapter.Fill(Data)
CveSolictudAgregada = SqlAdapter.SelectCommand.Parameters("@CveSolicitud").Value.ToString.ToEntero
Catch ex As Exception
CveSolictudAgregada = -1
OnError("Ocurrió un error al agregar la Solicitud.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return CveSolictudAgregada
End Function
Public Function UpdateSolicitudDetalleCveSolicitudDetalle(CveEmpresa As Integer, UUID As String, CveSolicitudDetalle As Integer) As Boolean
Dim retorno As Boolean = False
Try
DataAdapter("PA_SAT_SolicitudesCFDIDataCveSolicitudDetalleUpdate", CommandType.StoredProcedure)
With SqlAdapter.SelectCommand.Parameters
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@UUID", SqlDbType.VarChar).Value = UUID
.Add("@CveSolicitudDetalle", SqlDbType.Int).Value = CveSolicitudDetalle
End With
SqlAdapter.Fill(Data)
retorno = True
Catch ex As Exception
retorno = False
OnError("Ocurrió un error al Actualizar SolicitudesCFDIData.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return retorno
End Function
Public Function SolicitudesUp(CveSolicitud As Int32, CveSolicitudCFDI As Int32, CveSolicitudMetadata As Int32, estatus As Int32, observaciones As String, cveEmpresa As Int32) As Boolean
Dim retorno As Boolean = False
DataAdapter("PA_Gral_SAT_SolicitudesUp", CommandType.StoredProcedure)

View File

@@ -119,6 +119,7 @@ Public Class ClsOC
Public Property UsoCFDI As String
Public Property Promocion As String
Public Property CveProveedorContacto As Integer
Public Property NumRemision As String
Public ReadOnly Property DtResultados() As DataTable
Get
@@ -685,6 +686,7 @@ Public Class ClsOC
_UsoCFDI = dr("UsoCFDI").ToString
Promocion = IfNull(dr("Promocion"), "", dr("Promocion").ToString)
CveProveedorContacto = If(Not IsDBNull(dr("CveProveedorContacto")), dr("CveProveedorContacto").ToString.ToEntero, -1)
NumRemision = dr("NumRemision").ToString
Retorno = True
ElseIf Data.Rows.Count > 0 Then
@@ -704,7 +706,7 @@ Public Class ClsOC
Optional CveCliente As Integer = -1, Optional CveVendedor As Integer = -1, Optional PrioridadObservacion As String = "",
Optional PorcentajeIVA As Decimal = 0.16, Optional IVA As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0, Optional FechaExpiracion As Date = Nothing, Optional CveCotizacion As Integer = -1,
Optional FolioAdicional As String = "", Optional EntregaDirecta As Integer = -1, Optional CveDireccionEnvio As Integer = -1, Optional Guia As String = "-1", Optional IEPS As Decimal = -1,
Optional CveIEAnticipo As Integer = -1, Optional ImporteAnticipo As Decimal = 0, Optional UsoCFDI As Integer = -1, Optional Promocion As String = "-1", Optional CveProveedorContacto As Integer = -1) As Boolean
Optional CveIEAnticipo As Integer = -1, Optional ImporteAnticipo As Decimal = 0, Optional UsoCFDI As Integer = -1, Optional Promocion As String = "-1", Optional CveProveedorContacto As Integer = -1, Optional NumRemision As String = "-1") As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_OC_OrdenesCompraAdd")
@@ -747,6 +749,7 @@ Public Class ClsOC
.Add("@UsoCFDI", SqlDbType.Int).Value = UsoCFDI
.Add("@Promocion", SqlDbType.VarChar).Value = Promocion
.Add("@CveProveedorContacto", SqlDbType.Int).Value = CveProveedorContacto
.Add("@NumRemision", SqlDbType.VarChar).Value = NumRemision
.Add("@vCveOrdenCompra", SqlDbType.Int).Direction = ParameterDirection.Output
.Add("@vFolio", SqlDbType.Int).Direction = ParameterDirection.Output
@@ -910,7 +913,7 @@ Public Class ClsOC
pCveProveedor As Integer, pCveOrdenCompra As Integer, pCveUsuarioModifico As Integer, Optional CveCliente As Integer = -1, Optional CveVendedor As Integer = -1, Optional PrioridadObservacion As String = "",
Optional IVA As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0, Optional IDPoliza As Integer = -1, Optional FechaExpiracion As Date = Nothing, Optional FolioAdicional As String = "",
Optional EntregaDirecta As Integer = -1, Optional CveDireccionEnvio As Integer = -1, Optional Guia As String = "-1", Optional IEPS As Decimal = -1, Optional UsoCFDI As Integer = -1, Optional Promocion As String = "-1",
Optional pCveProveedorSucursal As Integer = -1, Optional CveProveedorContacto As Integer = -1, Optional PorcentajeIVA As Decimal = 0.16) As Boolean
Optional pCveProveedorSucursal As Integer = -1, Optional CveProveedorContacto As Integer = -1, Optional PorcentajeIVA As Decimal = 0.16, Optional NumRemision As String = "-1") As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_OC_OrdenesCompraUpdate")
@@ -944,6 +947,7 @@ Public Class ClsOC
.Add("@CveProveedorSucursal", SqlDbType.Int).Value = pCveProveedorSucursal
.Add("@CveProveedorContacto", SqlDbType.Int).Value = CveProveedorContacto
.Add("@PorcentajeIVA", SqlDbType.SmallMoney).Value = PorcentajeIVA
.Add("@NumRemision", SqlDbType.VarChar).Value = NumRemision
End With
Try
@@ -2506,6 +2510,30 @@ Public Class ClsOC
Return Retorno
End Function
Public Function GetVerificaNumRemision(CveProveedor As Integer, Tipo As String, NumRemision As String, CveEmpresa As Integer, CveOrdenCompraValida As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_OC_OCVerificaNumRemisionGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
.Add("@Tipo", SqlDbType.VarChar).Value = Tipo
.Add("@NumRemision", SqlDbType.VarChar).Value = NumRemision
.Add("@CveOrdenCompraValida", SqlDbType.Int).Value = CveOrdenCompraValida
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al consultar las remiciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
#Region " IDisposable Support "
' IDisposable
Protected Overridable Sub Dispose(ByVal disposing As Boolean)

View File

@@ -5384,7 +5384,7 @@ Public Class ClsPaginas
PaginaDict.Add("/RH/RepUniformes.aspx".ToUpper(), 630)
PaginaDict.Add("/RH/RepUniformesResguardo.aspx".ToUpper(), 666)
PaginaDict.Add("/RH/ListaAsistenciaRH.aspx".ToUpper(), 631)
'PaginaDict.Add("/RH/ListaAsistenciaRH.aspx".ToUpper(), 631)
PaginaDict.Add("/RH/CatUniformes.aspx".ToUpper(), 632)
PaginaDict.Add("/RH/CatUniformesDetalle.aspx".ToUpper(), 633)
PaginaDict.Add("/RH/CatConceptosViaticos.aspx".ToUpper(), 662)
@@ -9360,5 +9360,356 @@ Public Class ClsPaginas
End If
dtsec.Dispose()
End Sub
#Region "P A G O D E C O M P R A S "
Public Function AplicaPrePolizaPago(CompraActual As Compra, Pago As CompraPago, CvePrePoliza As Integer, ByRef ObjConta As ClsContabilidad) As Boolean
Dim ErrorMovtos As Boolean = False
Dim PorcentajePago As Decimal = Pago.ImportePago / CompraActual.Total
Dim ImporteMovimiento As Decimal = 0
Dim tImportePago, tImporteCompra As Decimal
Dim CveConceptoContableComplementaria As Integer = 206
Pago.CveConceptoPago = If(Pago.CveConceptoPago = -1, 17, Pago.CveConceptoPago) 'si viene en parametro lo toma com primera opcion, sino el 17
If CompraActual.CveTipoConceptoProveedor = 2 Then Pago.CveConceptoPago = 308 'cuando es acreedor
If CompraActual.CveMoneda <> 1 Then
Select Case Pago.CveConceptoPago
Case 17 : Pago.CveConceptoPago = 312
Case 308 : Pago.CveConceptoPago = 309 : CveConceptoContableComplementaria = 310
Case Else
End Select
End If
Dim Concepto As String = String.Format("{0} F:{1}", CompraActual.ProveedorNombre, CompraActual.SerieFolio)
Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False)
Dim tFecha As Date = Pago.Fecha
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
If UltimaFluctuacion.FechaFluctuacion <= tFecha Then
'FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion
CompraActual.TC = UltimaFluctuacion.TCFluctuacion
End If
End If
If CompraActual.CveMoneda = 1 And Pago.CveMonedaPago <> 1 Then 'factura pesos, pago en dolares
tImportePago = ((Pago.ImportePago * CompraActual.TC / Pago.TCPago).RoundSQL * Pago.TCPago).RoundSQL
ElseIf CompraActual.CveMoneda <> 1 And Pago.CveMonedaPago <> 1 Then 'factura dolares, pago en dolares
tImporteCompra = (Pago.ImportePago * CompraActual.TC).RoundSQL
tImportePago = (Pago.ImportePago * Pago.TCPago).RoundSQL
ElseIf CompraActual.CveMoneda <> 1 And Pago.CveMonedaPago = 1 Then 'factura dolares, pago en pesos
tImporteCompra = (Pago.ImportePago * CompraActual.TC).RoundSQL
tImportePago = (Pago.ImportePago * Pago.TCPago).RoundSQL
End If
'movimiento de pago proveedor
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, Pago.CveConceptoPago, CompraActual.SerieFolio, Concepto, CompraActual.IdCtaContableProv, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveCompraAmortizacion:=Pago.CveCompraAmortizacion, TipoCambio:=CompraActual.TC) Then
ErrorMovtos = True
End If
'movimiento de pago proveedor Complementaria
If Not ErrorMovtos AndAlso CompraActual.CveMoneda > 1 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, (Pago.ImportePago * CompraActual.TC - Pago.ImportePago).RoundSQL, CveConceptoContableComplementaria, CompraActual.SerieFolio, Concepto, CompraActual.IdCtaContableProv, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveCompraAmortizacion:=Pago.CveCompraAmortizacion, TipoCambio:=CompraActual.TC, ImporteME:=Pago.ImportePago) Then
ErrorMovtos = True
End If
End If
'si tiene iva y su proporcion
If Not ErrorMovtos AndAlso CompraActual.IVA <> 0 Then
ImporteMovimiento = (PorcentajePago * CompraActual.IVA).RoundSQL
Dim Ret As CompraRetenciones = CompraActual.ConceptoPrePolizaIVA
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMovimiento, Ret.CveConceptoxAcreditar, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, PorcentajeImpuesto:=CompraActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMovimiento = ((PorcentajePago * CompraActual.IVA).RoundSQL * Pago.TCPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMovimiento, Ret.CveConceptoAcreditable, CompraActual.SerieFolio, Concepto, Ret.IdCtaContableAcreditable, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, PorcentajeImpuesto:=CompraActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
If CompraActual.IVANoDeducible > 0 Then
Dim ImporteNOIVA As Decimal = CompraActual.IVANoDeducible * PorcentajePago
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteNOIVA, ImporteNOIVA, 280, CompraActual.SerieFolio, Concepto, Ret.IdCtaContIVANoAcreditable, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, PorcentajeImpuesto:=CompraActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
End If
End If
'si tiene RET IVA y su proporcion
If Not ErrorMovtos AndAlso CompraActual.RetIVA > 0 Then
ImporteMovimiento = (PorcentajePago * CompraActual.RetIVA).RoundSQL
Dim Ret As CompraRetenciones = CompraActual.ConceptoPrePolizaRetIVA
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMovimiento, Ret.CveConceptoxAcreditar, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMovimiento = ((PorcentajePago * CompraActual.RetIVA).RoundSQL * Pago.TCPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMovimiento, Ret.CveConceptoAcreditable, CompraActual.SerieFolio, Concepto, Ret.IdCtaContableAcreditable, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
End If
'si tiene Ret ISR y su proporcion
If Not ErrorMovtos AndAlso CompraActual.RetISR > 0 Then
ImporteMovimiento = (PorcentajePago * CompraActual.RetISR).RoundSQL
Dim Ret As CompraRetenciones = CompraActual.ConceptoPrePolizaRetISR
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMovimiento, Ret.CveConceptoxAcreditar, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMovimiento = ((PorcentajePago * CompraActual.RetISR).RoundSQL * Pago.TCPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMovimiento, Ret.CveConceptoAcreditable, CompraActual.SerieFolio, Concepto, Ret.IdCtaContableAcreditable, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
End If
'si tiene IEPS y su proporcion
If Not ErrorMovtos AndAlso CompraActual.IEPS > 0 Then
ImporteMovimiento = (PorcentajePago * CompraActual.IEPS).RoundSQL
Dim Ret As New CompraRetenciones
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If ObjConta.GetRetCuenta(26, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero
If ObjConta.GetRetCuenta(25, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMovimiento, 25, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMovimiento = ((PorcentajePago * CompraActual.IEPS).RoundSQL * Pago.TCPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMovimiento, 26, CompraActual.SerieFolio, Concepto, Ret.IdCtaContableAcreditable, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
End If
'si tiene otros gastos/ingresos
ImporteMovimiento = Pago.OtroGastoIngreso
If Not ErrorMovtos AndAlso ImporteMovimiento <> 0 Then
Dim tOtCveCon As Integer = 211
Dim tOtTipoMovto As Boolean = False
If ImporteMovimiento < 0 Then
tOtTipoMovto = True : tOtCveCon = 78
ImporteMovimiento = Math.Abs(ImporteMovimiento)
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tOtTipoMovto, ImporteMovimiento, ImporteMovimiento, tOtCveCon, CompraActual.SerieFolio, Concepto, 0, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveSubProyecto:=CompraActual.CveSubProyecto) Then ErrorMovtos = True
End If
If Not ErrorMovtos AndAlso CompraActual.TC <> Pago.TCPago Then
Dim ConceptoContable, IdCtaContable As Integer
Dim TipoMovimiento As Boolean
Dim Diferencia As Decimal = 0
If tImporteCompra <> tImportePago Then
If tImporteCompra > tImportePago Then
ConceptoContable = 64 : IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
TipoMovimiento = True
Else
ConceptoContable = 65 : IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
TipoMovimiento = False
End If
Diferencia = (tImporteCompra - tImportePago).Abs.RoundSQL
End If
If FuncionalidadFluctuacionImpuestos Then
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, Pago.TCPago, CompraActual.TC)
Diferencia = (Pago.ImportePago * CompraActual.TC) - (Pago.ImportePago * Pago.TCPago) 'Añadimos la diferencia de perdida en la venta
Diferencia -= ((CompraActual.IVA * PorcentajePago) * CompraActual.TC) - ((CompraActual.IVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA
Diferencia += ((CompraActual.RetIVA * PorcentajePago) * CompraActual.TC) - ((CompraActual.RetIVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA
Diferencia += ((CompraActual.RetISR * PorcentajePago) * CompraActual.TC) - ((CompraActual.RetISR * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR
Diferencia -= ((CompraActual.IEPS * PorcentajePago) * CompraActual.TC) - ((CompraActual.IEPS * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS
Diferencia = Diferencia.Abs.RoundSQL
End If
If Diferencia <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, Diferencia, Diferencia, ConceptoContable, Concepto, Concepto, IdCtaContable, CveCompra:=CompraActual.CveCompra, CveSubProyecto:=CompraActual.CveSubProyecto, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE) Then
ErrorMovtos = True
End If
End If
End If
Return ErrorMovtos
End Function
Public Class CompraPago
Public Fecha As Date
Public Property CveIE As Integer = -1
Public Property CvePersonal As Integer = -1
Public Property ImportePago As Decimal = 0
Public Property CveMonedaPago As Integer = 1
Public Property TCPago As Decimal = 1
Public Property CveCompraAmortizacion As Integer = 0
Public Property OtroGastoIngreso As Decimal = 0
Public Property CveConceptoPago As Integer = -1 'no definido de inicio
End Class
Public Class Compra
Public Property CveCompra As Integer = -1
Public Property CveProveedor As Integer
Public Property CveTipoConceptoProveedor As Integer
Public Property CveMoneda As Integer
Public Property SerieFolio As String = ""
Public Property ProveedorNombre As String = ""
Public Property EsImportacion As Boolean = False
Public Property TC As Decimal = 1
Public Property Total As Decimal
Public Property IVA As Decimal
Public Property IVADeducible As Decimal
Public Property IVANoDeducible As Decimal = 0
Public Property IEPS As Decimal
Public Property RetIVA As Decimal
Public Property RetISR As Decimal
Public Property PorcentajeIVA As Decimal
Public Property CveConceptoRetIVA As Integer
Public Property CveConceptoRetISR As Integer
Public Property CveSubProyecto As Integer
Public Property UsuarioActual As Usuario
Public Property IdCtaContableProv As Integer
Public Property IdCtaContableProvComplementaria As Integer
Public ReadOnly Property ConceptoPrePolizaIVA As CompraRetenciones
Get
Dim Ret As New CompraRetenciones
If EsImportacion Then
Ret.CveConceptoAcreditable = 288
Ret.CveConceptoxAcreditar = 287
Else
Ret.CveConceptoAcreditable = 19
Ret.CveConceptoxAcreditar = 14
End If
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
Dim IdCtaIVAXAcreditar, IdCtaIVAAcreditable As Integer
Dim dt As DataTable = ClsPaginas.GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA)
If dt.Rows.Count > 0 Then
IdCtaIVAXAcreditar = dt.Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
IdCtaIVAAcreditable = dt.Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
End If
Ret.IdCtaContableAcreditable = IdCtaIVAAcreditable
Ret.IdCtaContablexAcreditar = IdCtaIVAXAcreditar
End If
Return Ret
End Get
End Property
Public ReadOnly Property ConceptoPrePolizaRetIVA As CompraRetenciones
Get
Dim Ret As New CompraRetenciones
Dim Funcionalidad As Integer
If CveConceptoRetIVA = 1 Then
Funcionalidad = 308
Ret.CveConceptoAcreditable = 22
Ret.CveConceptoxAcreditar = 15
ElseIf CveConceptoRetIVA = 2 Then
Funcionalidad = 310
Ret.CveConceptoAcreditable = 184
Ret.CveConceptoxAcreditar = 183
ElseIf CveConceptoRetIVA = 3 Then
Funcionalidad = 312
Ret.CveConceptoAcreditable = 186
Ret.CveConceptoxAcreditar = 185
ElseIf CveConceptoRetIVA = 4 Then
Funcionalidad = 314
Ret.CveConceptoAcreditable = 249
Ret.CveConceptoxAcreditar = 248
ElseIf CveConceptoRetIVA = 5 Then
Funcionalidad = 578
Ret.CveConceptoAcreditable = 286
Ret.CveConceptoxAcreditar = 285
ElseIf CveConceptoRetIVA = 6 Then
Funcionalidad = 578
Ret.CveConceptoAcreditable = 333
Ret.CveConceptoxAcreditar = 334
End If
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero > 0 Then
Ret.IdCtaContablexAcreditar = UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero
Else
Dim ObjConta As New ClsContabilidad
If ObjConta.GetRetCuenta(Ret.CveConceptoAcreditable, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
If ObjConta.GetRetCuenta(Ret.CveConceptoxAcreditar, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
ObjConta.Dispose()
End If
End If
Return Ret
End Get
End Property
Public ReadOnly Property ConceptoPrePolizaRetISR As CompraRetenciones
Get
Dim Ret As New CompraRetenciones
Dim Funcionalidad As Integer
If CveConceptoRetISR = 1 Then
Funcionalidad = 316
Ret.CveConceptoAcreditable = 23
Ret.CveConceptoxAcreditar = 16
ElseIf CveConceptoRetISR = 2 Then
Funcionalidad = 318
Ret.CveConceptoAcreditable = 244
Ret.CveConceptoxAcreditar = 243
ElseIf CveConceptoRetISR = 3 Then
Funcionalidad = 348
Ret.CveConceptoAcreditable = 328
Ret.CveConceptoxAcreditar = 327
End If
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero > 0 Then
Ret.IdCtaContableAcreditable = UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero
Else
Dim ObjConta As New ClsContabilidad
If ObjConta.GetRetCuenta(Ret.CveConceptoxAcreditar, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
End If
End If
If ObjConta.GetRetCuenta(Ret.CveConceptoAcreditable, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
End If
End If
ObjConta.Dispose()
End If
End If
Return Ret
End Get
End Property
End Class
Public Class CompraRetenciones
Public Property CveConceptoxAcreditar As Integer
Public Property CveConceptoAcreditable As Integer
Public Property IdCtaContablexAcreditar As Integer
Public Property IdCtaContableAcreditable As Integer
Public Property IdCtaContIVANoAcreditable As Integer
End Class
#End Region
End Class

View File

@@ -2636,13 +2636,20 @@ Public Class ClsVentas
#Region "Firmas"
Public Function GetVentasRelacionadas(CveVenta As Integer, CveEmpresa As Integer) As Boolean
#Region "Relacionadas"
''' <summary>
'''
''' </summary>
''' <param name="CveVenta"></param>
''' <param name="CveEmpresa"></param>
''' <param name="TipoRelacion"> 1. Relacion de Padres, 2. Relacion sobre hijos</param>
''' <returns></returns>
Public Function GetVentasRelacionadas(CveVenta As Integer, CveEmpresa As Integer, Optional TipoRelacion As Integer = 1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasRelacionadasGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@TipoRelacion", SqlDbType.Int).Value = TipoRelacion
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try

View File

@@ -4303,6 +4303,7 @@ Partial Class Bancos_IE
Dim MensajeError = ""
Dim IdPolizaNueva = -1
Dim FolioPolizaNueva = -1
Dim MensajeLog As String = ""
Dim Banc As New ClsBancos
Dim ObjConta As New ClsContabilidad(Banc.IniciaTransacSQL())
@@ -4427,7 +4428,7 @@ Partial Class Bancos_IE
End If
End If
MensajeLog += "GeneraCancelacionEnCero:" & GeneraCancelacionEnCero
Dim CvePrePolizaCancelacion As Integer = 0
If Not GeneraCancelacionEnCero Then
@@ -4503,37 +4504,60 @@ Partial Class Bancos_IE
If CveMotivoCancelacion > 0 AndAlso CveSATMotivoCancelacion > 0 Then
Dim ObjCancelacion As New Timbrado
If EstatusSATCancelado(FolioFiscalCancelar, UsuarioActual.Empresa.RFC, RFCReceptorCancelar) Then
Dim DtComplementos As DataTable = Nothing
If CveIE > 0 AndAlso Banc.GetComplementoPagos(-1, CveIE, -1, UsuarioActual.CveEmpresa) Then
DtComplementos = Banc.DtResultados.FiltraParametros(" Estatus IN(1,3) ")
End If
If Banc.UpdateComplementoPagoCancelado(CveComplementoPagoCancelar, 2, CvePACCancelacion, UsuarioActual.CveEmpresa, Date.Now, "", 1) Then
CargaComplementosPago()
RegistraScript("$('#ModalCancelarComplemetno').modal('hide');")
ErrorCancelarComplemento = False
Alert("El complemento se cancelo correctamente.")
End If
For Each RowComplemento As DataRow In DtComplementos.Rows
Else
Dim respCancelacion = ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptorCancelar, UsuarioActual.Empresa.RFC, CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion)
If respCancelacion.Verificado Then
CveComplementoPagoCancelar = RowComplemento("CveComplementoPago").ToString().ToEntero()
FolioFiscalCancelar = RowComplemento("FolioFiscal").ToString()
'' Dim RFCEmisor As String = UsuarioActual.Empresa.RFC
RFCReceptorCancelar = RowComplemento("RFCReceptor").ToString()
CvePACCancelacion = RowComplemento("CvePAC").ToString().ToEntero()
If Banc.UpdateComplementoPagoCancelado(CveComplementoPagoCancelar, 2, CvePACCancelacion, UsuarioActual.CveEmpresa, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse, CveSATMotivoCancelacion:=CveSATMotivoCancelacion) Then
Dim ObjCancelacion As New Timbrado
If EstatusSATCancelado(FolioFiscalCancelar, UsuarioActual.Empresa.RFC, RFCReceptorCancelar) Then
If Banc.UpdateComplementoPagoCancelado(CveComplementoPagoCancelar, 2, CvePACCancelacion, UsuarioActual.CveEmpresa, Date.Now, "", 1) Then
CargaComplementosPago()
RegistraScript("$('#ModalCancelarComplemetno').modal('hide');")
ErrorCancelarComplemento = False
Alert("El complemento se cancelo correctamente.")
Else
ErrorCancelarComplemento = True
End If
Else
Alert("Se presento un error al cancelar el complemento.", TipoMensaje.MsgAdvertencia)
Dim respCancelacion = ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptorCancelar, UsuarioActual.Empresa.RFC, CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion)
If respCancelacion.Verificado Then
If Banc.UpdateComplementoPagoCancelado(CveComplementoPagoCancelar, 2, CvePACCancelacion, UsuarioActual.CveEmpresa, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse, CveSATMotivoCancelacion:=CveSATMotivoCancelacion) Then
CargaComplementosPago()
RegistraScript("$('#ModalCancelarComplemetno').modal('hide');")
ErrorCancelarComplemento = False
Alert("El complemento se cancelo correctamente.")
End If
Else
Alert("Se presento un error al cancelar el complemento.", TipoMensaje.MsgAdvertencia)
ErrorCancelarComplemento = True
End If
End If
Next
If DtComplementos IsNot Nothing Then
DtComplementos.Dispose()
DtComplementos = Nothing
End If
Else
ErrorCancelarComplemento = True
End If
Else
ErrorCancelarComplemento = False
End If

View File

@@ -3081,7 +3081,7 @@ Partial Class Compras_Compras
'TIENE AMORTIZACIÓN
If GvAnticiposSel.Rows.Count > 0 Then
If Not DdlTipoComprobante.SelectedValue.Contiene("NC") Then
If Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") Then
BtnCancelarCompra.Visible = False
BtnEliminarCompra.Visible = False
End If
@@ -5861,8 +5861,6 @@ Partial Class Compras_Compras
'Dim CveIEProvisional = CveIE
End If
If ObjConta.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPrePoliza) Then
Dim DTPlatilla As New DataTable
@@ -5961,7 +5959,6 @@ Partial Class Compras_Compras
If TipoCreditoInteres Then
Dim importeMovimientoIn As Decimal = ImporteIECredito - importeMovimiento
Dim importeMNIn As Decimal = importeMovimientoIn * tipoCambioActual * Multiplicador
@@ -5974,7 +5971,7 @@ Partial Class Compras_Compras
End If
End If
End If
importeMovimiento = 0 : importeMN = 0
If TipoCambioCompra > 1 AndAlso DdlMoneda.SelectedValue.ToEntero <> 1 Then Concepto += $" TC{TipoCambioCompra} ${importeMovimiento.FormatoNumero(2)}"
If TipoCambioCompra = 1 Or DdlMoneda.SelectedValue.ToEntero = 1 Then
@@ -6019,6 +6016,17 @@ Partial Class Compras_Compras
IdCtaContable = IdCuentaBancaria
End If
If importeMovimiento <> 0 Then
Dim Pago As New CompraPago
Pago.ImportePago = importeMovimiento
Pago.CveIE = CveIE
Pago.CveMonedaPago = 1
Pago.CveCompraAmortizacion = -1
'Pago.CveConceptoPago = CveConceptoPago
ErrorMovtosCxP = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta)
End If
Case 14 'IVA X Acreditar
importeMovimiento = CompraActual.IVA
importeMN = (importeMovimiento * tipoCambioActual * Multiplicador).RoundSQL
@@ -6071,13 +6079,13 @@ Partial Class Compras_Compras
End If
End If
Case 224 'Otros impuestos
If Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then
importeMovimiento = OtrosImpuestos
importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador
If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
IdCtaContable = If(UsuarioActual.CveEmpresa = 119, 1171, -1)
End If
'Case 224 'Otros impuestos
' If Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then
' importeMovimiento = OtrosImpuestos
' importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador
' If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
' IdCtaContable = If(UsuarioActual.CveEmpresa = 119, 1171, -1)
' End If
Case 15 'RetIVA X Acreditar Honorarios/Serv. Prof.
If Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then
@@ -7070,6 +7078,17 @@ Partial Class Compras_Compras
End If
End If
If importeMovimiento > 0 Then
Dim Pago As New CompraPago
Pago.ImportePago = importeFE
Pago.CveIE = -1
Pago.CvePersonal = CvePersonal
ErrorPrepoliza = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta)
End If
Case 21 'Anticipo
If ArrAnticipos.Count > 0 Then
@@ -7213,12 +7232,15 @@ Partial Class Compras_Compras
If Ant.TipoMovto.Contiene("Ant") Then
Dim Pago As New CompraPago
Pago.ImportePago = importeMovimientoNC
Pago.CveIE = Ant.CveIE
Pago.CveMonedaPago = 1
If importeMovimientoNC <> 0 Then
Dim Pago As New CompraPago
Pago.ImportePago = importeMovimientoNC
Pago.CveIE = Ant.CveIE
Pago.CveMonedaPago = 1
ErrorMovtosCxP = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta)
ErrorMovtosCxP = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta)
End If
End If
@@ -7456,13 +7478,16 @@ Partial Class Compras_Compras
If CveIE > 0 Then
'inserto los movimientos de la conta para abonar al saldo
Dim Pago As New CompraPago
Pago.ImportePago = ImporteCompra
Pago.CveIE = CveIE
Pago.CveMonedaPago = 1
If ImporteCompra <> 0 Then
'inserto los movimientos de la conta para abonar al saldo
Dim Pago As New CompraPago
Pago.ImportePago = ImporteCompra
Pago.CveIE = CveIE
Pago.CveMonedaPago = 1
ErrorMovtosCxP = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta)
ErrorMovtosCxP = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta)
End If
Else
ErrorMovtosIE = True
@@ -20561,111 +20586,6 @@ Partial Class Compras_Compras
End Sub
Private Function AplicaPrePolizaPago(CompraActual As Compra, Pago As CompraPago, CvePrePoliza As Integer, ByRef ObjConta As ClsContabilidad) As Boolean
Dim ErrorMovtos As Boolean = False
Dim PorcentajePago As Decimal = Pago.ImportePago / CompraActual.Total
Dim ImporteMovimiento As Decimal = 0
Dim CveConceptoContableComplementaria As Integer = 201
Pago.CveConceptoPago = If(Pago.CveConceptoPago = -1, 17, Pago.CveConceptoPago) 'si viene en parametro lo toma com primera opcion, sino el 17
If CompraActual.CveTipoConceptoProveedor = 2 Then Pago.CveConceptoPago = 308 'cuando es acreedor
If CompraActual.CveMoneda <> 1 Then
Select Case Pago.CveConceptoPago
Case 17 : Pago.CveConceptoPago = 312
Case 308 : Pago.CveConceptoPago = 309 : CveConceptoContableComplementaria = 307
Case Else
End Select
End If
Dim Concepto As String = CompraActual.ProveedorNombre & " F:" & CompraActual.SerieFolio
'movimiento de pago proveedor
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, Pago.CveConceptoPago, CompraActual.SerieFolio, Concepto, CompraActual.IdCtaContableProv, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=CvePersonal, CveCompraAmortizacion:=Pago.CveCompraAmortizacion, TipoCambio:=CompraActual.TC) Then
ErrorMovtos = True
End If
'movimiento de pago proveedor Complementaria
If Not ErrorMovtos AndAlso CompraActual.CveMoneda > 1 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, (Pago.ImportePago * CompraActual.TC - Pago.ImportePago).RoundSQL, CveConceptoContableComplementaria, CompraActual.SerieFolio, Concepto, CompraActual.IdCtaContableProv, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=CvePersonal, CveCompraAmortizacion:=Pago.CveCompraAmortizacion, TipoCambio:=CompraActual.TC, ImporteME:=Pago.ImportePago) Then
ErrorMovtos = True
End If
End If
'si tiene iva y su proporcion
ImporteMovimiento = (PorcentajePago * CompraActual.IVA).RoundSQL
If Not ErrorMovtos AndAlso ImporteMovimiento <> 0 Then
Dim Ret As CompraRetenciones = CompraActual.ConceptoPrePolizaIVA
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMovimiento, Ret.CveConceptoxAcreditar, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, PorcentajeImpuesto:=CompraActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMovimiento, Ret.CveConceptoAcreditable, CompraActual.SerieFolio, Concepto, Ret.IdCtaContableAcreditable, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, PorcentajeImpuesto:=CompraActual.PorcentajeIVA, CvePersonal:=CvePersonal) Then ErrorMovtos = True
End If
'si tiene RET IVA y su proporcion
ImporteMovimiento = (PorcentajePago * CompraActual.RetIVA).RoundSQL
If Not ErrorMovtos AndAlso ImporteMovimiento > 0 Then
Dim Ret As CompraRetenciones = CompraActual.ConceptoPrePolizaRetIVA
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMovimiento, Ret.CveConceptoxAcreditar, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=CvePersonal) Then ErrorMovtos = True
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMovimiento, Ret.CveConceptoAcreditable, CompraActual.SerieFolio, Concepto, Ret.IdCtaContableAcreditable, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=CvePersonal) Then ErrorMovtos = True
End If
'si tiene Ret ISR y su proporcion
ImporteMovimiento = (PorcentajePago * CompraActual.RetISR).RoundSQL
If Not ErrorMovtos AndAlso ImporteMovimiento > 0 Then
Dim Ret As CompraRetenciones = CompraActual.ConceptoPrePolizaRetISR
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMovimiento, Ret.CveConceptoxAcreditar, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=CvePersonal) Then ErrorMovtos = True
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMovimiento, Ret.CveConceptoAcreditable, CompraActual.SerieFolio, Concepto, Ret.IdCtaContableAcreditable, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=CvePersonal) Then ErrorMovtos = True
End If
'si tiene IEPS y su proporcion
ImporteMovimiento = (PorcentajePago * CompraActual.IEPS).RoundSQL
If Not ErrorMovtos AndAlso ImporteMovimiento > 0 Then
Dim Ret As New CompraRetenciones
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If ObjConta.GetRetCuenta(26, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then
Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero
End If
If ObjConta.GetRetCuenta(25, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then
Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
End If
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMovimiento, 25, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=CvePersonal) Then ErrorMovtos = True
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMovimiento, 26, CompraActual.SerieFolio, Concepto, Ret.IdCtaContableAcreditable, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=CvePersonal) Then ErrorMovtos = True
End If
If Not ErrorMovtos AndAlso CompraActual.TC <> Pago.TCPago Then
ImporteMovimiento = (Pago.ImportePago * CompraActual.TC) - (Pago.ImportePago * Pago.TCPago)
Dim ConceptoContable, IdCtaContable As Integer
Dim TipoMovimiento As Boolean
If ImporteMovimiento > 0 Then
ConceptoContable = 64 : TipoMovimiento = True
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
ElseIf ImporteMovimiento < 0 Then
ConceptoContable = 65 : TipoMovimiento = False
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
End If
ImporteMovimiento = ImporteMovimiento.Abs.RoundSQL()
If ImporteMovimiento <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ImporteMovimiento, ConceptoContable, Concepto, Concepto, IdCtaContable, CveCompra:=CompraActual.CveCompra, CveSubProyecto:=CompraActual.CveSubProyecto, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE) Then
ErrorMovtos = True
End If
End If
End If
Return ErrorMovtos
End Function
End Class
Public Class MMensajeDevolucion
@@ -20675,167 +20595,3 @@ Public Class MMensajeDevolucion
Public Property Total As Decimal
End Class
Public Class CompraPago
Public Property CveIE As Integer = -1
Public Property CvePersonal As Integer = -1
Public Property ImportePago As Decimal
Public Property CveMonedaPago As Integer = 1
Public Property TCPago As Decimal = 1
Public Property CveCompraAmortizacion As Integer
Public Property CveConceptoPago As Integer = -1 'no definido de inicio
End Class
Public Class Compra
Public Property CveCompra As Integer = -1
Public Property CveProveedor As Integer
Public Property CveTipoConceptoProveedor As Integer
Public Property CveMoneda As Integer
Public Property SerieFolio As String = ""
Public Property ProveedorNombre As String = ""
Public Property EsImportacion As Boolean = False
Public Property TC As Decimal = 1
Public Property Total As Decimal
Public Property IVA As Decimal
Public Property IEPS As Decimal
Public Property RetIVA As Decimal
Public Property RetISR As Decimal
Public Property PorcentajeIVA As Decimal
Public Property CveConceptoRetIVA As Integer
Public Property CveConceptoRetISR As Integer
Public Property CveSubProyecto As Integer
Public Property UsuarioActual As Usuario
Public Property IdCtaContableProv As Integer
Public Property IdCtaContableProvComplementaria As Integer
Public ReadOnly Property ConceptoPrePolizaIVA As CompraRetenciones
Get
Dim Ret As New CompraRetenciones
If EsImportacion Then
Ret.CveConceptoAcreditable = 288
Ret.CveConceptoxAcreditar = 287
Else
Ret.CveConceptoAcreditable = 19
Ret.CveConceptoxAcreditar = 14
End If
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
Dim IdCtaIVAXAcreditar, IdCtaIVAAcreditable As Integer
Dim dt As DataTable = ClsPaginas.GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA)
If dt.Rows.Count > 0 Then
IdCtaIVAXAcreditar = dt.Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
IdCtaIVAAcreditable = dt.Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
End If
Ret.IdCtaContableAcreditable = IdCtaIVAAcreditable
Ret.IdCtaContablexAcreditar = IdCtaIVAXAcreditar
End If
Return Ret
End Get
End Property
Public ReadOnly Property ConceptoPrePolizaRetIVA As CompraRetenciones
Get
Dim Ret As New CompraRetenciones
Dim Funcionalidad As Integer
If CveConceptoRetIVA = 1 Then
Funcionalidad = 308
Ret.CveConceptoAcreditable = 22
Ret.CveConceptoxAcreditar = 15
ElseIf CveConceptoRetIVA = 2 Then
Funcionalidad = 310
Ret.CveConceptoAcreditable = 184
Ret.CveConceptoxAcreditar = 183
ElseIf CveConceptoRetIVA = 3 Then
Funcionalidad = 312
Ret.CveConceptoAcreditable = 186
Ret.CveConceptoxAcreditar = 185
ElseIf CveConceptoRetIVA = 4 Then
Funcionalidad = 314
Ret.CveConceptoAcreditable = 249
Ret.CveConceptoxAcreditar = 248
ElseIf CveConceptoRetIVA = 5 Then
Funcionalidad = 578
Ret.CveConceptoAcreditable = 286
Ret.CveConceptoxAcreditar = 285
ElseIf CveConceptoRetIVA = 6 Then
Funcionalidad = 578
Ret.CveConceptoAcreditable = 333
Ret.CveConceptoxAcreditar = 334
End If
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero > 0 Then
Ret.IdCtaContablexAcreditar = UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero
Else
Dim ObjConta As New ClsContabilidad
If ObjConta.GetRetCuenta(Ret.CveConceptoAcreditable, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
If ObjConta.GetRetCuenta(Ret.CveConceptoxAcreditar, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
ObjConta.Dispose()
End If
End If
Return Ret
End Get
End Property
Public ReadOnly Property ConceptoPrePolizaRetISR As CompraRetenciones
Get
Dim Ret As New CompraRetenciones
Dim Funcionalidad As Integer
If CveConceptoRetISR = 1 Then
Funcionalidad = 316
Ret.CveConceptoAcreditable = 23
Ret.CveConceptoxAcreditar = 16
ElseIf CveConceptoRetISR = 2 Then
Funcionalidad = 318
Ret.CveConceptoAcreditable = 244
Ret.CveConceptoxAcreditar = 243
ElseIf CveConceptoRetISR = 3 Then
Funcionalidad = 348
Ret.CveConceptoAcreditable = 328
Ret.CveConceptoxAcreditar = 327
End If
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero > 0 Then
Ret.IdCtaContableAcreditable = UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero
Else
Dim ObjConta As New ClsContabilidad
If ObjConta.GetRetCuenta(Ret.CveConceptoxAcreditar, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
End If
End If
If ObjConta.GetRetCuenta(Ret.CveConceptoAcreditable, UsuarioActual.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
End If
End If
ObjConta.Dispose()
End If
End If
Return Ret
End Get
End Property
End Class
Public Class CompraRetenciones
Public Property CveConceptoxAcreditar As Integer
Public Property CveConceptoAcreditable As Integer
Public Property IdCtaContablexAcreditar As Integer
Public Property IdCtaContableAcreditable As Integer
End Class

View File

@@ -294,7 +294,7 @@
<asp:HiddenField runat="server" ID="HdnFechasComprasVinculadas" Value="-1" ClientIDMode="Static" />
<asp:GridView ID="GvCxP" GridLines="None" CssClass="table table-hover table-advance Widthall" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Cuentas por Pagar pendientes"
DataKeyNames="CveCompra,FechaCompra,Proveedor,SerieFolio,Original,SubTotal,IVA,RetIVA,RetISR,IdCtaContProveedores,IdCtaContAcreedor,CvePrePoliza,IdPoliza,CveRetIVAConcepto,CveRetISRConcepto,IVAPorcentaje,IVADeducible,IVANoDeducible,CveTipoConcepto,CveSubProyecto,IVAPorPagar">
DataKeyNames="CveCompra,FechaCompra,CveProveedor,Proveedor,SerieFolio,SubTotal,IVA,RetIVA,RetISR,IEPS,Total,TipoCambio,IdCtaContProveedores,IdCtaContAcreedor,CvePrePoliza,IdPoliza,CveRetIVAConcepto,CveRetISRConcepto,IVAPorcentaje,IVADeducible,IVANoDeducible,CveTipoConcepto,CveSubProyecto,IVAPorPagar">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
@@ -337,9 +337,9 @@
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Monto Compra (Saldo Orig.)</HeaderTemplate>
<HeaderTemplate>Total</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlSaldoOriginal" runat="server" Text='<%# Eval("Original", "{0:N2}") %>'></asp:Literal>&nbsp;
<asp:Literal ID="LtlSaldoTotal" runat="server" Text='<%# Eval("Total", "{0:N2}") %>'></asp:Literal>&nbsp;
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>

View File

@@ -1,4 +1,6 @@

Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Imports Microsoft.Reporting.WebForms
@@ -25,6 +27,24 @@ Partial Class Compras_ReembolsosComprobaciones
ViewState("CveMoneda") = value
End Set
End Property
Private Property CveMonedaPago As Integer
Get
Return ViewState("CveMonedaPago").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveMonedaPago") = value
End Set
End Property
Private Property TipoCambioPago As Decimal
Get
Return ViewState("TipoCambioPago").ToString.ToDecimal
End Get
Set(value As Decimal)
ViewState("TipoCambioPago") = value
End Set
End Property
Private Property CvePrePolizaComprobacion As Integer
Get
@@ -92,6 +112,7 @@ Partial Class Compras_ReembolsosComprobaciones
TxtAboneA.Enabled = False
CveCuentaBancaria = -1
ViewState("CveMoneda") = 1
CveMonedaPago = 1
Folio = ""
'Cargar Filtros
@@ -224,12 +245,13 @@ Partial Class Compras_ReembolsosComprobaciones
HdnCheque.Value = tCveIE.ToString
LtChequeImporte.Text = ObjIE.Importe.FormatoNumero
CveMonedaPago = ObjIE.CveMoneda
TipoCambioPago = ObjIE.TipoCambio
Dim IndexCheque = If(UsuarioActual.TienePermisoProceso(113), DDlCheques.SelectedIndex - 1, DDlCheques.SelectedIndex)
TxtChequeSaldo.Text = DtCheques.Rows(DDlCheques.SelectedIndex - 1)("Saldo").ToString.FormatoNumero
Else
Alert("El Documento solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
End If
@@ -323,7 +345,7 @@ Partial Class Compras_ReembolsosComprobaciones
Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("CveCuenta = " & DdlCuenta.SelectedValue)
If dr IsNot Nothing Then
CveMoneda = dr("CveMoneda").ToString.ToEntero
CveMonedaPago = dr("CveMoneda").ToString.ToEntero
IdCuentaBancaria = dr("IdCtaContable").ToString.ToEntero
End If
@@ -540,7 +562,7 @@ Partial Class Compras_ReembolsosComprobaciones
Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("CveCuenta = " & DdlCuenta.SelectedValue)
If dr IsNot Nothing Then
CveMoneda = dr("CveMoneda").ToString.ToEntero
CveMonedaPago = dr("CveMoneda").ToString.ToEntero
IdCuentaBancaria = dr("IdCtaContable").ToString.ToEntero
End If
@@ -609,29 +631,18 @@ Partial Class Compras_ReembolsosComprobaciones
End If
End If
If CveIERegistrado > 0 Or CveIEExcedente > 0 Or ChkReembolsarSinBancos.Checked Then
'inserto los movimientos de la conta para abonar al saldo
If ((TxtImporte.Text.ToDecimal > 0 Or ChkReembolsarSinBancos.Checked) And CvePrePolizaIERegistrado > 0) Or ((TxtImporteVinculado.Text.ToDecimal > 0 And HdnCheque.Value.ToEntero > 0) Or ChkReembolsarSinBancos.Checked) Then
Dim SaldoCheque = If(HdnCheque.Value.ToEntero > 0, TxtChequeSaldo.Text.ToDecimal, TxtImporte.Text.ToDecimal)
Dim ImportePagar = 0.0
Dim ImporteOriginal = 0.0
Dim ImporteMovto = 0.0
Dim PorcentajePago As Decimal = 1
Dim FechaMovimiento As Date = TxtFechaDocumento.Text.ToDate
Dim ConceptoMovimiento As String = ""
Dim Referencia As String = ""
Dim IdCtaProveedor As Integer = 0
Dim IdCtaIVAxAcreditar As Integer = 0
Dim IdCtaIVAAcreditable As Integer = 0
Dim IdCtaRetIVA As Integer = 0
Dim IdCtaRetISR As Integer = 0
Dim IdCtaOtrosProductos As Integer = 0
Dim CvePrePolizaUnificar As Integer = 0
Dim SeUnifico = False
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
@@ -650,34 +661,6 @@ Partial Class Compras_ReembolsosComprobaciones
End If
End If
'Obtenemos la cuenta del IVAxAcreditar
If ObjMov.GetRetCuenta(14, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaIVAxAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero
End If
End If
'Obtenemos la cuenta del IVAAcreditable
If ObjMov.GetRetCuenta(19, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero
End If
End If
'Obtenemos la cuenta del RetIVA
If ObjMov.GetRetCuenta(15, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaRetIVA = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
'Obtenemos la cuenta del RetISR
If ObjMov.GetRetCuenta(16, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaRetISR = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
End If
End If
'Obtenemos la cuenta del IdCtaOtrosProductos
If ObjMov.GetRetCuenta(132, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
@@ -690,31 +673,41 @@ Partial Class Compras_ReembolsosComprobaciones
For Each gvr As GridViewRow In GvCxP.Rows
If gvr.FCCheckBox("Chk").Checked Then
ConceptoMovimiento = $"{gvr.DataKey("Proveedor")} F:{gvr.DataKey("SerieFolio")} {If(DdlPersonal.Visible, DdlPersonal.SelectedItem.Text, DdlCajaChica.SelectedItem.Text)}"
Referencia = gvr.DataKey("SerieFolio").ToString
IdCtaProveedor = gvr.DataKey("IdCtaContProveedores").ToEntero
Dim ImporteMovto As Decimal
Dim ConceptoMovimiento As String = $"{gvr.DataKey("Proveedor")} F:{gvr.DataKey("SerieFolio")} {If(DdlPersonal.Visible, DdlPersonal.SelectedItem.Text, DdlCajaChica.SelectedItem.Text)}"
Dim Referencia As String = gvr.DataKey("SerieFolio").ToString
Dim ImportePagar, ImporteOriginal As Decimal
ImportePagar = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
ImporteOriginal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
Dim CveConceptoContablePago As Integer = 17
If gvr.DataKey("CveTipoConcepto").ToEntero = 2 Then CveConceptoContablePago = 308 'cuando es acreedor
If CveMoneda <> 1 Then
Select Case CveConceptoContablePago
Case 17
CveConceptoContablePago = 312
Case 308
CveConceptoContablePago = 309
Case Else
End Select
End If
If gvr.DataKey("CveTipoConcepto").ToEntero = 2 Then
IdCtaProveedor = gvr.DataKey("IdCtaContAcreedor").ToEntero
Else
IdCtaProveedor = gvr.DataKey("IdCtaContProveedores").ToEntero
End If
Dim CompraActual As New Compra
CompraActual.CveCompra = gvr.DataKey("CveCompra").ToEntero
CompraActual.CveTipoConceptoProveedor = gvr.DataKey("CveTipoConcepto").ToEntero
CompraActual.CveProveedor = gvr.DataKey("CveProveedor").ToEntero
CompraActual.CveMoneda = gvr.DataKey("CveMoneda").ToEntero
CompraActual.SerieFolio = gvr.DataKey("SerieFolio").ToString
CompraActual.ProveedorNombre = gvr.DataKey("Proveedor")
CompraActual.TC = gvr.DataKey("TipoCambio").ToDecimal
CompraActual.Total = gvr.DataKey("Total").ToDecimal
CompraActual.IVA = gvr.DataKey("IVA").ToDecimal
CompraActual.IVADeducible = gvr.DataKey("IVADeducible").ToDecimal
CompraActual.IEPS = gvr.DataKey("IEPS").ToDecimal
CompraActual.RetIVA = gvr.DataKey("RetIVA").ToDecimal
CompraActual.RetISR = gvr.DataKey("RetISR").ToDecimal
CompraActual.CveConceptoRetISR = gvr.DataKey("CveRetISRConcepto").ToEntero
CompraActual.CveConceptoRetIVA = gvr.DataKey("CveRetIVAConcepto").ToEntero
CompraActual.PorcentajeIVA = gvr.DataKey("IVAPorcentaje").ToDecimal
CompraActual.UsuarioActual = UsuarioActual
CompraActual.CveSubProyecto = gvr.DataKey("CveSubProyecto").ToEntero
CompraActual.IdCtaContableProv = IdCtaProveedor
ImportePagar = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
ImporteOriginal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
If SaldoCheque > 0 Then
'ImporteMovto = If(ImportePagar > SaldoCheque, SaldoCheque, ImportePagar)
@@ -725,7 +718,6 @@ Partial Class Compras_ReembolsosComprobaciones
'SE USARA PARA PODER ELIMINAR UNA COMPROBACION
CvePrePolizaPagoOriginal = ObjMov.AddPrePolizas("Compras/Comprobaciones6", 9, ImporteMovto, ImporteMovto, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", $"Compra: { gvr.DataKey("SerieFolio").ToString }", TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
'registramos el nuevo IE
If CveCajaChica > 0 Then
CveIEPago = 0
@@ -735,229 +727,43 @@ Partial Class Compras_ReembolsosComprobaciones
CveIEPago = CveIERegistrado
End If
Dim ComisionTmp As Decimal = gvr.FCTextBox("TxtComision").Text.ToDecimal
Dim Pago As New CompraPago
Pago.Fecha = TxtFechaDocumento.Text.ToDate
Pago.ImportePago = ImporteMovto
Pago.CveIE = CveIEPago
Pago.CveMonedaPago = CveMonedaPago
Pago.TCPago = TipoCambioPago
'Otros Ingresos
If MsgError = "" AndAlso (ChkAjusteOI.Checked Or ChkOtrosIngresosCheque.Checked) AndAlso ComisionTmp <> 0 Then
Dim tOtCveCon As Integer = 211
Dim tOtTipoMovto As Boolean = False
If ComisionTmp < 0 Then
tOtTipoMovto = True : tOtCveCon = 78
ComisionTmp = Math.Abs(ComisionTmp)
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, tOtTipoMovto, ComisionTmp, Referencia, tOtCveCon, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ComisionTmp), ImporteMX:=ComisionTmp * tipoCambio) Then
MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos"
End If
If CveCajaChica > 0 AndAlso Not HdnCheque.Value.ToEntero > 0 Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, Not tOtTipoMovto, ComisionTmp, Referencia, tOtCveCon, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ComisionTmp), ImporteMX:=ComisionTmp * tipoCambio, Contabilizable:=False) Then
MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos"
End If
End If
If MsgError = "" AndAlso (ChkAjusteOI.Checked Or ChkOtrosIngresosCheque.Checked) AndAlso gvr.FCTextBox("TxtComision").Text.ToDecimal <> 0 Then
Pago.OtroGastoIngreso = gvr.FCTextBox("TxtComision").Text.ToDecimal
End If
If gvr.DataKey("Original").ToDecimal > 0 Then PorcentajePago = (ImporteMovto / gvr.DataKey("Original").ToDecimal) Else PorcentajePago = 1
If MsgError = "" AndAlso Not ChkReembolsarSinBancos.Checked AndAlso (Not HdnCheque.Value.ToEntero > 0 Or Not UsuarioActual.CveEmpresa.Contiene(119, 158)) Then
Dim ImporteMovtoTmp As Decimal = ImporteMovto
'If ComisionTmp < 0 Then
' ImporteMovtoTmp = ImporteMovto + ComisionTmp
'End If
'Si es caja chica metemos el concepto 30, si es funcionario metemos 29
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, ImporteMovtoTmp, Referencia, If(CveCajaChica > 0, 30, 29), ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEPago, CveIEDevolucion:=If(CveCajaChica > 0, If(DDlCheques.SelectedValue.ToEntero = -1, CveIECajaChica, DDlCheques.SelectedValue.ToEntero), -1), CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovtoTmp), ImporteMX:=ImporteMovtoTmp * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, Contabilizable:=If(CveCajaChica > 0 Or CvePersonal > 0, Not UsaSimplificacionCajaChica, True)) Then
ImporteMovto += Pago.OtroGastoIngreso ' si ajuste, sedebe de aplicar en su contraparte
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, ImporteMovto, Referencia, If(CveCajaChica > 0, 30, 29), ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEPago, CveIEDevolucion:=If(CveCajaChica > 0, If(DDlCheques.SelectedValue.ToEntero = -1, CveIECajaChica, DDlCheques.SelectedValue.ToEntero), -1), CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, Contabilizable:=If(CveCajaChica > 0 Or CvePersonal > 0, Not UsaSimplificacionCajaChica, True)) Then
MsgError = "Detalle"
End If
End If
'Pago Proveedores
If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, ImporteMovto, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
MsgError = "Detalle"
End If
If MsgError = "" AndAlso gvr.DataKey("IVA").ToDecimal > 0 Then
Dim PorcentajeIVA As Decimal = gvr.DataKey("IVAPorcentaje").ToDecimal
Dim IdCtaContIVAXAcreditar As Integer = 0
Dim IdCtaContIVAAcreditable As Integer = 0
Dim IdCtaContIVANoAcreditable As Integer = 0
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows.Count > 0 Then
IdCtaContIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
IdCtaContIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
IdCtaContIVANoAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows(0)("IdCtaIVANoAcreditable").ToString.ToEntero
End If
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
If ImporteMovto = gvr.FCLiteral("LtlSaldo").Text.ToDouble Then
'Agrego el IVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.DataKey("IVA").ToDecimal, Referencia, 14, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAXAcreditar > 0, IdCtaContIVAXAcreditar, IdCtaIVAxAcreditar), -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVA").ToDecimal), ImporteMX:=(gvr.DataKey("IVA").ToDecimal) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
MsgError = "Detalle"
End If
'Agrego el IVA
If gvr.DataKey("IVADeducible").ToDecimal > 0 Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, gvr.DataKey("IVADeducible").ToDecimal, Referencia, 19, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAAcreditable > 0, IdCtaContIVAAcreditable, IdCtaIVAAcreditable), -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVADeducible").ToDecimal), ImporteMX:=(gvr.DataKey("IVADeducible").ToDecimal) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
MsgError = "Detalle"
End If
End If
End If
Else
'Agrego el IVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.DataKey("IVA").ToDecimal * PorcentajePago, Referencia, 14, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAXAcreditar > 0, IdCtaContIVAXAcreditar, IdCtaIVAxAcreditar), -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
MsgError = "Detalle"
End If
'Agrego el IVA
If gvr.DataKey("IVADeducible").ToDecimal > 0 Then
Dim ImporteIVA As Decimal = gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, ImporteIVA, Referencia, 19, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAAcreditable > 0, IdCtaContIVAAcreditable, IdCtaIVAAcreditable), -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteIVA), ImporteMX:=(ImporteIVA) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
MsgError = "Detalle"
End If
End If
If AplicaPrePolizaPago(CompraActual, Pago, CvePrePolizaPago, ObjMov) Then
MsgError = "Detalle"
End If
If gvr.DataKey("IVANoDeducible").ToDecimal > 0 Then
Dim ImporteNOIVA As Decimal = gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, ImporteNOIVA, Referencia, 280, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVANoAcreditable > 0, IdCtaContIVANoAcreditable, IdCtaIVAAcreditable), -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteNOIVA), ImporteMX:=(ImporteNOIVA) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
MsgError = "Detalle"
End If
End If
End If
If MsgError = "" AndAlso gvr.DataKey("RetIVA").ToDecimal > 0 Then
Dim ConceptoContableRetIVAXAcreditar = 0, ConceptoContableRetIVAAcreditable = 0, IdCtaContableRetIVAXAcreditar = 0, IdCtaContableRetIVAAcreditable = 0, CveFunc = 0, CveFuncAcreditable = 0
Select Case gvr.DataKey("CveRetIVAConcepto").ToEntero
Case 1
ConceptoContableRetIVAXAcreditar = 15
ConceptoContableRetIVAAcreditable = 22
CveFunc = 307
CveFuncAcreditable = 308
Case 2
ConceptoContableRetIVAXAcreditar = 183
ConceptoContableRetIVAAcreditable = 184
CveFunc = 309
CveFuncAcreditable = 310
Case 3
ConceptoContableRetIVAXAcreditar = 185
ConceptoContableRetIVAAcreditable = 186
CveFunc = 311
CveFuncAcreditable = 312
Case 4
ConceptoContableRetIVAXAcreditar = 248
ConceptoContableRetIVAAcreditable = 249
CveFunc = 313
CveFuncAcreditable = 314
Case 5
ConceptoContableRetIVAXAcreditar = 285
ConceptoContableRetIVAAcreditable = 286
CveFunc = 578
CveFuncAcreditable = 578
End Select
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(CveFunc).ToEntero > 0 Then
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(CveFunc).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(CveFuncAcreditable).ToEntero > 0 Then
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(CveFuncAcreditable).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
End If
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
If ImporteMovto = gvr.FCLiteral("LtlSaldo").Text.ToDouble Then
'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, gvr.DataKey("RetIVA").ToDecimal, Referencia, ConceptoContableRetIVAXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetIVAXAcreditar, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetIVA").ToDecimal), ImporteMX:=(gvr.DataKey("RetIVA").ToDecimal) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal) Then
MsgError = "Detalle"
End If
'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.DataKey("RetIVA").ToDecimal, Referencia, ConceptoContableRetIVAAcreditable, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetIVAAcreditable, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetIVA").ToDecimal), ImporteMX:=(gvr.DataKey("RetIVA").ToDecimal) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal) Then
MsgError = "Detalle"
End If
End If
Else
'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetIVAXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetIVAXAcreditar, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal) Then
MsgError = "Detalle"
End If
'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetIVAAcreditable, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetIVAAcreditable, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal) Then
MsgError = "Detalle"
End If
End If
Dim AcreditaISR As Boolean = False
If UsuarioActual.CveEmpresa = 140 Then AcreditaISR = True
If MsgError = "" AndAlso AcreditaISR AndAlso gvr.DataKey("RetISR").ToDecimal > 0 Then
Dim ConceptoContableRetISRXAcreditar = 0, ConceptoContableRetISRAcreditable = 0, IdCtaContableRetISRXAcreditar = 0, IdCtaContableRetISRAcreditable = 0
Select Case gvr.DataKey("CveRetIVAConcepto").ToEntero
Case 1
ConceptoContableRetISRXAcreditar = 16
ConceptoContableRetISRAcreditable = 23
Case 2
ConceptoContableRetISRXAcreditar = 243
ConceptoContableRetISRAcreditable = 244
CveFunc = 309
CveFuncAcreditable = 310
Case 3
ConceptoContableRetISRXAcreditar = 327
ConceptoContableRetISRAcreditable = 328
CveFunc = 311
End Select
'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, gvr.DataKey("RetISR").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetISRXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetISRXAcreditar, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetISR").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
MsgError = "Detalle"
End If
'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.DataKey("RetISR").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetISRAcreditable, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetISRAcreditable, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetISR").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
MsgError = "Detalle"
End If
End If
End If
Dim SaldoExcedente As Decimal = gvr.FCTextBox("TxtSaldoExcedente").Text.ToDecimal
If MsgError = "" AndAlso UsuarioActual.Empresa.Funcionalidad(506) = "1" And CbPermitirExcedente.Checked = True And SaldoExcedente > 0 Then
If DDlPermitirExcedente.SelectedValue = "1" Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, SaldoExcedente, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=(SaldoExcedente) * tipoCambio, CvePersonal:=CvePersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
MsgError = "Detalle Reembolso Personal"
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, SaldoExcedente, Referencia, 132, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaOtrosProductos, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
MsgError = "Detalle Reembolso Personal"
End If
ElseIf DDlPermitirExcedente.SelectedValue = "2" Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, SaldoExcedente, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
MsgError = "Detalle Reembolso Personal Excedente"
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, SaldoExcedente, Referencia, 29, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaPersonal, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
MsgError = "Detalle Reembolso Personal Excedente"
End If
@@ -967,12 +773,6 @@ Partial Class Compras_ReembolsosComprobaciones
'Unificamos el cheque y la caja chica con los pagos y facturas
If MsgError = "" AndAlso Not IdPoliza > 0 AndAlso Not gvr.DataKey("IdPoliza").ToEntero > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(219) = "1" Then
If MsgError = "" Then
'CvePrePolizaUnificar = CvePrePolizaPago
''codigo temoral, RMF. falta criterio de unificacion, en una póliza nueva de diario
'If UsuarioActual.CveEmpresa = 119 Then
' CvePrePolizaUnificar = ObjMov.AddPrePolizas("Compras/ComprobacionesU", 9, ImporteMovto, ImporteMovto, CveMoneda, TxtFechaPrePoliza.Text.ToDate, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=TxtFolio.Text.Trim.ToEntero)
' 'CvePrePolizaUnificar = -1 ' unificar en una de diario
'End If
If Not ObjMov.PrePolizaUnificacion(CvePrePolizaPago, gvr.DataKey("CvePrePoliza").ToEntero) Then
MsgError = "No se pudo unificar la prepoliza"
@@ -1000,177 +800,25 @@ Partial Class Compras_ReembolsosComprobaciones
End If
End If
If gvr.DataKey("Original").ToDecimal > 0 Then PorcentajePago = (ImporteMovto / gvr.DataKey("Original").ToDecimal).RoundSQL Else PorcentajePago = 1
Dim Pago As New CompraPago
Pago.ImportePago = ImporteMovto
Pago.CveIE = CveIEExcedente
Pago.CveMonedaPago = CveMoneda
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, ImporteMovto, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=(ImporteMovto * tipoCambio)) Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, ImporteMovto, Referencia, 30, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CveCuenta:=CveCuentaBancaria) Then
MsgError = "no se pudo insertar el detalle de la poliza"
End If
If Not AplicaPrePolizaPago(CompraActual, Pago, CvePrePolizaPago, ObjMov) Then
MsgError = "Detalle"
Exit For
Else
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, ImporteMovto, Referencia, 30, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CveCuenta:=CveCuentaBancaria) Then
MsgError = "no se pudo insertar el detalle de la poliza"
End If
'Otros Ingresos
If ChkAjusteOI.Checked Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.FCTextBox("TxtComision").Text.ToDecimal, Referencia, UsuarioActual.Empresa.IdCuentaOtrosIngresos, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.FCTextBox("TxtComision").Text.ToDecimal), ImporteMX:=gvr.FCTextBox("TxtComision").Text.ToDecimal * tipoCambio) Then
MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos"
End If
'Otros Ingresos
If ChkAjusteOI.Checked Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.FCTextBox("TxtComision").Text.ToDecimal, Referencia, UsuarioActual.Empresa.IdCuentaOtrosIngresos, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.FCTextBox("TxtComision").Text.ToDecimal), ImporteMX:=gvr.FCTextBox("TxtComision").Text.ToDecimal * tipoCambio) Then
MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos"
End If
End If
'*********IVA. siempre se registra aunque sea cero PREGUNTAR POR EL CONCEPTO DE IVA EN Conta_Conceptos
If MsgError = "" AndAlso gvr.DataKey("IVA").ToDecimal > 0 Then
Dim PorcentajeIVA As Decimal = gvr.DataKey("IVAPorcentaje").ToDecimal
Dim IdCtaContIVAXAcreditar As Integer = 0
Dim IdCtaContIVAAcreditable As Integer = 0
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows.Count > 0 Then
IdCtaContIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
IdCtaContIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
End If
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
If gvr.FCTextBox("TxtAbonar").Text.ToDecimal = gvr.FCLiteral("LtlSaldo").Text.ToDouble Then
'Agrego el IVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.DataKey("IVA").ToDecimal, Referencia, 14, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAXAcreditar > 0, IdCtaContIVAXAcreditar, IdCtaIVAxAcreditar), -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVA").ToDecimal), ImporteMX:=(gvr.DataKey("IVA").ToDecimal) * tipoCambio, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
MsgError = "Detalle"
End If
'Agrego el IVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, False, gvr.DataKey("IVA").ToDecimal, Referencia, 19, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAAcreditable > 0, IdCtaContIVAAcreditable, IdCtaIVAAcreditable), -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVA").ToDecimal), ImporteMX:=(gvr.DataKey("IVA").ToDecimal) * tipoCambio, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
MsgError = "Detalle"
End If
End If
Else
'Agrego el IVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.DataKey("IVA").ToDecimal * PorcentajePago, Referencia, 14, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAXAcreditar > 0, IdCtaContIVAXAcreditar, IdCtaIVAxAcreditar), -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambio, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
MsgError = "Detalle"
End If
'Agrego el IVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, False, gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago, Referencia, 19, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAAcreditable > 0, IdCtaContIVAAcreditable, IdCtaIVAAcreditable), -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago) * tipoCambio, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
MsgError = "Detalle"
End If
End If
If gvr.DataKey("IVANoDeducible").ToDecimal > 0 Then
Dim IdCtaContIVANoAcreditable As Integer = 0
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows.Count > 0 Then
IdCtaContIVANoAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeIVA).Rows(0)("IdCtaIVANoAcreditable").ToString.ToEntero
End If
Dim ImporteNOIVA As Decimal = gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, ImporteNOIVA, Referencia, 280, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVANoAcreditable > 0, IdCtaContIVANoAcreditable, IdCtaIVAAcreditable), -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteNOIVA), ImporteMX:=(ImporteNOIVA) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then
MsgError = "Detalle"
End If
End If
End If
If MsgError = "" AndAlso gvr.DataKey("RetIVA").ToDecimal > 0 Then
Dim ConceptoContableRetIVAXAcreditar = 0, ConceptoContableRetIVAAcreditable = 0, IdCtaContableRetIVAXAcreditar = 0, IdCtaContableRetIVAAcreditable = 0, CveFunc = 0, CveFuncAcreditable = 0
Select Case gvr.DataKey("CveRetIVAConcepto").ToEntero
Case 1
ConceptoContableRetIVAXAcreditar = 15
ConceptoContableRetIVAAcreditable = 22
CveFunc = 307
CveFuncAcreditable = 308
Case 2
ConceptoContableRetIVAXAcreditar = 183
ConceptoContableRetIVAAcreditable = 184
CveFunc = 309
CveFuncAcreditable = 310
Case 3
ConceptoContableRetIVAXAcreditar = 185
ConceptoContableRetIVAAcreditable = 186
CveFunc = 311
CveFuncAcreditable = 312
Case 4
ConceptoContableRetIVAXAcreditar = 248
ConceptoContableRetIVAAcreditable = 249
CveFunc = 313
CveFuncAcreditable = 314
End Select
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(CveFunc).ToEntero > 0 Then
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(CveFunc).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(CveFuncAcreditable).ToEntero > 0 Then
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(CveFuncAcreditable).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
End If
'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, False, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetIVAXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetIVAXAcreditar, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
MsgError = "Detalle"
End If
'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetIVAAcreditable, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetIVAAcreditable, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
MsgError = "Detalle"
End If
End If
Dim AcreditaISR As Boolean = False
If UsuarioActual.CveEmpresa = 140 Then AcreditaISR = True
If MsgError = "" AndAlso AcreditaISR AndAlso gvr.DataKey("RetISR").ToDecimal > 0 Then
Dim ConceptoContableRetISRXAcreditar = 0, ConceptoContableRetISRAcreditable = 0, IdCtaContableRetISRXAcreditar = 0, IdCtaContableRetISRAcreditable = 0, CveFunc = 0, CveFuncAcreditable = 0
Select Case gvr.DataKey("CveRetIVAConcepto").ToEntero
Case 1
ConceptoContableRetISRXAcreditar = 16
ConceptoContableRetISRAcreditable = 23
Case 2
ConceptoContableRetISRXAcreditar = 243
ConceptoContableRetISRAcreditable = 244
CveFunc = 309
CveFuncAcreditable = 310
Case 3
ConceptoContableRetISRXAcreditar = 327
ConceptoContableRetISRAcreditable = 328
CveFunc = 311
End Select
'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, False, gvr.DataKey("RetISR").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetISRXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetISRXAcreditar, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetISR").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
MsgError = "Detalle"
End If
'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.DataKey("RetISR").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetISRAcreditable, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetISRAcreditable, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetISR").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
MsgError = "Detalle"
End If
End If
End If
If MsgError = "" AndAlso ImportePagar = ImporteOriginal Then
@@ -1229,23 +877,15 @@ Partial Class Compras_ReembolsosComprobaciones
AutoConta = False
End If
'Conta ContPAQ AUTOMATICA
If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError.Trim = "" Then
If CvePrePolizaIERegistrado > 0 Then
If IdCtaPersonal > 0 Or DdlCajaChica.Visible Then
If IdCtaProveedor > 0 Then
If IdCtaIVAxAcreditar > 0 Then
If IdCtaIVAAcreditable > 0 Then
If ObjMov.ContabilizarPrePoliza(CvePrePolizaIERegistrado, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
Else
MsgError = "Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico"
End If
Else
MsgError = "No tiene cuenta contable IVA Acreditable"
End If
If ObjMov.ContabilizarPrePoliza(CvePrePolizaIERegistrado, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
Else
MsgError = "No tiene cuenta contable IVA x Acreditar"
MsgError = "Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico"
End If
Else
MsgError = "No tiene cuenta contable de proveedor"
@@ -1258,26 +898,12 @@ Partial Class Compras_ReembolsosComprobaciones
If ChkChequeExcedente.Checked Then
If IdCuentaBancaria > 0 Then
If IdCtaProveedor > 0 Then
If IdCtaIVAxAcreditar > 0 Then
If IdCtaIVAAcreditable > 0 Then
If IdCtaRetIVA > 0 Then
If IdCtaRetISR > 0 Then
If ObjMov.ContabilizarPrePoliza(CvePrePolizaExcedente, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
Else
MsgError = "Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico"
End If
Else
MsgError = "No tiene cuenta contable Ret ISR"
End If
Else
MsgError = "No tiene cuenta contable Ret IVA"
End If
Else
MsgError = "No tiene cuenta contable IVA Acreditable"
End If
If ObjMov.ContabilizarPrePoliza(CvePrePolizaExcedente, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
Else
MsgError = "No tiene cuenta contable IVA x Acreditar"
MsgError = "Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico"
End If
Else
MsgError = "No tiene cuenta contable de proveedor"
End If
@@ -1533,7 +1159,7 @@ Partial Class Compras_ReembolsosComprobaciones
If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(7).ForeColor = Drawing.Color.Red
If e.Row.DBCampo("DiasVencidos").ToDouble > 0 AndAlso CType(sender, GridView).ID = "GvCxP" Then e.Row.Cells(5).ForeColor = Drawing.Color.Red
If e.Row.DBCampo("Original").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldoOriginal"), Literal).Text = ""
If e.Row.DBCampo("Total").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldoTotal"), Literal).Text = ""
If e.Row.DBCampo("Abonado").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlAbonado"), Literal).Text = ""
If e.Row.DBCampo("Saldo").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldo"), Literal).Text = ""
@@ -1543,7 +1169,7 @@ Partial Class Compras_ReembolsosComprobaciones
e.Row.FCTextBox("TxtSaldoExcedente").Attributes.Add("onblur", String.Format("FnSumaExcedente({0},{1},{2});", e.Row.FCTextBox("TxtSaldoExcedente").ClientID, e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo")))
e.Row.FCTextBox("TxtComision").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},2);", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo")))
e.Row.FCRangeValidator("RVComision").MinimumValue = 0.00
e.Row.FCRangeValidator("RVComision").MinimumValue = "0"
e.Row.FCRangeValidator("RVComision").MaximumValue = e.Row.DBCampo("Saldo")
End If
End Sub

View File

@@ -2645,10 +2645,10 @@ Partial Class Compras_eFacturas
sbResultado.Append($"{resultSolicitud(1)}<br/>")
Else
sbResultado.Append($"Solicitud Generada Correctamente")
sbResultado.Append($"Se presento un error al verificar las solicitudes <br/> {resultSolicitud(2)} <br>")
sbResultado.Append($"Se presento un error al verificar las solicitudes <br/> {resultSolicitud(1)} <br>")
End If
Else
sbResultado.Append($"{resultSolicitud(2)}")
sbResultado.Append($"{resultSolicitud(1)}")
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia
End If
Else
@@ -2675,7 +2675,7 @@ Partial Class Compras_eFacturas
If Continuar Then
txtFechaIAdd.Text = ""
txtFechaFAdd.Text = ""
Me.RegistraScript("$('#ModalAgregarSolicitud').modal('hide');")
Me.RegistraScript("$('#ModalViewSolicitudes').modal('hide');")
cargasolicitudes()
End If
@@ -2723,10 +2723,10 @@ Partial Class Compras_eFacturas
sbResultado.Append($"{resultSolicitud(2)}<br/>")
Else
sbResultado.Append($"Solicitud Generada Correctamente")
sbResultado.Append($"Se presento un error al verificar las solicitudes <br/> {resultSolicitud(2)} <br>")
sbResultado.Append($"Se presento un error al verificar las solicitudes <br/> {resultSolicitud(1)} <br>")
End If
Else
sbResultado.Append($"{resultSolicitud(2)}")
sbResultado.Append($"{resultSolicitud(1)}")
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia
End If
Else
@@ -2737,9 +2737,9 @@ Partial Class Compras_eFacturas
If SeVerifico AndAlso resultVerificacion.Count = 4 Then
If ResultadoVerificaionOK Then
sbResultado.Append($"{resultVerificacion(2)}<br>")
sbResultado.Append($"{resultVerificacion(1)}<br>")
Else
sbResultado.Append($"Se presento un error al verificar las solicitudes {resultVerificacion(2)}<br>")
sbResultado.Append($"Se presento un error al verificar las solicitudes {resultVerificacion(1)}<br>")
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia
End If
Else

View File

@@ -1114,7 +1114,7 @@
<Height>0.63559in</Height>
<Style />
</Body>
<Width>10.98354in</Width>
<Width>10.94855in</Width>
<Page>
<PageHeader>
<Height>2.46174cm</Height>

View File

@@ -325,20 +325,34 @@
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpDdlIVA" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<label class="col-md-2"><b>IVA A Facturar:</b> </label>
<div class="col-md-2">
<div class="row">
<label class="col-md-2"><b>IVA A Facturar:</b> </label>
<div class="col-md-2">
<asp:UpdatePanel ID="UpDdlIVA" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="DdlIVA" AutoPostBack="true" OnSelectedIndexChanged="DdlIVA_SelectedIndexChanged" CssClass="select2me" Style="width: 100%; display: inline-block;" runat="server" data-toggle="tooltip" data-placement="left" ToolTip="Si el producto aplica IVA, se tomara en cuenta el porcentaje seleccionado.">
<asp:ListItem Value="1.08">8%</asp:ListItem>
<asp:ListItem Value="1.16" Selected="True">16%</asp:ListItem>
<asp:ListItem Value="1">0%</asp:ListItem>
</asp:DropDownList>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="col-md-2" runat="server" id="DvNumRemision1" visible="false"><b>Núm. Remisión</b></div>
<div class="col-md-2" runat="server" id="DvNumRemision2" visible="false">
<asp:TextBox ID="TxtNumRemision" runat="server" MaxLength="10" Width="100%" onblur="ValidaNumRemision()"></asp:TextBox>
<asp:Button ID="BtnValidaNumRemision" ClientIDMode="Static" OnClick="BtnValidaNumRemision_Click" Style="display: none;" runat="server" />
</div>
</div>
<%--linea 7--%>
<div class="row">
<%--<label class="col-md-2">Guia:</label>--%>
@@ -2767,7 +2781,7 @@
<label for="<%= DdlTipoGasto.ClientID.ToString()%>">Tipo de Gasto:</label>
<asp:RequiredFieldValidator runat="server" Enabled="true" InitialValue="-1" Display="None" ID="RFVDdlTipoGasto" ControlToValidate="DdlTipoGasto" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo de Gasto''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpAplicaContrato"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator runat="server" Enabled="true" InitialValue="-1" Display="None" ID="RFVDdlTipoGasto" ControlToValidate="DdlTipoGasto" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo de Gasto''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpAplicaContrato"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="CERFVDdlTipoGasto" runat="server" HighlightCssClass="vco" TargetControlID="RFVDdlTipoGasto" Width="300px"></ajax:ValidatorCalloutExtender>
@@ -3215,20 +3229,20 @@
function ValidateCant(variable) {
var txt = $(variable);
var max = txt.data('cantidad');
var value = parseInt(txt.val());
var txt = $(variable);
var max = txt.data('cantidad');
var value = parseInt(txt.val());
if (value > max) {
txt.val(max);
}
}
if (value < 0) {
txt.val(0);
}
var importe = $('.txtimporte[data-cve="' + txt.data('cve') + '"]');
importe.val(parseFloat(txt.val()) * parseFloat(txt.data('pu')));
}
var importe = $('.txtimporte[data-cve="' + txt.data('cve') + '"]');
importe.val(parseFloat(txt.val()) * parseFloat(txt.data('pu')));
}
@@ -3244,6 +3258,10 @@
}
}
function ValidaNumRemision() {
$('#BtnValidaNumRemision').click();
}
</script>

View File

@@ -822,12 +822,19 @@ Partial Class OC
If UsuarioActual.Empresa.Funcionalidad(590).ToString.ToEntero = 1 Then
DVCultivosCuadro.Visible = True
DdlSubProyecto.AutoPostBack = True
DdlCultivosCuadro.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyecto.SelectedValue} AND Estatus =1")
DdlCultivosCuadro.DataBind()
DdlCultivosCuadro.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
If UsuarioActual.CveRol = 1 Then
DvNumRemision1.Visible = True
DvNumRemision2.Visible = True
End If
End If
'SOLO SE MUESTRA CUANDO ES REGISTRO NUEVO
@@ -1409,6 +1416,8 @@ Partial Class OC
LblCodigo.Text = objOC.Codigo
TxtFolioAdicional.Text = objOC.FolioAdicional
TxtNumRemision.Text = objOC.NumRemision
If Not IsNothing(objOC.Tipo) Then
Select Case objOC.Tipo.ToUpper
@@ -1750,6 +1759,10 @@ Partial Class OC
UpAcciones.Update()
End If
uppEstatus.Update()
UPPEmp.Update()
@@ -2529,6 +2542,9 @@ Partial Class OC
'VALIDACIONES PARA GUARDAR
If ValidaGuardar() Then Exit Sub
Dim MsgError As String = "Hubo un error al registrar"
'VARIABLES
Dim CveProveedorSucursal As Integer = -1
@@ -2590,12 +2606,18 @@ Partial Class OC
Dim CveOrdenCompraPadre As Integer = -1
If GeneraReq Then
If Not ValidaNumRemision(TxtNumRemision.Text.Trim(), "REQ", CveProveedor, OC.IniciaTransacSQL) Then
TieneError = True
End If
If Not TieneError Then ' AGREGAR REQUISICION
If OC.AddOrdenCompra("REQ", -1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CboE.SelectedValue.ToEntero, If(TxtFechaEstimadaEntrega.Text.Trim = "", "-1", TxtFechaEstimadaEntrega.Text.Trim),
LugarEntrega, UsuarioActual.CveUsuario, CveEmpresaActual, GvD.Rows(0).FCHiddenField("HdnCvePresupuestoEgreso").Value.ToString.ToEntero, pCveProveedor:=CveProveedor, pCveProveedorSucursal:=CveProveedorSucursal,
RequiereCotizacion:=ChkCotizacion.Checked, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal,
RetISR:=TxtRetISR.Text.ToDecimal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim,
IEPS:=TxtIEPS.Text.ToDecimal, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, CveProveedorContacto:=CveProveedorContacto) Then
IEPS:=TxtIEPS.Text.ToDecimal, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, CveProveedorContacto:=CveProveedorContacto, NumRemision:=TxtNumRemision.Text.Trim()) Then
CveOrdenCompraPadre = OC.CveOrdenCompra
If CveOrdenCompraPadre > 0 Then
@@ -2622,15 +2644,21 @@ Partial Class OC
End If
End If
If Not ValidaNumRemision(TxtNumRemision.Text.Trim(), If(TipoOS, "OS", TipoOC), CveProveedor, OC.IniciaTransacSQL) Then
TieneError = True
End If
If Not TieneError Then ' AGREGAR ORDEN DE COMPRA
If OC.AddOrdenCompra(If(TipoOS, "OS", TipoOC), -1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CveEstatusNuevo, If(TxtFechaEstimadaEntrega.Text.Trim = "", "-1", TxtFechaEstimadaEntrega.Text.Trim),
LugarEntrega, UsuarioActual.CveUsuario, CveEmpresaActual, GvD.Rows(0).FCHiddenField("HdnCvePresupuestoEgreso").Value.ToString.ToEntero, pCveProveedor:=CveProveedor, pCveProveedorSucursal:=CveProveedorSucursal,
RequiereCotizacion:=ChkCotizacion.Checked, CveUsuarioAsignado:=DdlUsuariosAsignado.SelectedValue.ToEntero, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text,
PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1),
CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=ImporteAnticipos, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero,
Promocion:=Promocion, CveProveedorContacto:=CveProveedorContacto) Then
Promocion:=Promocion, CveProveedorContacto:=CveProveedorContacto, NumRemision:=TxtNumRemision.Text) Then
CveOrdenCompra = OC.CveOrdenCompra
CveEstatus = CboE.SelectedValue.ToEntero
@@ -2790,11 +2818,17 @@ Partial Class OC
Proveedor = DdlProveedores.SelectedText.ToString
End If
If Not ValidaNumRemision(TxtNumRemision.Text.Trim(), TipoOC, CveProveedor, OC.IniciaTransacSQL, CveOrdenCompra) Then
TieneError = True
End If
If OC.UpdateOrdenCompra(-1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, ChkCotizacion.Checked, If(TxtFechaEstimadaEntrega.Text.Trim = "", "-1", TxtFechaEstimadaEntrega.Text.Trim),
LugarEntrega, DdlMoneda.SelectedValue.ToEntero, CveProveedor, CveOrdenCompra, UsuarioActual.CveUsuario, Ddlcliente.txtValue.Value.ToEntero,
DdlVendedor.SelectedValue.ToEntero, txtobsprioridad.Text, IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1),
Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveProveedorContacto:=CveProveedorContacto,
PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2)) Then
PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), NumRemision:=TxtNumRemision.Text) Then
If CveProveedorOriginal <> CveProveedor Then
If Not ObjConta.UpdateProveedorPoliza(CveOrdenCompra, CveProveedor, Proveedor) Then
TieneError = True
@@ -3263,11 +3297,17 @@ Partial Class OC
RetIVA = TxtRetIVA.Text.ToDecimal
RetISR = TxtRetISR.Text.ToDecimal
If objOrdenCompra.AddOrdenCompra("OC", -1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CveEstatusInicialOC, TxtFechaEstimadaEntrega.Text, LugarEntrega,
If Not ValidaNumRemision(TxtNumRemision.Text.Trim(), "OC", CveProveedor, objOrdenCompra.IniciaTransacSQL) Then
HuboError = True
End If
If (Not HuboError) AndAlso objOrdenCompra.AddOrdenCompra("OC", -1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CveEstatusInicialOC, TxtFechaEstimadaEntrega.Text, LugarEntrega,
CveUsuario, CveEmpresaActual, 0, pCveProveedor:=CveProveedor, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text,
PorcentajeIVA:=PorIVA, IVA:=IVACot, RetIVA:=RetIVA.ToString.ToDecimal, RetISR:=RetISR.ToString.ToDecimal, IDPoliza:=IdPoliza, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text,
EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), IEPS:=TxtIEPS.Text.ToDecimal,
CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=ImporteAnticipos, Promocion:=Promocion, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero) Then
CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=ImporteAnticipos, Promocion:=Promocion, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, NumRemision:=TxtNumRemision.Text.Trim) Then
'CREA POLIZA POR CADA PROVEEDOR
@@ -3331,11 +3371,19 @@ Partial Class OC
Else
If objOrdenCompra.AddOrdenCompra("OC", -1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CveEstatusInicialOC, TxtFechaEstimadaEntrega.Text, LugarEntrega,
If Not ValidaNumRemision(TxtNumRemision.Text.Trim(), "OC", DdlProveedores.SelectedValue.ToEntero, objOrdenCompra.IniciaTransacSQL) Then
HuboError = True
End If
If (Not HuboError) AndAlso objOrdenCompra.AddOrdenCompra("OC", -1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CveEstatusInicialOC, TxtFechaEstimadaEntrega.Text, LugarEntrega,
CveUsuario, CveEmpresaActual, 0, pCveProveedor:=DdlProveedores.SelectedValue.ToEntero, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveUsuarioAsignado:=DdlUsuariosAsignado.SelectedValue.ToEntero(), CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text,
PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, IDPoliza:=IDPolizaPresupuestal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text,
EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), IEPS:=TxtIEPS.Text.ToDecimal, CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=ImporteAnticipos, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero,
Promocion:=Promocion) Then
Promocion:=Promocion, NumRemision:=TxtNumRemision.Text.Trim) Then
'USA AC
@@ -8677,4 +8725,58 @@ Partial Class OC
Return Retorno
End Function
Private Function ValidaNumRemision(NumRemision As String, TipoOC As String, CveProveedor As Integer, Optional OcTranasaccion As System.Data.SqlClient.SqlTransaction = Nothing, Optional CveOrdenCompraValida As Integer = -1) As Boolean
Dim NumRemisionValida As Boolean = False
If NumRemision.Trim.Length > 0 Then
If UsuarioActual.Empresa.Funcionalidad(590).ToString.ToEntero = 1 AndAlso UsuarioActual.CveRol = 1 Then
Dim ObjOC As ClsOC
If OcTranasaccion IsNot Nothing Then
ObjOC = New ClsOC(OcTranasaccion)
Else
ObjOC = New ClsOC
End If
If ObjOC.GetVerificaNumRemision(CveProveedor, TipoOC, NumRemision, UsuarioActual.CveEmpresa, CveOrdenCompraValida) Then
If ObjOC.DtResultados.Rows.Count > 0 Then
Alert($"La remision ya se encuentra asiganada a la { If(TipoOC = "OC", "Orden de compra", "Requisición")} <a target='_blank' href='./OC.aspx?OC={ObjOC.DtResultados.Rows(0)("CveOrdenCompra").ToString()}' >{ObjOC.DtResultados.Rows(0)("Folio").ToString() }</a>", TipoMensaje.MsgAdvertencia)
Else
NumRemisionValida = True
End If
End If
Else
NumRemisionValida = True
End If
Else
NumRemisionValida = True
End If
Return NumRemisionValida
End Function
Protected Sub BtnValidaNumRemision_Click(sender As Object, e As EventArgs)
ValidaNumRemision(TxtNumRemision.Text.Trim(), TipoOC, DdlProveedores.SelectedValue.ToEntero, Nothing, If(CveOrdenCompra > 0, CveOrdenCompra, -1))
End Sub
End Class

View File

@@ -205,6 +205,15 @@
.reporte9 .GVSolicitudTimbreNominaGral tr td:nth-child(n+40) {
text-align: right !important;
}
/* .ajax_tab_xp .ajax_tab_body {
font-size: 9px !important;
}
*/
.ajax__tab_xp .ajax__tab_body {
font-size: 12px !important;
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
@@ -213,15 +222,21 @@
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<li>
<%-- <asp:LinkButton ID="LnkDownloadExcel" OnClick="LnkDownloadExcel_Click" runat="server"><i class="fa fa-download"></i>Descargar</asp:LinkButton>--%>
</li>
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional">
<contenttemplate>
<li>
<asp:LinkButton ID="LnkShowSolicitudes" OnClick="LnkShowSolicitudes_Click" runat="server">Solicitudes</asp:LinkButton>
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkDownloadExcel" OnClick="LnkDownloadExcel_Click" runat="server"><i class="fa fa-download"></i>Descargar</asp:LinkButton>
</li>
</contenttemplate>
<li>
<asp:LinkButton ID="LnkShowSolicitudes" OnClick="LnkShowSolicitudes_Click" runat="server"> Solicitudes</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkDownloadExcel" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
@@ -229,7 +244,7 @@
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="upDatosChec" runat="server" UpdateMode="Conditional">
<contenttemplate>
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle">
<div class="titlefiltros caption">
@@ -237,8 +252,8 @@
<label class="col-md-1">Agrupador: </label>
<div class="col-md-2">
<asp:DropDownList ID="DdlReporte" runat="server" Style="width: 100% !important;" CssClass="select2me" DataValueField="CveUsuario" DataTextField="Nombre">
<asp:ListItem Value="1" Text="Por Mes"></asp:ListItem>
<asp:ListItem Value="2" Text="Por Comprobante"></asp:ListItem>
<asp:ListItem Value="1" Text="Por Mes"></asp:ListItem>
<asp:ListItem Value="2" Text="Por Comprobante"></asp:ListItem>
</asp:DropDownList>
</div>
<label class="col-md-1 mediocol">Fecha inicio:</label>
@@ -250,10 +265,10 @@
<span class="input-group-btn ">
<asp:LinkButton ID="LnkRpdFechaInicio" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:maskededitextender id="MaskedEditExtender3" runat="server" targetcontrolid="TxtRpdFechaInicio" mask="99/99/9999" masktype="Date" displaymoney="Left" acceptnegative="Left"></ajax:maskededitextender>
<ajax:calendarextender runat="server" id="CalendarExtender3" targetcontrolid="TxtRpdFechaInicio" popupbuttonid="LnkRpdFechaInicio" popupposition="BottomRight" enabled="True" format="dd/MM/yyyy"></ajax:calendarextender>
<ajax:MaskedEditExtender ID="MaskedEditExtender3" runat="server" TargetControlID="TxtRpdFechaInicio" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CalendarExtender3" TargetControlID="TxtRpdFechaInicio" PopupButtonID="LnkRpdFechaInicio" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvRpdFechaInicio" runat="server" ControlToValidate="TxtRpdFechaInicio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Inicio''</b> es necesario, por favor ingréselo." ValidationGroup="VGReporterepperde"></asp:RequiredFieldValidator>
<ajax:validatorcalloutextender id="ValidatorCalloutExtender1" runat="server" highlightcssclass="vco" targetcontrolid="rfvRpdFechaInicio"></ajax:validatorcalloutextender>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="rfvRpdFechaInicio"></ajax:ValidatorCalloutExtender>
</div>
</div>
<label class="col-md-1 mediocol">Fecha fin:</label>
@@ -264,13 +279,13 @@
<span class="input-group-btn ">
<asp:LinkButton ID="LnkFechaFin" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:maskededitextender id="MaskedEditExtender5" runat="server" targetcontrolid="TxtRpdFechaFin" mask="99/99/9999" masktype="Date" displaymoney="Left" acceptnegative="Left"></ajax:maskededitextender>
<ajax:calendarextender runat="server" id="CalendarExtender4" targetcontrolid="TxtRpdFechaFin" popupbuttonid="LnkFechaFin" popupposition="BottomRight" enabled="True" format="dd/MM/yyyy"></ajax:calendarextender>
<ajax:MaskedEditExtender ID="MaskedEditExtender5" runat="server" TargetControlID="TxtRpdFechaFin" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CalendarExtender4" TargetControlID="TxtRpdFechaFin" PopupButtonID="LnkFechaFin" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvRpdFechaFin" runat="server" ControlToValidate="TxtRpdFechaFin" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Fin''</b> es necesario, por favor ingréselo." ValidationGroup="VGReporterepperde"></asp:RequiredFieldValidator>
<ajax:validatorcalloutextender id="ValidatorCalloutExtender2" runat="server" highlightcssclass="vco" targetcontrolid="rfvRpdFechaFin"></ajax:validatorcalloutextender>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="rfvRpdFechaFin"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="col-md-2" style="text-align:right">
<div class="col-md-2" style="text-align: right">
<asp:LinkButton ID="LnkConsultar" OnClick="LnkConsultar_Click" runat="server" Text="Consultar" Visible="true" class="btn btn-primary" />
</div>
</div>
@@ -283,257 +298,300 @@
</div>
</div>
</contenttemplate>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<contenttemplate>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvResumen" runat="server" GridLines="None" CssClass="table table-hover table-striped ScrollAD Widthall" AutoGenerateColumns="False" Width="600px" OnRowDataBound="GvResumen_RowDataBound"
ShowHeaderWhenEmpty="true" EmptyDataText="No se encontraron registros"
DataKeyNames="Mes" >
<Columns>
<asp:TemplateField HeaderText="Mes">
<ItemTemplate>
<asp:Label id="LblMes" runat="server" Text='<%# Eval("Mes")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblVTotal" runat="server" Text='<%# Eval("VTotal","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SAT" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblCBTTotal" runat="server" Text='<%# Eval("CBTTotal","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Diferencia" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblDif" runat="server" Text='<%# Eval("Dif","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<ContentTemplate>
<div class="row" runat="server" id="DVResumen1" visible="false">
<div class="col-md-6" style="text-align: right">
<input type="text" id="TxtBusquedaResumen" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaResumen','{0}')", GvResumen.ClientID) %>" style="display: inline-block; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaResumen','{0}')", GvResumen.ClientID) %>" style="margin-top: -3px; margin-left: -13px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
<div class="row" runat="server" id="DVResumen2" visible="false">
<div class="col-md-6">
<asp:GridView ID="GvResumen" runat="server" GridLines="None" CssClass="table table-hover table-striped ScrollAD Widthall" AutoGenerateColumns="False" OnRowDataBound="GvResumen_RowDataBound"
ShowHeaderWhenEmpty="true" EmptyDataText="No se encontraron registros"
DataKeyNames="Mes">
<Columns>
<asp:TemplateField HeaderText="Mes">
<ItemTemplate>
<asp:Label ID="LblMes" runat="server" Text='<%# Eval("Mes")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblVTotal" runat="server" Text='<%# Eval("VTotal","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SAT" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblCBTTotal" runat="server" Text='<%# Eval("CBTTotal","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Diferencia" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblDif" runat="server" Text='<%# Eval("Dif","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
<div class="row" runat="server" id="DvDatos1" visible="false">
<div class="col-md-12">
<div class="col-md-12" style="text-align: right">
<input type="text" id="TxtBusquedaDatos" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaDatos','{0}')", GvDatos.ClientID) %>" style="display: inline-block; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaDatos','{0}')", GvDatos.ClientID) %>" style="margin-top: -3px; margin-left: -13px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvDatos" runat="server" GridLines="None" CssClass="table table-hover table-striped ScrollAD Widthall" Visible ="false" AutoGenerateColumns="false" OnRowDataBound="GvDatos_RowDataBound"
ShowHeaderWhenEmpty="true" EmptyDataText="No se encontraron registros"
DataKeyNames="UUID,CountRegistros,VTotal,CBTTotal">
<Columns>
<asp:TemplateField HeaderText="Folio">
<ItemTemplate>
<asp:Label runat="server" ID="LblUUID" Text='<%# Eval("UUID")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</div>
</div>
<div class="row" runat="server" id="DvDatos2" visible="false">
<div class="col-md-12">
<asp:GridView ID="GvDatos" runat="server" GridLines="None" CssClass="table table-hover table-striped ScrollAD Widthall" AutoGenerateColumns="false" OnRowDataBound="GvDatos_RowDataBound"
ShowHeaderWhenEmpty="true" EmptyDataText="No se encontraron registros"
DataKeyNames="UUID,CountRegistros,VTotal,CBTTotal,CountRegistrosSIG,CountRegistrosSAT,DifImporte,Abreviatura,CBTMoneda,CFDIData,CveSolicitudDetalle,CveVenta,VSerieFolio,Sistema">
<Columns>
<asp:TemplateField HeaderText="Folio">
<ItemTemplate>
<asp:Label runat="server" ID="LblUUID" Text='<%# Eval("UUID")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG">
<ItemTemplate>
<asp:Label runat="server" ID="LblEnSistema" Text='<%# Eval("Sistema")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG">
<ItemTemplate>
<asp:Label runat="server" ID="LblEnSistema" Text='<%# Eval("Sistema")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SAT" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblCFDIData" Text='<%# Eval("CFDIData")%>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SAT" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:LinkButton runat="server" ID="LnkCFDIData" OnClick="LnkCFDIData_Click" Text='<%# Eval("CFDIData")%>' ></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Serie Folio" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblVSerieFolio" Text='<%# Eval("VSerieFolio")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Serie Folio" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblVSerieFolio" Text='<%# Eval("VSerieFolio")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblVTotal" Text='<%# Eval("VTotal","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Sub Total" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblVSubTotal" Text='<%# Eval("VSubTotal","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="IVA" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblVIVA" Text='<%# Eval("VIVA","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="IEPS" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblVIEPS" Text='<%# Eval("VIEPS","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblVTotal" Text='<%# Eval("VTotal","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Sub Total" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblVSubTotal" Text='<%# Eval("VSubTotal","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ret. IVA" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblVRetIVA" Text='<%# Eval("VRetIVA","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="IVA" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblVIVA" Text='<%# Eval("VIVA","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ret. ISR" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblVRetISR" Text='<%# Eval("VRetISR","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="IEPS" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblVIEPS" Text='<%# Eval("VIEPS","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ret. IVA" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblVRetIVA" Text='<%# Eval("VRetIVA","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ret. ISR" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblVRetISR" Text='<%# Eval("VRetISR","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Moneda" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label runat="server" ID="LblAbreviatura" Text='<%# Eval("Abreviatura")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblCBTTotal" Text='<%# Eval("CBTTotal","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Sub Total" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblCBTSubTotal" Text='<%# Eval("CBTSubTotal","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblCBTTotal" Text='<%# Eval("CBTTotal","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="IVA" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblImpIVA" Text='<%# Eval("ImpIVA","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Sub Total" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblCBTSubTotal" Text='<%# Eval("CBTSubTotal","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="IEPS" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblImpIEPS" Text='<%# Eval("ImpIEPS","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="IVA" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblImpIVA" Text='<%# Eval("ImpIVA","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="IEPS" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblImpIEPS" Text='<%# Eval("ImpIEPS","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ret. ISR" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblImpRetISR" Text='<%# Eval("ImpRetISR","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ret. ISR" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblImpRetISR" Text='<%# Eval("ImpRetISR","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ret. IVA" ItemStyle-HorizontalAlign="Right" >
<ItemTemplate>
<asp:Label runat="server" ID="LblImpRetIVA" Text='<%# Eval("ImpRetIVA","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ret. IVA" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" ID="LblImpRetIVA" Text='<%# Eval("ImpRetIVA","{0:N2}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Moneda" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label runat="server" ID="LblCBTMoneda" Text='<%# Eval("CBTMoneda")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</Columns>
</asp:GridView>
</div>
</div>
</div>
</contenttemplate>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="ModalViewSolicitudes" class="modal ADS fade" role="dialog">
<asp:UpdatePanel ID="UPModalViewSolicitudes" class="modal-dialog rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<contenttemplate>
<div id="ModalViewSolicitudes" class="modal ADS fade" role="dialog">
<asp:UpdatePanel ID="UPModalViewSolicitudes" class="modal-dialog rowpadding xspadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Solicitudes CFDI</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12" style="text-align:right">
<div class="row">
<div class="col-md-12" style="text-align: right">
<asp:LinkButton ID="LnkAgregarSolictud" runat="server" data-toggle="tooltip" data-placement="right" OnClick="LnkAgregarSolictud_Click" title="Agregar Solicitud." CssClass="btn btn-circle btn-default" Text="<i class='fa fa-plus'></i> Agregar Solicitud"></asp:LinkButton>
</div>
</div>
<ajax:TabContainer runat="server" ID="TabPanel" ActiveTabIndex="0">
<ajax:TabPanel runat="server" HeaderText="Pendientes" ID="TabPendientes">
<ContentTemplate>
<asp:GridView ID="GVSolicitudesPendientes" runat="server" GridLines="None" CssClass="table table-hover table-striped ScrollAD Widthall" AutoGenerateColumns="False"
ShowHeaderWhenEmpty="true" EmptyDataText="No se encontraron registros"
DataKeyNames="CveSolicitud,CveSolicitudCFDI,CveSolicitudMetadata,Estatus,Observaciones,FechaInicio,FechaFin,FechaIng,CveUsuarioIng,CveEmpresa">
<Columns>
<asp:TemplateField HeaderText="Folio">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("CveSolicitud")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Inicio">
<ItemTemplate>
<asp:Label ID="lblfechaInicio" runat="server" Text='<%# Eval("FechaInicio","{0:dd/MM/yyyy}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Fin">
<ItemTemplate>
<asp:Label ID="lblfechaFin" runat="server" Text='<%# Eval("FechaFin","{0:dd/MM/yyyy}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Estatus">
<ItemTemplate>
<asp:Label ID="lblestatus" runat="server" Text='<%# Eval("EstatusText")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Observaciones">
<ItemTemplate>
<asp:Label ID="lblobservaciones" runat="server" Text='<%# Eval("Observaciones")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha solicitud">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("FechaIng","{0:dd/MM/yyyy HH:mm}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Solicitó">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("UsuarioIng")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GVSolicitudesPendientes" runat="server" GridLines="None" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" AutoGenerateColumns="False"
ShowHeaderWhenEmpty="true" EmptyDataText="No se encontraron registros"
DataKeyNames="CveSolicitud,CveSolicitudCFDI,CveSolicitudMetadata,Estatus,Observaciones,FechaInicio,FechaFin,FechaIng,CveUsuarioIng,CveEmpresa,ArchivoXML,idSolicitud,CveSolicitudDetalle">
<Columns>
<asp:TemplateField HeaderText="Folio">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("CveSolicitud")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Inicio">
<ItemTemplate>
<asp:Label ID="lblfechaInicio" runat="server" Text='<%# Eval("FechaInicio","{0:dd/MM/yyyy}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Fin">
<ItemTemplate>
<asp:Label ID="lblfechaFin" runat="server" Text='<%# Eval("FechaFin","{0:dd/MM/yyyy}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Estatus">
<ItemTemplate>
<asp:Label ID="lblestatus" runat="server" Text='<%# Eval("EstatusText")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Observaciones">
<ItemTemplate>
<asp:Label ID="lblobservaciones" runat="server" Text='<%# Eval("Observaciones")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha solicitud">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("FechaIng","{0:dd/MM/yyyy}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Solicitó">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("UsuarioIng")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
<div class="row">
<div class="col-md-12" style="text-align: center">
<asp:LinkButton ID="LnkverificarSolicitudes" CssClass="btn btn-primary" OnClick="LnkverificarSolicitudes_Click" runat="server">Verificar pendientes</asp:LinkButton>
</div>
</div>
</ContentTemplate>
</ajax:TabPanel>
@@ -541,50 +599,74 @@
<ajax:TabPanel runat="server" HeaderText="Historial" ID="TabHistorial">
<ContentTemplate>
<asp:GridView ID="GVSolicitudesNominas" runat="server" GridLines="None" CssClass="table table-hover table-striped ScrollAD Widthall" AutoGenerateColumns="False"
ShowHeaderWhenEmpty="true" EmptyDataText="No se encontraron registros"
DataKeyNames="CveSolicitud,idSolicitudCFDI,idSolicitudMetadata,Estatus,Observaciones,FechaInicio,FechaFin,FechaIng,CveUsuarioIng,CveEmpresa">
<Columns>
<asp:TemplateField HeaderText="Folio">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("CveSolicitud")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Inicio">
<ItemTemplate>
<asp:Label ID="lblfechaInicio" runat="server" Text='<%# Eval("FechaInicio","{0:dd/MM/yyyy}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Fin">
<ItemTemplate>
<asp:Label ID="lblfechaFin" runat="server" Text='<%# Eval("FechaFin","{0:dd/MM/yyyy}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="No CFDI">
<ItemTemplate>
<asp:Label ID="lblobservaciones" runat="server" Text='<%# Eval("numeroCFDIs")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Observaciones">
<ItemTemplate>
<asp:Label ID="lblobservaciones" runat="server" Text='<%# Eval("Observaciones")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha solicitud">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("FechaIng","{0:dd/MM/yyyy HH:mm}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Solicitó">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("UsuarioIng")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GVSolicitudesNominas" runat="server" GridLines="None" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" AutoGenerateColumns="False" OnRowDataBound="GVSolicitudesNominas_RowDataBound"
ShowHeaderWhenEmpty="true" EmptyDataText="No se encontraron registros"
DataKeyNames="CveSolicitudDetalle,CveSolicitud,idSolicitudCFDI,idSolicitudMetadata,Estatus,Observaciones,FechaInicio,FechaFin,FechaIng,CveUsuarioIng,CveEmpresa,ArchivoXML">
<Columns>
<asp:TemplateField HeaderText="Folio">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("CveSolicitud")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Inicio">
<ItemTemplate>
<asp:Label ID="lblfechaInicio" runat="server" Text='<%# Eval("FechaInicio","{0:dd/MM/yyyy}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Fin">
<ItemTemplate>
<asp:Label ID="lblfechaFin" runat="server" Text='<%# Eval("FechaFin","{0:dd/MM/yyyy}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="No CFDI" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblnumeroCFDIs" runat="server" Text='<%# Eval("numeroCFDIs")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Observaciones">
<ItemTemplate>
<asp:Label ID="lblobservaciones" runat="server" Text='<%# Eval("Observaciones")%>' ItemStyle-Width="150px" ControlStyle-Width="150px" CssClass="truncate" ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha solicitud">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("FechaIng","{0:dd/MM/yyyy}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Solicitó" ItemStyle-Width="100px" ControlStyle-Width="100px">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("UsuarioIng")%>' CssClass="truncate"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Right" ItemStyle-Width="50px" HeaderText="XML">
<ItemTemplate>
<asp:LinkButton ID="LnkDescargaXML" CssClass="btn btn-circle btn-sm blue" OnClick="LnkDescargaXML_Click" runat="server" ToolTip="Descargar archivo"
Text="<i class='fa fa-download' style='color:white' title='Descargar Documento'></i>" CausesValidation="False" Visible="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="R Nombres" Visible="false">
<ItemTemplate>
<asp:LinkButton ID="LnkRenombrarArchivos" CssClass="btn btn-circle btn-sm blue" OnClick="LnkRenombrarArchivos_Click" runat="server" ToolTip="Renombrar Archivos"
Text="Renombrar" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</ContentTemplate>
</ajax:TabPanel>
@@ -593,16 +675,16 @@
</ajax:TabContainer>
</div>
<div class="modal-footer">
<asp:LinkButton ID="LnkverificarSolicitudes" CssClass="btn btn-primary" OnClick="LnkverificarSolicitudes_Click" runat="server">Verificar pendientes</asp:LinkButton>
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</div>
</div>
</contenttemplate>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
@@ -612,7 +694,7 @@
<div id="ModalAgregarSolicitud" class="modal ADS fade" role="dialog">
<asp:UpdatePanel ID="UPModalViewSolicitudesAgregar" class="modal-dialog rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
@@ -622,10 +704,10 @@
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright" style="width: 125px!important">
<asp:TextBox ID="txtFechaIAdd" CssClass="form-control" MaxLength="20" runat="server" Width="100px"></asp:TextBox>
<div class="form-group form-md-line-input input-iconright" style="width: 125px!important;height:28px!important">
<asp:TextBox ID="txtFechaIAdd" CssClass="form-control" MaxLength="20" runat="server" Width="100px" Height="28px"></asp:TextBox>
<span class="input-group-btn " style="position: absolute; right: 41px; top: -5px;">
<asp:LinkButton ID="LnkFechaIAdd" class="btn default" Style="margin-top: 15px; margin-left: 6px" Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
<asp:LinkButton ID="LnkFechaIAdd" class="btn default" Style="margin-top: 15px; margin-left: 6px" Text="<i Style='margin-left: -6px;margin-top: -5px' class='fa fa-calendar'></i>" runat="server" Width="25px" Height="27px" ></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaIAdd" runat="server" TargetControlID="txtFechaIAdd" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CalendarExtender1" TargetControlID="txtFechaIAdd" PopupButtonID="LnkFechaIAdd" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
@@ -639,9 +721,9 @@
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright" style="width: 125px!important">
<asp:TextBox ID="txtFechaFAdd" CssClass="form-control" MaxLength="20" runat="server" Width="100px"></asp:TextBox>
<asp:TextBox ID="txtFechaFAdd" CssClass="form-control" MaxLength="20" runat="server" Width="100px" Height="28px"></asp:TextBox>
<span class="input-group-btn " style="position: absolute; right: 41px; top: -5px;">
<asp:LinkButton ID="LnkFechaFAdd" class="btn default" Style="margin-top: 15px; margin-left: 6px" Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
<asp:LinkButton ID="LnkFechaFAdd" class="btn default" Style="margin-top: 15px; margin-left: 6px" Text="<i Style='margin-left: -6px;margin-top: -5px' class='fa fa-calendar'></i>" runat="server" Width="25px" Height="27px" ></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaFAdd" runat="server" TargetControlID="txtFechaFAdd" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CalendarExtender2" TargetControlID="txtFechaFAdd" PopupButtonID="LnkFechaFAdd" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
@@ -668,10 +750,10 @@
</asp:Content>

View File

@@ -44,111 +44,82 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
}
set { ViewState["fechaFin"] = value; }
}
public int TipoDescarga // 0 sin descarga 1 resumen 2 desglose
{
get
{
if (ViewState["TipoDescarga"] == null) { return 0; }
else { return ViewState["TipoDescarga"].ToString().ToEntero(); }
}
set { ViewState["TipoDescarga"] = (int)value; }
}
#endregion
protected void Page_Load(object sender, EventArgs e)
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
TxtRpdFechaInicio.Text = string.Format("01/{0:MM/yyyy}", DateTime.Now.AddMonths(-1));
TxtRpdFechaFin.Text = string.Format("{0:dd/MM/yyyy}", DateTime.Now.AddMonths(-1).LastDayOfMonth());
LnkConsultar_Click(null, null);
//if(UsuarioActual.CveRol == 1)
//{
// GVSolicitudesNominas.Columns[8].Visible = true;
//}
}
}
protected void LnkDownloadExcel_Click(object sender, EventArgs e)
{
if(TipoDescarga == 1) {
GvResumen.ExportToExcel2($"Resumen{DateTime.Now.ToString("yyyyMMddhhmmss")}");
}
using (ClsNominas nom = new ClsNominas())
if (TipoDescarga == 2)
{
nom.SATSolicitudTimbreNominaGral(DdlReporte.SelectedValue.ToString().ToEntero(), UsuarioActual.CveEmpresa, fechaInicio, fechaFin);
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
var libro = wb.AddWorksheet(nom.DtResultados, "Nomina");
libro.ColumnsUsed().AdjustToContents();
libro.Range(1, 1, 1, nom.DtResultados.Columns.Count).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 153, 153));
switch (DdlReporte.SelectedValue.ToString().ToEntero())
{
case 1:
libro.Range(1, 2, 1, 2).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 3, 1, 5).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 2:
libro.Range(1, 2, 1, 2).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 3, 1, 6).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
libro.Range(1, 8, 1, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 3:
libro.Range(1, 1, 1, 10).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
libro.Range(1, 11, 1, nom.DtResultados.Columns.Count).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
break;
case 4:
libro.Range(1, 2, 1, 2).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 3, 1, 5).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 5:
libro.Range(1, 2, 1, 2).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 3, 1, 3).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 6:
libro.Range(1, 4, 1, 6).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 7, 1, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 7:
libro.Range(1, 3, 1, 5).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 6, 1, 8).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 8:
libro.Range(1, 6, 1, 8).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 9, 1, 12).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 9:
break;
default:
break;
}
libro.Row(1).InsertRowsAbove(4);
libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa;
libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de {DdlReporte.SelectedItem.Text}";
libro.Range(3, 2, 3, 6).Merge().Value = $"del {fechaInicio.ToDateTime():dd/MM/yyyy} al {fechaFin.ToDateTime():dd/MM/yyyy}";
libro.Range(2, 7, 2, 9).Merge().Value = $"Fecha:{DateTime.Now:dd/MM/yyyy}";
libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now:HH:mm}";
System.IO.Stream fs = new System.IO.MemoryStream();
wb.SaveAs(fs);
fs.Position = 0;
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
using (System.IO.Stream input = fs)
{
input.CopyTo(memoryStream);
}
memoryStream.Position = 0;
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.xlsx", $"Visor nómina ( Reporte :{DdlReporte.SelectedValue}) "));
Response.BinaryWrite(memoryStream.ToArray());
Response.End();
GvDatos.ExportToExcel2($"PorComprobante{DateTime.Now.ToString("yyyyMMddhhmmss")}");
}
}
protected void LnkConsultar_Click(object sender, EventArgs e)
{
GvResumen.DataSource = null;
GvDatos.DataSource = null;
//GvResumen.DataSource = null;
//GvDatos.DataSource = null;
DvDatos1.Visible = false;
DvDatos2.Visible = false;
DVResumen1.Visible = false;
DVResumen2.Visible = false;
TipoDescarga = 0;
LnkDownloadExcel.Visible = false;
if (DdlReporte.SelectedValue.ToEntero() == 1)
{
GvResumen.Visible = true;
GvDatos.Visible = false;
DVResumen1.Visible = true;
DVResumen2.Visible = true;
DvDatos1.Visible = false;
DvDatos2.Visible = false;
}
else
{
GvResumen.Visible = false;
GvDatos.Visible = true;
DVResumen1.Visible = false;
DVResumen2.Visible = false;
DvDatos1.Visible = true;
DvDatos2.Visible = true;
}
@@ -160,36 +131,59 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
if (DdlReporte.SelectedValue.ToEntero() == 1)
{
GvResumen.DataSource = ObjNom.DtResultados;
TipoDescarga = ObjNom.DtResultados.Rows.Count > 0 ? 1:0;
LnkDownloadExcel.Visible = true;
}
else
{
GvDatos.DataSource = ObjNom.DtResultados;
TipoDescarga = ObjNom.DtResultados.Rows.Count > 0 ? 2 : 0;
LnkDownloadExcel.Visible = true;
}
}
}
GvResumen.DataBind();
GvDatos.DataBind();
UpDatos.Update();
UpAcciones.Update();
}
private void cargasolicitudes()
{
LnkverificarSolicitudes.Visible = false;
using (ClsNominas nom = new ClsNominas())
{
if (nom.SolicitudesGet(-1, UsuarioActual.CveEmpresa, CveTipoSolicitud: 3))
if (nom.SolicitudesGet(-1, UsuarioActual.CveEmpresa, CveTipoSolicitud: 3, Estatus: 0,Top:50))
{
GVSolicitudesPendientes.DataSource = nom.DtResultados;
if (nom.DtResultados.Rows.Count > 0)
{
LnkverificarSolicitudes.Visible = true;
}
GVSolicitudesPendientes.DataBind();
}
if (nom.SolicitudesGet(-1, UsuarioActual.CveEmpresa, CveTipoSolicitud: 3, Estatus:1,Top:50))
{
GVSolicitudesPendientes.DataSource = nom.DtResultados.FiltraParametros("Estatus =0");
GVSolicitudesPendientes.DataBind();
GVSolicitudesNominas.DataSource = nom.DtResultados.FiltraParametros("Estatus =1");
GVSolicitudesNominas.DataSource = nom.DtResultados;
GVSolicitudesNominas.DataBind();
}
}
UPModalViewSolicitudes.Update();
}
@@ -204,6 +198,7 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
protected void LnkSolicitarSat_Click(object sender, EventArgs e)
{
StringBuilder sbResultado = new StringBuilder();
int idSolicitudCFDI = 0;
int idSolicitudMetadata = 0;
int estatus = 0;
@@ -212,22 +207,23 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
DateTime fechaFin = txtFechaFAdd.Text.ToDateTime();
int cveUsuarioIng = UsuarioActual.CveUsuario;
int cveEmpresa = UsuarioActual.CveEmpresa;
bool Continuar = false;
int CveSolicitudAgregada = -1;
using (ClsNominas nom = new ClsNominas())
{
Continuar = nom.SolicitudesAdd(idSolicitudCFDI, idSolicitudMetadata, estatus, observaciones, fechaInicio, fechaFin, cveUsuarioIng, cveEmpresa, CveTipoSolicitud: 3);
CveSolicitudAgregada = nom.SolicitudesAdd2(idSolicitudCFDI, idSolicitudMetadata, estatus, observaciones, fechaInicio, fechaFin, cveUsuarioIng, cveEmpresa, CveTipoSolicitud: 3);
}
if (Continuar)
if (CveSolicitudAgregada > 0)
{
StringBuilder sbResultado = new StringBuilder();
var api = new GeneralesAPII();
JToken ObjApiSolicitud = (JToken)api.GeneraSolicitud(UsuarioActual.CveEmpresa, 3);
JToken ObjApiSolicitud = (JToken)api.GeneraSolicitud(UsuarioActual.CveEmpresa, 3, CveSolicitudAgregada);
List<string> resultSolicitud = new List<string>();
List<string> resultVerificacion = new List<string>();
var ResultadoVerificaionOK = false;
var SeVerifico = false;
//var ResultadoVerificaionOK = false;
//var SeVerifico = false;
var TipoMensaje = ModExtensiones.TipoMensaje.MsgInformacion;
var ResultadoSolicitudOK = false;
@@ -244,71 +240,25 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
if (ResultadoSolicitudOK)
{
JToken ObjApiVerificacion = (JToken)api.VerificaSolicitudesNominas(UsuarioActual.CveEmpresa, 3);
if (!(ObjApiVerificacion == null))
{
resultVerificacion = ObjApiVerificacion.Select(token => token.Values().Aggregate((i, j) => $"{i}|{j}").Value<string>()).ToList();
ResultadoVerificaionOK = bool.Parse(resultVerificacion[0]);
SeVerifico = true;
}
else
{
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
sbResultado.Append($"Solicitud registrada correctamente y solicitada a SAT.<br> Folio: { CveSolicitudAgregada}");
}
else {
if (resultSolicitud.Count == 4)
{
if (ResultadoSolicitudOK)
{
if (resultSolicitud[1].ToString().Trim().Length > 0)
{
sbResultado.Append($"{resultSolicitud[1]}<br/>");
}
else
{
sbResultado.Append($"Solicitud Generada Correctamente");
sbResultado.Append($"Se presento un error al verificar las solicitudes <br/> {resultSolicitud[2]} <br>");
}
}
else
{
sbResultado.Append($"{resultSolicitud[2]}");
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
}
else
{
sbResultado.AppendLine("Se presento un error al generar la solicitud (API) <br/>");
sbResultado.Append($"Solicitud registrada, pendiente de verificar en SAT <br> Folio: {CveSolicitudAgregada} <br>({resultSolicitud[1] })<br>");
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
if (SeVerifico && resultVerificacion.Count == 4)
{
if (ResultadoVerificaionOK)
{
sbResultado.Append($"{resultVerificacion[1]}<br>");
}
else
{
sbResultado.Append($"Se presento un error al verificar las solicitudes {resultVerificacion[1]}<br>");
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
}
else
{
sbResultado.AppendLine("Se presento un error al verificar las solicitudes (API) <br/>");
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
Alert(sbResultado.ToString(), TipoMensaje);
}
else
{
Alert("No se puedo registrar la solictud".ToString(), ModExtensiones.TipoMensaje.MsgAdvertencia);
}
if (Continuar)
if (CveSolicitudAgregada > 0)
{
txtFechaIAdd.Text = "";
txtFechaFAdd.Text = "";
@@ -325,97 +275,118 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
//api.GeneraSolicitud();
//api.VerificaSolicitudesNominas();
StringBuilder sbResultado = new StringBuilder();
var api = new GeneralesAPII();
JToken ObjApiSolicitud = (JToken)api.GeneraSolicitud(UsuarioActual.CveEmpresa, 3);
List<string> resultSolicitud = new List<string>();
List<string> resultVerificacion = new List<string>();
var ResultadoVerificaionOK = false;
var SeVerifico = false;
var TipoMensaje = ModExtensiones.TipoMensaje.MsgInformacion;
var ResultadoSolicitudOK = false;
if (!(ObjApiSolicitud == null))
try
{
resultSolicitud = ObjApiSolicitud.Select(token => token.Values().Aggregate((i, j) => $"{i}|{j}").Value<string>()).ToList();
ResultadoSolicitudOK = bool.Parse(resultSolicitud[0]);
}
else
{
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
StringBuilder sbResultado = new StringBuilder();
if (ResultadoSolicitudOK)
{
JToken ObjApiVerificacion = (JToken)api.VerificaSolicitudesNominas(UsuarioActual.CveEmpresa, 3);
if (!(ObjApiVerificacion == null))
foreach(GridViewRow GvRow in GVSolicitudesPendientes.Rows)
{
resultVerificacion = ObjApiVerificacion.Select(token => token.Values().Aggregate((i, j) => $"{i}|{j}").Value<string>()).ToList();
ResultadoVerificaionOK = bool.Parse(resultVerificacion[0]);
SeVerifico = true;
}
else
{
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
}
int CveSolicitudActual = GvRow.DataKey("CveSolicitud").ToEntero();
string idSolicitud = GvRow.DataKey("idSolicitud").Trim();
List<string> resultSolicitud = new List<string>();
List<string> resultVerificacion = new List<string>();
var ResultadoVerificaionOK = false;
var SeVerifico = false;
var TipoMensaje = ModExtensiones.TipoMensaje.MsgInformacion;
var ResultadoSolicitudOK = false;
if (resultSolicitud.Count == 4)
{
if (ResultadoSolicitudOK)
{
if (resultSolicitud[2].ToString().Trim().Length > 0)
var api = new GeneralesAPII();
if (idSolicitud.Length == 0)
{
sbResultado.Append($"{resultSolicitud[2]}<br/>");
JToken ObjApiSolicitud = (JToken)api.GeneraSolicitud(UsuarioActual.CveEmpresa, 3, CveSolicitudActual);
if (!(ObjApiSolicitud == null))
{
resultSolicitud = ObjApiSolicitud.Select(token => token.Values().Aggregate((i, j) => $"{i}|{j}").Value<string>()).ToList();
ResultadoSolicitudOK = bool.Parse(resultSolicitud[0]);
sbResultado.Append($"Solicitud {CveSolicitudActual} solicitada a SAT.<br>");
}
else
{
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
}
else
{
sbResultado.Append($"Solicitud Generada Correctamente");
sbResultado.Append($"Se presento un error al verificar las solicitudes <br/> {resultSolicitud[2]} <br>");
resultSolicitud = new List<string>();
resultSolicitud.Add("true");
resultSolicitud.Add("");
resultSolicitud.Add("");
resultSolicitud.Add("");
ResultadoSolicitudOK = true;
}
if (ResultadoSolicitudOK)
{
JToken ObjApiVerificacion = (JToken)api.VerificaSolicitudesNominas(UsuarioActual.CveEmpresa, 3, CveSolicitudActual);
if (!(ObjApiVerificacion == null))
{
resultVerificacion = ObjApiVerificacion.Select(token => token.Values().Aggregate((i, j) => $"{i}|{j}").Value<string>()).ToList();
ResultadoVerificaionOK = bool.Parse(resultVerificacion[0]);
SeVerifico = true;
}
else
{
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
}
else
{
sbResultado.Append($"Solicitud pendiente de verificar en SAT <br> Folio:{CveSolicitudActual} ({resultSolicitud[1]})<br>");
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
if (SeVerifico && resultVerificacion.Count == 4)
{
if (ResultadoVerificaionOK)
{
sbResultado.Append($"Solicitud procesada.<br> Folio: {CveSolicitudActual}");
}
else
{
sbResultado.Append($"Solicitud no verificada <br> Folio: {CveSolicitudActual}{resultVerificacion[1]}.<br>");
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
}
else
{
sbResultado.Append($"Se presento un error al verificar la solicitud <br> Folio: {CveSolicitudActual}.");
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
Alert(sbResultado.ToString(), TipoMensaje);
}
else
{
sbResultado.Append($"{resultSolicitud[2]}");
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
cargasolicitudes();
}
else
catch(Exception ex)
{
sbResultado.AppendLine("Se presento un error al generar la solicitud (API) <br/>");
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
Alert(ex.StackTrace);
}
if (SeVerifico && resultVerificacion.Count == 4)
{
if (ResultadoVerificaionOK)
{
sbResultado.Append($"{resultVerificacion[2]}<br>");
}
else
{
sbResultado.Append($"Se presento un error al verificar las solicitudes {resultVerificacion[2]}<br>");
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
}
else
{
sbResultado.AppendLine("Se presento un error al verificar las solicitudes (API) <br/>");
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
}
Alert(sbResultado.ToString(), TipoMensaje);
cargasolicitudes();
}
@@ -436,8 +407,8 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
{
if(e.Row.DataKey("Mes").ToString() == "")
{
e.Row.Cells[0].Text = "Total";
e.Row.Font.Bold = true;
e.Row.Cells[0].Text = "Total";
e.Row.Attributes.Add("class", "Totales");
}
}
@@ -448,23 +419,83 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
if(e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.DataKey("UUID") == "Totales")
{
e.Row.Font.Bold = true;
e.Row.Cells[1].Text = e.Row.DataKey("VTotal").ToDecimal().ToString("###,###,###.00");
e.Row.Cells[2].Text = e.Row.DataKey("CBTTotal").ToDecimal().ToString("###,###,###.00");
e.Row.Cells[3].Text = e.Row.DataKey("CountRegistros");
if (e.Row.DataKey("UUID") == "Totales")
{
e.Row.Font.Bold = true;
e.Row.Cells[1].Text = e.Row.DataKey("CountRegistrosSIG");
e.Row.Cells[2].Text = e.Row.DataKey("CountRegistrosSAT");
e.Row.Attributes.Add("class", "Totales");
}
if(e.Row.DataKey("UUID").ToUpper() != "TOTALES")
{
StringBuilder SBMsgToolTip = new StringBuilder();
if (e.Row.DataKey("DifImporte").ToDecimal() != 0 || (e.Row.DataKey("Abreviatura").ToUpper() != e.Row.DataKey("CBTMoneda").ToUpper()))
{
e.Row.CssClass = "bg-yellow-casablanca bg-font-yellow-casablanca";
}
e.Row.Attributes.Add("data-html", "true");
e.Row.Attributes.Add("data-toggle", "tooltip");
e.Row.Attributes.Add("data-placement", "top");
if (e.Row.DataKey("Sistema").ToUpper() == "NO" || e.Row.DataKey("CFDIData").ToUpper() == "NO")
{
if (e.Row.DataKey("Sistema").ToUpper() == "NO")
{
SBMsgToolTip.AppendLine("Comprobante no se encuentra en SIG.<br>");
}
if (e.Row.DataKey("CFDIData").ToUpper() == "NO")
{
SBMsgToolTip.AppendLine("Comprobante no se encuentra en descargas de SAT.<br>");
}
}
else {
if (e.Row.DataKey("DifImporte").ToDecimal() != 0)
{
SBMsgToolTip.AppendLine($" Diferencia importes {e.Row.DataKey("DifImporte").ToDecimal().ToString("###,###,###.00")}");
}
if (e.Row.DataKey("Abreviatura").ToUpper() != e.Row.DataKey("CBTMoneda").ToUpper())
{
SBMsgToolTip.AppendLine($"Diferencia en monedas.");
}
}
if (SBMsgToolTip.ToString().Length > 0)
{
e.Row.Attributes.Add("title", SBMsgToolTip.ToString());
}
LinkButton LnkCFDIData = e.Row.FCLinkButton("LnkCFDIData");
if((e.Row.DataKey("CFDIData").ToUpper() == "SI"))
{
ScriptManager.GetCurrent(this).RegisterPostBackControl(LnkCFDIData);
LnkCFDIData.CssClass = "Texto";
}
else
{
LnkCFDIData.PostBackUrl = "#";
}
if(e.Row.DataKey("CveVenta").ToEntero() > 0)
{
e.Row.Cells[1].Text = $"<a href='/Ventas/Ventas.aspx?CveVenta={e.Row.DataKey("CveVenta").ToEntero()}'class='Texto' target='_blank' >Si</a>";
e.Row.Cells[3].Text = $"<a href='/Ventas/Ventas.aspx?CveVenta={e.Row.DataKey("CveVenta").ToEntero()}'class='Texto' target='_blank' >{e.Row.DataKey("VSerieFolio")}</a>";
}
}
}
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[1].BackColor = System.Drawing.Color.FromName("#3598dc"); //Azul
e.Row.Cells[2].BackColor = System.Drawing.Color.FromName("#900"); //Rojo
e.Row.Cells[2].BackColor = System.Drawing.Color.FromName("#E87E04"); //Rojo
e.Row.Cells[4].BackColor = System.Drawing.Color.FromName("#3598dc"); //Azul
@@ -473,14 +504,29 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
e.Row.Cells[7].BackColor = System.Drawing.Color.FromName("#3598dc"); //Azul
e.Row.Cells[8].BackColor = System.Drawing.Color.FromName("#3598dc"); //Azul
e.Row.Cells[9].BackColor = System.Drawing.Color.FromName("#3598dc"); //Azul
e.Row.Cells[10].BackColor = System.Drawing.Color.FromName("#3598dc"); //Azul
//e.Row.Cells[11].BackColor = System.Drawing.Color.FromName("#900"); //Rojo
//e.Row.Cells[12].BackColor = System.Drawing.Color.FromName("#900"); //Rojo
//e.Row.Cells[13].BackColor = System.Drawing.Color.FromName("#900"); //Rojo
//e.Row.Cells[14].BackColor = System.Drawing.Color.FromName("#900"); //Rojo
//e.Row.Cells[15].BackColor = System.Drawing.Color.FromName("#900"); //Rojo
//e.Row.Cells[16].BackColor = System.Drawing.Color.FromName("#900"); //Rojo
//e.Row.Cells[17].BackColor = System.Drawing.Color.FromName("#900"); //Rojo
e.Row.Cells[11].BackColor = System.Drawing.Color.FromName("#E87E04"); //Rojo
e.Row.Cells[12].BackColor = System.Drawing.Color.FromName("#E87E04"); //Rojo
e.Row.Cells[13].BackColor = System.Drawing.Color.FromName("#E87E04"); //Rojo
e.Row.Cells[14].BackColor = System.Drawing.Color.FromName("#E87E04"); //Rojo
e.Row.Cells[15].BackColor = System.Drawing.Color.FromName("#E87E04"); //Rojo
e.Row.Cells[16].BackColor = System.Drawing.Color.FromName("#E87E04"); //Rojo
e.Row.Cells[17].BackColor = System.Drawing.Color.FromName("#E87E04"); //Rojo
e.Row.Cells[10].BackColor = System.Drawing.Color.FromName("#900"); //Rojo
e.Row.Cells[11].BackColor = System.Drawing.Color.FromName("#900"); //Rojo
e.Row.Cells[12].BackColor = System.Drawing.Color.FromName("#900"); //Rojo
e.Row.Cells[13].BackColor = System.Drawing.Color.FromName("#900"); //Rojo
e.Row.Cells[14].BackColor = System.Drawing.Color.FromName("#900"); //Rojo
e.Row.Cells[15].BackColor = System.Drawing.Color.FromName("#900"); //Rojo
e.Row.Cells[1].ForeColor = System.Drawing.Color.FromName("white");
@@ -492,18 +538,200 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
e.Row.Cells[7].ForeColor = System.Drawing.Color.FromName("white");
e.Row.Cells[8].ForeColor = System.Drawing.Color.FromName("white");
e.Row.Cells[9].ForeColor = System.Drawing.Color.FromName("white");
e.Row.Cells[10].ForeColor = System.Drawing.Color.FromName("white");
e.Row.Cells[11].ForeColor = System.Drawing.Color.FromName("white");
e.Row.Cells[12].ForeColor = System.Drawing.Color.FromName("white");
e.Row.Cells[13].ForeColor = System.Drawing.Color.FromName("white");
e.Row.Cells[14].ForeColor = System.Drawing.Color.FromName("white");
e.Row.Cells[15].ForeColor = System.Drawing.Color.FromName("white");
e.Row.Cells[15].ForeColor = System.Drawing.Color.FromName("white");
e.Row.Cells[16].ForeColor = System.Drawing.Color.FromName("white");
e.Row.Cells[17].ForeColor = System.Drawing.Color.FromName("white");
}
}
protected void LnkDescargaXML_Click(object sender, EventArgs e)
{
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
var UrlDescarga = $"{UsuarioActual.Empresa.Ruta}NomXMLSAT\\Descargas\\{GvRow.DataKey("ArchivoXML")}";
var Archivo = new System.IO.FileInfo(UrlDescarga);
if (Archivo.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + Archivo.Name);
Response.AddHeader("Content-Length", Archivo.Length.ToString());
Response.ContentType = "text/octet-stream";
Response.Flush();
Response.TransmitFile(Archivo.FullName);
Response.End();
}
}
protected void GVSolicitudesNominas_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.DataKey("ArchivoXML").Length > 0)
{
var UrlDescarga = $"{UsuarioActual.Empresa.Ruta}NomXMLSAT\\Descargas\\{e.Row.DataKey("ArchivoXML")}";
if (System.IO.File.Exists(UrlDescarga)){
LinkButton LnkDescargaXML = e.Row.FCLinkButton("LnkDescargaXML");
ScriptManager.GetCurrent(this).RegisterPostBackControl(LnkDescargaXML);
LnkDescargaXML.Visible = true;
}
}
e.Row.Attributes.Add("data-html", "true");
e.Row.Attributes.Add("data-toggle", "tooltip");
e.Row.Attributes.Add("data-placement", "top");
e.Row.Attributes.Add("title", e.Row.DataKey("Observaciones"));
}
}
private void CargaComprobanteXML(string DirectoryPath, int CveSolicitudDetalle)
{
int Contador = 0;
System.IO.DirectoryInfo DirInfo = new System.IO.DirectoryInfo(DirectoryPath);
IEnumerable<System.IO.FileInfo> files = DirInfo.EnumerateFiles();
foreach (var f in files)
{
if(f.Extension.ToUpper() == ".XML")
{
string UUID = "";
System.Xml.XmlDocument XMLDoc = new System.Xml.XmlDocument();
try
{
XMLDoc.Load(f.FullName);
}
catch (Exception ex)
{
try
{
var oReader = new System.IO.StreamReader(f.FullName, System.Text.Encoding.GetEncoding("ISO-8859-1"));
XMLDoc.Load(oReader);
oReader.Dispose();
}
catch (Exception ex2)
{
// GuardaLog("Error al intentar leer el XML del SAT. Error:" + ex2.ToString());
ModExtensiones.GuardaLog(ex2.StackTrace);
}
}
System.Xml.XmlNode nodo = XMLDoc.DocumentElement;
string Version = ValorXML(nodo, "version");
System.Xml.XmlNamespaceManager namespaces = new System.Xml.XmlNamespaceManager(XMLDoc.NameTable);
string Prefijo = XMLDoc.DocumentElement.Prefix == "" ? "cfd" : XMLDoc.DocumentElement.Prefix;
string cfdVer = "";
if (Version == "3.2")
{
Prefijo = "cfd";
cfdVer = "http://www.sat.gob.mx/cfd/2";
}
else if (Version == "3.3")
cfdVer = "http://www.sat.gob.mx/cfd/3";
else
cfdVer = "http://www.sat.gob.mx/cfd/4";
namespaces.AddNamespace(Prefijo, cfdVer);
namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital");
namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal");
namespaces.AddNamespace("registrofiscal", "http://www.sat.gob.mx/registrofiscal");
System.Xml.XmlNode node;
node = XMLDoc.SelectSingleNode(string.Format("//{0}:Emisor", Prefijo), namespaces);
System.Xml.XmlNode nodeComp = XMLDoc.SelectSingleNode(string.Format("//{0}:Complemento", Prefijo), namespaces);
if (node != null )
{
System.Xml.XmlNode nodeTFD = nodeComp.SelectSingleNode(string.Format("//{0}:TimbreFiscalDigital", "tfd"), namespaces);
UUID = ValorXML(nodeTFD, "UUID", "");
}
if (UUID.Length > 0)
{
try {
System.IO.File.Move(f.FullName, $@"{f.DirectoryName}\{UUID.ToUpper()}.XML");
Contador++;
} catch (Exception ex3)
{
ModExtensiones.GuardaLog(ex3.StackTrace);
}
//ClsNominas objNominas = new ClsNominas();
//objNominas.UpdateSolicitudDetalleCveSolicitudDetalle(UsuarioActual.CveEmpresa, UUID, CveSolicitudDetalle);
//objNominas.Dispose();
}
}
}
Alert("Archivos Renombrados ");
}
private string ValorXML(System.Xml.XmlNode n, string Campo, string Retorno = "")
{
System.Xml.XmlNode o = n.Attributes.Cast<System.Xml.XmlAttribute>().SingleOrDefault(a => string.Compare(a.Name, Campo, true) == 0);
if (o == null)
return Retorno;
else
return o.Value;
}
protected void LnkRenombrarArchivos_Click(object sender, EventArgs e)
{
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
var CveSolicitudDetalle = GvRow.DataKey("CveSolicitudDetalle").ToEntero();
var UrlDirectorio = $"{UsuarioActual.Empresa.Ruta}DescargasSATXML\\Ingresos\\{CveSolicitudDetalle}";
CargaComprobanteXML(UrlDirectorio, CveSolicitudDetalle);
}
protected void LnkCFDIData_Click(object sender, EventArgs e)
{
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
var CveSolicitudDetalle = GvRow.DataKey("CveSolicitudDetalle");
var UrlDescargaXML = $"{UsuarioActual.Empresa.Ruta}DescargasSATXML\\Ingresos\\{CveSolicitudDetalle}\\{GvRow.DataKey("UUID")}.XML";
var ArchivoXML = new System.IO.FileInfo(UrlDescargaXML);
if (ArchivoXML.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + ArchivoXML.Name);
Response.AddHeader("Content-Length", ArchivoXML.Length.ToString());
Response.ContentType = "text/octet-stream";
Response.Flush();
Response.TransmitFile(ArchivoXML.FullName);
Response.End();
}
}
}
@@ -512,13 +740,13 @@ public class GeneralesAPII : ADSNetLibraryzI.HelpersI.ConexionesI.SIGAPII.BaseSI
public GeneralesAPII(string domainApi = "http://localhost:4001/", string token = "") : base(domainApi, token) { }
public object GeneraSolicitud(int CveEmpresa, int CveTipoSolicitud)
public object GeneraSolicitud(int CveEmpresa, int CveTipoSolicitud, int CveSolicitud)
{
return getData<object>($"GeneraSolicitud/{CveEmpresa}/{CveTipoSolicitud}", null, ADSNetLibraryzI.HelpersI.ConexionesI.SIGAPII.requestMethod.GET, false);
return getData<object>($"GeneraSolicitud/{CveEmpresa}/{CveTipoSolicitud}/{CveSolicitud}", null, ADSNetLibraryzI.HelpersI.ConexionesI.SIGAPII.requestMethod.GET, false);
}
public object VerificaSolicitudesNominas(int CveEmpresa, int CveTipoSolicitud)
public object VerificaSolicitudesNominas(int CveEmpresa, int CveTipoSolicitud, int CveSolicitud)
{
return getData<object>($"VerificaSolicitudesNominas/{CveEmpresa}/{CveTipoSolicitud}", null, ADSNetLibraryzI.HelpersI.ConexionesI.SIGAPII.requestMethod.GET, false);
return getData<object>($"VerificaSolicitudesNominas/{CveEmpresa}/{CveTipoSolicitud}/{CveSolicitud}", null, ADSNetLibraryzI.HelpersI.ConexionesI.SIGAPII.requestMethod.GET, false);
}
}

View File

@@ -1018,6 +1018,7 @@ Partial Class RepVentaDetalle
Dim RutaFormato = String.Format("{0}Formatos\RepVentaDetalle.rdlc", UsuarioActual.Empresa.Ruta)
Dim Archivo As New System.IO.FileInfo(RutaFormato)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
@@ -1033,14 +1034,19 @@ Partial Class RepVentaDetalle
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
params.Add(New ReportParameter("TipoDocto", TipoDocto))
params.Add(New ReportParameter("AgrupadoPor", $"<b>Agrupado Por:</b>&nbsp;{Grupo} {TipoDocto} {FechaIn} {FechaFn} {FechaIEjec} {FechaFEjec} {CveCliente} {CveSucursal} {CveSucursalEjec} {Vendedor} {CveUsuario} {CveEstatusFactura} {CondicionesPago} "))
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If
If Not Archivo.Exists Then
RutaFormato = "Empresas/Grales/Formatos/RepVentaDetalle.rdlc"
End If
ImprimirPDF(RutaFormato, dt, params, String.Format("ReporteVentaDetalle-{0}", Now.ToDateTime.ToShortDateString), Formato:=Formato)
Else
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)