diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb
index c71136040..4021301ca 100644
--- a/App_Code/Modelos.vb
+++ b/App_Code/Modelos.vb
@@ -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
diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb
index 02afc5da6..053edf302 100644
--- a/Compras/PopUpVerFactura.aspx.vb
+++ b/Compras/PopUpVerFactura.aspx.vb
@@ -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), "")))
diff --git a/Compras/Proveedores.aspx b/Compras/Proveedores.aspx
index 9ec425df3..bcbcf062c 100644
--- a/Compras/Proveedores.aspx
+++ b/Compras/Proveedores.aspx
@@ -3136,7 +3136,7 @@
-
+
<%----%>
<%----%>
@@ -3489,7 +3489,7 @@
-
+
<%-- --%>
diff --git a/Inventarios/RecepcionAlmacen.aspx b/Inventarios/RecepcionAlmacen.aspx
index 60f5a4f91..fe8ca46d5 100644
--- a/Inventarios/RecepcionAlmacen.aspx
+++ b/Inventarios/RecepcionAlmacen.aspx
@@ -408,7 +408,8 @@
-
+
diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb
index 62d095024..9b59e3357 100644
--- a/Inventarios/RecepcionAlmacen.aspx.vb
+++ b/Inventarios/RecepcionAlmacen.aspx.vb
@@ -8,8 +8,8 @@ Imports System.IO
Imports System.Linq
Partial Class Inventarios_RecepcionAlmacen
- Inherits ClsPaginas
-
+ Inherits ClsPaginas
+
#Region "PROPIEDADES"
Private Shared missing As Object = System.Reflection.Missing.Value
Private Property EstatusInicial As String
@@ -353,9 +353,10 @@ Partial Class Inventarios_RecepcionAlmacen
Set(value As Integer)
ViewState("CveVendedor") = value
End Set
- End Property
+ End Property
+
#End Region
-
+
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
@@ -367,9 +368,9 @@ Partial Class Inventarios_RecepcionAlmacen
CargaPermisos()
End If
- End Sub
-
-
+ End Sub
+
+
#Region " PERMISOS PAGINAS "
Private Sub CargaPermisos()
@@ -384,9 +385,9 @@ Partial Class Inventarios_RecepcionAlmacen
'SECCION ALMACEN EXISTENCIAS
GvInv.Columns(11).Visible = UsuarioActual.Empresa.Funcionalidad(563).ToString = "1"
- End Sub
+ End Sub
#End Region
-
+
#Region " INICIALIZA VALORES "
Private Sub InicializaValores()
CveCompraParametro = -1
@@ -498,9 +499,9 @@ Partial Class Inventarios_RecepcionAlmacen
UpFiltros.Update()
- End Sub
+ End Sub
#End Region
-
+
#Region " CARGA URL PARAMETROS "
Private Sub CargaUrlParametros()
@@ -532,9 +533,9 @@ Partial Class Inventarios_RecepcionAlmacen
End If
- End Sub
+ End Sub
#End Region
-
+
#Region " MODALIDAD RECEPCION "
Protected Sub DdlTipo_SelectedIndexChanged(sender As Object, e As EventArgs)
ModalidadRecepcion()
@@ -571,11 +572,11 @@ Partial Class Inventarios_RecepcionAlmacen
CargaFoliosRecepcion()
- End Sub
-
-
+ End Sub
+
+
#End Region
-
+
#Region " CARGA FOLIOS RECEPCION "
Protected Sub ddlProveedor_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlProveedor.selectedindexchange
CargaFoliosRecepcion()
@@ -664,9 +665,9 @@ Partial Class Inventarios_RecepcionAlmacen
DdlFletes.DataBind()
DdlFletes.Items.Insert(0, New ListItem("Seleccione", "-1"))
- End Sub
+ End Sub
#End Region
-
+
#Region " CARGA POR SURTIR - GV "
Protected Sub TimmerRefresh_Tick(sender As Object, e As EventArgs)
CargaPendientes()
@@ -730,9 +731,9 @@ Partial Class Inventarios_RecepcionAlmacen
End If
End If
- End Sub
+ End Sub
#End Region
-
+
#Region " CARGA POR SURTIR "
Protected Sub btnBuscar_Click(sender As Object, e As EventArgs) Handles BtnBuscar.Click
@@ -1053,9 +1054,9 @@ Partial Class Inventarios_RecepcionAlmacen
CargaGVInv()
- End Sub
+ End Sub
#End Region
-
+
#Region " GVINV "
Private Sub CreaDTInv(TmDT As DataTable)
TmDT.Columns.Add("CveAlmacen", GetType(Integer))
@@ -1182,11 +1183,11 @@ Partial Class Inventarios_RecepcionAlmacen
End If
- End Sub
+ End Sub
#End Region
-
+
#Region " AGREGAR "
-
+
#Region " AGREGA CON TXT | CODIGO - SERIE "
Protected Sub BtnCodigoPS_Click(sender As Object, e As EventArgs)
@@ -1292,9 +1293,9 @@ Partial Class Inventarios_RecepcionAlmacen
End If
TxtCantidadEspecialDiv.Text = "1"
- End Sub
+ End Sub
#End Region
-
+
#Region " AGREGA POR SERIE/LOTE "
Protected Sub BtnSerieLote_Click(sender As Object, e As EventArgs)
@@ -1524,10 +1525,10 @@ Partial Class Inventarios_RecepcionAlmacen
DtDatosDetalle.AcceptChanges()
CargaSerie(1)
- End Sub
-
+ End Sub
+
#End Region
-
+
#Region " AGREGAR POR LOTE BATCH "
Private Sub CreaDtLoteDetalle()
If DtDatosLoteDetalle Is Nothing Then
@@ -1692,11 +1693,11 @@ Partial Class Inventarios_RecepcionAlmacen
DtDatosLoteDetalle.AcceptChanges()
CargaLote(1)
- End Sub
+ End Sub
#End Region
-
+
#End Region
-
+
#Region " GUARDAR "
Private Function ValidaGuardar() As Boolean
@@ -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
@@ -2649,6 +2653,12 @@ Partial Class Inventarios_RecepcionAlmacen
link = String.Format("{1}", MovtosEntrada(index), FoliosEntrada(index))
Msg.AppendFormat(" Movimiento de Entrada por Traspaso: Folio: {0} ", link)
Next
+ End If
+
+ 'VIRTUAL
+ If CveMovimientoVirtual > 0 Then
+ link = String.Format("{1}", CveMovimientoVirtual, FolioVirtual)
+ Msg.AppendFormat(" Movimiento de Entrada al Almacen Virtal: Folio: {0}", link)
End If
'CONTABILIDAD
@@ -2947,9 +2957,9 @@ Partial Class Inventarios_RecepcionAlmacen
End Sub
Private Function GuardaPrePoliza() As Boolean
Return True
- End Function
+ End Function
#End Region
-
+
#Region " OC "
Private Sub CargaFoliosOC()
DdlFolioOC.Items.Clear()
@@ -3122,10 +3132,10 @@ Partial Class Inventarios_RecepcionAlmacen
UpDatosCompra.Update()
- End Sub
-
+ End Sub
+
#End Region
-
+
#Region " TIPO DE CAMBIO "
Protected Sub DdlMonedaTC_SelectedIndexChanged(sender As Object, e As EventArgs)
Select Case DdlMonedaTC.SelectedValue.ToEntero
@@ -3167,13 +3177,13 @@ Partial Class Inventarios_RecepcionAlmacen
Dr("CostoIndirecto") = Dr("CostoIndirectoExtranjero").ToString.ToDouble * TipoCambio
Next
DtInv.AcceptChanges()
- End Sub
-
-
+ End Sub
+
+
#End Region
-
+
#Region " BITACORA "
-
+
Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvBitacora.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("Archivo").ToString.Trim <> "" AndAlso -1 > 0 Then
@@ -3289,9 +3299,9 @@ Partial Class Inventarios_RecepcionAlmacen
Next
Return Retorno
- End Function
+ End Function
#End Region
-
+
#Region " FINANCIAMIENTO - AC "
Protected Sub CargaAC()
Dim Cont As New ClsContPAQi(UsuarioActual.Empresa)
@@ -3318,10 +3328,10 @@ Partial Class Inventarios_RecepcionAlmacen
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", String.Format("ValidaImporte(this, {0});", e.Row.DBCampo("PorDevengar")))
e.Row.FCRangeValidator("RVA").MaximumValue = e.Row.DBCampo("PorDevengar").FormatoNumero
End If
- End Sub
-
+ End Sub
+
#End Region
-
+
#Region " ENVIA CORREO NOTICIACION - VENDEDOR "
Private Sub MandaCorreoOCVendedores(CveCompra As Integer, CveMovimiento As Integer)
@@ -3423,19 +3433,11 @@ Partial Class Inventarios_RecepcionAlmacen
Next
- End Sub
+ End Sub
#End Region
-
-
-
-
-
-
-
-
-
+
#Region "Imprimir PDF/Excel"
-
+
Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
ImprimiReporte("EXCEL")
End Sub
@@ -3462,14 +3464,11 @@ Partial Class Inventarios_RecepcionAlmacen
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
ImprimirPDF(RutaPDF, dt, params, "Reporte de Entrada Almacén", Formato:=Formato)
- End Sub
-
-
+ End Sub
+
+
#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
@@ -3516,10 +3515,10 @@ Partial Class Inventarios_RecepcionAlmacen
TbCantidadAlm.Text = ""
ddlAlmacenAdd.SelectedIndex = 0
- End Sub
-
+ End Sub
+
#End Region
-
+
#Region "SECCION ALMACEN"
Private Sub CreaDtSeccionAlmacen()
DtSeccionAlmacen = New DataTable
@@ -3595,10 +3594,8 @@ Partial Class Inventarios_RecepcionAlmacen
DtSeccionAlmacen.Rows.RemoveAt(Index)
DtSeccionAlmacen.AcceptChanges()
CargaSeccionAlmacen()
- End Sub
-
+ End Sub
+
#End Region
-
-
-
+
End Class
diff --git a/Inventarios/RecepcionEntrega.aspx b/Inventarios/RecepcionEntrega.aspx
index 5dd948d5c..ebcb39af7 100644
--- a/Inventarios/RecepcionEntrega.aspx
+++ b/Inventarios/RecepcionEntrega.aspx
@@ -329,8 +329,18 @@
+
+ <%--ADVERTENCIA--%>
+
+
+
+
+ Información:
+
+
+
-
+
@@ -346,7 +356,6 @@
-
@@ -408,7 +417,8 @@
<%--GV DATOS--%>
-
+
diff --git a/Inventarios/RecepcionEntrega.aspx.vb b/Inventarios/RecepcionEntrega.aspx.vb
index f291d9842..b7b78daae 100644
--- a/Inventarios/RecepcionEntrega.aspx.vb
+++ b/Inventarios/RecepcionEntrega.aspx.vb
@@ -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(" Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoGarantia)))
End If
+ 'VIRTUAL
+ If CveMovimientoVirtual > 0 Then
+ Msg.AppendFormat(" Movimiento de Salida del Almacen Virtal: Folio : ")
+ Msg.AppendFormat("{1}", CveMovimientoVirtual, FolioVirtual)
+ End If
+
'If CveMovimientoSalidaDevRem > 0 Then
- ' Msg.AppendFormat("
Movimiento de salida de devolución (Traspaso): {1}", CveMovimientoSalidaDevRem, FolioMovimientoSalidaDevRem)
+ ' Msg.AppendFormat(" < br /<> br /> Movimiento de salida de devolución (Traspaso): {1}", CveMovimientoSalidaDevRem, FolioMovimientoSalidaDevRem)
' Msg.AppendFormat(" Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalidaDevRem)))
' Msg.AppendFormat("
Movimiento de entrada de devolución (Traspaso): {1}", CveMovimientoEntradaDevRem, FolioMovimientoEntradaDevRem)
diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb
index 747e1a705..38308c5a7 100644
--- a/Inventarios/TraspasoAlmacen.aspx.vb
+++ b/Inventarios/TraspasoAlmacen.aspx.vb
@@ -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
diff --git a/Planeacion/CatSubProyectos.aspx b/Planeacion/CatSubProyectos.aspx
index b5c442439..77216b445 100644
--- a/Planeacion/CatSubProyectos.aspx
+++ b/Planeacion/CatSubProyectos.aspx
@@ -83,7 +83,7 @@
diff --git a/Planeacion/CatSubProyectos.aspx.vb b/Planeacion/CatSubProyectos.aspx.vb
index 22121f394..0c13a7096 100644
--- a/Planeacion/CatSubProyectos.aspx.vb
+++ b/Planeacion/CatSubProyectos.aspx.vb
@@ -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"))
diff --git a/Ventas/RepRecuperacion.aspx.vb b/Ventas/RepRecuperacion.aspx.vb
index 4312dec0d..ab5d4b57b 100644
--- a/Ventas/RepRecuperacion.aspx.vb
+++ b/Ventas/RepRecuperacion.aspx.vb
@@ -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.DataBind()
+ DdlBanco.Items.Insert(0, New ListItem("Todos", "-1"))
+ DdlBanco.Items.Add(New ListItem("Empresa", "0"))
'Carga Clasificacion Cliente'
Dim ObjCliente As New ClsClientes
@@ -178,10 +179,8 @@ Partial Class Ventas_RepRecuperacion
#Region "SELECTED INDEX CHANGE"
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.Items.Clear()
+ DdlCuentaBancaria.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario).FiltraParametros($"CveBanco = {DdlBanco.SelectedValue.ToEntero}")
DdlCuentaBancaria.Items.Insert(0, New ListItem("Todos", "-1"))
DdlCuentaBancaria.DataBind()
End Sub
diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx
index 564021c75..96819d0d4 100644
--- a/Ventas/Ventas.aspx
+++ b/Ventas/Ventas.aspx
@@ -1279,81 +1279,99 @@
@@ -7463,24 +7540,24 @@
$('#divAgregarCliente').modal('hide');
}
- function CompararNC() {
- var TotalRem = ToDouble(document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').value);
- var TotalNC = ToDouble(document.getElementById('<%= TxtNCImporte.ClientID %>').value);
-
- if (TotalRem == TotalNC) {
- document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.border = "2px solid #04B431";
- document.getElementById('<%= TxtNCImporte.ClientID %>').style.border = "2px solid #04B431";
- document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.color = "";
- document.getElementById('<%= TxtNCImporte.ClientID %>').style.color = "";
-
- }
- else {
-
- document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.border = "2px solid #ff0000";
- document.getElementById('<%= TxtNCImporte.ClientID %>').style.border = "2px solid #ff0000";
- document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.color = "#ff0000";
- document.getElementById('<%= TxtNCImporte.ClientID %>').style.color = "#ff0000";
- }
+ function CompararNC() {
+ var TotalRem = ToDouble(document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').value);
+ var TotalNC = ToDouble(document.getElementById('<%= TxtNCImporte.ClientID %>').value);
+
+ if (TotalRem == TotalNC) {
+ document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.border = "2px solid #04B431";
+ document.getElementById('<%= TxtNCImporte.ClientID %>').style.border = "2px solid #04B431";
+ document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.color = "";
+ document.getElementById('<%= TxtNCImporte.ClientID %>').style.color = "";
+
+ }
+ else {
+
+ document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.border = "2px solid #ff0000";
+ document.getElementById('<%= TxtNCImporte.ClientID %>').style.border = "2px solid #ff0000";
+ document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.color = "#ff0000";
+ document.getElementById('<%= TxtNCImporte.ClientID %>').style.color = "#ff0000";
+ }
}
function CerrarModalRemNC() {
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index b452d4b3d..a1b16c5ae 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -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
- EmitirImprimir()
+ 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
- Dim Obj2 As New List(Of Object)
-
+ '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)
-
- Try
- If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing, Nothing) 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 (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse NCDescuento Then
+ Try
+ 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
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,15 +7215,33 @@ Partial Class Ventas
ObjFacturaDevolucion.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim
ObjFacturaDevolucion.MonedaAbreviatura = ""
+ '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
+ ObjFacturaDevolucion.IVA = TxtIVA.Text.ToDecimal
+ ObjFacturaDevolucion.RetIVA = TxtRetIVA.Text.ToDecimal
+ ObjFacturaDevolucion.RetISR = TxtRetISR.Text.ToDecimal
+ ObjFacturaDevolucion.IEPS = TxtIEPS.Text.ToDecimal
+ ObjFacturaDevolucion.Total = TxtTotal.Text.ToDecimal
+ End If
'Totales, Y se llena TmpDTImpuestos
- ObjFacturaDevolucion.SubTotal = TxtSubTotal.Text.ToDecimal
- ObjFacturaDevolucion.Descuento = LblDescuentos.Text.Trim.ToDecimal
- ObjFacturaDevolucion.Amortizacion = LblAmortizacion.Text.Trim.ToDecimal
- ObjFacturaDevolucion.IVA = TxtIVA.Text.ToDecimal
- ObjFacturaDevolucion.RetIVA = TxtRetIVA.Text.ToDecimal
- ObjFacturaDevolucion.RetISR = TxtRetISR.Text.ToDecimal
- ObjFacturaDevolucion.IEPS = TxtIEPS.Text.ToDecimal
- ObjFacturaDevolucion.Total = TxtTotal.Text.ToDecimal
'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,91 +7378,10 @@ Partial Class Ventas
DT.Dispose()
End If
- '** genero los datos de la NC
- Dim tmpcon As DataTable = TmpDT.Clone
- tmpcon.Clear()
-
- Dim drpss As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlNCPSAnt.SelectedValue.ToEntero).FiltroPrimero("")
-
- If drpss IsNot Nothing Then
- Dim ii As Integer = 1
- Dim CveVentaP As Integer = 0
- For Each gvrt As GridViewRow In GVAnticipos.Rows
- If gvrt.FCCheckBox(String.Format("Chk{0}", gvrt.RowIndex)).Checked Then
- Dim CveSub As Integer = TmpDT.FiltroPrimeroValor("CveSubProyecto").ToEntero
- Dim dr As DataRow = tmpcon.NewRow
- Dim Cantidad As Decimal = 1
- Dim PU As Decimal = gvrt.FCTextBox(String.Format("TxtAnticipo{0}", gvrt.RowIndex)).Text.ToDecimal
- Dim TotalCalculableImpuestos As Decimal = (Cantidad * (PU))
- dr("CvePS") = drpss("CvePS")
- dr("PS") = drpss("PS")
- dr("OBS") = drpss("PS")
- dr("PU") = PU
- dr("Cantidad") = Cantidad
- dr("CveUM") = drpss("CveUnidadMedida")
- dr("SATClaveProdServ") = "84111506"
- dr("SATClaveUM") = "ACT"
- dr("Consec") = ii
-
- If drpss("IVA").ToString = "-1" Then
- dr("PorcentajeIVA") = PorcentajeIVA ' GlobalDTSubProyectos(-1,cves DrPS("IVA")
- Else
- dr("PorcentajeIVA") = drpss("IVA")
- End If
-
- dr("IVA") = dr("PorcentajeIVA")
- dr("ImporteIVA") = Math.Round(dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
- dr("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
- dr("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
- dr("PorcentajeRetIVA") = ClienteRetIVA
- dr("PorcentajeRetISR") = ClienteRetISR
- If UsuarioActual.Empresa.Funcionalidad(343) = "1" Then
- dr("PorcentajeIEPS") = drpss("IEPSPorcentaje")
- dr("ImporteIEPS") = Math.Round(drpss("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
- Else
- dr("PorcentajeIEPS") = 0 ' DrPS("IEPSPorcentaje")
- dr("ImporteIEPS") = 0 'Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
- End If
-
- dr("IEPS") = dr("ImporteIEPS")
- dr("Descuento") = Math.Round(0, NumeroDecimales)
- dr("TipoDescuento") = HdnTipoDescuento.Value
- dr("Total") = (Cantidad * PU)
- dr("CveClasificacion") = drpss("CveClasificacion")
- dr("CveSubProyecto") = CveSub
- dr("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales)
- CveVentaP = gvrt.DataKey("CveVenta").ToEntero
- tmpcon.Rows.Add(dr)
- ii += 1
- End If
-
- Next
-
- '**** impuestos locales
-
- factura.DtDetalle = tmpcon
- Dim TotalSubTotal As Decimal = tmpcon.SUM("TotalImporte").ToDecimal
- Dim TotalDescuentos As Decimal = tmpcon.SUM("Descuento").ToDecimal
-
- Dim TotalIVA As Decimal = tmpcon.SUM("ImporteIVA").ToDecimal
- Dim TotalIEPS As Decimal = tmpcon.SUM("ImporteIEPS").ToDecimal
- Dim TotalRetIVA As Decimal = tmpcon.SUM("ImporteRetIVA").ToDecimal
- Dim TotalRetISR As Decimal = tmpcon.SUM("ImporteRetISR").ToDecimal
- Dim Total As Decimal = 0
- Dim TotalImpuestosLocales As Decimal = 0
- Total = (TotalSubTotal - TotalDescuentos + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales)
-
- factura.SubTotal = TotalSubTotal
- factura.Descuento = 0
- factura.IVA = TotalIVA
- factura.IEPS = TotalIEPS
- factura.RetIVA = TotalRetIVA
- factura.RetISR = TotalRetISR
- factura.Total = Total
- factura.CveVentaPadre = CveVentaP
+ If NCDescuento Then
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
- DtVentasNC.Rows(0)("Importe") = Total
+ DtVentasNC.Rows(0)("Importe") = factura.Total
DtVentasNC.Rows(0)("TC") = factura.TipoCambio
DtVentasNC.Rows(0)("TCCambioValuacion") = factura.TipoCambio
End If
@@ -7439,36 +7389,107 @@ Partial Class Ventas
ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
'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
+ GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True, NCDescuento:=True)
Else
- ErrorList.Add("No se encontró un producto para generar la nota de crédito")
- End If
+ 'GENERO LOS DATOS DE LA NC
+ Dim tmpcon As DataTable = TmpDT.Clone
+ tmpcon.Clear()
+ Dim drpss As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlNCPSAnt.SelectedValue.ToEntero).FiltroPrimero("")
+
+ If drpss IsNot Nothing Then
+ Dim ii As Integer = 1
+ Dim CveVentaP As Integer = 0
+ For Each gvrt As GridViewRow In GVAnticipos.Rows
+ If gvrt.FCCheckBox(String.Format("Chk{0}", gvrt.RowIndex)).Checked Then
+ Dim CveSub As Integer = TmpDT.FiltroPrimeroValor("CveSubProyecto").ToEntero
+ Dim dr As DataRow = tmpcon.NewRow
+ Dim Cantidad As Decimal = 1
+ Dim PU As Decimal = gvrt.FCTextBox(String.Format("TxtAnticipo{0}", gvrt.RowIndex)).Text.ToDecimal
+ Dim TotalCalculableImpuestos As Decimal = (Cantidad * (PU))
+ dr("CvePS") = drpss("CvePS")
+ dr("PS") = drpss("PS")
+ dr("OBS") = drpss("PS")
+ dr("PU") = PU
+ dr("Cantidad") = Cantidad
+ dr("CveUM") = drpss("CveUnidadMedida")
+ dr("SATClaveProdServ") = "84111506"
+ dr("SATClaveUM") = "ACT"
+ dr("Consec") = ii
+
+ If drpss("IVA").ToString = "-1" Then
+ dr("PorcentajeIVA") = PorcentajeIVA ' GlobalDTSubProyectos(-1,cves DrPS("IVA")
+ Else
+ dr("PorcentajeIVA") = drpss("IVA")
+ End If
+
+ dr("IVA") = dr("PorcentajeIVA")
+ dr("ImporteIVA") = Math.Round(dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
+ dr("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
+ dr("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
+ dr("PorcentajeRetIVA") = ClienteRetIVA
+ dr("PorcentajeRetISR") = ClienteRetISR
+ If UsuarioActual.Empresa.Funcionalidad(343) = "1" Then
+ dr("PorcentajeIEPS") = drpss("IEPSPorcentaje")
+ dr("ImporteIEPS") = Math.Round(drpss("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
+ Else
+ dr("PorcentajeIEPS") = 0 ' DrPS("IEPSPorcentaje")
+ dr("ImporteIEPS") = 0 'Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
+ End If
+
+ dr("IEPS") = dr("ImporteIEPS")
+ dr("Descuento") = Math.Round(0, NumeroDecimales)
+ dr("TipoDescuento") = HdnTipoDescuento.Value
+ dr("Total") = (Cantidad * PU)
+ dr("CveClasificacion") = drpss("CveClasificacion")
+ dr("CveSubProyecto") = CveSub
+ dr("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales)
+ CveVentaP = gvrt.DataKey("CveVenta").ToEntero
+ tmpcon.Rows.Add(dr)
+ ii += 1
+ End If
+
+ Next
+
+ '**** IMPUESTOS LOCALES
+
+ factura.DtDetalle = tmpcon
+ Dim TotalSubTotal As Decimal = tmpcon.SUM("TotalImporte").ToDecimal
+ Dim TotalDescuentos As Decimal = tmpcon.SUM("Descuento").ToDecimal
+
+ Dim TotalIVA As Decimal = tmpcon.SUM("ImporteIVA").ToDecimal
+ Dim TotalIEPS As Decimal = tmpcon.SUM("ImporteIEPS").ToDecimal
+ Dim TotalRetIVA As Decimal = tmpcon.SUM("ImporteRetIVA").ToDecimal
+ Dim TotalRetISR As Decimal = tmpcon.SUM("ImporteRetISR").ToDecimal
+ Dim Total As Decimal = 0
+ Dim TotalImpuestosLocales As Decimal = 0
+ Total = (TotalSubTotal - TotalDescuentos + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales)
+
+ factura.SubTotal = TotalSubTotal
+ factura.Descuento = 0
+ factura.IVA = TotalIVA
+ factura.IEPS = TotalIEPS
+ factura.RetIVA = TotalRetIVA
+ factura.RetISR = TotalRetISR
+ factura.Total = Total
+ factura.CveVentaPadre = CveVentaP
+
+ If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
+ DtVentasNC.Rows(0)("Importe") = 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, tmpcon, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True)
+
+ 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. 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
@@ -9563,37 +9584,37 @@ Partial Class Ventas
'APLICA NC SALDOS DIRECTOS
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
- For Each Dr As DataRow In DtVentasNC.Rows
+ For Each Dr As DataRow In DtVentasNC.Rows
- Dim Importe91 As Decimal = 0
- Dim ImporteMN91 As Decimal = 0
- Dim Importe251 As Decimal = 0
- Dim ImporteMN251 As Decimal = 0
+ Dim Importe91 As Decimal = 0
+ Dim ImporteMN91 As Decimal = 0
+ Dim Importe251 As Decimal = 0
+ Dim ImporteMN251 As Decimal = 0
- If DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
- Importe251 = Dr("Importe").ToString.ToDecimal
- Importe91 = Dr("Importe").ToString.ToDecimal
- ImporteMN91 = Dr("Importe").ToString.ToDecimal
- TipoCambioNC = 1
- ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
- Importe251 = Dr("Importe").ToString.ToDecimal
- Importe91 = Dr("Importe").ToString.ToDecimal
- ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
- ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
- Importe251 = Dr("Importe").ToString.ToDecimal
- Importe91 = Dr("Importe").ToString.ToDecimal
- ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
- ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
+ If DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
+ Importe251 = Dr("Importe").ToString.ToDecimal
+ Importe91 = Dr("Importe").ToString.ToDecimal
+ ImporteMN91 = Dr("Importe").ToString.ToDecimal
+ TipoCambioNC = 1
+ ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
+ Importe251 = Dr("Importe").ToString.ToDecimal
+ Importe91 = Dr("Importe").ToString.ToDecimal
+ ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
+ ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
+ Importe251 = Dr("Importe").ToString.ToDecimal
+ Importe91 = Dr("Importe").ToString.ToDecimal
+ ImporteMN91 = Dr("Importe").ToString.ToDecimal * TipoCambioNC
+ ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
- Importe91 = Dr("Importe").ToString.ToDecimal / TipoCambioNC
- ImporteMN91 = Dr("Importe").ToString.ToDecimal
- End If
+ Importe91 = Dr("Importe").ToString.ToDecimal / TipoCambioNC
+ ImporteMN91 = Dr("Importe").ToString.ToDecimal
+ End If
- Dim TCFluctuacion As Decimal = Dr("TCCambioValuacion").ToString.ToDecimal
- If TCFluctuacion = 1 AndAlso TipoCambioNC > 1 Then
- TCFluctuacion = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
- End If
+ Dim TCFluctuacion As Decimal = Dr("TCCambioValuacion").ToString.ToDecimal
+ If TCFluctuacion = 1 AndAlso TipoCambioNC > 1 Then
+ TCFluctuacion = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
+ End If
If DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
@@ -9614,93 +9635,93 @@ Partial Class Ventas
CveUltimaVenta = Dr("CveVenta").ToString.ToEntero
- Dim ImporteComplementarioIngreso As Decimal = 0
- If UsaComplementariaClientes = True AndAlso tipoCambio > 1 Then
- ImporteMN91 = Importe91
- ImporteComplementarioIngreso = ((Importe91 * tipoCambio) - Importe91).RoundSQL
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteComplementarioIngreso, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
- ErrorPrepoliza = True
- Exit For
- End If
- End If
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
+ Dim ImporteComplementarioIngreso As Decimal = 0
+ If UsaComplementariaClientes = True AndAlso tipoCambio > 1 Then
+ ImporteMN91 = Importe91
+ ImporteComplementarioIngreso = ((Importe91 * tipoCambio) - Importe91).RoundSQL
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 203, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteComplementarioIngreso, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
ErrorPrepoliza = True
Exit For
End If
- ImporteAcumulado91 += (ImporteMN91).RoundSQL
-
- If UsaComplementariaClientes = True AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
- ImporteMN251 = Importe251
- Dim ImporteComplementarioNC As Decimal = ((Importe251 * Dr("TCCambioValuacion").ToString.ToDecimal) - Importe251).RoundSQL
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementarioNC, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
- ErrorPrepoliza = True
- Exit For
- End If
- End If
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal, TipoCambioPago:=tipoCambio) Then
- ErrorPrepoliza = True
- Exit For
- End If
-
-
- 'considero fluctuación.
-
-
- If TipoCambioNC <> TCFluctuacion AndAlso TCFluctuacion > 1 AndAlso TipoCambioNC > 1 Then
- Dim difFluctuacion As Decimal = TipoCambioNC - TCFluctuacion
- Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
- Dim TipoMovtoFluctua As Boolean = True
- Dim IdCtaContableFluctua As Integer
- If difFluctuacion < 0 Then
- CveConceptoFluctua = 65
- TipoMovtoFluctua = False
- IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
- CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
- Else
- CveConceptoFluctua = 64
- TipoMovtoFluctua = True
- IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
- CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
- End If
- Dim ImporteFluctuacion As Decimal = Math.Abs((Importe251 * difFluctuacion).RoundSQL)
-
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=TipoCambioNC, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal, CveCuenta:=CveCuenta) Then
- ErrorPrepoliza = True
- Exit For
- End If
- End If
-
- Next
-
- If ImporteConcepto12 < ImporteAcumulado91 Then
- Dim ImporteOtrosIngresos As Decimal = ImporteConcepto12 - ImporteAcumulado91
- If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteOtrosIngresos, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveUltimaVenta, ImporteMX:=ImporteOtrosIngresos, ImporteME:=0, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ImporteOtrosIngresos, Referencia, 211, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteME:=0, ImporteMX:=ImporteOtrosIngresos, CveSubProyecto:=CveSubProyectoContabilizar) Then
- ErrorPrepoliza = True
- End If
- Else
- ErrorPrepoliza = True
- End If
End If
-
- If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5) Then
- If ObjConta.ValorPolizaDescuadre > 0 Then
- 'ErrorPrepoliza = True
- GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
-
- 'SIRVE PARA VER LA PREPOLIZA QUE SE VALIDA
- 'If ObjConta.GetPrePolizasDetalle(ObjFactura.CvePrePoliza) Then
- ' Dim DtTest = ObjConta.DtResultados
- 'End If
- End If
- End If
-
-
- If ErrorPrepoliza Then
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe91, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteMN91, ImporteME:=If(tipoCambio = 1, 0, Importe91), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
+ ErrorPrepoliza = True
Exit For
End If
+ ImporteAcumulado91 += (ImporteMN91).RoundSQL
+
+ If UsaComplementariaClientes = True AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
+ ImporteMN251 = Importe251
+ Dim ImporteComplementarioNC As Decimal = ((Importe251 * Dr("TCCambioValuacion").ToString.ToDecimal) - Importe251).RoundSQL
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 207, Concepto, FechaMovimiento, IdCtaContableClienteComplementaria, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteComplementarioNC, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
+ End If
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString.ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString.ToDecimal, TipoCambioPago:=tipoCambio) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
+
+
+ 'considero fluctuación.
+
+
+ If TipoCambioNC <> TCFluctuacion AndAlso TCFluctuacion > 1 AndAlso TipoCambioNC > 1 Then
+ Dim difFluctuacion As Decimal = TipoCambioNC - TCFluctuacion
+ Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
+ Dim TipoMovtoFluctua As Boolean = True
+ Dim IdCtaContableFluctua As Integer
+ If difFluctuacion < 0 Then
+ CveConceptoFluctua = 65
+ TipoMovtoFluctua = False
+ IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
+ CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
+ Else
+ CveConceptoFluctua = 64
+ TipoMovtoFluctua = True
+ IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
+ CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
+ End If
+ Dim ImporteFluctuacion As Decimal = Math.Abs((Importe251 * difFluctuacion).RoundSQL)
+
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString.ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=TipoCambioNC, TipoCambioPago:=Dr("TCCambioValuacion").ToString.ToDecimal, CveCuenta:=CveCuenta) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
+ End If
+
+ Next
+
+ If ImporteConcepto12 < ImporteAcumulado91 Then
+ Dim ImporteOtrosIngresos As Decimal = ImporteConcepto12 - ImporteAcumulado91
+ If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteOtrosIngresos, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveUltimaVenta, ImporteMX:=ImporteOtrosIngresos, ImporteME:=0, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio) Then
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ImporteOtrosIngresos, Referencia, 211, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteME:=0, ImporteMX:=ImporteOtrosIngresos, CveSubProyecto:=CveSubProyectoContabilizar) Then
+ ErrorPrepoliza = True
+ End If
+ Else
+ ErrorPrepoliza = True
+ End If
End If
+ If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5) Then
+ If ObjConta.ValorPolizaDescuadre > 0 Then
+ 'ErrorPrepoliza = True
+ GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
+
+ 'SIRVE PARA VER LA PREPOLIZA QUE SE VALIDA
+ 'If ObjConta.GetPrePolizasDetalle(ObjFactura.CvePrePoliza) Then
+ ' Dim DtTest = ObjConta.DtResultados
+ 'End If
+ End If
+ End If
+
+
+ If ErrorPrepoliza Then
+ Exit For
+ End If
+ End If
+
'APLICA DEVOLUCION SALDOS DIRECTOS
If AplicaDevolucion Then
Dim importeMovimientoDev = TxtTotal.Text.ToDecimal
@@ -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,17 +13566,21 @@ Partial Class Ventas
Return False
End If
- 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
- If DrPS("CveMoneda").ToString.ToEntero <> DdlMoneda.SelectedValue.ToEntero Then
- Alert("No puede agregar un producto de diferente moneda a la ya seleccionada", TipoMensaje.MsgAdvertencia)
- Return False
+ '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
+ If DrPS("CveMoneda").ToString.ToEntero <> DdlMoneda.SelectedValue.ToEntero Then
+ Alert("No puede agregar un producto de diferente moneda a la ya seleccionada", TipoMensaje.MsgAdvertencia)
+ Return False
+ 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
@@ -14274,784 +14355,784 @@ Partial Class Ventas
#End Region
#End Region
-#Region "M E T O D O S"
- Private Sub CargaOtrosConceptos()
- Dim ObjVentas As New ClsVentas
- If ObjVentas.GetVentaOtrosConceptos(UsuarioActual.CveEmpresa, CveVenta) Then
- GVOtrosConceptos.DataSource = ObjVentas.DtResultados
- GVOtrosConceptos.DataBind()
- UpOtrosConceptos.Update()
- End If
- ObjVentas.Dispose()
- End Sub
- Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, factura As Modelos.Factura, Optional CancelacionIngreso As Boolean = False) As Integer
- Dim Retorno As Integer = 0
- Dim IDPoliza As Integer = 0
-
- Dim ErrorAC As Boolean = False
- 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL()
- Dim Fecha As Date = factura.Fecha
- Dim Concepto As String = String.Format("GD {0}", factura.Cliente.Nombre)
- Dim Paridad As Integer = 1
- Dim TipoMovto As Boolean = False
-
- If CancelacionIngreso Then
- Concepto = String.Format("Cancelación GD {0}", factura.Cliente.Nombre)
- Paridad = -1
- TipoMovto = True
- End If
-
- Dim TipoPoliza = If(factura.TipoDocto = "OP" Or factura.TipoDocto = "Com", 3, 1)
-
- IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, factura.Total * 2, factura.Total * 2, factura.CveUsuario, Fecha)
- Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue))
- 'Dim Importe As Double = TxtTotal.Text.ToDouble
- Dim CtaCliente As Integer = factura.Cliente.IdCtaContClientes
- Dim CtaISSSTESON As Integer = 643
- Dim CtaISPT As Integer = 1745
- ' Dim NombreCliente As String = ViewState("NombreCliente").ToString
-
- If IDPoliza > 0 Then
-
- 'Orden de PAGO
- If factura.TipoDocto = "OP" Then
-
- If DdlOrdenPago.SelectedValue.ToEntero = 1 Then
- 'ISSSTESON
-
- If ObjAC.AddMovimiento(IDPoliza, factura.Cliente.IdCtaContClientes, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
- If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
-
- Else
- 'ISPT
-
- If ObjAC.AddMovimiento(IDPoliza, factura.Cliente.IdCtaContClientes, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
- If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- End If
-
- ' NORMAL
- Else
- Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)()
- Group gvr By Grp = New With {
- Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero
- } Into Group
- Select Grp.CvePresupuestoIngreso,
- TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble)
-
-
- 'Select Case TipoComprobante
- ' Case "Ing", "Egs"
- For Each grp In Detalles
- dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso))
- Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString, TxtFolio.Text)
-
- If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- 'CARGO la deuda del cliente
- If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- 'abono,
- If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- Next
-
- 'Case "OP", "Com"
- ' Dim Importe As Decimal = 0
- ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, False, Importe, "", Concepto, 0, Fecha, "") Then
- ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, True, Importe, "", Concepto, 0, Fecha, "") Then
-
- ' End If
- ' End If
- 'End Select
- End If
-
- Else
- ErrorAC = True
-
- End If
-
- If Not ErrorAC Then
- ObjAC.AjustaPoliza(IDPoliza)
-
- Retorno = IDPoliza
- Else
-
- Alert("Error al agregar la Póliza de AC.", TipoMensaje.MsgError)
- End If
-
- ' ObjAC.Dispose()
-
- Return Retorno
-
- End Function
- Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, Optional CancelacionIngreso As Boolean = False) As Integer
- Dim Retorno As Integer = 0
- Dim IDPoliza As Integer = 0
-
- Dim ErrorAC As Boolean = False
- 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL()
- Dim Fecha As Date = TxtFecha.Text.ToDate
- Dim Concepto As String = String.Format("GD {0}", NombreCliente)
- Dim Paridad As Integer = 1
- Dim TipoMovto As Boolean = False
-
- If CancelacionIngreso Then
- Concepto = String.Format("Cancelación GD {0}", NombreCliente)
- Paridad = -1
- TipoMovto = True
- End If
-
- Dim TipoPoliza = If(DdlTipoComprobante.SelectedValue.ToString = "OP" Or DdlTipoComprobante.SelectedValue.ToString = "Com", 3, 1)
-
- IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, TxtTotal.Text.ToDouble * 2, TxtTotal.Text.ToDouble * 2, UsuarioActual.CveUsuario, Fecha)
- Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue))
- 'Dim Importe As Double = TxtTotal.Text.ToDouble
- Dim CtaCliente As Integer = ViewState("IdCtaContClientes").ToString.ToEntero
- Dim CtaISSSTESON As Integer = 643
- Dim CtaISPT As Integer = 1745
- ' Dim NombreCliente As String = ViewState("NombreCliente").ToString
-
- If IDPoliza > 0 Then
-
- 'Orden de PAGO
- If DdlTipoComprobante.SelectedValue.ToString = "OP" Then
-
- If DdlOrdenPago.SelectedValue.ToEntero = 1 Then
- 'ISSSTESON
-
- If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
- If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
-
- Else
- 'ISPT
-
- If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
- If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- End If
-
- ' NORMAL
- Else
- Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)()
- Group gvr By Grp = New With {
- Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero
- } Into Group
- Select Grp.CvePresupuestoIngreso,
- TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble)
-
-
- 'Select Case TipoComprobante
- ' Case "Ing", "Egs"
- For Each grp In Detalles
- dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso))
- Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString, TxtFolio.Text)
-
- If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- 'CARGO la deuda del cliente
- If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- 'abono,
- If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- Else
- ErrorAC = True
- End If
- Next
-
- 'Case "OP", "Com"
- ' Dim Importe As Decimal = 0
- ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, False, Importe, "", Concepto, 0, Fecha, "") Then
- ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, True, Importe, "", Concepto, 0, Fecha, "") Then
-
- ' End If
- ' End If
- 'End Select
- End If
-
- Else
- ErrorAC = True
-
- End If
-
- If Not ErrorAC Then
- ObjAC.AjustaPoliza(IDPoliza)
-
- Retorno = IDPoliza
- Else
-
- Alert("Error al Agregar la Póliza de AC.", TipoMensaje.MsgError)
- End If
-
- ' ObjAC.Dispose()
-
- Return Retorno
-
- End Function
- Private Sub SetValues()
- ViewState("TipoCambio") = 1
-
- If UsuarioActual.Empresa.MostrarRetIVA Then TrRetIVA.Style.Add("display", "")
- If UsuarioActual.Empresa.MostrarRetISR Then TrRetISR.Style.Add("display", "")
-
- If UsuarioActual.CveEmpresa.Contiene(72, 80) Then ' agregar en el modal de PS. que forme el código del producto
- TxtPS.Enabled = False
- DivDdlTipo.Visible = True
- DivTxtModelo.Visible = True
- DivTxtAdicional.Visible = True
- DdlTipo.Attributes.Add("onChange", "CreaDescripcionPS();")
- DdlMarcaPSDes.Attributes.Add("onChange", "CreaDescripcionPS();")
- TxtModelo.Attributes.Add("onKeyUp ", "CreaDescripcionPS();")
- TxtAdicional.Attributes.Add("onKeyUp ", "CreaDescripcionPS();")
-
- CargaClasificacionesDetalles()
- ClasificacionModal()
-
- End If
-
- If Not UsuarioActual.CveEmpresa.Contiene(1, 119) Then 'PAGO CON TERMINAL PARA JAM
- RBLPago.Items.RemoveAt(2)
- End If
-
-
- End Sub
- Private Sub SetPermisos()
- If CveVenta < 1 Then
- 'Puede cotizar
- If Not UsuarioActual.TienePermisoProceso(59) Then
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Cot"))
- End If
-
- 'Puede Hacer NC
- If Not UsuarioActual.TienePermisoProceso(175) Then
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs"))
- End If
-
- 'Puede Hacer Devolución
- If Not UsuarioActual.TienePermisoProceso(264) Then
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev"))
- End If
-
- 'Puede facturar
- If Not UsuarioActual.TienePermisoProceso(60) Then
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs"))
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev"))
- End If
-
- 'Puede remisionar
- If Not UsuarioActual.TienePermisoProceso(199) Then
- DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
- LnkFacturarRemision.Visible = False
- LnkRemisiones.Visible = False
- End If
-
- '[IPP]: FALTA CONFIGURAR Y DAR PERMISO A TODOS LOS QUE TENGAN ACCESO A VENTAS
- ''Puede remisionar
- 'If Not UsuarioActual.TienePermisoProceso(199) Then
- ' DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
- 'End If
-
- ''MODO SOLO LECTURA
- 'If DdlTipoComprobante.Items.Count = 0 Then
- ' DdlTipoComprobante.Items.Insert(0, New ListItem("Solo lectura", "-1"))
- ' TrBotones.Visible = False
- 'End If
-
- ConfiguraTipoDocto()
- End If
- End Sub
- Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True)
-
- Dim TotalSubTotal As Decimal = TmpDT.SUM("TotalImporte").ToDecimal
- Dim TotalDescuentos As Decimal = TmpDT.SUM("Descuento").ToDecimal
- Dim TotalAmortizacion As Decimal = LblAmortizacion.Text.ToDecimal
- Dim TotalIVA As Decimal = TmpDT.SUM("ImporteIVA").ToDecimal
- Dim TotalIEPS As Decimal = TmpDT.SUM("ImporteIEPS").ToDecimal
- Dim TotalRetIVA As Decimal = TmpDT.SUM("ImporteRetIVA").ToDecimal
- Dim TotalRetISR As Decimal = TmpDT.SUM("ImporteRetISR").ToDecimal
- Dim Total As Decimal = 0
- Dim TotalImpuestosLocales As Decimal = 0
-
- If TotalAmortizacion > 0 AndAlso TotalSubTotal = TotalAmortizacion Then ' si se amortizó completa la factura, debe de limpiar los impuestos
- If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("3") Then
- For Each dr As DataRow In TmpDT.Rows
- dr("ImporteIVA") = 0 : dr("ImporteIEPS") = 0 : dr("ImporteRetIVA") = 0 : dr("ImporteRetISR") = 0 : dr("PorcentajeIVA") = 0 : dr("IVA") = 0
- Next
-
- If TmpDTImpuestos IsNot Nothing Then
- For Each dr2 As DataRow In TmpDTImpuestos.Rows
- dr2("Importe") = 0
- Next
- TmpDTImpuestos.AcceptChanges()
- End If
-
- TmpDT.AcceptChanges()
- TotalIVA = TmpDT.SUM("ImporteIVA").ToDecimal
- TotalIEPS = TmpDT.SUM("ImporteIEPS").ToDecimal
- TotalRetIVA = TmpDT.SUM("ImporteRetIVA").ToDecimal
- TotalRetISR = TmpDT.SUM("ImporteRetISR").ToDecimal
- TotalImpuestosLocales = TmpDTImpuestos.SUM("Importe").ToDecimal
- End If
- End If
-
- If RecalculaImpuestosLocales AndAlso TmpDTImpuestos IsNot Nothing AndAlso TmpDTImpuestos.Rows.Count > 0 Then
- If TotalSubTotal <> TotalAmortizacion Then
- For Each drt As DataRow In TmpDTImpuestos.Rows
- drt("Importe") = drt("Porcentaje").ToString.ToDecimal * TotalSubTotal / 100
- Next
- End If
-
- GvImpuestosLocales2.DataSource = TmpDTImpuestos
- GvImpuestosLocales2.DataBind()
- End If
-
- For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
- If gvr.RowType = DataControlRowType.DataRow Then
-
- If gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal > 0 Then
- If gvr.DataKey("TipoImpuesto") = "5" Then ' traslado de imp local
- TotalImpuestosLocales -= gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal
- Else
- TotalImpuestosLocales += gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal
- End If
- End If
- End If
- Next
-
- 'If TotalDescuentos > 0 Then GvPS.Columns(ColumnaDescuento).Visible = True : thEncDesc1.Visible = True : thEncDesc2.Visible = True Else GvPS.Columns(ColumnaDescuento).Visible = False : thEncDesc1.Visible = False : thEncDesc2.Visible = False
- If TotalIEPS > 0 Then TrIEPS.Visible = True : GvPS.Columns(ColumnaIEPS).Visible = True : thEncIEPS1.Visible = True : thEncIEPS2.Visible = True Else TrIEPS.Visible = False : GvPS.Columns(ColumnaIEPS).Visible = False : thEncIEPS1.Visible = False : thEncIEPS2.Visible = False
- If TotalRetIVA > 0 Then GvPS.Columns(ColumnaRetIVA).Visible = True Else GvPS.Columns(ColumnaRetIVA).Visible = False
- If TotalRetISR > 0 Then GvPS.Columns(ColumnaRetISR).Visible = True Else GvPS.Columns(ColumnaRetISR).Visible = False
-
- If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero.Contiene(2, 1) Then
- TotalAmortizacion = 0
- End If
-
-
- Total = (TotalSubTotal - TotalDescuentos - TotalAmortizacion + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales)
- LblSubTotal1.Text = TotalSubTotal.FormatoNumero(2)
- TxtSubTotal.Text = TotalSubTotal.FormatoNumero(2)
- LblDescuentos.Text = TotalDescuentos.FormatoNumero
- TxtSubTotal2.Text = (TotalSubTotal - TotalDescuentos - TotalAmortizacion).FormatoNumero(2)
- TxtRetIVA.Text = TotalRetIVA.FormatoNumero(2)
- TxtRetISR.Text = TotalRetISR.FormatoNumero(2)
- TxtIVA.Text = TotalIVA.FormatoNumero
- TxtIEPS.Text = TotalIEPS.FormatoNumero
- TxtTotal.Text = Total.FormatoNumero
-
- LblAmort.Text = TxtSubTotal.Text
- If CveVenta <= 0 OrElse (CveDevolucion > 0 And NuevaFactura = 1) Then
- HdnVentaSaldo.Value = Total.ToString
- Else
- HdnVentaSaldo.Value = SaldoVenta.ToString
- End If
- HdnIVAOriginal.Value = TxtIVA.Text
-
- 'JJMQ 20160506: Se agrego para la validacion de pago de contado.
- 'CVImporteContado.ValueToCompare = Total.ToString
-
- If MensajeCveSAT IsNot Nothing AndAlso MensajeCveSAT.ToString.Length > 0 Then
- Alert($"Los siguientes conceptos hace falta especificar clave SAT
{MensajeCveSAT.ToString}", TipoMensaje.MsgAdvertencia)
- MensajeCveSAT.Clear()
- End If
-
- Dim view As DataView = New DataView(TmpDT)
- view.Sort = "Consec"
- GvPS.DataSource = view
- GvPS.DataBind()
-
- 'RECARGA GV INVENTARIO
- If Not CveVenta > 0 Or DdlTipoComprobante.SelectedValue = "Cot" Then
- DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
- CargaGVInv(DtInv)
- End If
-
- UpContado.Update()
- UpPS.Update()
- RegistraScript("BorraDescuentos();", "BorraDescuentos")
- End Sub
- Private Function ValidaAdendaFEMSA() As Boolean
- Dim Retorno As Boolean = False
-
- If Not AplicaFEMSA Then
- Retorno = True
- Else
- If TxtFEMSA_Version.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_Version.Text.Trim) Then
- Retorno = False
- Alert("La versión de la Adenda es requerida y debe ser numérica. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- ElseIf TxtFEMSA_NumSociedad.Text.Trim.Length = 0 Then
- Retorno = False
- Alert("El número de Sociedad para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
- ElseIf TxtFEMSA_NumProveedor.Text.Trim.Length = 0 Then
- Retorno = False
- Alert("El número de Proveedor para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
- ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso (TxtFEMSA_NumPedido.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_NumPedido.Text.Trim)) Then
- Retorno = False
- Alert("El número de Pedido para la Adenda es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso (TxtFEMSA_NumEntrada.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_NumEntrada.Text.Trim)) Then
- Retorno = False
- Alert("El número de Entrada para la Adenda es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso TxtFEMSA_NumRemision.Text.Trim.Length = 0 Then
- Retorno = False
- Alert("El número de Remisión para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
- ElseIf TxtFEMSA_Mail.Text.Trim.Length = 0 Then
- Retorno = False
- Alert("El Mail para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
- Else
- Retorno = True
- End If
- End If
-
- Return Retorno
- End Function
- Private Function ValidaComplementoDetallista() As Boolean
- Dim Retorno As Boolean = False
-
- If Not AplicaDetallista Then
- Retorno = True
- Else
- If TxtDet_OrdenCompra.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_OrdenCompra.Text.Trim) Then
- Retorno = False
- Alert("El campo Orden de Compra es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia, "")
- ElseIf TxtDet_FechaOrdenCompra.Text.Trim.Length = 0 OrElse Not IsDate(TxtDet_FechaOrdenCompra.Text.Trim) Then
- Retorno = False
- Alert("El campo Fecha de Orden de Compra es requerido y debe de contar con un formato válido de fecha. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- ElseIf TxtDet_GLNComprador.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_GLNComprador.Text.Trim) Then
- Retorno = False
- Alert("El campo GLN-Comprador es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- ElseIf TxtDet_Departamento.Text.Trim.Length = 0 Then
- Retorno = False
- Alert("El campo Departamento es requerido. Por favor ingrese uno.", TipoMensaje.MsgAdvertencia)
- ElseIf TxtDet_GLNVendedor.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_GLNVendedor.Text.Trim) Then
- Retorno = False
- Alert("El campo GLN-Vendedor es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- ElseIf TxtDet_NumProv.Text.Trim.Length = 0 Then
- Retorno = False
- Alert("El campo Número de Proveedor es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- Else
- Retorno = True
- End If
- End If
-
- Return Retorno
- End Function
- Private Function ValidaComplementoFord() As Boolean
- Dim Retorno As Boolean = False
-
- If Not AplicaFord Then
- Retorno = True
- Else
- If TxtFordGSDB.Text.Trim.Length = 0 Then
- Retorno = False
- Alert("El campo GSDB es requerido. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- Else
- If LstFordASN.Items.Count = 0 Then
- Retorno = True
- 'Alert("El campo ASN es requerido. Por favor corrija.", TipoMensaje.MsgAdvertencia)
- Else
- Retorno = True
- End If
-
- End If
- End If
-
- Return Retorno
- End Function
- Private Sub VinculaCotizacionVenta()
- Dim ObjVentas As New ClsVentas()
- ObjVentas.UpdateVentaCotizacion(CveVenta, Request("CveVenta").ToEntero)
- ObjVentas.Dispose()
- End Sub
- Private Sub GeneraAddenda7Eleven(Archivo As String)
- Dim cfdi As String = ""
- Dim SB As New StringBuilder
- Try
- Using sr As New StreamReader(Archivo)
-
- cfdi = sr.ReadToEnd()
-
- End Using
- Catch e As Exception
- Alert("The file could not be read:", TipoMensaje.MsgError)
-
- End Try
-
-
- cfdi = cfdi.Replace("", "")
-
- SB.Append(cfdi)
-
- SB.Append("")
- SB.AppendFormat("", Txt7ElevenNumProveedor.Text.Trim)
- SB.AppendFormat("", Txt7ElevenFolio.Text.Trim, Txt7ElevenTienda.Text.Trim, Txt7ElevenFecha.Text.Trim.ToDate.ToString("yyyy-MM-dd"))
-
- For Each Row As DataRow In TmpDT.Rows
-
- SB.AppendFormat("", Row("Codigo"), Row("PS"), Row("Cantidad").ToString.ToDouble.FormatoNumero(), Row("PU").ToString.ToDouble.FormatoNumero())
-
- Next
-
- SB.Append("")
-
-
- Using outfile As New StreamWriter(Archivo)
- outfile.Write(SB.ToString())
- End Using
-
- 'Exit Sub
-
-
-
- 'Dim MyXmlDocument As New XmlDocument()
-
- 'MyXmlDocument.Load("C:/Temp/aaa.xml")
- 'Dim nsmgr = New XmlNamespaceManager(MyXmlDocument.NameTable)
- 'nsmgr.AddNamespace("cfdi", "http://www.sat.gob.mx/cfd/3")
- 'Dim ParentElement As XmlElement = MyXmlDocument.CreateElement("cfdi:Addenda", "https://edixcfisecure.ekomercio.com/esquemas")
- 'ParentElement.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")
- 'ParentElement.SetAttribute("xsi:schemaLocation", "https://edixcfisecure.ekomercio.com/esquemas https:/edixcfdisecure.ekomercio.com/esquemas/7Eleven.xsd")
-
- 'Dim Prov As XmlElement = MyXmlDocument.CreateElement("cfdi:Proveedor", "")
- 'Prov.SetAttribute("Clave", "3125")
-
- 'Dim ns As String = "cfdi" 'MyXmlDocument.DocumentElement.GetNamespaceOfPrefix("cfdi")
- 'Dim Recepciones As XmlElement = MyXmlDocument.CreateElement("cfdi:Recepciones")
- 'Recepciones.Prefix = "cfdi"
- 'Dim Recepcion As XmlElement = MyXmlDocument.CreateElement("cfdi:Recepcion")
- 'Recepcion.SetAttribute("folio", Txt7ElevenFolio.Text.Trim)
- 'Recepcion.SetAttribute("tienda", Txt7ElevenTienda.Text.Trim)
- 'Recepcion.SetAttribute("fecha", Txt7ElevenFecha.Text.Trim.ToDate.ToString("yyyy-dd-MM"))
-
- 'Dim Productos As XmlElement = MyXmlDocument.CreateElement("cfdi:Productos")
- ''dentro de un ciclo
- 'Dim Producto As XmlElement = MyXmlDocument.CreateElement("cfdi:Producto")
- 'Producto.SetAttribute("codigo", "cod1")
- 'Producto.SetAttribute("descripcion", "prod1")
- 'Producto.SetAttribute("cantidad", "99")
- 'Producto.SetAttribute("precio", "2000")
- 'Productos.AppendChild(Producto)
- ''fin de ciclo
-
- 'Recepcion.AppendChild(Productos)
-
- 'Recepciones.AppendChild(Recepcion)
-
- 'ParentElement.AppendChild(Prov)
-
- 'ParentElement.AppendChild(Recepciones)
-
-
- 'MyXmlDocument.DocumentElement.AppendChild(ParentElement)
- 'MyXmlDocument.Save("C:/Temp/aa.xml")
-
- End Sub
- Protected Sub DdlFuenteRecaudacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFuenteRecaudacion.SelectedIndexChanged
- For Each dr As DataRow In TmpDT.Rows
- dr("CvePresupuestoIngreso") = DdlFuenteRecaudacion.SelectedValue
- Next
-
- GvPS.DataSource = TmpDT
- GvPS.DataBind()
-
- UpPS.Update()
- End Sub
- Protected Sub DdlFR_SelectedIndexChanged(sender As Object, e As EventArgs)
- Dim DdlFR_Gv As DropDownList = CType(sender, DropDownList)
- Dim index As Integer = CType(DdlFR_Gv.NamingContainer, GridViewRow).FCLiteral("LtlConsecutivo").Text.ToString.ToEntero
-
- If UsuarioActual.Empresa.UsaAC Then
- TmpDT(index - 1)("CvePresupuestoIngreso") = DdlFR_Gv.SelectedValue
- End If
- TmpDT.AcceptChanges()
- End Sub
- Protected Sub LnkASN_Click(sender As Object, e As EventArgs) Handles LnkASN.Click
- If TxtFordASN.Text.Trim.Length > 20 Then Alert("Maximo 20 Caracteres", TipoMensaje.MsgAdvertencia) : Exit Sub
- LstFordASN.Items.Add(New ListItem(TxtFordASN.Text.Trim))
- TxtFordASN.Text = ""
- TxtFordASN.Focus()
- End Sub
- Protected Sub LnkFordQuitar_Click(sender As Object, e As EventArgs) Handles LnkFordQuitar.Click
- LstFordASN.Items.RemoveAt(LstFordASN.SelectedIndex)
-
- End Sub
- Private Sub LnkImprimir_Click(sender As Object, e As EventArgs) Handles LnkImprimir.Click
- GeneraPDFCot(TxtFecha.Text.Trim.ToDate, Nothing, VentaFolio, False, False)
- End Sub
- Protected Sub TxtCodigo_TextChanged(sender As Object, e As System.EventArgs) Handles TxtCodigo.TextChanged
-
- Dim ObjClientes As New ClsClientes()
-
- Dim Nombre As String = "-1"
- Dim Codigo As String = "-1"
- Dim NombreCorto As String = "-1"
- Dim RFC As String = "-1"
- Dim Telefono As String = "-1"
- Dim Mail As String = "-1"
-
- If TxtCodigo.Text.Trim <> String.Empty Then Codigo = TxtCodigo.Text.Trim
-
- If Codigo <> "-1" Then
- If ObjClientes.GetClientes(-1, Nombre, Codigo, NombreCorto, RFC, Telefono, Mail, -1, UsuarioActual.CveEmpresa, TipoCliente:=-1) Then
- If ObjClientes.DtResultados.Rows.Count > 0 Then
- If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not ObjClientes.CveCliente.Contiene(10450, 10460, 10458) Then
- TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : LnkAgregarPyME.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False
- UpFacturar.Update()
- Exit Sub
- ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not ObjClientes.CveCliente.Contiene(27448) Then
- TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : LnkAgregarPyME.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False
- UpFacturar.Update()
- Exit Sub
- Else
- HdnCveCliente.Value = ObjClientes.CveCliente.ToString
- End If
- BtnBuscarCliente_Click(sender, e)
- Else
- Alert("No se encontró el cliente con el código: " & TxtCodigo.Text.Trim & ".", Extensiones.TipoMensaje.MsgAdvertencia)
- TxtCodigo.Text = ""
- LblCliente.Text = "Cliente"
- LblDireccion.Text = "Dirección"
- LblColonia.Text = "Colonia"
- LblCiudad.Text = "Ciudad"
- LblEstado.Text = "Estado"
- LblCP.Text = "00000"
- LblRFC.Text = "AAA010101AAA"
- LblTelefono.Text = "9999999999"
- trsucursalciente.Visible = False
- End If
- End If
- ObjClientes.Dispose()
-
- End If
- End Sub
- Protected Sub TxtFolio_TextChanged(sender As Object, e As System.EventArgs) Handles TxtFolio.TextChanged
- ViewState("EstablecioFolio") = True
- End Sub
- Private Sub ConfiguraTipoDocto()
-
- 'Esconde Todo
- TdOrdenPago.Visible = False
- Tr33.Visible = False
-
- 'si tiene la funcionalidad que se active independiente del tipo de documento RMF 15-10-2017
- Tr33.Visible = True
-
- If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") Then
- BtnEmitirImprimir.Text = "Emitir e Imprimir"
- 'TdReferencia.Style.Add("display", "none")
- ElseIf DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Then
- BtnEmitirImprimir.Text = "Emitir e Imprimir"
- 'TdReferencia.Style.Remove("display")
- ElseIf DdlTipoComprobante.SelectedValue = "Rem" Then
- BtnEmitirImprimir.Text = "Registrar"
- 'TdReferencia.Style.Add("display", "none")
- ElseIf DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC", "PA", "Pd2") Then
- BtnEmitirImprimir.Text = "Registrar"
- 'TdReferencia.Style.Add("display", "none")
- ElseIf DdlTipoComprobante.SelectedValue = "Cot" Then
- BtnEmitirImprimir.Text = "Cotizar"
- 'TdReferencia.Style.Add("display", "none")
-
- 'FACTURACION 3.3
- Tr33.Visible = True
-
- ElseIf DdlTipoComprobante.SelectedValue = "Com" Then
- BtnEmitirImprimir.Text = "Registrar"
- 'TdReferencia.Style.Add("display", "none")
- ElseIf DdlTipoComprobante.SelectedValue.ToString = "OP" Then
- BtnEmitirImprimir.Text = "Registrar"
- TdOrdenPago.Visible = True
- End If
-
- UpFacturar.Update()
-
- End Sub
- Private Sub EliminaPoliza()
- Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa)
- ObjAC.IniciaTransacSQL()
- Dim ObjConta As New ClsContabilidad
- ObjConta.IniciaTransacSQL()
-
- Dim ErrorMovimiento = False
-
- 'Elimina la poliza
- If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad) AndAlso IdPoliza > 0 Then
- If Not ObjAC.RemovePoliza(IdPoliza) Then
- ErrorMovimiento = True
- End If
- End If
-
- 'Desasocia la poliza
- If Not ErrorMovimiento Then
- If Not ObjConta.DesasociarPoliza(IdPoliza, UsuarioActual.CveEmpresa) Then
- ErrorMovimiento = True
- End If
- End If
-
+#Region "M E T O D O S"
+ Private Sub CargaOtrosConceptos()
+ Dim ObjVentas As New ClsVentas
+ If ObjVentas.GetVentaOtrosConceptos(UsuarioActual.CveEmpresa, CveVenta) Then
+ GVOtrosConceptos.DataSource = ObjVentas.DtResultados
+ GVOtrosConceptos.DataBind()
+ UpOtrosConceptos.Update()
+ End If
+ ObjVentas.Dispose()
+ End Sub
+ Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, factura As Modelos.Factura, Optional CancelacionIngreso As Boolean = False) As Integer
+ Dim Retorno As Integer = 0
+ Dim IDPoliza As Integer = 0
+
+ Dim ErrorAC As Boolean = False
+ 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL()
+ Dim Fecha As Date = factura.Fecha
+ Dim Concepto As String = String.Format("GD {0}", factura.Cliente.Nombre)
+ Dim Paridad As Integer = 1
+ Dim TipoMovto As Boolean = False
+
+ If CancelacionIngreso Then
+ Concepto = String.Format("Cancelación GD {0}", factura.Cliente.Nombre)
+ Paridad = -1
+ TipoMovto = True
+ End If
+
+ Dim TipoPoliza = If(factura.TipoDocto = "OP" Or factura.TipoDocto = "Com", 3, 1)
+
+ IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, factura.Total * 2, factura.Total * 2, factura.CveUsuario, Fecha)
+ Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue))
+ 'Dim Importe As Double = TxtTotal.Text.ToDouble
+ Dim CtaCliente As Integer = factura.Cliente.IdCtaContClientes
+ Dim CtaISSSTESON As Integer = 643
+ Dim CtaISPT As Integer = 1745
+ ' Dim NombreCliente As String = ViewState("NombreCliente").ToString
+
+ If IDPoliza > 0 Then
+
+ 'Orden de PAGO
+ If factura.TipoDocto = "OP" Then
+
+ If DdlOrdenPago.SelectedValue.ToEntero = 1 Then
+ 'ISSSTESON
+
+ If ObjAC.AddMovimiento(IDPoliza, factura.Cliente.IdCtaContClientes, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
+ If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+
+ Else
+ 'ISPT
+
+ If ObjAC.AddMovimiento(IDPoliza, factura.Cliente.IdCtaContClientes, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
+ If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ End If
+
+ ' NORMAL
+ Else
+ Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)()
+ Group gvr By Grp = New With {
+ Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero
+ } Into Group
+ Select Grp.CvePresupuestoIngreso,
+ TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble)
+
+
+ 'Select Case TipoComprobante
+ ' Case "Ing", "Egs"
+ For Each grp In Detalles
+ dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso))
+ Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString, TxtFolio.Text)
+
+ If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ 'CARGO la deuda del cliente
+ If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ 'abono,
+ If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ Next
+
+ 'Case "OP", "Com"
+ ' Dim Importe As Decimal = 0
+ ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, False, Importe, "", Concepto, 0, Fecha, "") Then
+ ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, True, Importe, "", Concepto, 0, Fecha, "") Then
+
+ ' End If
+ ' End If
+ 'End Select
+ End If
+
+ Else
+ ErrorAC = True
+
+ End If
+
+ If Not ErrorAC Then
+ ObjAC.AjustaPoliza(IDPoliza)
+
+ Retorno = IDPoliza
+ Else
+
+ Alert("Error al agregar la Póliza de AC.", TipoMensaje.MsgError)
+ End If
+
+ ' ObjAC.Dispose()
+
+ Return Retorno
+
+ End Function
+ Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, Optional CancelacionIngreso As Boolean = False) As Integer
+ Dim Retorno As Integer = 0
+ Dim IDPoliza As Integer = 0
+
+ Dim ErrorAC As Boolean = False
+ 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL()
+ Dim Fecha As Date = TxtFecha.Text.ToDate
+ Dim Concepto As String = String.Format("GD {0}", NombreCliente)
+ Dim Paridad As Integer = 1
+ Dim TipoMovto As Boolean = False
+
+ If CancelacionIngreso Then
+ Concepto = String.Format("Cancelación GD {0}", NombreCliente)
+ Paridad = -1
+ TipoMovto = True
+ End If
+
+ Dim TipoPoliza = If(DdlTipoComprobante.SelectedValue.ToString = "OP" Or DdlTipoComprobante.SelectedValue.ToString = "Com", 3, 1)
+
+ IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, TxtTotal.Text.ToDouble * 2, TxtTotal.Text.ToDouble * 2, UsuarioActual.CveUsuario, Fecha)
+ Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue))
+ 'Dim Importe As Double = TxtTotal.Text.ToDouble
+ Dim CtaCliente As Integer = ViewState("IdCtaContClientes").ToString.ToEntero
+ Dim CtaISSSTESON As Integer = 643
+ Dim CtaISPT As Integer = 1745
+ ' Dim NombreCliente As String = ViewState("NombreCliente").ToString
+
+ If IDPoliza > 0 Then
+
+ 'Orden de PAGO
+ If DdlTipoComprobante.SelectedValue.ToString = "OP" Then
+
+ If DdlOrdenPago.SelectedValue.ToEntero = 1 Then
+ 'ISSSTESON
+
+ If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
+ If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+
+ Else
+ 'ISPT
+
+ If ObjAC.AddMovimiento(IDPoliza, CtaCliente, False, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
+ If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * TxtTotal.Text.ToDecimal, "", Concepto, 0, Fecha, "") Then
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ End If
+
+ ' NORMAL
+ Else
+ Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)()
+ Group gvr By Grp = New With {
+ Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero
+ } Into Group
+ Select Grp.CvePresupuestoIngreso,
+ TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble)
+
+
+ 'Select Case TipoComprobante
+ ' Case "Ing", "Egs"
+ For Each grp In Detalles
+ dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso))
+ Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString, TxtFolio.Text)
+
+ If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString.ToEntero, False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString.ToEntero, True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ 'CARGO la deuda del cliente
+ If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ 'abono,
+ If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString.ToEntero, Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "") Then
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ Else
+ ErrorAC = True
+ End If
+ Next
+
+ 'Case "OP", "Com"
+ ' Dim Importe As Decimal = 0
+ ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, False, Importe, "", Concepto, 0, Fecha, "") Then
+ ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, True, Importe, "", Concepto, 0, Fecha, "") Then
+
+ ' End If
+ ' End If
+ 'End Select
+ End If
+
+ Else
+ ErrorAC = True
+
+ End If
+
+ If Not ErrorAC Then
+ ObjAC.AjustaPoliza(IDPoliza)
+
+ Retorno = IDPoliza
+ Else
+
+ Alert("Error al Agregar la Póliza de AC.", TipoMensaje.MsgError)
+ End If
+
+ ' ObjAC.Dispose()
+
+ Return Retorno
+
+ End Function
+ Private Sub SetValues()
+ ViewState("TipoCambio") = 1
+
+ If UsuarioActual.Empresa.MostrarRetIVA Then TrRetIVA.Style.Add("display", "")
+ If UsuarioActual.Empresa.MostrarRetISR Then TrRetISR.Style.Add("display", "")
+
+ If UsuarioActual.CveEmpresa.Contiene(72, 80) Then ' agregar en el modal de PS. que forme el código del producto
+ TxtPS.Enabled = False
+ DivDdlTipo.Visible = True
+ DivTxtModelo.Visible = True
+ DivTxtAdicional.Visible = True
+ DdlTipo.Attributes.Add("onChange", "CreaDescripcionPS();")
+ DdlMarcaPSDes.Attributes.Add("onChange", "CreaDescripcionPS();")
+ TxtModelo.Attributes.Add("onKeyUp ", "CreaDescripcionPS();")
+ TxtAdicional.Attributes.Add("onKeyUp ", "CreaDescripcionPS();")
+
+ CargaClasificacionesDetalles()
+ ClasificacionModal()
+
+ End If
+
+ If Not UsuarioActual.CveEmpresa.Contiene(1, 119) Then 'PAGO CON TERMINAL PARA JAM
+ RBLPago.Items.RemoveAt(2)
+ End If
+
+
+ End Sub
+ Private Sub SetPermisos()
+ If CveVenta < 1 Then
+ 'Puede cotizar
+ If Not UsuarioActual.TienePermisoProceso(59) Then
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Cot"))
+ End If
+
+ 'Puede Hacer NC
+ If Not UsuarioActual.TienePermisoProceso(175) Then
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs"))
+ End If
+
+ 'Puede Hacer Devolución
+ If Not UsuarioActual.TienePermisoProceso(264) Then
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev"))
+ End If
+
+ 'Puede facturar
+ If Not UsuarioActual.TienePermisoProceso(60) Then
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs"))
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev"))
+ End If
+
+ 'Puede remisionar
+ If Not UsuarioActual.TienePermisoProceso(199) Then
+ DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
+ LnkFacturarRemision.Visible = False
+ LnkRemisiones.Visible = False
+ End If
+
+ '[IPP]: FALTA CONFIGURAR Y DAR PERMISO A TODOS LOS QUE TENGAN ACCESO A VENTAS
+ ''Puede remisionar
+ 'If Not UsuarioActual.TienePermisoProceso(199) Then
+ ' DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
+ 'End If
+
+ ''MODO SOLO LECTURA
+ 'If DdlTipoComprobante.Items.Count = 0 Then
+ ' DdlTipoComprobante.Items.Insert(0, New ListItem("Solo lectura", "-1"))
+ ' TrBotones.Visible = False
+ 'End If
+
+ ConfiguraTipoDocto()
+ End If
+ End Sub
+ 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
+ Dim TotalAmortizacion As Decimal = LblAmortizacion.Text.ToDecimal
+ Dim TotalIVA As Decimal = TmpDT.SUM("ImporteIVA").ToDecimal
+ Dim TotalIEPS As Decimal = TmpDT.SUM("ImporteIEPS").ToDecimal
+ Dim TotalRetIVA As Decimal = TmpDT.SUM("ImporteRetIVA").ToDecimal
+ Dim TotalRetISR As Decimal = TmpDT.SUM("ImporteRetISR").ToDecimal
+ Dim Total As Decimal = 0
+ Dim TotalImpuestosLocales As Decimal = 0
+
+ If TotalAmortizacion > 0 AndAlso TotalSubTotal = TotalAmortizacion Then ' si se amortizó completa la factura, debe de limpiar los impuestos
+ If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("3") Then
+ For Each dr As DataRow In TmpDT.Rows
+ dr("ImporteIVA") = 0 : dr("ImporteIEPS") = 0 : dr("ImporteRetIVA") = 0 : dr("ImporteRetISR") = 0 : dr("PorcentajeIVA") = 0 : dr("IVA") = 0
+ Next
+
+ If TmpDTImpuestos IsNot Nothing Then
+ For Each dr2 As DataRow In TmpDTImpuestos.Rows
+ dr2("Importe") = 0
+ Next
+ TmpDTImpuestos.AcceptChanges()
+ End If
+
+ TmpDT.AcceptChanges()
+ TotalIVA = TmpDT.SUM("ImporteIVA").ToDecimal
+ TotalIEPS = TmpDT.SUM("ImporteIEPS").ToDecimal
+ TotalRetIVA = TmpDT.SUM("ImporteRetIVA").ToDecimal
+ TotalRetISR = TmpDT.SUM("ImporteRetISR").ToDecimal
+ TotalImpuestosLocales = TmpDTImpuestos.SUM("Importe").ToDecimal
+ End If
+ End If
+
+ If RecalculaImpuestosLocales AndAlso TmpDTImpuestos IsNot Nothing AndAlso TmpDTImpuestos.Rows.Count > 0 Then
+ If TotalSubTotal <> TotalAmortizacion Then
+ For Each drt As DataRow In TmpDTImpuestos.Rows
+ drt("Importe") = drt("Porcentaje").ToString.ToDecimal * TotalSubTotal / 100
+ Next
+ End If
+
+ GvImpuestosLocales2.DataSource = TmpDTImpuestos
+ GvImpuestosLocales2.DataBind()
+ End If
+
+ For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
+ If gvr.RowType = DataControlRowType.DataRow Then
+
+ If gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal > 0 Then
+ If gvr.DataKey("TipoImpuesto") = "5" Then ' traslado de imp local
+ TotalImpuestosLocales -= gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal
+ Else
+ TotalImpuestosLocales += gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal
+ End If
+ End If
+ End If
+ Next
+
+ 'If TotalDescuentos > 0 Then GvPS.Columns(ColumnaDescuento).Visible = True : thEncDesc1.Visible = True : thEncDesc2.Visible = True Else GvPS.Columns(ColumnaDescuento).Visible = False : thEncDesc1.Visible = False : thEncDesc2.Visible = False
+ If TotalIEPS > 0 Then TrIEPS.Visible = True : GvPS.Columns(ColumnaIEPS).Visible = True : thEncIEPS1.Visible = True : thEncIEPS2.Visible = True Else TrIEPS.Visible = False : GvPS.Columns(ColumnaIEPS).Visible = False : thEncIEPS1.Visible = False : thEncIEPS2.Visible = False
+ If TotalRetIVA > 0 Then GvPS.Columns(ColumnaRetIVA).Visible = True Else GvPS.Columns(ColumnaRetIVA).Visible = False
+ If TotalRetISR > 0 Then GvPS.Columns(ColumnaRetISR).Visible = True Else GvPS.Columns(ColumnaRetISR).Visible = False
+
+ If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero.Contiene(2, 1) Then
+ TotalAmortizacion = 0
+ End If
+
+
+ Total = (TotalSubTotal - TotalDescuentos - TotalAmortizacion + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales)
+ LblSubTotal1.Text = TotalSubTotal.FormatoNumero(2)
+ TxtSubTotal.Text = TotalSubTotal.FormatoNumero(2)
+ LblDescuentos.Text = TotalDescuentos.FormatoNumero
+ TxtSubTotal2.Text = (TotalSubTotal - TotalDescuentos - TotalAmortizacion).FormatoNumero(2)
+ TxtRetIVA.Text = TotalRetIVA.FormatoNumero(2)
+ TxtRetISR.Text = TotalRetISR.FormatoNumero(2)
+ TxtIVA.Text = TotalIVA.FormatoNumero
+ TxtIEPS.Text = TotalIEPS.FormatoNumero
+ TxtTotal.Text = Total.FormatoNumero
+
+ LblAmort.Text = TxtSubTotal.Text
+ If CveVenta <= 0 OrElse (CveDevolucion > 0 And NuevaFactura = 1) Then
+ HdnVentaSaldo.Value = Total.ToString
+ Else
+ HdnVentaSaldo.Value = SaldoVenta.ToString
+ End If
+ HdnIVAOriginal.Value = TxtIVA.Text
+
+ 'JJMQ 20160506: Se agrego para la validacion de pago de contado.
+ 'CVImporteContado.ValueToCompare = Total.ToString
+
+ If MensajeCveSAT IsNot Nothing AndAlso MensajeCveSAT.ToString.Length > 0 Then
+ Alert($"Los siguientes conceptos hace falta especificar clave SAT
{MensajeCveSAT.ToString}", TipoMensaje.MsgAdvertencia)
+ MensajeCveSAT.Clear()
+ End If
+
+ Dim view As DataView = New DataView(TmpDT)
+ view.Sort = "Consec"
+ GvPS.DataSource = view
+ GvPS.DataBind()
+
+ 'RECARGA GV INVENTARIO
+ If Not CveVenta > 0 Or DdlTipoComprobante.SelectedValue = "Cot" Then
+ DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
+ CargaGVInv(DtInv)
+ End If
+
+ UpContado.Update()
+ UpPS.Update()
+ RegistraScript("BorraDescuentos();", "BorraDescuentos")
+ End Sub
+ Private Function ValidaAdendaFEMSA() As Boolean
+ Dim Retorno As Boolean = False
+
+ If Not AplicaFEMSA Then
+ Retorno = True
+ Else
+ If TxtFEMSA_Version.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_Version.Text.Trim) Then
+ Retorno = False
+ Alert("La versión de la Adenda es requerida y debe ser numérica. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ ElseIf TxtFEMSA_NumSociedad.Text.Trim.Length = 0 Then
+ Retorno = False
+ Alert("El número de Sociedad para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
+ ElseIf TxtFEMSA_NumProveedor.Text.Trim.Length = 0 Then
+ Retorno = False
+ Alert("El número de Proveedor para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
+ ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso (TxtFEMSA_NumPedido.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_NumPedido.Text.Trim)) Then
+ Retorno = False
+ Alert("El número de Pedido para la Adenda es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso (TxtFEMSA_NumEntrada.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtFEMSA_NumEntrada.Text.Trim)) Then
+ Retorno = False
+ Alert("El número de Entrada para la Adenda es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ ElseIf DdlTipoComprobante.SelectedValue = "Ing" AndAlso TxtFEMSA_NumRemision.Text.Trim.Length = 0 Then
+ Retorno = False
+ Alert("El número de Remisión para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
+ ElseIf TxtFEMSA_Mail.Text.Trim.Length = 0 Then
+ Retorno = False
+ Alert("El Mail para la Adenda es requerido. Por favor capture uno.", TipoMensaje.MsgAdvertencia)
+ Else
+ Retorno = True
+ End If
+ End If
+
+ Return Retorno
+ End Function
+ Private Function ValidaComplementoDetallista() As Boolean
+ Dim Retorno As Boolean = False
+
+ If Not AplicaDetallista Then
+ Retorno = True
+ Else
+ If TxtDet_OrdenCompra.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_OrdenCompra.Text.Trim) Then
+ Retorno = False
+ Alert("El campo Orden de Compra es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia, "")
+ ElseIf TxtDet_FechaOrdenCompra.Text.Trim.Length = 0 OrElse Not IsDate(TxtDet_FechaOrdenCompra.Text.Trim) Then
+ Retorno = False
+ Alert("El campo Fecha de Orden de Compra es requerido y debe de contar con un formato válido de fecha. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ ElseIf TxtDet_GLNComprador.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_GLNComprador.Text.Trim) Then
+ Retorno = False
+ Alert("El campo GLN-Comprador es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ ElseIf TxtDet_Departamento.Text.Trim.Length = 0 Then
+ Retorno = False
+ Alert("El campo Departamento es requerido. Por favor ingrese uno.", TipoMensaje.MsgAdvertencia)
+ ElseIf TxtDet_GLNVendedor.Text.Trim.Length = 0 OrElse Not IsNumeric(TxtDet_GLNVendedor.Text.Trim) Then
+ Retorno = False
+ Alert("El campo GLN-Vendedor es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ ElseIf TxtDet_NumProv.Text.Trim.Length = 0 Then
+ Retorno = False
+ Alert("El campo Número de Proveedor es requerido y debe ser numérico. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ Else
+ Retorno = True
+ End If
+ End If
+
+ Return Retorno
+ End Function
+ Private Function ValidaComplementoFord() As Boolean
+ Dim Retorno As Boolean = False
+
+ If Not AplicaFord Then
+ Retorno = True
+ Else
+ If TxtFordGSDB.Text.Trim.Length = 0 Then
+ Retorno = False
+ Alert("El campo GSDB es requerido. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ Else
+ If LstFordASN.Items.Count = 0 Then
+ Retorno = True
+ 'Alert("El campo ASN es requerido. Por favor corrija.", TipoMensaje.MsgAdvertencia)
+ Else
+ Retorno = True
+ End If
+
+ End If
+ End If
+
+ Return Retorno
+ End Function
+ Private Sub VinculaCotizacionVenta()
+ Dim ObjVentas As New ClsVentas()
+ ObjVentas.UpdateVentaCotizacion(CveVenta, Request("CveVenta").ToEntero)
+ ObjVentas.Dispose()
+ End Sub
+ Private Sub GeneraAddenda7Eleven(Archivo As String)
+ Dim cfdi As String = ""
+ Dim SB As New StringBuilder
+ Try
+ Using sr As New StreamReader(Archivo)
+
+ cfdi = sr.ReadToEnd()
+
+ End Using
+ Catch e As Exception
+ Alert("The file could not be read:", TipoMensaje.MsgError)
+
+ End Try
+
+
+ cfdi = cfdi.Replace("", "")
+
+ SB.Append(cfdi)
+
+ SB.Append("")
+ SB.AppendFormat("", Txt7ElevenNumProveedor.Text.Trim)
+ SB.AppendFormat("", Txt7ElevenFolio.Text.Trim, Txt7ElevenTienda.Text.Trim, Txt7ElevenFecha.Text.Trim.ToDate.ToString("yyyy-MM-dd"))
+
+ For Each Row As DataRow In TmpDT.Rows
+
+ SB.AppendFormat("", Row("Codigo"), Row("PS"), Row("Cantidad").ToString.ToDouble.FormatoNumero(), Row("PU").ToString.ToDouble.FormatoNumero())
+
+ Next
+
+ SB.Append("")
+
+
+ Using outfile As New StreamWriter(Archivo)
+ outfile.Write(SB.ToString())
+ End Using
+
+ 'Exit Sub
+
+
+
+ 'Dim MyXmlDocument As New XmlDocument()
+
+ 'MyXmlDocument.Load("C:/Temp/aaa.xml")
+ 'Dim nsmgr = New XmlNamespaceManager(MyXmlDocument.NameTable)
+ 'nsmgr.AddNamespace("cfdi", "http://www.sat.gob.mx/cfd/3")
+ 'Dim ParentElement As XmlElement = MyXmlDocument.CreateElement("cfdi:Addenda", "https://edixcfisecure.ekomercio.com/esquemas")
+ 'ParentElement.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")
+ 'ParentElement.SetAttribute("xsi:schemaLocation", "https://edixcfisecure.ekomercio.com/esquemas https:/edixcfdisecure.ekomercio.com/esquemas/7Eleven.xsd")
+
+ 'Dim Prov As XmlElement = MyXmlDocument.CreateElement("cfdi:Proveedor", "")
+ 'Prov.SetAttribute("Clave", "3125")
+
+ 'Dim ns As String = "cfdi" 'MyXmlDocument.DocumentElement.GetNamespaceOfPrefix("cfdi")
+ 'Dim Recepciones As XmlElement = MyXmlDocument.CreateElement("cfdi:Recepciones")
+ 'Recepciones.Prefix = "cfdi"
+ 'Dim Recepcion As XmlElement = MyXmlDocument.CreateElement("cfdi:Recepcion")
+ 'Recepcion.SetAttribute("folio", Txt7ElevenFolio.Text.Trim)
+ 'Recepcion.SetAttribute("tienda", Txt7ElevenTienda.Text.Trim)
+ 'Recepcion.SetAttribute("fecha", Txt7ElevenFecha.Text.Trim.ToDate.ToString("yyyy-dd-MM"))
+
+ 'Dim Productos As XmlElement = MyXmlDocument.CreateElement("cfdi:Productos")
+ ''dentro de un ciclo
+ 'Dim Producto As XmlElement = MyXmlDocument.CreateElement("cfdi:Producto")
+ 'Producto.SetAttribute("codigo", "cod1")
+ 'Producto.SetAttribute("descripcion", "prod1")
+ 'Producto.SetAttribute("cantidad", "99")
+ 'Producto.SetAttribute("precio", "2000")
+ 'Productos.AppendChild(Producto)
+ ''fin de ciclo
+
+ 'Recepcion.AppendChild(Productos)
+
+ 'Recepciones.AppendChild(Recepcion)
+
+ 'ParentElement.AppendChild(Prov)
+
+ 'ParentElement.AppendChild(Recepciones)
+
+
+ 'MyXmlDocument.DocumentElement.AppendChild(ParentElement)
+ 'MyXmlDocument.Save("C:/Temp/aa.xml")
+
+ End Sub
+ Protected Sub DdlFuenteRecaudacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFuenteRecaudacion.SelectedIndexChanged
+ For Each dr As DataRow In TmpDT.Rows
+ dr("CvePresupuestoIngreso") = DdlFuenteRecaudacion.SelectedValue
+ Next
+
+ GvPS.DataSource = TmpDT
+ GvPS.DataBind()
+
+ UpPS.Update()
+ End Sub
+ Protected Sub DdlFR_SelectedIndexChanged(sender As Object, e As EventArgs)
+ Dim DdlFR_Gv As DropDownList = CType(sender, DropDownList)
+ Dim index As Integer = CType(DdlFR_Gv.NamingContainer, GridViewRow).FCLiteral("LtlConsecutivo").Text.ToString.ToEntero
+
+ If UsuarioActual.Empresa.UsaAC Then
+ TmpDT(index - 1)("CvePresupuestoIngreso") = DdlFR_Gv.SelectedValue
+ End If
+ TmpDT.AcceptChanges()
+ End Sub
+ Protected Sub LnkASN_Click(sender As Object, e As EventArgs) Handles LnkASN.Click
+ If TxtFordASN.Text.Trim.Length > 20 Then Alert("Maximo 20 Caracteres", TipoMensaje.MsgAdvertencia) : Exit Sub
+ LstFordASN.Items.Add(New ListItem(TxtFordASN.Text.Trim))
+ TxtFordASN.Text = ""
+ TxtFordASN.Focus()
+ End Sub
+ Protected Sub LnkFordQuitar_Click(sender As Object, e As EventArgs) Handles LnkFordQuitar.Click
+ LstFordASN.Items.RemoveAt(LstFordASN.SelectedIndex)
+
+ End Sub
+ Private Sub LnkImprimir_Click(sender As Object, e As EventArgs) Handles LnkImprimir.Click
+ GeneraPDFCot(TxtFecha.Text.Trim.ToDate, Nothing, VentaFolio, False, False)
+ End Sub
+ Protected Sub TxtCodigo_TextChanged(sender As Object, e As System.EventArgs) Handles TxtCodigo.TextChanged
+
+ Dim ObjClientes As New ClsClientes()
+
+ Dim Nombre As String = "-1"
+ Dim Codigo As String = "-1"
+ Dim NombreCorto As String = "-1"
+ Dim RFC As String = "-1"
+ Dim Telefono As String = "-1"
+ Dim Mail As String = "-1"
+
+ If TxtCodigo.Text.Trim <> String.Empty Then Codigo = TxtCodigo.Text.Trim
+
+ If Codigo <> "-1" Then
+ If ObjClientes.GetClientes(-1, Nombre, Codigo, NombreCorto, RFC, Telefono, Mail, -1, UsuarioActual.CveEmpresa, TipoCliente:=-1) Then
+ If ObjClientes.DtResultados.Rows.Count > 0 Then
+ If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not ObjClientes.CveCliente.Contiene(10450, 10460, 10458) Then
+ TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : LnkAgregarPyME.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False
+ UpFacturar.Update()
+ Exit Sub
+ ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not ObjClientes.CveCliente.Contiene(27448) Then
+ TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : LnkAgregarPyME.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False
+ UpFacturar.Update()
+ Exit Sub
+ Else
+ HdnCveCliente.Value = ObjClientes.CveCliente.ToString
+ End If
+ BtnBuscarCliente_Click(sender, e)
+ Else
+ Alert("No se encontró el cliente con el código: " & TxtCodigo.Text.Trim & ".", Extensiones.TipoMensaje.MsgAdvertencia)
+ TxtCodigo.Text = ""
+ LblCliente.Text = "Cliente"
+ LblDireccion.Text = "Dirección"
+ LblColonia.Text = "Colonia"
+ LblCiudad.Text = "Ciudad"
+ LblEstado.Text = "Estado"
+ LblCP.Text = "00000"
+ LblRFC.Text = "AAA010101AAA"
+ LblTelefono.Text = "9999999999"
+ trsucursalciente.Visible = False
+ End If
+ End If
+ ObjClientes.Dispose()
+
+ End If
+ End Sub
+ Protected Sub TxtFolio_TextChanged(sender As Object, e As System.EventArgs) Handles TxtFolio.TextChanged
+ ViewState("EstablecioFolio") = True
+ End Sub
+ Private Sub ConfiguraTipoDocto()
+
+ 'Esconde Todo
+ TdOrdenPago.Visible = False
+ Tr33.Visible = False
+
+ 'si tiene la funcionalidad que se active independiente del tipo de documento RMF 15-10-2017
+ Tr33.Visible = True
+
+ If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") Then
+ BtnEmitirImprimir.Text = "Emitir e Imprimir"
+ 'TdReferencia.Style.Add("display", "none")
+ ElseIf DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Then
+ BtnEmitirImprimir.Text = "Emitir e Imprimir"
+ 'TdReferencia.Style.Remove("display")
+ ElseIf DdlTipoComprobante.SelectedValue = "Rem" Then
+ BtnEmitirImprimir.Text = "Registrar"
+ 'TdReferencia.Style.Add("display", "none")
+ ElseIf DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC", "PA", "Pd2") Then
+ BtnEmitirImprimir.Text = "Registrar"
+ 'TdReferencia.Style.Add("display", "none")
+ ElseIf DdlTipoComprobante.SelectedValue = "Cot" Then
+ BtnEmitirImprimir.Text = "Cotizar"
+ 'TdReferencia.Style.Add("display", "none")
+
+ 'FACTURACION 3.3
+ Tr33.Visible = True
+
+ ElseIf DdlTipoComprobante.SelectedValue = "Com" Then
+ BtnEmitirImprimir.Text = "Registrar"
+ 'TdReferencia.Style.Add("display", "none")
+ ElseIf DdlTipoComprobante.SelectedValue.ToString = "OP" Then
+ BtnEmitirImprimir.Text = "Registrar"
+ TdOrdenPago.Visible = True
+ End If
+
+ UpFacturar.Update()
+
+ End Sub
+ Private Sub EliminaPoliza()
+ Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa)
+ ObjAC.IniciaTransacSQL()
+ Dim ObjConta As New ClsContabilidad
+ ObjConta.IniciaTransacSQL()
+
+ Dim ErrorMovimiento = False
+
+ 'Elimina la poliza
+ If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad) AndAlso IdPoliza > 0 Then
+ If Not ObjAC.RemovePoliza(IdPoliza) Then
+ ErrorMovimiento = True
+ End If
+ End If
+
+ 'Desasocia la poliza
+ If Not ErrorMovimiento Then
+ If Not ObjConta.DesasociarPoliza(IdPoliza, UsuarioActual.CveEmpresa) Then
+ ErrorMovimiento = True
+ End If
+ End If
+
If Not ErrorMovimiento Then
If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
ErrorMovimiento = True
End If
- End If
-
- If Not ErrorMovimiento Then
- Alert("La póliza ha sido desvinculada y eliminada con éxito.", TipoMensaje.MsgInformacion)
- ObjAC.Commit()
- ObjConta.Commit()
- BtnDescontabilizar.Visible = False
- Else
- Alert("Ocurrió un error al desvincular y/o eliminar la póliza. Por favor intente de nuevo ", TipoMensaje.MsgError)
- ObjAC.RollBack()
- ObjConta.RollBack()
- End If
-
- ObjAC.Dispose()
- ObjConta.Dispose()
-
- End Sub
- Protected Sub DdlPS_SelectedIndexChanged1(sender As Object, e As EventArgs)
- Dim Ddl As DropDownList = CType(sender, DropDownList)
- Dim gvr As GridViewRow = CType(Ddl.BindingContainer, GridViewRow)
- gvr.FCDropDownList("DdlUnidadMedida").DataSource = GlobalDTProductosServiciosEquivalencias(Ddl.SelectedValue.ToEntero, -1)
- gvr.FCDropDownList("DdlUnidadMedida").DataBind()
-
- End Sub
- Private Function TraspasoAlmacen(ByRef ObjInventario As ClsInventarios, CveRemision As Integer, ByRef ObjConta As ClsContabilidad, ConSalida As Boolean, ConceptoMovimiento As Integer) As Boolean
+ End If
+
+ If Not ErrorMovimiento Then
+ Alert("La póliza ha sido desvinculada y eliminada con éxito.", TipoMensaje.MsgInformacion)
+ ObjAC.Commit()
+ ObjConta.Commit()
+ BtnDescontabilizar.Visible = False
+ Else
+ Alert("Ocurrió un error al desvincular y/o eliminar la póliza. Por favor intente de nuevo ", TipoMensaje.MsgError)
+ ObjAC.RollBack()
+ ObjConta.RollBack()
+ End If
+
+ ObjAC.Dispose()
+ ObjConta.Dispose()
+
+ End Sub
+ Protected Sub DdlPS_SelectedIndexChanged1(sender As Object, e As EventArgs)
+ Dim Ddl As DropDownList = CType(sender, DropDownList)
+ Dim gvr As GridViewRow = CType(Ddl.BindingContainer, GridViewRow)
+ gvr.FCDropDownList("DdlUnidadMedida").DataSource = GlobalDTProductosServiciosEquivalencias(Ddl.SelectedValue.ToEntero, -1)
+ gvr.FCDropDownList("DdlUnidadMedida").DataBind()
+
+ End Sub
+ Private Function TraspasoAlmacen(ByRef ObjInventario As ClsInventarios, CveRemision As Integer, ByRef ObjConta As ClsContabilidad, ConSalida As Boolean, ConceptoMovimiento As Integer) As Boolean
Dim OcurrioError As Boolean = False
Try
Dim DtMovimientos As DataTable
@@ -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,14 +16823,29 @@ 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 (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
+ 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
@@ -16919,13 +17015,13 @@ Partial Class Ventas
Private Sub BtnAgregarCliente_Click(sender As Object, e As EventArgs) Handles BtnAgregarCliente.Click
Dim CvePreioLista As Integer = -1
- If DdlSubProyectoDatos.SelectedValue.ToEntero > 0 Then
- Dim Dr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa).Rows(0)
- If Dr IsNot Nothing Then
- If Dr("CvePrecioLista").ToString.ToEntero > 0 Then
- CvePreioLista = Dr("CvePrecioLista").ToString.ToEntero
- End If
- End If
+ If DdlSubProyectoDatos.SelectedValue.ToEntero > 0 Then
+ Dim Dr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa).Rows(0)
+ If Dr IsNot Nothing Then
+ If Dr("CvePrecioLista").ToString.ToEntero > 0 Then
+ CvePreioLista = Dr("CvePrecioLista").ToString.ToEntero
+ End If
+ End If
End If
Dim ObjCliente As New ClsClientes
@@ -16946,16 +17042,16 @@ Partial Class Ventas
End Sub
- Private Sub RecargaGlobalCliente()
- Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente)
- Hilo.Start()
- End Sub
- Private Sub GeneraGlobalDTCliente()
- Dim Objclientes As New ClsClientes
- If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1,TipoCliente:=-1) Then
- Application("GlobalDTCliente") = Objclientes.DtResultados
- End If
- Objclientes.Dispose()
+ Private Sub RecargaGlobalCliente()
+ Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente)
+ Hilo.Start()
+ End Sub
+ Private Sub GeneraGlobalDTCliente()
+ Dim Objclientes As New ClsClientes
+ If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1, TipoCliente:=-1) Then
+ Application("GlobalDTCliente") = Objclientes.DtResultados
+ End If
+ Objclientes.Dispose()
End Sub
#End Region
@@ -18474,7 +18570,7 @@ Partial Class Ventas
strBody.AppendFormat("