BDH. Generacion de RNC desde URL en Recepcion de Usados

This commit is contained in:
2022-01-12 21:26:13 -07:00
parent 13119a2575
commit f384107d06
5 changed files with 1226 additions and 1116 deletions

View File

@@ -928,7 +928,7 @@ Public Class ClsAcumuladores
#End Region
Public Function DistribuidorMovtosAdd(CveCliente As Integer, Cantidad As Decimal, CveTamaño As Integer, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer,
CveEmpresa As Integer, ImporteCompras As Decimal, Observaciones As String, Optional CveMovimiento As Integer = -1) As Boolean
CveEmpresa As Integer, ImporteCompras As Decimal, Observaciones As String, FechaIng As DateTime, Optional CveMovimiento As Integer = -1) As Boolean
Dim Retorno As Boolean = False
'Data = New DataTable
@@ -945,6 +945,7 @@ Public Class ClsAcumuladores
.Add("@ImporteCompras", SqlDbType.Money).Value = ImporteCompras
.Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones
.Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento
.Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng
End With
Try

View File

@@ -2078,7 +2078,7 @@ Namespace Modelos
For Each RowSalida As DataRow In DtMovimientos.Rows
Dim Cantidad As Decimal = RowSalida("Cantidad").ToString().ToDecimal() * -1
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "") Then
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", factura.Fecha) Then
Retorno = False
Exit For
End If
@@ -2100,7 +2100,7 @@ Namespace Modelos
For Each drow As DataRow In factura.DtDetalle.Rows
If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, 2, factura.CveVenta, UsuarioActual.CveUsuario,
UsuarioActual.CveEmpresa, 0D, "") Then
UsuarioActual.CveEmpresa, 0D, "", factura.Fecha) Then
Resultado = False
Exit For
End If
@@ -2159,7 +2159,7 @@ Namespace Modelos
If factura.Cliente.EsDistribuidor AndAlso factura.CveConceptoMovimiento = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Dr("Cantidad").ToString.ToDecimal(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario,
UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then
UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, factura.Fecha, CveMovimiento:=CveMovimiento) Then
' Mensaje = "Error al guardar Movimientos de distribuidor"
Resultado = False
Exit For

View File

@@ -15,6 +15,15 @@ Partial Class Inventarios_RecepcionUsados
Private _dtDatos As DataTable
Public Property DtClientes() As DataTable
Get
Return CType(ViewState("DtClientes"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtClientes") = value
End Set
End Property
Public Property DtMovimientos() As DataTable
Get
Return CType(ViewState("DtMovimientos"), DataTable)
@@ -331,6 +340,7 @@ Partial Class Inventarios_RecepcionUsados
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
CargaInicial()
GeneraRNCFromURL()
End If
End Sub
@@ -405,7 +415,76 @@ Partial Class Inventarios_RecepcionUsados
'DdlProducto2.setEsWebService(True)
'DdlProducto2.Attributes.Add("data-metodo", "getpsusados")
End Sub
Private Sub GeneraRNCFromURL()
Dim RFC As String = IfNull(Request("RFC"), "").ToString()
Dim CveAlmacen As Integer = IfNull(Request("CveAlmacen"), "-1").ToString().ToEntero()
Dim Cantidad As Decimal = IfNull(Request("Cantidad"), "0").ToString().ToDecimal()
Dim Fecha As DateTime = IfNull(Request("Fecha"), Now.ToString("dd/MM/yyyy")).ToString().ToDateTime()
If Not String.IsNullOrEmpty(RFC) Then
If DtClientes Is Nothing Then
Alert("No se encontraron clientes para filtrar", TipoMensaje.MsgError)
Exit Sub
End If
Dim RowCliente = DtClientes.FiltroPrimero(String.Format("RFC='{0}'", RFC))
If RowCliente Is Nothing Then
Alert("No se encontro el cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If CveAlmacen <= 0 Then
Alert("Es necesario especificar el almacen", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If Cantidad <= 0 Then
Alert("Es necesario especificar la cantidad", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim CveCliente As Integer = RowCliente("CveCliente").ToString().ToEntero()
DdlClientes.SelectedValueExist(CveCliente)
DdlClientes_SelectedIndexChanged(DdlClientes, EventArgs.Empty)
DdlAlmacen.SelectedValueExist(CveAlmacen)
TxtFecha.Text = Fecha.ToString("dd/MM/yyyy")
Dim CvePS As Integer = 403591 'EXTRA CHICO
Dim CveTamanio As Integer = 1
Dim CveUM As Integer = -1
Dim PU As Decimal = 0
Dim RowTamanio As DataRow = GlobalDTAcumTamaños.FiltroPrimero($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo > 0 AND CvePSCargo={CvePS}")
Dim CodigoPS As String = ""
Dim UnidaMedida As String = ""
If RowTamanio IsNot Nothing Then
PU = RowTamanio("Cargo").ToString.ToDecimal()
CodigoPS = RowTamanio("CodigoPS").ToString()
CveTamanio = RowTamanio("CveTamaño").ToString().ToEntero()
CveUM = RowTamanio("CveUM").ToString().ToEntero()
UnidaMedida = "" 'RowTamanio("UnidadMedida").ToString()
AddNew(CvePS, CodigoPS, CveUM, UnidaMedida, Cantidad, PU, "", "-1", "-1", "-1", "", "", -1, "", "", CveTamanio)
Dim CveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}").ToEntero
CreaRemisionNC(CveCliente, CveSubProyecto, 1)
If Me.ObjRemisionNC IsNot Nothing Then
Guardar(True)
Else
Alert("No se pudo generar la RNC", TipoMensaje.MsgError)
End If
Else
Alert("No se encontro el tamaño", TipoMensaje.MsgError)
End If
End If
End Sub
#Region " PERMISOS PAGINAS "
@@ -1165,7 +1244,7 @@ Partial Class Inventarios_RecepcionUsados
If EsDistribuidor AndAlso RBLOpcion.SelectedValue.ToEntero = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then
If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario,
UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then
UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, Now, CveMovimiento:=CveMovimiento) Then
Mensaje = "Error al guardar Movimientos de distribuidor"
ErrorMovInv = True
Exit For
@@ -1850,9 +1929,11 @@ Partial Class Inventarios_RecepcionUsados
#Region "DDL CLIENTE / CLIENTE SUCURSAL - SELECTED INDEX CHANGED"
Private Sub InicializaClientes(Todos As Boolean)
DtClientes = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltraParametros(If(Todos, "", "EsDistribuidor = 1"))
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltraParametros(If(Todos, "", "EsDistribuidor = 1"))
DdlClientes.DataSource = DtClientes
DdlClientes.DataBind()
DdlClientes.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlClientes.SelectedValue = "-1"
@@ -2219,11 +2300,12 @@ Partial Class Inventarios_RecepcionUsados
Me.ObjRemisionNC.TipoDocto = "RNC"
Me.ObjRemisionNC.RefDocto = ""
Me.ObjRemisionNC.CveMesa = -1
Me.ObjRemisionNC.Fecha = Now
Dim Fecha As DateTime = TxtFecha.Text.ToDateTime()
Me.ObjRemisionNC.Fecha = Fecha
Me.ObjRemisionNC.CvePrePoliza = -1
Me.ObjRemisionNC.FechaPago = Now
Me.ObjRemisionNC.FechaPago = Fecha
Me.ObjRemisionNC.MotivoDescuento = ""
Me.ObjRemisionNC.FechaEjecucion = Now
Me.ObjRemisionNC.FechaEjecucion = Fecha
Me.ObjRemisionNC.UsuarioCreo = UsuarioActual.Usuario
Me.ObjRemisionNC.CveCondicionEntrega = -1
Me.ObjRemisionNC.CondicionEntrega = ""

File diff suppressed because it is too large Load Diff

View File

@@ -8512,7 +8512,7 @@ Partial Class Ventas
End If
'SI ES AMORTIZACION 3.3
Dim Obj2 As New List(Of Object)
Dim ListaNotasCreditoGeneradas As New List(Of Modelos.Factura)
Dim NCDescuento As Boolean = ((ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) OrElse (ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0))
If ErrorList.Count = 0 Then
' cambiar la condicion para saber si hay seleccionado
@@ -8534,7 +8534,7 @@ Partial Class Ventas
CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento)
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing,
Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDesc, IndexNC:=(If(DtVentasNC IsNot Nothing, DtVentasNC.Rows.Count - 1, 0))) Then
Obj2.Add(ObjFacturaDevolucion)
ListaNotasCreditoGeneradas.Add(ObjFacturaDevolucion)
End If
End If
@@ -8547,7 +8547,7 @@ Partial Class Ventas
CreaObjetosVentaBonificacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento)
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaBonificacion, ObjBancos, Nothing,
Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCBonificacion, IndexNC:=(DtVentasNC.Rows.Count - 1)) Then
Obj2.Add(ObjFacturaBonificacion)
ListaNotasCreditoGeneradas.Add(ObjFacturaBonificacion)
End If
End If
@@ -8556,7 +8556,7 @@ Partial Class Ventas
OnError("Ocurrió un error al generar nota de crédito de amortización", ex)
ErrorList.Add("No se pudo generar la nota de crédito de amortización")
End Try
If Obj2 Is Nothing AndAlso Obj2.Count = 0 Then
If ListaNotasCreditoGeneradas Is Nothing AndAlso ListaNotasCreditoGeneradas.Count = 0 Then
ErrorList.Add("No se pudo generar la nota de crédito de amortización")
End If
End If
@@ -8583,7 +8583,7 @@ Partial Class Ventas
CveVentaNCProntoPago = RespFacturaProntoPago.Mensaje.CveVenta
SerieFolioNCProntoPago = RespFacturaProntoPago.Mensaje.SerieFolio
Obj2.Add(RespFacturaProntoPago.ObjFacturaProntoPago)
ListaNotasCreditoGeneradas.Add(RespFacturaProntoPago.ObjFacturaProntoPago)
End If
End If
Else
@@ -8774,7 +8774,7 @@ Partial Class Ventas
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso (UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1) Then
'FACTURA INGRESO/EGRESO
Dim ObjTimbrado As New Timbrado
Dim FM As New Modelos.FemsaFactura
Dim TmpDT7Eleven As New DataTable
Dim TmpDTComplementosTimbrado As New DataTable
@@ -8785,34 +8785,35 @@ Partial Class Ventas
'DOCUMENTO ACTUAL
If DebeTimbrar Then
Dim ObjTimbrado As New Timbrado
SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
Dim FolioFiscalFactura As String = ObjTimbrado.UUID
Dim MsgErrorTimbrado = ObjTimbrado.MensajeErrorCFDI
ObjTimbrado = Nothing
'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION
If Not GeneroDescuentoProntoPago AndAlso Not IsNothing(Obj2) AndAlso Obj2.Count > 0 AndAlso SeTimbro 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 DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
ofa.Timbre.CFDIRelacionados.UUID.Clear()
ofa.Timbre.CFDIRelacionados.UUID.Add(ObjTimbrado.UUID)
End If
ObjTimbrado.TimbrarFactura(UsuarioActual, ofa)
GeneraPDFFactura(ChkEnviarFactura.Checked)
End If
'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION
If GeneroDescuentoProntoPago AndAlso Not IsNothing(Obj2) AndAlso Obj2.Count > 0 AndAlso SeTimbro Then
If ListaNotasCreditoGeneradas.Count > 0 Then
Try
Dim ofa As Modelos.Factura = CType(Obj2(Obj2.Count - 1), Modelos.Factura)
'asigna el foliofiscal del ingreso que se acaba de timbrar, cuando es amortización de anticipo con NC
ofa.Timbre.CFDIRelacionados.UUID.Clear()
ofa.Timbre.CFDIRelacionados.UUID.Add(ObjTimbrado.UUID)
For Each NCGenerada In ListaNotasCreditoGeneradas
If NCGenerada.Timbre IsNot Nothing Then
NCGenerada.Timbre.CFDIRelacionados.UUID.Clear()
NCGenerada.Timbre.CFDIRelacionados.UUID.Add(FolioFiscalFactura)
ObjTimbrado.TimbrarFactura(UsuarioActual, ofa)
GeneraPDFFactura(ChkEnviarFactura.Checked)
Dim ObjTimbradoNC As New Timbrado
Dim TimbroNC = ObjTimbradoNC.TimbrarFactura(UsuarioActual, NCGenerada)
If Not TimbroNC Then
Alert(ObjTimbradoNC.MensajeErrorCFDI, TipoMensaje.MsgError)
End If
ObjTimbradoNC = Nothing
End If
Next
Catch ex As Exception
OnError("Ocurrió un error al timbrar la nota de credito", ex)
OnError("Ocurrió un error al timbrar la NC.", ex)
End Try
End If
If SeTimbro AndAlso ObjFactura.TipoDocto.Contiene("Ing") Then
@@ -8820,29 +8821,26 @@ Partial Class Ventas
End If
If Not SeTimbro Then
Alert(ObjTimbrado.MensajeErrorCFDI, TipoMensaje.MsgError)
Alert(MsgErrorTimbrado, TipoMensaje.MsgError)
End If
'CANCELAR FACTURA ANTERIOR
If SeTimbro AndAlso (Me.CveDevolucion > 0 AndAlso Me.NuevaFactura = 1) Then
If Me.ObjFacturaNC IsNot Nothing Then
Me.ObjFacturaNC.CveEstatusRefacturacion = 2 'MARCAR COMO REFACTURADA
Me.ObjFacturaNC.CancelarPorRefacturacion(Me.ObjFacturaNC.CveMotivoCancelacion, Me.ObjFacturaNC.MotivoCancelacion, ObjTimbrado.UUID)
Me.ObjFacturaNC.CancelarPorRefacturacion(Me.ObjFacturaNC.CveMotivoCancelacion, Me.ObjFacturaNC.MotivoCancelacion, FolioFiscalFactura)
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
ElseIf UsuarioActual.Empresa.TipoFacturacion = "CBB" Then
GeneraPDFCBB(ObjFactura.FechaCP, Nothing, ObjFactura.SerieFolio, False)
''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
@@ -9069,7 +9067,7 @@ Partial Class Ventas
End If
ObjFactura = Nothing
Obj2 = Nothing
ListaNotasCreditoGeneradas = Nothing
End If
End If
@@ -9147,6 +9145,11 @@ Partial Class Ventas
ObjFacturaDevolucion.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero()
ObjFacturaDevolucion.TipoRelacion = "07"
If NCDescuento Then
ObjFacturaDevolucion.CveTipoRelacion = 1
ObjFacturaDevolucion.TipoRelacion = "01"
End If
Dim Fol As New List(Of String)
Fol.Add(FolioFiscalRelacionado)
ObjFacturaDevolucion.UUIDRelacionados = Fol
@@ -9421,8 +9424,8 @@ Partial Class Ventas
ObjFacturaBonificacion.UsoCFDI = DdlUsoCFDI.SelectedItem.Text
ObjFacturaBonificacion.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}")
ObjFacturaBonificacion.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero()
ObjFacturaBonificacion.TipoRelacion = "07"
ObjFacturaBonificacion.CveTipoRelacion = 1
ObjFacturaBonificacion.TipoRelacion = "01"
Dim Fol As New List(Of String)
Fol.Add(FolioFiscalRelacionado)
@@ -11735,7 +11738,7 @@ Partial Class Ventas
Dim CveTamanio As Integer = GlobalDTAcumTamaños().FiltroPrimeroValor("CveTamaño", $"CvePSCargo={CvePSCargo}").ToEntero()
If CveTamanio > 0 Then
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Row("Cantidad").ToString().ToDecimal(), CveTamanio, 6, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "") Then
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Row("Cantidad").ToString().ToDecimal(), CveTamanio, 6, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", Now) Then
ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.")
Exit For
End If
@@ -22937,7 +22940,7 @@ Partial Class Ventas
'Else
'End If
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs", "RNC") Then
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then
Dim sb As New StringBuilder()
Dim sbExtra As New StringBuilder()
@@ -27423,10 +27426,14 @@ Partial Class Ventas
'Dim RNCCargo = ListaNC.Where(Function(f) f.CveVenta = RNCBonificacion.CveVentaRNCCargo).FirstOrDefault()
For Each RowCargo As DataRow In TmpDT.FiltraParametros("EsCargo = True", Orderby:="PU").Rows
Dim CantidadCargo = RowCargo("Cantidad").ToString().ToDecimal()
Dim ImportePU As Decimal = GlobalDTAcumTamaños().FiltroPrimeroValor("Bonificacion", $"CvePSCargo={RowCargo("CvePS")}").ToDecimal()
Dim TotalCalculableImpuestosCargo As Decimal = (CantidadCargo * ImportePU)
Dim TotalCargo As Decimal = TotalCalculableImpuestosCargo + (TotalCalculableImpuestosCargo * RowCargo("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
Dim PorcentajeAplicado = (RNCBonificacion.TotalRemNCAplicado / RNCBonificacion.Total)
Dim PorcentajeAplicado = (RNCBonificacion.TotalRemNCAplicado / TotalCargo)
Dim Cantidad As Decimal = RowCargo("Cantidad").ToString().ToDecimal() '* PorcentajeAplicado
Dim Cantidad As Decimal = RowCargo("Cantidad").ToString().ToDecimal() * PorcentajeAplicado
Dim Obs = RowCargo("CodigoPS").ToString()
@@ -27436,7 +27443,7 @@ Partial Class Ventas
'Dim ImportePU = RowCargo("PUBonificacion").ToString().ToDecimal
Dim ImportePU As Decimal = GlobalDTAcumTamaños().FiltroPrimeroValor("Bonificacion", $"CvePSCargo={RowCargo("CvePS")}").ToDecimal()
Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU)
@@ -31051,7 +31058,7 @@ Partial Class Ventas
For Each drow As DataRow In factura.DtDetalle.Rows
If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario,
UsuarioActual.CveEmpresa, 0D, "") Then
UsuarioActual.CveEmpresa, 0D, "", Now) Then
Resultado = False
Exit For
End If
@@ -31427,15 +31434,18 @@ Partial Class Ventas
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim Rows = TmpDTRNCDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}")
For Each row In Rows
row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal()
If GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal() > 0 Then
row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal()
Dim TotalCalculableImpuestos As Decimal = row("Cantidad").ToString().ToDecimal() * row("PU").ToString().ToDecimal()
Dim IVA As Decimal = (TotalCalculableImpuestos * row("PorcentajeIVA").ToString().ToDecimal()).RoundSQL()
Dim TotalCalculableImpuestos As Decimal = row("Cantidad").ToString().ToDecimal() * row("PU").ToString().ToDecimal()
Dim IVA As Decimal = (TotalCalculableImpuestos * row("PorcentajeIVA").ToString().ToDecimal()).RoundSQL()
row("IVA") = IVA
row("Total") = (TotalCalculableImpuestos + IVA).RoundSQL
row("IVA") = IVA
row("Total") = (TotalCalculableImpuestos + IVA).RoundSQL
TmpDTRNCDetalleSelecciondas.Rows.Add(row.ItemArray)
End If
TmpDTRNCDetalleSelecciondas.Rows.Add(row.ItemArray)
Next
End If
End If
@@ -31461,18 +31471,25 @@ Partial Class Ventas
If GvRow.FCCheckBox("ChkAplicar").Checked AndAlso GvRow.DataKey("CveVenta").ToEntero() = Dr("CveVenta").ToString().ToEntero() Then
Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal()
Dim PU = GvRow.DataKey("PU").ToDecimal()
Dim PorcentajeIVA As Decimal = GvRow.DataKey("PorcentajeIVA").ToDecimal()
If Cantidad > 0 Then
Dim PU = GvRow.DataKey("PU").ToDecimal()
Dim PorcentajeIVA As Decimal = GvRow.DataKey("PorcentajeIVA").ToDecimal()
Dim TotalCalculableImpuestos As Decimal = (Cantidad * PU)
Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * PorcentajeIVA).RoundSQL(2)
Dim TotalCalculableImpuestos As Decimal = (Cantidad * PU)
Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * PorcentajeIVA).RoundSQL(2)
Dim TotalRNCDetalle As Decimal = (TotalCalculableImpuestos + ImporteIVA)
Dim TotalRNCDetalle As Decimal = (TotalCalculableImpuestos + ImporteIVA)
TotalRNC += TotalRNCDetalle
TotalRNC += TotalRNCDetalle
If RemNC.CveVentaRNCCargo <= 0 Then
RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVenta").ToEntero()
If RemNC.CveVentaRNCCargo <= 0 Then
RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVenta").ToEntero()
End If
Else
Alert($"La cantidad seleccionada debe ser mayor a 0.", TipoMensaje.MsgAdvertencia)
ListaNCDesc.Clear()
ListaNCBonificacion.Clear()
Exit Sub
End If
End If
@@ -31581,15 +31598,17 @@ Partial Class Ventas
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim Rows = TmpDTRNCBonificacionDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}")
For Each row In Rows
row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal()
If GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal() > 0 Then
row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal()
Dim TotalCalculableImpuestos As Decimal = row("Cantidad").ToString().ToDecimal() * row("PU").ToString().ToDecimal()
Dim IVA As Decimal = (TotalCalculableImpuestos * row("PorcentajeIVA").ToString().ToDecimal()).RoundSQL()
Dim TotalCalculableImpuestos As Decimal = row("Cantidad").ToString().ToDecimal() * row("PU").ToString().ToDecimal()
Dim IVA As Decimal = (TotalCalculableImpuestos * row("PorcentajeIVA").ToString().ToDecimal()).RoundSQL()
row("IVA") = IVA
row("Total") = (TotalCalculableImpuestos + IVA).RoundSQL
row("IVA") = IVA
row("Total") = (TotalCalculableImpuestos + IVA).RoundSQL
TmpDTRNCBonificacionDetalleSeleccionadas.Rows.Add(row.ItemArray)
TmpDTRNCBonificacionDetalleSeleccionadas.Rows.Add(row.ItemArray)
End If
Next
End If
End If
@@ -31607,20 +31626,28 @@ Partial Class Ventas
If GvRow.FCCheckBox("ChkAplicar").Checked AndAlso GvRow.DataKey("CveVenta").ToEntero() = Dr("CveVenta").ToString().ToEntero() Then
Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal()
Dim PU = GvRow.DataKey("PU").ToDecimal()
Dim PorcentajeIVA As Decimal = GvRow.DataKey("PorcentajeIVA").ToDecimal()
If Cantidad > 0 Then
Dim PU = GvRow.DataKey("PU").ToDecimal()
Dim PorcentajeIVA As Decimal = GvRow.DataKey("PorcentajeIVA").ToDecimal()
Dim TotalCalculableImpuestos As Decimal = (Cantidad * PU)
Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * PorcentajeIVA).RoundSQL(2)
Dim TotalCalculableImpuestos As Decimal = (Cantidad * PU)
Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * PorcentajeIVA).RoundSQL(2)
Dim TotalRNCDetalle As Decimal = (TotalCalculableImpuestos + ImporteIVA)
Dim TotalRNCDetalle As Decimal = (TotalCalculableImpuestos + ImporteIVA)
TotalRNC += TotalRNCDetalle
TotalRNC += TotalRNCDetalle
If RemNC.CveVentaRNCCargo <= 0 Then
RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVenta").ToEntero()
If RemNC.CveVentaRNCCargo <= 0 Then
RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVenta").ToEntero()
End If
Else
Alert($"La cantidad seleccionada debe ser mayor a 0.", TipoMensaje.MsgAdvertencia)
ListaNCDesc.Clear()
ListaNCBonificacion.Clear()
Exit Sub
End If
End If
End If