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
|
Return Retorno
|
||||||
End Function
|
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
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_VentasGet")
|
DataAdapter("PA_VentasGet")
|
||||||
|
|
||||||
|
|||||||
@@ -242,8 +242,8 @@
|
|||||||
OnClick="LnkAplicarRNCDevolucion_Click" />
|
OnClick="LnkAplicarRNCDevolucion_Click" />
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<asp:LinkButton ID="LBAplicaDevolucion" runat="server" CausesValidation="False" Text="<i class='fa fa-pencil'></i> Aplicar Devolución"
|
<asp:LinkButton ID="LBAplicaDevolucion" runat="server" CausesValidation="False" Text="<i class='fa fa-pencil'></i> Aplicar Devolución" OnClick="LBAplicaDevolucion_Click"
|
||||||
data-toggle="modal" data-target="#DivAplicaDevolucion" Visible="false" />
|
Visible="false" />
|
||||||
</li>
|
</li>
|
||||||
<%--TERMINA: CANCELAR - NC - DEVOLUCION [NEW]--%>
|
<%--TERMINA: CANCELAR - NC - DEVOLUCION [NEW]--%>
|
||||||
|
|
||||||
@@ -1675,7 +1675,12 @@
|
|||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</ajax:TabPanel>
|
</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>
|
<ContentTemplate>
|
||||||
|
|
||||||
<%--<asp:UpdatePanel ID="UpInvDev" UpdateMode="Conditional" runat="server">
|
<%--<asp:UpdatePanel ID="UpInvDev" UpdateMode="Conditional" runat="server">
|
||||||
@@ -1719,6 +1724,7 @@
|
|||||||
|
|
||||||
<asp:UpdatePanel ID="UpINV" runat="server" UpdateMode="Conditional">
|
<asp:UpdatePanel ID="UpINV" runat="server" UpdateMode="Conditional">
|
||||||
<ContentTemplate>
|
<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 box purpleAlmacen" id="DivSalidaAlmacen" runat="server">
|
||||||
<div class="portlet-title">
|
<div class="portlet-title">
|
||||||
<div class="caption">
|
<div class="caption">
|
||||||
@@ -9402,6 +9408,7 @@
|
|||||||
$('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total));
|
$('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function CalculaTotalPagoContado() {
|
function CalculaTotalPagoContado() {
|
||||||
|
|
||||||
var totalEfectivo = ToDouble($get("TxtImporteEfectivo").value);
|
var totalEfectivo = ToDouble($get("TxtImporteEfectivo").value);
|
||||||
@@ -9822,6 +9829,10 @@
|
|||||||
$('#BtnAplicaNuevaNC').click();
|
$('#BtnAplicaNuevaNC').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CargaMovimientosInventario() {
|
||||||
|
$('#BtnCargarInventario').click();
|
||||||
|
}
|
||||||
|
|
||||||
$('.DdlPS').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); });
|
$('.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(); });
|
$('.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()
|
Return IfNull(ViewState("MailCC"), "").ToString()
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
Private ReadOnly Property CveVenta As Integer
|
Public ReadOnly Property CveVenta As Integer
|
||||||
Get
|
Get
|
||||||
Return ViewState("CveVenta").ToString().ToEntero()
|
Return ViewState("CveVenta").ToString().ToEntero()
|
||||||
End Get
|
End Get
|
||||||
@@ -2078,22 +2078,6 @@ Partial Class Ventas
|
|||||||
ViewState("DiasVencidosCliente") = value
|
ViewState("DiasVencidosCliente") = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
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
|
Private Property SeCancelaRemisionProceso As Boolean
|
||||||
Get
|
Get
|
||||||
Return CBool(ViewState("SeCancelaRemisionProceso").ToString())
|
Return CBool(ViewState("SeCancelaRemisionProceso").ToString())
|
||||||
@@ -2816,14 +2800,6 @@ Partial Class Ventas
|
|||||||
'End If
|
'End If
|
||||||
|
|
||||||
'CargaDetalle de Almacen
|
'CargaDetalle de Almacen
|
||||||
If Not LblAlertRefacInv.Visible Then
|
|
||||||
If CveVentaPadre > 0 Then
|
|
||||||
InventarioMov(CveVentaPadre)
|
|
||||||
Else
|
|
||||||
InventarioMov()
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
'PERMISO PARA CANCELAR PEDIDO
|
'PERMISO PARA CANCELAR PEDIDO
|
||||||
If GvInv.Rows.Count = 0 Then
|
If GvInv.Rows.Count = 0 Then
|
||||||
If DdlTipoComprobante.SelectedValue.Contiene("Ped") And Not CveEstatus = 14 Then
|
If DdlTipoComprobante.SelectedValue.Contiene("Ped") And Not CveEstatus = 14 Then
|
||||||
@@ -2867,6 +2843,15 @@ Partial Class Ventas
|
|||||||
ViewState("CveOS") = Request("CveOS")
|
ViewState("CveOS") = Request("CveOS")
|
||||||
CargaOS(CveOS)
|
CargaOS(CveOS)
|
||||||
Else
|
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
|
'Modalidad Devoluciones y Refacturacion
|
||||||
If Request("CveDevolucion") IsNot Nothing AndAlso IsNumeric(Request("CveDevolucion")) AndAlso Request("CveDevolucion").ToEntero() > 0 Then
|
If Request("CveDevolucion") IsNot Nothing AndAlso IsNumeric(Request("CveDevolucion")) AndAlso Request("CveDevolucion").ToEntero() > 0 Then
|
||||||
ViewState("CveDevolucion") = Request("CveDevolucion")
|
ViewState("CveDevolucion") = Request("CveDevolucion")
|
||||||
@@ -3113,7 +3098,7 @@ Partial Class Ventas
|
|||||||
'End If
|
'End If
|
||||||
|
|
||||||
'CargaDetalle de Almacen
|
'CargaDetalle de Almacen
|
||||||
InventarioMov()
|
'InventarioMov()
|
||||||
|
|
||||||
If ViewState("CveCotizacion").ToString().ToEntero() > 0 Then
|
If ViewState("CveCotizacion").ToString().ToEntero() > 0 Then
|
||||||
|
|
||||||
@@ -4594,7 +4579,7 @@ Partial Class Ventas
|
|||||||
'CARGA DTs DE VENTAS
|
'CARGA DTs DE VENTAS
|
||||||
If CveVenta > 0 Then
|
If CveVenta > 0 Then
|
||||||
Using ObjVentas As New ClsVentas()
|
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
|
If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||||
DbRowVenta = ObjVentas.DtResultados.Copy().Rows(0)
|
DbRowVenta = ObjVentas.DtResultados.Copy().Rows(0)
|
||||||
Else
|
Else
|
||||||
@@ -4772,15 +4757,6 @@ Partial Class Ventas
|
|||||||
ViewState("SaldoVenta") = DbRowVenta("Saldo").ToString()
|
ViewState("SaldoVenta") = DbRowVenta("Saldo").ToString()
|
||||||
AplicaCancelarRemision = CBool(DbRowVenta("AplicaCancelarRemision").ToString())
|
AplicaCancelarRemision = CBool(DbRowVenta("AplicaCancelarRemision").ToString())
|
||||||
If AplicaCancelarRemision AndAlso CveEstatus.Contiene(2, 3) AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then DivCanRem.Visible = True
|
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
|
If CveEstatus = 5 Then LbCancelarDocumento.Enabled = False
|
||||||
@@ -5673,21 +5649,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
ObjUsados.Dispose()
|
ObjUsados.Dispose()
|
||||||
|
|
||||||
Dim SaldoAlmacenExA As Decimal = 0
|
BtnsFacturar.Visible = True
|
||||||
'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
|
|
||||||
|
|
||||||
'VERIFICA SI YA SE FACTURO COMPLETAMENTE
|
'VERIFICA SI YA SE FACTURO COMPLETAMENTE
|
||||||
If TmpDT.SUM("CantidadFacturadaRem") = TmpDT.SUM("Cantidad") Then
|
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
|
If DTFacNC IsNot Nothing AndAlso DTFacNC.Rows.Count > 0 Then
|
||||||
Me.CveEstatusRefacturacion = DTFacNC.Rows(0)("CveEstatusRefacturacion").ToString().ToEntero()
|
Me.CveEstatusRefacturacion = DTFacNC.Rows(0)("CveEstatusRefacturacion").ToString().ToEntero()
|
||||||
Me.DevolucionAlmacenNC = DTFacNC.Rows(0)("EsDevolucionVenta").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()
|
HdnRFCVenta.Value = DTFacNC.Rows(0)("ClienteRFC").ToString()
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
@@ -21767,6 +21728,23 @@ Partial Class Ventas
|
|||||||
If RefacturarCancelada Then
|
If RefacturarCancelada Then
|
||||||
Response.Redirect($"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1")
|
Response.Redirect($"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1")
|
||||||
Else
|
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 = ""
|
Dim script As String = ""
|
||||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then
|
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then
|
||||||
Dim sb As New StringBuilder()
|
Dim sb As New StringBuilder()
|
||||||
@@ -23541,22 +23519,22 @@ Partial Class Ventas
|
|||||||
#Region " INVENTARIO POR ENTREGA"
|
#Region " INVENTARIO POR ENTREGA"
|
||||||
Private Sub InventarioMov(Optional CveVentaPadre As Integer = -1)
|
Private Sub InventarioMov(Optional CveVentaPadre As Integer = -1)
|
||||||
If CveVentaPadre > 0 Then
|
If CveVentaPadre > 0 Then
|
||||||
Dim ObjVentas As New ClsVentas()
|
Dim RowVentas As DataRow = Nothing
|
||||||
If ObjVentas.GetVenta(CveVentaPadre, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
|
Using ObjVentas As New ClsVentas
|
||||||
If ObjVentas.DtResultados.Rows.Count > 0 AndAlso ObjVentas.DtResultados.Rows(0)("TipoDocto").ToString() = "Ing" AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then
|
If ObjVentas.GetVenta(CveVentaPadre, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
|
||||||
' Dim CveEstatusRefacturacion As Integer = ObjVentas.DtResultados.Rows(0)("CveEstatusRefacturacion").ToString().ToEntero()
|
RowVentas = ObjVentas.DtResultados.Copy().Rows(0)
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
|
||||||
' If CveEstatusRefacturacion = 2 Then
|
If RowVentas IsNot Nothing Then
|
||||||
CargaInventario(Me.CveVenta)
|
If RowVentas("TipoDocto").ToString().Contiene("Ing") AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then
|
||||||
'End If
|
|
||||||
|
|
||||||
Else
|
|
||||||
CargaInventario(Me.CveVenta)
|
CargaInventario(Me.CveVenta)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
ObjVentas.Dispose()
|
|
||||||
Else
|
Else
|
||||||
CargaInventario(Me.CveVenta)
|
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Dev") Then
|
||||||
|
CargaInventario(Me.CveVenta)
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub CargaInventario(CveVenta As Integer)
|
Private Sub CargaInventario(CveVenta As Integer)
|
||||||
@@ -23572,14 +23550,6 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
ObjInv.Dispose()
|
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
|
End Sub
|
||||||
Private Sub CargaGVInv(DtTemporal As DataTable)
|
Private Sub CargaGVInv(DtTemporal As DataTable)
|
||||||
|
|
||||||
@@ -23645,9 +23615,9 @@ Partial Class Ventas
|
|||||||
|
|
||||||
#Region " DEVOLUCION ALMACEN "
|
#Region " DEVOLUCION ALMACEN "
|
||||||
Private Sub InicializaDevolucionAlmacen()
|
Private Sub InicializaDevolucionAlmacen()
|
||||||
If Not GvInv.Rows.Count > 0 Then
|
'If Not GvInv.Rows.Count > 0 Then
|
||||||
Exit Sub
|
' Exit Sub
|
||||||
End If
|
'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
|
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?"
|
LBDevolucionAlmacen.ToolTip = "¿Está seguro de Solicitar la Devolución de Almacén?"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If VentaSaldoAlmacen < 0 Then
|
'If VentaSaldoAlmacen < 0 Then
|
||||||
If DevolucionAlmacen = 0 Then
|
' If DevolucionAlmacen = 0 Then
|
||||||
LBAplicaDevolucion.Visible = True
|
' LBAplicaDevolucion.Visible = True
|
||||||
ElseIf DevolucionAlmacen.Contiene(1, 2) Then
|
' ElseIf DevolucionAlmacen.Contiene(1, 2) Then
|
||||||
LBAplicaDevolucion.Visible = False
|
' LBAplicaDevolucion.Visible = False
|
||||||
End If
|
' End If
|
||||||
ElseIf VentaSaldoAlmacen >= 0 Then
|
'ElseIf VentaSaldoAlmacen >= 0 Then
|
||||||
LBAplicaDevolucion.Visible = False
|
' LBAplicaDevolucion.Visible = False
|
||||||
End If
|
'End If
|
||||||
|
|
||||||
If DdlTipoComprobante.SelectedValue = "Dev" AndAlso VentaSaldoAlmacen <> 0 Then
|
If DdlTipoComprobante.SelectedValue = "Dev" Then
|
||||||
LiDevolucionAlmacen.Visible = False
|
LiDevolucionAlmacen.Visible = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -23687,14 +23657,22 @@ Partial Class Ventas
|
|||||||
'UpInvDev.Update()
|
'UpInvDev.Update()
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub LBDevolucionAlmacen_Click(sender As Object, e As EventArgs)
|
Protected Sub LBDevolucionAlmacen_Click(sender As Object, e As EventArgs)
|
||||||
|
Dim SaldoAlmacen As Decimal = 0
|
||||||
|
|
||||||
Dim ObjVentas As New ClsVentas
|
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
|
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||||
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
|
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
|
||||||
Me.DevolucionAlmacen = DbRowVenta("EsDevolucionVenta").ToString().ToEntero()
|
Me.DevolucionAlmacen = DbRowVenta("EsDevolucionVenta").ToString().ToEntero()
|
||||||
|
SaldoAlmacen = DbRowVenta("SaldoAlmacen").ToString().ToDecimal()
|
||||||
End If
|
End If
|
||||||
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
|
If Me.DevolucionAlmacen.Contiene(2) Then
|
||||||
InicializaDevolucionAlmacen()
|
InicializaDevolucionAlmacen()
|
||||||
UpnTools.Update()
|
UpnTools.Update()
|
||||||
@@ -24677,10 +24655,10 @@ Partial Class Ventas
|
|||||||
|
|
||||||
End Sub
|
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()
|
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>")
|
SbCondiciones.Append("<b>*Se realizará una devolución en automatico al realizar la cancelación.</b>")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -24705,11 +24683,9 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Dim sb As New StringBuilder()
|
Dim sb As New StringBuilder()
|
||||||
Dim sbExtra 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 TotalT As Decimal = TxtTotal.Text.ToDecimal
|
||||||
|
|
||||||
Dim RFCReceptor As String = ""
|
Dim RFCReceptor As String = ""
|
||||||
|
|
||||||
If String.IsNullOrEmpty(Me.RFCReceptorVenta) Then
|
If String.IsNullOrEmpty(Me.RFCReceptorVenta) Then
|
||||||
@@ -24723,6 +24699,36 @@ Partial Class Ventas
|
|||||||
RFCReceptor = Me.RFCReceptorVenta
|
RFCReceptor = Me.RFCReceptorVenta
|
||||||
End If
|
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
|
Dim SWatch As New Stopwatch
|
||||||
SWatch.Start()
|
SWatch.Start()
|
||||||
@@ -24827,7 +24833,7 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
LblCancelarDocumento.Text = sb.ToString()
|
LblCancelarDocumento.Text = sb.ToString()
|
||||||
MostrarCondicionesCancelacion(sbExtra.ToString())
|
MostrarCondicionesCancelacion(sbExtra.ToString(), SaldoAlmacen)
|
||||||
|
|
||||||
RegistraScript("$('#ModalCancelarDocumento').modal();")
|
RegistraScript("$('#ModalCancelarDocumento').modal();")
|
||||||
UpCancelarDocumento.Update()
|
UpCancelarDocumento.Update()
|
||||||
@@ -30142,12 +30148,14 @@ Partial Class Ventas
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
LBAplicaDevolucion.Visible = True
|
||||||
|
|
||||||
'SOLO APLICA DEVOLUCION SI TIENE MOVIMIENTOS DE ALMACEN
|
'SOLO APLICA DEVOLUCION SI TIENE MOVIMIENTOS DE ALMACEN
|
||||||
If VentaSaldoAlmacen < 0 Then
|
'If VentaSaldoAlmacen < 0 Then
|
||||||
LBAplicaDevolucion.Visible = True
|
' LBAplicaDevolucion.Visible = True
|
||||||
ElseIf VentaSaldoAlmacen >= 0 Then
|
'ElseIf VentaSaldoAlmacen >= 0 Then
|
||||||
LBAplicaDevolucion.Visible = False
|
' LBAplicaDevolucion.Visible = False
|
||||||
End If
|
'End If
|
||||||
|
|
||||||
Dim SeEsconde As Boolean = False
|
Dim SeEsconde As Boolean = False
|
||||||
|
|
||||||
@@ -30197,7 +30205,7 @@ Partial Class Ventas
|
|||||||
End Sub
|
End Sub
|
||||||
Protected Sub BtnAplicaDevolucion_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnAplicaDevolucion_Click(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
'VALIDACIONES
|
|
||||||
Dim Selecciono As Boolean = False
|
Dim Selecciono As Boolean = False
|
||||||
For Each Gv As GridViewRow In GvAplicaDevolucion.Rows
|
For Each Gv As GridViewRow In GvAplicaDevolucion.Rows
|
||||||
If Gv.FCCheckBox("Chk").Checked And Gv.FCTextBox("TxtCantidadAplicaDevolucion").Text.ToDouble > 0 Then
|
If Gv.FCCheckBox("Chk").Checked And Gv.FCTextBox("TxtCantidadAplicaDevolucion").Text.ToDouble > 0 Then
|
||||||
@@ -32813,6 +32821,11 @@ Partial Class Ventas
|
|||||||
DivAdjuntar.Visible = True
|
DivAdjuntar.Visible = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'REMOVER EVENTO PARA RECARGAR ALMACEN
|
||||||
|
spanAlmacen.Attributes.Remove("onclick")
|
||||||
|
Tab.ActiveTabIndex = 1
|
||||||
|
Updatetabs.Update()
|
||||||
|
|
||||||
|
|
||||||
UpnTools.Update()
|
UpnTools.Update()
|
||||||
UpCliente.Update()
|
UpCliente.Update()
|
||||||
@@ -32919,6 +32932,30 @@ Partial Class Ventas
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
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
|
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)
|
Alert("No se puede facturar hasta que se haya especificado detalladamente la forma de pago", TipoMensaje.MsgAdvertencia)
|
||||||
Else
|
Else
|
||||||
@@ -36488,5 +36525,50 @@ Partial Class Ventas
|
|||||||
|
|
||||||
UpComercioExterior.Update()
|
UpComercioExterior.Update()
|
||||||
End Sub
|
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
|
End Class
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user