Validaciones en ventas
This commit is contained in:
@@ -714,13 +714,11 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="TrLineaAdicional" runat="server" visible="false">
|
||||
<td align="left">Linea Adicional:</td>
|
||||
<td align="left"><b>Linea Adicional:</b></td>
|
||||
<td align="left">
|
||||
<asp:DropDownList ID="DdlLineaAdicional" DataTextField="InfoGeneral" DataValueField="CveLineaAdicional" AutoPostBack="true" CssClass=" form-control input-sm select2me" runat="server" Width="200px" OnSelectedIndexChanged="DdlLineaAdicional_SelectedIndexChanged">
|
||||
<asp:DropDownList ID="DdlLineaAdicional" DataTextField="InfoGeneral" DataValueField="CveLineaAdicional" AutoPostBack="true" CssClass=" form-control input-sm select2me" runat="server" Width="80%" OnSelectedIndexChanged="DdlLineaAdicional_SelectedIndexChanged">
|
||||
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</td>
|
||||
<td align="left">
|
||||
<asp:LinkButton runat="server" Visible="false" ID="LnkUpdateLineaAdicional" OnClick="LnkUpdateLineaAdicional_Click" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea actualizar la linea adicional de crédito de la factura?" data-btn-ok-label="si" Text="<i class='fa fa-check' style='color:green'></i>" CssClass="btn btn-default btn-circle btn-xs" ToolTip="Actualizar Linea adicional" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -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: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CvePedidoA) Then
|
||||
If Not ObjEventos.AddEventoBitacora($"Remisionado de autorización en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.SerieFolio}</a>", "-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: <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-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: <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>{SerieFolioRem}</a>", "-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: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then
|
||||
If Not ObjEventos.AddEventoBitacora($"Remisión facturada en Venta: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.SerieFolio}</a>", "-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
|
||||
|
||||
Reference in New Issue
Block a user