This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2023-05-24 08:01:53 -07:00
25 changed files with 923 additions and 1005 deletions

View File

@@ -2117,6 +2117,26 @@ Public Class ClsCompras
Return Retorno
End Function
Public Function CancelarCompraOC(CveCompra As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Comp_CancelarCompraOC")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveCompra", SqlDbType.Int).Value = CveCompra
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al desvincular la oc de la compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
#End Region

View File

@@ -3,7 +3,6 @@ Option Strict On
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web
Imports Extensiones
Public Class ClsContabilidad
@@ -1430,7 +1429,7 @@ Public Class ClsContabilidad
End If
Else
OcurrioError = True
StrLog.AppendFormat(" Error 1.3 - ")
StrLog.AppendFormat(" Error 1.3 - La cuenta contable {0} es invalida ", dr("ConceptoContable"))
Mensaje.Append(String.Format("<br> La cuenta contable {0} es invalida", dr("ConceptoContable")))
Exit For
End If
@@ -6386,14 +6385,16 @@ Public Class ClsContabilidad
#End Region
#Region "VALIDACION POLIZA DESCUADRADA"
Public Function ValidacionPrePolizaCuadre(CvePrePoliza As Integer, Opcion As Integer, Optional CveVenta As Integer = -1) As Boolean
Public Function ValidacionPrePolizaCuadre(CvePrePoliza As Integer, Opcion As Integer, Optional CveVenta As Integer = -1, Optional AutoConta As Boolean = True) As Boolean
Dim Retorno = False
DataAdapter("PA_Conta_PrePoliza_Validacion")
DataAdapter("PA_Conta_PrePolizasValidacion")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@Opcion", SqlDbType.Int).Value = Opcion
' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@AutoConta", SqlDbType.Int).Value = If(AutoConta, 1, 0)
.Add("@Valor", SqlDbType.Int).Direction = ParameterDirection.Output
.Add("@MsgSalida", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output
.Add("@MsgPrePolizaSalida", SqlDbType.VarChar, 8000).Direction = ParameterDirection.Output
@@ -6414,6 +6415,47 @@ Public Class ClsContabilidad
Return Retorno
End Function
Public Function ValidacionesPrePoliza(CvePrePoliza As Integer, Opcion As Integer, ByRef UsuarioActual As Usuario, Optional CveVenta As Integer = -1, Optional AutoConta As Boolean = True) As Boolean
Dim Retorno = False
DataAdapter("PA_Conta_PrePolizasValidacion")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza
.Add("@Opcion", SqlDbType.Int).Value = Opcion
.Add("@CveEmpresa", SqlDbType.Int).Value = UsuarioActual.CveEmpresa
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@AutoConta", SqlDbType.Int).Value = If(AutoConta, 1, 0)
.Add("@Valor", SqlDbType.Int).Direction = ParameterDirection.Output
.Add("@MsgSalida", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output
.Add("@MsgPrePolizaSalida", SqlDbType.VarChar, 8000).Direction = ParameterDirection.Output
.Add("@Diferencia", SqlDbType.Float).Direction = ParameterDirection.Output
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
ValorPolizaDescuadre = SqlAdapter.SelectCommand.Parameters("@Valor").Value.ToString.ToEntero
MensajePolizaDescuadre = SqlAdapter.SelectCommand.Parameters("@MsgSalida").Value.ToString
ValorDiferencia = SqlAdapter.SelectCommand.Parameters("@Diferencia").Value.ToString
Dim MsgPrePoliza As String = SqlAdapter.SelectCommand.Parameters("@MsgPrePolizaSalida").Value.ToString
If MsgPrePoliza <> "" Then MsgPrePoliza.GuardaLogAD("LogPrePoliza")
If MensajePolizaDescuadre = "" AndAlso AutoConta Then
If UsuarioActual.Empresa.TipoContabilidad = 2 Then ' eltipocontabilidad deberá activarse en el PA
If Not ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
MensajePolizaDescuadre = Mensaje.ToString ' regresa el mensaje de contabilización
End If
End If
End If
Catch ex As Exception
OnError("Ocurrió un error al validar la PrePoliza.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
#End Region
#Region "AUXILIAR PREPOLIZAS"

View File

@@ -4311,6 +4311,11 @@ Public Class ClsPaginas
' Response.Redirect("/Sistemas/PopUpSeleccionarEmpresa.aspx")
' 'Alert(Request.ServerVariables("URL"))
'End If
''codigo temporal
If EsProduccion Then
If UsuarioActual.CveEmpresa.Contiene(141, 152, 159, 160, 161, 162, 166) Then System.Threading.Thread.Sleep(750)
End If
Dim i As Integer = Obt_ClavePagina(Request.ServerVariables("URL"))
Dim FailURL As String = $"{FormsAuthentication.DefaultUrl}?ADCod={Encripta($"CveModulo={i}")}"
'si es <0 la página es sin restricciones
@@ -7651,6 +7656,14 @@ Public Class ClsPaginas
Retorno.CveConcepto = If(CveTipoProveedorTipoDocto = 1, 292, 294) '1.Venta.2.NC
Retorno.CveConceptoComplementario = If(CveTipoProveedorTipoDocto = 1, 207, 203) '1.Venta.2.NC
End Select
Case 18 ' ingresos por comprobar
Select Case CveMoneda
Case 1 'pesos
Retorno.CveConcepto = 92 '1.Venta.2.NC
Case 2 'dólares
Retorno.CveConcepto = 92 'falta nuevo concepto
Retorno.CveConceptoComplementario = 332
End Select
End Select
Else 'cuando es la provisión
Select Case CveTipoSaldo
@@ -7694,7 +7707,14 @@ Public Class ClsPaginas
Retorno.CveConcepto = If(CveTipoProveedorTipoDocto = 1, 291, 293) '1.Venta.2.NC
Retorno.CveConceptoComplementario = If(CveTipoProveedorTipoDocto = 1, 203, 203) '1.Venta.2.NC
End Select
Case 18 ' ingresos por comprobar
Select Case CveMoneda
Case 1 'pesos
Retorno.CveConcepto = 66 '1.Venta.2.NC
Case 2 'dólares
Retorno.CveConcepto = 66 'falta nuevo concepto
Retorno.CveConceptoComplementario = 332
End Select
End Select
End If
@@ -7717,7 +7737,7 @@ Public Class ClsPaginas
#End Region
#Region "P A G O D E V E N T A S "
Public Function AplicaPrePolizaPagoVenta(VentaActual As Venta, Pago As VentaPago, CvePrePoliza As Integer, ByRef ObjConta As ClsContabilidad) As Boolean
Public Shared Function AplicaPrePolizaPagoVenta(VentaActual As Venta, Pago As VentaPago, CvePrePoliza As Integer, ByRef ObjConta As ClsContabilidad) As Boolean
Dim ErrorMovtos As Boolean = False
Dim PorcentajePago As Decimal = Pago.ImportePagoVenta / VentaActual.Total
Dim ImporteMovimiento As Decimal = 0
@@ -7731,14 +7751,11 @@ Public Class ClsPaginas
Dim CveConceptoContableComplementaria As Integer = 207
Dim Contabilizable As Boolean = True
If PorcentajePago > 1 Then PorcentajePago = 1
Pago.CveConceptoPago = If(Pago.CveConceptoPago = -1, 2, Pago.CveConceptoPago) 'si viene en parametro lo toma com primera opcion, sino el 2
If VentaActual.CveMoneda <> 1 Then
If Pago.TipoPago = "NC" Then Pago.CveConceptoPago = 301 Else Pago.CveConceptoPago = 292
End If
Dim Concepto As String = String.Format("{0} F:{1}", VentaActual.ClienteNombre, VentaActual.SerieFolio)
Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False)
Dim FuncionalidadFluctuacionImpuestos As Boolean = If(VentaActual.UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False)
Dim tFecha As Date = Pago.Fecha
If VentaActual.CveMoneda > 1 AndAlso UsuarioActual.Empresa.Funcionalidad(703) = "1" Then
If VentaActual.CveMoneda > 1 AndAlso VentaActual.UsuarioActual.Empresa.Funcionalidad(703) = "1" Then
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
If UltimaFluctuacion IsNot Nothing Then
If UltimaFluctuacion.FechaFluctuacion < tFecha Then
@@ -7762,7 +7779,7 @@ Public Class ClsPaginas
End If
If VentaActual.CveMoneda > 1 Then ImporteME = Pago.ImportePagoVenta
'CONDICION ESPECIAL, PARA ANTICIPOS ESPECIALES, QUE SE EMITE LA VENTA, PERO NO SE CONTABILIZA, EL TRATAMIENTO SE LLEVA POR EL ANTICIPO
If VentaActual.TipoDocto = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119, 158) Then
If VentaActual.TipoDocto = "Ant" AndAlso VentaActual.UsuarioActual.CveEmpresa.Contiene(1, 119, 158) Then
Pago.AplicaTraslado = False
Dim IdCtaContable As Integer = VentaActual.IdCtaContableClienteAnticipo
If VentaActual.CveMoneda = 2 Then IdCtaContable = VentaActual.IdCtaContableClienteAnticipoExtranjera
@@ -7781,15 +7798,19 @@ Public Class ClsPaginas
If Not ErrorMovtos AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, 95, VentaActual.SerieFolio, VentaActual.SerieFolio, IdCtaContable, CveIE:=Pago.CveIE, CveVenta:=VentaActual.CveVenta, CveSubProyecto:=VentaActual.CveSubProyecto, CveCliente:=VentaActual.CveCliente, TipoCambio:=TCValuacionVenta, TipoCambioPago:=Pago.TCPago, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, Contabilizable:=False) Then
ErrorMovtos = True
End If
End If
Dim ConPreP As ConceptosTipoSaldo = ObtenerCveConceptoPrePoliza(6, VentaActual.CveMoneda, True, 1)
'cuando es pago por NC, tiene sus propios pagos
If Pago.TipoPago = "NC" Then ConPreP.CveConcepto = If(VentaActual.CveMoneda <> 1, 301, 251)
'movimiento de pago cliente
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePagoVenta, Pago.ImportePagoVenta, Pago.CveConceptoPago, VentaActual.SerieFolio, Concepto, VentaActual.IdCtaContableCliente, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveVentaAmortizacion:=Pago.CveVentaAmortizacion, TipoCambio:=TCValuacionVenta, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada, Contabilizable:=Contabilizable) Then ErrorMovtos = True
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePagoVenta, Pago.ImportePagoVenta, ConPreP.CveConcepto, VentaActual.SerieFolio, Concepto, VentaActual.IdCtaContableCliente, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveVentaAmortizacion:=Pago.CveVentaAmortizacion, TipoCambio:=TCValuacionVenta, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada, Contabilizable:=Contabilizable) Then ErrorMovtos = True
'movimiento de pago cliente Complementaria
If Not ErrorMovtos AndAlso VentaActual.CveMoneda > 1 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePagoVenta, (ImporteME * TCValuacionVenta - ImporteME).RoundSQL, CveConceptoContableComplementaria, VentaActual.SerieFolio, Concepto, VentaActual.IdCtaContableClienteComplementaria, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveVentaAmortizacion:=Pago.CveVentaAmortizacion, TipoCambio:=TCValuacionVenta, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada, Contabilizable:=Contabilizable) Then ErrorMovtos = True
End If
If Pago.AplicaTraslado Then
'si tiene iva y su proporcion
If Not ErrorMovtos AndAlso VentaActual.IVA <> 0 Then
@@ -7801,46 +7822,48 @@ Public Class ClsPaginas
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 61, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
End If
'si tiene RET IVA y su proporcion
If Not ErrorMovtos AndAlso VentaActual.RetIVA > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.RetIVA).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 8, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 62, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'si tiene Ret ISR y su proporcion
If Not ErrorMovtos AndAlso VentaActual.RetISR > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.RetISR).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 9, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 63, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'si tiene IEPS y su proporcion
If Not ErrorMovtos AndAlso VentaActual.IEPS > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.IEPS).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
Dim Ret As New ConceptosRetenciones
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If ObjConta.GetRetCuenta(38, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxTrasladar").ToString.ToEntero
If ObjConta.GetRetCuenta(39, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSTrasladado").ToString.ToEntero
'si tiene RET IVA y su proporcion
If Not ErrorMovtos AndAlso VentaActual.RetIVA > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.RetIVA).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 8, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 62, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'si tiene Ret ISR y su proporcion
If Not ErrorMovtos AndAlso VentaActual.RetISR > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.RetISR).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 9, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 63, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'si tiene IEPS y su proporcion
If Not ErrorMovtos AndAlso VentaActual.IEPS > 0 Then
ImporteMovimiento = (PorcentajePago * VentaActual.IEPS).RoundSQL
ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL
If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento
Dim Ret As New ConceptosRetenciones
If VentaActual.UsuarioActual.Empresa.TipoContabilidad = 2 Then
If ObjConta.GetRetCuenta(38, VentaActual.UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxTrasladar").ToString.ToEntero
If ObjConta.GetRetCuenta(39, VentaActual.UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSTrasladado").ToString.ToEntero
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 38, VentaActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * Pago.TCPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 39, VentaActual.SerieFolio, Concepto, Ret.IdCtaContableAcreditable, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 38, VentaActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe
If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * Pago.TCPago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 39, VentaActual.SerieFolio, Concepto, Ret.IdCtaContableAcreditable, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, CveSubProyecto:=VentaActual.CveSubProyecto, CveCompra:=Pago.CveCompraRelacionada) Then ErrorMovtos = True
End If
'concepto pago
Concepto = String.Format("{0} NC:{1}", VentaActual.ClienteNombre, Pago.Referencia)
If Pago.TipoPago = "A" AndAlso Not ErrorMovtos Then ' A N T I C I P O
Dim Ret As New ConceptosRetenciones
'Dim ConPreP As ConceptosTipoSaldo = ObtenerCveConceptoPrePoliza(6, VentaActual.CveMoneda, True, 1)
If Pago.CveMonedaPago > 1 Then
'Agregamos la Extranjera
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, 296, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteAnticipoExtranjera, CveVenta:=Pago.CveVentaAmortizacion, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto) Then ErrorMovtos = True
@@ -7853,25 +7876,26 @@ Public Class ClsPaginas
End If
If Pago.TipoPago = "NC" AndAlso Not ErrorMovtos Then ' N O T A D E C R E D I T O
Dim Ret As New ConceptosRetenciones
Dim ConPrePNC As ConceptosTipoSaldo = ObtenerCveConceptoPrePoliza(6, VentaActual.CveMoneda, True, 2)
If Pago.CveMonedaPago > 1 Then
'Agregamos la Extranjera
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, 294, Pago.Referencia, Concepto, VentaActual.IdCtaContableCliente, CveVenta:=Pago.CveVentaAmortizacion, CveVentaAmortizacion:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto) Then ErrorMovtos = True
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, ConPrePNC.CveConcepto, Pago.Referencia, Concepto, VentaActual.IdCtaContableCliente, CveVenta:=Pago.CveVentaAmortizacion, CveVentaAmortizacion:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto) Then ErrorMovtos = True
ImporteMN = (Pago.ImportePago * TCValuacionPago - Pago.ImportePago).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, ImporteMN, 207, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteComplementaria, CveVenta:=Pago.CveVentaAmortizacion, CveVentaAmortizacion:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto) Then ErrorMovtos = True
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, ImporteMN, ConPrePNC.CveConceptoComplementario, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteComplementaria, CveVenta:=Pago.CveVentaAmortizacion, CveVentaAmortizacion:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto) Then ErrorMovtos = True
Else
'Agregamos Nacional
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, 91, Pago.Referencia, Concepto, VentaActual.IdCtaContableCliente, CveVenta:=Pago.CveVentaAmortizacion, CveVentaAmortizacion:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, ConPrePNC.CveConcepto, Pago.Referencia, Concepto, VentaActual.IdCtaContableCliente, CveVenta:=Pago.CveVentaAmortizacion, CveVentaAmortizacion:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True
End If
End If
If Pago.TipoPago = "I" AndAlso Not ErrorMovtos Then ' I N G R E S O S X C O M P R O B A R
Dim Ret As New ConceptosRetenciones
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If VentaActual.UsuarioActual.Empresa.TipoContabilidad = 2 Then
'If ObjConta.GetRetCuenta(66, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero
'If Pago.CveMonedaPago > 1 AndAlso ObjConta.GetRetCuenta(207, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero
If UsuarioActual.CveEmpresa.Contiene(119) Then
If VentaActual.UsuarioActual.CveEmpresa.Contiene(119) Then
If Pago.FechaDocumentoRelacionado.Year <= 2017 Then
Dim ObjCliente As New ClsClientes(ObjConta.IniciaTransacSQL())
If ObjCliente.GetClientes(VentaActual.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) AndAlso ObjCliente.DtResultados.Rows.Count > 0 Then
If ObjCliente.GetClientes(VentaActual.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, VentaActual.UsuarioActual.CveEmpresa) AndAlso ObjCliente.DtResultados.Rows.Count > 0 Then
If Pago.CveMonedaPago > 1 Then VentaActual.IdCtaContableClienteAnticipoExtranjera = ObjCliente.IdCtaContMonedaExtranjera Else VentaActual.IdCtaContableClienteAnticipo = ObjCliente.IdCtaContClientes
End If
End If
@@ -7903,17 +7927,22 @@ Public Class ClsPaginas
Dim ConceptoContable, IdCtaContable As Integer
Dim TipoMovimiento As Boolean
Dim Diferencia As Decimal = 0
'tImporteVenta = tImporteVenta.Abs()
'tImportePago = tImportePago.Abs()
tImportePago += Pago.ImporteFluctuacionAdicional 'para los casos de aplicación de
If tImporteVenta <> tImportePago Then
If tImporteVenta < tImportePago Then
If tImporteVenta.Abs() < tImportePago.Abs() Then
ConceptoContable = 64
TipoMovimiento = True
Else
ConceptoContable = 65
TipoMovimiento = False
End If
Diferencia = (tImporteVenta - tImportePago).Abs.RoundSQL
Diferencia = ((tImporteVenta - tImportePago).Abs.RoundSQL(2)) * Pago.ValorMultiplicador
End If
If FuncionalidadFluctuacionImpuestos Then
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, Pago.TCPago, VentaActual.TC)
Diferencia = (Pago.ImportePago * VentaActual.TC) - (Pago.ImportePago * Pago.TCPago) 'Añadimos la diferencia de perdida en la venta
@@ -7923,6 +7952,7 @@ Public Class ClsPaginas
Diferencia -= ((VentaActual.IEPS * PorcentajePago) * VentaActual.TC) - ((VentaActual.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, CveVenta:=VentaActual.CveVenta, CveSubProyecto:=VentaActual.CveSubProyecto, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE) Then
ErrorMovtos = True
@@ -7944,14 +7974,46 @@ Public Class ClsPaginas
Public Property TCPago As Decimal = 1
Public Property CveVentaAmortizacion As Integer = 0
Public Property OtroGastoIngreso As Decimal = 0
Public Property CveConceptoPago As Integer = -1 'no definido de inicio
'Public Property CveConceptoPago As Integer = -1 'no definido de inicio
Public Property CveCreditoDetalle As Integer = -1
Public Property CveCompraRelacionada As Integer = -1
Public Property AplicaTraslado As Boolean = True
Public Property Referencia As String
Public Property ImporteFluctuacionAdicional As Decimal = 0
Public Property ValorMultiplicador As Decimal = 1
End Class
Public Class Venta
Public Sub New(UsuarioActual As Usuario)
Me.UsuarioActual = UsuarioActual
End Sub
Public Sub New(ObjFactura As Modelos.Factura, UsuarioActual As Usuario, Optional ValorMultiplicador As Decimal = 1D)
Me.CveVenta = ObjFactura.CveVenta
Me.CveCliente = ObjFactura.CveCliente
Me.CveMoneda = ObjFactura.CveMoneda
Me.TipoDocto = ObjFactura.TipoDocto
Me.SerieFolio = ObjFactura.SerieFolio
Me.Fecha = ObjFactura.Fecha
If ObjFactura.Cliente IsNot Nothing AndAlso ObjFactura.CveCliente > 0 Then
Me.ClienteNombre = ObjFactura.Cliente.Nombre
Me.IdCtaContableCliente = If(ObjFactura.CveMoneda = 1, ObjFactura.Cliente.IdCtaContClientes, ObjFactura.Cliente.IdCtaContMonedaExtranjera)
Me.IdCtaContableClienteComplementaria = ObjFactura.Cliente.IdCtaContComplementaria
Me.IdCtaContableClienteAnticipo = ObjFactura.Cliente.IdCtaContAnticipos
Me.IdCtaContableClienteAnticipoExtranjera = ObjFactura.Cliente.IdCtaMonedaExtranjeraAnticipos
Me.IdCtaContableClienteAnticipoComplementaria = ObjFactura.Cliente.IdCtaContCompAnticipos
End If
Me.TC = ObjFactura.TipoCambio
Me.Total = ObjFactura.Total * ValorMultiplicador
Me.IVA = ObjFactura.IVA * ValorMultiplicador
Me.IEPS = ObjFactura.IEPS * ValorMultiplicador
Me.RetIVA = ObjFactura.RetIVA * ValorMultiplicador
Me.RetISR = ObjFactura.RetISR * ValorMultiplicador
Me.PorcentajeIVA = ObjFactura.PorcentajeIVA.ToString().ToDecimal()
Me.CveSubProyecto = ObjFactura.CveSubProyecto
Me.UsuarioActual = ObjFactura.UsuarioActual
End Sub
Public Property CveVenta As Integer = -1
Public Property CveCliente As Integer
Public Property CveMoneda As Integer

View File

@@ -2621,7 +2621,7 @@ Public Class ClsRH
End Function
Public Function GetAsistencias(CvePersonal As Integer, CveClienteAsignado As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveTurno As Integer, CveEstatusPersonal As Integer, CveTipoPeriodo As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer) As Boolean
Public Function GetAsistencias(CvePersonal As Integer, CveClienteAsignado As Integer, CveProyecto As Integer, CveSubProyecto As Integer, CveTurno As Integer, CveEstatusPersonal As Integer, CveTipoPeriodo As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, Optional CvePuesto As Integer = -1) As Boolean
Dim Retorno As Boolean = False
SqlDataAdapter("PA_RH_PersonalAsistenciasGet")
@@ -2633,6 +2633,7 @@ Public Class ClsRH
.Add("@CveTurno", SqlDbType.Int).Value = CveTurno
.Add("@CveTipoPeriodo", SqlDbType.Int).Value = CveTipoPeriodo
.Add("@CveEstatusPersonal", SqlDbType.Int).Value = CveEstatusPersonal
.Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto
.Add("@FechaI", SqlDbType.Date).Value = FechaI
.Add("@FechaF", SqlDbType.Date).Value = FechaF
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
@@ -2648,7 +2649,7 @@ Public Class ClsRH
Return Retorno
End Function
Public Function RepGetAsistencias(Grupo As Integer, CveClienteAsignado As Integer, CveSubProyecto As Integer, CveTurno As Integer, CveEstatusPersonal As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, CvePersonalPadre As Integer) As Boolean
Public Function RepGetAsistencias(Grupo As Integer, CveClienteAsignado As Integer, CveSubProyecto As Integer, CveTurno As Integer, CveEstatusPersonal As Integer, FechaI As Date, FechaF As Date, CveEmpresa As Integer, CvePersonalPadre As Integer, CveTipoPeriodo As Integer, CvePuesto As Integer) As Boolean
Dim Retorno As Boolean = False
SqlDataAdapter("PA_RH_RepPersonalAsistenciasGet")
@@ -2662,7 +2663,8 @@ Public Class ClsRH
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@CvePersonalPadre", SqlDbType.Int).Value = CvePersonalPadre
.Add("@CveEstatusPersonal", SqlDbType.Int).Value = CveEstatusPersonal
.Add("@CveTipoPeriodo", SqlDbType.Int).Value = CveTipoPeriodo
.Add("@CvePuesto", SqlDbType.Int).Value = CvePuesto
End With
Try

View File

@@ -2371,7 +2371,7 @@ Namespace Modelos
Private Function ProcesoPrepolizas(ObjFactura As Factura, ByRef ObjConta As ClsContabilidad, CveIE As Integer, TmpDTDetalle As DataTable, ByRef objContPaqi As ClsContPAQi,
Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing,
Optional ByRef DtRemisionesRelacionadas As DataTable = Nothing, Optional SeCancelaRemisionProceso As Boolean = False, Optional CancelarRemisiones As Boolean = False, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing,
Optional CveEstatusRefacturacion As Integer = 0, Optional ByRef ObjInventario As ClsInventarios = Nothing) As Boolean
Optional CveEstatusRefacturacion As Integer = 0, Optional ByRef ObjInventario As ClsInventarios = Nothing, Optional FechaCancelacion As DateTime = MinFecha) As Boolean
Dim ErrorPrepoliza As Boolean = False
Try
Dim DT As DataTable
@@ -2401,6 +2401,24 @@ Namespace Modelos
tipoCambio = 1
End If
' Verificar si la fecha es del mes anterior a la fecha actual
Dim esMesAnterior As Boolean = False
If ObjFactura.TipoDocto = "Egs" AndAlso ValorMultiplicador = -1 AndAlso FechaCancelacion > MinFecha AndAlso tipoCambio > 1 AndAlso UsuarioActual.Empresa.Funcionalidad(703) = "1" Then
' Obtener el mes y año de la fecha actual
Dim mesActual As Integer = FechaCancelacion.Month
Dim añoActual As Integer = FechaCancelacion.Year
' Obtener el mes y año de la fecha a comparar
Dim mesFecha As Integer = ObjFactura.Fecha.Month
Dim añoFecha As Integer = ObjFactura.Fecha.Year
If añoFecha < añoActual Then
esMesAnterior = True
ElseIf añoFecha = añoActual AndAlso mesFecha < mesActual Then
esMesAnterior = True
End If
End If
Dim ConceptoContable As Integer
Dim TipoMovimiento As Boolean
Dim importeMovimiento As Decimal
@@ -2690,159 +2708,130 @@ Namespace Modelos
Case 12 'Nota de Credito
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then
importeMovimiento = ObjFactura.Total * ValorMultiplicador
importeMX = (importeMovimiento * tipoCambio * Multiplicador).RoundSQL
FechaMovimiento = ObjFactura.FechaPago
Dim ImporteConcepto12 As Decimal = 0
Dim ImporteAcumulado91 As Decimal = 0
Dim CveUltimaVenta As Integer = 0
If tipoCambio > 1 Then
Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
ConceptoContable = 293
End If
IdCtaContable = 0
If tipoCambio = 1 Then
IdCtaContable = ObjFactura.Cliente.IdCtaContClientes
ElseIf UsaComplementariaClientes Then
Dim ConPreP As ClsPaginas.ConceptosTipoSaldo = ClsPaginas.ObtenerCveConceptoPrePoliza(6, ObjFactura.CveMoneda, False, 2)
IdCtaContable = ObjFactura.Cliente.IdCtaContComplementaria
If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsaComplementariaClientes) Then
importeMX = importeMovimiento
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, 0, Referencia, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=(importeMovimiento * tipoCambio - importeMovimiento).RoundSQL, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
End If
IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera
End If
CveSubProyectoContabilizar = CveSubProyectoVenta
ImporteConcepto12 = importeMX.RoundSQL
If importeMovimiento <> 0 Then
If IdCtaContable <= 0 Then
CuentasContablesInvalidas.Append("<br>" & ClsPaginas.GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString)
idCuentaContabilizacion = 0
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
Else
ObjFactura.SeGuardoPrePoliza = True
End If
End If
importeMovimiento = 0
If ValorMultiplicador = 1 Then
Dim IdCtaContableClienteComplementaria As Integer = ObjFactura.Cliente.IdCtaContComplementaria
Dim TipoCambioNC As Decimal = 1
Dim TipoCambioNC As Decimal = 1
If ObjFactura.CveMoneda = 2 Then
If tipoCambio > 1 Then
TipoCambioNC = tipoCambio
Else
TipoCambioNC = ClsPaginas.GlobalTipoCambio(ObjFactura.Fecha).ToDecimal
End If
End If
If ValorMultiplicador = -1 AndAlso UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso esMesAnterior AndAlso ObjFactura.CveMoneda = 2 Then
Dim UltimaFluctuacion As ClsPaginas.MTipoCambioFluctuacion = ClsPaginas.GlobalTipoCambioUltimaFluctuacion(FechaCancelacion)
If UltimaFluctuacion IsNot Nothing Then
If UltimaFluctuacion.FechaFluctuacion < FechaCancelacion Then
TipoCambioNC = UltimaFluctuacion.TCFluctuacion
End If
End If
End If
importeMovimiento = ObjFactura.Total * ValorMultiplicador
importeMX = (importeMovimiento * TipoCambioNC * Multiplicador).RoundSQL(2)
FechaMovimiento = ObjFactura.FechaPago
CveSubProyectoContabilizar = ObjFactura.CveSubProyecto
IdCtaContable = ObjFactura.Cliente.IdCtaContClientes
If ObjFactura.CveMoneda = 2 Then
importeMX = importeMovimiento
IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera
Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConPreP.CveConcepto, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(TipoCambioNC = 1, 0, importeMovimiento), TipoCambio:=TipoCambioNC, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
If UsaComplementariaClientes AndAlso ObjFactura.CveMoneda = 2 Then
IdCtaContable = ObjFactura.Cliente.IdCtaContComplementaria
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, 0, Referencia, ConPreP.CveConceptoComplementario, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=(importeMovimiento * TipoCambioNC - importeMovimiento).RoundSQL(2), ImporteME:=If(TipoCambioNC = 1, 0, importeMovimiento), TipoCambio:=TipoCambioNC, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
End If
If ValorMultiplicador = -1 AndAlso esMesAnterior Then
Dim TCCliente As Decimal = tipoCambio
Dim TCFluctuacion As Decimal = tipoCambio
'TOMA EL TC DE LA ULTIMA FLUCTUACION
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso ObjFactura.CveMoneda = 2 Then
Dim UltimaFluctuacion As ClsPaginas.MTipoCambioFluctuacion = ClsPaginas.GlobalTipoCambioUltimaFluctuacion(FechaCancelacion)
If UltimaFluctuacion IsNot Nothing Then
If UltimaFluctuacion.FechaFluctuacion <= FechaCancelacion Then
TCCliente = UltimaFluctuacion.TCFluctuacion
TCFluctuacion = UltimaFluctuacion.TCFluctuacion
End If
End If
End If
'CONSIDERO FLUCTUACIÓN.
If tipoCambio <> TCFluctuacion AndAlso TCFluctuacion > 1 AndAlso tipoCambio > 1 Then
Dim difFluctuacion As Decimal = tipoCambio - TCFluctuacion
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
Dim TipoMovtoFluctua As Boolean = True
Dim IdCtaContableFluctua As Integer
If difFluctuacion < 0 Then
CveConceptoFluctua = 64
TipoMovtoFluctua = True
Else
CveConceptoFluctua = 65
TipoMovtoFluctua = False
End If
Dim ImporteFluctuacion As Decimal = Math.Abs((importeMovimiento * difFluctuacion).RoundSQL)
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=TCCliente) Then
ErrorPrepoliza = True
Exit For
End If
End If
End If
importeMovimiento = 0
If ValorMultiplicador = 1 Then
Dim IdCtaContableClienteComplementaria As Integer = ObjFactura.Cliente.IdCtaContComplementaria
'APLICA NC SALDOS DIRECTOS
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
For Each Dr As DataRow In DtVentasNC.Rows
Dim Importe91 As Decimal = 0
Dim ImporteMN91 As Decimal = 0
Dim Importe251 As Decimal = 0
Dim ObjFacturaRef As New Modelos.Factura(UsuarioActual, Dr("CveVenta").ToString().ToEntero(), UsuarioActual.CveEmpresa, CargaDTDetalle:=False, VerificaAlmacen:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False)
If ObjFactura.CveMoneda = 1 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString.ToDecimal
Importe91 = Dr("Importe").ToString.ToDecimal
ImporteMN91 = Dr("Importe").ToString.ToDecimal
TipoCambioNC = 1
ElseIf ObjFactura.CveMoneda = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
Importe91 = Dr("Importe").ToString.ToDecimal
ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
ElseIf ObjFactura.CveMoneda = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString.ToDecimal
Importe91 = Dr("Importe").ToString.ToDecimal
ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
ElseIf ObjFactura.CveMoneda = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString.ToDecimal / TipoCambioNC
Importe91 = Dr("Importe").ToString.ToDecimal
ImporteMN91 = Dr("Importe").ToString.ToDecimal
End If
Dim ventaRef As New ClsPaginas.Venta(ObjFacturaRef, UsuarioActual, ValorMultiplicador:=ValorMultiplicador)
Importe251 = (Importe251 * Multiplicador).RoundSQL
ObjFacturaRef.Dispose()
Importe91 = (Importe91 * ValorMultiplicador).RoundSQL
ImporteMN91 = (ImporteMN91 * Multiplicador).RoundSQL
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${Importe91.FormatoNumero(2)}"
ventaRef.ClienteNombre = ObjFactura.Cliente.Nombre
ventaRef.IdCtaContableCliente = If(ventaRef.CveMoneda = 1, ObjFactura.Cliente.IdCtaContClientes, ObjFactura.Cliente.IdCtaContMonedaExtranjera)
ventaRef.IdCtaContableClienteComplementaria = ObjFactura.Cliente.IdCtaContComplementaria ' ViewState("IdCtaContComplementaria").ToString.ToEntero
CveUltimaVenta = Dr("CveVenta").ToString.ToEntero
ventaRef.IdCtaContableClienteAnticipo = ObjFactura.Cliente.IdCtaContAnticipos
ventaRef.IdCtaContableClienteAnticipoExtranjera = ObjFactura.Cliente.IdCtaMonedaExtranjeraAnticipos
ventaRef.IdCtaContableClienteAnticipoComplementaria = ObjFactura.Cliente.IdCtaContCompAnticipos
Dim ImporteComplementarioIngreso As Decimal = 0
If UsaComplementariaClientes = True AndAlso tipoCambio > 1 Then
ImporteMN91 = Importe91
ImporteComplementarioIngreso = ((Importe91 * tipoCambio) - Importe91).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteComplementarioIngreso, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
ErrorPrepoliza = True
Exit For
End If
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
ImporteAcumulado91 += (ImporteMN91).RoundSQL
Dim Pago As New ClsPaginas.VentaPago
Pago.Fecha = ObjFactura.Fecha
Pago.FechaDocumentoRelacionado = ObjFactura.Fecha
Pago.ImportePagoVenta = Dr("Importe").ToString().ToDecimal()
Pago.ImportePago = Dr("Importe").ToString().ToDecimal()
Pago.CveMonedaPago = ObjFactura.CveMoneda
Pago.TCPago = TipoCambioNC
Pago.TipoPago = "NC"
Pago.CveVentaAmortizacion = ObjFactura.CveVenta 'Dr("CveVenta").ToString().ToEntero()
Pago.AplicaTraslado = False
Pago.Referencia = Concepto
Dim tCveConcepto As Integer = 251
If Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then tCveConcepto = 301
If UsaComplementariaClientes = True AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Dim ImporteComplementarioNC As Decimal = ((Importe251 * Dr("TCCambioValuacion").ToString.ToDecimal) - Importe251).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementarioNC, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
ErrorPrepoliza = True
Exit For
End If
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, tCveConcepto, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=Importe251, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal, TipoCambioPago:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
'considero fluctuación.
Dim TCFluctuacion As Decimal = Dr("TCCambioValuacion").ToString.ToDecimal
If TCFluctuacion = 1 AndAlso TipoCambioNC > 1 Then
TCFluctuacion = ClsPaginas.GlobalTipoCambio(ObjFactura.Fecha).ToDecimal
End If
If TipoCambioNC <> TCFluctuacion AndAlso TCFluctuacion > 1 AndAlso TipoCambioNC > 1 Then
Dim difFluctuacion As Decimal = TipoCambioNC - TCFluctuacion
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
Dim TipoMovtoFluctua As Boolean = True
Dim IdCtaContableFluctua As Integer
If difFluctuacion < 0 Then
CveConceptoFluctua = 65
TipoMovtoFluctua = False
Else
CveConceptoFluctua = 64
TipoMovtoFluctua = True
End If
Dim ImporteFluctuacion As Decimal = Math.Abs((Importe251 * difFluctuacion).RoundSQL) * ValorMultiplicador
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=TipoCambioNC, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
ErrorPrepoliza = True
Exit For
End If
End If
ErrorPrepoliza = ClsPaginas.AplicaPrePolizaPagoVenta(ventaRef, Pago, ObjFactura.CvePrePoliza, ObjConta)
Next
If ImporteConcepto12 < ImporteAcumulado91 Then
Dim ImporteOtrosIngresos As Decimal = ImporteConcepto12 - ImporteAcumulado91
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteOtrosIngresos, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveUltimaVenta, ImporteMX:=ImporteOtrosIngresos, ImporteME:=0, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ImporteOtrosIngresos, Referencia, 211, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteME:=0, ImporteMX:=ImporteOtrosIngresos, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
Else
ErrorPrepoliza = True
End If
End If
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
ErrorPrepoliza = True
@@ -2855,7 +2844,6 @@ Namespace Modelos
End If
End If
If ErrorPrepoliza Then
Exit For
End If
@@ -3078,6 +3066,20 @@ Namespace Modelos
Dim Contabilizable = If(UsuarioActual.CveEmpresa = 119, False, True)
If ValorMultiplicador = -1 Then
Dim TipoCambioNC As Decimal = 1
If ObjFactura.CveMoneda = 2 Then
If tipoCambio > 1 Then
TipoCambioNC = tipoCambio
Else
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
TipoCambioNC = ClsPaginas.GlobalTipoCambio(ObjFactura.Fecha.AddDays(-1)).ToDecimal
Else
TipoCambioNC = ClsPaginas.GlobalTipoCambio(ObjFactura.Fecha).ToDecimal
End If
End If
End If
'cuando es cancelación
If ObjFactura.DtNCVinculadas IsNot Nothing Then
For Each row2 As DataRow In ObjFactura.DtNCVinculadas.Rows
@@ -3085,134 +3087,42 @@ Namespace Modelos
If row2("CveConceptoContable").ToString().ToEntero.Contiene(91, 294) Then
importeMovimiento = (row2("Importe").ToString().ToDecimal * ValorMultiplicador)
sumaAmorticaciones += importeMovimiento
Dim CveConceptoAplicacionNC As Integer = 91
Dim CveConceptoPagoNC As Integer = 251
Dim ObjFacturaRef As New Modelos.Factura(UsuarioActual, row2("CveVenta").ToString().ToEntero(), UsuarioActual.CveEmpresa, CargaDTDetalle:=False, VerificaAlmacen:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False)
If tipoCambio > 1 Then
Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
CveConceptoAplicacionNC = 294
CveConceptoPagoNC = 301
Dim ventaRef As New ClsPaginas.Venta(ObjFacturaRef, UsuarioActual, ValorMultiplicador:=-1D)
ObjFacturaRef.Dispose()
ventaRef.ClienteNombre = ObjFactura.Cliente.Nombre
ventaRef.IdCtaContableCliente = If(ventaRef.CveMoneda = 1, ObjFactura.Cliente.IdCtaContClientes, ObjFactura.Cliente.IdCtaContMonedaExtranjera)
ventaRef.IdCtaContableClienteComplementaria = ObjFactura.Cliente.IdCtaContComplementaria ' ViewState("IdCtaContComplementaria").ToString.ToEntero
ventaRef.IdCtaContableClienteAnticipo = ObjFactura.Cliente.IdCtaContAnticipos
ventaRef.IdCtaContableClienteAnticipoExtranjera = ObjFactura.Cliente.IdCtaMonedaExtranjeraAnticipos
ventaRef.IdCtaContableClienteAnticipoComplementaria = ObjFactura.Cliente.IdCtaContCompAnticipos
Dim Pago As New ClsPaginas.VentaPago
Pago.Fecha = FechaCancelacion
Pago.FechaDocumentoRelacionado = ObjFactura.Fecha
Pago.ImportePagoVenta = importeMovimiento
Pago.ImportePago = importeMovimiento
Pago.CveMonedaPago = ObjFactura.CveMoneda
Pago.TCPago = TipoCambioNC
Pago.TipoPago = "NC"
Pago.CveVentaAmortizacion = ObjFactura.CveVenta 'Dr("CveVenta").ToString().ToEntero()
Pago.AplicaTraslado = False
Pago.Referencia = Concepto
Pago.ValorMultiplicador = -1D
ErrorPrepoliza = ClsPaginas.AplicaPrePolizaPagoVenta(ventaRef, Pago, ObjFactura.CvePrePoliza, ObjConta)
If ErrorPrepoliza Then
Exit For
End If
'CTACONTABLE
'IdCtaContable = IdCtaContAnticipos
If tipoCambio = 1 Then
IdCtaContable = ObjFactura.Cliente.IdCtaContClientes
Else
IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera
End If
CveSubProyectoContabilizar = CveSubProyectoVenta
If importeMovimiento <> 0 Then
Dim Importe91 As Decimal = 0
Dim ImporteMN91 As Decimal = 0
Dim Importe251 As Decimal = 0
Dim ImporteMN251 As Decimal = 0
If ObjFactura.CveMoneda = 1 AndAlso Not row2("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = row2("Importe").ToString.ToDecimal
Importe91 = row2("Importe").ToString.ToDecimal
ImporteMN91 = row2("Importe").ToString.ToDecimal
tipoCambio = 1
ElseIf ObjFactura.CveMoneda = 2 AndAlso Not row2("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = row2("Importe").ToString.ToDecimal
Importe91 = row2("Importe").ToString.ToDecimal
ImporteMN91 = row2("Importe").ToString.ToDecimal * tipoCambio
ElseIf ObjFactura.CveMoneda = 2 AndAlso row2("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = row2("Importe").ToString.ToDecimal
Importe91 = row2("Importe").ToString.ToDecimal
ImporteMN91 = row2("Importe").ToString.ToDecimal * tipoCambio
ElseIf ObjFactura.CveMoneda = 1 AndAlso row2("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe91 = row2("Importe").ToString.ToDecimal / tipoCambio
ImporteMN91 = row2("Importe").ToString.ToDecimal
End If
Dim TCFluctuacion As Decimal = row2("TCCambioValuacion").ToString.ToDecimal
If TCFluctuacion = 1 AndAlso tipoCambio > 1 Then
TCFluctuacion = ClsPaginas.GlobalTipoCambio(ObjFactura.Fecha).ToDecimal
End If
If ObjFactura.CveMoneda = 2 AndAlso Not row2("TCCambioValuacion").ToString.ToDecimal > 1 Then
ImporteMN251 = row2("Importe").ToString.ToDecimal * TCFluctuacion
ElseIf ObjFactura.CveMoneda = 2 AndAlso row2("TCCambioValuacion").ToString.ToDecimal > 1 Then
ImporteMN251 = row2("Importe").ToString.ToDecimal * TCFluctuacion
ElseIf ObjFactura.CveMoneda = 1 AndAlso row2("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = row2("Importe").ToString.ToDecimal / TCFluctuacion
ImporteMN251 = row2("Importe").ToString.ToDecimal
Else
ImporteMN251 = row2("Importe").ToString.ToDecimal
End If
Importe251 = (Importe251 * Multiplicador * ValorMultiplicador).RoundSQL
ImporteMN251 = ImporteMN251 * ValorMultiplicador
Importe91 = (Importe91 * ValorMultiplicador).RoundSQL
ImporteMN91 = (ImporteMN91 * Multiplicador * ValorMultiplicador).RoundSQL
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${Importe91.FormatoNumero(2)}"
Dim CveUltimaVenta = row2("CveVenta").ToString.ToEntero
Dim ImporteComplementarioIngreso As Decimal = 0
If UsaComplementariaClientes = True AndAlso tipoCambio > 1 Then
ImporteMN91 = Importe91
ImporteComplementarioIngreso = ((Importe91 * tipoCambio) - Importe91).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 203, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=row2("CveVenta").ToString.ToEntero, ImporteMX:=ImporteComplementarioIngreso, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=row2("TCCambioValuacion").ToString.ToDecimal) Then
ErrorPrepoliza = True
Exit For
End If
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, CveConceptoAplicacionNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=row2("CveVenta").ToString.ToEntero, ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
If UsaComplementariaClientes = True AndAlso row2("TCCambioValuacion").ToString.ToDecimal > 1 Then
ImporteMN251 = Importe251
Dim ImporteComplementarioNC As Decimal = ((Importe251 * row2("TCCambioValuacion").ToString.ToDecimal) - Importe251).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 207, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContComplementaria, -1, CveVenta:=row2("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementarioNC, ImporteME:=If(row2("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=row2("TCCambioValuacion").ToString.ToDecimal) Then
ErrorPrepoliza = True
Exit For
End If
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, CveConceptoPagoNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(row2("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=row2("TCCambioValuacion").ToString.ToDecimal, TipoCambioPago:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
'CONSIDERO FLUCTUACIÓN.
If tipoCambio <> TCFluctuacion AndAlso TCFluctuacion > 1 AndAlso tipoCambio > 1 Then
Dim difFluctuacion As Decimal = tipoCambio - TCFluctuacion
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
Dim TipoMovtoFluctua As Boolean = True
Dim IdCtaContableFluctua As Integer
If difFluctuacion < 0 Then
CveConceptoFluctua = 65
TipoMovtoFluctua = False
Else
CveConceptoFluctua = 64
TipoMovtoFluctua = True
End If
Dim ImporteFluctuacion As Decimal = Math.Abs((Importe251 * difFluctuacion).RoundSQL) * ValorMultiplicador
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=row2("CveVenta").ToString.ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=row2("TCCambioValuacion").ToString.ToDecimal) Then
ErrorPrepoliza = True
Exit For
End If
End If
End If
End If
Next
End If
@@ -5342,7 +5252,7 @@ Namespace Modelos
'CANCELA PREPOLIZA
If Not ErrorCancelar Then
ErrorCancelar = ProcesoPrepolizas(ObjFactura, ObjConta, -1, ObjFactura.DtDetalle, ObjAC, -1, ObjBancos, ObjVentas, ObjEventos, DtRemisionesRelacionadas:=DtRemisionesRelacionadas, SeCancelaRemisionProceso:=SeCancelaRemisionProceso,
CancelarRemisiones:=CancelarRemisiones, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveEstatusRefacturacion:=CveEstatusRefacturacion, ObjInventario:=ObjInventario)
CancelarRemisiones:=CancelarRemisiones, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveEstatusRefacturacion:=CveEstatusRefacturacion, ObjInventario:=ObjInventario, FechaCancelacion:=CancelacionFecha)
MensajeError = "Ocurrió un error al generar la prepoliza de cancelación."
End If
@@ -7693,6 +7603,8 @@ Namespace Modelos
Public Property IdCtaContMonedaExtranjera As Integer
Public Property IdCtaContComplementaria As Integer
Public Property IdCtaContAnticipos As Integer
Public Property IdCtaMonedaExtranjeraAnticipos As Integer
Public Property IdCtaContCompAnticipos As Integer
Public Property IdCtaContRetIVA As Integer
Public Property IdCtaContRetISR As Integer
Public Property ConvenioCIE As String

View File

@@ -1398,10 +1398,9 @@ Partial Class Bancos_PopIECompras
Dim Pago As New CompraPago
Pago.Fecha = TxtFechaDocumento.Text.ToDate
Pago.CveMonedaPago = CveMoneda
ImportePagado = TxtImporte.Text.Trim.ToDecimal
ImportePagado = TxtImporte.Text.Trim.ToDecimal.RoundSQL
'Tipos de cambio
If Pago.CveMonedaPago = 1 AndAlso CompraActual.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en Pesos
Pago.TCPago = TxtTipoCambio.Text.ToDecimal
Pago.TCCambioMoneda = 1 / TxtTipoCambio.Text.ToDecimal
ElseIf Pago.CveMonedaPago = 2 AndAlso CompraActual.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en DOLARES
Pago.TCPago = TxtTipoCambio.Text.ToDecimal
@@ -1433,7 +1432,7 @@ Partial Class Bancos_PopIECompras
Dim UsaComplementariaBancos As Boolean = Not UsuarioActual.CveEmpresa.Contiene(7, 11, 122, 145, 13, 83)
Dim ConceptoMovimiento As String = $"{TxtPagueseA.Text.Trim} - {TxtObservaciones.Text} {If(Pago.TCPago > 1, $" TC:{Pago.TCPago}", "")}"
Dim Referencia As String = TxtFolio.Text.Trim
Dim tImporteMN As Decimal = TxtImporte.Text.ToDecimal
Dim tImporteMN As Decimal = ImportePagado
Pago.ImportePago = tImporteMN
If DivTarjeta.Visible AndAlso DdlTarjeta.SelectedValue.ToEntero > 0 Then
@@ -1480,7 +1479,7 @@ Partial Class Bancos_PopIECompras
End If
Dim saldo As Decimal = DtCheques.Rows(DDlCheques.SelectedIndex)("Saldo").ToString.ToDecimal
If TxtImporte.Text.ToDecimal > saldo Then
If ImportePagado > saldo Then
Alert("El importe no debe de superar el saldo del cheque seleccionado.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
@@ -1497,8 +1496,8 @@ Partial Class Bancos_PopIECompras
MsgError = "Error al registrar detalle de concepto bancario"
End If
Case "3" 'Ingresos X Comprobar
ImportePagado = TxtImporte.Text.Trim.ToDecimal
Case "3" 'Ingresos X Comprobar
Pago.ImportePago = ImportePagado
For Each rw As GridViewRow In GvIngresos.Rows
If rw.FCCheckBox("Chk").Checked Then
@@ -1556,7 +1555,7 @@ Partial Class Bancos_PopIECompras
Pago.CveIE = rw.DataKey("CveIE").ToEntero
Pago.CveMonedaPago = rw.DataKey("CveMoneda").ToEntero
Pago.ImportePago = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
Pago.TCPago = TxtTipoCambio.Text.ToDecimal
Pago.TCPago = If(Pago.CveMonedaPago <> 1, TxtTipoCambio.Text.ToDecimal, 1)
Pago.CveProveedor = DdlAcreedor.SelectedValue.ToEntero
Pago.TipoPago = "Egsc"
If AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjMov) Then
@@ -1584,7 +1583,7 @@ Partial Class Bancos_PopIECompras
End If
If MsgError = "" Then
Dim VentaActual As New Venta With {.CveVenta = rw.DataKey("CveVenta").ToEntero, .ClienteNombre = NombreCliente, .SerieFolio = rw.DataKey("SerieFolio"), .CveCliente = rw.DataKey("CveCliente").ToEntero, .IVA = rw.DataKey("IVA").ToDecimal, .IEPS = rw.DataKey("IEPS").ToDecimal, .RetIVA = rw.DataKey("RetIVA").ToDecimal, .RetISR = rw.DataKey("RetISR").ToDecimal, .Total = rw.DataKey("Total").ToDecimal, .PorcentajeIVA = rw.DataKey("PorcentajeIVA").ToDecimal, .CveSubProyecto = rw.DataKey("CveSubProyecto").ToEntero, .CveMoneda = rw.DataKey("CveMoneda").ToEntero}
Dim VentaActual As New Venta(UsuarioActual) With {.CveVenta = rw.DataKey("CveVenta").ToEntero, .ClienteNombre = NombreCliente, .SerieFolio = rw.DataKey("SerieFolio"), .CveCliente = rw.DataKey("CveCliente").ToEntero, .IVA = rw.DataKey("IVA").ToDecimal, .IEPS = rw.DataKey("IEPS").ToDecimal, .RetIVA = rw.DataKey("RetIVA").ToDecimal, .RetISR = rw.DataKey("RetISR").ToDecimal, .Total = rw.DataKey("Total").ToDecimal, .PorcentajeIVA = rw.DataKey("PorcentajeIVA").ToDecimal, .CveSubProyecto = rw.DataKey("CveSubProyecto").ToEntero, .CveMoneda = rw.DataKey("CveMoneda").ToEntero}
Dim PagoVenta As New VentaPago
PagoVenta.CveMonedaPago = rw.DataKey("CveMoneda").ToEntero
@@ -1854,8 +1853,6 @@ Partial Class Bancos_PopIECompras
End If
End Sub
End Class

View File

@@ -857,6 +857,8 @@ Partial Class Bancos_ProveedoresAbonar
ElseIf Pago.CveMonedaPago = 2 AndAlso CompraActual.CveMoneda = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES
Pago.TCPago = TxtTCDolares.Text.ToDecimal
End If
If ChkPagarPesos.Checked Then Pago.TCCambioMoneda = 1 / TxtTC.Text.ToDecimal
If ChkPagarDolares.Checked Then Pago.TCCambioMoneda = TxtTCDolares.Text.ToDecimal
If gvr.FCTextBox("TxtComision").Text.ToDecimal <> 0 Then
Pago.OtroGastoIngreso = gvr.FCTextBox("TxtComision").Text.ToDecimal
@@ -1097,13 +1099,14 @@ Partial Class Bancos_ProveedoresAbonar
Anexo.Text = "[]"
Dim Msg As New StringBuilder
Msg.AppendFormat(" Folio: <a class=""Texto"" target='_blank' href=""/Bancos/IE.aspx?CveIE={0}"">{1}</a><br/> <br/> ", CveIE, TxtFolio.Text)
Msg.AppendFormat("<li> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir movimiento</a></li> ", Encripta(String.Format("OP=IECHEQUE&CVEIE={0}", CveIE)))
Msg.AppendFormat(" <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir movimiento</a><br/> ", Encripta(String.Format("OP=IECHEQUE&CVEIE={0}", CveIE)))
'End If
Msg.AppendFormat("<li><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Listado</a></li>", Encripta(String.Format("OP=ImprimeMov&CveIE={0}", CveIE)))
If IDPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then Msg.AppendFormat("<li><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Póliza</a></li>", IDPoliza)
Msg.AppendFormat(" <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Listado</a><br/> ", Encripta(String.Format("OP=ImprimeMov&CveIE={0}", CveIE)))
If IDPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then Msg.AppendFormat(" <a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Póliza</a><br/> ", IDPoliza)
Dim Mensaje As String = String.Format("<br />El Documento se generó correctamente.<br /><br /><br />Descargas:<ul>{0}</ul>", Msg.ToString)
Dim Mensaje As String = String.Format("El Documento se generó correctamente.<br /><br /> {0} ", Msg.ToString)
'LIMPIA
TxtFolio.Text = ""

View File

@@ -3598,25 +3598,24 @@
<div class="col-md-2" style="text-align: left;">
<asp:CheckBox ID="ChkIEPS" runat="server" Text="IEPS" Visible="false" />
</div>
<div class="col-md-3" style="text-align: center; margin-top: 5px">
<div class="col-md-2" style="text-align: center; margin-top: 5px">
<asp:Label runat="server" ID="LbImporte" />
</div>
<div class="col-md-4">
<div class="col-md-7">
<asp:DropDownList ID="DdlConceptoIEPS" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="PS" DataValueField="CvePS" Width="100px" ValidationGroup="GrpAgregar" Visible="false"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVConceptoIEPS" runat="server" ControlToValidate="DdlConceptoIEPS" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />Es necesario <b>seleccionar un concepto, </b>por favor ingréselo." InitialValue="-1" ValidationGroup="GrpAgregar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEConceptoIEPS" runat="server" HighlightCssClass="vco" TargetControlID="RFVConceptoIEPS" Width="300px" BehaviorID="VCEConceptoIEPS"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-5"></div>
</div>
</div>
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-2" style="text-align: left; width: 140px">
<asp:CheckBox ID="ChkOtrosI" runat="server" Text="Otros Impuestos" Visible="false" />
</div>
<div class="col-md-3" style="text-align: center; margin-top: 5px">
<div class="col-md-2" style="text-align: center; margin-top: 5px">
<asp:Label runat="server" ID="LbImporte2" />
</div>
<div class="col-md-4">
<div class="col-md-7">
<asp:DropDownList ID="DdlConceptoOI" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="PS" DataValueField="CvePS" Width="100px" ValidationGroup="GrpAgregar" Visible="false"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVConcepto" runat="server" ControlToValidate="DdlConceptoOI" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />Es necesario <b>seleccionar un concepto, </b>por favor ingréselo." InitialValue="-1" ValidationGroup="GrpAgregar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEConcepto" runat="server" HighlightCssClass="vco" TargetControlID="RFVConcepto" Width="300px" BehaviorID="VCEConcepto"></ajax:ValidatorCalloutExtender>
@@ -3629,7 +3628,7 @@
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="BtnAgregarIEPS" OnClick="BtnAgregarIEPS_Click" runat="server" ClientIDMode="Static" Text="Agregar" ValidationGroup="GrpAgregar" CssClass="btn btn-primary" />
<button type="button" class="btn btn-danger" data-dismiss="modal" runat="server" id="BtnCancelarotrosImpuestos" visible="false">Cancelar</button>
<%--<button type="button" class="btn btn-danger" data-dismiss="modal" runat="server" id="BtnCancelarotrosImpuestos" visible="false">Cancelar</button>--%>
</ContentTemplate>
</asp:UpdatePanel>
</div>
@@ -6631,15 +6630,13 @@
TotalCompra = parseFloat($('#<%= TxtTotal.ClientID %>').val().replace(/,/g, '')).toFixed(2);
ImporteAmortizado = $(`.CsSelAmbos${CveCreditoDetalle}`).val().replace(/,/g, '').length == 0 ? 0 : parseFloat($(`.CsSelAmbos${CveCreditoDetalle}`).val().replace(/,/g, ''));
ImporteComision = $(`.CsSelComision${CveCreditoDetalle}`).val().replace(/,/g, '').length == 0 ? 0 : parseFloat($(`.CsSelComision${CveCreditoDetalle}`).val().replace(/,/g, ''));
ImporteComision = isNaN(ImporteComision) ? 0 : ImporteComision;
ImporteDocPorPagar = (ImporteIE - ImporteAmortizado - ImporteComision).toFixed(2);
$(`.CsSelAmbos${CveCreditoDetalle}`).each(function () {
FormatoMoneda3($(this));
});
$(`.CsSelComision${CveCreditoDetalle}`).each(function () {
FormatoMoneda3($(this));
});
$(`.CsCreGlobal`).each(function () {
let stringTemp = $(this).val().replace(/,/g, '');
@@ -6660,15 +6657,18 @@
});
if (((TotalAmortizaciones + TotalComisiones) > TotalCompra) || ((ImporteAmortizado + ImporteComision) > ImporteIE)) {
if ((TotalAmortizaciones > TotalCompra) || ((ImporteAmortizado + ImporteComision) > ImporteIE)) {
TotalAmortizaciones = 0;
TotalComisiones = 0;
//TotalComisiones = 0;
if (Tipo == 1) {
if (Tipo == 1) {
$(`.CsSelAmbos${CveCreditoDetalle}`).val(``);
} else if (Tipo == 2) {
$(`.CsSelComision${CveCreditoDetalle}`).val(``);
if (!isNaN(ImporteComision) && ImporteComision != 0) {
$(`.CsSelComision${CveCreditoDetalle}`).val(``);
}
}
@@ -6679,11 +6679,8 @@
$(`.CsSelAmbos${CveCreditoDetalle}`).each(function () {
FormatoMoneda3($(this));
});
$(`.CsSelComision${CveCreditoDetalle}`).each(function () {
FormatoMoneda3($(this));
});
});
$(`.CsCreGlobal`).each(function () {

View File

@@ -853,6 +853,18 @@ Partial Class Compras_Compras
ViewState("TipoCambio") = value
End Set
End Property
Private Property TipoCambioOriginal As Decimal
Get
Return ViewState("TipoCambioOriginal").ToString.ToDecimal
End Get
Set(value As Decimal)
ViewState("TipoCambioOriginal") = value
End Set
End Property
'Private Property TipoCambio As Double = 0
Private Property OtrosImpuestos As Decimal = 0
Private Property OtrosImpuestosRetenciones As Decimal = 0
@@ -1724,8 +1736,12 @@ Partial Class Compras_Compras
Dim ObjeFacturas As New ClsCompras
Dim RFC As String = ""
If ObjeFacturas.GetFacturas(CveFactura, "-1", Now.AddYears(-4), Now, "-1", "-1", -1, -1, -1, -1, "-1", UsuarioActual.CveEmpresa) AndAlso ObjeFacturas.DtResultados.Rows.Count > 0 Then
Dim dr As DataRow = ObjeFacturas.DtResultados.Rows(0) ' no toma la cero, porque es el totalizador
ViewState("CveTipoProveedor") = dr("CveTipoProveedor").ToString.ToEntero
Dim XMLDoc As New XmlDocument
Dim Archivo As String = String.Format("{0}Compras\{1}\{2}", UsuarioActual.Empresa.Ruta, dr("RFCDe"), dr("XML"))
If IO.File.Exists(Archivo) Then
@@ -2374,12 +2390,22 @@ Partial Class Compras_Compras
If TrasladoIEPS > 0 Or OtrosImpuestos > 0 Then
If OtrosImpuestos > 0 Or TrasladoIEPS > 0 Then
If OtrosImpuestos > 0 Then
RegistraScript("$('#ModalIEPS').modal({ backdrop: 'static', keyboard: false },'show');")
Else
RegistraScript("$('#ModalIEPS').modal('show');")
BtnCancelarotrosImpuestos.Visible = True
If UsuarioActual.Empresa.Funcionalidad(713).ToEntero = 1 Then
'Si tiene funcionalidad y es Acreedor se muestra modal
If CveTipoProveedor.Contiene(2, 3) Then ' Acreedor
RegistraScript("$('#ModalIEPS').modal({ backdrop: 'static', keyboard: false },'show');")
End If
Else
'Si no tiene funcionalidad y es proveedor se muestra
RegistraScript("$('#ModalIEPS').modal({ backdrop: 'static', keyboard: false },'show');")
End If
'Else
' RegistraScript("$('#ModalIEPS').modal('show');")
'BtnCancelarotrosImpuestos.Visible = True
End If
@@ -2642,7 +2668,8 @@ Partial Class Compras_Compras
HfTotalCompra.Value = TxtTotal.Text
TipoCambio = dr("TipoCambio").ToString.ToDecimal
Dim TipoCambioOriginal = dr("TipoCambioOriginal").ToString.ToDouble
TipoCambioOriginal = dr("TipoCambioOriginal").ToString.ToDecimal
If TipoCambio > 1 Then LblTC.Text = String.Format("TC: {0}", TipoCambio.ToString("N4"))
If TipoCambio <> TipoCambioOriginal Then LblTCO.Text = String.Format("<br/>TC Original: {0}", TipoCambioOriginal.ToString("N4"))
@@ -6058,6 +6085,7 @@ Partial Class Compras_Compras
Dim OtrosGastosIngresosCredito As Decimal = gvRowCredito.FCTextBox("TxtComision").Text.ToDecimal
Dim CveIECredito As Integer = gvRowCredito.DataKey("CveIE").ToEntero
Dim CveCreditoDetalleTemp As Integer = gvRowCredito.DataKey("CveCreditoDetalle").ToEntero
Dim CveCreditoTemp As Integer = gvRowCredito.DataKey("CveCredito").ToEntero
If ImportePagoCredito > 0 Then
Dim Pago As New CompraPago
@@ -6079,14 +6107,14 @@ Partial Class Compras_Compras
Exit For
End If
Dim ImporteDifCredito As Decimal = ImporteIEAnticipo - ImportePagoCredito ' CompraActual.Total
Dim ImporteDifCredito As Decimal = (ImporteIEAnticipo + OtrosGastosIngresosCredito) - ImportePagoCredito ' CompraActual.Total
If ImporteDifCredito > 0 Then
' Dim ImportePagoCreditoMN As Decimal = ImportePagoCredito * tipoCambioActual
Dim ImporteDifCreditoMN As Decimal = ImporteDifCredito * tipoCambioActual
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteDifCredito, ImporteDifCreditoMN, 59, Referencia, Concepto, IdCtaContable, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveIE:=CveIECredito, CveCreditoDetalle:=CveCreditoDetalleTemp, CveClasificacion:=CveClasificacionDT, CveSubProyecto:=CveSubProyectoDT, ImporteME:=If(tipoCambioActual = 1, 0, ImporteDifCredito), CveTipoGasto:=CveTipoGastoDT, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteDifCredito, ImporteDifCreditoMN, 50, Referencia, Concepto, IdCtaContable, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveIE:=CveIECredito, CveCredito:=CveCreditoTemp, CveCreditoDetalle:=CveCreditoDetalleTemp, CveClasificacion:=CveClasificacionDT, CveSubProyecto:=CveSubProyectoDT, ImporteME:=If(tipoCambioActual = 1, 0, ImporteDifCredito), CveTipoGasto:=CveTipoGastoDT, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
End If
@@ -9203,10 +9231,17 @@ Partial Class Compras_Compras
Dim FechaMovimiento As Date = TxtFecha.Text.ToDate
If DdlMoneda.SelectedValue.ToString.ToEntero = 2 Then
tipoCambioActual = GlobalTipoCambio(FechaMovimiento).ToString.ToDecimal
tipoCambioActual = If(DivTC.Visible Or TipoCambio > 0, TipoCambio, tipoCambioActual)
tipoCambioPago = GlobalTipoCambio(TxtFechaPago.Text.ToDate).ToString.ToDecimal
If TipoCambioOriginal > 0 Then
tipoCambioActual = TipoCambioOriginal
End If
Else
tipoCambioActual = 1
tipoCambioPago = 1
@@ -9473,7 +9508,7 @@ Partial Class Compras_Compras
'AGREGA MOVIMIENTO
If importeMovimiento <> 0 AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then
Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}"
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 6, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveIE:=CveIE, CveCreditoDetalle:=CveCreditoDetalle, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveTipoGasto:=Row2("CveTipoGasto").ToString.ToEntero) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 6, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveIE:=CveIE, CveCreditoDetalle:=CveCreditoDetalle, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), TipoCambio:=tipoCambioActual, CveTipoGasto:=Row2("CveTipoGasto").ToString.ToEntero) Then
ErrorPrepoliza = True
End If
End If
@@ -13949,6 +13984,12 @@ Partial Class Compras_Compras
End If
If Not ErrorCancelar Then
If Not ObjCompras.CancelarCompraOC(CveCompra, UsuarioActual.CveEmpresa) Then
ErrorCancelar = True
End If
End If
'CANCELA COMPRA
If Not ErrorCancelar Then
@@ -16720,10 +16761,19 @@ Partial Class Compras_Compras
'TxtIVAModal.Text = FormatoNumero(GvRow.DataKey("IVAPorcentaje").ToDouble * 100, 0)
TxtRetIVAModal.Text = FormatoNumero(GvRow.DataKey("RetIVAPorcentaje").ToDouble * 100, 0)
TxtRetISRModal.Text = FormatoNumero(GvRow.DataKey("RetISRPorcentaje").ToDouble * 100, 0)
TxtIEPSModal.Text = FormatoNumero(GvRow.DataKey("IEPSPSPorcentaje").ToDouble * 100, 0)
ViewState("RetIVA") = GvRow.DataKey("RetIVAPorcentaje").ToDouble
ViewState("RetISR") = GvRow.DataKey("RetISRPorcentaje").ToDouble
'TxtRetIVAModal.Text = FormatoNumero(ViewState("RetIVA").ToString().ToDouble * 100, 0)
'TxtRetISRModal.Text = FormatoNumero(ViewState("RetISR").ToString().ToDouble * 100, 0)
TxtPrecio.Text = GvRow.DataKey("PU").FormatoNumero(6)
TxtDescuentoModal.Text = GvRow.DataKey("Descuento").FormatoNumero(6)
TxtOtrosGastos.Text = GvRow.DataKey("OtrosGastos").FormatoNumero
@@ -16899,8 +16949,11 @@ Partial Class Compras_Compras
' DdlIVA.Enabled = False
End If
ViewState("RetIVA") = If(PS("RetIVA").ToString = "-1", ViewState("RetIVA"), PS("RetIVA").ToString).ToString
ViewState("RetISR") = If(PS("RetISR").ToString = "-1", ViewState("RetISR"), PS("RetISR").ToString).ToString
If Not CveFactura > 0 Then
ViewState("RetIVA") = If(PS("RetIVA").ToString = "-1", ViewState("RetIVA"), PS("RetIVA").ToString).ToString
ViewState("RetISR") = If(PS("RetISR").ToString = "-1", ViewState("RetISR"), PS("RetISR").ToString).ToString
End If
If TxtIEPSModal.Text = "" Then
TxtIEPSModal.Text = FormatoNumero(PS("IEPSPorcentaje").ToString.ToDecimal * 100, 0)
End If
@@ -18854,7 +18907,7 @@ Partial Class Compras_Compras
Dim ObjBancos As New ClsBancos
If ObjBancos.GetCreditosDetalleCompras(UsuarioActual.CveEmpresa, CveProveedor, -1, -1, -1) Then
GvCreditos.DataSource = ObjBancos.DtResultados
GvCreditos.DataSource = ObjBancos.DtResultados.FiltraParametros(" ImporteIE > 0")
Else
GvCreditos.DataSource = Nothing
End If
@@ -18921,7 +18974,7 @@ Partial Class Compras_Compras
Dim ObjBancos As New ClsBancos
If ObjBancos.GetCreditosDetalleCompras(UsuarioActual.CveEmpresa, CveProveedor, -1, -1, -1) Then
GvCreditos.DataSource = ObjBancos.DtResultados
GvCreditos.DataSource = ObjBancos.DtResultados.FiltraParametros(" ImporteIE > 0")
Else
GvCreditos.DataSource = Nothing
End If
@@ -18995,7 +19048,7 @@ Partial Class Compras_Compras
If Not ObjInventario.AddFletesCompras(CveFlete, CveCompra) Then
ErrorTrans = True
End If
'''actualiza la compra para que no se surta en almacen. sino por el flete o importación
''actualiza la compra para que no se surta en almacen. sino por el flete o importación
''If Not ObjCompras.UpdateEstatusAlmacen(CveCompra, 2) Then
'' ErrorTrans = True
''End If

View File

@@ -269,8 +269,6 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC
e.Row.Cells(Index).ForeColor = Drawing.Color.Red
End If
Index += 1
Next
@@ -280,8 +278,6 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC
For Each DRow As DataRow In DTHeaders.Rows
Dim Importe As Decimal = e.Row.DBCampo($"SubProyecto{DRow("SubProyecto")}").ToDecimal
'Dim Anio As Integer = DRow("SubProyecto").ToString.ToEntero
If e.Row.Cells(Index).Text.Replace("%", "").ToDecimal = 0 Then
e.Row.Cells(Index).Text = "-"
@@ -289,61 +285,13 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC
e.Row.Cells(Index).ForeColor = Drawing.Color.Red
End If
If Importe <> 0 Then
e.Row.Cells(Index).Text = $"<a { If(Importe < 0, "style='color:Red;'", "style='color:#337ab7;'") } target='_blank' href='./RepAnexoCatalogo.aspx?CveCuenta={CveCunetaRow}&FF=31/12/{DdlEjercicio.SelectedValue}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1&CveSubProyecto={ If(DRow("CveSubProyecto").ToString.ToEntero > 0, DRow("CveSubProyecto").ToString, "-1")}' >{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }</a>"
End If
'If e.Row.Cells(Index + 1).Text.ToDecimal = 0 Then
' e.Row.Cells(Index + 1).Text = "-"
'ElseIf e.Row.Cells(Index + 1).Text.ToDecimal < 0 Then
' e.Row.Cells(Index + 1).ForeColor = Drawing.Color.Red
'End If
Index += 1
Next
'Index = 4
'For Each DRow As DataRow In DTHeaders.Rows
' Dim Importe As Decimal = e.Row.DBCampo($"SubProyecto{DRow("SubProyecto")}").ToDecimal
' 'Dim Anio As Integer = DRow("SubProyecto").ToString.ToEntero
' If Importe > 0 Then
' e.Row.Cells(Index).Text = $"<a { If(Importe < 0, "style='color:Red;'", "style='color:#337ab7;'") } target='_blank' href='./RepAnexoCatalogo.aspx?CveCuenta={CveCunetaRow}&FF=31/12/{DdlEjercicio.SelectedValue}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1&CveSubProyecto={DdlSubProyecto.SelectedValue.ToEntero}' >{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }</a>"
' Else
' e.Row.Cells(Index).Text = "-"
' End If
' If e.Row.Cells(Index + 1).Text.ToDecimal = 0 Then
' e.Row.Cells(Index + 1).Text = "-"
' ElseIf e.Row.Cells(Index + 1).Text.ToDecimal < 0 Then
' e.Row.Cells(Index + 1).ForeColor = Drawing.Color.Red
' End If
' If e.Row.Cells(Index + 2).Text.Replace("%", "").ToDecimal = 0 Then
' e.Row.Cells(Index + 2).Text = "-"
' ElseIf e.Row.Cells(Index + 2).Text.Replace("%", "").ToDecimal < 0 Then
' e.Row.Cells(Index + 2).ForeColor = Drawing.Color.Red
' End If
' Index += 1
'Next
' e.Row.Cells(1).Style.Add("text-indent", $"{e.Row.DBCampo("Level").ToString.ToEntero * 2}em")
End If
End Sub

View File

@@ -643,7 +643,7 @@
</asp:GridView>
<br />
<br />
<asp:GridView ID="GvTotalesMesH" runat="server" AutoGenerateColumns="False" DataKeyNames="CveCuenta,Enero,Febrero,Marzo,Abril,Mayo,Junio,Julio,Agosto,Septiembre,Octubre,Noviembre,Diciembre,PorcentajeAcumulado" OnRowDataBound="GvTotalesMesH_RowDataBound" ShowHeaderWhenEmpty="true" CssClass="table table-striped table-hover Widthall" Style="margin-top: -10px; text-align: center;" GridLines="None">
<asp:GridView ID="GvTotalesMesH" runat="server" AutoGenerateColumns="False" DataKeyNames="CveCuenta,Enero,Febrero,Marzo,Abril,Mayo,Junio,Julio,Agosto,Septiembre,Octubre,Noviembre,Diciembre,PorcentajeAcumulado,ImporteAcumulado" OnRowDataBound="GvTotalesMesH_RowDataBound" ShowHeaderWhenEmpty="true" CssClass="table table-striped table-hover Widthall" Style="margin-top: -10px; text-align: center;" GridLines="None">
<Columns>
<asp:TemplateField>

View File

@@ -1518,6 +1518,8 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal
e.Row.FCHyperLink("HLOctubre").ForeColor = If(e.Row.DataKey("Octubre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLOctubre").ForeColor)
e.Row.FCHyperLink("HLNoviembre").ForeColor = If(e.Row.DataKey("Noviembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLNoviembre").ForeColor)
e.Row.FCHyperLink("HLDiciembre").ForeColor = If(e.Row.DataKey("Diciembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLDiciembre").ForeColor)
e.Row.FCHyperLink("HLAnterior").ForeColor = If(e.Row.DataKey("ImporteAcumulado").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAnterior").ForeColor)
End If
@@ -1929,6 +1931,9 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal
e.Row.Attributes.Add("style", "Font-weight: bold")
If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then
e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red
End If
End If

View File

@@ -400,7 +400,7 @@
<ContentTemplate>
<div class="col-md-4">
<div class="portlet smmallpadding light bordered" id="DivRegistro" runat="server" visible="false">
<div class="portlet xspadding light bordered" id="DivRegistro" runat="server" visible="false">
<div class="portlet-title">
<div class="tools">
<a href="javascript;" data-idchekbox="<%= chkexpand2.ClientID%>" class=" <%= IIf(chkexpand2.Checked = True, "collapse", "expand")%>"></a>
@@ -848,8 +848,8 @@
<ItemTemplate>
<asp:Literal ID="LbLote" runat="server" Text='<%# Eval("Lote")%>'></asp:Literal>
</ItemTemplate>
<ItemStyle Width="90px" HorizontalAlign="Right"></ItemStyle>
<FooterStyle HorizontalAlign="Right"></FooterStyle>
<ItemStyle Width="90px"></ItemStyle>
<FooterStyle ></FooterStyle>
</asp:TemplateField>
<%--<asp:BoundField HeaderText="Caducidad" DataField="FechaCaducidad" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" Visible="false"/>--%>
<asp:TemplateField HeaderText="Fecha Caducidad" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" Visible="false">

View File

@@ -369,7 +369,7 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
GvDetalleDias.DataBind();
}
DdlTipoAsistencias.Enabled = GvDetalleDias.Rows.Count > 0;
if (objRH.GetAsistencias(CvePersonal, -1, -1, -1, -1, -1, fechai, fechai, UsuarioActual.CveEmpresa))
if (objRH.GetAsistencias(CvePersonal, -1, -1, -1, -1, -1,-1, fechai, fechai, UsuarioActual.CveEmpresa))
{
if (objRH.DtResultados.Rows.Count > 0)
{

View File

@@ -92,8 +92,15 @@
<asp:Label runat="server" class="col-md-1 truncate">Tipo Periodo: </asp:Label>
<div class="col-md-1">
<asp:DropDownList ID="DdlTipoPeriodo" runat="server" AppendDataBoundItems="true" AutoPostBack="true" OnSelectedIndexChanged="DdlTipoPeriodo_SelectedIndexChanged" DataTextField="TipoPeriodo" DataValueField="CveTipoPeriodo" Class="form-control select2me input-sm" Style="width: 100% !important;">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
<asp:DropDownList ID="DdlTipoPeriodo" runat="server" AppendDataBoundItems="true" DataTextField="TipoPeriodo" DataValueField="CveTipoPeriodo" Class="form-control select2me input-sm" Style="width: 100% !important;">
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
</asp:DropDownList>
</div>
<asp:Label runat="server" class="col-md-1 truncate">Puesto: </asp:Label>
<div class="col-md-1">
<asp:DropDownList ID="DdlPuesto" runat="server" AppendDataBoundItems="true" DataTextField="Puesto" DataValueField="CvePuesto" Class="form-control select2me input-sm" Style="width: 100% !important;">
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
@@ -130,6 +137,12 @@
<asp:Label ID="LtlCliente" CssClass="truncate" Width="100px" runat="server" Text='<%# Eval("Cliente") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Width="100px" Visible="false" >
<HeaderTemplate>Puesto</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LtlPuesto" CssClass="truncate" Width="100px" runat="server" Text='<%# Eval("Puesto") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Width="110px">
<HeaderTemplate>Asistencia</HeaderTemplate>
<ItemTemplate>

View File

@@ -17,12 +17,13 @@ Partial Class RH_Asistencias
divCliente.Visible = False
LblCliente.Visible = False
GV.Columns(2).Visible = False
GV.Columns(3).Visible = True
End If
txtFechaAsistencia.Text = Now.ToShortDateString
If UsuarioActual.CveRol = 1 OrElse UsuarioActual.CveUsuario = 2343 Then
PnlMasivo.Visible = True
CargaTiposPeriodo()
End If
CargaTiposPeriodo()
End If
End Sub
@@ -57,6 +58,8 @@ Partial Class RH_Asistencias
Private Sub CargaTurnos()
DdlTurno.DataSource = GlobalDTTurno(UsuarioActual.CveEmpresa)
DdlTurno.DataBind()
DdlPuesto.DataSource = GlobalDTRHPuestos(UsuarioActual.CveEmpresa)
DdlPuesto.databind
End Sub
#End Region
@@ -68,7 +71,7 @@ Partial Class RH_Asistencias
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
If TxtFechaAsistencia.Text.Trim.ToDate.Year.Contiene(Now.Year - 1, Now.Year, Now.Year + 1) Then
Dim objpersonal As New ClsRH
If objpersonal.GetAsistencias(-1, DdlCliente.SelectedValue.ToEntero, DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlTurno.SelectedValue.ToEntero, 1, DdlTipoPeriodo.SelectedValue.ToEntero, txtFechaAsistencia.Text.Trim.ToDate, txtFechaAsistencia.Text.Trim.ToDate, UsuarioActual.CveEmpresa) Then
If objpersonal.GetAsistencias(-1, DdlCliente.SelectedValue.ToEntero, DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlTurno.SelectedValue.ToEntero, 1, DdlTipoPeriodo.SelectedValue.ToEntero, txtFechaAsistencia.Text.Trim.ToDate, txtFechaAsistencia.Text.Trim.ToDate, UsuarioActual.CveEmpresa, DdlPuesto.SelectedValue.ToEntero) Then
Dim dt As DataTable = objpersonal.DtResultados
If DdlSupervisorOrganigrama.SelectedValue.ToEntero() > 0 Then
dt = dt.FiltraParametros(String.Format("CvePersonalPadre = {0}", DdlSupervisorOrganigrama.SelectedValue.ToEntero()))

View File

@@ -31,11 +31,11 @@
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveAsistenciasInasistencias,Tipo,AplicaAsistencia,AplicaFalta,AplicaVacacion,AplicaIncapacidad,AplicaRetardo,AplicaAguinaldo,AplicaUtilidades,AplicaPago,AplicaPagoDoble,AplicaPrimaVac,Estatus" EmptyDataText="No se encontraron AsistenciasInasistenciass Registrados" ToolTip="Listado de AsistenciasInasistenciass" CssClass="table table-striped table-hover Widthall" GridLines="None">
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveAsistenciasInasistencias,Tipo,TipoCorto,AplicaAsistencia,AplicaFalta,AplicaVacacion,AplicaIncapacidad,AplicaRetardo,AplicaAguinaldo,AplicaUtilidades,AplicaPago,AplicaPagoDoble,AplicaPrimaVac,Estatus" EmptyDataText="No se encontraron AsistenciasInasistenciass Registrados" ToolTip="Listado de AsistenciasInasistenciass" CssClass="table table-striped table-hover Widthall mysmallbtn" GridLines="None">
<Columns>
<asp:TemplateField HeaderText="Tipo" ItemStyle-Width="25%" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Literal ID="LtlTipo" runat="server" Text='<%# Eval("Tipo", "&nbsp;{0}") %>'></asp:Literal>
<asp:Literal ID="LtlTipo" runat="server" Text='<%# Eval("Tipo", "{0}") %>'></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TxtTipo" runat="server" CausesValidation="true" MaxLength="50" Text='<%# Eval("Tipo") %>' ValidationGroup="GrpGV" Width="240px"></asp:TextBox>
@@ -43,7 +43,8 @@
<ajax:ValidatorCalloutExtender ID="VCTipo" runat="server" HighlightCssClass="vco" TargetControlID="RFVTipo" Width="300px"></ajax:ValidatorCalloutExtender>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Aplica Falta" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
<asp:BoundField DataField="TipoCorto" HeaderText="Tipo Corto" />
<asp:TemplateField HeaderText="Aplica Falta" ItemStyle-Width="10%" >
<ItemTemplate>
<asp:Literal ID="LtlAplicaFalta" runat="server" Text='<%# Eval("AplicaFalta") %>'></asp:Literal>
</ItemTemplate>
@@ -51,7 +52,7 @@
<asp:CheckBox ID="ChkAplicaFalta" runat="server" Checked='<%# If (Eval("AplicaFalta").ToString = "Aplica", True, False) %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Aplica Asistencia" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
<asp:TemplateField HeaderText="Aplica Asistencia" ItemStyle-Width="10%" >
<ItemTemplate>
<asp:Literal ID="LtlAplicaAsistencia" runat="server" Text='<%# Eval("AplicaAsistencia") %>'></asp:Literal>
</ItemTemplate>
@@ -59,46 +60,42 @@
<asp:CheckBox ID="ChkAplicaAsistencia" runat="server" Checked='<%# If (Eval("AplicaAsistencia").ToString() = "Aplica", True, False) %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Aplica Vacaciones" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
<asp:TemplateField HeaderText="Aplica Vacaciones" ItemStyle-Width="10%">
<ItemTemplate>
<asp:Literal ID="LtlAplicaVacacion" runat="server" Text='<%# Eval("AplicaVacacion") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Aplica Incapacidad" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
<asp:TemplateField HeaderText="Aplica Incapacidad" ItemStyle-Width="10%">
<ItemTemplate>
<asp:Literal ID="LtlAplica" runat="server" Text='<%# Eval("AplicaIncapacidad") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Aplica Retardo" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
<asp:TemplateField HeaderText="Aplica Retardo" ItemStyle-Width="10%">
<ItemTemplate>
<asp:Literal ID="LtlAplicaRetardo" runat="server" Text='<%# Eval("AplicaRetardo") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Aplica Aguinaldo" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
<asp:TemplateField HeaderText="Aplica Aguinaldo" ItemStyle-Width="10%">
<ItemTemplate>
<asp:Literal ID="LtlAplicaAguinaldo" runat="server" Text='<%# Eval("AplicaAguinaldo") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Aplica Utilidades" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
<asp:TemplateField HeaderText="Aplica Utilidades" ItemStyle-Width="10%">
<ItemTemplate>
<asp:Literal ID="LtlAplicaUtilidades" runat="server" Text='<%# Eval("AplicaUtilidades") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Aplica Pago" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
<asp:TemplateField HeaderText="Aplica Pago" ItemStyle-Width="10%">
<ItemTemplate>
<asp:Literal ID="LtlAplicapago" runat="server" Text='<%# Eval("AplicaPago") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Aplica Pago Doble" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
<asp:TemplateField HeaderText="Aplica Pago Doble" ItemStyle-Width="10%">
<ItemTemplate>
<asp:Literal ID="LtlAplicapagoDoble" runat="server" Text='<%# Eval("AplicaPagoDoble") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Estatus" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
</asp:TemplateField>
<asp:TemplateField HeaderText="Estatus" ItemStyle-Width="10%">
<ItemTemplate>
<asp:Literal ID="LtlEstatus" runat="server" Text='<%# Eval("Estatus") %>'>a</asp:Literal>
</ItemTemplate>
@@ -106,17 +103,17 @@
<asp:CheckBox ID="ChkEstatus" runat="server" Checked='<%# If (Eval("Estatus").ToString = "Activo", True, False) %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
<asp:TemplateField HeaderText="Fecha" ItemStyle-Width="10%">
<ItemTemplate>
<asp:Literal ID="LtlFechaIng" runat="server" Text='<%# Eval("FechaIng", "{0:d}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Usuario" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
<%-- <asp:TemplateField HeaderText="Usuario" ItemStyle-Width="10%">
<ItemTemplate>
<asp:Literal ID="LtlUsuario" runat="server" Text='<%# Eval("Usuario") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Editar" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
</asp:TemplateField>--%>
<asp:TemplateField HeaderText="Editar" ItemStyle-Width="10%">
<ItemTemplate>
<asp:LinkButton ID="imgE" runat="server" AlternateText="Editar" CausesValidation="False" CommandName="Edit" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
<%--<asp:ImageButton ID="imgE" runat="server" AlternateText="Editar" CausesValidation="False" CommandName="Edit" ImageUrl="/Imagenes/Btn_Edit.png" />--%>
@@ -159,6 +156,11 @@
<asp:RequiredFieldValidator ID="RfvTxtTiposD" runat="server" ControlToValidate="TipoTxt" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpTiposD"></asp:RequiredFieldValidator>
<label for="TipoTxt">Tipo:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtTipoCorto" CssClass="form-control " runat="server" MaxLength="70" CausesValidation="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TxtTipoCorto" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo Corto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpTiposD"></asp:RequiredFieldValidator>
<label for="TipoTxt">TipoCorto:</label>
</div>
<div class="row">
<div class="col-md-4">
<div id="AplicaNoAplicaSection" runat="server" class="form-group form-md-line-input input-iconright">

View File

@@ -120,6 +120,7 @@ chkAplicaVacacion, chkAplicaIncapacidad, chkAplicaRetardo, chkAplicaAguinaldo, c
CheckActiveSection.Visible = True
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) 'obtenemos el renglon que acabamos de seleccionar
TipoTxt.Text = GvRow.DataKey("Tipo")
TxtTipoCorto.Text = GvRow.DataKey("TipoCorto")
AplicaNoAplica.Checked = If(GvRow.DataKey("AplicaAsistencia") = "Aplica", True, False)

View File

@@ -1512,7 +1512,7 @@ Partial Class RH_Personal
If CveCliente <= 0 Then
CveCliente = -1
End If
If objpersonal.GetAsistencias(CvePersonal, CveCliente, -1, DdlSubProyectoAsistenciasC.SelectedValue.ToEntero(), DdlTurno.SelectedValue.ToEntero(), -1, txtFechaI.Text.Trim.ToDate, txtFechaF.Text.Trim.ToDate, UsuarioActual.CveEmpresa) Then
If objpersonal.GetAsistencias(CvePersonal, CveCliente, -1, DdlSubProyectoAsistenciasC.SelectedValue.ToEntero(), DdlTurno.SelectedValue.ToEntero(), -1, -1, txtFechaI.Text.Trim.ToDate, txtFechaF.Text.Trim.ToDate, UsuarioActual.CveEmpresa) Then
GVAsistencia.DataSource = objpersonal.DtResultados.FiltraParametros("Fecha IS NOT NULL")
Else
GVAsistencia.DataSource = Nothing

View File

@@ -46,16 +46,10 @@
</div>
<div class="titlefiltros caption ">
<div class="row">
<div class="col-md-1" style="text-align:right">
Cliente:
</div>
<div class="col-md-1">
<asp:Button ID="BtnCargarClientes" runat="server" ClientIDMode="Static" Text="CargarClientes" Style="display: none;" />
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlCliente" Width="100%" data-metodo="getcliente" UsaWebService="true" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%"></ADS:Dropdownlost>
<div class="row">
<asp:Label ID="LblCliente" runat="server" class="col-md-1 truncate">Cliente:</asp:Label>
<div class="col-md-2" id="divCliente" runat="server">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlCliente" Width="100%" data-metodo="getcliente" UsaWebService="true" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%"></ADS:Dropdownlost>
</div>
<div class="col-md-1" style="text-align:right">
@@ -145,7 +139,20 @@
<asp:ListItem Text="Sin Asignar" Value="-2"></asp:ListItem>
</asp:DropDownList>
</div>
<asp:Label runat="server" class="col-md-1 truncate">Tipo Periodo: </asp:Label>
<div class="col-md-1">
<asp:DropDownList ID="DdlTipoPeriodo" runat="server" AppendDataBoundItems="true" DataTextField="TipoPeriodo" DataValueField="CveTipoPeriodo" Class="form-control select2me input-sm" Style="width: 100% !important;">
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
</asp:DropDownList>
</div>
<asp:Label runat="server" class="col-md-1 truncate">Puesto: </asp:Label>
<div class="col-md-1">
<asp:DropDownList ID="DdlPuesto" runat="server" AppendDataBoundItems="true" DataTextField="Puesto" DataValueField="CvePuesto" Class="form-control select2me input-sm" Style="width: 100% !important;">
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
</asp:DropDownList>
</div>
</div>

View File

@@ -14,10 +14,16 @@ Partial Class RH_RepAsistencias
CargaClientes()
CargaProyecto()
CargaTurnos()
CargaTiposPeriodo()
TxtFechaAsistenciaFin.Text = Now.ToShortDateString
TxtFechaAsistencia.Text = $"01/{Now.ToString("MM")}/{Now.Year}"
If UsuarioActual.Empresa.Funcionalidad(267) = "1" Then ' emp citricola
divCliente.Visible = False
LblCliente.Visible = False
GV.Columns(2).Visible = False
GV.Columns(3).Visible = True
End If
End If
End Sub
@@ -45,21 +51,16 @@ Partial Class RH_RepAsistencias
End Sub
Private Sub CargaClientes()
Dim ObjClientes As New ClsClientes
If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, -1) Then
DdlCliente.DataSource = ObjClientes.DtResultados
Else
DdlCliente.DataSource = Nothing
End If
ObjClientes.Dispose()
'Dim ObjClientes As New ClsClientes
'If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, -1) Then
' DdlCliente.DataSource = ObjClientes.DtResultados
'Else
' DdlCliente.DataSource = Nothing
'End If
'ObjClientes.Dispose()
DdlCliente.DataBind()
End Sub
Protected Sub BtnCargarClientes_Click(sender As Object, e As System.EventArgs) Handles BtnCargarClientes.Click
CargaClientes()
'DdlCliente.Attributes.Remove("onclick")
'DdlCliente.DataBind()
End Sub
Private Sub CargaProyecto()
@@ -85,6 +86,13 @@ Partial Class RH_RepAsistencias
Private Sub CargaTurnos()
DdlTurno.DataSource = GlobalDTTurno(UsuarioActual.CveEmpresa)
DdlTurno.DataBind()
DdlPuesto.DataSource = GlobalDTRHPuestos(UsuarioActual.CveEmpresa)
DdlPuesto.databind
End Sub
Private Sub CargaTiposPeriodo()
DdlTipoPeriodo.DataSource = GlobalDTTipoPeriodo
DdlTipoPeriodo.DataBind()
End Sub
#End Region
@@ -105,7 +113,7 @@ Partial Class RH_RepAsistencias
Dim CveClienteAsignado As Integer = If(DdlCliente.SelectedValue.ToEntero > 0, DdlCliente.SelectedValue.ToEntero, -1)
If objpersonal.RepGetAsistencias(DdlGrupo.SelectedValue.ToEntero, CveClienteAsignado, DdlSubProyecto.SelectedValue.ToEntero, DdlTurno.SelectedValue.ToEntero, 1, TxtFechaAsistencia.Text.Trim.ToDate,
TxtFechaAsistenciaFin.Text.Trim.ToDate, UsuarioActual.CveEmpresa, DdlSupervisorOrganigrama.SelectedValue.ToEntero()) Then
TxtFechaAsistenciaFin.Text.Trim.ToDate, UsuarioActual.CveEmpresa, DdlSupervisorOrganigrama.SelectedValue.ToEntero(), DdlTipoPeriodo.SelectedValue.ToEntero, DdlPuesto.SelectedValue.ToEntero) Then
dtTemp = objpersonal.DtResultados
GvMostrarColumnas(dtTemp)
@@ -143,7 +151,6 @@ Partial Class RH_RepAsistencias
Private Sub GvMostrarColumnas(dt As DataTable)
Dim index = 1
For index = 1 To dt.Columns.Count - 5
CType(GV.Columns(index + 4), BoundField).DataField = dt.Columns(index + 4).ColumnName
GV.Columns(index + 4).Visible = True
@@ -153,13 +160,7 @@ Partial Class RH_RepAsistencias
Else
CType(GV.Columns(index + 4), BoundField).HeaderText = dt.Columns(index + 4).ColumnName
End If
Next
UpDatos.Update()
End Sub
@@ -167,17 +168,10 @@ Partial Class RH_RepAsistencias
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DataKey("Ordenador").ToEntero = 0 Then
If e.Row.DataKey("Ordenador") = "0" Then
e.Row.CssClass = "SubTotales"
End If
' e.Row.Attributes.Add("style", "max-height: 22px;")
End If
End Sub
Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click

View File

@@ -290,40 +290,39 @@ Partial Class CatPS
#Region "P R O D U C T O S A D I C I O N A L E S"
Private Function GuardarProductosEquivalenteEnFranquicia(ObjPS As ClsProductosServicios, CodigoPS As String, PSAdicional As String, Cantidad As Decimal, Opcion As Integer) As Boolean
Private Function GuardarProductosEquivalenteEnFranquicia(ObjPS As ClsProductosServicios, CodigoPS As String, PSAdicional As String, Cantidad As Decimal, Opcion As Integer) As String
Dim Retorno As String = ""
If UsuarioActual.Empresa.Funcionalidad(563) <> "" Then
Dim StrEmpresas As String = UsuarioActual.Empresa.Funcionalidad(563) & "," & UsuarioActual.CveEmpresa ' agregamos la empresa actual
Dim StrEmpresas As String = UsuarioActual.CveEmpresa & "," & UsuarioActual.Empresa.Funcionalidad(563) ' agregamos la empresa actual
Dim EmpresasFranquicia As List(Of Integer) = StrEmpresas.Split(","c).ToList().ConvertAll(Function(x) Convert.ToInt32(x))
For Each Franquicia As Integer In EmpresasFranquicia
Dim CvePSPagina As Integer = GlobalDTPS(Franquicia).FiltroPrimeroValor("CvePS", String.Format("Codigo = '{0}'", CodigoPS)).ToEntero
Dim CvePSPagina As Integer = GlobalDTPSSimplificado(Franquicia, Codigo:=CodigoPS.ToUpper).FiltroPrimeroValor("CvePS", "").ToEntero
Dim CvePSAdicional As Integer
If Opcion = 1 Then CvePSAdicional = GlobalDTPS(Franquicia).FiltroPrimeroValor("CvePS", String.Format("Codigo = '{0}'", PSAdicional)).ToEntero
If Opcion = 1 Then CvePSAdicional = GlobalDTPSSimplificado(Franquicia, Codigo:=PSAdicional.ToUpper).FiltroPrimeroValor("CvePS", "").ToEntero
If CvePSPagina <= 0 Then
Alert(String.Format("El producto de la página no existe en la franquicia: '{0}'", GlobalDTEmpresas(Franquicia).FiltroPrimeroValor("Empresa")), TipoMensaje.MsgAdvertencia)
Return False
Return String.Format("El producto:{0} no existe en la franquicia: '{1}'", CodigoPS, GlobalDTEmpresas(Franquicia).FiltroPrimeroValor("Empresa"))
End If
If CvePSAdicional <= 0 AndAlso Opcion = 1 Then
Alert(String.Format("El producto adicional no existe en la franquicia: '{0}'", GlobalDTEmpresas(Franquicia).FiltroPrimeroValor("Empresa")), TipoMensaje.MsgAdvertencia)
Return False
Return String.Format("El producto adicional: {0} no existe en la franquicia: '{1}'", PSAdicional, GlobalDTEmpresas(Franquicia).FiltroPrimeroValor("Empresa"))
End If
If Opcion = 1 Then
If Not ObjPS.AddPSAdicionales(CvePSPagina, CvePSAdicional, Cantidad) Then
Return False
Return String.Format("No se registró el producto adicional:{0} no existe en la franquicia: '{1}'", CodigoPS, GlobalDTEmpresas(Franquicia).FiltroPrimeroValor("Empresa"))
End If
End If
If Opcion = 2 Then
If Not ObjPS.RemovePSAdicionales(CvePSPagina, -1) Then
Return False
Return "No se pudo eliminar"
End If
End If
Next
End If
Return True
Return ""
End Function
Private Sub LnkExcelPSAdicional_Click(sender As Object, e As EventArgs) Handles LnkExcelPSAdicional.Click
@@ -391,44 +390,50 @@ Partial Class CatPS
Try
Dim ContadorRegistros As Integer = 0
Dim ObjPS As New ClsProductosServicios
ObjPS.IniciaTransacSQL()
Dim ObjPS As ClsProductosServicios
Dim dtPS As DataTable = dt.FiltraParametros("", DistinctColumns:={"CodigoProducto"})
Dim strNoCargados As New StringBuilder
'antes de iniciar la carga se limpiarán los asignados, se filtran por codigops
For Each Row As DataRow In dt.FiltraParametros("", DistinctColumns:={"CodigoProducto"}).Rows
If Not GuardarProductosEquivalenteEnFranquicia(ObjPS, Row("CodigoProducto").ToString.Trim, "", 0, 2) Then
For Each Row As DataRow In dtPS.Rows
ObjPS = New ClsProductosServicios
ObjPS.IniciaTransacSQL()
ErrorExcel = False
Dim msgg As String = GuardarProductosEquivalenteEnFranquicia(ObjPS, Row("CodigoProducto").ToString.Trim, "", 0, 2)
If msgg = "" Then ''eliminar los ps
For Each dr As DataRow In dt.FiltraParametros($"CodigoProducto='{ Row("CodigoProducto").ToString.Trim}'").Rows
Dim CodigoPS As String = dr("CodigoProducto").ToString.Trim
Dim CodigoPSAdicional As String = dr("CodigoProductoAdicional").ToString.Trim
Dim Cantidad As Integer = dr("CantidadFija").ToString.ToEntero
msgg = GuardarProductosEquivalenteEnFranquicia(ObjPS, CodigoPS, CodigoPSAdicional, Cantidad, 1)
If msgg <> "" Then
ErrorExcel = True
strNoCargados.AppendFormat(" {0} <br/>", msgg)
Exit For
End If
ContadorRegistros = ContadorRegistros + 1
Next
Else
ErrorExcel = True
Exit For
strNoCargados.AppendFormat(" {0} <br/> ", msgg)
End If
If Not ErrorExcel Then
ObjPS.Commit()
Else
ObjPS.RollBack()
End If
ObjPS.Dispose()
Next
If Not ErrorExcel Then
For Each Row As DataRow In dt.Rows
Dim CodigoPS As String = Row("CodigoProducto").ToString
Dim CodigoPSAdicional As String = Row("CodigoProductoAdicional").ToString
Dim Cantidad As Integer = Row("CantidadFija").ToString.ToEntero
If Not GuardarProductosEquivalenteEnFranquicia(ObjPS, CodigoPS, CodigoPSAdicional, Cantidad, 1) Then
ErrorExcel = True
Exit For
End If
ContadorRegistros = ContadorRegistros + 1
Next
End If
If Not ErrorExcel Then
ObjPS.Commit()
If ContadorRegistros > 1 Then
Dim StrEmpresas As String = UsuarioActual.Empresa.Funcionalidad(563) & "," & UsuarioActual.CveEmpresa ' agregamos la empresa actual
Dim EmpresasFranquicia As List(Of Integer) = StrEmpresas.Split(","c).ToList().ConvertAll(Function(x) Convert.ToInt32(x))
'regenerar el global de cada empresa
For Each Franquicia As Integer In EmpresasFranquicia
GlobalDTPSAdicionales(-1, Franquicia) = Nothing
Next
Alert($"{ContadorRegistros} Registros aplicados.")
Else
ObjPS.RollBack()
Alert($"Ocurrió un error al cargar los productos.", TipoMensaje.MsgAdvertencia)
End If
Alert($"{ContadorRegistros} Registros aplicados.<br/>{If(strNoCargados.Length > 0, strNoCargados.ToString, "")}")
Catch ex As Exception
Alert("No se pudo cargar el excel", TipoMensaje.MsgAdvertencia)
GuardaLog(ex.Message)

View File

@@ -3081,7 +3081,7 @@ Partial Class Clientes
Protected Sub BtnConsultarAsistencia_Click(sender As Object, e As System.EventArgs) Handles BtnConsultarAsistencia.Click
Dim objpersonal As New ClsRH
If objpersonal.GetAsistencias(-1, CveCliente, -1, -1, -1, 1, txtFechaI.Text.Trim.ToDate(), txtFechaF.Text.Trim.ToDate(), UsuarioActual.CveEmpresa) Then
If objpersonal.GetAsistencias(-1, CveCliente, -1, -1, -1, 1, -1, txtFechaI.Text.Trim.ToDate(), txtFechaF.Text.Trim.ToDate(), UsuarioActual.CveEmpresa) Then
GVAsistencia.DataSource = objpersonal.DtResultados.FiltraParametros("Fecha IS NOT NULL")
Else
GVAsistencia.DataSource = Nothing

View File

@@ -966,7 +966,7 @@ Partial Class Ventas_ClientesAbonar
ObjFactura = New Modelos.Factura(UsuarioActual, gvr.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
End If
Dim VentaActual As New Venta
Dim VentaActual As New Venta(UsuarioActual)
VentaActual.CveVenta = gvr.DataKey("CveVenta").ToEntero
VentaActual.Fecha = gvr.DataKey("Fecha").ToDate
VentaActual.CveCliente = gvr.DataKey("CveCliente").ToEntero
@@ -982,7 +982,6 @@ Partial Class Ventas_ClientesAbonar
VentaActual.RetISR = gvr.DataKey("RetISR").ToDecimal
VentaActual.PorcentajeIVA = gvr.DataKey("PorcentajeIVA").ToDecimal
VentaActual.UsuarioActual = UsuarioActual
VentaActual.CveSubProyecto = gvr.DataKey("CveSubProyecto").ToEntero
VentaActual.IdCtaContableCliente = IIf(VentaActual.CveMoneda = 1, IdCuentaCliente, IdCtaContMonedaExtranjera)
VentaActual.IdCtaContableClienteComplementaria = IdCtaContComplementaria

View File

@@ -5277,7 +5277,7 @@ Partial Class Ventas
TxtKilometraje.Text = DbRowVenta("Kilometraje").ToString().PadLeft(6, "0"c)
VentaActual = New Venta
VentaActual = New Venta(UsuarioActual)
VentaActual.CveVenta = CveVenta
VentaActual.Fecha = DbRowVenta("Fecha").ToString.ToDate
VentaActual.CveCliente = DbRowVenta("CveCliente").ToString.ToEntero
@@ -10079,8 +10079,38 @@ Partial Class Ventas
End If
End If
'ContPAQ El movimiento 1 es el de Venta
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
AutoConta = AutocontaMatriz(AutoConta)
If DdlTipoComprobante.SelectedValue.Contiene("Rem", "RNC", "Cot", "Ped", "Pd2", "PA") Then
AutoConta = False
End If
If UsuarioActual.CveEmpresa = 119 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ant", "Rem", "RNC", "Cot", "Ped", "Pd2", "PA", "Egs", "Dev") Then
AutoConta = False
End If
If UsuarioActual.CveEmpresa = 140 Then
AutoConta = True
idCuentaContabilizacion = 10
End If
Try
If AutoConta Then
If Not ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContPaq) Then
ErrorList.Add("Ocurrió un error al contabilizar, pongase en contacto con soporte técnico")
End If
End If
Catch ex As Exception
ErrorList.Add("Ocurrió un error al contabilizar, pongase en contacto con soporte técnico")
OnError("Ocurrió un error al contabilizar la factura", ex)
End Try
If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or ObjFactura.TipoDocto.Contiene("Ped", "Cot", "DPe", "PeC", "PA", "Pd2")) Then
ObjVentas.Commit()
If ObjContPaq IsNot Nothing Then ObjContPaq.Commit()
'ENVIAR POLIZA VIRTUAL
If ErrorList.Count = 0 Then
@@ -10089,42 +10119,6 @@ Partial Class Ventas
End If
End If
'ContPAQ El movimiento 1 es el de Venta
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
AutoConta = AutocontaMatriz(AutoConta)
If UsuarioActual.CveEmpresa = 119 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ant", "Rem", "RNC", "Cot", "Ped", "Pd2", "PA", "Egs", "Dev") Then
AutoConta = False
End If
If UsuarioActual.CveEmpresa = 140 Then
AutoConta = True
idCuentaContabilizacion = 10
End If
Try
If AutoConta Then
If idCuentaContabilizacion > 0 Or UsuarioActual.CveEmpresa.Contiene(7, 11, 12, 122, 145) Then
If ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContPaq) Then
If ObjContPaq IsNot Nothing Then ObjContPaq.Commit()
Else
Alert("Ocurrió un Error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError)
If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
End If
Else
Alert(String.Format("Falta asignación de las siguientes cuentas contables: {0}", CuentasContablesInvalidas), TipoMensaje.MsgAdvertencia)
End If
Else
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC Then
If ObjContPaq IsNot Nothing Then ObjContPaq.Commit()
End If
End If
Catch ex As Exception
OnError("Ocurrió un error al contabilizar la factura", ex)
End Try
Try
'RMF, cuando es pedido, se manda autorización.
If ObjFactura.TipoDocto.Contiene("PA") Then
@@ -13831,6 +13825,7 @@ Partial Class Ventas
Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>"
Dim CveCuentaContabilizacion As Integer = 1
Dim tipoCambio As Decimal
Dim TCPago As Decimal = 1
Dim CuentasContablesInvalidasSIG As New StringBuilder
@@ -13844,6 +13839,7 @@ Partial Class Ventas
If ObjFactura.CveMoneda = 2 AndAlso ObjFactura.TipoCambio > 0 Then
tipoCambio = ObjFactura.TipoCambio
TCPago = GlobalTipoCambio(ObjFactura.Fecha.AddDays(-1)).ToString().ToDecimal
ElseIf ObjFactura.CveMoneda = 2 AndAlso ObjFactura.TipoCambio <= 1 Then
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
tipoCambio = GlobalTipoCambio(ObjFactura.Fecha.AddDays(-1)).ToString().ToDecimal
@@ -14043,456 +14039,301 @@ Partial Class Ventas
Case 12 'Nota de Credito
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then
Dim ConPreP As ConceptosTipoSaldo = ObtenerCveConceptoPrePoliza(6, ObjFactura.CveMoneda, False, 2)
importeMovimiento = ObjFactura.Total * ValorMultiplicador
importeMX = (importeMovimiento * tipoCambio * Multiplicador).RoundSQL
importeMX = (importeMovimiento * tipoCambio * Multiplicador).RoundSQL(2)
FechaMovimiento = ObjFactura.FechaPago
Dim ImporteConcepto12 As Decimal = 0
Dim ImporteAcumulado91 As Decimal = 0
Dim CveUltimaVenta As Integer = 0
If tipoCambio > 1 Then
Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
ConceptoContable = 293
End If
If tipoCambio = 1 Then
IdCtaContable = ObjFactura.Cliente.IdCtaContClientes
ElseIf UsaComplementariaClientes Then
IdCtaContable = ObjFactura.Cliente.IdCtaContComplementaria
CveSubProyectoContabilizar = ObjFactura.CveSubProyecto
If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsaComplementariaClientes) Then
importeMX = importeMovimiento
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, 0, Referencia, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=Math.Round(importeMovimiento * tipoCambio - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
End If
IdCtaContable = ObjFactura.Cliente.IdCtaContClientes
If ObjFactura.CveMoneda = 2 Then
importeMX = importeMovimiento
IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera
'CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera
Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
End If
CveSubProyectoContabilizar = CveSubProyectoVenta
ImporteConcepto12 = importeMX.RoundSQL
If importeMovimiento <> 0 Then
If IdCtaContable <= 0 Then
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString())
idCuentaContabilizacion = 0
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConPreP.CveConcepto, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
If UsaComplementariaClientes AndAlso ObjFactura.CveMoneda = 2 Then
IdCtaContable = ObjFactura.Cliente.IdCtaContComplementaria
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, 0, Referencia, ConPreP.CveConceptoComplementario, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=(importeMovimiento * tipoCambio - importeMovimiento).RoundSQL(2), ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
Else
ViewState("SeGuardoPrePoliza") = True
End If
End If
importeMovimiento = 0
If ValorMultiplicador = 1 Then
Dim TipoCambioNC As Decimal = 1
Dim IdCtaContableClienteComplementaria As Integer = ObjFactura.Cliente.IdCtaContComplementaria
Dim TipoCambioNC As Decimal = 1
If ObjFactura.CveMoneda = 2 Then
If tipoCambio > 1 Then
TipoCambioNC = tipoCambio
Else
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
TipoCambioNC = GlobalTipoCambio(TxtFecha.Text.ToDate.AddDays(-1)).ToDecimal
TipoCambioNC = GlobalTipoCambio(ObjFactura.Fecha.AddDays(-1)).ToDecimal
Else
TipoCambioNC = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
TipoCambioNC = GlobalTipoCambio(ObjFactura.Fecha).ToDecimal
End If
End If
End If
'APLICA NC SALDOS DIRECTOS
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
For Each Dr As DataRow In DtVentasNC.Rows
importeMovimiento = 0
importeMX = 0
'APLICA NC SALDOS DIRECTOS
If Not ErrorPrepoliza AndAlso DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
For Each Dr As DataRow In DtVentasNC.Rows
Dim ObjFacturaRef As New Modelos.Factura(UsuarioActual, Dr("CveVenta").ToString().ToEntero(), UsuarioActual.CveEmpresa, CargaDTDetalle:=False, VerificaAlmacen:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False)
Dim Importe91 As Decimal = 0
Dim ImporteMN91 As Decimal = 0
Dim Importe251 As Decimal = 0
Dim ImporteMN251 As Decimal = 0
Dim ventaRef As New Venta(ObjFacturaRef, UsuarioActual)
If DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso Not Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString().ToDecimal
Importe91 = Dr("Importe").ToString().ToDecimal
ImporteMN91 = Dr("Importe").ToString().ToDecimal
TipoCambioNC = 1
ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso Not Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString().ToDecimal
Importe91 = Dr("Importe").ToString().ToDecimal
ImporteMN91 = Dr("Importe").ToString().ToDecimal * TipoCambioNC
ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString().ToDecimal
Importe91 = Dr("Importe").ToString().ToDecimal
ImporteMN91 = Dr("Importe").ToString().ToDecimal * TipoCambioNC
ElseIf DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then
ObjFacturaRef.Dispose()
Importe91 = Dr("Importe").ToString().ToDecimal / TipoCambioNC
ImporteMN91 = Dr("Importe").ToString().ToDecimal
End If
ventaRef.ClienteNombre = NombreCliente
ventaRef.IdCtaContableCliente = IIf(ventaRef.CveMoneda = 1, ViewState("IdCtaContClientes"), ViewState("IdCtaContMonedaExtranjera")).ToString.ToEntero
ventaRef.IdCtaContableClienteComplementaria = ViewState("IdCtaContComplementaria").ToString.ToEntero
Dim TCFluctuacion As Decimal = Dr("TCCambioValuacion").ToString().ToDecimal
If TCFluctuacion = 1 AndAlso TipoCambioNC > 1 Then
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
TCFluctuacion = GlobalTipoCambio(TxtFecha.Text.ToDate.AddDays(-1)).ToDecimal
Else
TCFluctuacion = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
End If
End If
ventaRef.IdCtaContableClienteAnticipo = ViewState("IdCtaContAnticipos").ToString.ToEntero
ventaRef.IdCtaContableClienteAnticipoExtranjera = ViewState("IdCtaContAnticiposExtranjera").ToString.ToEntero
ventaRef.IdCtaContableClienteAnticipoComplementaria = ViewState("IdCtaContAnticiposComplementaria").ToString.ToEntero
If DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso Not Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then
ImporteMN251 = Dr("Importe").ToString().ToDecimal * TCFluctuacion
ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then
ImporteMN251 = Dr("Importe").ToString().ToDecimal * TCFluctuacion
ElseIf DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString().ToDecimal / TCFluctuacion
ImporteMN251 = Dr("Importe").ToString().ToDecimal
Else
ImporteMN251 = Dr("Importe").ToString().ToDecimal
End If
Importe251 = Importe251.RoundSQL
Importe91 = (Importe91).RoundSQL
ImporteMN91 = (ImporteMN91 * Multiplicador).RoundSQL
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${Importe91.FormatoNumero(2)}"
CveUltimaVenta = Dr("CveVenta").ToString().ToEntero()
Dim ImporteComplementarioIngreso As Decimal = 0
If UsaComplementariaClientes = True AndAlso tipoCambio > 1 Then
ImporteMN91 = Importe91
ImporteComplementarioIngreso = ((Importe91 * tipoCambio) - Importe91).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString().ToEntero(), ImporteMX:=ImporteComplementarioIngreso, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=Dr("TCCambioValuacion").ToString().ToDecimal) Then
ErrorPrepoliza = True
Exit For
End If
End If
Dim CveConceptoAplicacionNC As Integer = 91
'SI LA NOTA DE CREDITO ES EN MONEDA EXTRANGERA UTILIZAR EL CONCEPTO DE APLICACION ME
If ConceptoContable = 293 Then
CveConceptoAplicacionNC = 294
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, CveConceptoAplicacionNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString().ToEntero(), ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
ImporteAcumulado91 += (ImporteMN91).RoundSQL
If UsaComplementariaClientes = True AndAlso Dr("TCCambioValuacion").ToString().ToDecimal > 1 Then
ImporteMN251 = Importe251
Dim ImporteComplementarioNC As Decimal = ((Importe251 * Dr("TCCambioValuacion").ToString().ToDecimal) - Importe251).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementarioNC, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal) Then
ErrorPrepoliza = True
Exit For
End If
End If
' Traslado de impuestos cuando es amortizacion de NC
If EsNCAmortizacion Then
'' aqui no se registra el pago como NC, se deja para el registro de la aplicaion del anticipo
'' esto para trasladar los impuestos.
If Not AplicoNCFacturaActual Then
If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") Then
For Each row2 As GridViewRow In GVAnticipos.Rows
If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 3 Then
If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then
CveIEAnticipo = row2.DataKey("CveIE").ToString().ToEntero()
importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal)
Dim ImporteAnticipo As Decimal = importeMovimiento
Dim CveMonedaAnticipo As Integer = row2.DataKey("CveMoneda").ToString().ToEntero()
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then ImporteAnticipo = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal * row2.DataKey("SubTotalAnticipo").ToDecimal
Dim Importe11MX As Decimal = ImporteAnticipo
IdCtaContable = IdCtaContAnticipos
CveSubProyectoContabilizar = CveSubProyectoVenta
If importeMovimiento <> 0 Then
'SI LA NC ES EN DOLARES Y PERO VIENE DE UN ANTICIPO EN PESOS
If (Not UsuarioActual.CveEmpresa.Contiene(72, 80, 146)) AndAlso ObjFactura.CveMoneda = 2 Then
Dim tipoCambioAnticipo = GlobalTipoCambio(row2.DataKey("Fecha").ToString().ToDate).ToDecimal
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
tipoCambioAnticipo = GlobalTipoCambio(row2.DataKey("Fecha").ToString().ToDate.AddDays(-1)).ToDecimal
End If
If ObjFactura.CveMoneda = 2 AndAlso CveMonedaAnticipo = 1 Then
Importe11MX = Importe11MX * tipoCambio
End If
If row2.DataKey("CveMoneda").ToString.ToEntero = 2 Then
IdCtaContable = IdCtaContAnticiposExtranjera
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe11MX, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Importe11MX, ImporteME:=If(tipoCambioAnticipo = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioAnticipo) Then
ErrorPrepoliza = True
Exit For
End If
If row2.DataKey("CveMoneda").ToString.ToEntero = 2 Then
IdCtaContable = IdCtaContAnticiposComplementaria
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteAnticipo * tipoCambioAnticipo - ImporteAnticipo, Referencia, 227, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=ImporteAnticipo * tipoCambioAnticipo - ImporteAnticipo, ImporteME:=If(tipoCambioAnticipo = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioAnticipo) Then
ErrorPrepoliza = True
Exit For
End If
End If
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 292, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 292, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContMonedaExtranjera, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
Else
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe11MX, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Importe11MX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
Exit For
Else
ViewState("SeGuardoPrePoliza") = True
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContClientes, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
'se hace acreditamiento de impuestos
'IVA X TRASLADAR
Dim EsAnticipoEspecial As Boolean = False
If UsuarioActual.CveEmpresa.Contiene(1, 119) Then EsAnticipoEspecial = True
If EsAnticipoEspecial Then
Dim PorcentajeImpuestoPago As Decimal = TmpDT.MAX("PorcentajeIVA").ToDecimal
'' si se esta aplicando NC por amortizaion, se trasladan impuestos
If EsNCAmortizacion Then
Dim IngresoIVA As Decimal = TxtIVA.Text.ToDecimal
Dim IngresoIEPS As Decimal = TxtIEPS.Text.ToDecimal
Dim IngresoTotal As Decimal = TxtTotal.Text.ToDecimal
If IngresoIVA > 0 Then
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
ErrorPrepoliza = True
Exit For
End If
'IVA PAGADO
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
ErrorPrepoliza = True
Exit For
End If
End If
If IngresoIEPS > 0 Then
'IEPS X TRASLADAR
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 38, Concepto, Fecha, 0, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
Exit For
End If
'IEPS PAGADO
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 39, Concepto, Fecha, 0, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
Exit For
End If
End If
End If
End If
End If
End If
End If
End If
End If
Next
End If
ElseIf AplicoNCFacturaActual AndAlso ChkAplicaNCAnticipo.Checked Then
Dim CveConceptoPagoNC As Integer = 251
If ObjFactura.CveMoneda > 1 Then
CveConceptoPagoNC = 301
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, CveConceptoPagoNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
End If
Else
Dim CveConceptoPagoNC As Integer = 251
If ObjFactura.CveMoneda > 1 Then
CveConceptoPagoNC = 301
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, CveConceptoPagoNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
End If
'considero fluctuación.
If TipoCambioNC <> TCFluctuacion AndAlso TCFluctuacion > 1 AndAlso TipoCambioNC > 1 Then
Dim difFluctuacion As Decimal = TipoCambioNC - TCFluctuacion
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
Dim TipoMovtoFluctua As Boolean = True
Dim IdCtaContableFluctua As Integer
If difFluctuacion < 0 Then
CveConceptoFluctua = 65
TipoMovtoFluctua = False
Else
CveConceptoFluctua = 64
TipoMovtoFluctua = True
End If
Dim ImporteFluctuacion As Decimal = Math.Abs((Importe251 * difFluctuacion).RoundSQL)
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString().ToEntero(), ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=TipoCambioNC, TipoCambioPago:=Dr("TCCambioValuacion").ToString().ToDecimal) Then
ErrorPrepoliza = True
Exit For
End If
End If
Next
If ImporteConcepto12 <> ImporteAcumulado91 Then
Dim CveConceptoOtIngresos As Integer = 0
Dim IdCuentaContableOt As Integer = 0
Dim TipoMovtoOt As Boolean = False
If ImporteConcepto12 > ImporteAcumulado91 Then
IdCuentaContableOt = UsuarioActual.Empresa.Funcionalidad(559).ToEntero()
CveConceptoOtIngresos = 211
TipoMovtoOt = False
Else
IdCuentaContableOt = UsuarioActual.Empresa.IdCuentaOtrosIngresos
CveConceptoOtIngresos = 78
TipoMovtoOt = True
End If
Dim ImporteOtrosIngresos As Decimal = ImporteConcepto12 - ImporteAcumulado91
' If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteOtrosIngresos, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveUltimaVenta, ImporteMX:=ImporteOtrosIngresos, ImporteME:=0, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoOt, ImporteOtrosIngresos, Referencia, CveConceptoOtIngresos, Concepto, FechaMovimiento, IdCuentaContableOt, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteME:=0, ImporteMX:=ImporteOtrosIngresos, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
'Else
' ErrorPrepoliza = True
'End If
End If
If Not ErrorPrepoliza AndAlso ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
'ErrorPrepoliza = True
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
'SIRVE PARA VER LA PREPOLIZA QUE SE VALIDA
'If ObjConta.GetPrePolizasDetalle(ObjFactura.CvePrePoliza) Then
' Dim DtTest = ObjConta.DtResultados
'End If
End If
End If
Dim Pago As New VentaPago
Pago.Fecha = ObjFactura.Fecha
Pago.FechaDocumentoRelacionado = ObjFactura.Fecha
Pago.ImportePagoVenta = Dr("Importe").ToString().ToDecimal()
Pago.ImportePago = Dr("Importe").ToString().ToDecimal()
Pago.CveMonedaPago = ObjFactura.CveMoneda
Pago.TCPago = TipoCambioNC
Pago.TipoPago = "NC"
Pago.CveVentaAmortizacion = ObjFactura.CveVenta 'Dr("CveVenta").ToString().ToEntero()
Pago.AplicaTraslado = False
Pago.Referencia = Concepto
'Pago.CveConceptoPago = 251
ErrorPrepoliza = AplicaPrePolizaPagoVenta(ventaRef, Pago, ObjFactura.CvePrePoliza, ObjConta)
If ErrorPrepoliza Then
Exit For
End If
End If
'APLICA DEVOLUCION SALDOS DIRECTOS
If AplicaDevolucion Then
Dim importeMovimientoDev = TxtTotal.Text.ToDecimal
importeMovimientoDev = If(SaldoVentaDevolucion < importeMovimientoDev, SaldoVentaDevolucion, importeMovimientoDev)
If importeMovimientoDev > 0 Then
Dim importeMXDev = importeMovimientoDev * tipoCambio * Multiplicador
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimientoDev.FormatoNumero(2)}"
If Not ErrorPrepoliza AndAlso EsNCAmortizacion AndAlso Not AplicoNCFacturaActual AndAlso DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") Then
If UsaComplementariaClientes AndAlso tipoCambio > 1 Then
importeMXDev = importeMovimientoDev
Dim ImporteComplementaria As Decimal = ((importeMovimientoDev * tipoCambio) - importeMovimientoDev).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimientoDev, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveVentaDevolucion, ImporteMX:=ImporteComplementaria, ImporteME:=If(tipoCambio = 1, 0, importeMovimientoDev), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=TipoCambioFactura) Then
ErrorPrepoliza = True
Exit For
For Each row2 As GridViewRow In GVAnticipos.Rows
If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 3 Then
If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then
CveIEAnticipo = row2.DataKey("CveIE").ToString().ToEntero()
importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal)
Dim ImporteAnticipo As Decimal = importeMovimiento
Dim CveMonedaAnticipo As Integer = row2.DataKey("CveMoneda").ToString().ToEntero()
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then ImporteAnticipo = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal * row2.DataKey("SubTotalAnticipo").ToDecimal
Dim Importe11MX As Decimal = ImporteAnticipo
IdCtaContable = IdCtaContAnticipos
CveSubProyectoContabilizar = CveSubProyectoVenta
If importeMovimiento <> 0 Then
'SI LA NC ES EN DOLARES Y PERO VIENE DE UN ANTICIPO EN PESOS
If (Not UsuarioActual.CveEmpresa.Contiene(72, 80, 146)) AndAlso ObjFactura.CveMoneda = 2 Then
Dim tipoCambioAnticipo As Decimal = 1D
If CveMonedaAnticipo = 2 Then
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
tipoCambioAnticipo = GlobalTipoCambio(row2.DataKey("Fecha").ToString().ToDate.AddDays(-1)).ToDecimal
Else
tipoCambioAnticipo = GlobalTipoCambio(row2.DataKey("Fecha").ToString().ToDate).ToDecimal
End If
End If
If ObjFactura.CveMoneda = 2 AndAlso CveMonedaAnticipo = 1 Then
Importe11MX = Importe11MX * tipoCambio
End If
If row2.DataKey("CveMoneda").ToString.ToEntero = 2 Then
IdCtaContable = IdCtaContAnticiposExtranjera
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe11MX, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Importe11MX, ImporteME:=If(tipoCambioAnticipo = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioAnticipo) Then
ErrorPrepoliza = True
Exit For
End If
If row2.DataKey("CveMoneda").ToString.ToEntero = 2 Then
IdCtaContable = IdCtaContAnticiposComplementaria
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteAnticipo * tipoCambioAnticipo - ImporteAnticipo, Referencia, 227, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=ImporteAnticipo * tipoCambioAnticipo - ImporteAnticipo, ImporteME:=If(tipoCambioAnticipo = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza, TipoCambio:=tipoCambioAnticipo) Then
ErrorPrepoliza = True
Exit For
End If
End If
'Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 292, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
'If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 292, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContMonedaExtranjera, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
' ErrorPrepoliza = True
' Exit For
'End If
Else
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe11MX, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Importe11MX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
Exit For
Else
'ViewState("SeGuardoPrePoliza") = True
'If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContClientes, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
' ErrorPrepoliza = True
' Exit For
'End If
'se hace acreditamiento de impuestos
'IVA X TRASLADAR
Dim EsAnticipoEspecial As Boolean = False
If UsuarioActual.CveEmpresa.Contiene(1, 119) Then EsAnticipoEspecial = True
If EsAnticipoEspecial Then
Dim PorcentajeImpuestoPago As Decimal = TmpDT.MAX("PorcentajeIVA").ToDecimal
'' si se esta aplicando NC por amortizaion, se trasladan impuestos
If EsNCAmortizacion Then
Dim IngresoIVA As Decimal = TxtIVA.Text.ToDecimal
Dim IngresoIEPS As Decimal = TxtIEPS.Text.ToDecimal
Dim IngresoTotal As Decimal = TxtTotal.Text.ToDecimal
If IngresoIVA > 0 Then
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
ErrorPrepoliza = True
Exit For
End If
'IVA PAGADO
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
ErrorPrepoliza = True
Exit For
End If
End If
If IngresoIEPS > 0 Then
'IEPS X TRASLADAR
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 38, Concepto, Fecha, 0, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
Exit For
End If
'IEPS PAGADO
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 39, Concepto, Fecha, 0, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
Exit For
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimientoDev, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveVentaDevolucion, ImporteMX:=importeMXDev, ImporteME:=If(tipoCambio = 1, 0, importeMovimientoDev), CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
Exit For
End If
If UsaComplementariaClientes AndAlso TipoCambioFactura > 1 Then
importeMXDev = importeMovimientoDev
Dim ImporteComplementaria As Decimal = ((importeMovimientoDev * TipoCambioFactura) - importeMovimientoDev).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimientoDev, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=CveVentaDevolucion, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementaria, ImporteME:=If(TipoCambioFactura = 1, 0, importeMovimientoDev), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=TipoCambioFactura) Then
ErrorPrepoliza = True
Exit For
End If
End If
Dim CveConceptoPagoNC As Integer = 251
If ObjFactura.CveMoneda > 1 Then
CveConceptoPagoNC = 301
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimientoDev, Referencia, CveConceptoPagoNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVentaDevolucion, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMXDev, ImporteME:=If(tipoCambio = 1, 0, importeMovimientoDev), CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
Exit For
End If
If tipoCambio <> TipoCambioFactura Then
Dim difFluctuacion As Decimal = tipoCambio - TipoCambioFactura
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
Dim TipoMovtoFluctua As Boolean = True
Dim IdCtaContableFluctua As Integer
If difFluctuacion < 0 Then
CveConceptoFluctua = 65
TipoMovtoFluctua = False
Else
CveConceptoFluctua = 64
TipoMovtoFluctua = True
End If
Dim ImporteFluctuacion As Decimal = Math.Abs((importeMovimientoDev * difFluctuacion).RoundSQL)
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveVentaDevolucion, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=TipoCambioFactura) Then
ErrorPrepoliza = True
Exit For
End If
End If
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 2) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
'ErrorPrepoliza = True
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
'SIRVE PARA VER LA PREPOLIZA QUE SE VALIDA
'If ObjConta.GetPrePolizasDetalle(ObjFactura.CvePrePoliza) Then
' Dim DtTest = ObjConta.DtResultados
'End If
End If
End If
Next
End If
Next
If Not ErrorPrepoliza AndAlso ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
'ErrorPrepoliza = True
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
End If
End If
If ErrorPrepoliza Then
Exit For
End If
End If
'APLICA DEVOLUCION SALDOS DIRECTOS
If AplicaDevolucion Then
IdCtaContable = ObjFactura.Cliente.IdCtaContClientes
Dim IdCtaContableClienteComplementaria As Integer = ObjFactura.Cliente.IdCtaContComplementaria
Dim importeMovimientoDev = TxtTotal.Text.ToDecimal
importeMovimientoDev = If(SaldoVentaDevolucion < importeMovimientoDev, SaldoVentaDevolucion, importeMovimientoDev)
If importeMovimientoDev > 0 Then
Dim importeMXDev = importeMovimientoDev * tipoCambio * Multiplicador
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimientoDev.FormatoNumero(2)}"
If UsaComplementariaClientes AndAlso tipoCambio > 1 Then
importeMXDev = importeMovimientoDev
Dim ImporteComplementaria As Decimal = ((importeMovimientoDev * tipoCambio) - importeMovimientoDev).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimientoDev, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveVentaDevolucion, ImporteMX:=ImporteComplementaria, ImporteME:=If(tipoCambio = 1, 0, importeMovimientoDev), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=TipoCambioFactura) Then
ErrorPrepoliza = True
Exit For
End If
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimientoDev, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveVentaDevolucion, ImporteMX:=importeMXDev, ImporteME:=If(tipoCambio = 1, 0, importeMovimientoDev), CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
Exit For
End If
If UsaComplementariaClientes AndAlso TipoCambioFactura > 1 Then
importeMXDev = importeMovimientoDev
Dim ImporteComplementaria As Decimal = ((importeMovimientoDev * TipoCambioFactura) - importeMovimientoDev).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimientoDev, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=CveVentaDevolucion, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementaria, ImporteME:=If(TipoCambioFactura = 1, 0, importeMovimientoDev), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=TipoCambioFactura) Then
ErrorPrepoliza = True
Exit For
End If
End If
Dim CveConceptoPagoNC As Integer = 251
If ObjFactura.CveMoneda > 1 Then
CveConceptoPagoNC = 301
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimientoDev, Referencia, CveConceptoPagoNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVentaDevolucion, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMXDev, ImporteME:=If(tipoCambio = 1, 0, importeMovimientoDev), CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
Exit For
End If
If tipoCambio <> TipoCambioFactura Then
Dim difFluctuacion As Decimal = tipoCambio - TipoCambioFactura
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
Dim TipoMovtoFluctua As Boolean = True
Dim IdCtaContableFluctua As Integer
If difFluctuacion < 0 Then
CveConceptoFluctua = 65
TipoMovtoFluctua = False
Else
CveConceptoFluctua = 64
TipoMovtoFluctua = True
End If
Dim ImporteFluctuacion As Decimal = Math.Abs((importeMovimientoDev * difFluctuacion).RoundSQL)
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveVentaDevolucion, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=TipoCambioFactura) Then
ErrorPrepoliza = True
Exit For
End If
End If
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 2) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
End If
End If
End If
End If
End If
@@ -16576,9 +16417,9 @@ Partial Class Ventas
Pago.CveIE = CveIEAnticipo
Pago.CveMonedaPago = gvr.DataKey("CveMoneda").ToEntero()
Pago.TipoPago = "A"
Pago.Fecha = TxtFechaAnticipoCliente.text.todate 'TCPago = gvr.DataKey("TipoCambio").todecimal
Pago.Fecha = TxtFechaAnticipoCliente.Text.ToDate 'TCPago = gvr.DataKey("TipoCambio").todecimal
Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero()
Pago.TCPago = gvr.DataKey("TipoCambio").Todecimal
Pago.TCPago = gvr.DataKey("TipoCambio").ToDecimal
Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1"
Pago.Referencia = gvr.DataKey("Folio")
@@ -16628,7 +16469,7 @@ Partial Class Ventas
Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero()
Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1"
Pago.Referencia = gvr.DataKey("Folio")
Pago.CveConceptoPago = 251
'Pago.CveConceptoPago = 251
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
SimplificaPrePoliza = False
@@ -19478,6 +19319,7 @@ Partial Class Ventas
DrPoliza("TotalImporte") = (DrPoliza("Cantidad").ToString().ToDecimal * PU).RoundSQL(NumeroDecimales)
DrPoliza("SATClaveProdServ") = DrPSAdicional("SATClavePS")
DrPoliza("SATClaveUM") = DrPSAdicional("SATClaveUnidadMedida")
DrPoliza("CveActivoFijo") = -1
TmpDT.Rows.Add(DrPoliza)
End If
@@ -21163,12 +21005,8 @@ Partial Class Ventas
End If
If AutoConta Then
If idCuentaContabilizacion > 0 Then
If Not ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContPaq) Then
Alert("Ocurrio un Error al contabilizar la prepoliza de almacen, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError)
End If
Else
Alert(String.Format("Falta asignación de las siguientes cuentas contables: {0}", CuentasContablesInvalidas), TipoMensaje.MsgAdvertencia)
If Not ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContPaq) Then
Alert("Ocurrio un Error al contabilizar la prepoliza de almacen, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError)
End If
End If
End If
@@ -22128,6 +21966,7 @@ Partial Class Ventas
drt("CveOSDetalle") = dr("CveOSDetalle")
drt("CveSubProyecto") = dr("CveSubProyecto")
drt("SubProyecto") = dr("SubProyecto")
drt("CveActivoFijo") = -1
TmpDT.Rows.Add(drt)
Cons = Cons + 1
Next
@@ -30257,6 +30096,7 @@ Partial Class Ventas
Row("CveVentaDetalleRNC") = CveVentaDetalleRNC
Row("CodigoObjetoImpuesto") = CodigoObjetoImpuesto
Row("CveActivoFijo") = -1
TmpDT.Rows.Add(Row)
End Sub
@@ -34584,6 +34424,18 @@ Partial Class Ventas
Else
TFuenteRecaudacion.Visible = False
End If
If UsuarioActual.CveRol = 1 Then
If ChkEmitirComercioExterior.Checked Then
TxtTipoCambio.Text = GlobalTipoCambio(TxtFecha.Text.ToDate.AddDays(-1)).ToString()
Else
TxtTipoCambio.Text = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString()
End If
UpPS.Update()
End If
End Sub
'Protected Sub LnkDescargarFacturaPrueba_Click(sender As Object, e As EventArgs)
' 'Dim Hilo As New System.Threading.Thread(Sub() DescargarFactura(Me.CveVenta, UsuarioActual.CveEmpresa))
@@ -35168,6 +35020,7 @@ Partial Class Ventas
Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle
Row("CveVentaDetalleRemision") = CveVentaDetalleRemision
Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
Row("CveActivoFijo") = -1
TmpDT.Rows.Add(Row)
End Sub
@@ -36869,21 +36722,21 @@ Partial Class Ventas
DdlTipoActivo_SelectedIndexChanged(DdlTipoActivoFiltro, EventArgs.Empty)
End Sub
Protected Sub CargarTipoActivoFijo()
DdlTipoActivoFiltro.DataSource = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo")
DdlTipoActivoFiltro.DataBind()
DdlTipoActivoFiltro.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
Protected Sub DdlTipoActivo_SelectedIndexChanged(sender As Object, e As EventArgs)
DdlSubTipoActivoFiltro.Items.Clear()
DdlSubTipoActivoFiltro.DataSource = GlobalDTSubTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveTipoActivoFijo = {0}", DdlTipoActivoFiltro.SelectedValue), "SubTipoActivoFijo")
DdlSubTipoActivoFiltro.DataBind()
DdlSubTipoActivoFiltro.Items.Insert(0, New ListItem("Todos", "-1"))
Protected Sub CargarTipoActivoFijo()
DdlTipoActivoFiltro.DataSource = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo")
DdlTipoActivoFiltro.DataBind()
DdlTipoActivoFiltro.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
Protected Sub DdlTipoActivo_SelectedIndexChanged(sender As Object, e As EventArgs)
DdlSubTipoActivoFiltro.Items.Clear()
DdlSubTipoActivoFiltro.DataSource = GlobalDTSubTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveTipoActivoFijo = {0}", DdlTipoActivoFiltro.SelectedValue), "SubTipoActivoFijo")
DdlSubTipoActivoFiltro.DataBind()
DdlSubTipoActivoFiltro.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
#End Region
Protected Sub BtnFiltrarAF_Click(sender As Object, e As EventArgs)
Protected Sub BtnFiltrarAF_Click(sender As Object, e As EventArgs)
Using ObjAF As New ClsAF
If ObjAF.GetRepActivosFijosDepreciacion(UsuarioActual.CveEmpresa, Now, Depreciados:=1, CveTipoAF:=DdlTipoActivoFiltro.SelectedValue.ToEntero(), CveSubTipoAF:=DdlSubTipoActivoFiltro.SelectedValue.ToEntero(), CveSubProyecto:=DdlSubProyectoFiltroAF.SelectedValue.ToEntero()) Then
GvVentaAF.DataSource = ObjAF.DtResultados.FiltraParametros("CveActivoFijo > 0 AND CveEstadoActivoFijo <> 5")