Validaciones en ventas
This commit is contained in:
@@ -714,13 +714,11 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="TrLineaAdicional" runat="server" visible="false">
|
<tr id="TrLineaAdicional" runat="server" visible="false">
|
||||||
<td align="left">Linea Adicional:</td>
|
<td align="left"><b>Linea Adicional:</b></td>
|
||||||
<td align="left">
|
<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:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
|
||||||
</asp:DropDownList>
|
</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" />
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -3173,6 +3173,7 @@ Partial Class Ventas
|
|||||||
'TabE.Visible = False
|
'TabE.Visible = False
|
||||||
LnkOCs.Visible = False
|
LnkOCs.Visible = False
|
||||||
GvPS.Columns(8).Visible = False
|
GvPS.Columns(8).Visible = False
|
||||||
|
DdlSubProyecto.Visible = False
|
||||||
TrEdit.Visible = True
|
TrEdit.Visible = True
|
||||||
|
|
||||||
ThProyecto.Visible = False
|
ThProyecto.Visible = False
|
||||||
@@ -3194,6 +3195,7 @@ Partial Class Ventas
|
|||||||
TabE.Visible = False
|
TabE.Visible = False
|
||||||
LnkOCs.Visible = False
|
LnkOCs.Visible = False
|
||||||
GvPS.Columns(8).Visible = False
|
GvPS.Columns(8).Visible = False
|
||||||
|
DdlSubProyecto.Visible = False
|
||||||
TrEdit.Visible = False
|
TrEdit.Visible = False
|
||||||
|
|
||||||
ThProyecto.Visible = False
|
ThProyecto.Visible = False
|
||||||
@@ -8850,8 +8852,8 @@ Partial Class Ventas
|
|||||||
Dim RowClasificacion = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row("CveClasificacion").ToString().ToEntero()).FiltroPrimero("")
|
Dim RowClasificacion = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row("CveClasificacion").ToString().ToEntero()).FiltroPrimero("")
|
||||||
|
|
||||||
If RowClasificacion IsNot Nothing Then
|
If RowClasificacion IsNot Nothing Then
|
||||||
Dim CveCategoria As Integer = Row("CveCategoria").ToString().ToEntero()
|
Dim CveCategoria As Integer = RowClasificacion("CveCategoria").ToString().ToEntero()
|
||||||
Dim Categoria As String = Row("Categoria").ToString()
|
Dim Categoria As String = RowClasificacion("Categoria").ToString()
|
||||||
|
|
||||||
If Me.CveCategoriaLineaAdicional <> CveCategoria Then
|
If Me.CveCategoriaLineaAdicional <> CveCategoria Then
|
||||||
Alert($"La categoría '{Categoria}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
|
Alert($"La categoría '{Categoria}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
|
||||||
@@ -8864,6 +8866,12 @@ Partial Class Ventas
|
|||||||
Next
|
Next
|
||||||
End If
|
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
|
If Me.SaldoLineaAdicional <= 0 Then
|
||||||
Alert("El saldo de la linea adicional debe ser mayor a cero", TipoMensaje.MsgAdvertencia)
|
Alert("El saldo de la linea adicional debe ser mayor a cero", TipoMensaje.MsgAdvertencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
@@ -12916,7 +12924,7 @@ Partial Class Ventas
|
|||||||
ErrorList.Add("Ocurrió un error al actualizar el estatus del pedidoA")
|
ErrorList.Add("Ocurrió un error al actualizar el estatus del pedidoA")
|
||||||
Else
|
Else
|
||||||
'Remision
|
'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")
|
ErrorList.Add("Ocurrió un error al agregar bitácora de Autorización")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -14692,13 +14700,22 @@ Partial Class Ventas
|
|||||||
ErrorPrepoliza = True
|
ErrorPrepoliza = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Factura
|
If CveRemision > 0 Then
|
||||||
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 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
|
ErrorPrepoliza = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Remision
|
'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
|
ErrorPrepoliza = True
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
@@ -18077,10 +18094,10 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Using ObjVentas As New ClsVentas
|
Using ObjVentas As New ClsVentas
|
||||||
If CveVenta > 0 Then
|
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
|
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||||
TrLineaAdicional.Visible = True
|
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
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
@@ -18106,6 +18123,7 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
UpParametros.Update()
|
UpParametros.Update()
|
||||||
|
UPCondicionesPago.Update()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
@@ -26979,93 +26997,94 @@ Partial Class Ventas
|
|||||||
End Sub
|
End Sub
|
||||||
Private Sub CargaRNC(Optional CveVentaUsado As Integer = -1, Optional CargarBonificaciones As Boolean = False, Optional CargarSoloGarantias As Boolean = False)
|
Private Sub CargaRNC(Optional CveVentaUsado As Integer = -1, Optional CargarBonificaciones As Boolean = False, Optional CargarSoloGarantias As Boolean = False)
|
||||||
Dim DtNC As DataTable = Nothing
|
Dim DtNC As DataTable = Nothing
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
Dim ObjMovtos As New ClsMovimientos()
|
Dim ObjMovtos As New ClsMovimientos()
|
||||||
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1) Then
|
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1) Then
|
||||||
DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
|
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)
|
|
||||||
End If
|
End If
|
||||||
|
ObjMovtos.Dispose()
|
||||||
|
|
||||||
If CargarSoloGarantias Then
|
Me.TmpDTRNCBonificacionesSeleccionadas = Nothing
|
||||||
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
|
If DtNC IsNot Nothing Then
|
||||||
'GvRemisionesNCBon.DataBind()
|
Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2")
|
||||||
Dim SaldoMaximoUtilizable As Decimal = 0
|
Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal))
|
||||||
|
Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal))
|
||||||
|
Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
|
||||||
|
|
||||||
If CargarSoloGarantias Then
|
If CargarBonificaciones Then
|
||||||
Dim SaldoMaximo As Decimal = DtNC.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True")
|
'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy()
|
||||||
If SaldoMaximo > 0 Then
|
CargaBonificaciones(-1, True)
|
||||||
SaldoMaximoUtilizable = SaldoMaximo
|
|
||||||
Else
|
|
||||||
SaldoMaximoUtilizable = 0
|
|
||||||
End If
|
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
|
If SaldoMaximo > 0 Then
|
||||||
SaldoMaximoUtilizable = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
|
SaldoMaximoUtilizable = SaldoMaximo
|
||||||
Else
|
Else
|
||||||
SaldoMaximoUtilizable = 0
|
SaldoMaximoUtilizable = 0
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
SaldoMaximoUtilizable = 0
|
Dim ObjAcum As New ClsAcumuladores
|
||||||
End If
|
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
|
||||||
ObjAcum.Dispose()
|
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2)
|
||||||
End If
|
DivSMU.Visible = True
|
||||||
|
|
||||||
If CveVentaUsado > 0 Then
|
Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
|
||||||
DivSMU.Visible = True
|
If SaldoMaximo > 0 Then
|
||||||
'Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa, CargaDatosCliente:=False, CargaDatosRelacionados:=False)
|
SaldoMaximoUtilizable = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
|
||||||
Dim DtDetalleUsado As DataTable = Nothing
|
Else
|
||||||
Using ObjVentas As New ClsVentas
|
SaldoMaximoUtilizable = 0
|
||||||
If ObjVentas.GetVentaDetalle(CveVentaUsado) Then
|
End If
|
||||||
DtDetalleUsado = ObjVentas.DtResultados.Copy()
|
|
||||||
|
Else
|
||||||
|
SaldoMaximoUtilizable = 0
|
||||||
End If
|
End If
|
||||||
End Using
|
ObjAcum.Dispose()
|
||||||
|
End If
|
||||||
|
|
||||||
If DtDetalleUsado IsNot Nothing Then
|
If CveVentaUsado > 0 Then
|
||||||
Dim SaldoMaximoUsadosFactura As Decimal = DtDetalleUsado.SUM("Total", "EsCargo = True").ToDecimal() + DtDetalleUsado.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
|
DivSMU.Visible = True
|
||||||
If SaldoMaximoUtilizable < SaldoMaximoUsadosFactura Then
|
'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()
|
HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString()
|
||||||
LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUtilizable)
|
LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUtilizable)
|
||||||
Else
|
|
||||||
HdnSaldoMaximoUsados.Value = SaldoMaximoUsadosFactura.ToString()
|
|
||||||
LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUsadosFactura)
|
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString()
|
HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString()
|
||||||
LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUtilizable)
|
LtlSMU.Text = SaldoMaximoUtilizable.FormatoNumero(2)
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString()
|
HdnSaldoMaximoUsados.Value = "0"
|
||||||
LtlSMU.Text = SaldoMaximoUtilizable.FormatoNumero(2)
|
LtlSMU.Text = "0"
|
||||||
End If
|
End If
|
||||||
Else
|
|
||||||
HdnSaldoMaximoUsados.Value = "0"
|
|
||||||
LtlSMU.Text = "0"
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
UpModalRemisionesNC.Update()
|
UpModalRemisionesNC.Update()
|
||||||
@@ -27074,81 +27093,83 @@ Partial Class Ventas
|
|||||||
Private Sub CargaRNCDesc(Optional CargarBonificaciones As Boolean = False, Optional CargarSoloGarantias As Boolean = False)
|
Private Sub CargaRNCDesc(Optional CargarBonificaciones As Boolean = False, Optional CargarSoloGarantias As Boolean = False)
|
||||||
Dim DtNC As DataTable = Nothing
|
Dim DtNC As DataTable = Nothing
|
||||||
|
|
||||||
Dim ObjMovtos As New ClsMovimientos()
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1) Then
|
Dim ObjMovtos As New ClsMovimientos()
|
||||||
DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
|
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1) Then
|
||||||
End If
|
DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
|
||||||
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)
|
|
||||||
End If
|
End If
|
||||||
|
ObjMovtos.Dispose()
|
||||||
|
|
||||||
If CargarSoloGarantias Then
|
Me.TmpDTRNCBonificacionesSeleccionadas = Nothing
|
||||||
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
|
If DtNC IsNot Nothing Then
|
||||||
Dim SaldoEntregado As Decimal = 0
|
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
|
If CargarBonificaciones Then
|
||||||
Dim SaldoMaximo As Decimal = DtNC.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True")
|
'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy()
|
||||||
If SaldoMaximo > 0 Then
|
CargaBonificacionesDesc("-1", True)
|
||||||
SaldoMaximoCliente = SaldoMaximo
|
|
||||||
Else
|
|
||||||
SaldoMaximoCliente = 0
|
|
||||||
End If
|
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
|
If SaldoMaximo > 0 Then
|
||||||
SaldoMaximoCliente = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
|
SaldoMaximoCliente = SaldoMaximo
|
||||||
Else
|
Else
|
||||||
SaldoMaximoCliente = 0
|
SaldoMaximoCliente = 0
|
||||||
End If
|
End If
|
||||||
Dim RowEntregado As DataRow = ObjAcum.DtResultados.Rows(1)
|
|
||||||
SaldoEntregado = RowEntregado("ValorConImpuestos").ToString().ToDecimal()
|
|
||||||
Else
|
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
|
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
|
If SaldoMaximoCliente > 0 AndAlso SaldoMaximoCliente < SaldoMaximoUsadosFactura Then
|
||||||
SaldoMaximoUsadosFactura = SaldoMaximoCliente
|
SaldoMaximoUsadosFactura = SaldoMaximoCliente
|
||||||
End If
|
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
|
Else
|
||||||
HdnSaldoMaximoUsados.Value = "0"
|
HdnSaldoMaximoUsados.Value = "0"
|
||||||
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", 0)
|
LblSaldoMaximoUsados.Text = "0"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
|
||||||
HdnSaldoMaximoUsados.Value = "0"
|
|
||||||
LblSaldoMaximoUsados.Text = "0"
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
UpDescNC.Update()
|
UpDescNC.Update()
|
||||||
@@ -35299,7 +35320,7 @@ Partial Class Ventas
|
|||||||
RBLPago.Enabled = False
|
RBLPago.Enabled = False
|
||||||
|
|
||||||
Using ObjVentas As New ClsVentas
|
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
|
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||||
TxtFechaPago.Text = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy")
|
TxtFechaPago.Text = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy")
|
||||||
Me.SaldoLineaAdicional = ObjVentas.DtResultados.Rows(0)("Saldo").ToString().ToDecimal()
|
Me.SaldoLineaAdicional = ObjVentas.DtResultados.Rows(0)("Saldo").ToString().ToDecimal()
|
||||||
@@ -35314,6 +35335,7 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
UpParametros.Update()
|
UpParametros.Update()
|
||||||
|
UPCondicionesPago.Update()
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub LnkUpdateLineaAdicional_Click(sender As Object, e As EventArgs)
|
Protected Sub LnkUpdateLineaAdicional_Click(sender As Object, e As EventArgs)
|
||||||
'VALIDAR LINEAS ADICIONALES
|
'VALIDAR LINEAS ADICIONALES
|
||||||
@@ -35324,8 +35346,8 @@ Partial Class Ventas
|
|||||||
Dim RowClasificacion = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row("CveClasificacion").ToString().ToEntero()).FiltroPrimero("")
|
Dim RowClasificacion = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row("CveClasificacion").ToString().ToEntero()).FiltroPrimero("")
|
||||||
|
|
||||||
If RowClasificacion IsNot Nothing Then
|
If RowClasificacion IsNot Nothing Then
|
||||||
Dim CveCategoria As Integer = Row("CveCategoria").ToString().ToEntero()
|
Dim CveCategoria As Integer = RowClasificacion("CveCategoria").ToString().ToEntero()
|
||||||
Dim Categoria As String = Row("Categoria").ToString()
|
Dim Categoria As String = RowClasificacion("Categoria").ToString()
|
||||||
|
|
||||||
If Me.CveCategoriaLineaAdicional <> CveCategoria Then
|
If Me.CveCategoriaLineaAdicional <> CveCategoria Then
|
||||||
Alert($"La categoría '{Categoria}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
|
Alert($"La categoría '{Categoria}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
|
||||||
@@ -35338,6 +35360,12 @@ Partial Class Ventas
|
|||||||
Next
|
Next
|
||||||
End If
|
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
|
If Me.SaldoLineaAdicional <= 0 Then
|
||||||
Alert("El saldo de la linea adicional debe ser mayor a cero", TipoMensaje.MsgAdvertencia)
|
Alert("El saldo de la linea adicional debe ser mayor a cero", TipoMensaje.MsgAdvertencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
|
|||||||
Reference in New Issue
Block a user