Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -4156,7 +4156,7 @@ Namespace Modelos
|
||||
End Select
|
||||
|
||||
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
DtExistencias = ObjInventario.DtResultados.FiltraParametros($"CvePS IS NOT NULL AND {Filtro}")
|
||||
DtExistencias = ObjInventario.DtResultados.FiltraParametros($"CvePS IS NOT NULL AND {Filtro} AND CveTipoPS = 2")
|
||||
TieneSalida = DtExistencias.Rows.Count > 0
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
@@ -4269,6 +4269,12 @@ Namespace Modelos
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL
|
||||
If Not GeneraMovimientosVirtuales(CveVenta, ObjInventario) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
|
||||
End If
|
||||
Else
|
||||
'UTILIZA LA DEVOLUCION YA REALIZADA
|
||||
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
@@ -4503,6 +4509,58 @@ Namespace Modelos
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Private Function GeneraMovimientosVirtuales(CveVenta As Integer, ByRef ObjInventario As ClsInventarios) As Boolean
|
||||
Dim ErrorCancelar As Boolean = False
|
||||
Try
|
||||
If UsuarioActual.CveEmpresa = 140 Then
|
||||
Dim CveMovimientoSalida As Integer = -1
|
||||
Dim CveAlmacenVirutal As Integer = -1
|
||||
|
||||
Dim DtMovtosDev As DataTable = Nothing
|
||||
|
||||
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND CveTipoAlmacen = 24 AND CveConcepto = 3 AND CveVenta > 0")
|
||||
CveMovimientoSalida = RowMovimiento("CveMovimiento").ToString().ToEntero()
|
||||
CveAlmacenVirutal = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
|
||||
If CveMovimientoSalida > 0 Then
|
||||
'CARGA CONCEPTOS DEVUELTOS EN LA VENTA
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||
DtMovtosDev = ObjInventario.DtResultados.Copy()
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
|
||||
If DtMovtosDev IsNot Nothing AndAlso DtMovtosDev.Rows.Count > 0 Then
|
||||
Dim CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenVirutal, 18, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1)
|
||||
|
||||
For Each RowUsado As DataRow In DtMovtosDev.Rows
|
||||
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
|
||||
Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble()
|
||||
Dim PU As Double = RowUsado("PU").ToString().ToDouble()
|
||||
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
||||
ErrorCancelar = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al realizar la devolución al almacen virtual.", ex)
|
||||
ErrorCancelar = True
|
||||
End Try
|
||||
|
||||
Return Not ErrorCancelar
|
||||
End Function
|
||||
Private Function GeneraMovimientosEntregaPorAdelantadoRemision(CveMovimiento As Integer, ByRef ObjVentas As ClsVentas, ByRef ObjInventario As ClsInventarios, ByRef DtDevRem As DataTable, ByRef ListaRemisionesCancelar As List(Of Integer)) As Boolean
|
||||
Dim ErrorCancelar As Boolean = False
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
@@ -1220,7 +1219,9 @@ Partial Class PopUpVerFactura
|
||||
Personal, Capturo, AlmacenDestino, CveConsignacion, CveMoneda, Moneda, FolioVenta, FolioOC,
|
||||
FolioInterno, FechaHora, ObservacionesSolicitud, DepartamentoEntrega, RazonSocialOC,
|
||||
Remision, Proveedor, CalleOrigen, NoExtOrigen, ColoniaOrigen, LocalidadOrigen, MunicipioOrigen,
|
||||
EstadoOrigen, PaisOrigen, CPOrigen, CalleDestino, NoExtDestino, ColoniaDestino, LocalidadDestino, MunicipioDestino, EstadoDestino, PaisDestino, CPDestino, FechaMovimiento, NombreCapturo, PuestoRecibio, PuestoEnrego, RazonSocial, ResponsableCarga, ResponsableRecibio)
|
||||
EstadoOrigen, PaisOrigen, CPOrigen, CalleDestino, NoExtDestino, ColoniaDestino, LocalidadDestino,
|
||||
MunicipioDestino, EstadoDestino, PaisDestino, CPDestino, FechaMovimiento, NombreCapturo, PuestoRecibio,
|
||||
PuestoEnrego, RazonSocial, ResponsableCarga, ResponsableRecibio, CveCliente)
|
||||
|
||||
End Sub
|
||||
Private Sub PUanacExtr(CveMoneda As Integer) 'preciounitario a moneda nacional o extranjera
|
||||
@@ -1236,7 +1237,17 @@ Partial Class PopUpVerFactura
|
||||
FolioInterno As String, FechaHora As DateTime, ObservacionesSolicitud As String, DepartamentoEntrega As String, RazonSocialOC As String,
|
||||
Remision As String, Proveedor As String, CalleOrigen As String, NoExtOrigen As String, ColoniaOrigen As String, LocalidadOrigen As String, MunicipioOrigen As String,
|
||||
EstadoOrigen As String, PaisOrigen As String, CPOrigen As String, CalleDestino As String, NoExtDestino As String, ColoniaDestino As String, LocalidadDestino As String, MunicipioDestino As String,
|
||||
EstadoDestino As String, PaisDestino As String, CPDestino As String, FechaMovimiento As Date, NombreCapturo As String, PuestoRecibio As String, PuestoEntrego As String, RazonSocial As String, ResponsableCarga As String, ResponsableRecibio As String)
|
||||
EstadoDestino As String, PaisDestino As String, CPDestino As String, FechaMovimiento As Date, NombreCapturo As String, PuestoRecibio As String, PuestoEntrego As String,
|
||||
RazonSocial As String, ResponsableCarga As String, ResponsableRecibio As String, CveCliente As Integer)
|
||||
Dim NombreCliente As String = ""
|
||||
If CveCliente <> Nothing Then
|
||||
Dim ObjClientes As New ClsClientes
|
||||
If ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1) Then
|
||||
NombreCliente = ObjClientes.Nombre
|
||||
End If
|
||||
ObjClientes.Dispose()
|
||||
End If
|
||||
|
||||
Select Case CveConcepto
|
||||
Case 1 'INICIAL
|
||||
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/Inicial.rdlc", UsuarioActual.Empresa.Ruta))
|
||||
@@ -1396,7 +1407,7 @@ Partial Class PopUpVerFactura
|
||||
params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy")))
|
||||
params.Add(New ReportParameter("Folio", Folio))
|
||||
params.Add(New ReportParameter("FacturaProveedor", If(CveCompra > 0 AndAlso dr IsNot Nothing, dr("SerieFolio").ToString, "")))
|
||||
params.Add(New ReportParameter("FacturadoA", If(CveCompra > 0, dr("RazonSocial").ToString, "")))
|
||||
params.Add(New ReportParameter("FacturadoA", If(CveCompra > 0, dr("RazonSocial").ToString, NombreCliente)))
|
||||
params.Add(New ReportParameter("Descuentos", If(CveCompra > 0 AndAlso dr IsNot Nothing, (dr("Descuentos").ToString.ToDouble).FormatoNumero(2), "")))
|
||||
params.Add(New ReportParameter("IVA", If(CveCompra > 0 AndAlso dr IsNot Nothing, dr("IVA").ToString.FormatoNumero(2), "")))
|
||||
params.Add(New ReportParameter("Total", If(CveCompra > 0 AndAlso dr IsNot Nothing, dr("Total").ToString.FormatoNumero(2), "")))
|
||||
|
||||
@@ -3136,7 +3136,7 @@
|
||||
<label for="<%= TxtContactoSucursal.ClientID.ToString()%>">Contacto:</label>
|
||||
</div>
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtLimiteCreditoSuc" runat="server" CssClass="form-control" MaxLength="9" Text="0" onkeyup="FormatoMoneda(this)"></asp:TextBox>
|
||||
<asp:TextBox ID="TxtLimiteCreditoSuc" runat="server" CssClass="form-control" MaxLength="15" Text="0" onkeyup="FormatoMoneda(this)"></asp:TextBox>
|
||||
<%--<asp:RequiredFieldValidator ID="RFVLimiteCreditoSuc" runat="server" ControlToValidate="TxtLimiteCreditoSuc" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Límite de Crédito''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarSucursal"></asp:RequiredFieldValidator>--%>
|
||||
<%--<ajax:ValidatorCalloutExtender ID="VCELimiteCreditoSuc" runat="server" HighlightCssClass="vco" TargetControlID="RFVLimiteCreditoSuc" Width="300px"></ajax:ValidatorCalloutExtender>--%>
|
||||
<label for="<%= TxtLimiteCreditoSuc.ClientID.ToString()%>">Limite de Crédito:</label>
|
||||
@@ -3489,7 +3489,7 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtLimiteCredito" runat="server" CssClass="form-control" MaxLength="9" Text="0" onkeyup="FormatoMoneda(this)"></asp:TextBox>
|
||||
<asp:TextBox ID="TxtLimiteCredito" runat="server" CssClass="form-control" MaxLength="15" Text="0" onkeyup="FormatoMoneda(this)"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RFVLimiteCredito" runat="server" ControlToValidate="TxtLimiteCredito" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Límite de Crédito''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<%-- <asp:CompareValidator ID="CVLimiteCredito" runat="server" ControlToValidate="TxtLimiteCredito" Display="None" ErrorMessage="El campo <b>''Límite de Crédito''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." Operator="DataTypeCheck" Type="Integer" ValidationGroup="GrpGuardar"></asp:CompareValidator>--%>
|
||||
<ajax:ValidatorCalloutExtender ID="VCOLimiteCredito1" runat="server" HighlightCssClass="vco" TargetControlID="RFVLimiteCredito" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
|
||||
@@ -408,7 +408,8 @@
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
<asp:GridView ID="GvInv" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False" ShowFooter="True" ShowHeader="true" ShowHeaderWhenEmpty="True" DataKeyNames="EntregaDirecta,Consec,CodigoBarras,CvePS,CveUM,PU,CantidadC,CantidadF,UM,PS,CveCompraDetalle,CveOrdenCompraDetalle,PUExtranjero,AplicaSerieLote,CveClasificacion,Codigo,CveVentaDetalle,CostoIndirecto" HeaderStyle-CssClass="Titulos" RowStyle-Height="25px" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" data-heighterror="450" data-freezerows="1" GridLines="None">
|
||||
<asp:GridView ID="GvInv" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False" ShowFooter="True" ShowHeader="true" ShowHeaderWhenEmpty="True"
|
||||
DataKeyNames="EntregaDirecta,Consec,CodigoBarras,CvePS,CveUM,PU,CantidadC,CantidadF,UM,PS,CveCompraDetalle,CveOrdenCompraDetalle,PUExtranjero,AplicaSerieLote,CveClasificacion,Codigo,CveVentaDetalle,CostoIndirecto,CveTamaño" HeaderStyle-CssClass="Titulos" RowStyle-Height="25px" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" data-heighterror="450" data-freezerows="1" GridLines="None">
|
||||
<HeaderStyle Height="58px" />
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
|
||||
@@ -354,6 +354,7 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
ViewState("CveVendedor") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
@@ -1998,6 +1999,7 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
Dim ObjCompras As New ClsCompras(ObjInventario.IniciaTransacSQL())
|
||||
Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL())
|
||||
Dim ObjOC As New ClsOC(ObjInventario.IniciaTransacSQL())
|
||||
Dim ObjAcum As New ClsAcumuladores(ObjInventario.IniciaTransacSQL())
|
||||
Dim ObjContaAC As ClsContPAQi = Nothing
|
||||
Dim ObjContaContPAQ As ClsContPAQi = Nothing
|
||||
|
||||
@@ -2011,6 +2013,10 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
Dim MovtosEntrada As New List(Of Integer)
|
||||
Dim FoliosEntrada As New List(Of Integer)
|
||||
|
||||
'VIRUAL
|
||||
Dim CveMovimientoVirtual As Integer = -1
|
||||
Dim FolioVirtual As Integer = -1
|
||||
|
||||
'CONTABILIDAD
|
||||
Dim CvePrePoliza = -1
|
||||
Dim MensajeContabilidad = ""
|
||||
@@ -2382,24 +2388,22 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
If CveOCSurtir > 0 Then
|
||||
Dim TotalCostoDetalle As Decimal = 0
|
||||
Dim TotalCostoAcumulado As Decimal = 0
|
||||
Dim TotalCostoExtranjeroComplementario As Decimal = 0
|
||||
Dim cont As Integer = 1
|
||||
For Each Dr As DataRow In DtCostos.Rows
|
||||
TotalCostoDetalle = (Dr("Total").ToString.ToDecimal)
|
||||
TotalCostoExtranjero = Dr("TotalExtranjero").ToString.ToDecimal
|
||||
TotalCostoAcumulado += TotalCostoDetalle.RoundSQL
|
||||
TotalCostoAcumulado += Math.Round(TotalCostoDetalle, 2)
|
||||
|
||||
'si es el último movimiento verifica los importes que sean igual
|
||||
If cont = DtCostos.Rows.Count AndAlso (Math.Round(TotalCosto, 2) <> Math.Round(TotalCostoAcumulado, 2)) Then
|
||||
TotalCostoDetalle = TotalCostoDetalle + (Math.Round(TotalCosto, 2) - Math.Round(TotalCostoAcumulado, 2))
|
||||
TotalCostoExtranjeroComplementario = (Math.Round(TotalCosto, 2) - Math.Round(TotalCostoAcumulado, 2))
|
||||
'TotalCostoExtranjero = TotalCostoExtranjero
|
||||
TotalCostoExtranjero = TotalCostoExtranjero + (Math.Round(TotalCosto, 2) - Math.Round(TotalCostoAcumulado, 2))
|
||||
End If
|
||||
|
||||
If CveMoneda <> 1 AndAlso UsaComplementariaFleteImportaciones Then
|
||||
'COMPLEMENTARIA
|
||||
If ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, TotalCostoExtranjero, SerieFolio, CveConceptoContableCostoME, SerieFolio, Fecha, IdCtaContableRecepcionME, -1, CveCompra:=CveCompraSurtir, CveOC:=CveOCSurtir, CveSubProyecto:=CveSubProyecto, CveProveedor:=CveProveedor, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=TotalCostoExtranjero, ImporteME:=TotalCostoExtranjero, TipoCambio:=TipoCambio.ToDecimal, CveOCDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero) Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, TotalCostoDetalle - TotalCostoExtranjero + TotalCostoExtranjeroComplementario, SerieFolio, CveConceptoContableCostoComplementaria, SerieFolio, Fecha, IdCtaContableRecepcionComplementaria, -1, CveCompra:=CveCompraSurtir, CveOC:=CveOCSurtir, CveProveedor:=CveProveedor, CveSubProyecto:=CveSubProyecto, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=TotalCostoDetalle - TotalCostoExtranjero, ImporteME:=TotalCostoExtranjero, TipoCambio:=TipoCambio.ToDecimal, CveOCDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero) Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, TotalCostoDetalle - TotalCostoExtranjero, SerieFolio, CveConceptoContableCostoComplementaria, SerieFolio, Fecha, IdCtaContableRecepcionComplementaria, -1, CveCompra:=CveCompraSurtir, CveOC:=CveOCSurtir, CveProveedor:=CveProveedor, CveSubProyecto:=CveSubProyecto, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=TotalCostoDetalle - TotalCostoExtranjero, ImporteME:=TotalCostoExtranjero, TipoCambio:=TipoCambio.ToDecimal, CveOCDetalle:=Dr("CveOrdenCompraDetalle").ToString.ToEntero) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
@@ -2651,6 +2655,12 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
Next
|
||||
End If
|
||||
|
||||
'VIRTUAL
|
||||
If CveMovimientoVirtual > 0 Then
|
||||
link = String.Format("<a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimientoVirtual, FolioVirtual)
|
||||
Msg.AppendFormat("<br/>Movimiento de Entrada al Almacen Virtal: Folio: <b>{0}</b>", link)
|
||||
End If
|
||||
|
||||
'CONTABILIDAD
|
||||
Msg.Append(MensajeContabilidad)
|
||||
|
||||
@@ -3426,14 +3436,6 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#Region "Imprimir PDF/Excel"
|
||||
|
||||
Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
||||
@@ -3467,9 +3469,6 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
#Region " VIEJO - POR ELIMINAR 22 NOVIEMBRE 2017 "
|
||||
Protected Sub ImgAlmacen_Click(sender As Object, e As ImageClickEventArgs)
|
||||
For i As Integer = 0 To GvInv.Rows.Count - 1
|
||||
@@ -3599,6 +3598,4 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
@@ -330,6 +330,16 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%--ADVERTENCIA--%>
|
||||
<div class="col-md-12" style="vertical-align: middle;" align="center">
|
||||
<div style="z-index: 5; position: relative;">
|
||||
<div id="DivVirtualAdvertencia" visible="false" clientidmode="Static" runat="server" class="alert alert-warning" style="padding: 5px; margin-bottom: 5px; padding-right: 25px;">
|
||||
<button type="button" class="close" data-dismiss="alert" style="margin-top: 5px;" aria-hidden="true"></button>
|
||||
<strong style="font-size: 20px; margin-right: 25px;">Información: </strong>
|
||||
<asp:Literal Text="" runat="server" ID="Literal1"></asp:Literal>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<asp:GridView ID="GvDocs" DataKeyNames="CveDocumentacion,Documentacion,Orden,CveDocumentacionElectronica,Adjunto,Estatus" runat="server" AutoGenerateColumns="False" ShowHeader="true" HeaderStyle-CssClass="Titulos" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" data-height="100" data-freezerows="1" GridLines="None">
|
||||
<Columns>
|
||||
@@ -346,7 +356,6 @@
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
@@ -408,7 +417,8 @@
|
||||
</div>
|
||||
|
||||
<%--GV DATOS--%>
|
||||
<asp:GridView ID="GvDatos" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False" ShowFooter="True" ShowHeader="true" ShowHeaderWhenEmpty="True" DataKeyNames="Consec,CvePS,Codigo,CodigoBarras,AplicaSerieLote,CveUM,CantidadC,CantidadF,UM,PS,CveClasificacion,CveVentaDetalle" HeaderStyle-CssClass="Titulos" RowStyle-Height="25px" CssClass="table table-striped table-hover Widthall ScrollAD gvInventario mysmallbtn" data-heighterror="450" data-freezerows="1" GridLines="None">
|
||||
<asp:GridView ID="GvDatos" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False" ShowFooter="True" ShowHeader="true" ShowHeaderWhenEmpty="True"
|
||||
DataKeyNames="Consec,CvePS,Codigo,CodigoBarras,AplicaSerieLote,CveUM,CantidadC,CantidadF,UM,PS,CveClasificacion,CveVentaDetalle,CveTamaño,PUVenta" HeaderStyle-CssClass="Titulos" RowStyle-Height="25px" CssClass="table table-striped table-hover Widthall ScrollAD gvInventario mysmallbtn" data-heighterror="450" data-freezerows="1" GridLines="None">
|
||||
<HeaderStyle Height="58px" />
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
|
||||
@@ -3,6 +3,7 @@ Option Explicit On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports System.Linq
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class Inventarios_RecepcionEntrega
|
||||
@@ -711,6 +712,11 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
DivTipoCambioAdvertencia.Visible = False
|
||||
End If
|
||||
|
||||
'If DtDatos.Rows.Cast(Of DataRow).Any(Function(Row) Row("CveTamaño").ToString().ToEntero() > 0) Then
|
||||
|
||||
'End If
|
||||
|
||||
|
||||
DdlAlmacen.Items.Clear()
|
||||
If CveAlmacenTraspasoOrigen > 0 Then
|
||||
DdlAlmacen.Items.Insert(0, New ListItem(GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Almacen", $"CveAlmacen = {CveAlmacenTraspasoOrigen}"), CveAlmacenTraspasoOrigen.ToString))
|
||||
@@ -1526,6 +1532,9 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
Dim CveMovimientoGarantia As Integer = -1
|
||||
Dim FolioGarantia As Integer = -1
|
||||
|
||||
Dim CveMovimientoVirtual As Integer = -1
|
||||
Dim FolioVirtual As Integer = -1
|
||||
|
||||
'PASA DATOS DEL GV A DATATABLE PARA MANEJOR CON FOR EACH
|
||||
Dim Index = 0
|
||||
For Each gvr As GridViewRow In GvDatos.Rows
|
||||
@@ -1901,7 +1910,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
DtGarantias = ObjAcumuladores.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
If DtGarantias IsNot Nothing AndAlso DtGarantias.Rows.Count > 0 Then
|
||||
If DtGarantias IsNot Nothing AndAlso DtGarantias.Rows.Count > 0 AndAlso CveAlmacenGarantia > 0 Then
|
||||
CveMovimientoGarantia = ObjInventario.AddMovimiento(CveAlmacenGarantia, 2, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text)
|
||||
FolioGarantia = ObjInventario.Folio
|
||||
|
||||
@@ -1922,6 +1931,66 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
|
||||
' TERMINA: GARANTIAS
|
||||
|
||||
|
||||
' COMIENZA: VIRTUAL
|
||||
If TipoDocto.Contiene("Ing", "Rem") AndAlso UsuarioActual.CveEmpresa = 140 AndAlso TipoMovimiento = 1 Then
|
||||
|
||||
Dim DtTamanios As New DataTable("DtTamanios")
|
||||
DtTamanios.Columns.Add(New DataColumn("CvePS", GetType(Integer)))
|
||||
DtTamanios.Columns.Add(New DataColumn("Cantidad", GetType(Decimal)))
|
||||
DtTamanios.Columns.Add(New DataColumn("PU", GetType(Decimal)))
|
||||
DtTamanios.Columns.Add(New DataColumn("CveUM", GetType(Integer)))
|
||||
|
||||
If ObjAcumuladores.TamañoGet(-1, UsuarioActual.CveEmpresa) Then
|
||||
For Each GvRow As GridViewRow In GvDatos.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
For Each Tam As DataRow In ObjAcumuladores.DtResultados.Rows
|
||||
If Tam("CveTamaño").ToString() = GvRow.DataKey("CveTamaño") Then
|
||||
Dim Row As DataRow = DtTamanios.NewRow()
|
||||
|
||||
Row("CvePS") = Tam("CvePSCargo").ToString().ToEntero()
|
||||
Row("Cantidad") = GvRow.FCTextBox("TbCantidadF").Text.ToDecimal()
|
||||
Row("PU") = GvRow.DataKey("PUVenta").ToDecimal()
|
||||
Row("CveUM") = GvRow.DataKey("CveUM").ToEntero()
|
||||
|
||||
DtTamanios.Rows.Add(Row)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Dim CveAlmacenVirutal As Integer = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero()
|
||||
|
||||
If DtTamanios IsNot Nothing AndAlso DtTamanios.Rows.Count > 0 AndAlso CveAlmacenVirutal > 0 Then
|
||||
Dim CveConceptoMovimientoVirtual = If(TipoMovimiento = 1, 3, 18) 'CHECA SI ES ENTRADA O DEVOLUCION
|
||||
|
||||
CveAlmacenVirutal = ObjInventario.AddMovimiento(CveAlmacenVirutal, CveConceptoMovimientoVirtual, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text)
|
||||
FolioVirtual = ObjInventario.Folio
|
||||
|
||||
For Each RowUsado As DataRow In DtTamanios.Rows
|
||||
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
|
||||
Dim CantidadEntrada As Double = RowUsado("Cantidad").ToString().ToDouble()
|
||||
Dim PU As Double = RowUsado("PU").ToString().ToDouble()
|
||||
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveAlmacenVirutal, CantidadEntrada, CveUM, CvePS, PU, -1) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar."
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
|
||||
If DtTamanios.Rows.Count = 0 Then
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
End If
|
||||
|
||||
' TERMINA: VIRTUAL
|
||||
|
||||
If Not ErrorMovInv Then
|
||||
Dim ConceptoMovimiento = 3
|
||||
ConceptoMovimiento = If(TipoMovimiento = 1, ConceptoMovimiento, 18)
|
||||
@@ -2389,8 +2458,14 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
Msg.AppendFormat("<br/><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoGarantia)))
|
||||
End If
|
||||
|
||||
'VIRTUAL
|
||||
If CveMovimientoVirtual > 0 Then
|
||||
Msg.AppendFormat("<br/> Movimiento de Salida del Almacen Virtal: Folio : ")
|
||||
Msg.AppendFormat("<b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a></b>", CveMovimientoVirtual, FolioVirtual)
|
||||
End If
|
||||
|
||||
'If CveMovimientoSalidaDevRem > 0 Then
|
||||
' Msg.AppendFormat("<br/><br/> Movimiento de salida de devolución (Traspaso): <b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a></b>", CveMovimientoSalidaDevRem, FolioMovimientoSalidaDevRem)
|
||||
' Msg.AppendFormat(" < br /<> br /> Movimiento de salida de devolución (Traspaso): <b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a></b>", CveMovimientoSalidaDevRem, FolioMovimientoSalidaDevRem)
|
||||
' Msg.AppendFormat("<br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalidaDevRem)))
|
||||
|
||||
' Msg.AppendFormat("<br/><br/> Movimiento de entrada de devolución (Traspaso): <b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a></b>", CveMovimientoEntradaDevRem, FolioMovimientoEntradaDevRem)
|
||||
|
||||
@@ -646,7 +646,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
End If
|
||||
|
||||
'VALIDA ALMACEN DISTINTA SUCURSAL DEBE SER TRANSITORIO
|
||||
If UsuarioActual.CveEmpresa <> 7 Then '[IPP] EMPRESA VIGILANCIA NO OCUPA TRANSITORIOS - TIENEN MIL SUCURSALES Xd
|
||||
If Not UsuarioActual.CveEmpresa.Contiene(7, 140) Then '[IPP] EMPRESA VIGILANCIA NO OCUPA TRANSITORIOS - TIENEN MIL SUCURSALES Xd
|
||||
If Not ChkTransitorio.Checked Then
|
||||
Dim CveSucursalOrigen = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen = {DdlAlmacenOrigen.SelectedValue.ToEntero}")
|
||||
Dim CveSucursalDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen = {DdlAlmacenDestino.SelectedValue.ToEntero}")
|
||||
@@ -755,7 +755,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
Dim ErrorMovInv As Boolean = False
|
||||
Dim ErrorAC As Boolean = False
|
||||
Dim TextoError = ""
|
||||
Dim TipoMovimientoSalida = If(ChkTransitorio.Checked, 26, 8)
|
||||
Dim TipoMovimientoSalida = If(ChkTransitorio.Checked, 26, If(TipoAlmacenOrigen = 24, 26, 8))
|
||||
|
||||
|
||||
'AGREGAMOS LA SALIDA DEL ALMACEN ORIGEN
|
||||
@@ -1445,14 +1445,6 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
|
||||
Protected Sub BtnRecibir_Click(sender As Object, e As EventArgs)
|
||||
If GvDatosRecepcion.Rows.Count > 0 Then
|
||||
Dim ObjInventarios As New ClsInventarios
|
||||
Dim Dtt As DataTable = Nothing
|
||||
|
||||
If ObjInventarios.GetMovimientosTransitorios(CveAlmacenDestino, -1, CveAlmacenTransitorio, -1, FolioBusqueda, UsuarioActual.CveEmpresa) Then
|
||||
Dtt = ObjInventarios.DtResultados.FiltraParametros(String.Format("CveTipoAlmacenDestino <> 4"), "", {"Codigo", "Cantidad"})
|
||||
End If
|
||||
|
||||
ObjInventarios.Dispose()
|
||||
'Valida Movimientos
|
||||
Dim ValidaMovtos = 0.0
|
||||
For Each gvr As GridViewRow In GvDatosRecepcion.Rows
|
||||
@@ -1474,12 +1466,15 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
End If
|
||||
|
||||
Dim ObjInventario As New ClsInventarios
|
||||
|
||||
Dim Dtt As DataTable = Nothing
|
||||
Dim CveMovimientoEntrada As Integer = 0
|
||||
Dim Folio = 0
|
||||
Dim ErrorMovInv As Boolean = False
|
||||
Dim TextoError = ""
|
||||
|
||||
If ObjInventario.GetMovimientosTransitorios(CveAlmacenDestino, -1, CveAlmacenTransitorio, -1, FolioBusqueda, UsuarioActual.CveEmpresa) Then
|
||||
Dtt = ObjInventario.DtResultados.FiltraParametros(String.Format("CveTipoAlmacenDestino <> 4"), "", {"Codigo", "Cantidad"})
|
||||
End If
|
||||
'REGISTRA LA SALIDA Y ENTRADA (TRASPASO)
|
||||
ObjInventario.IniciaTransacSQL() 'Inicia la transacción
|
||||
Dim Fecha As Date = TxtFechaRecepcion.Text.ToDate
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<div style="">
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False"
|
||||
DataKeyNames="CveSubProyecto,SubProyecto,IdSegNeg,Estatus,Serie,IVA,Calle,NoExt,NoInt,Colonia,Localidad,Municipio,Estado,Pais,CP,CveProyecto,TipoSucursal,EsSucursal,
|
||||
CvePais,CveEstado,CveMunicipio,CveColonia,AplicaComercioExterior,CvePrecioLista,Correo,Telefono,HorarioVerano,HorarioInvierno"
|
||||
CvePais,CveEstado,CveMunicipio,CveColonia,AplicaComercioExterior,CvePrecioLista,Correo,Telefono,UTCOffsetVerano,UTCOffsetInvierno"
|
||||
EmptyDataText="No se encontraron SubProyectos" ShowHeader="true" CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" GridLines="None">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="SubProyecto" HeaderText="Centro de costo" />
|
||||
|
||||
@@ -284,8 +284,8 @@ Partial Class CatSubProyectos
|
||||
DdlPrecioLista.SelectedValueExist(GvRow.DataKey("CvePrecioLista"))
|
||||
TxtCorreo.Text = (GvRow.DataKey("Correo"))
|
||||
TxtTelefono.Text = (GvRow.DataKey("Telefono"))
|
||||
TxtHorarioVerano.Text = (GvRow.DataKey("HorarioVerano"))
|
||||
TxtHorarioInvierno.Text = (GvRow.DataKey("HorarioInvierno"))
|
||||
TxtHorarioVerano.Text = (GvRow.DataKey("UTCOffsetVerano"))
|
||||
TxtHorarioInvierno.Text = (GvRow.DataKey("UTCOffsetInvierno"))
|
||||
'COMERCIO EXTERIOR
|
||||
ChkAplicaComercioExterior.Checked = If(GvRow.DataKey("AplicaComercioExterior").ToString = "True", True, False)
|
||||
DdlPais.SelectedValueExist(GvRow.DataKey("CvePais"))
|
||||
|
||||
@@ -92,8 +92,9 @@ Partial Class Ventas_RepRecuperacion
|
||||
|
||||
'Carga Bancos'
|
||||
DdlBanco.DataSource = GlobalDTBancos().FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}")
|
||||
DdlBanco.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
DdlBanco.DataBind()
|
||||
DdlBanco.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
DdlBanco.Items.Add(New ListItem("Empresa", "0"))
|
||||
|
||||
'Carga Clasificacion Cliente'
|
||||
Dim ObjCliente As New ClsClientes
|
||||
@@ -179,9 +180,7 @@ Partial Class Ventas_RepRecuperacion
|
||||
|
||||
Protected Sub DdlBanco_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
DdlCuentaBancaria.Items.Clear()
|
||||
If DdlBanco.SelectedValue.ToEntero > 0 Then
|
||||
DdlCuentaBancaria.DataSource = GlobalDTBancosCuentas(-1).FiltraParametros($"CveBanco = {DdlBanco.SelectedValue.ToEntero}")
|
||||
End If
|
||||
DdlCuentaBancaria.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros($"CveBanco = {DdlBanco.SelectedValue.ToEntero}")
|
||||
DdlCuentaBancaria.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
DdlCuentaBancaria.DataBind()
|
||||
End Sub
|
||||
|
||||
@@ -1279,11 +1279,29 @@
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 ">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<table id="TbDescuentosRNC" border="0" rules="none" class="well TextTab" style="float: right;" runat="server" visible="false">
|
||||
<tr align="right">
|
||||
<td style="border: 1px none white"><b>Descuentos. RNC.:</b></td>
|
||||
<td>
|
||||
<asp:Label ID="LblDescuentosRNC" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
|
||||
<td align="right"> <asp:LinkButton ID="LnkDescuentosRNC" runat="server" OnClick="LnkDescuentosRNC_Click" Text="<i class='fa fa-tag fa-lg font-green'></i>" AlternateText="Aplicacion de RNC" Style="cursor: pointer;" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr align="right">
|
||||
<td style="border: 1px none white"><b>Total NC.:</b></td>
|
||||
<td>
|
||||
<asp:Label ID="LblTotalNC" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
|
||||
<td align="right">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<table border="0" rules="none" class="well TextTab" style="float: right;">
|
||||
<tr align="right">
|
||||
@@ -1469,6 +1487,8 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</ContentTemplate>
|
||||
@@ -6329,6 +6349,63 @@
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<%--APLICAR REMISIONES DE NC--%>
|
||||
<div id="ModalAplicarDescuentoNC" class="modal ADS fade" role="dialog">
|
||||
<asp:UpdatePanel ID="UpDescNC" class="modal-dialog rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Aplicar Remisiones de Nota de Crédito</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row" style="margin-right: 10px; margin-top: 18px;" align="right">
|
||||
<input type="text" id="TxtBusquedaDescC" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaDescC','{0}')", GvDescNC.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaDescC','{0}')", GvDescNC.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
<div class="row" style="max-height: 10px">
|
||||
<div class="col-md-12" style="height: 440px; overflow: auto">
|
||||
<asp:GridView ID="GvDescNC" runat="server" AutoGenerateColumns="False"
|
||||
DataKeyNames="CveVenta" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
<asp:CheckBox ID="ChkAplicar" runat="server" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:HyperLinkField DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="SerieFolio" HeaderText="Folio" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlTotal" runat="server" Text='<%# Eval("Original", "{0:N2}") %>'></asp:Literal>
|
||||
<asp:Literal ID="LtlAbrev" runat="server" Text='<%# Eval("Abreviatura") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Saldo" ItemStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlSaldo" runat="server" Text='<%# Eval("Saldo", "{0:N2}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtImporte" CssClass="myvalue" runat="server" Width="75px" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="CancelarAplicarDescNC" type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
<asp:Button Text="Aplicar Descuento" ID="BtnAplicarDesc" OnClick="BtnAplicarDesc_Click" CssClass="btn btn-primary" runat="server" />
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script src="/Metronic/assets/global/scripts/jquery-sortable.js"></script>
|
||||
|
||||
@@ -85,6 +85,14 @@ Partial Class Ventas
|
||||
End Property
|
||||
|
||||
'Local
|
||||
Private Property DtPorcentajeMarcas As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("DtPorcentajeMarcas")), Nothing, CType(ViewState("DtPorcentajeMarcas"), DataTable))
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtPorcentajeMarcas") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TmpDT As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("TmpDT")), Nothing, CType(ViewState("TmpDT"), DataTable))
|
||||
@@ -265,6 +273,14 @@ Partial Class Ventas
|
||||
ViewState("ListaRemisionesNC") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property ListaNCDesc As List(Of Modelos.Factura)
|
||||
Get
|
||||
Return If(IsNothing(ViewState("ListaNCDesc")), Nothing, CType(ViewState("ListaNCDesc"), List(Of Modelos.Factura)))
|
||||
End Get
|
||||
Set(value As List(Of Modelos.Factura))
|
||||
ViewState("ListaNCDesc") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property Pedidos2Lista As List(Of Integer)
|
||||
Get
|
||||
Return If(IsNothing(ViewState("Pedidos2Lista")), Nothing, CType(ViewState("Pedidos2Lista"), List(Of Integer)))
|
||||
@@ -2463,7 +2479,7 @@ Partial Class Ventas
|
||||
InicializaAplicarNC()
|
||||
|
||||
If CveCliente > 0 Then
|
||||
CargaRestriccionesCreditoCliente()
|
||||
CargaRestriccionesCreditoCliente(CveVenta:=Me.CveVenta)
|
||||
End If
|
||||
|
||||
If Not CveVenta > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(403).ToString = "1" Then
|
||||
@@ -2512,6 +2528,11 @@ Partial Class Ventas
|
||||
End If
|
||||
TxtFecha.Enabled = True
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then
|
||||
TbDescuentosRNC.Visible = True
|
||||
End If
|
||||
|
||||
CargaPorcentajeMarcas()
|
||||
End Sub
|
||||
|
||||
Private Sub ConfiguraEmpresa()
|
||||
@@ -4947,7 +4968,7 @@ Partial Class Ventas
|
||||
TrVistaPrevia.Visible = True
|
||||
|
||||
If Not (ModalidadEdicion AndAlso DdlTipoComprobante.SelectedValue = "Rem") Then
|
||||
CargaRestriccionesCreditoCliente(True)
|
||||
CargaRestriccionesCreditoCliente(True, Me.CveVenta)
|
||||
End If
|
||||
|
||||
|
||||
@@ -5001,7 +5022,7 @@ Partial Class Ventas
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False)
|
||||
Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1)
|
||||
Dim ObjCliente As New ClsClientes()
|
||||
If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
@@ -6120,7 +6141,11 @@ Partial Class Ventas
|
||||
#Region " EMITIR IMPRIMIR - GUARDAR "
|
||||
|
||||
Protected Sub BtnEmitirImprimir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEmitirImprimir.Click
|
||||
Try
|
||||
EmitirImprimir()
|
||||
Catch ex As Exception
|
||||
OnError(ex.ToString(), ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub EmitirImprimir()
|
||||
@@ -6525,7 +6550,6 @@ Partial Class Ventas
|
||||
' Exit Sub
|
||||
'End If
|
||||
|
||||
|
||||
If ObjFactura.CveCliente > 0 Or CveEmpresaCRM > 0 Then
|
||||
If TmpDT.Rows.Count > 0 Then
|
||||
|
||||
@@ -6597,7 +6621,8 @@ Partial Class Ventas
|
||||
EsNCAmortizacion = True
|
||||
End If
|
||||
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS, ObjEventos, ObjCGame, ObjClientes, EsNCAmortizacion:=EsNCAmortizacion)
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS,
|
||||
ObjEventos, ObjCGame, ObjClientes, EsNCAmortizacion:=EsNCAmortizacion)
|
||||
|
||||
'SI ES REFACTURACION
|
||||
Dim ObjNC As List(Of Object) = Nothing
|
||||
@@ -6620,30 +6645,21 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'SI ES amortizacion 3.3
|
||||
'SI ES AMORTIZACION 3.3
|
||||
Dim Obj2 As New List(Of Object)
|
||||
|
||||
Dim NCDescuento As Boolean = (ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0)
|
||||
If ErrorList.Count = 0 Then
|
||||
' cambiar la condicion para saber si hay seleccionado
|
||||
If TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
|
||||
|
||||
If TieneAnticipo Then
|
||||
CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveAnticipoPadre)
|
||||
|
||||
If (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse NCDescuento Then
|
||||
Try
|
||||
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing, Nothing) Then
|
||||
|
||||
CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveAnticipoPadre, NCDescuento:=NCDescuento)
|
||||
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing,
|
||||
Nothing, NCDescuento:=NCDescuento) Then
|
||||
Obj2.Add(ObjFacturaDevolucion)
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ErrorList.Add("No se pudo generarse la nota de crédito de amortización")
|
||||
End Try
|
||||
|
||||
|
||||
End If
|
||||
|
||||
If Obj2 Is Nothing AndAlso Obj2.Count = 0 Then
|
||||
ErrorList.Add("No se pudo generarse la nota de crédito de amortización")
|
||||
End If
|
||||
@@ -6820,7 +6836,6 @@ Partial Class Ventas
|
||||
End Try
|
||||
|
||||
|
||||
|
||||
Dim SeTimbro As Boolean = False
|
||||
Dim SeTimbroNC As Boolean = False
|
||||
Dim EstatusSMS = 0
|
||||
@@ -6881,7 +6896,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
ElseIf UsuarioActual.Empresa.TipoFacturacion = "CBB" Then
|
||||
GeneraPDFCBB(ObjFactura.Fecha, Nothing, ObjFactura.SerieFolio, False)
|
||||
GeneraPDFCBB(ObjFactura.FechaCP, Nothing, ObjFactura.SerieFolio, False)
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -7084,7 +7099,8 @@ Partial Class Ventas
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub CreaObjetosVentaAmortizacion(ObjVentas As ClsVentas, FolioFiscalRelacionado As String, CveAnticipoPadre As Integer, Optional CveVentasPadre As Integer = -1)
|
||||
Private Sub CreaObjetosVentaAmortizacion(ObjVentas As ClsVentas, FolioFiscalRelacionado As String, CveAnticipoPadre As Integer,
|
||||
Optional CveVentasPadre As Integer = -1, Optional NCDescuento As Boolean = False)
|
||||
ObjFacturaDevolucion = New Modelos.Factura
|
||||
|
||||
ObjFacturaDevolucion.CveUsuario = UsuarioActual.CveUsuario
|
||||
@@ -7098,7 +7114,6 @@ Partial Class Ventas
|
||||
ObjFacturaDevolucion.CveVentaRelacion = ObjVentas.CveVenta
|
||||
End If
|
||||
|
||||
|
||||
ObjFacturaDevolucion.CveEmpresa = UsuarioActual.CveEmpresa
|
||||
ObjFacturaDevolucion.TipoCambio = If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.Trim.ToDecimal)
|
||||
ObjFacturaDevolucion.ConvertirPesos = ChkConvertirDoctoPesos.Checked
|
||||
@@ -7139,6 +7154,7 @@ Partial Class Ventas
|
||||
|
||||
ObjFacturaDevolucion.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero
|
||||
ObjFacturaDevolucion.TipoRelacion = "07"
|
||||
|
||||
Dim Fol As New List(Of String)
|
||||
Fol.Add(FolioFiscalRelacionado)
|
||||
ObjFacturaDevolucion.UUIDRelacionados = Fol
|
||||
@@ -7199,7 +7215,23 @@ Partial Class Ventas
|
||||
ObjFacturaDevolucion.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim
|
||||
ObjFacturaDevolucion.MonedaAbreviatura = ""
|
||||
|
||||
'Totales, Y se llena TmpDTImpuestos
|
||||
'DETALLES
|
||||
If NCDescuento Then
|
||||
ObjFacturaDevolucion.DtDetalle = CreaDTDetalleNCDescuento()
|
||||
|
||||
ObjFacturaDevolucion.SubTotal = ObjFacturaDevolucion.DtDetalle.SUM("Total").ToDecimal()
|
||||
ObjFacturaDevolucion.Descuento = ObjFacturaDevolucion.DtDetalle.SUM("Descuento").ToDecimal()
|
||||
ObjFacturaDevolucion.Amortizacion = 0
|
||||
ObjFacturaDevolucion.IVA = ObjFacturaDevolucion.DtDetalle.SUM("ImporteIVA").ToDecimal()
|
||||
ObjFacturaDevolucion.RetIVA = ObjFacturaDevolucion.DtDetalle.SUM("ImporteRetIVA").ToDecimal()
|
||||
ObjFacturaDevolucion.RetISR = ObjFacturaDevolucion.DtDetalle.SUM("ImporteRetISR").ToDecimal()
|
||||
ObjFacturaDevolucion.IEPS = ObjFacturaDevolucion.DtDetalle.SUM("ImporteIEPS").ToDecimal()
|
||||
|
||||
Dim Total As Decimal = (ObjFacturaDevolucion.SubTotal + ObjFacturaDevolucion.IVA + ObjFacturaDevolucion.IEPS) - (ObjFacturaDevolucion.Descuento + ObjFacturaDevolucion.RetIVA + ObjFacturaDevolucion.RetISR + ObjFacturaDevolucion.Amortizacion)
|
||||
ObjFacturaDevolucion.Total = Total
|
||||
Else
|
||||
ObjFacturaDevolucion.DtDetalle = TmpDT
|
||||
|
||||
ObjFacturaDevolucion.SubTotal = TxtSubTotal.Text.ToDecimal
|
||||
ObjFacturaDevolucion.Descuento = LblDescuentos.Text.Trim.ToDecimal
|
||||
ObjFacturaDevolucion.Amortizacion = LblAmortizacion.Text.Trim.ToDecimal
|
||||
@@ -7208,6 +7240,8 @@ Partial Class Ventas
|
||||
ObjFacturaDevolucion.RetISR = TxtRetISR.Text.ToDecimal
|
||||
ObjFacturaDevolucion.IEPS = TxtIEPS.Text.ToDecimal
|
||||
ObjFacturaDevolucion.Total = TxtTotal.Text.ToDecimal
|
||||
End If
|
||||
'Totales, Y se llena TmpDTImpuestos
|
||||
|
||||
'ObjFactura.BZDescripcion = TxtBZDescripcion.Text.Trim
|
||||
'ObjFactura.BZNombreCorto = TxtBZNombreCorto.Text.Trim
|
||||
@@ -7255,12 +7289,10 @@ Partial Class Ventas
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
If TxtTotal.Text.ToDecimal <> 0 Then DR("ImpuestoLocal") = "Total" : DR("Importe") = TxtTotal.Text.ToDecimal : DR("Orden") = 100 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
|
||||
|
||||
ObjFacturaDevolucion.DtDeduccion = TmpDTImpuestos.FiltraParametros("", Orderby:="Orden ASC")
|
||||
|
||||
|
||||
'otros
|
||||
ObjFacturaDevolucion.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim
|
||||
ObjFacturaDevolucion.Det_OrdenCompra = TxtDet_OrdenCompra.Text.Trim
|
||||
@@ -7273,8 +7305,6 @@ Partial Class Ventas
|
||||
ObjFacturaDevolucion.CveMoneda = 1
|
||||
End If
|
||||
|
||||
'DETALLES
|
||||
ObjFacturaDevolucion.DtDetalle = TmpDT
|
||||
ObjFacturaDevolucion.DtFirmas = DTmpF
|
||||
|
||||
'CLIENTE
|
||||
@@ -7331,10 +7361,11 @@ Partial Class Ventas
|
||||
End Sub
|
||||
|
||||
|
||||
Private Function RegistrarNCAmortizacion(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi, ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos) As Boolean
|
||||
Private Function RegistrarNCAmortizacion(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi,
|
||||
ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos, Optional NCDescuento As Boolean = False) As Boolean
|
||||
Dim ProcesoCorrecto As Boolean = True
|
||||
|
||||
'Generamos el nuevo folio
|
||||
'GENERAMOS EL NUEVO FOLIO
|
||||
Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL())
|
||||
|
||||
If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then
|
||||
@@ -7347,7 +7378,21 @@ Partial Class Ventas
|
||||
DT.Dispose()
|
||||
End If
|
||||
|
||||
'** genero los datos de la NC
|
||||
If NCDescuento Then
|
||||
|
||||
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
|
||||
DtVentasNC.Rows(0)("Importe") = factura.Total
|
||||
DtVentasNC.Rows(0)("TC") = factura.TipoCambio
|
||||
DtVentasNC.Rows(0)("TCCambioValuacion") = factura.TipoCambio
|
||||
End If
|
||||
|
||||
ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
|
||||
|
||||
'Registramos la venta
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True, NCDescuento:=True)
|
||||
|
||||
Else
|
||||
'GENERO LOS DATOS DE LA NC
|
||||
Dim tmpcon As DataTable = TmpDT.Clone
|
||||
tmpcon.Clear()
|
||||
|
||||
@@ -7407,7 +7452,7 @@ Partial Class Ventas
|
||||
|
||||
Next
|
||||
|
||||
'**** impuestos locales
|
||||
'**** IMPUESTOS LOCALES
|
||||
|
||||
factura.DtDetalle = tmpcon
|
||||
Dim TotalSubTotal As Decimal = tmpcon.SUM("TotalImporte").ToDecimal
|
||||
@@ -7441,34 +7486,10 @@ Partial Class Ventas
|
||||
'Registramos la venta
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True)
|
||||
|
||||
''Timbramos
|
||||
'If factura.TipoDocto.Contiene("Ing", "Egs", "Ant") Then
|
||||
' If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso UsuarioActual.Empresa.FacturaProduccion Then
|
||||
|
||||
' Dim sw As New Diagnostics.Stopwatch
|
||||
' sw.Start()
|
||||
|
||||
' ''factura INGRESO / EGRESO
|
||||
' Dim ObjTimbrado As New Modelos.Timbrado
|
||||
' Dim FM As New Modelos.FemsaFactura
|
||||
' Dim TmpDT7Eleven As New DataTable
|
||||
' Dim TmpDTComplementosTimbrado As New DataTable
|
||||
|
||||
' 'PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado)
|
||||
' '**
|
||||
' ObjTimbrado.TimbrarFactura(UsuarioActual, factura, FM, TmpDT, TmpDTImpuestos, TmpDT7Eleven, TmpDTComplementosTimbrado, Ruta, LstFordASN, TxtFordGSDB.Text)
|
||||
|
||||
' sw.Stop()
|
||||
' 'GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString, UsuarioActual.Empresa.CvePAC)
|
||||
|
||||
|
||||
' End If
|
||||
'End If
|
||||
|
||||
Else
|
||||
ErrorList.Add("No se encontró un producto para generar la nota de crédito")
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Return ProcesoCorrecto
|
||||
End Function
|
||||
@@ -8934,7 +8955,7 @@ Partial Class Ventas
|
||||
#Region " GUARDAR - VENTA, PREPOLIZAS, INV, ESTIMACIONES, AC, NOTA DE CRÉDITO "
|
||||
Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, TmpDTDetalle As DataTable, CveNCaVincular As Integer,
|
||||
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing,
|
||||
ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNCAmortizacion As Boolean = False)
|
||||
ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False)
|
||||
|
||||
Dim Msgok As New StringBuilder
|
||||
Dim CveAlmacenTraspasoOrigen As Integer = -1
|
||||
@@ -9255,10 +9276,10 @@ Partial Class Ventas
|
||||
|
||||
If ErrorList.Count = 0 Then
|
||||
'prepoliza
|
||||
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion)
|
||||
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento)
|
||||
If ErrorList.Count = 0 Then
|
||||
'inventarios
|
||||
If Not EsNCAmortizacion Then
|
||||
If Not EsNCAmortizacion AndAlso Not NCDescuento Then
|
||||
If GuardarVentaInventarios(ObjInventario, ObjConta, factura) Then
|
||||
ErrorList.Add("Ocurrio un error al Guardar Inventario")
|
||||
End If
|
||||
@@ -9284,7 +9305,7 @@ Partial Class Ventas
|
||||
End Sub
|
||||
Private Sub GuardarVentaPrePolizas(ByRef ObjConta As ClsContabilidad, factura As Modelos.Factura, TmpDTDetalleMovimientos As DataTable, CveNCaVincular As Integer,
|
||||
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
|
||||
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False)
|
||||
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False)
|
||||
|
||||
Dim CveIE As Integer = -1
|
||||
Dim DT As DataTable = Nothing
|
||||
@@ -9303,7 +9324,7 @@ Partial Class Ventas
|
||||
If DdlTipoComprobante.SelectedValue <> "Cot" Then
|
||||
If factura.CvePrePoliza > 0 Then
|
||||
|
||||
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, 1, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion) Then
|
||||
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, 1, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento) Then
|
||||
ErrorList.Add("Ocurrió un error al agregar los Movimientos de la prepoliza.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
||||
End If
|
||||
|
||||
@@ -9314,7 +9335,7 @@ Partial Class Ventas
|
||||
End Sub
|
||||
Private Function ProcesoPrepolizas(ByRef ObjConta As ClsContabilidad, ObjFactura As Modelos.Factura, CveIE As Integer, TmpDTDetalle As DataTable, ByRef objContPaqi As ClsContPAQi,
|
||||
Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
|
||||
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False) As Boolean
|
||||
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False) As Boolean
|
||||
Try
|
||||
Dim DT As DataTable
|
||||
Dim CvePlantilaPoliza As Integer
|
||||
@@ -9960,8 +9981,16 @@ Partial Class Ventas
|
||||
Next
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(344) = "1" Then
|
||||
If ListaRemisionesNC IsNot Nothing Then
|
||||
For Each ObjRNC As Modelos.Factura In ListaRemisionesNC
|
||||
Dim ListaNC As List(Of Modelos.Factura) = Nothing
|
||||
|
||||
If NCDescuento Then
|
||||
ListaNC = ListaNCDesc
|
||||
Else
|
||||
ListaNC = ListaRemisionesNC
|
||||
End If
|
||||
|
||||
If ListaNC IsNot Nothing Then
|
||||
For Each ObjRNC As Modelos.Factura In ListaNC
|
||||
If ObjRNC.TipoDocto = "RNC" Then
|
||||
importeMovimiento = ObjRNC.TotalRemNCAplicado * -1
|
||||
importeMX = importeMovimiento * tipoCambio * Multiplicador
|
||||
@@ -10101,7 +10130,7 @@ Partial Class Ventas
|
||||
|
||||
importeMovimiento = 0
|
||||
Case 150 'Descuento sobre ventas
|
||||
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") AndAlso Not EsNCAmortizacion Then
|
||||
If (ObjFactura.TipoDocto.Contiene("Egs", "Dev") AndAlso Not EsNCAmortizacion) OrElse NCDescuento Then
|
||||
|
||||
Dim ConceptoContableAplicar = 150
|
||||
Dim CveVentaAplicar = ObjFactura.CveVenta
|
||||
@@ -13537,6 +13566,8 @@ Partial Class Ventas
|
||||
Return False
|
||||
End If
|
||||
|
||||
'SI NO TIENE LA FUNCIONALIDAD VALIDARA LAS MONEDAS
|
||||
If Not UsuarioActual.Empresa.Funcionalidad(524) <> "" Then
|
||||
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count >= 1 Then
|
||||
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).Rows(0)
|
||||
If DrPS IsNot Nothing Then
|
||||
@@ -13546,8 +13577,10 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not UsuarioActual.TienePermisoProceso(169) Then ' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR
|
||||
' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR
|
||||
If Not UsuarioActual.TienePermisoProceso(169) Then
|
||||
'SOLO VALIDA EXISTENCIAS Y COSTO: SI USA INVENTARIOS, SOLO PRODUCTOS TIPO PRODUCTO, SOLO REMISIONES E INGRESOS
|
||||
If UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119))) Then
|
||||
Dim ObjInventarios As New ClsInventarios
|
||||
@@ -13836,6 +13869,13 @@ Partial Class Ventas
|
||||
UpINV.Update()
|
||||
UPPPS.Update()
|
||||
End Sub
|
||||
Private Sub CargaPorcentajeMarcas()
|
||||
Dim ObjPS As New ClsProductosServicios
|
||||
If ObjPS.GetPorcentajeMarcas(CveCliente) Then
|
||||
DtPorcentajeMarcas = ObjPS.DtResultados.Copy()
|
||||
End If
|
||||
ObjPS.Dispose()
|
||||
End Sub
|
||||
Private Function AgregarProductoServicio(Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String,
|
||||
PU As Decimal, Descuento As Decimal,
|
||||
CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String,
|
||||
@@ -13912,13 +13952,6 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ClienteDesglosaIEPS Then
|
||||
If Not RegeneraIEPS Then
|
||||
PU = PU * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal)
|
||||
End If
|
||||
DrPS("IEPSPorcentaje") = 0
|
||||
End If
|
||||
|
||||
'verifica si tiene ventaminima
|
||||
If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDecimal > 0 Then
|
||||
'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15...
|
||||
@@ -13928,6 +13961,56 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ClienteDesglosaIEPS Then
|
||||
If Not RegeneraIEPS Then
|
||||
PU = PU * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal)
|
||||
End If
|
||||
DrPS("IEPSPorcentaje") = 0
|
||||
End If
|
||||
|
||||
'VERIFICA SI APLICAN CONDICIONES COMERCIALES
|
||||
If DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then
|
||||
'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA
|
||||
If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then
|
||||
Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}")
|
||||
'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA
|
||||
If RowPorcentaje IsNot Nothing Then
|
||||
Dim PorcentajeProducto = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D
|
||||
Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D
|
||||
Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D
|
||||
|
||||
Dim TotalInicial = (Cantidad * (PU)) - Descuento
|
||||
Dim TotalFinal = TotalInicial
|
||||
'SI APLICA EL PRIMER DESCUENTO
|
||||
If PorcentajeProducto > 0 Then
|
||||
Dim Descuento1 = TotalInicial * PorcentajeProducto
|
||||
Dim Total2 = (TotalInicial - Descuento1)
|
||||
|
||||
'SI APLICA EL SEGUNDO DESCUENTO
|
||||
If PorcentajeProducto2 > 0 Then
|
||||
Dim Descuento2 = Total2 * PorcentajeProducto2
|
||||
Dim Total3 = (Total2 - Descuento2)
|
||||
|
||||
'SI APLICA EL TERCER DESCUENTO
|
||||
If PorcentajeProducto3 > 0 Then
|
||||
Dim Descuento3 = Total3 * PorcentajeProducto3
|
||||
TotalFinal = Total3 - Descuento3
|
||||
Else
|
||||
TotalFinal = Total3
|
||||
End If
|
||||
Else
|
||||
TotalFinal = Total2
|
||||
End If
|
||||
Else
|
||||
TotalFinal = TotalInicial
|
||||
End If
|
||||
|
||||
Descuento += ((Cantidad * PU) - TotalFinal)
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
|
||||
|
||||
Row("PU") = PU
|
||||
@@ -13960,8 +14043,6 @@ Partial Class Ventas
|
||||
|
||||
Row("IVA") = Row("PorcentajeIVA")
|
||||
Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
|
||||
|
||||
Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
|
||||
Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
|
||||
Row("PorcentajeRetIVA") = ClienteRetIVA
|
||||
@@ -14596,7 +14677,7 @@ Partial Class Ventas
|
||||
ConfiguraTipoDocto()
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True)
|
||||
Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True, Optional NCDescuento As Boolean = False)
|
||||
|
||||
Dim TotalSubTotal As Decimal = TmpDT.SUM("TotalImporte").ToDecimal
|
||||
Dim TotalDescuentos As Decimal = TmpDT.SUM("Descuento").ToDecimal
|
||||
@@ -15526,7 +15607,7 @@ Partial Class Ventas
|
||||
Cuerpo = Cuerpo.Replace("{""Fecha""}", TxtFecha.Text)
|
||||
Cuerpo = Cuerpo.Replace("{""Total""}", TxtTotal.Text)
|
||||
Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", TxtFechaPago.Text)
|
||||
Cuerpo = Cuerpo.Replace("{""SerieFolio""}", $"{LblSerie.Text} - {TxtFolio.Text}")
|
||||
Cuerpo = Cuerpo.Replace("{""SerieFolio""}", ObjFactura.SerieFolio)
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.AsuntoPlantillaMailVenta.Trim.Length > 0 Then
|
||||
@@ -16742,15 +16823,30 @@ Partial Class Ventas
|
||||
Private Function ValidaPagosContado() As Boolean
|
||||
Dim Retorno = False
|
||||
|
||||
If (UsuarioActual.CveEmpresa = 140) AndAlso (Not PermiteCredito) AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) And TxtTotal.Text.ToDecimal > 0 Then
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso (UsuarioActual.CveEmpresa = 140) AndAlso (Not PermiteCredito) AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) And TxtTotal.Text.ToDecimal > 0 Then
|
||||
Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then
|
||||
Dim TotalNC As Decimal = If(ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0, ListaNCDesc.Sum(Function(f) f.TotalRemNCAplicado), 0)
|
||||
If TotalNC > 0 Then
|
||||
If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TotalNC Then
|
||||
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = True
|
||||
End If
|
||||
Else
|
||||
If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then
|
||||
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = True
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then
|
||||
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = True
|
||||
End If
|
||||
End If
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
@@ -18474,7 +18570,7 @@ Partial Class Ventas
|
||||
strBody.AppendFormat(" <div id=""C_divOC"" style=""width: 630px""> <fieldset> <legend><b>Datos de {0}</b></legend> ", DdlTipoComprobante.SelectedItem.Text)
|
||||
strBody.Append(" <table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%""> ")
|
||||
strBody.Append(" <tr style=""height: 22px""> ")
|
||||
strBody.AppendFormat(" <td style=""width: 90px""> Serie-Folio:</td><td style=""width: 125px""><b>{0}-{1}</b></td> ", LblSerie.Text, TxtFolio.Text)
|
||||
strBody.AppendFormat(" <td style=""width: 90px""> Serie-Folio:</td><td style=""width: 125px""><b>{0}</b></td> ", ObjFactura.SerieFolio)
|
||||
strBody.Append(" </tr> ")
|
||||
strBody.Append(" <tr style=""height: 22px""> ")
|
||||
strBody.AppendFormat(" <td style=""width: 90px""> Empresa:</td><td colspan=""3""><b>{0}</b></td> ", UsuarioActual.Empresa.Empresa)
|
||||
@@ -20525,6 +20621,16 @@ Partial Class Ventas
|
||||
ObjMovtos.Dispose()
|
||||
GvRemisionesNC.DataBind()
|
||||
End Sub
|
||||
Private Sub CargaDescRNC()
|
||||
Dim ObjMovtos As New ClsMovimientos()
|
||||
If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, -1, TipoDocto:="RNC") Then
|
||||
GvDescNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento")
|
||||
End If
|
||||
ObjMovtos.Dispose()
|
||||
GvDescNC.DataBind()
|
||||
|
||||
UpDescNC.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvCxC_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
@@ -20561,8 +20667,13 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
AplicarNC(DdlNCPS.SelectedValue.ToEntero)
|
||||
|
||||
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlNCPS.SelectedValue.ToEntero).FiltroPrimero("")
|
||||
RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC")
|
||||
End Sub
|
||||
|
||||
Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False)
|
||||
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
If DrPS Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
@@ -20577,11 +20688,6 @@ Partial Class Ventas
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "Ant" Then CveAnticipo = CveVenta
|
||||
|
||||
DdlTipoComprobante.SelectedValueExist("Egs")
|
||||
|
||||
'CREAMOS DT PARA UTILIZAR AL TIMBRAR
|
||||
InicializaDTVentasNC()
|
||||
|
||||
@@ -20600,6 +20706,13 @@ Partial Class Ventas
|
||||
DtImpuestos.AcceptChanges()
|
||||
|
||||
If AplicaNCMasiva Then
|
||||
If NCDescuento Then
|
||||
For Each Gvr As GridViewRow In GvDescNC.Rows
|
||||
If Gvr.FCCheckBox("ChkAplicar").Checked Then
|
||||
DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal), True, MissingSchemaAction.Ignore)
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
For Each Gvr As GridViewRow In GvCxC.Rows
|
||||
If Gvr.FCCheckBox("ChkCxC").Checked Then
|
||||
DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal), True, MissingSchemaAction.Ignore)
|
||||
@@ -20607,6 +20720,7 @@ Partial Class Ventas
|
||||
CargaNCDT(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal)
|
||||
End If
|
||||
@@ -20634,16 +20748,25 @@ Partial Class Ventas
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
DtImpuestos = query.QueryToDataTable(False)
|
||||
|
||||
If Not NCDescuento Then
|
||||
LimpiaDocumentoNC()
|
||||
End If
|
||||
|
||||
Dim CveSubProyecto = DrSubProyecto("CveSubProyecto").ToString.ToEntero
|
||||
Dim SubProyecto = DrSubProyecto("SubProyecto").ToString
|
||||
Dim CveProyecto = DrSubProyecto("CveProyecto").ToString.ToEntero
|
||||
Dim Proyecto = DrSubProyecto("Proyecto").ToString
|
||||
|
||||
AplicaNC = True
|
||||
|
||||
If Not NCDescuento Then
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "Ant" Then CveAnticipo = CveVenta
|
||||
|
||||
DdlTipoComprobante.SelectedValueExist("Egs")
|
||||
|
||||
For Each Dr As DataRow In DtImpuestos.Rows
|
||||
AgregaTempDT(DrPS("CvePS").ToString.ToEntero, DrPS("PS").ToString, DrPS("Codigo").ToString, DrPS("PSCodigo").ToString, DrPS("CveTipoPS").ToString.ToEntero, DrPS("Inv_CveMetodoInventario").ToString.ToEntero,
|
||||
DrPS("CveUM").ToString.ToEntero, DrPS("UnidadMedida").ToString, DrPS("CveClasificacion").ToString.ToEntero, DrPS("Clasificacion").ToString, CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
|
||||
@@ -20652,22 +20775,19 @@ Partial Class Ventas
|
||||
DrPS("SATClavePS").ToString, DrPS("SATClaveUnidadMedida").ToString, -1, -1, -1, -1, -1, -1)
|
||||
Next
|
||||
|
||||
TrTipoRelacion.Visible = True
|
||||
DdlTiposRelacion.SelectedValueExist("1")
|
||||
|
||||
GvPS.DataSource = TmpDT
|
||||
GvPS.DataBind()
|
||||
|
||||
CalculaTotalesVenta(True)
|
||||
|
||||
|
||||
TrTipoRelacion.Visible = True
|
||||
DdlTiposRelacion.SelectedValueExist("1")
|
||||
|
||||
'condicióon, en la que se verifica que el importe total de aplicación de la nota de crédito sea igual al del total de la nota de crédito, ej. saldo de la factura 1000.01 y la nota de crédito se generó po 1000.00
|
||||
If Not AplicaNCMasiva Then
|
||||
Dim TT As Decimal = TxtNCImporte.Text.ToDecimal
|
||||
If TT > TxtTotal.Text.ToDecimal Then TT = TxtTotal.Text.ToDecimal
|
||||
CargaNCDT(CveVenta, TT)
|
||||
|
||||
End If
|
||||
'verifica el tipo de cambio que se actualice
|
||||
If DdlMoneda.SelectedValue <> "1" Then
|
||||
@@ -20677,11 +20797,10 @@ Partial Class Ventas
|
||||
UpPS.Update()
|
||||
|
||||
LBNotaCredito.Visible = False
|
||||
RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC")
|
||||
AplicaNC = True
|
||||
|
||||
CambiaTipoDocto()
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal) As DataTable
|
||||
@@ -20705,8 +20824,6 @@ Partial Class Ventas
|
||||
Else
|
||||
Total = TxtTotal.Text.ToDecimal
|
||||
SubTotal = TxtSubTotal.Text.ToDecimal
|
||||
|
||||
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
@@ -22082,7 +22199,10 @@ Partial Class Ventas
|
||||
Protected Sub BtnGuardarRemisiones_Click(sender As Object, e As EventArgs) Handles BtnGuardarRemisiones.Click
|
||||
If GvRem.Rows.Count > 0 Or GvRemPS.Rows.Count > 0 Then
|
||||
'Checa las facturas selecionadas
|
||||
VerificaRemisiones(DTRemisiones)
|
||||
If Not VerificaRemisiones(DTRemisiones) Then
|
||||
Alert("La cantidad/total debe ser mayor que 0", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim dtSeleccionadas As DataTable = DTRemisiones.FiltraParametros("Aplicado = True")
|
||||
Dim CveContrato = DTRemisiones.FiltroPrimeroValor("CveContrato", "Aplicado = True").ToEntero
|
||||
@@ -22252,8 +22372,17 @@ Partial Class Ventas
|
||||
|
||||
RegistraScript("$('#DivRemisiones').modal('hide');", "DivRemisionesHide")
|
||||
End Sub
|
||||
Private Sub VerificaRemisiones(ByRef dt As DataTable)
|
||||
Private Function VerificaRemisiones(ByRef dt As DataTable) As Boolean
|
||||
Dim Valido As Boolean = True
|
||||
If ChkRemProductos.Checked Then
|
||||
|
||||
Valido = Not (From GvRow In GvRemPS.Rows.Cast(Of GridViewRow)
|
||||
Let Cantidad = GvRow.FCTextBox("TxtCantidadRem").Text.Trim().ToEntero(), Aplicar = GvRow.FCCheckBox("Chk").Checked
|
||||
Where GvRow.RowType = DataControlRowType.DataRow AndAlso Cantidad <= 0 AndAlso Aplicar
|
||||
Select GvRow
|
||||
).Any
|
||||
|
||||
If Valido Then
|
||||
For Each Gvr As GridViewRow In GvRemPS.Rows
|
||||
If Gvr.RowType = DataControlRowType.DataRow Then
|
||||
Dim ChkAplicar As CheckBox = Gvr.FCCheckBox("Chk")
|
||||
@@ -22265,6 +22394,8 @@ Partial Class Ventas
|
||||
dt.AcceptChanges()
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Else
|
||||
For Each Gvr As GridViewRow In GvRem.Rows
|
||||
If Gvr.RowType = DataControlRowType.DataRow Then
|
||||
@@ -22278,7 +22409,9 @@ Partial Class Ventas
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Return Valido
|
||||
End Function
|
||||
Private Sub CargaConceptosRemisionPorFacturar(CveRemisiones As String, TipoCargas As Integer)
|
||||
Dim ObjClientes As New ClsClientes
|
||||
If ObjClientes.GetVentasRemisionesTotales(CveCliente, CveRemisiones, TipoCargas) Then
|
||||
@@ -22898,7 +23031,7 @@ Partial Class Ventas
|
||||
CambiaTipoDocto()
|
||||
CambiaSucursalGeneral()
|
||||
CargaAnticipos(CveCliente)
|
||||
CargaRestriccionesCreditoCliente()
|
||||
CargaRestriccionesCreditoCliente(CveVenta:=-1)
|
||||
UpParametros.Update()
|
||||
|
||||
End Sub
|
||||
@@ -23295,4 +23428,158 @@ Partial Class Ventas
|
||||
RegistraScript("CerrarModalRemNC();")
|
||||
|
||||
End Sub
|
||||
Protected Sub LnkDescuentosRNC_Click(sender As Object, e As EventArgs)
|
||||
CargaDescRNC()
|
||||
RegistraScript("$('#ModalAplicarDescuentoNC').modal('show'); ")
|
||||
End Sub
|
||||
Protected Sub BtnAplicarDesc_Click(sender As Object, e As EventArgs)
|
||||
Dim CveSATNC = "84111506"
|
||||
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).Rows(0)
|
||||
|
||||
If DrPS Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
AplicaNCMasiva = True
|
||||
|
||||
If ListaNCDesc Is Nothing Then
|
||||
ListaNCDesc = New List(Of Modelos.Factura)
|
||||
Else
|
||||
ListaNCDesc.Clear()
|
||||
End If
|
||||
|
||||
Dim TotalRemNCAplicado As Decimal = 0
|
||||
For Each GvRow As GridViewRow In GvDescNC.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
If GvRow.FCCheckBox("ChkAplicar").Checked Then
|
||||
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
|
||||
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
|
||||
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
|
||||
|
||||
If RemNC.TotalRemNCAplicado <= 0 Then
|
||||
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
|
||||
ListaNCDesc.Clear()
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
ListaNCDesc.Add(RemNC)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
LblDescuentosRNC.Text = TotalRemNCAplicado.FormatoNumero
|
||||
LblTotalNC.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado).FormatoNumero
|
||||
|
||||
Dim CvePS = DrPS("CvePS").ToString().ToEntero()
|
||||
|
||||
AplicarNC(CvePS, True)
|
||||
|
||||
UpPS.Update()
|
||||
|
||||
RegistraScript("$('#ModalAplicarDescuentoNC').modal('hide'); ")
|
||||
End Sub
|
||||
|
||||
Protected Function CreaDTDetalleNCDescuento() As DataTable
|
||||
Dim Dt As DataTable = TmpDT.Clone()
|
||||
Dt.Rows.Clear()
|
||||
|
||||
Dim CveSATNC = "84111506"
|
||||
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).Rows(0)
|
||||
|
||||
If DrPS Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||||
Return Dt
|
||||
End If
|
||||
Dim CvePS = DrPS("CvePS").ToString().ToEntero()
|
||||
|
||||
Dim TotalCalculableImpuestos As Decimal = 0
|
||||
Dim PU = Math.Round(ListaNCDesc.Sum(Function(RNC) RNC.TotalRemNCAplicado), 6) ' el precio unitario puede llevar hasta 6 decimales permitidos
|
||||
Dim Cantidad As Decimal = 1
|
||||
Dim Descuento As Decimal = 0
|
||||
|
||||
Dim Row As DataRow = Dt.NewRow()
|
||||
Row("CveProyecto") = DdlProyecto.SelectedValue.ToEntero()
|
||||
Row("Proyecto") = DdlProyecto.SelectedItem.Text
|
||||
Row("CveSubProyecto") = DdlSubProyecto.SelectedValue.ToEntero()
|
||||
Row("SubProyecto") = DdlSubProyecto.SelectedItem.Text
|
||||
Row("SerieLote") = "-1"
|
||||
Row("TiempoEntrega") = ""
|
||||
Row("Orden") = Dt.Rows.Count + 1
|
||||
Row("Cantidad") = Cantidad
|
||||
Row("CveUM") = DrPS("CveUM").ToString().ToEntero()
|
||||
Row("UM") = ""
|
||||
Row("CveClasificacion") = DrPS("CveClasificacion").ToString().ToEntero()
|
||||
Row("Clasificacion") = ""
|
||||
Row("CvePS") = CvePS
|
||||
Row("Obs") = ""
|
||||
|
||||
TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
|
||||
|
||||
Row("PU") = PU
|
||||
Row("Codigo") = DrPS("Codigo")
|
||||
Row("NoIdentificacion") = DrPS("Codigo")
|
||||
Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria")
|
||||
Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana")
|
||||
Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion")
|
||||
Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion")
|
||||
|
||||
If Modalidad = "U" Then
|
||||
Row("Consec") = Index
|
||||
Else
|
||||
Row("Consec") = TmpDT.Rows.Count + 1
|
||||
End If
|
||||
|
||||
Row("PS") = DrPS("PS")
|
||||
Row("CodigoPS") = DrPS("PSCodigo").ToString
|
||||
Row("CveTipoPS") = DrPS("CveTipoPS")
|
||||
Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario")
|
||||
Row("CveTamaño") = DrPS("CveTamaño")
|
||||
Row("CveClasificacion") = DrPS("CveClasificacion")
|
||||
Row("Clasificacion") = DrPS("Clasificacion")
|
||||
|
||||
If DrPS("IVA").ToString.Contiene("-1", "") Then
|
||||
Row("PorcentajeIVA") = PorcentajeIVA
|
||||
Else
|
||||
Row("PorcentajeIVA") = DrPS("IVA")
|
||||
End If
|
||||
|
||||
Row("IVA") = Row("PorcentajeIVA")
|
||||
Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
|
||||
Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
|
||||
Row("PorcentajeRetIVA") = ClienteRetIVA
|
||||
Row("PorcentajeRetISR") = ClienteRetISR
|
||||
Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje")
|
||||
Row("ImporteIEPS") = Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
Row("IEPS") = Row("ImporteIEPS")
|
||||
Row("Descuento") = Math.Round(Descuento, NumeroDecimales)
|
||||
Row("TipoDescuento") = HdnTipoDescuento.Value
|
||||
Row("Total") = (Cantidad * PU)
|
||||
Row("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales)
|
||||
|
||||
Row("SATClaveProdServ") = DrPS("SATClavePS")
|
||||
Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
|
||||
|
||||
If UsuarioActual.Empresa.UsaAC Then
|
||||
Row("CvePresupuestoIngreso") = Me.DdlFuenteRecaudacion.SelectedValue
|
||||
End If
|
||||
|
||||
Row("EntregaDirecta") = -1
|
||||
'Contratos
|
||||
Row("CveContratoDetalle") = -1
|
||||
Row("CveVentaDetalle") = -1
|
||||
Row("CveMovimientoDetallePedido") = -1
|
||||
Row("CveOrdenCompraDetalle") = -1
|
||||
Row("CveVentaDetalleRemision") = -1
|
||||
Row("CveVentaDetalleCotizacion") = -1
|
||||
Row("CveVentaDetallePedido2") = -1
|
||||
Row("CuentaPredial") = "-1"
|
||||
Row("Consec") = 1
|
||||
|
||||
'RECARGAR GV
|
||||
Dt.Rows.Add(Row)
|
||||
|
||||
Return Dt
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user