--Cambios en aplicacion de NC

This commit is contained in:
2025-03-25 22:46:20 -07:00
parent ba349c18fb
commit a677d2466e
3 changed files with 65 additions and 249 deletions

View File

@@ -849,53 +849,6 @@ Namespace Modelos
End If End If
End If End If
'SI ES REFACTURACION
'Dim ObjNC As List(Of Object) = Nothing
'If ErrorList.Count = 0 Then
' If NuevaFactura = 1 AndAlso FacturaDevolucion IsNot Nothing Then
' ObjNC = GeneraNC(ObjVentas, ObjConta, ObjInventario, ObjContr, FacturaDevolucion, ObjBancos, ObjEventos)
' If ObjNC Is Nothing Then
' ErrorList.Add("No se pudo Cancelar la Factura")
' End If
' 'Esquema viejo, evitamos que aparezca por surtir
' If ErrorList.Count = 0 Then
' If Not ObjInventario.ActualizarEsDevolucionVenta(CveVenta, 2) Then
' ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura")
' End If
' End If
' End If
'End If
'SI ES amortizacion 3.3
'Dim Obj2 As New List(Of Object)
'If ErrorList.Count = 0 Then
' ' cambiar la condicion para saber si hay seleccionado
' If TieneAnticipo AndAlso Me.CveTipoAmortizacionAnticipo = 2 Then
' If TieneAnticipo Then
' Try
' 'DESCOMENTAR
' If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, FacturaDevolucion, ObjBancos, Nothing, Nothing) Then
' Obj2.Add(FacturaDevolucion)
' End If
' Catch ex As Exception
' ErrorList.Add("No se pudo generarse la nota de crédito de amortización")
' End Try
' End If
' If Obj2 Is Nothing AndAlso Obj2.Count = 0 Then
' ErrorList.Add("No se pudo generarse la nota de crédito de amortización")
' End If
' End If
'End If
'MARCA PARA NO SURTIR VENTA DE COTNRATO DE CONSIGNACION DE VENTA | [IPP] : PARCHE 'MARCA PARA NO SURTIR VENTA DE COTNRATO DE CONSIGNACION DE VENTA | [IPP] : PARCHE
If ErrorList.Count = 0 Then If ErrorList.Count = 0 Then
If Me.CveVenta > 0 And Me.CveAlmacenExistenciasContrato > 0 And Me.TipoDocto = "Ing" Then If Me.CveVenta > 0 And Me.CveAlmacenExistenciasContrato > 0 And Me.TipoDocto = "Ing" Then
@@ -1065,17 +1018,6 @@ Namespace Modelos
SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, Me, CvePACEspecial:=CvePAC) SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, Me, CvePACEspecial:=CvePAC)
'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION
'If Not IsNothing(Obj2) AndAlso Obj2.Count > 0 Then
' Dim ofa As Modelos.Factura = CType(Obj2(0), Modelos.Factura)
' 'asigna el foliofiscal del ingreso que se acaba de timbrar, cuando es amortización de anticipo con NC
' If TieneAnticipo AndAlso CveTipoAmortizacionAnticipo = 2 Then
' ofa.Timbre.CFDIRelacionados.UUID.Clear()
' ofa.Timbre.CFDIRelacionados.UUID.Add(ObjTimbrado.UUID)
' End If
' ObjTimbrado.TimbrarFactura(UsuarioActual, ofa)
'End If
If SeTimbro AndAlso Me.TipoDocto.Contiene("Ing") Then If SeTimbro AndAlso Me.TipoDocto.Contiene("Ing") Then
EstatusSMS = EnviarSMSTimbrado(ObjEventos) EstatusSMS = EnviarSMSTimbrado(ObjEventos)
End If End If
@@ -1085,14 +1027,6 @@ Namespace Modelos
End If End If
End If End If
'NOTA DE CREDITO DE REFACTURACION
'If RefacturacionGeneroNC Then
' If Not IsNothing(ObjNC) AndAlso ObjNC.Count > 0 Then
' Dim ofa As Modelos.Factura = CType(ObjNC(0), Modelos.Factura)
' SeTimbroNC = ObjTimbrado.TimbrarFactura(UsuarioActual, ofa)
' End If
'End If
End If End If
End If End If
End If End If
@@ -1337,7 +1271,7 @@ Namespace Modelos
End Function End Function
Private Shared Function CreaDTFactura() As DataTable Public Shared Function CreaDTFactura() As DataTable
Dim TmpDT As New DataTable Dim TmpDT As New DataTable
TmpDT.Columns.Add("CveVenta", GetType(Integer)) TmpDT.Columns.Add("CveVenta", GetType(Integer))
TmpDT.Columns.Add("Consec", GetType(Integer)) TmpDT.Columns.Add("Consec", GetType(Integer))
@@ -1454,6 +1388,12 @@ Namespace Modelos
TmpDT.Columns.Add("CantidadConversion", GetType(Decimal)) TmpDT.Columns.Add("CantidadConversion", GetType(Decimal))
TmpDT.Columns("CantidadConversion").DefaultValue = 0 TmpDT.Columns("CantidadConversion").DefaultValue = 0
'COLUMNAS DE PV.aspx
TmpDT.Columns.Add("PUOriginal", GetType(Decimal))
TmpDT.Columns.Add("ConsecPSPadre", GetType(Integer))
TmpDT.Columns.Add("EliminarDB", GetType(Boolean))
TmpDT.Columns("EliminarDB").DefaultValue = False
Return TmpDT Return TmpDT
End Function End Function
@@ -3111,7 +3051,7 @@ Namespace Modelos
Pago.TCPago = DrPago("TipoCambio").ToString().ToDecimal() Pago.TCPago = DrPago("TipoCambio").ToString().ToDecimal()
Pago.AplicaTraslado = False Pago.AplicaTraslado = False
Pago.Referencia = DrPago("Folio").ToString() Pago.Referencia = DrPago("Folio").ToString()
Pago.CveVentaAmortizacion = DrPago("CveVenta").ToString().ToEntero() Pago.CveVentaAmortizacion = DrPago("CveVentaNC").ToString().ToEntero()
Pago.TipoPago = DrPago("TipoPago").ToString() Pago.TipoPago = DrPago("TipoPago").ToString()
Pago.CveClientePago = ObjFactura.CveCliente Pago.CveClientePago = ObjFactura.CveCliente
@@ -3132,11 +3072,10 @@ Namespace Modelos
Dim DT As DataTable Dim DT As DataTable
Dim CvePlantilaPoliza As Integer Dim CvePlantilaPoliza As Integer
Dim PorcentajeAmortizacion As Decimal = 0
Dim sumaAmorticaciones As Decimal = 0
Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>" Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>"
Dim idCuentaContabilizacion As Integer = 1 Dim idCuentaContabilizacion As Integer = 1
Dim CveCuentaContabilizacion As Integer = 1
Dim tipoCambio As Decimal Dim tipoCambio As Decimal
Dim CuentasContablesInvalidas As New StringBuilder Dim CuentasContablesInvalidas As New StringBuilder
Dim CuentasContablesInvalidasSIG As New StringBuilder Dim CuentasContablesInvalidasSIG As New StringBuilder
@@ -3764,13 +3703,13 @@ Namespace Modelos
End If End If
End If End If
'PorcentajeAmortizacion = sumaAmorticaciones / TxtTotal.Text.ToDecimal
importeMovimiento = 0 importeMovimiento = 0
Case 91 'Amortizacion Nota de Credito Case 91 'Amortizacion Nota de Credito
Dim Contabilizable As Boolean = If(UsuarioActual.CveEmpresa = 119, False, True) Dim Contabilizable As Boolean = If(UsuarioActual.CveEmpresa = 119, False, True)
If ValorMultiplicador = -1 Then 'CANCELACION
If Not ErrorPrepoliza AndAlso ValorMultiplicador = -1 Then
Dim TipoCambioNC As Decimal = 1 Dim TipoCambioNC As Decimal = 1
If ObjFactura.CveMoneda = 2 Then If ObjFactura.CveMoneda = 2 Then
@@ -3785,7 +3724,7 @@ Namespace Modelos
End If End If
End If End If
'cuando es cancelación 'CANCELA LA APLICACION DEL PAGO DE LA NC EN LA FACTURA APLICADA
If ObjFactura.DtNCVinculadas IsNot Nothing Then If ObjFactura.DtNCVinculadas IsNot Nothing Then
For Each row2 As DataRow In ObjFactura.DtNCVinculadas.Rows For Each row2 As DataRow In ObjFactura.DtNCVinculadas.Rows
@@ -3895,76 +3834,54 @@ Namespace Modelos
End If End If
End If End If
Else
End If
'VENTA NUEVA
If Not ErrorPrepoliza AndAlso ValorMultiplicador = 1 AndAlso ObjFactura.CveTipoAmortizacionAnticipo = 4 Then
importeMovimiento = 0
importeMX = 0
If ObjFactura.DtAnticiposAplicados IsNot Nothing Then If ObjFactura.DtAnticiposAplicados IsNot Nothing Then
Dim VentaActual As New ClsPaginas.Venta(ObjFactura, UsuarioActual)
For Each row2 As DataRow In ObjFactura.DtAnticiposAplicados.Rows For Each row2 As DataRow In ObjFactura.DtAnticiposAplicados.Rows
If row2("CveConceptoContable").ToString().ToEntero = 12 Then If row2("CveConceptoContable").ToString().ToEntero = 12 Then
importeMovimiento = row2("Importe").ToString().ToDecimal() importeMovimiento = row2("Importe").ToString().ToDecimal
sumaAmorticaciones += importeMovimiento
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
CveSubProyectoContabilizar = CveSubProyectoVenta
If importeMovimiento <> 0 Then If importeMovimiento <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, importeMovimiento * tipoCambio, Dim Pago As New ClsPaginas.VentaPago
ConceptoContable, Referencia, Concepto, Pago.Fecha = Now
CveVenta:=row2("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, Pago.FechaDocumentoRelacionado = row2("Fecha").ToString().ToDateTime()
CveVentaAmortizacion:=ObjFactura.CveVenta, Pago.ImportePagoVenta = importeMovimiento
ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Pago.ImportePago = importeMovimiento
CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then Pago.CveIE = row2("CveIE").ToString().ToEntero()
ErrorPrepoliza = True Pago.CveMonedaPago = row2("CveMoneda").ToString().ToEntero()
End If Pago.TCPago = row2("TipoCambioPago").ToString().ToDecimal()
Pago.AplicaTraslado = False
Pago.Referencia = row2("Folio").ToString()
Pago.CveVentaAmortizacion = row2("CveVenta").ToString().ToEntero()
Pago.TipoPago = "NC"
Pago.CveClientePago = ObjFactura.CveCliente
ErrorPrepoliza = ClsPaginas.AplicaPrePolizaPagoVenta(VentaActual, Pago, ObjFactura.CvePrePoliza, ObjConta, AplicarConceptoAplicacion:=True)
End If End If
End If End If
'SI ES PAGO CON DEVOLUCION
If Not ErrorPrepoliza AndAlso ObjFactura.CveTipoAmortizacionAnticipo = 4 Then
If row2("CveConceptoContable").ToString().ToEntero = 277 Then
importeMovimiento = row2("Importe").ToString().ToDecimal()
importeMX = importeMovimiento * tipoCambio
sumaAmorticaciones += importeMovimiento
If importeMovimiento <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, importeMovimiento * tipoCambio, 150, Referencia, Concepto, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=-1, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveClasificacion:=ObjFactura.DtDetalle.MAX("CveClasificacion").ToEntero(), CveSubProyecto:=ObjFactura.CveSubProyecto, Contabilizable:=Contabilizable) Then
ErrorPrepoliza = True
End If
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento * -1, importeMX * -1, 277, Referencia, Concepto, CveVenta:=row2("CveVenta").ToString().ToEntero(), CveVentaAmortizacion:=-1, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento * -1, importeMX * -1, 278, Referencia, Concepto, CveVenta:=row2("CveVenta").ToString().ToEntero(), CveVentaAmortizacion:=-1, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
Else
ErrorPrepoliza = True
End If
End If
End If
End If
If ErrorPrepoliza Then If ErrorPrepoliza Then
Exit For Exit For
End If End If
Next Next
End If End If
If Not ErrorPrepoliza AndAlso sumaAmorticaciones <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, sumaAmorticaciones, sumaAmorticaciones * tipoCambio, 251, Referencia, Concepto,
CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento),
CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then
ErrorPrepoliza = True
Else
ObjFactura.SeGuardoPrePoliza = True
End If
End If
End If End If
importeMovimiento = 0 importeMovimiento = 0
importeMX = 0
Case 4 'Venta Clasificacion Case 4 'Venta Clasificacion
@@ -4318,7 +4235,7 @@ Namespace Modelos
Pago.TCPago = DrPago("TipoCambio").ToString().ToDecimal() Pago.TCPago = DrPago("TipoCambio").ToString().ToDecimal()
Pago.AplicaTraslado = False Pago.AplicaTraslado = False
Pago.Referencia = DrPago("Folio").ToString() Pago.Referencia = DrPago("Folio").ToString()
Pago.CveVentaAmortizacion = -1 Pago.CveVentaAmortizacion = DrPago("CveVentaNC").ToString().ToEntero()
Pago.TipoPago = DrPago("TipoPago").ToString() Pago.TipoPago = DrPago("TipoPago").ToString()
Pago.CveClientePago = ObjFactura.CveCliente Pago.CveClientePago = ObjFactura.CveCliente
@@ -4370,7 +4287,7 @@ Namespace Modelos
Pago.TCPago = DrPago("TipoCambio").ToString().ToDecimal() Pago.TCPago = DrPago("TipoCambio").ToString().ToDecimal()
Pago.AplicaTraslado = False Pago.AplicaTraslado = False
Pago.Referencia = DrPago("Folio").ToString() Pago.Referencia = DrPago("Folio").ToString()
Pago.CveVentaAmortizacion = DrPago("CveVenta").ToString().ToEntero() Pago.CveVentaAmortizacion = DrPago("CveVentaNC").ToString().ToEntero()
Pago.TipoPago = DrPago("TipoPago").ToString() Pago.TipoPago = DrPago("TipoPago").ToString()
Pago.CveClientePago = ObjFactura.CveCliente Pago.CveClientePago = ObjFactura.CveCliente

View File

@@ -242,7 +242,7 @@ Partial Class Ventas_FacturacionGlobal
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
Try Try
Retorno = ObjFactura.EmitirFactura(True) Retorno = ObjFactura.EmitirFactura(True, Modulo:="FGlobal/GuardarVenta")
If Retorno IsNot Nothing AndAlso Retorno.CveVenta > 0 Then If Retorno IsNot Nothing AndAlso Retorno.CveVenta > 0 Then
SbAlert.AppendFormat("{0}", Retorno.Mensajes(Retorno.Mensajes.Count - 1)) SbAlert.AppendFormat("{0}", Retorno.Mensajes(Retorno.Mensajes.Count - 1))

View File

@@ -15313,8 +15313,7 @@ Partial Class Ventas
Try Try
Dim DT As DataTable Dim DT As DataTable
Dim CvePlantilaPoliza As Integer Dim CvePlantilaPoliza As Integer
Dim PorcentajeAmortizacion As Decimal = 0
Dim sumaAmorticaciones As Decimal = 0
Dim ErrorPrepoliza As Boolean = False Dim ErrorPrepoliza As Boolean = False
Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>" Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>"
Dim CveCuentaContabilizacion As Integer = 1 Dim CveCuentaContabilizacion As Integer = 1
@@ -15891,133 +15890,46 @@ Partial Class Ventas
End If End If
End If End If
'PorcentajeAmortizacion = sumaAmorticaciones / TxtTotal.Text.ToDecimal
importeMovimiento = 0 importeMovimiento = 0
Case 91 'Amortizacion Nota de Credito Case 91 'Amortizacion Nota de Credito
Dim Contabilizable As Boolean = If(UsuarioActual.CveEmpresa = 119, False, True) Dim Contabilizable As Boolean = If(UsuarioActual.CveEmpresa = 119, False, True)
If ValorMultiplicador = -1 Then If Not ErrorPrepoliza AndAlso ValorMultiplicador = 1 Then
'cuando es cancelación Dim VentaRef As New ClsPaginas.Venta(ObjFactura, UsuarioActual)
For Each row2 As GridViewRow In GvNC.Rows importeMovimiento = 0
If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 91 Then
importeMovimiento = row2.DataKey("Importe").ToDecimal * ValorMultiplicador
sumaAmorticaciones += importeMovimiento
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
CveSubProyectoContabilizar = CveSubProyectoVenta
If importeMovimiento <> 0 Then
Dim CveConceptoPagoNC As Integer = 251
If ObjFactura.CveMoneda > 1 Then
CveConceptoPagoNC = 301
End If
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, importeMovimiento * tipoCambio, CveConceptoPagoNC, Referencia, Concepto, CveVenta:=row2.DataKey("CveVentaNC").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimiento, importeMovimiento * tipoCambio, 91, Referencia, Concepto, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=row2.DataKey("CveVentaNC").ToString().ToEntero(), ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then
ErrorPrepoliza = True
Exit For
End If
Else
ErrorPrepoliza = True
Exit For
End If
End If
End If
Next
Else
'If DdlTipoAmortizacionAnticipo.SelectedValue <> "4" Then
'End If
For Each row2 As GridViewRow In GVAnticipos.Rows For Each row2 As GridViewRow In GVAnticipos.Rows
If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 12 Then If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 12 Then
If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then
importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal
sumaAmorticaciones += importeMovimiento
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
CveSubProyectoContabilizar = CveSubProyectoVenta
If importeMovimiento <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, importeMovimiento * tipoCambio, ConceptoContable, Referencia, Concepto, CveVenta:=row2.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=row2.DataKey("CveCliente").ToString().ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then Dim Pago As New ClsPaginas.VentaPago
ErrorPrepoliza = True Pago.Fecha = Now
End If Pago.FechaDocumentoRelacionado = row2.DataKey("Fecha").ToString().ToDateTime()
End If Pago.ImportePagoVenta = importeMovimiento
End If Pago.ImportePago = importeMovimiento
Pago.CveIE = row2.DataKey("CveIE").ToString().ToEntero()
Pago.CveMonedaPago = row2.DataKey("CveMoneda").ToString().ToEntero()
Pago.TCPago = row2.DataKey("TipoCambioPago").ToString().ToDecimal()
Pago.AplicaTraslado = False
Pago.Referencia = row2.DataKey("Folio").ToString()
Pago.CveVentaAmortizacion = row2.DataKey("CveVenta").ToString().ToEntero()
Pago.TipoPago = "NC"
Pago.CveClientePago = ObjFactura.CveCliente
Pago.Referencia = Referencia
End If ErrorPrepoliza = ClsPaginas.AplicaPrePolizaPagoVenta(VentaRef, Pago, ObjFactura.CvePrePoliza, ObjConta, AplicarConceptoAplicacion:=True)
'SI ES PAGO CON DEVOLUCION
If DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then
If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 277 Then
If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then
importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal() * Multiplicador
importeMX = importeMovimiento * tipoCambio
sumaAmorticaciones += importeMovimiento
If importeMovimiento <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, importeMovimiento * tipoCambio, 150, Referencia, Concepto, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=-1, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveClasificacion:=ObjFactura.DtDetalle.MAX("CveClasificacion").ToEntero(), CveSubProyecto:=ObjFactura.CveSubProyecto, Contabilizable:=Contabilizable) Then
ErrorPrepoliza = True
End If
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento * -1, importeMX * -1, 277, Referencia, Concepto, CveVenta:=row2.DataKey("CveVenta").ToString().ToEntero(), CveVentaAmortizacion:=-1, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento * -1, importeMX * -1, 278, Referencia, Concepto, CveVenta:=row2.DataKey("CveVenta").ToString().ToEntero(), CveVentaAmortizacion:=-1, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
Else
ErrorPrepoliza = True
End If
End If
End If
End If End If
End If End If
Next Next
If ObjFactura.AplicaDevolucion AndAlso ObjFactura.TipoDocto = "RNC" AndAlso CveVentaDevolucion > 0 Then
Dim importeMovimientoDev As Decimal = TxtTotal.Text.ToDecimal
importeMovimientoDev = If(SaldoVentaDevolucion < importeMovimientoDev, SaldoVentaDevolucion, importeMovimientoDev)
importeMovimiento = importeMovimientoDev * Multiplicador
importeMX = importeMovimiento * tipoCambio
If importeMovimiento <> 0 Then
If Not ErrorPrepoliza AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, importeMovimiento * tipoCambio, 150, Referencia, Concepto, CveVenta:=CveVentaDevolucion, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=-1, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveClasificacion:=ObjFactura.DtDetalle.MAX("CveClasificacion").ToEntero(), CveSubProyecto:=ObjFactura.CveSubProyecto, Contabilizable:=Contabilizable) Then
ErrorPrepoliza = True
End If
If Not ErrorPrepoliza AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento * -1, importeMX * -1, 277, Referencia, Concepto, CveVenta:=ObjFactura.CveVenta, CveVentaAmortizacion:=-1, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
If Not ErrorPrepoliza AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento * -1, importeMX * -1, 278, Referencia, Concepto, CveVenta:=ObjFactura.CveVenta, CveVentaAmortizacion:=-1, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
End If
If Not ErrorPrepoliza Then
Dim CveConceptoPagoNC As Integer = 251
If ObjFactura.CveMoneda > 1 Then
CveConceptoPagoNC = 301
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, importeMX, CveConceptoPagoNC, Referencia, Concepto, CveVenta:=CveVentaDevolucion, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then
ErrorPrepoliza = True
Else
ViewState("SeGuardoPrePoliza") = True
End If
End If
End If
End If
If UsuarioActual.Empresa.Funcionalidad(344) = "1" AndAlso ObjFactura.TipoDocto = "Egs" Then If UsuarioActual.Empresa.Funcionalidad(344) = "1" AndAlso ObjFactura.TipoDocto = "Egs" Then
Dim ListaNC As List(Of Modelos.Factura) = Nothing Dim ListaNC As List(Of Modelos.Factura) = Nothing
@@ -16087,19 +15999,6 @@ Partial Class Ventas
Next Next
End If End If
End If End If
If sumaAmorticaciones <> 0 Then
Dim CveConceptoPagoNC As Integer = 251
If ObjFactura.CveMoneda > 1 Then
CveConceptoPagoNC = 301
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, sumaAmorticaciones, sumaAmorticaciones * tipoCambio, CveConceptoPagoNC, Referencia, Concepto, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then
ErrorPrepoliza = True
Else
ViewState("SeGuardoPrePoliza") = True
End If
End If
End If End If
importeMovimiento = 0 importeMovimiento = 0