From 0a5bc9f89b49565d66d67a818d9e930cea4af548 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 1 Oct 2022 18:28:36 -0700 Subject: [PATCH] Validaciones en ventas --- Ventas/Ventas.aspx | 6 +- Ventas/Ventas.aspx.vb | 292 +++++++++++++++++++++++------------------- 2 files changed, 162 insertions(+), 136 deletions(-) diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 4f54a399f..e2f342c52 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -714,13 +714,11 @@ - Linea Adicional: + Linea Adicional: - + - - diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 237250041..96797b397 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3173,6 +3173,7 @@ Partial Class Ventas 'TabE.Visible = False LnkOCs.Visible = False GvPS.Columns(8).Visible = False + DdlSubProyecto.Visible = False TrEdit.Visible = True ThProyecto.Visible = False @@ -3194,6 +3195,7 @@ Partial Class Ventas TabE.Visible = False LnkOCs.Visible = False GvPS.Columns(8).Visible = False + DdlSubProyecto.Visible = False TrEdit.Visible = False ThProyecto.Visible = False @@ -8850,8 +8852,8 @@ Partial Class Ventas Dim RowClasificacion = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row("CveClasificacion").ToString().ToEntero()).FiltroPrimero("") If RowClasificacion IsNot Nothing Then - Dim CveCategoria As Integer = Row("CveCategoria").ToString().ToEntero() - Dim Categoria As String = Row("Categoria").ToString() + Dim CveCategoria As Integer = RowClasificacion("CveCategoria").ToString().ToEntero() + Dim Categoria As String = RowClasificacion("Categoria").ToString() If Me.CveCategoriaLineaAdicional <> CveCategoria Then Alert($"La categoría '{Categoria}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia) @@ -8864,6 +8866,12 @@ Partial Class Ventas Next End If + 'SI NO ES A CREDITO NO SELECCIONAR LINEA ADICIONAL + If RBLPago.SelectedValue <> "1" Then + Alert($"La linea adicional debe ser utilizada en una venta a crédito.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + If Me.SaldoLineaAdicional <= 0 Then Alert("El saldo de la linea adicional debe ser mayor a cero", TipoMensaje.MsgAdvertencia) Exit Sub @@ -12916,7 +12924,7 @@ Partial Class Ventas ErrorList.Add("Ocurrió un error al actualizar el estatus del pedidoA") Else 'Remision - If Not ObjEventos.AddEventoBitacora($"Remisionado de autorización en: {ObjFactura.Folio}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CvePedidoA) Then + If Not ObjEventos.AddEventoBitacora($"Remisionado de autorización en: {ObjFactura.SerieFolio}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CvePedidoA) Then ErrorList.Add("Ocurrió un error al agregar bitácora de Autorización") End If End If @@ -14692,13 +14700,22 @@ Partial Class Ventas ErrorPrepoliza = True End If - 'Factura - If Not ObjEventos.AddEventoBitacora($"Venta facturada de Remisión: {ObjFactura.Folio}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then + If CveRemision > 0 Then + If ObjVentas.GetVenta(CveRemision, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then + Dim SerieFolioRem As String = ObjVentas.DtResultados.Rows(0)("SerieFolio").ToString() + 'Factura + If Not ObjEventos.AddEventoBitacora($"Venta facturada de Remisión: {SerieFolioRem}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then + ErrorPrepoliza = True + End If + Else + ErrorPrepoliza = True + End If + Else ErrorPrepoliza = True End If 'Remision - If Not ObjEventos.AddEventoBitacora($"Remisión facturada en Venta: {ObjFactura.Folio}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then + If Not ObjEventos.AddEventoBitacora($"Remisión facturada en Venta: {ObjFactura.SerieFolio}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then ErrorPrepoliza = True End If Next @@ -18077,10 +18094,10 @@ Partial Class Ventas Using ObjVentas As New ClsVentas If CveVenta > 0 Then - If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=-1) Then + If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=-1, FechaVencimientoConsulta:=MinFecha) Then If ObjVentas.DtResultados.Rows.Count > 0 Then TrLineaAdicional.Visible = True - DdlLineaAdicional.DataSource = ObjVentas.DtResultados.FiltraParametros($"(Saldo > 0 AND FechaVencimiento <= {Now.ToString("dd/MM/yyyy")}) OR CveLineaAdicional = {Me.CveLineaAdicionalVenta}") + DdlLineaAdicional.DataSource = ObjVentas.DtResultados.FiltraParametros($"(Saldo > 0 AND FechaVencimiento <= '{Now.ToString("dd/MM/yyyy")}') OR CveLineaAdicional = {Me.CveLineaAdicionalVenta}") End If End If Else @@ -18106,6 +18123,7 @@ Partial Class Ventas End If UpParametros.Update() + UPCondicionesPago.Update() End Sub @@ -26979,93 +26997,94 @@ Partial Class Ventas End Sub Private Sub CargaRNC(Optional CveVentaUsado As Integer = -1, Optional CargarBonificaciones As Boolean = False, Optional CargarSoloGarantias As Boolean = False) Dim DtNC As DataTable = Nothing - - Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1) Then - DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio") - End If - ObjMovtos.Dispose() - - Me.TmpDTRNCBonificacionesSeleccionadas = Nothing - - If DtNC IsNot Nothing Then - Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2") - Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal)) - Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal)) - Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer)) - - If CargarBonificaciones Then - 'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy() - CargaBonificaciones(-1, True) + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + Dim ObjMovtos As New ClsMovimientos() + If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1) Then + DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio") End If + ObjMovtos.Dispose() - If CargarSoloGarantias Then - GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True") - Else - GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False") - End If - GvRemisionesNC.DataBind() + Me.TmpDTRNCBonificacionesSeleccionadas = Nothing - 'GvRemisionesNCBon.DataSource = Me.TmpDTRNCBonificacionesSeleccionadas - 'GvRemisionesNCBon.DataBind() - Dim SaldoMaximoUtilizable As Decimal = 0 + If DtNC IsNot Nothing Then + Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2") + Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal)) + Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal)) + Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer)) - If CargarSoloGarantias Then - Dim SaldoMaximo As Decimal = DtNC.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True") - If SaldoMaximo > 0 Then - SaldoMaximoUtilizable = SaldoMaximo - Else - SaldoMaximoUtilizable = 0 + If CargarBonificaciones Then + 'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy() + CargaBonificaciones(-1, True) End If - Else - Dim ObjAcum As New ClsAcumuladores - If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then - Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2) - DivSMU.Visible = True - Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() + If CargarSoloGarantias Then + GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True") + Else + GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False") + End If + GvRemisionesNC.DataBind() + + 'GvRemisionesNCBon.DataSource = Me.TmpDTRNCBonificacionesSeleccionadas + 'GvRemisionesNCBon.DataBind() + Dim SaldoMaximoUtilizable As Decimal = 0 + + If CargarSoloGarantias Then + Dim SaldoMaximo As Decimal = DtNC.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True") If SaldoMaximo > 0 Then - SaldoMaximoUtilizable = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() + SaldoMaximoUtilizable = SaldoMaximo Else SaldoMaximoUtilizable = 0 End If - Else - SaldoMaximoUtilizable = 0 - End If - ObjAcum.Dispose() - End If + Dim ObjAcum As New ClsAcumuladores + If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then + Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2) + DivSMU.Visible = True - If CveVentaUsado > 0 Then - DivSMU.Visible = True - 'Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa, CargaDatosCliente:=False, CargaDatosRelacionados:=False) - Dim DtDetalleUsado As DataTable = Nothing - Using ObjVentas As New ClsVentas - If ObjVentas.GetVentaDetalle(CveVentaUsado) Then - DtDetalleUsado = ObjVentas.DtResultados.Copy() + Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() + If SaldoMaximo > 0 Then + SaldoMaximoUtilizable = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() + Else + SaldoMaximoUtilizable = 0 + End If + + Else + SaldoMaximoUtilizable = 0 End If - End Using + ObjAcum.Dispose() + End If - If DtDetalleUsado IsNot Nothing Then - Dim SaldoMaximoUsadosFactura As Decimal = DtDetalleUsado.SUM("Total", "EsCargo = True").ToDecimal() + DtDetalleUsado.SUM("ImporteIVA", "EsCargo = True").ToDecimal() - If SaldoMaximoUtilizable < SaldoMaximoUsadosFactura Then + If CveVentaUsado > 0 Then + DivSMU.Visible = True + 'Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa, CargaDatosCliente:=False, CargaDatosRelacionados:=False) + Dim DtDetalleUsado As DataTable = Nothing + Using ObjVentas As New ClsVentas + If ObjVentas.GetVentaDetalle(CveVentaUsado) Then + DtDetalleUsado = ObjVentas.DtResultados.Copy() + End If + End Using + + If DtDetalleUsado IsNot Nothing Then + Dim SaldoMaximoUsadosFactura As Decimal = DtDetalleUsado.SUM("Total", "EsCargo = True").ToDecimal() + DtDetalleUsado.SUM("ImporteIVA", "EsCargo = True").ToDecimal() + If SaldoMaximoUtilizable < SaldoMaximoUsadosFactura Then + HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString() + LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUtilizable) + Else + HdnSaldoMaximoUsados.Value = SaldoMaximoUsadosFactura.ToString() + LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUsadosFactura) + End If + Else HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString() LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUtilizable) - Else - HdnSaldoMaximoUsados.Value = SaldoMaximoUsadosFactura.ToString() - LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUsadosFactura) End If Else HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString() - LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUtilizable) + LtlSMU.Text = SaldoMaximoUtilizable.FormatoNumero(2) End If Else - HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString() - LtlSMU.Text = SaldoMaximoUtilizable.FormatoNumero(2) + HdnSaldoMaximoUsados.Value = "0" + LtlSMU.Text = "0" End If - Else - HdnSaldoMaximoUsados.Value = "0" - LtlSMU.Text = "0" End If UpModalRemisionesNC.Update() @@ -27074,81 +27093,83 @@ Partial Class Ventas Private Sub CargaRNCDesc(Optional CargarBonificaciones As Boolean = False, Optional CargarSoloGarantias As Boolean = False) Dim DtNC As DataTable = Nothing - Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1) Then - DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio") - End If - ObjMovtos.Dispose() - - Me.TmpDTRNCBonificacionesSeleccionadas = Nothing - - If DtNC IsNot Nothing Then - Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2") - Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal)) - Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal)) - Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer)) - - If CargarBonificaciones Then - 'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy() - CargaBonificacionesDesc("-1", True) + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + Dim ObjMovtos As New ClsMovimientos() + If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1) Then + DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio") End If + ObjMovtos.Dispose() - If CargarSoloGarantias Then - GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True") - Else - GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False") - End If - GvDescNCCargos.DataBind() + Me.TmpDTRNCBonificacionesSeleccionadas = Nothing - Dim SaldoMaximoCliente As Decimal = 0 - Dim SaldoEntregado As Decimal = 0 + If DtNC IsNot Nothing Then + Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2") + Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal)) + Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal)) + Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer)) - If CargarSoloGarantias Then - Dim SaldoMaximo As Decimal = DtNC.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True") - If SaldoMaximo > 0 Then - SaldoMaximoCliente = SaldoMaximo - Else - SaldoMaximoCliente = 0 + If CargarBonificaciones Then + 'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy() + CargaBonificacionesDesc("-1", True) End If - Else - Dim ObjAcum As New ClsAcumuladores - If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then - Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2) - DivSMU.Visible = True - Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() + If CargarSoloGarantias Then + GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True") + Else + GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False") + End If + GvDescNCCargos.DataBind() + + Dim SaldoMaximoCliente As Decimal = 0 + Dim SaldoEntregado As Decimal = 0 + + If CargarSoloGarantias Then + Dim SaldoMaximo As Decimal = DtNC.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True") If SaldoMaximo > 0 Then - SaldoMaximoCliente = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() + SaldoMaximoCliente = SaldoMaximo Else SaldoMaximoCliente = 0 End If - Dim RowEntregado As DataRow = ObjAcum.DtResultados.Rows(1) - SaldoEntregado = RowEntregado("ValorConImpuestos").ToString().ToDecimal() Else - SaldoMaximoCliente = 0 + Dim ObjAcum As New ClsAcumuladores + If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then + Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2) + DivSMU.Visible = True + + Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() + If SaldoMaximo > 0 Then + SaldoMaximoCliente = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() + Else + SaldoMaximoCliente = 0 + End If + Dim RowEntregado As DataRow = ObjAcum.DtResultados.Rows(1) + SaldoEntregado = RowEntregado("ValorConImpuestos").ToString().ToDecimal() + Else + SaldoMaximoCliente = 0 + End If + ObjAcum.Dispose() End If - ObjAcum.Dispose() - End If - Dim SaldoMaximoUsadosFactura As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal() + Dim SaldoMaximoUsadosFactura As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal() - If SaldoMaximoCliente > 0 AndAlso SaldoMaximoCliente < SaldoMaximoUsadosFactura Then - SaldoMaximoUsadosFactura = SaldoMaximoCliente - End If + If SaldoMaximoCliente > 0 AndAlso SaldoMaximoCliente < SaldoMaximoUsadosFactura Then + SaldoMaximoUsadosFactura = SaldoMaximoCliente + End If - Dim SaldoMaximoUtilizable = If(SaldoMaximoUsadosFactura < SaldoEntregado, SaldoMaximoUsadosFactura, SaldoEntregado) + Dim SaldoMaximoUtilizable = If(SaldoMaximoUsadosFactura < SaldoEntregado, SaldoMaximoUsadosFactura, SaldoEntregado) + + If SaldoMaximoUtilizable > 0 Then + HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString() + LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUtilizable) + Else + HdnSaldoMaximoUsados.Value = "0" + LblSaldoMaximoUsados.Text = String.Format("{0:N2}", 0) + End If - If SaldoMaximoUtilizable > 0 Then - HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString() - LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUtilizable) Else HdnSaldoMaximoUsados.Value = "0" - LblSaldoMaximoUsados.Text = String.Format("{0:N2}", 0) + LblSaldoMaximoUsados.Text = "0" End If - - Else - HdnSaldoMaximoUsados.Value = "0" - LblSaldoMaximoUsados.Text = "0" End If UpDescNC.Update() @@ -35299,7 +35320,7 @@ Partial Class Ventas RBLPago.Enabled = False Using ObjVentas As New ClsVentas - If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then + If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, FechaVencimientoConsulta:=MinFecha) Then If ObjVentas.DtResultados.Rows.Count > 0 Then TxtFechaPago.Text = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy") Me.SaldoLineaAdicional = ObjVentas.DtResultados.Rows(0)("Saldo").ToString().ToDecimal() @@ -35314,6 +35335,7 @@ Partial Class Ventas End If UpParametros.Update() + UPCondicionesPago.Update() End Sub Protected Sub LnkUpdateLineaAdicional_Click(sender As Object, e As EventArgs) 'VALIDAR LINEAS ADICIONALES @@ -35324,8 +35346,8 @@ Partial Class Ventas Dim RowClasificacion = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row("CveClasificacion").ToString().ToEntero()).FiltroPrimero("") If RowClasificacion IsNot Nothing Then - Dim CveCategoria As Integer = Row("CveCategoria").ToString().ToEntero() - Dim Categoria As String = Row("Categoria").ToString() + Dim CveCategoria As Integer = RowClasificacion("CveCategoria").ToString().ToEntero() + Dim Categoria As String = RowClasificacion("Categoria").ToString() If Me.CveCategoriaLineaAdicional <> CveCategoria Then Alert($"La categoría '{Categoria}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia) @@ -35338,6 +35360,12 @@ Partial Class Ventas Next End If + 'SI NO ES A CREDITO NO SELECCIONAR LINEA ADICIONAL + If RBLPago.SelectedValue <> "1" Then + Alert($"La linea adicional debe ser utilizada en una venta a crédito.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + If Me.SaldoLineaAdicional <= 0 Then Alert("El saldo de la linea adicional debe ser mayor a cero", TipoMensaje.MsgAdvertencia) Exit Sub