SIG. Carga de inventario dinamica en ventas. solo cuando se utilice
This commit is contained in:
@@ -161,7 +161,7 @@ Public Class ClsVentas
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function GetVenta(CveVenta As Integer, CveEmpresa As Integer, Optional VerificaAlmacen As Boolean = True) As Boolean
|
||||
Public Function GetVenta(CveVenta As Integer, CveEmpresa As Integer, Optional VerificaAlmacen As Boolean = False) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_VentasGet")
|
||||
|
||||
|
||||
@@ -242,8 +242,8 @@
|
||||
OnClick="LnkAplicarRNCDevolucion_Click" />
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LBAplicaDevolucion" runat="server" CausesValidation="False" Text="<i class='fa fa-pencil'></i> Aplicar Devolución"
|
||||
data-toggle="modal" data-target="#DivAplicaDevolucion" Visible="false" />
|
||||
<asp:LinkButton ID="LBAplicaDevolucion" runat="server" CausesValidation="False" Text="<i class='fa fa-pencil'></i> Aplicar Devolución" OnClick="LBAplicaDevolucion_Click"
|
||||
Visible="false" />
|
||||
</li>
|
||||
<%--TERMINA: CANCELAR - NC - DEVOLUCION [NEW]--%>
|
||||
|
||||
@@ -1675,7 +1675,12 @@
|
||||
</ContentTemplate>
|
||||
</ajax:TabPanel>
|
||||
|
||||
<ajax:TabPanel ID="TabAlmacen" runat="server" HeaderText="Almacén">
|
||||
<ajax:TabPanel ID="TabAlmacen" runat="server">
|
||||
<HeaderTemplate>
|
||||
<span onclick="CargaMovimientosInventario();" id="spanAlmacen" runat="server">
|
||||
Almacen
|
||||
</span>
|
||||
</HeaderTemplate>
|
||||
<ContentTemplate>
|
||||
|
||||
<%--<asp:UpdatePanel ID="UpInvDev" UpdateMode="Conditional" runat="server">
|
||||
@@ -1719,6 +1724,7 @@
|
||||
|
||||
<asp:UpdatePanel ID="UpINV" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:Button ID="BtnCargarInventario" runat="server" ClientIDMode="Static" Text="" Style="display: none;" OnClick="BtnCargarInventario_Click" />
|
||||
<div class="portlet box purpleAlmacen" id="DivSalidaAlmacen" runat="server">
|
||||
<div class="portlet-title">
|
||||
<div class="caption">
|
||||
@@ -9402,6 +9408,7 @@
|
||||
$('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total));
|
||||
}
|
||||
|
||||
|
||||
function CalculaTotalPagoContado() {
|
||||
|
||||
var totalEfectivo = ToDouble($get("TxtImporteEfectivo").value);
|
||||
@@ -9822,6 +9829,10 @@
|
||||
$('#BtnAplicaNuevaNC').click();
|
||||
}
|
||||
|
||||
function CargaMovimientosInventario() {
|
||||
$('#BtnCargarInventario').click();
|
||||
}
|
||||
|
||||
$('.DdlPS').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); });
|
||||
$('.DdlPSPyME').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); });
|
||||
|
||||
|
||||
@@ -600,7 +600,7 @@ Partial Class Ventas
|
||||
Return IfNull(ViewState("MailCC"), "").ToString()
|
||||
End Get
|
||||
End Property
|
||||
Private ReadOnly Property CveVenta As Integer
|
||||
Public ReadOnly Property CveVenta As Integer
|
||||
Get
|
||||
Return ViewState("CveVenta").ToString().ToEntero()
|
||||
End Get
|
||||
@@ -2078,22 +2078,6 @@ Partial Class Ventas
|
||||
ViewState("DiasVencidosCliente") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property VentaSaldoAlmacen As Decimal
|
||||
Get
|
||||
Return ViewState("VentaSaldoAlmacen").ToString().ToDecimal
|
||||
End Get
|
||||
Set(value As Decimal)
|
||||
ViewState("VentaSaldoAlmacen") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property VentaSaldoAlmacenNC As Decimal
|
||||
Get
|
||||
Return IfNull(ViewState("VentaSaldoAlmacenNC"), 0, ViewState("VentaSaldoAlmacenNC").ToString().ToDecimal()).ToString().ToDecimal()
|
||||
End Get
|
||||
Set(value As Decimal)
|
||||
ViewState("VentaSaldoAlmacenNC") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property SeCancelaRemisionProceso As Boolean
|
||||
Get
|
||||
Return CBool(ViewState("SeCancelaRemisionProceso").ToString())
|
||||
@@ -2816,14 +2800,6 @@ Partial Class Ventas
|
||||
'End If
|
||||
|
||||
'CargaDetalle de Almacen
|
||||
If Not LblAlertRefacInv.Visible Then
|
||||
If CveVentaPadre > 0 Then
|
||||
InventarioMov(CveVentaPadre)
|
||||
Else
|
||||
InventarioMov()
|
||||
End If
|
||||
End If
|
||||
|
||||
'PERMISO PARA CANCELAR PEDIDO
|
||||
If GvInv.Rows.Count = 0 Then
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ped") And Not CveEstatus = 14 Then
|
||||
@@ -2867,6 +2843,15 @@ Partial Class Ventas
|
||||
ViewState("CveOS") = Request("CveOS")
|
||||
CargaOS(CveOS)
|
||||
Else
|
||||
|
||||
'SI ES VENTA NUEVA, NO RECARGAR TAB DE ALMACEN
|
||||
If CveVenta <= 0 Then
|
||||
'REMOVER EVENTO PARA RECARGAR ALMACEN
|
||||
spanAlmacen.Attributes.Remove("onclick")
|
||||
Tab.ActiveTabIndex = 1
|
||||
Updatetabs.Update()
|
||||
End If
|
||||
|
||||
'Modalidad Devoluciones y Refacturacion
|
||||
If Request("CveDevolucion") IsNot Nothing AndAlso IsNumeric(Request("CveDevolucion")) AndAlso Request("CveDevolucion").ToEntero() > 0 Then
|
||||
ViewState("CveDevolucion") = Request("CveDevolucion")
|
||||
@@ -3113,7 +3098,7 @@ Partial Class Ventas
|
||||
'End If
|
||||
|
||||
'CargaDetalle de Almacen
|
||||
InventarioMov()
|
||||
'InventarioMov()
|
||||
|
||||
If ViewState("CveCotizacion").ToString().ToEntero() > 0 Then
|
||||
|
||||
@@ -4594,7 +4579,7 @@ Partial Class Ventas
|
||||
'CARGA DTs DE VENTAS
|
||||
If CveVenta > 0 Then
|
||||
Using ObjVentas As New ClsVentas()
|
||||
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
|
||||
If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
DbRowVenta = ObjVentas.DtResultados.Copy().Rows(0)
|
||||
Else
|
||||
@@ -4772,15 +4757,6 @@ Partial Class Ventas
|
||||
ViewState("SaldoVenta") = DbRowVenta("Saldo").ToString()
|
||||
AplicaCancelarRemision = CBool(DbRowVenta("AplicaCancelarRemision").ToString())
|
||||
If AplicaCancelarRemision AndAlso CveEstatus.Contiene(2, 3) AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then DivCanRem.Visible = True
|
||||
VentaSaldoAlmacen = DbRowVenta("SaldoAlmacen").ToString().ToDecimal
|
||||
|
||||
If DbRowVenta("TipoDocto").ToString().Contiene("Rem", "Dev") AndAlso VentaSaldoAlmacen <> 0 Then
|
||||
ChkDevAlm.Checked = True
|
||||
LiDevolucionAlmacen.Visible = True
|
||||
If DbRowVenta("TipoDocto").ToString() = "Dev" Then
|
||||
LblDevAlm.Text = "Salida de almacen"
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If CveEstatus = 5 Then LbCancelarDocumento.Enabled = False
|
||||
@@ -5673,21 +5649,7 @@ Partial Class Ventas
|
||||
|
||||
ObjUsados.Dispose()
|
||||
|
||||
Dim SaldoAlmacenExA As Decimal = 0
|
||||
'Dim SaldoAlmacenUsados As Decimal = 0
|
||||
|
||||
Using ObjInventarios As New ClsInventarios
|
||||
'VERIFICA SI HACE FALTA DEVOLVER PRODUCTOS Y USADOS EN ESPECIFICO
|
||||
If ObjInventarios.GetSaldoVentaDetalleAlmacen(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
SaldoAlmacenExA = ObjInventarios.DtResultados.SUMD("SaldoAlmacen", $"CveTipoAlmacen = 10")
|
||||
'SaldoAlmacenUsados = ObjInventarios.DtResultados.SUMD("SaldoAlmacen", $"CveTipoAlmacen = 22")
|
||||
End If
|
||||
End Using
|
||||
|
||||
'Si ya se surtió y recibió
|
||||
If SaldoAlmacenExA > 0 OrElse TmpDT.MAX("CveTipoPS") = "1" Then
|
||||
BtnsFacturar.Visible = True
|
||||
End If
|
||||
BtnsFacturar.Visible = True
|
||||
|
||||
'VERIFICA SI YA SE FACTURO COMPLETAMENTE
|
||||
If TmpDT.SUM("CantidadFacturadaRem") = TmpDT.SUM("Cantidad") Then
|
||||
@@ -7767,7 +7729,6 @@ Partial Class Ventas
|
||||
If DTFacNC IsNot Nothing AndAlso DTFacNC.Rows.Count > 0 Then
|
||||
Me.CveEstatusRefacturacion = DTFacNC.Rows(0)("CveEstatusRefacturacion").ToString().ToEntero()
|
||||
Me.DevolucionAlmacenNC = DTFacNC.Rows(0)("EsDevolucionVenta").ToString().ToEntero()
|
||||
Me.VentaSaldoAlmacenNC = DTFacNC.Rows(0)("SaldoAlmacen").ToString().ToDecimal
|
||||
HdnRFCVenta.Value = DTFacNC.Rows(0)("ClienteRFC").ToString()
|
||||
End If
|
||||
Else
|
||||
@@ -21767,6 +21728,23 @@ Partial Class Ventas
|
||||
If RefacturarCancelada Then
|
||||
Response.Redirect($"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1")
|
||||
Else
|
||||
'si es la empresa 119, Candado, no permite refacturar, si no se ha surtido y que no sea refacturación, para que cancele la factura mejor.
|
||||
If UsuarioActual.CveEmpresa = 119 AndAlso LkRefacturacion.Visible AndAlso CveVentaPadre <= 0 Then
|
||||
Dim PermiteRefacturarar As Boolean = True
|
||||
Using ObjInv As New ClsInventarios
|
||||
If ObjInv.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
If ObjInv.DtResultados.Rows.Count > 0 Then
|
||||
PermiteRefacturarar = False
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
|
||||
If Not PermiteRefacturarar Then
|
||||
Alert("La factura no se puede refacturar si no ha sido surtida previamente", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim script As String = ""
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then
|
||||
Dim sb As New StringBuilder()
|
||||
@@ -23541,22 +23519,22 @@ Partial Class Ventas
|
||||
#Region " INVENTARIO POR ENTREGA"
|
||||
Private Sub InventarioMov(Optional CveVentaPadre As Integer = -1)
|
||||
If CveVentaPadre > 0 Then
|
||||
Dim ObjVentas As New ClsVentas()
|
||||
If ObjVentas.GetVenta(CveVentaPadre, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 AndAlso ObjVentas.DtResultados.Rows(0)("TipoDocto").ToString() = "Ing" AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then
|
||||
' Dim CveEstatusRefacturacion As Integer = ObjVentas.DtResultados.Rows(0)("CveEstatusRefacturacion").ToString().ToEntero()
|
||||
Dim RowVentas As DataRow = Nothing
|
||||
Using ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetVenta(CveVentaPadre, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
|
||||
RowVentas = ObjVentas.DtResultados.Copy().Rows(0)
|
||||
End If
|
||||
End Using
|
||||
|
||||
' If CveEstatusRefacturacion = 2 Then
|
||||
CargaInventario(Me.CveVenta)
|
||||
'End If
|
||||
|
||||
Else
|
||||
If RowVentas IsNot Nothing Then
|
||||
If RowVentas("TipoDocto").ToString().Contiene("Ing") AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then
|
||||
CargaInventario(Me.CveVenta)
|
||||
End If
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
Else
|
||||
CargaInventario(Me.CveVenta)
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Dev") Then
|
||||
CargaInventario(Me.CveVenta)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CargaInventario(CveVenta As Integer)
|
||||
@@ -23572,14 +23550,6 @@ Partial Class Ventas
|
||||
End If
|
||||
ObjInv.Dispose()
|
||||
|
||||
'si es la empresa 119, Candado, no permite refacturar, si no se ha surtido y que no sea refacturación, para que cancele la factura mejor.
|
||||
If UsuarioActual.CveEmpresa = 119 AndAlso LkRefacturacion.Visible AndAlso VentaSaldoAlmacen = 0 And CveVentaPadre <= 0 Then
|
||||
LkRefacturacion.Visible = False
|
||||
End If
|
||||
If UsuarioActual.CveEmpresa = 119 AndAlso CveVenta = 620098 Then
|
||||
LkRefacturacion.Visible = True
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Private Sub CargaGVInv(DtTemporal As DataTable)
|
||||
|
||||
@@ -23645,9 +23615,9 @@ Partial Class Ventas
|
||||
|
||||
#Region " DEVOLUCION ALMACEN "
|
||||
Private Sub InicializaDevolucionAlmacen()
|
||||
If Not GvInv.Rows.Count > 0 Then
|
||||
Exit Sub
|
||||
End If
|
||||
'If Not GvInv.Rows.Count > 0 Then
|
||||
' Exit Sub
|
||||
'End If
|
||||
|
||||
If CveVenta > 0 AndAlso (SaldoVenta = TxtTotal.Text.ToDecimal OrElse DdlTipoComprobante.SelectedValue = "Dev" OrElse (DdlTipoComprobante.SelectedValue = "Ped" AndAlso TmpDT IsNot Nothing AndAlso TmpDT.COUNT("CveContratoDetalle", "CveContratoDetalle > 0") > 0)) Then 'And (DdlTipoComprobante.SelectedValue.Contiene({"Rem", "Ped"}) Or (DdlTipoComprobante.SelectedValue.Contiene({"Ing"}) And TxtFecha.Text.ToDate.Month = Now.Month And TxtFecha.Text.ToDate.Year = Now.Year)) Then
|
||||
|
||||
@@ -23667,17 +23637,17 @@ Partial Class Ventas
|
||||
LBDevolucionAlmacen.ToolTip = "¿Está seguro de Solicitar la Devolución de Almacén?"
|
||||
End If
|
||||
|
||||
If VentaSaldoAlmacen < 0 Then
|
||||
If DevolucionAlmacen = 0 Then
|
||||
LBAplicaDevolucion.Visible = True
|
||||
ElseIf DevolucionAlmacen.Contiene(1, 2) Then
|
||||
LBAplicaDevolucion.Visible = False
|
||||
End If
|
||||
ElseIf VentaSaldoAlmacen >= 0 Then
|
||||
LBAplicaDevolucion.Visible = False
|
||||
End If
|
||||
'If VentaSaldoAlmacen < 0 Then
|
||||
' If DevolucionAlmacen = 0 Then
|
||||
' LBAplicaDevolucion.Visible = True
|
||||
' ElseIf DevolucionAlmacen.Contiene(1, 2) Then
|
||||
' LBAplicaDevolucion.Visible = False
|
||||
' End If
|
||||
'ElseIf VentaSaldoAlmacen >= 0 Then
|
||||
' LBAplicaDevolucion.Visible = False
|
||||
'End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "Dev" AndAlso VentaSaldoAlmacen <> 0 Then
|
||||
If DdlTipoComprobante.SelectedValue = "Dev" Then
|
||||
LiDevolucionAlmacen.Visible = False
|
||||
End If
|
||||
|
||||
@@ -23687,14 +23657,22 @@ Partial Class Ventas
|
||||
'UpInvDev.Update()
|
||||
End Sub
|
||||
Protected Sub LBDevolucionAlmacen_Click(sender As Object, e As EventArgs)
|
||||
Dim SaldoAlmacen As Decimal = 0
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
|
||||
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=True) Then
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
|
||||
Me.DevolucionAlmacen = DbRowVenta("EsDevolucionVenta").ToString().ToEntero()
|
||||
SaldoAlmacen = DbRowVenta("SaldoAlmacen").ToString().ToDecimal()
|
||||
End If
|
||||
End If
|
||||
|
||||
If SaldoAlmacen >= 0 Then
|
||||
Alert("El movimiento ya fue devuelto.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Me.DevolucionAlmacen.Contiene(2) Then
|
||||
InicializaDevolucionAlmacen()
|
||||
UpnTools.Update()
|
||||
@@ -24677,10 +24655,10 @@ Partial Class Ventas
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub MostrarCondicionesCancelacion(Optional Extra As String = "")
|
||||
Private Sub MostrarCondicionesCancelacion(Optional Extra As String = "", Optional SaldoAlmacen As Decimal = 0)
|
||||
Dim SbCondiciones As New StringBuilder()
|
||||
|
||||
If VentaSaldoAlmacen < 0 AndAlso ChkDevAlm.Checked Then
|
||||
If SaldoAlmacen < 0 AndAlso ChkDevAlm.Checked Then
|
||||
SbCondiciones.Append("<b>*Se realizará una devolución en automatico al realizar la cancelación.</b>")
|
||||
End If
|
||||
|
||||
@@ -24705,11 +24683,9 @@ Partial Class Ventas
|
||||
|
||||
Dim sb As New StringBuilder()
|
||||
Dim sbExtra As New StringBuilder()
|
||||
sb.Append("La factura se encuentra en el siguiente estatus del SAT:<br/>")
|
||||
|
||||
sb.Append("La factura se encuentra en el siguiente estatus del SAT:<br/>")
|
||||
|
||||
Dim TotalT As Decimal = TxtTotal.Text.ToDecimal
|
||||
|
||||
Dim RFCReceptor As String = ""
|
||||
|
||||
If String.IsNullOrEmpty(Me.RFCReceptorVenta) Then
|
||||
@@ -24723,6 +24699,36 @@ Partial Class Ventas
|
||||
RFCReceptor = Me.RFCReceptorVenta
|
||||
End If
|
||||
|
||||
Dim SaldoAlmacen As Decimal = 0
|
||||
|
||||
Dim PermiteCancelar As Boolean = True
|
||||
Using ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=True) Then
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
Dim RowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
|
||||
|
||||
SaldoAlmacen = RowVenta("SaldoAlmacen").ToString().ToDecimal()
|
||||
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Rem", "Dev") AndAlso SaldoAlmacen <> 0 Then
|
||||
ChkDevAlm.Checked = True
|
||||
LiDevolucionAlmacen.Visible = True
|
||||
If DdlTipoComprobante.SelectedValue = "Dev" Then
|
||||
LblDevAlm.Text = "Salida de almacen"
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
PermiteCancelar = False
|
||||
End If
|
||||
Else
|
||||
PermiteCancelar = False
|
||||
End If
|
||||
End Using
|
||||
|
||||
If Not PermiteCancelar Then
|
||||
Alert("La venta no se puede cancelar si no ha sido surtida previamente", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
Dim SWatch As New Stopwatch
|
||||
SWatch.Start()
|
||||
@@ -24827,7 +24833,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
LblCancelarDocumento.Text = sb.ToString()
|
||||
MostrarCondicionesCancelacion(sbExtra.ToString())
|
||||
MostrarCondicionesCancelacion(sbExtra.ToString(), SaldoAlmacen)
|
||||
|
||||
RegistraScript("$('#ModalCancelarDocumento').modal();")
|
||||
UpCancelarDocumento.Update()
|
||||
@@ -30142,12 +30148,14 @@ Partial Class Ventas
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
LBAplicaDevolucion.Visible = True
|
||||
|
||||
'SOLO APLICA DEVOLUCION SI TIENE MOVIMIENTOS DE ALMACEN
|
||||
If VentaSaldoAlmacen < 0 Then
|
||||
LBAplicaDevolucion.Visible = True
|
||||
ElseIf VentaSaldoAlmacen >= 0 Then
|
||||
LBAplicaDevolucion.Visible = False
|
||||
End If
|
||||
'If VentaSaldoAlmacen < 0 Then
|
||||
' LBAplicaDevolucion.Visible = True
|
||||
'ElseIf VentaSaldoAlmacen >= 0 Then
|
||||
' LBAplicaDevolucion.Visible = False
|
||||
'End If
|
||||
|
||||
Dim SeEsconde As Boolean = False
|
||||
|
||||
@@ -30197,7 +30205,7 @@ Partial Class Ventas
|
||||
End Sub
|
||||
Protected Sub BtnAplicaDevolucion_Click(sender As Object, e As EventArgs)
|
||||
|
||||
'VALIDACIONES
|
||||
|
||||
Dim Selecciono As Boolean = False
|
||||
For Each Gv As GridViewRow In GvAplicaDevolucion.Rows
|
||||
If Gv.FCCheckBox("Chk").Checked And Gv.FCTextBox("TxtCantidadAplicaDevolucion").Text.ToDouble > 0 Then
|
||||
@@ -32813,6 +32821,11 @@ Partial Class Ventas
|
||||
DivAdjuntar.Visible = True
|
||||
End If
|
||||
|
||||
'REMOVER EVENTO PARA RECARGAR ALMACEN
|
||||
spanAlmacen.Attributes.Remove("onclick")
|
||||
Tab.ActiveTabIndex = 1
|
||||
Updatetabs.Update()
|
||||
|
||||
|
||||
UpnTools.Update()
|
||||
UpCliente.Update()
|
||||
@@ -32919,6 +32932,30 @@ Partial Class Ventas
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim TieneSoloServicios As Boolean = TmpDT.MAX("CveTipoPS") = "1"
|
||||
'SI ES REMISION Y TIENE PRODUCTOS, DEBE VERIFICAR EL ALMACEN
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Not TieneSoloServicios AndAlso DdlTipoComprobante.SelectedValue = "Rem" AndAlso TipoDoctoNuevo = "Ing" AndAlso Not TmpDT.MAX("CveTipoPS") = "1" Then
|
||||
Dim SaldoAlmacenExA As Decimal = 0
|
||||
'Dim SaldoAlmacenUsados As Decimal = 0
|
||||
|
||||
Using ObjInventarios As New ClsInventarios
|
||||
'VERIFICA SI HACE FALTA DEVOLVER PRODUCTOS Y USADOS EN ESPECIFICO
|
||||
If ObjInventarios.GetSaldoVentaDetalleAlmacen(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
SaldoAlmacenExA = ObjInventarios.DtResultados.SUMD("SaldoAlmacen", $"CveTipoAlmacen = 10")
|
||||
'SaldoAlmacenUsados = ObjInventarios.DtResultados.SUMD("SaldoAlmacen", $"CveTipoAlmacen = 22")
|
||||
End If
|
||||
End Using
|
||||
|
||||
'Si ya se surtió y recibió
|
||||
If SaldoAlmacenExA <= 0 Then
|
||||
BtnsFacturar.Visible = False
|
||||
Alert("No se puede facturar hasta que se haya surtido la remisión", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
If GvPagos.Rows.Count = 0 And UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 And RBLPago.SelectedValue.ToEntero() = 2 Then
|
||||
Alert("No se puede facturar hasta que se haya especificado detalladamente la forma de pago", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
@@ -36488,5 +36525,50 @@ Partial Class Ventas
|
||||
|
||||
UpComercioExterior.Update()
|
||||
End Sub
|
||||
Protected Sub BtnCargarInventario_Click(sender As Object, e As EventArgs)
|
||||
If Not LblAlertRefacInv.Visible Then
|
||||
If CveVentaPadre > 0 Then
|
||||
InventarioMov(CveVentaPadre)
|
||||
Else
|
||||
InventarioMov()
|
||||
End If
|
||||
End If
|
||||
|
||||
'REMOVER EVENTO PARA RECARGAR ALMACEN
|
||||
spanAlmacen.Attributes.Remove("onclick")
|
||||
Tab.ActiveTabIndex = 1
|
||||
Updatetabs.Update()
|
||||
End Sub
|
||||
Protected Sub LBAplicaDevolucion_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim SaldoAlmacen As Decimal = 0
|
||||
|
||||
Dim PermiteCancelar As Boolean = True
|
||||
Using ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=True) Then
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
Dim RowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
|
||||
SaldoAlmacen = RowVenta("SaldoAlmacen").ToString().ToDecimal()
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
|
||||
Dim PuedeAplicarDevolucion As Boolean = False
|
||||
|
||||
If SaldoAlmacen < 0 Then
|
||||
If DevolucionAlmacen = 0 Then
|
||||
PuedeAplicarDevolucion = True
|
||||
ElseIf DevolucionAlmacen.Contiene(1, 2) Then
|
||||
Alert("No se puede aplicar una devolución sobre el documento actual", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
ElseIf SaldoAlmacen >= 0 Then
|
||||
Alert("No se puede aplicar una devolución sobre el documento actual", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
If PuedeAplicarDevolucion Then
|
||||
RegistraScript("$('#DivAplicaDevolucion').modal('show');")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user