Aplicacion de anticipos multiples a una factura

This commit is contained in:
2021-10-14 16:03:29 -07:00
parent e2b06dddc0
commit 3b0001e569

View File

@@ -1337,6 +1337,15 @@ Partial Class Ventas
ViewState("Adjunto") = value
End Set
End Property
Private Property ListaAnticiposAplicados As List(Of MAnticipoRelacionado)
Get
Return If(IsNothing(ViewState("ListaAnticiposAplicados")), Nothing, CType(ViewState("ListaAnticiposAplicados"), List(Of MAnticipoRelacionado)))
End Get
Set(value As List(Of MAnticipoRelacionado))
ViewState("ListaAnticiposAplicados") = value
End Set
End Property
#End Region
#Region "Propiedades PuntoVenta"
@@ -4091,8 +4100,14 @@ Partial Class Ventas
CveVenta = If(CveCotizacion > 0, CveCotizacion, CveVenta)
CveVenta = If(CvePedido > 0, CvePedido, CveVenta)
Dim DtAntRelacionados As DataTable = Nothing
Dim ObjVentas As New ClsVentas()
If ObjVentas.GetVentasRelacionadas(CveVenta, UsuarioActual.CveEmpresa) Then
DtAntRelacionados = ObjVentas.DtResultados.Copy()
End If
Dim SerieFolioPadre As String
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
@@ -4527,7 +4542,17 @@ Partial Class Ventas
If DbRowVenta("CveTipoRelacion").ToString().ToEntero() > 0 Then
TrTipoRelacion.Visible = True
DdlTiposRelacion.SelectedValueExist(DbRowVenta("CveTipoRelacion").ToString().ToEntero())
HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString()
'RELACIONAR ANTICIPOS APLICADOS
If DbRowVenta("CveTipoRelacion").ToString().ToEntero() = 7 AndAlso DtAntRelacionados IsNot Nothing AndAlso DtAntRelacionados.Rows.Count > 0 Then
DdlTipoRelacionAnticipo.SelectedValueExist(7)
ListaAnticiposAplicados = New List(Of MAnticipoRelacionado)()
For Each RowAnt As DataRow In DtAntRelacionados.Rows
ListaAnticiposAplicados.Add(New MAnticipoRelacionado() With {.CveVenta = RowAnt("CveVentaRelacionada").ToString().ToEntero(), .FolioFiscal = RowAnt("FolioFiscal").ToString()})
Next
Else
HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString()
End If
End If
If DbRowVenta("Saldo").ToString().ToDouble < 0.01 Then
@@ -4617,6 +4642,9 @@ Partial Class Ventas
TrTipoRelacion2.Visible = True
LblTipoRelacion.Text = DbRowVenta("TipoRelacion").ToString()
HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString()
End If
@@ -6093,9 +6121,9 @@ Partial Class Ventas
Using ObjVentas As New ClsVentas
If ObjVentas.GetVentasRelacionadas(CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
'SI LA FACTURA NO SE TIMBRO QUE VUELVA A INTENTAR FACTURAR
If LblSeTimbro.Text = "No" Then
Me.AplicaRelacionManual = True
End If
'If LblSeTimbro.Text = "No" Then
' Me.AplicaRelacionManual = True
'End If
For Each RowRelacionada As DataRow In ObjVentas.DtResultados.Rows
Dim Row As DataRow = TmpDTFacturasRelacionadas.NewRow()
@@ -8343,6 +8371,11 @@ Partial Class Ventas
' cambiar la condicion para saber si hay seleccionado
If (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse NCDescuento Then
Try
'LIMPIA LOS ANTICIPOS RELACIONADOS QUE YA SE APLICARON
If ListaAnticiposAplicados IsNot Nothing Then
ListaAnticiposAplicados.Clear()
End If
Dim CveVentaRelacionada As Integer = -1
If NuevaFactura = 1 Then
CveVentaRelacionada = ObjFactura.CveVenta
@@ -8822,7 +8855,7 @@ Partial Class Ventas
Liga2 = $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}"";"
End If
Alert(MensajeAlert.ToString(), TipoMensaje.MsgVentasDosBotones, Liga, TextoConfirmacion:="Seguir Registrando", TextoSegundoBoton:="Ir al Cliente", JSBtn2:=Liga2)
Alert(MensajeAlert.ToString(), TipoMensaje.MsgVentasDosBotones, Liga, TextoConfirmacion:="Seguir Registrando", TextoSegundoBoton:="Ir al Cliente", JSBtn2:=Liga2, ShowCloseButton:=False)
MensajeAlert.Clear()
@@ -10167,15 +10200,24 @@ Partial Class Ventas
'Amortizacion
ObjFactura.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero()
If ObjFactura.CveTipoRelacion > 0 Then
Select Case ObjFactura.CveTipoRelacion
Case 7
ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "07"
ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo"
ObjFactura.Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value)
End Select
End If
'If ObjFactura.CveTipoRelacion > 0 Then
' Select Case ObjFactura.CveTipoRelacion
' Case 7
' ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "07"
' ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo"
' If ListaAnticiposAplicados IsNot Nothing Then
' For Each Ant As MAnticipoRelacionado In ListaAnticiposAplicados
' ObjFactura.Timbre.CFDIRelacionados.UUID.Add(Ant.FolioFiscal)
' Next
' End If
' 'ObjFactura.Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value)
' End Select
'End If
ObjFactura.AplicaDevolucion = Me.AplicaDevolucion
ObjFactura.CveTipoAmortizacionAnticipo = DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero()
@@ -10705,8 +10747,14 @@ Partial Class Ventas
Timbre.CFDIRelacionados.UUID.Add(Dr("FolioFiscal").ToString())
Next
Else
If Not String.IsNullOrEmpty(HdnFolioFiscalNC.Value.Trim()) Then
Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value)
If ListaAnticiposAplicados IsNot Nothing AndAlso ListaAnticiposAplicados.Count > 0 Then
For Each Ant As MAnticipoRelacionado In ListaAnticiposAplicados
Timbre.CFDIRelacionados.UUID.Add(Ant.FolioFiscal)
Next
Else
If Not String.IsNullOrEmpty(HdnFolioFiscalNC.Value.Trim()) AndAlso HdnFolioFiscalNC.Value <> "0" Then
Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value)
End If
End If
End If
@@ -11371,9 +11419,17 @@ Partial Class Ventas
'SI TIENE UN ANTICIPO TAMBIEN DEBE RELACIONARLO
If CveAnticipoPadre > 0 Then
If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, CveAnticipoPadre) Then
ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico")
If ListaAnticiposAplicados IsNot Nothing Then
For Each Ant As MAnticipoRelacionado In ListaAnticiposAplicados
If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, Ant.CveVenta) Then
ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico")
End If
Next
End If
'If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, CveAnticipoPadre) Then
' ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico")
'End If
End If
End If
@@ -13711,195 +13767,195 @@ Partial Class Ventas
Return ErrorPrepoliza
End Function
Private Function generaNC(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, ByRef ObjContPaq As ClsContPAQi, ByVal factura As Modelos.Factura, ByRef ObjBancos As ClsBancos, ByRef ObjEventos As ClsOIEventos) As List(Of Object)
Dim Obj As New List(Of Object)
Dim CveVentaNueva As Integer = ObjVentas.CveVenta
Dim BanderaGeneraNC As Boolean = True
'If UsuarioActual.CveEmpresa.Contiene(1, 119) Then BanderaGeneraNC = True
'Private Function generaNC(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, ByRef ObjContPaq As ClsContPAQi, ByVal factura As Modelos.Factura, ByRef ObjBancos As ClsBancos, ByRef ObjEventos As ClsOIEventos) As List(Of Object)
' Dim Obj As New List(Of Object)
' Dim CveVentaNueva As Integer = ObjVentas.CveVenta
' Dim BanderaGeneraNC As Boolean = True
' 'If UsuarioActual.CveEmpresa.Contiene(1, 119) Then BanderaGeneraNC = True
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
Dim drv As DataRow = ObjVentas.DtResultados.Rows(0)
Dim TmpDTconceptos As DataTable = Nothing
Dim CveNCaVincular As Integer = DdlNCFactura.SelectedValue.ToEntero()
'CargaCliente
Dim CveCliente As Integer = drv("CveCliente").ToString().ToEntero()
If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not CveCliente.Contiene(10450, 10460, 10458) Then
Return Nothing
ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not CveCliente.Contiene(27448) Then
Return Nothing
End If
factura.TipoDocto = drv("TipoDocto").ToString()
factura.Serie = drv("Serie").ToString()
factura.FechaEjecucion = drv("FechaEjecucion").ToString().ToDateTime
factura.Fecha = drv("Fecha").ToString().ToDateTime
factura.CveSubProyectoEjecucion = drv("CveSubProyectoEjecucion").ToString().ToEntero()
factura.CveSubProyectoCobranza = drv("CveSubProyectoCobranza").ToString().ToEntero()
factura.CveClienteSucursal = drv("CveClienteSucursal").ToString().ToEntero()
factura.CveSubProyecto = drv("CveSubProyecto").ToString().ToEntero()
' If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
' If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
' Dim drv As DataRow = ObjVentas.DtResultados.Rows(0)
' Dim TmpDTconceptos As DataTable = Nothing
' Dim CveNCaVincular As Integer = DdlNCFactura.SelectedValue.ToEntero()
' 'CargaCliente
' Dim CveCliente As Integer = drv("CveCliente").ToString().ToEntero()
' If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not CveCliente.Contiene(10450, 10460, 10458) Then
' Return Nothing
' ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not CveCliente.Contiene(27448) Then
' Return Nothing
' End If
' factura.TipoDocto = drv("TipoDocto").ToString()
' factura.Serie = drv("Serie").ToString()
' factura.FechaEjecucion = drv("FechaEjecucion").ToString().ToDateTime
' factura.Fecha = drv("Fecha").ToString().ToDateTime
' factura.CveSubProyectoEjecucion = drv("CveSubProyectoEjecucion").ToString().ToEntero()
' factura.CveSubProyectoCobranza = drv("CveSubProyectoCobranza").ToString().ToEntero()
' factura.CveClienteSucursal = drv("CveClienteSucursal").ToString().ToEntero()
' factura.CveSubProyecto = drv("CveSubProyecto").ToString().ToEntero()
'Carga Detalle Sucursal
CargaClienteSucursal(drv("CveClienteSucursal").ToString().ToEntero(), ObjVentas)
' 'Carga Detalle Sucursal
' CargaClienteSucursal(drv("CveClienteSucursal").ToString().ToEntero(), ObjVentas)
'CargaDetalle
If ObjVentas.GetVentaDetalle(CveVenta) Then
TmpDTconceptos = ObjVentas.DtResultados
TmpDTconceptos.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
GvPS.DataSource = TmpDTconceptos
GvPS.DataBind()
End If
' 'CargaDetalle
' If ObjVentas.GetVentaDetalle(CveVenta) Then
' TmpDTconceptos = ObjVentas.DtResultados
' TmpDTconceptos.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
' GvPS.DataSource = TmpDTconceptos
' GvPS.DataBind()
' End If
'Carga Totales
factura.SubTotal = drv("SubTotal").ToString().ToDecimal
factura.Descuento = drv("Descuento").ToString().ToDecimal
factura.Amortizacion = drv("Amortizacion").ToString().ToDecimal
factura.IVA = drv("IVA").ToString().ToDecimal
factura.RetIVA = drv("RetIVA").ToString().ToDecimal
factura.RetISR = drv("RetISR").ToString().ToDecimal
factura.Total = drv("Total").ToString().ToDecimal
factura.MotivoDescuento = drv("MotivoDescuento").ToString()
factura.Observaciones = drv("Observaciones").ToString()
factura.CveMoneda = drv("CveMoneda").ToString().ToEntero()
factura.TipoCambio = drv("TipoCambio").ToString().ToDecimal
factura.CveVendedor = drv("CveVendedor").ToString().ToEntero()
factura.RefDocto = drv("Ref").ToString()
'factura.SerieFolioPadre = drv("SerieFolio").ToString()
HdnFolioFiscalNC.Value = drv("FolioFiscal").ToString()
' 'Carga Totales
' factura.SubTotal = drv("SubTotal").ToString().ToDecimal
' factura.Descuento = drv("Descuento").ToString().ToDecimal
' factura.Amortizacion = drv("Amortizacion").ToString().ToDecimal
' factura.IVA = drv("IVA").ToString().ToDecimal
' factura.RetIVA = drv("RetIVA").ToString().ToDecimal
' factura.RetISR = drv("RetISR").ToString().ToDecimal
' factura.Total = drv("Total").ToString().ToDecimal
' factura.MotivoDescuento = drv("MotivoDescuento").ToString()
' factura.Observaciones = drv("Observaciones").ToString()
' factura.CveMoneda = drv("CveMoneda").ToString().ToEntero()
' factura.TipoCambio = drv("TipoCambio").ToString().ToDecimal
' factura.CveVendedor = drv("CveVendedor").ToString().ToEntero()
' factura.RefDocto = drv("Ref").ToString()
' 'factura.SerieFolioPadre = drv("SerieFolio").ToString()
' HdnFolioFiscalNC.Value = drv("FolioFiscal").ToString()
ViewState("FolioFiscal") = drv("FolioFiscal").ToString()
' ViewState("FolioFiscal") = drv("FolioFiscal").ToString()
'JJMQ 20160506: Se agrego para la validacion de pago de contado.
'CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "")
' 'JJMQ 20160506: Se agrego para la validacion de pago de contado.
' 'CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "")
UpContado.Update()
If factura.CveCliente > 0 Then
If Not IsNothing(TmpDTconceptos) AndAlso TmpDTconceptos.Rows.Count > 0 Then
' UpContado.Update()
' If factura.CveCliente > 0 Then
' If Not IsNothing(TmpDTconceptos) AndAlso TmpDTconceptos.Rows.Count > 0 Then
If Not drv("Total").ToString().ToDecimal = factura.Total Then
Return Nothing
End If
' If Not drv("Total").ToString().ToDecimal = factura.Total Then
' Return Nothing
' End If
If FolioFiscal = "" Then
CveEstatus = 4
Else
CveEstatus = 5
End If
' If FolioFiscal = "" Then
' CveEstatus = 4
' Else
' CveEstatus = 5
' End If
'[IPP] - CANCELA INVENTARIO DE VENTA NUEVA Y NO TRASPASA MOVTOS DE ALMACEN
'If UsuarioActual.CveEmpresa.Contiene(1) Then
'QUEMA DOCUMENTO NUEVO
If Not ObjInventario.ActualizarEsDevolucionVenta(CveVentaNueva, 2) Then
Return Nothing
End If
'Else
' 'TRASPASA ALMACEN A DOCUMENTO NUEVO
' If Not CancelarMovimientoInventario(ObjInventario, ObjConta, CveVentaNueva, CveDevolucion) Then
' Return Nothing
' End If
'End If
' '[IPP] - CANCELA INVENTARIO DE VENTA NUEVA Y NO TRASPASA MOVTOS DE ALMACEN
' 'If UsuarioActual.CveEmpresa.Contiene(1) Then
' 'QUEMA DOCUMENTO NUEVO
' If Not ObjInventario.ActualizarEsDevolucionVenta(CveVentaNueva, 2) Then
' Return Nothing
' End If
' 'Else
' ' 'TRASPASA ALMACEN A DOCUMENTO NUEVO
' ' If Not CancelarMovimientoInventario(ObjInventario, ObjConta, CveVentaNueva, CveDevolucion) Then
' ' Return Nothing
' ' End If
' 'End If
'CANCELA PAGOS
If ObjFacturaDevolucion.TipoDocto.Contiene("Ing", "Ant") Then
If Not ObjConta.PrePolizasCancelarPagos(CveDevolucion, ObjFactura.CvePrePoliza) Then
Return Nothing
End If
End If
' 'CANCELA PAGOS
' If ObjFacturaDevolucion.TipoDocto.Contiene("Ing", "Ant") Then
' If Not ObjConta.PrePolizasCancelarPagos(CveDevolucion, ObjFactura.CvePrePoliza) Then
' Return Nothing
' End If
' End If
'CANCELA FACTURA
' 'CANCELA FACTURA
BanderaGeneraNC = True
'2019.05.10- RMF. se activa la bandera a true, para que siempre se cancele, y no genere la NC
' BanderaGeneraNC = True
' '2019.05.10- RMF. se activa la bandera a true, para que siempre se cancele, y no genere la NC
If Month(factura.Fecha) = Month(Now) OrElse BanderaGeneraNC = True Then
If CancelarFactura(ObjVentas, ObjConta, ObjContPaq, ObjBancos) Then
Obj.Add(factura)
Else
Return Nothing
End If
Else
ObjFacturaDevolucion.TipoDocto = "Egs"
ObjFacturaDevolucion.Fecha = Now
If RegistrarNC(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, TmpDTconceptos, ObjEventos) Then
Obj.Add(ObjFacturaDevolucion)
Else
Return Nothing
End If
End If
' If Month(factura.Fecha) = Month(Now) OrElse BanderaGeneraNC = True Then
' If CancelarFactura(ObjVentas, ObjConta, ObjContPaq, ObjBancos) Then
' Obj.Add(factura)
' Else
' Return Nothing
' End If
' Else
' ObjFacturaDevolucion.TipoDocto = "Egs"
' ObjFacturaDevolucion.Fecha = Now
' If RegistrarNC(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, TmpDTconceptos, ObjEventos) Then
' Obj.Add(ObjFacturaDevolucion)
' Else
' Return Nothing
' End If
' End If
'TRASPASA PAGADO
If Not ObjConta.TraspasarSaldosPrePolizas(CveDevolucion, ObjFactura.CveVenta, ObjFactura.CvePrePoliza) Then
Return Nothing
End If
' 'TRASPASA PAGADO
' If Not ObjConta.TraspasarSaldosPrePolizas(CveDevolucion, ObjFactura.CveVenta, ObjFactura.CvePrePoliza) Then
' Return Nothing
' End If
If Not ObjInventario.TraspasaEntregaDirectaOCInv(ObjFactura.CveVenta, UsuarioActual.CveEmpresa) Then
Return Nothing
End If
' If Not ObjInventario.TraspasaEntregaDirectaOCInv(ObjFactura.CveVenta, UsuarioActual.CveEmpresa) Then
' Return Nothing
' End If
End If
End If
End If
End If
' End If
' End If
' End If
' End If
If Obj.Count > 0 Then
Return Obj
Else
Return Nothing
End If
' If Obj.Count > 0 Then
' Return Obj
' Else
' Return Nothing
' End If
End Function
Private Function RegistrarNC(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi, ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos) As Boolean
Dim ProcesoCorrecto As Boolean = True
RefacturacionGeneroNC = True
'End Function
'Private Function RegistrarNC(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi, ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos) As Boolean
' Dim ProcesoCorrecto As Boolean = True
' RefacturacionGeneroNC = True
''Generamos el nuevo folio
'Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL())
'If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then
' Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue))
' If DT.Rows.Count > 0 Then
' factura.Folio = DT.Rows(0)("FActual").ToString().ToEntero()
' Else
' ProcesoCorrecto = False
' End If
' DT.Dispose()
'End If
factura.Folio = -1
' ''Generamos el nuevo folio
' 'Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL())
' 'If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then
' ' Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue))
' ' If DT.Rows.Count > 0 Then
' ' factura.Folio = DT.Rows(0)("FActual").ToString().ToEntero()
' ' Else
' ' ProcesoCorrecto = False
' ' End If
' ' DT.Dispose()
' 'End If
' factura.Folio = -1
'Registramos la venta
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, TmpDTconceptos, -1, ObjContPaq, ObjBancos)
'CargaNCDT(factura.CveVentaPadre, factura.Total)
' 'Registramos la venta
' GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, TmpDTconceptos, -1, ObjContPaq, ObjBancos)
' 'CargaNCDT(factura.CveVentaPadre, factura.Total)
'ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
''Timbramos
'If factura.TipoDocto.Contiene("Ing", "Egs", "Ant") AndAlso FolioFiscal <> "" Then
' If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso UsuarioActual.Empresa.FacturaProduccion Then
' 'ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
' ''Timbramos
' 'If factura.TipoDocto.Contiene("Ing", "Egs", "Ant") AndAlso FolioFiscal <> "" Then
' ' If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso UsuarioActual.Empresa.FacturaProduccion Then
' Dim sw As New Diagnostics.Stopwatch
' sw.Start()
' ' Dim sw As New Diagnostics.Stopwatch
' ' sw.Start()
' 'FACTURA INGRESO/EGRESO
' Dim ObjTimbrado As New Modelos.Timbrado
' Dim FM As New Modelos.FemsaFactura
' Dim TmpDT7Eleven As New DataTable
' Dim TmpDTComplementosTimbrado As New DataTable
' ' 'FACTURA INGRESO/EGRESO
' ' Dim ObjTimbrado As New Modelos.Timbrado
' ' Dim FM As New Modelos.FemsaFactura
' ' Dim TmpDT7Eleven As New DataTable
' ' Dim TmpDTComplementosTimbrado As New DataTable
' PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado)
' ' PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado)
' ObjTimbrado.TimbrarFactura(UsuarioActual, factura, FM, TmpDT, TmpDTImpuestos, TmpDT7Eleven, TmpDTComplementosTimbrado, Ruta, LstFordASN, TxtFordGSDB.Text, ObjVentas)
' ' ObjTimbrado.TimbrarFactura(UsuarioActual, factura, FM, TmpDT, TmpDTImpuestos, TmpDT7Eleven, TmpDTComplementosTimbrado, Ruta, LstFordASN, TxtFordGSDB.Text, ObjVentas)
' sw.Stop()
' GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString(), UsuarioActual.Empresa.CvePAC)
' ' sw.Stop()
' ' GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString(), UsuarioActual.Empresa.CvePAC)
' ElseIf UsuarioActual.Empresa.TipoFacturacion = "CBB" Then
' GeneraPDFCBB(ObjFactura.Fecha, Nothing, ObjFactura.SerieFolio, False)
' End If
'End If
' ' ElseIf UsuarioActual.Empresa.TipoFacturacion = "CBB" Then
' ' GeneraPDFCBB(ObjFactura.Fecha, Nothing, ObjFactura.SerieFolio, False)
' ' End If
' 'End If
If ErrorList.Count > 0 Then
ProcesoCorrecto = False
End If
' If ErrorList.Count > 0 Then
' ProcesoCorrecto = False
' End If
Return ProcesoCorrecto
End Function
' Return ProcesoCorrecto
'End Function
#End Region
#Region " VISTA PREVIA NEW "
@@ -15003,12 +15059,19 @@ Partial Class Ventas
Dim Amortizacion As Decimal = 0
Dim ImpuestosLocalesTemporal As Decimal = 0
If ListaAnticiposAplicados IsNot Nothing Then
ListaAnticiposAplicados.Clear()
Else
ListaAnticiposAplicados = New List(Of MAnticipoRelacionado)
End If
HdnIVACalculado.Value = HdnIVAOriginal.Value
For Each gvr As GridViewRow In GVAnticipos.Rows
If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3) Then
Amortizacion += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal ' - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
HdnIVACalculado.Value = (HdnIVACalculado.Value.ToDouble - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)).FormatoNumero(2)
HdnFolioFiscalNC.Value = gvr.DataKey("FolioFiscal")
ListaAnticiposAplicados.Add(New MAnticipoRelacionado() With {.CveVenta = gvr.DataKey("CveVenta").ToEntero(), .FolioFiscal = gvr.DataKey("FolioFiscal")})
'HdnFolioFiscalNC.Value = gvr.DataKey("FolioFiscal")
'CvePSAmortizacion = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS", "CveConceptoContable = 11").ToEntero()
End If
@@ -32425,5 +32488,10 @@ Partial Class Ventas
End Select
UpModalSolicitud.Update()
End Sub
Public Class MAnticipoRelacionado
Public Property CveVenta As Integer
Public Property FolioFiscal As String
End Class
End Class