diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb
index e7b9a2971..a8235bf19 100644
--- a/App_Code/ClsContratos.vb
+++ b/App_Code/ClsContratos.vb
@@ -3493,10 +3493,63 @@ Public Class ClsContratos
End Try
Return Retorno
- End Function
+ End Function
+
+
+
+#Region " MAQUINARIA FLOTILLA HERRAMIENTA "
+
+
+ Public Function AddContratosMaquinariaFlotilla(CveActivoFijo As Integer, Fecha As Date, CvePersonal As Integer, Importe As Decimal, CveContratoDetalle As Integer) As Boolean
+ Dim Retorno As Boolean = False
+ Dataset = New DataSet()
+ DataAdapter("PA_Con_ContratosMaquinariaFlotillaAdd")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo
+ .Add("@Fecha", SqlDbType.DateTime).Value = Fecha
+ .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal
+ .Add("@Importe", SqlDbType.Money).Value = Importe
+ .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle
+ End With
+
+ Try
+ SqlAdapter.Fill(Dataset)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al agregar el registro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+
+ Return Retorno
+ End Function
+
+
+ Public Function GetContratosMaquinariaFlotillaSubTipoAF(CveContrato As Integer, CveEmpresa As Integer) As Boolean
+ Dim Retorno As Boolean = False
+ Dataset = New DataSet()
+ DataAdapter("PA_Con_ContratosMaquinariaFlotillaSuibTipoAFGet")
+
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveContrato", SqlDbType.Int).Value = CveContrato
+
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al obtener el registro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+
+ Return Retorno
+ End Function
+
+
+#End Region
+
#Region " IDisposable Support "
- ' IDisposable
+ ' IDisposable
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not disposedValue Then
If disposing Then
diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb
index be81c310e..b05a5614f 100644
--- a/App_Code/ClsPaginas.vb
+++ b/App_Code/ClsPaginas.vb
@@ -7052,6 +7052,28 @@ Public Class ClsPaginas
RutaFormato = String.Format("{0}Formatos\{1}.rdlc", UsuarioActual.Empresa.Ruta, NombreArchivo)
RutaFormatoDefault = String.Format("Empresas\Grales\Formatos\{0}.rdlc", NombreArchivo)
+ Case "RNC"
+
+
+ NombreArchivo = "RemisionNC"
+ NombreArchivoDescarga = "RemisionNC"
+ TipoDocumento = "REMISION"
+
+ params.Add(New ReportParameter("TipoDocumento", NombreArchivoDescarga))
+ params.Add(New ReportParameter("Tipo", TipoDocumento))
+ params.Add(New ReportParameter("Ref", TipoDocumentoRef))
+ params.Add(New ReportParameter("AplicaPagare", AplicaPagare))
+
+ 'ALAN YEPIZ
+ If UsuarioActual.CveEmpresa.Contiene(123) Then
+ params.Add(New ReportParameter("DiaExpedicion", String.Format("{0}", Vta.Fecha.ToDate.Day)))
+ params.Add(New ReportParameter("MesExpedicion", String.Format("{0}", Vta.Fecha.ToDate.Month)))
+ params.Add(New ReportParameter("AñoExpedicion", String.Format("{0}", Vta.Fecha.ToDate.Year)))
+ End If
+
+ RutaFormato = String.Format("{0}Formatos\{1}.rdlc", UsuarioActual.Empresa.Ruta, NombreArchivo)
+ RutaFormatoDefault = String.Format("Empresas\Grales\Formatos\{0}.rdlc", NombreArchivo)
+
Case Else
NombreArchivo = ""
TipoDocumento = ""
diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb
index 1dead2777..a01edf317 100644
--- a/App_Code/Modelos.vb
+++ b/App_Code/Modelos.vb
@@ -1912,6 +1912,27 @@ Namespace Modelos
DtVentasNC.Rows.Add(Dr)
End If
End Sub
+ Private Function CancelarMovimientosUsados(factura As Modelos.Factura, UsuarioActual As Usuario, ByRef ObjAcum As ClsAcumuladores) As Boolean
+ Dim Retorno As Boolean = True
+ If ObjAcum.DistribuidorMovtosGet(factura.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=factura.CveVenta, CveConcepto:=2) Then
+ Dim CveConceptoSalida As Integer = 2
+
+ Dim DtSalidas As DataTable = ObjAcum.DtResultados.FiltraParametros("Cantidad > 0")
+ If DtSalidas IsNot Nothing AndAlso DtSalidas.Rows.Count > 0 Then
+ For Each RowSalida As DataRow In DtSalidas.Rows
+ Dim Cantidad As Decimal = RowSalida("Cantidad").ToString().ToDecimal() * -1
+
+ If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, CveConceptoSalida, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "") Then
+ Retorno = False
+ Exit For
+ End If
+ Next
+ DtSalidas.Dispose()
+ End If
+
+ End If
+ Return Retorno
+ End Function
Private Function GuardarUsados(ByRef ObjAcum As ClsAcumuladores, ByRef ObjVentas As ClsVentas, ByRef ObjInventario As ClsInventarios, factura As Modelos.Factura, ByRef Optional Resp As MMensajeFactura = Nothing) As Boolean
Dim Resultado As Boolean = True
@@ -4407,63 +4428,79 @@ Namespace Modelos
If ObjFactura.FolioFiscal <> "" Then
If ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Dev", "Egs") Then
- Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), UsuarioActual.Empresa.FacturaProduccion)
+ 'VERIFICA SI DEBE VALIDAR ANTE EL SAT
+ If Not (UsuarioActual.Empresa.Funcionalidad(529) = "1") Then
- If Vigencia IsNot Nothing Then
- If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then
- Retorno.Mensaje = "Esta factura no es cancelable."
+ Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), UsuarioActual.Empresa.FacturaProduccion)
+
+ If Vigencia IsNot Nothing Then
+ If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then
+ Retorno.Mensaje = "Esta factura no es cancelable."
+ Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
+
+ Return Retorno
+ End If
+ If Vigencia.Estado.ToUpper().Contains("CANCELADO") Then
+ ContinuarCancelacion = False
+ ObtenerAcuse = True
+ Dim solicitud = New WSGF.Service1SoapClient()
+ Dim acuse = solicitud.GetAcuse(UsuarioActual.Empresa.RFC, "rene.molina@adsistemas.mx", "rene2018", FolioFiscal)
+
+ If acuse.Estado = 0 Then
+ Dim xmlAcuse = New System.Xml.XmlDocument()
+ xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64))
+ CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")(0).InnerText
+ CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes("Fecha").Value.ToDate()
+ CveEstatus = 5
+ Else
+ CancelacionFecha = Now.Date
+ CancelacionAcuse = ""
+ CveEstatus = 5
+ End If
+
+ ElseIf Vigencia.Estado.ToUpper().Contains("VIGENTE") Then
+
+ If Vigencia.EstatusCancelacion.ToUpper() = "EN PROCESO" Then
+ CveEstatus = 20
+ ContinuarCancelacion = False
+ ElseIf Vigencia.EsCancelable.ToUpper() = "CANCELABLE CON ACEPTACIÓN" Then
+ CveEstatus = 20
+ ContinuarCancelacion = True
+ RequiereAceptacion = True
+ ElseIf Vigencia.EsCancelable.ToUpper() = "CANCELABLE SIN ACEPTACIÓN" Then
+ ContinuarCancelacion = True
+ CveEstatus = 5
+ End If
+
+ Else
+ If Vigencia.EsCancelable.ToUpper() = "CANCELABLE SIN ACEPTACIÓN" Then
+ ContinuarCancelacion = True
+ CveEstatus = 5
+ Else
+ CveEstatus = 20
+ ContinuarCancelacion = False
+ CancelacionFecha = Now.Date
+ CancelacionAcuse = ""
+ End If
+ End If
+ Else
+ Retorno.Mensaje = "SAT - No se pudo verificar el estatus de la factura."
Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
Return Retorno
End If
- If Vigencia.Estado.ToUpper().Contains("CANCELADO") Then
- ContinuarCancelacion = False
- ObtenerAcuse = True
- Dim solicitud = New WSGF.Service1SoapClient()
- Dim acuse = solicitud.GetAcuse(UsuarioActual.Empresa.RFC, "rene.molina@adsistemas.mx", "rene2018", FolioFiscal)
-
- If acuse.Estado = 0 Then
- Dim xmlAcuse = New System.Xml.XmlDocument()
- xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64))
- CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")(0).InnerText
- CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes("Fecha").Value.ToDate()
- CveEstatus = 5
- Else
- CancelacionFecha = Now.Date
- CancelacionAcuse = ""
- CveEstatus = 5
- End If
-
- ElseIf Vigencia.Estado.ToUpper().Contains("VIGENTE") Then
-
- If Vigencia.EstatusCancelacion.ToUpper() = "EN PROCESO" Then
- CveEstatus = 20
- ContinuarCancelacion = False
- ElseIf Vigencia.EsCancelable.ToUpper() = "CANCELABLE CON ACEPTACIÓN" Then
- CveEstatus = 20
- ContinuarCancelacion = True
- RequiereAceptacion = True
- ElseIf Vigencia.EsCancelable.ToUpper() = "CANCELABLE SIN ACEPTACIÓN" Then
- ContinuarCancelacion = True
- CveEstatus = 5
- End If
-
- Else
- If Vigencia.EsCancelable.ToUpper() = "CANCELABLE SIN ACEPTACIÓN" Then
- ContinuarCancelacion = True
- CveEstatus = 5
- Else
- CveEstatus = 20
- ContinuarCancelacion = False
- CancelacionFecha = Now.Date
- CancelacionAcuse = ""
- End If
- End If
Else
- Retorno.Mensaje = "SAT - No se pudo verificar el estatus de la factura."
- Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
+ ObtenerAcuse = False
+ ContinuarCancelacion = True
+ CancelacionFecha = Now.Date
+ CancelacionAcuse = ""
+
+ Dim diasTimbrado As Decimal = DateDiff(DateInterval.Day, ObjFactura.FechaCP, Now)
+
+ If ObjFactura.Total < 5000D OrElse diasTimbrado <= 3 OrElse ObjFactura.Cliente.RFC.Contiene("XAXX010101000", "XEXX010101000") Then
+ RequiereAceptacion = False
+ End If
- Return Retorno
End If
If Not ObtenerAcuse Then
@@ -4558,6 +4595,7 @@ Namespace Modelos
Dim ObjInventario As New ClsInventarios(ObjVentas.IniciaTransacSQL())
Dim ObjContrato As New ClsContratos(ObjVentas.IniciaTransacSQL())
Dim ObjEventos As New ClsOIEventos(ObjVentas.IniciaTransacSQL())
+ Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL())
Dim ObjAC As ClsContPAQi = Nothing
If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
@@ -4974,6 +5012,16 @@ Namespace Modelos
End If
End If
+ 'CANCELA MOVIMIENTOS DE USADOS
+ If Not ErrorCancelar Then
+ If ObjFactura.TipoDocto = "Ing" Then
+ If Not CancelarMovimientosUsados(ObjFactura, UsuarioActual, ObjAcum) Then
+ ErrorCancelar = True
+ MensajeError = "Ocurrió un error al cancelar los movimientos de usados"
+ End If
+ End If
+ End If
+
End If
'MARCA LA VENTA PARA REALIZAR LA DEVOLUCION POSTERIORMENTE
diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb
index edfa892ec..56fce0da2 100644
--- a/App_Code/Timbrado.vb
+++ b/App_Code/Timbrado.vb
@@ -59,18 +59,20 @@ Public Class Timbrado
Public Function CFDICancelar(Empresa As Empresa, FolioFiscal As String, Total As Decimal, RFCReceptor As String, RFCEmisor As String, Optional CvePACCancelacion As Integer = 2, Optional ValidaFactura As Boolean = True) As Boolean
Dim Retorno As Boolean = False
Dim MsgCancelacion As New StringBuilder
- If ValidaFactura Then
- Dim Vigencia = VerificarVigenciaSAT(FolioFiscal, RFCEmisor, RFCReceptor, Total.ToString(), True)
- If Vigencia IsNot Nothing Then
- If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then
+
+ If Not (Empresa.Funcionalidad(529) = "1") Then
+ If ValidaFactura Then
+ Dim Vigencia = VerificarVigenciaSAT(FolioFiscal, RFCEmisor, RFCReceptor, Total.ToString(), True)
+ If Vigencia IsNot Nothing Then
+ If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then
+ Return False
+ End If
+ Else
Return False
End If
- Else
- Return False
End If
End If
-
MsgCancelacion.AppendFormat("CvePAC:{0}", CvePACCancelacion)
Select Case CvePACCancelacion
diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb
index 87c370a23..15833e3e0 100644
--- a/Bancos/IE.aspx.vb
+++ b/Bancos/IE.aspx.vb
@@ -5058,8 +5058,12 @@ Partial Class Bancos_IE
Dim fileItem As Archivo = Filesgral(0)
Dim Path As String = HttpContext.Current.Request.ApplicationPath
Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
- Path = HttpContext.Current.Request.MapPath(Path)
+
+ Path = Extensiones.DirectorioBaseEmpresas
Path += String.Format("Empresas/{0}/IE", UsuarioActual.CveEmpresa)
+
+
+
If Not Directory.Exists(Path) Then
Directory.CreateDirectory(Path)
End If
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 05acca532..bedc186b0 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -1366,7 +1366,15 @@ Partial Class Compras_Compras
Dim ObjPersonal As New ClsRH
ObjPersonal.GetPersonal(-1, UsuarioActual.CveEmpresa)
DdlPersonal.DataSource = ObjPersonal.DtResultados
- DdlPersonalReembolso.DataSource = ObjPersonal.DtResultados.FiltraParametros("CveEstatusPersonal = 1")
+
+ If UsuarioActual.CveEmpresa = 119 Then
+ DdlPersonalReembolso.DataSource = ObjPersonal.DtResultados
+ Else
+ DdlPersonalReembolso.DataSource = ObjPersonal.DtResultados.FiltraParametros("CveEstatusPersonal = 1")
+ End If
+
+
+
ObjPersonal.Dispose()
DdlPersonal.DataBind()
DdlPersonalReembolso.DataBind()
diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb
index 58e9dd59c..3b39e3541 100644
--- a/Compras/eFacturas.aspx.vb
+++ b/Compras/eFacturas.aspx.vb
@@ -2710,7 +2710,7 @@ Partial Class Compras_eFacturas
Dim PrefijoPagos As String = ""
For Each nodoPrefijo As XmlNode In nodeComp.ChildNodes
- If nodoPrefijo.Prefix <> "tfd" Then
+ If nodoPrefijo.Prefix <> "tfd" And nodoPrefijo.Prefix.ToUpper.Contains("PAGO") Then
PrefijoPagos = nodoPrefijo.Prefix
End If
Next
diff --git a/Contratos/ContratoObra.aspx b/Contratos/ContratoObra.aspx
index ea4c94e5d..bea7e596d 100644
--- a/Contratos/ContratoObra.aspx
+++ b/Contratos/ContratoObra.aspx
@@ -102,6 +102,10 @@
Agregar Gasto
+
+ Agregar Maquionaria Flotilla Herramienta
+
+
@@ -1011,19 +1015,7 @@
- <%--
-
-
-
-
-
-
-
-
- --%>
+
InsumosMano de Obra
- Flotillas
+ Maquinaria Herramienta Flotilla
@@ -2764,18 +2756,30 @@
@@ -1576,6 +1587,7 @@
+
@@ -7220,7 +7232,7 @@
if (Chk.checked) {
let SaldoMaximoUtilizable = ToDouble(HdnSaldoMaximoUsados.value)
let ImportesAsignados = 0;
-
+
$('.ImportesRNCCargo').each(function () {
if ($(this).context.id != TxtImporte.id) {
ImportesAsignados += ToDouble($(this).val());
@@ -7235,16 +7247,15 @@
TxtImporte.value = FormatoNumero(Saldo, 2);
}
} else {
- TxtImporte.value = "";
- Chk.checked = false;
- //if (SaldoMaximoUtilizable > 0) {
- // TxtImporte.value = "";
- // Chk.checked = false;
- //} else {
- // TxtImporte.value = FormatoNumero(Saldo, 2);
- //}
- }
+ if (SaldoMaximoUtilizable > 0) {
+ TxtImporte.value = "";
+ Chk.checked = false;
+ } else {
+ TxtImporte.value = FormatoNumero(Saldo, 2);
+ }
+ }
+
} else {
TxtImporte.value = "";
}
@@ -7791,7 +7802,10 @@
var totalDebito = ToDouble($get("TxtImporteDebito").value);
var totalCheque = ToDouble($get("TxtImporteCheque").value);
var totalTransferencia = ToDouble($get("TxtImporteTransferencia").value);
+
var totalRNC = ToDouble($get("HdnTotalRNC").value);
+ var totalAmortizado = ToDouble($get("HdnAnticipos").value);
+ var totalProntoPago = ToDouble($get("HdnProntoPago").value);
var TotalOtrosContado = 0;
@@ -7801,7 +7815,7 @@
}
} catch (e) { }
- var total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia + TotalOtrosContado + totalRNC;
+ var total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia + TotalOtrosContado + totalRNC + totalAmortizado + totalProntoPago;
var totalVenta = ToDouble($get('TxtTotal').value);
if (total > totalVenta) {
@@ -7810,7 +7824,7 @@
$get("TxtCambio").value = "0.00";
}
- $get("TxtImporteContado").value = total - totalRNC;
+ $get("TxtImporteContado").value = total - totalRNC - totalAmortizado - totalProntoPago;
}
// ****************************************************************************************************************************************************************************
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 4a4ecc7da..ce8535aa8 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -3996,6 +3996,8 @@ Partial Class Ventas
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer))
+ TmpDT.Columns.Add("TieneProntoPago", GetType(String))
+ TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
GvPS.DataSource = ObjVentas.DtResultados
GvPS.DataBind()
@@ -7842,6 +7844,25 @@ Partial Class Ventas
End If
End If
End If
+ Dim SerieFolioNCProntoPago As String = ""
+ Dim CveVentaNCProntoPago As Integer = -1
+ Dim GeneroDescuentoProntoPago As Boolean = False
+ If ObjFactura.DescuentoProntoPago > 0 Then
+ Dim RespFacturaProntoPago = GenerarNCProntoPago(ObjVentas.IniciaTransacSQL(), ObjClientes, ObjContPaq, ObjFactura)
+ If RespFacturaProntoPago.ObjFacturaProntoPago Is Nothing OrElse RespFacturaProntoPago Is Nothing Then
+ ErrorList.Add("No se pudo generar la nota de crédito de pronto pago")
+ Else
+ If RespFacturaProntoPago.Mensaje.CveVenta <= 0 OrElse RespFacturaProntoPago.Mensaje.TieneError Then
+ ErrorList.Add("No se pudo generar la nota de crédito de pronto pago")
+ Else
+ GeneroDescuentoProntoPago = True
+ CveVentaNCProntoPago = RespFacturaProntoPago.Mensaje.CveVenta
+ SerieFolioNCProntoPago = RespFacturaProntoPago.Mensaje.SerieFolio
+
+ Obj2.Add(RespFacturaProntoPago.ObjFacturaProntoPago)
+ End If
+ End If
+ End If
'MARCA PARA NO SURTIR VENTA DE COTNRATO DE CONSIGNACION DE VENTA | [IPP] : PARCHE
If ErrorList.Count = 0 Then
@@ -7941,7 +7962,7 @@ Partial Class Ventas
'ENVIAR POLIZA VIRTUAL
If ErrorList.Count = 0 Then
- If UsuarioActual.Empresa.Funcionalidad(576) = "1" Then
+ If UsuarioActual.Empresa.Funcionalidad(576) = "1" AndAlso EsProduccion Then
GeneraPolizaVentaWS(ObjFactura)
End If
End If
@@ -8034,7 +8055,7 @@ Partial Class Ventas
SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION
- If Not IsNothing(Obj2) AndAlso Obj2.Count > 0 AndAlso SeTimbro Then
+ If Not GeneroDescuentoProntoPago AndAlso Not IsNothing(Obj2) AndAlso Obj2.Count > 0 AndAlso SeTimbro Then
Dim ofa As Modelos.Factura = CType(Obj2(0), Modelos.Factura)
'asigna el foliofiscal del ingreso que se acaba de timbrar, cuando es amortización de anticipo con NC
If TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
@@ -8046,9 +8067,25 @@ Partial Class Ventas
GeneraPDFFactura(ChkEnviarFactura.Checked)
End If
+ 'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION
+ If GeneroDescuentoProntoPago AndAlso Not IsNothing(Obj2) AndAlso Obj2.Count > 0 AndAlso SeTimbro Then
+ Try
+ Dim ofa As Modelos.Factura = CType(Obj2(Obj2.Count - 1), Modelos.Factura)
+ 'asigna el foliofiscal del ingreso que se acaba de timbrar, cuando es amortización de anticipo con NC
+ ofa.Timbre.CFDIRelacionados.UUID.Clear()
+ ofa.Timbre.CFDIRelacionados.UUID.Add(ObjTimbrado.UUID)
+
+ ObjTimbrado.TimbrarFactura(UsuarioActual, ofa)
+ GeneraPDFFactura(ChkEnviarFactura.Checked)
+ Catch ex As Exception
+ OnError("Ocurrió un error al timbrar la nota de credito", ex)
+ End Try
+ End If
+
If SeTimbro AndAlso ObjFactura.TipoDocto.Contiene("Ing") Then
EstatusSMS = EnviarSMSTimbrado(ObjEventos)
End If
+
If Not SeTimbro Then
Alert(ObjTimbrado.MensajeErrorCFDI, TipoMensaje.MsgError)
End If
@@ -8207,6 +8244,10 @@ Partial Class Ventas
MensajeAlert.AppendFormat("
Su cambio es de ${0} ", TxtCambio.Text.ToDecimal.FormatoNumero(2))
End If
+ If CveVentaNCProntoPago > 0 Then
+ MensajeAlert.AppendFormat(String.Format(" La nota de crédito {0} por descuento pronto pago se generó correctamente.
", SerieFolioNCProntoPago))
+ End If
+
'MUESTA ALERT OK
' si es elrol 1165-Ventas,EMp:80, o la empresa 119, recarga ventas, para seguir registrando-.
Dim Liga = If(UsuarioActual.CveRol = 1165 Or UsuarioActual.CveEmpresa = 119, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", If(CveEmpresaCRM > 0, $"document.location.href=""/CRM/EmpresaCRM.aspx?CveEmpresaCRM={CveEmpresaCRM}"";", $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}&Opt=2"";"))
@@ -9649,6 +9690,7 @@ Partial Class Ventas
End If
ObjFactura.CveTipoRetencion = DdlTipoRetencion.SelectedValue.ToEntero()
+ ObjFactura.DescuentoProntoPago = HdnProntoPago.Value.ToDecimal()
ObjFactura.NuevaFactura = Me.NuevaFactura
End Sub
@@ -10088,6 +10130,12 @@ Partial Class Ventas
tPS = String.Format("{0} {1}", drr("PS"), drr("Obs"))
End If
End If
+
+ If tPS.Length >= 1000 Then
+ Dim tPSRecortado = tPS.Remove(999, tPS.Length - 999)
+ tPS = tPSRecortado
+ End If
+
'condicionante, especial
If UsuarioActual.CveEmpresa = 15 Then drr("UM") = "" ' les comentan que no debe de ir la etiqueta de "unidad" en el producto
@@ -10690,8 +10738,14 @@ Partial Class Ventas
factura.Timbre.Comprobante.Serie = ObjVentas.Serie
factura.Timbre.Comprobante.Folio = ObjVentas.Folio.ToString()
- If Not GuardarUsados(ObjVentas.IniciaTransacSQL, factura) Then
- ErrorList.Add("Error al guardar usados")
+ If ObjFactura.TipoDocto = "Ing" Then
+ If Not GuardarUsados(2, ObjVentas.IniciaTransacSQL, factura) Then
+ ErrorList.Add("Error al guardar usados")
+ End If
+ ElseIf ObjFactura.TipoDocto = "Dev" Then
+ If Not GuardarUsados(1, ObjVentas.IniciaTransacSQL, factura) Then
+ ErrorList.Add("Error al guardar usados")
+ End If
End If
If factura.TipoDocto = "Egs" AndAlso NuevaFactura = 1 Then
@@ -12109,7 +12163,7 @@ Partial Class Ventas
importeMovimiento = 0
Case 103 'Descuento
- If ObjFactura.Descuento <> 0 AndAlso Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "-1" Then
+ If ObjFactura.Descuento <> 0 AndAlso Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") AndAlso (DdlTipoAmortizacionAnticipo.SelectedValue = "-1" OrElse UsuarioActual.CveEmpresa = 141) Then
importeMovimiento = ObjFactura.Descuento * Multiplicador * ValorMultiplicador
importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador * ValorMultiplicador
@@ -14319,6 +14373,7 @@ Partial Class Ventas
'cuando es amortización por NOTA DE CREDITO
If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
LblAntAplicados.Text = String.Format("Amortización por Nota de Crédito: {0:C}", Amortizacion) : LblAntAplicados.Visible = True
+ HdnAnticipos.Value = Amortizacion.RoundSQL(2).ToString()
Amortizacion = 0
HdnTipoDescuento.Value = "-1"
HdnDescuento.Value = "0"
@@ -15015,6 +15070,8 @@ Partial Class Ventas
If ObjVentas.GetVentaDetalle(ObjFacturaDevolucion.CveVenta) Then
TmpDT = ObjVentas.DtResultados
TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer))
+ TmpDT.Columns.Add("TieneProntoPago", GetType(String))
+ TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
End If
ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFacturaDevolucion, -1, TmpDT, ObjAC, -1, ObjBancos, ObjVentas)
Else
@@ -16221,6 +16278,14 @@ Partial Class Ventas
Descuento += ((Cantidad * PU) - TotalFinal)
End If
+ 'SI TIENE PRONTO PAGO CALCULA EL IMPORTE
+ If RowPorcentaje("ProntoPago").ToString().ToDecimal() > 0 Then
+ Dim TotalProntoPago As Decimal = (Cantidad * (PU)) - Descuento
+ Dim PorcentajeProntoPago = RowPorcentaje("ProntoPago").ToString().ToDecimal() / 100D
+
+ ObjDescuento.ImporteProntoPago = (TotalProntoPago * PorcentajeProntoPago).RoundSQL(2)
+ End If
+
End If
End If
End If
@@ -16254,6 +16319,7 @@ Partial Class Ventas
Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal
Dim PU As Decimal = If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal)
+
Dim ObjDescuento As Descuentos = CalcularDescuentos(CvePS, Cantidad, PU)
If ObjDescuento.EsPUModificado Then
PU = ObjDescuento.PU
@@ -16262,7 +16328,8 @@ Partial Class Ventas
AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero(), DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero(), DdlClasificacion.SelectedItem.Text,
CvePS, "", TxtObsPS.Text.Trim, PU, ObjDescuento.ImporteDescuento,
DdlProyecto.SelectedValue.ToEntero(), DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text,
- Serie:=If(DIVCod.Visible, TxtCodigoSerie.Text.Trim, ""), TiempoEntrega:=TxtTiempoEntrega.Text, CuentaPredial:=TxtCuentaPredial.Text.Trim, RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle)
+ Serie:=If(DIVCod.Visible, TxtCodigoSerie.Text.Trim, ""), TiempoEntrega:=TxtTiempoEntrega.Text, CuentaPredial:=TxtCuentaPredial.Text.Trim, RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle,
+ ImporteProntoPago:=ObjDescuento.ImporteProntoPago)
CalculaUsados()
@@ -16396,7 +16463,8 @@ Partial Class Ventas
PU As Decimal, Descuento As Decimal, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, Optional Serie As String = "", Optional TiempoEntrega As String = "",
Optional EntregaDirecta As Integer = 0, Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, Optional CuentaPredial As String = "",
- Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1, Optional EsCargo As Boolean = False) As Boolean
+ Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1, Optional EsCargo As Boolean = False,
+ Optional ImporteProntoPago As Decimal = 0) As Boolean
Dim Retorno As Boolean = False
Try
@@ -16405,10 +16473,10 @@ Partial Class Ventas
Return False
End If
- If (Obs.Length + PS.Length > 1000) AndAlso DdlTipoComprobante.SelectedValue <> "Cot" Then
- Alert(String.Format("El Nombre y observación del producto tiene longitud de {0} caracteres y excede los 1000 caracteres permitidos.", Obs.Length + PS.Length), TipoMensaje.MsgAdvertencia)
- Return False
- End If
+ 'If (Obs.Length + PS.Length > 1000) AndAlso DdlTipoComprobante.SelectedValue <> "Cot" Then
+ ' Alert(String.Format("El Nombre y observación del producto tiene longitud de {0} caracteres y excede los 1000 caracteres permitidos.", Obs.Length + PS.Length), TipoMensaje.MsgAdvertencia)
+ ' Return False
+ 'End If
'VALIDA CONCEPTOS EN CERO - YA SE VALIDA ANTES CON FUNCIONALIDAD - A MIRAS DE ELIMINAR - IPP 28 AGOSTO 2017
If Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "Ant") Then
@@ -16425,7 +16493,7 @@ Partial Class Ventas
Dim Row As DataRow = Nothing
Dim TotalCalculableImpuestos As Decimal = 0
Dim TotalCalculableImpuestosIVA As Decimal = 0
- PU = PU.RoundAD(6) ' el precio unitario puede llevar hasta 6 decimales permitidos
+ PU = PU.RoundSQL(6) ' el precio unitario puede llevar hasta 6 decimales permitidos
If Not TmpDT.Columns.Contains("RetIVA") Then
TmpDT.Columns.Add("RetIVA", GetType(Decimal))
@@ -16555,24 +16623,24 @@ Partial Class Ventas
Row("IVA") = Row("PorcentajeIVA")
- Row("ImporteIVA") = (Row("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA).RoundAD(NumeroDecimales)
- Row("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundAD(NumeroDecimales)
+ Row("ImporteIVA") = (Row("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales)
+ Row("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
- Row("RetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundAD(NumeroDecimales)
+ Row("RetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
- Row("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundAD(NumeroDecimales)
+ Row("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
Row("PorcentajeRetIVA") = ClienteRetIVA
Row("PorcentajeRetISR") = ClienteRetISR
Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje")
- Row("ImporteIEPS") = (DrPS("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos).RoundAD(NumeroDecimales)
+ Row("ImporteIEPS") = (DrPS("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
Row("IEPS") = Row("ImporteIEPS")
- Row("Descuento") = (Descuento).RoundAD(NumeroDecimales)
+ Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales)
Row("TipoDescuento") = HdnTipoDescuento.Value
Row("CvePromocionDetalle") = CvePromocionDetalle
Row("Total") = (Cantidad * PU)
- Row("TotalImporte") = (Cantidad * PU).RoundAD(NumeroDecimales)
+ Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales)
'Row("AsientoContableVentas") = DrPS("AsientoContableVentas")
' Row("IdCtaContVentas") = IdCtaContable
@@ -16598,6 +16666,14 @@ Partial Class Ventas
Row("EsOutSourcing") = DrPS("EsOutSourcing")
Row("EsCargo") = EsCargo
+ If ImporteProntoPago > 0 Then
+ Row("ImporteProntoPago") = ImporteProntoPago
+ Row("TieneProntoPago") = "Si"
+ GvPS.Columns(22).Visible = True
+ thProntoPago.Visible = True
+ thProntoPago2.Visible = True
+ End If
+
If UsuarioActual.CveEmpresa = 119 Then
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
@@ -16817,9 +16893,15 @@ Partial Class Ventas
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer))
+ TmpDT.Columns.Add("TieneProntoPago", GetType(String))
+ TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
+
TmpDT.Columns("EsOutSourcing").DefaultValue = False
TmpDT.Columns("EsCargo").DefaultValue = False
+ TmpDT.Columns("TieneProntoPago").DefaultValue = "No"
+ TmpDT.Columns("ImporteProntoPago").DefaultValue = 0
+
End Sub
Private Sub CreaDTmpC()
DTmpC = New DataTable
@@ -17242,6 +17324,8 @@ Partial Class Ventas
Dim Total As Decimal = 0
Dim TotalImpuestosLocales As Decimal = 0
+ Dim TotalProntoPago As Decimal = TmpDT.SUM("ImporteProntoPago").ToDecimal
+
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
@@ -17309,6 +17393,9 @@ Partial Class Ventas
TxtIEPS.Text = TotalIEPS.FormatoNumero
TxtTotal.Text = Total.FormatoNumero
+ HdnProntoPago.Value = TotalProntoPago.ToString()
+ LblProntoPago.Text = TotalProntoPago.FormatoNumero(2)
+
LblAmort.Text = TxtSubTotal.Text
If CveVenta <= 0 OrElse (CveDevolucion > 0 And NuevaFactura = 1) Then
HdnVentaSaldo.Value = Total.ToString()
@@ -24827,7 +24914,14 @@ Partial Class Ventas
Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal()
- Dim Obs = RowUsado("CodigoPS").ToString()
+ Dim CvePSCargo As Integer = RowUsado("CvePS").ToString().ToEntero()
+ Dim Obs = ""
+ 'SI ES ACUMULADOR LAS OBSERVACIOENS DEBEN SER EL NOMBRE DEL ACUMULADOR
+ If GlobalDTAcumTamaños().FiltroPrimero($"CvePSCargo = {CvePSCargo}") IsNot Nothing Then
+ Obs = RowUsado("CodigoPS").ToString()
+ Else
+ Obs = RowUsado("Obs").ToString()
+ End If
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
@@ -24898,12 +24992,20 @@ Partial Class Ventas
For Each RNC In ListaNC
Dim UltimoRenglonRNC As Integer = 1
Dim TotalAcumuladoRNC As Decimal = 0
+ Dim Terminar As Boolean = False
For Each RowUsado As DataRow In Me.TmpDTRNCDetalleSelecciondas.FiltraParametros($"CveVenta={RNC.CveVenta}").Rows
Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal()
- Dim Obs = RowUsado("CodigoPS").ToString()
+ Dim CvePSCargo As Integer = RowUsado("CvePS").ToString().ToEntero()
+ Dim Obs = ""
+ 'SI ES ACUMULADOR LAS OBSERVACIOENS DEBEN SER EL NOMBRE DEL ACUMULADOR
+ If GlobalDTAcumTamaños().FiltroPrimero($"CvePSCargo = {CvePSCargo}") IsNot Nothing Then
+ Obs = RowUsado("CodigoPS").ToString()
+ Else
+ Obs = RowUsado("Obs").ToString()
+ End If
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
@@ -24921,8 +25023,32 @@ Partial Class Ventas
TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA)
+
+ 'SI EL IMPORTE ES MAYOR REALIZA EL AJUSTE
+ If TotalAcumuladoRNC > RNC.TotalRemNCAplicado Then
+ Terminar = True
+ 'RESTA LO SUMANDO DEL ACUMULADO
+ TotalAcumuladoRNC -= (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
+
+ Dim Diferencia As Decimal = RNC.TotalRemNCAplicado - TotalAcumuladoRNC
+
+ Dim TotalPartida As Decimal = (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
+
+ Dim PorcentajePorAplicar As Decimal = (Diferencia / TotalPartida)
+
+ Cantidad = Cantidad * PorcentajePorAplicar
+
+ TotalCalculableImpuestos = (Cantidad * ImportePU)
+ ImporteIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
+
+
+ ImporteTotal = TotalCalculableImpuestos
+
+ TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
+ End If
+
'SI ES EL ULTIMO REGLON REALIZA UN AJUSTE
- If UltimoRenglonRNC = RNC.DtDetalle.Rows.Count Then
+ If UltimoRenglonRNC = Me.TmpDTRNCDetalleSelecciondas.FiltraParametros($"CveVenta={RNC.CveVenta}").Rows.Count OrElse Terminar Then
Dim Ajuste As Decimal = 0
If Math.Abs(RNC.TotalRemNCAplicado - TotalAcumuladoRNC) > 0.00 Then
Ajuste = RNC.TotalRemNCAplicado - TotalAcumuladoRNC
@@ -24937,6 +25063,10 @@ Partial Class Ventas
Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, 0, ImporteRetIVA,
0, ImporteRetISR, 0, ImporteIEPS, -1, 0.0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero())
+
+ If Terminar Then
+ Exit For
+ End If
Next
Next
@@ -25047,6 +25177,8 @@ Partial Class Ventas
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer))
+ TmpDT.Columns.Add("TieneProntoPago", GetType(String))
+ TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
End If
If AplicaNCMasiva OrElse AplicaNCUsado Then
@@ -26516,6 +26648,12 @@ Partial Class Ventas
Return Nothing
End Function
Private Function AgregaPSCotizacion() As Boolean
+ 'Dim ObjFactCotizacion As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa)
+
+ 'Dim TotalCotizacion As Decimal = ObjFactCotizacion.Total 'TmpDT.SUM("TotalImporte").ToDecimal() + TmpDT.SUM("ImporteIVA").ToDecimal() + TmpDT.SUM("ImporteIEPS").ToDecimal() - TmpDT.SUM("ImporteRetIVA").ToDecimal() - TmpDT.SUM("ImporteRetISR").ToDecimal()
+
+ 'ObjFactCotizacion.Dispose()
+
If DtCotizacionesPS IsNot Nothing Then
Dim tCantidad As Decimal = 0
For Each Dr As DataRow In DtCotizacionesPS.Select()
@@ -26525,6 +26663,15 @@ Partial Class Ventas
Dr("CveProyecto").ToString().ToEntero(), Dr("Proyecto").ToString(), Dr("CveSubProyecto").ToString().ToEntero(), Dr("SubProyecto").ToString(),
CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero(), CveVentaDetalleCotizacion:=Dr("CveVentaDetalle").ToString().ToEntero(), SeActualiza:=True)
Next
+ 'Dim TotalFactura = TmpDT.SUM("TotalImporte").ToDecimal() + TmpDT.SUM("ImporteIVA").ToDecimal() + TmpDT.SUM("ImporteIEPS").ToDecimal() - TmpDT.SUM("ImporteRetIVA").ToDecimal() - TmpDT.SUM("ImporteRetISR").ToDecimal()
+
+ 'Dim Diferencia As Decimal = TotalCotizacion - TotalFactura
+
+ 'If Diferencia <> 0 Then
+ ' Dim LastRow As DataRow = TmpDT.Rows(TmpDT.Rows.Count - 1)
+ ' LastRow("ImporteIVA") = LastRow("ImporteIVA").ToString().ToDecimal() - Diferencia
+ 'End If
+
CalculaTotalesVenta()
Return True
Else
@@ -26537,6 +26684,9 @@ Partial Class Ventas
#Region " COTIZACIONES - FACTURAR "
Private Function PreparaFacturarCotizacion() As Boolean
'LIMPIAMOS
+
+ 'Dim TotalCotizacion As Decimal = TxtTotal.Text.Replace(",", "").ToDecimal()
+
TmpDT.Rows.Clear()
TxtSubTotal.Text = "0.00"
TxtSubTotal2.Text = "0.00"
@@ -26565,6 +26715,18 @@ Partial Class Ventas
Return False
End If
+ 'Dim TotalFactura As Decimal = TmpDT.SUM("TotalImporte").ToDecimal() + TmpDT.SUM("ImporteIVA").ToDecimal() + TmpDT.SUM("ImporteIEPS").ToDecimal() - TmpDT.SUM("ImporteRetIVA").ToDecimal() - TmpDT.SUM("ImporteRetISR").ToDecimal()
+
+ 'Dim Diferencia As Decimal = TotalCotizacion - TotalFactura
+
+ 'If Diferencia <> 0 Then
+ ' Dim LastRow As DataRow = TmpDT.Rows(TmpDT.Rows.Count - 1)
+
+ ' LastRow("ImporteIVA") = LastRow("ImporteIVA").ToString().ToDecimal() + Diferencia
+
+ ' CalculaTotalesVenta()
+ 'End If
+
If TmpDT.Rows.Count = 0 Then
Alert("No hay conceptos por facturar de esta cotización o ha sido cambiada su información. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Return False
@@ -27956,17 +28118,17 @@ Partial Class Ventas
End If
End Sub
- Private Function GuardarUsados(SqlTransaccion As SqlClient.SqlTransaction, factura As Modelos.Factura) As Boolean
+ Private Function GuardarUsados(CveConcepto As Integer, SqlTransaccion As SqlClient.SqlTransaction, factura As Modelos.Factura) As Boolean
Dim Resultado As Boolean = True
- If ClienteEsDistribuidor AndAlso factura.TipoDocto.Contiene("Ing") Then
+ If ClienteEsDistribuidor Then
Dim ObjAcum As New ClsAcumuladores(SqlTransaccion)
Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero
For Each drow As DataRow In factura.DtDetalle.Rows
If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then
- If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, 2, factura.CveVenta, UsuarioActual.CveUsuario,
+ If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario,
UsuarioActual.CveEmpresa, 0D, "") Then
Resultado = False
Exit For
@@ -28053,7 +28215,7 @@ Partial Class Ventas
End Select
If ChkMostarProductosRNC.Checked Then
-
+ Dim TotalAcumulado As Decimal = 0
Me.AplicaRNCXDetalle = True
For Each GvRow As GridViewRow In GvRemisionesNCDetalle.Rows
@@ -28061,12 +28223,13 @@ Partial Class Ventas
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim Rows = TmpDTRNCDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}")
For Each row In Rows
- row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToEntero()
+ row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal()
TmpDTRNCDetalleSelecciondas.Rows.Add(row.ItemArray)
Next
End If
End If
Next
+ Dim TerminarCiclo As Boolean = False
For Each Dr As DataRow In TmpDTRNCDetalleSelecciondas.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows
Dim RemNC As New Modelos.Factura(UsuarioActual, Dr("CveVenta").ToString().ToEntero(), UsuarioActual.CveEmpresa)
@@ -28092,6 +28255,14 @@ Partial Class Ventas
End If
Next
+ TotalAcumulado += TotalRNC
+
+ 'SI SE EXECE RESTA AL ULTIMO
+ If TotalAcumulado > LtlSMU.Text.ToDecimal() Then
+ TerminarCiclo = True
+ TotalAcumulado -= TotalRNC
+ TotalRNC = LtlSMU.Text.ToDecimal() - TotalAcumulado
+ End If
RemNC.TotalRemNCAplicado = TotalRNC
'MARCA LA VENTA QUE FUE USADA PARA EL FILTRO
@@ -28105,6 +28276,10 @@ Partial Class Ventas
End If
ListaRemisionesNC.Add(RemNC)
+
+ If TerminarCiclo Then
+ Exit For
+ End If
Next
Else
@@ -28732,6 +28907,7 @@ Partial Class Ventas
Public CvePromocionDetalle As Integer = -1
Public PU As Decimal = 0
Public EsPUModificado As Boolean = False
+ Public ImporteProntoPago As Decimal = 0
End Class
Protected Sub btnupEventoBitacora_Click(sender As Object, e As EventArgs)
@@ -28993,4 +29169,468 @@ Partial Class Ventas
+#Region " N O T A - D E - C R E D I T O - P R O N T O - P A G O"
+
+ Private Function GenerarNCProntoPago(SqlTransaccion As SqlClient.SqlTransaction, ByRef ObjCliente As ClsClientes, ByRef ObjConta As ClsContPAQi, ObjFactura As Modelos.Factura) As MensajeProntoPago
+ Dim Retorno As New MensajeProntoPago
+
+ Dim Resp As New Modelos.Factura.MMensajeFactura
+ Dim ObjFacturaProntoPago As Modelos.Factura = Nothing
+
+ Try
+ ObjFacturaProntoPago = New Modelos.Factura(UsuarioActual)
+
+ ObjFacturaProntoPago.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.TextoLimpio
+ ObjFacturaProntoPago.CveUsuario = UsuarioActual.CveUsuario
+ ObjFacturaProntoPago.UsuarioCreo = UsuarioActual.Usuario
+
+ Dim CveSubProyecto As Integer = ObjFactura.CveSubProyecto
+ Dim CveMoneda As Integer = ObjFactura.CveMoneda
+ Dim CveCliente As Integer = ObjFactura.CveCliente
+
+ Dim Folio As Integer = -1
+ Dim Serie As String = "-1"
+
+ ObjFacturaProntoPago.CveEmpresa = UsuarioActual.CveEmpresa
+ ObjFacturaProntoPago.TipoCambio = If(CveMoneda = 1, 1, GlobalTipoCambio(Now).FormatoNumero(4).ToDecimal())
+ ObjFacturaProntoPago.ConvertirPesos = False
+ ObjFacturaProntoPago.CveMoneda = CveMoneda
+ ObjFacturaProntoPago.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", $"CveMoneda = {CveMoneda}")
+ ObjFacturaProntoPago.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", $"CveMoneda = {CveMoneda}")
+ ObjFacturaProntoPago.Serie = Serie
+ ObjFacturaProntoPago.Folio = Folio
+ ObjFacturaProntoPago.Fecha = Now
+ ObjFacturaProntoPago.CvePrePoliza = -1
+ ObjFacturaProntoPago.CveMetodoPago = 0
+ ObjFacturaProntoPago.CondicionesPago = 0 ' 0 - Contado, 1 - Credito (CHECAR)
+ ObjFacturaProntoPago.FormaPago = 0
+
+ ObjFacturaProntoPago.TipoDocto = "Egs"
+ ObjFacturaProntoPago.Fecha = Now
+
+ ObjFacturaProntoPago.Version = "3.3"
+ ObjFacturaProntoPago.CveMetodoPago33 = 1
+ ObjFacturaProntoPago.MetodoPago33 = "Pago en una sola exhibición"
+ ObjFacturaProntoPago.ClaveMetodoPagoSAT = "PUE"
+
+ ObjFacturaProntoPago.CveFormaPago33 = 21
+ ObjFacturaProntoPago.FormaPago33 = "Aplicación de anticipos"
+ ObjFacturaProntoPago.FormaPagoSAT33 = "30"
+
+ ObjFacturaProntoPago.MetodoPago = ""
+ ObjFacturaProntoPago.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {ObjFacturaProntoPago.CveMetodoPago33}")
+
+ ObjFacturaProntoPago.CveSubProyecto = CveSubProyecto
+ ObjFacturaProntoPago.SetSubProyecto()
+
+ ObjFacturaProntoPago.CveCliente = CveCliente
+ ObjFacturaProntoPago.SetCliente()
+
+
+ If ObjCliente.GetClientes(ObjFacturaProntoPago.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, -1, TipoCliente:=-1) Then
+ If ObjCliente.DtResultados.Rows.Count > 0 Then
+
+ ObjFacturaProntoPago.CveUsoCFDI = ObjCliente.CveUsoCFDI
+ ObjFacturaProntoPago.UsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("Descripcion", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI))
+ ObjFacturaProntoPago.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI))
+
+ ObjFacturaProntoPago.DtDetalle = CreaDTDetalleNCProntoPago()
+
+ CargaImpuestosProntoPago(ObjFacturaProntoPago, ObjFactura, ObjCliente.DesglosaIEPS, ObjCliente.RetIVA.ToDecimal, ObjCliente.RetISR.ToDecimal)
+
+ End If
+ End If
+
+ If ObjCliente.GetSucursales(CveCliente) Then
+ If ObjCliente.DtResultados.Rows.Count > 0 Then
+ ObjFacturaProntoPago.CveClienteSucursal = If(String.IsNullOrEmpty(ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'")), -1, ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'").ToEntero())
+ Else
+ ObjFacturaProntoPago.CveClienteSucursal = -1
+ End If
+ End If
+
+ ObjFacturaProntoPago.CveTipoRelacion = 7
+ ObjFacturaProntoPago.TipoRelacion = "07"
+
+ Dim Fol As New List(Of String)
+ Fol.Add(ObjFactura.FolioFiscal)
+ ObjFacturaProntoPago.UUIDRelacionados = Fol
+
+ Select Case ObjFacturaProntoPago.TipoDocto
+ Case "Ing"
+ ObjFacturaProntoPago.TipoDocumento = "Factura"
+ Case "REM"
+ ObjFacturaProntoPago.TipoDocumento = "Remision"
+ Case "Cot"
+ ObjFacturaProntoPago.TipoDocumento = "Cotizacion"
+ Case "Egs"
+ ObjFacturaProntoPago.TipoDocumento = "Nota de Crédito"
+ Case "Dev"
+ ObjFacturaProntoPago.TipoDocumento = "Nota de Devolución"
+ Case Else
+ ObjFacturaProntoPago.TipoDocumento = ""
+ End Select
+
+ ObjFacturaProntoPago.FechaPago = Now
+
+ ObjFacturaProntoPago.CveCorte = -1
+ ObjFacturaProntoPago.CveMesa = -1
+ ObjFacturaProntoPago.NumeroPersonas = 0
+ ObjFacturaProntoPago.CveContrato = -1
+ ObjFacturaProntoPago.DescripcionContrato = ""
+ ObjFacturaProntoPago.CveClienteSucursal = -1
+ ObjFacturaProntoPago.Entrega = ""
+ ObjFacturaProntoPago.CveAlmacen = -1
+
+ Dim DtVentasNC = InicializaDTVentasNCProntoPago()
+
+ Dim TotalImporte As Decimal = ObjFacturaProntoPago.DtDetalle.SUMD("TotalImporte")
+ Dim ImporteIVA As Decimal = ObjFacturaProntoPago.DtDetalle.SUMD("ImporteIVA")
+ Dim ImporteRetIVA As Decimal = ObjFacturaProntoPago.DtDetalle.SUMD("ImporteRetIVA")
+ Dim ImporteRetISR As Decimal = ObjFacturaProntoPago.DtDetalle.SUMD("ImporteRetISR")
+ Dim ImporteIEPS As Decimal = ObjFacturaProntoPago.DtDetalle.SUMD("ImporteIEPS")
+ Dim Descuento As Decimal = ObjFacturaProntoPago.DtDetalle.SUMD("Descuento")
+ Dim Amortizacion As Decimal = 0
+
+ Dim Total As Decimal = (TotalImporte + ImporteIVA + ImporteIEPS) - (ImporteRetIVA + ImporteRetISR + Descuento + Amortizacion)
+
+ 'DETALLES
+ ObjFacturaProntoPago.SubTotal = TotalImporte
+ ObjFacturaProntoPago.Descuento = Descuento
+ ObjFacturaProntoPago.Amortizacion = Amortizacion
+ ObjFacturaProntoPago.IVA = ImporteIVA
+ ObjFacturaProntoPago.RetIVA = ImporteRetIVA
+ ObjFacturaProntoPago.RetISR = ImporteRetISR
+ ObjFacturaProntoPago.IEPS = ImporteIEPS
+ ObjFacturaProntoPago.Total = Total
+ ObjFacturaProntoPago.TotalOtrosConceptos = 0
+
+ Dim Drt = DtVentasNC.NewRow
+ Drt("CveVenta") = ObjFactura.CveVenta
+ Drt("Importe") = ObjFactura.DescuentoProntoPago
+ Drt("FolioFiscal") = ObjFactura.FolioFiscal
+
+ DtVentasNC.Rows.Add(Drt)
+ DtVentasNC.AcceptChanges()
+
+ ObjFacturaProntoPago.DtVentasNC = DtVentasNC
+
+ Resp = ObjFacturaProntoPago.EmitirFactura(False, Transac:=SqlTransaccion, ObjContPaqTransac:=ObjConta)
+
+ ObjFacturaProntoPago.Dispose()
+
+ Catch ex As Exception
+ Resp.CveVenta = -1
+ Resp.TieneError = True
+ OnError("Ocurrio un error al generar la nota de credito de pronto pago", ex)
+ End Try
+
+ Retorno.ObjFacturaProntoPago = ObjFacturaProntoPago
+ Retorno.Mensaje = Resp
+
+ Return Retorno
+ End Function
+
+
+ Private Sub AgregaTempDTNCProntoPago(ByRef TmpDT As DataTable, CvePS As Integer, PS As String, Codigo As String, CodigoPS As String, CveTipoPS As Integer, CveTipoInvPS As Integer, CveUM As Integer, UM As String,
+ CveClasificacion As Integer, Clasificacion As String, CveProyecto As Integer, CveSubProyecto As Integer,
+ Obs As String, Cantidad As Double, PU As Double, PorcentajeIVA As Double, ImporteIVA As Double, PorcentajeRetIVA As Double, ImporteRetIVA As Double,
+ PorcentajeRetISR As Double, ImporteRetISR As Double, PorcentajeIEPS As Double, ImporteIEPS As Double, TipoDescuento As Integer, Descuento As Double,
+ Total As Double, Serie As String, TiempoEntrega As String, CvePresupuestoIngreso As Integer, EntregaDirecta As Integer, SATClaveProdServ As String,
+ SATClaveUM As String, CveContratoDetalle As Integer, CveVentaDetalle As Integer, CveMovimientoDetallePedido As Integer, CveOrdenCompraDetalle As Integer,
+ CveVentaDetalleRemision As Integer, CveVentaDetalleCotizacion As Integer)
+
+ Dim Row As DataRow = Nothing
+ Row = TmpDT.NewRow()
+
+ Row("Consec") = TmpDT.Rows.Count + 1
+ Row("Orden") = TmpDT.Rows.Count + 1
+
+ Row("CvePS") = CvePS
+ Row("PS") = PS
+ Row("Codigo") = Codigo
+ Row("CodigoPS") = CodigoPS
+ Row("CveTipoPS") = CveTipoPS
+ Row("CveTipoInvPS") = CveTipoInvPS
+
+ Row("CveUM") = CveUM
+ Row("UM") = UM
+
+ Row("CveClasificacion") = CveClasificacion
+ Row("Clasificacion") = Clasificacion
+ Row("CveProyecto") = CveProyecto
+ Row("Proyecto") = ""
+ Row("CveSubProyecto") = CveSubProyecto
+ Row("SubProyecto") = ""
+
+ Row("Obs") = Obs
+ Row("Cantidad") = Cantidad
+ Row("PU") = Math.Round(PU, 6)
+ Row("PorcentajeIVA") = PorcentajeIVA
+ Row("IVA") = PorcentajeIVA
+ Row("ImporteIVA") = Math.Round(ImporteIVA, 2)
+ Row("PorcentajeRetIVA") = PorcentajeRetIVA
+ Row("ImporteRetIVA") = Math.Round(ImporteRetIVA, 2)
+ Row("PorcentajeRetISR") = PorcentajeRetISR
+ Row("ImporteRetISR") = Math.Round(ImporteRetISR, 2)
+ Row("PorcentajeIEPS") = PorcentajeIEPS
+ Row("ImporteIEPS") = Math.Round(ImporteIEPS, 2)
+ Row("IEPS") = Math.Round(ImporteIEPS, 2)
+ Row("TipoDescuento") = TipoDescuento
+ Row("Descuento") = Math.Round(Descuento, 2)
+ Row("Total") = Math.Round(Total, 2)
+ Row("TotalImporte") = Math.Round(Total, 2)
+
+ Row("Serie") = Serie
+ Row("TiempoEntrega") = TiempoEntrega
+ Row("CvePresupuestoIngreso") = CvePresupuestoIngreso
+ Row("EntregaDirecta") = EntregaDirecta
+ Row("SATClaveProdServ") = SATClaveProdServ
+ Row("SATClaveUM") = SATClaveUM
+
+ 'Contratos
+ Row("CveContratoDetalle") = CveContratoDetalle
+ Row("CveVentaDetalle") = CveVentaDetalle
+ Row("CveMovimientoDetallePedido") = CveMovimientoDetallePedido
+ Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle
+ Row("CveVentaDetalleRemision") = CveVentaDetalleRemision
+ Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
+
+ TmpDT.Rows.Add(Row)
+ End Sub
+
+ Private Sub CargaImpuestosProntoPago(ByRef ObjFacturaDevolucion As Modelos.Factura, ObjFactura As Modelos.Factura, ClienteDesglosaIEPS As Boolean, ClienteRetIVA As Decimal, ClienteRetISR As Decimal)
+ Dim DtImpuestos As New DataTable
+ DtImpuestos.Columns.Add("ImportePU", GetType(Decimal))
+ DtImpuestos.Columns.Add("ImporteTotal", GetType(Decimal))
+ DtImpuestos.Columns.Add("PorcentajeIVA", GetType(Decimal))
+ DtImpuestos.Columns.Add("ImporteIVA", GetType(Decimal))
+ DtImpuestos.Columns.Add("PorcentajeRetIVA", GetType(Decimal))
+ DtImpuestos.Columns.Add("ImporteRetIVA", GetType(Decimal))
+ DtImpuestos.Columns.Add("PorcentajeRetISR", GetType(Decimal))
+ DtImpuestos.Columns.Add("ImporteRetISR", GetType(Decimal))
+ DtImpuestos.Columns.Add("PorcentajeIEPS", GetType(Decimal))
+ DtImpuestos.Columns.Add("ImporteIEPS", GetType(Decimal))
+ DtImpuestos.Columns.Add("CveSubProyecto", GetType(Integer))
+ DtImpuestos.AcceptChanges()
+ Dim AcumuladoNC As Decimal = 0
+
+ DtImpuestos.Merge(CargaDtImpuestosNC(ObjFactura.CveVenta, ObjFactura.DescuentoProntoPago), True, MissingSchemaAction.Ignore)
+
+ DtImpuestos = CargaTotalesImpuestosProntoPago(DtImpuestos)
+
+ Dim DrSubProyecto As DataRow = GlobalDTSubProyectos(-1, ObjFacturaDevolucion.CveSubProyecto).Rows(0)
+
+ Dim Cantidad As Decimal = 1
+ Dim CveProyecto As Integer = DrSubProyecto("CveProyecto").ToString().ToEntero()
+ Dim CveSubProyecto = DrSubProyecto("CveSubProyecto").ToString.ToEntero
+ Dim SubProyecto = DrSubProyecto("SubProyecto").ToString
+ Dim Proyecto = DrSubProyecto("Proyecto").ToString
+
+ Dim CveSATNC As Integer
+ Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
+ Dim NCBonificacion As Integer = 0
+ If ArrayNC.Length > 6 Then 'CONCEPTO DE PRONTO PAGO
+ CveSATNC = ArrayNC(6).ToEntero()
+ End If
+ Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CveSATNC, AplicaParaVenta:=1).FiltroPrimero("")
+
+ For Each Dr As DataRow In DtImpuestos.Rows
+ AgregaTempDTNCProntoPago(ObjFacturaDevolucion.DtDetalle, DrPS("CvePS").ToString.ToEntero, DrPS("PS").ToString, DrPS("Codigo").ToString, DrPS("PSCodigo").ToString, DrPS("CveTipoPS").ToString.ToEntero, DrPS("Inv_CveMetodoInventario").ToString.ToEntero,
+ DrPS("CveUM").ToString.ToEntero, DrPS("UnidadMedida").ToString, DrPS("CveClasificacion").ToString.ToEntero, DrPS("Clasificacion").ToString, CveProyecto, CveSubProyecto,
+ "", Cantidad, Dr("ImportePU").ToString.ToDecimal, Dr("PorcentajeIVA").ToString.ToDecimal, Dr("ImporteIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("ImporteRetIVA").ToString.ToDecimal,
+ Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("ImporteRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("ImporteIEPS").ToString.ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString.ToDecimal, "", "", -1, -1,
+ DrPS("SATClavePS").ToString, DrPS("SATClaveUnidadMedida").ToString, -1, -1, -1, -1, -1, -1)
+ Next
+
+ End Sub
+
+ Private Function CargaDtImpuestosNCProntoPago(CveVentaNC As Integer, Importe As Decimal) As DataTable
+ Dim Total As Decimal = 0, SubTotal As Decimal = 0, Saldo As Decimal = 0
+
+ Dim TmpDT As DataTable = Nothing
+ Dim ObjVentas As New ClsVentas
+
+ If ObjVentas.GetVentaDetalle(CveVentaNC) Then
+ TmpDT = ObjVentas.DtResultados
+ TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
+ TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
+ End If
+
+ If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa) Then
+ If ObjVentas.DtResultados.Rows.Count > 0 Then
+ Total = ObjVentas.DtResultados()(0)("Total").ToString.ToDecimal
+ SubTotal = ObjVentas.DtResultados()(0)("SubTotal").ToString.ToDecimal
+ End If
+ End If
+ ObjVentas.Dispose()
+
+ Dim DtImpuestosLocal = TmpDT.FiltraParametros("", "", {"PorcentajeIVA", "PorcentajeRetIVA", "PorcentajeRetISR", "PorcentajeIEPS", "CveSubProyecto"}).Copy
+ DtImpuestosLocal.Columns.Add("ImportePU", GetType(Decimal))
+ DtImpuestosLocal.Columns.Add("ImporteTotal", GetType(Decimal))
+ DtImpuestosLocal.Columns.Add("ImporteIVA", GetType(Decimal))
+ DtImpuestosLocal.Columns.Add("ImporteRetIVA", GetType(Decimal))
+ DtImpuestosLocal.Columns.Add("ImporteRetISR", GetType(Decimal))
+ DtImpuestosLocal.Columns.Add("ImporteIEPS", GetType(Decimal))
+
+ Dim ImporteReferencia As Decimal = Total
+ Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100
+ Dim FiltroStr As String = ""
+ Dim ImporteTotalConcepto As Decimal = 0
+ For Each Dr As DataRow In DtImpuestosLocal.Rows
+ FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("CveSubProyecto"))
+ ImporteTotalConcepto = Porcentaje * (TmpDT.SUMD("TotalImporte", FiltroStr) - TmpDT.SUMD("Descuento", FiltroStr))
+
+ Dr("ImportePU") = ImporteTotalConcepto.RoundSQL(6)
+ Dr("ImporteTotal") = ImporteTotalConcepto.RoundSQL(2)
+
+ Dr("ImporteIVA") = (ImporteTotalConcepto * Dr("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2)
+ Dr("ImporteRetIVA") = (ImporteTotalConcepto * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2)
+ Dr("ImporteRetISR") = (ImporteTotalConcepto * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2)
+ Dr("ImporteIEPS") = (ImporteTotalConcepto * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2)
+
+ 'Dr("ImporteIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIVA", FiltroStr), 2)
+ 'Dr("ImporteRetIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetIVA", FiltroStr), 2)
+ 'Dr("ImporteRetISR") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetISR", FiltroStr), 2)
+ 'Dr("ImporteIEPS") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIEPS", FiltroStr), 2)
+
+ '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal)
+ Next
+ 'codigo para ajuste de centavo, si el importe total no cuadra con los totales
+ Dim difTmp As Decimal = Importe - (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR"))
+ If Math.Abs(difTmp) >= 0.01 Then
+ 'asusto la diferencia en el último concepto
+ Dim ImporteAjustado As Decimal = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal").ToString.ToDecimal + difTmp
+ DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal") = ImporteAjustado
+ DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImportePU") = ImporteAjustado
+ End If
+ 'CARGA FACTURA A LA CUAL SE APLICA LA NC
+ 'CargaNCDT(CveVentaNC, Importe.ToDecimal)
+ Return DtImpuestosLocal
+ End Function
+
+ Private Function CargaTotalesImpuestosProntoPago(DtImpuestos As DataTable) As DataTable
+ Dim query = From dr In DtImpuestos
+ Group By PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal,
+ PorcentajeRetIVA = dr("PorcentajeRetIVA").ToString.ToDecimal,
+ PorcentajeRetISR = dr("PorcentajeRetISR").ToString.ToDecimal,
+ PorcentajeIEPS = dr("PorcentajeIEPS").ToString.ToDecimal
+ Into x = Group
+ Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString.ToDecimal),
+ ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString.ToDecimal),
+ ImporteIVA = x.Sum(Function(s) Math.Round(s("ImporteIVA").ToString.ToDecimal, 2)), ' Math.Round(s("ImporteIVA").ToString.ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
+ ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString.ToDecimal, 2)),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetIVA,
+ ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString.ToDecimal, 2)),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetISR,
+ ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString.ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeIEPS,
+ PorcentajeIVA = PorcentajeIVA,
+ PorcentajeRetIVA = PorcentajeRetIVA,
+ PorcentajeRetISR = PorcentajeRetISR,
+ PorcentajeIEPS = PorcentajeIEPS
+
+ Return query.QueryToDataTable(False)
+ End Function
+
+ Protected Function CreaDTDetalleNCProntoPago() As DataTable
+ Dim TmpDT = New DataTable
+ TmpDT.Columns.Add("CveVenta", GetType(Integer))
+ TmpDT.Columns.Add("Consec", GetType(Integer))
+ TmpDT.Columns.Add("Cantidad", GetType(Decimal))
+ TmpDT.Columns.Add("Codigo", GetType(String))
+ TmpDT.Columns.Add("CveUM", GetType(Integer))
+ TmpDT.Columns.Add("UM", GetType(String))
+ TmpDT.Columns.Add("SATClaveUM", GetType(String))
+ TmpDT.Columns.Add("CveClasificacion", GetType(Integer))
+ TmpDT.Columns.Add("Clasificacion", GetType(String))
+ TmpDT.Columns.Add("CvePS", GetType(Integer))
+ TmpDT.Columns.Add("PS", GetType(String))
+ TmpDT.Columns.Add("CodigoPS", GetType(String))
+ TmpDT.Columns.Add("SATClaveProdServ", GetType(String))
+ TmpDT.Columns.Add("NoIdentificacion", GetType(String))
+ TmpDT.Columns.Add("CveTipoPS", GetType(Integer))
+ TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer))
+ TmpDT.Columns.Add("Serie", GetType(String))
+ TmpDT.Columns.Add("CuentaPredial", GetType(String))
+ TmpDT.Columns.Add("Obs", GetType(String))
+ TmpDT.Columns.Add("TiempoEntrega", GetType(String))
+ TmpDT.Columns.Add("PU", GetType(Decimal))
+ TmpDT.Columns.Add("IVA", GetType(Decimal))
+ TmpDT.Columns.Add("ImporteIVA", GetType(Decimal))
+ TmpDT.Columns.Add("PorcentajeIVA", GetType(Decimal))
+ TmpDT.Columns.Add("ImporteRetIVA", GetType(Decimal))
+ TmpDT.Columns.Add("ImporteRetISR", GetType(Decimal))
+ TmpDT.Columns.Add("PorcentajeRetIVA", GetType(Decimal))
+ TmpDT.Columns.Add("PorcentajeRetISR", GetType(Decimal))
+ TmpDT.Columns.Add("ImporteIEPS", GetType(Decimal))
+ TmpDT.Columns.Add("IEPS", GetType(Decimal))
+ TmpDT.Columns.Add("PorcentajeIEPS", GetType(Decimal))
+ TmpDT.Columns.Add("Descuento", GetType(Decimal))
+ TmpDT.Columns.Add("TipoDescuento", GetType(Integer))
+ TmpDT.Columns.Add("TotalImporte", GetType(Decimal))
+ TmpDT.Columns.Add("Total", GetType(Decimal))
+ 'Para uso del módulo contable
+ TmpDT.Columns.Add("AsientoContableVentas", GetType(Integer))
+ TmpDT.Columns.Add("IdCtaContVentas", GetType(Integer))
+ TmpDT.Columns.Add("AplicaParaConcepto", GetType(Boolean))
+ TmpDT.Columns.Add("CveProyecto", GetType(Integer))
+ TmpDT.Columns.Add("Proyecto", GetType(String))
+ TmpDT.Columns.Add("CveSubProyecto", GetType(Integer))
+ TmpDT.Columns.Add("SubProyecto", GetType(String))
+ TmpDT.Columns.Add("CveVentaDetallePadre", GetType(Integer))
+ 'TipoDescuento: 1 = Descuento * PU; 2 = Descuento por Total del concepto
+ TmpDT.Columns.Add("CvePresupuestoIngreso", GetType(Integer))
+ TmpDT.Columns.Add("CveFuenteRecaudacion", GetType(Integer))
+ 'Contratos
+ TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
+ 'Remisiones a Facturas
+ TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer))
+ TmpDT.Columns.Add("CveVentaDetalleRemision", GetType(Integer))
+ TmpDT.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer))
+ 'Pedido2 a Facturas
+ TmpDT.Columns.Add("CveVentaDetallePedido2", GetType(Integer))
+ TmpDT.Columns.Add("Origen", GetType(Integer))
+ 'Ordenes Servicio
+ TmpDT.Columns.Add("CveOS", GetType(Integer))
+ TmpDT.Columns.Add("CveOSDetalle", GetType(Integer))
+ TmpDT.Columns.Add("SeFacturara", GetType(Integer))
+ TmpDT.Columns.Add("Folio", GetType(Integer))
+ TmpDT.Columns.Add("Estatus", GetType(String))
+ 'Ordenamiento
+ TmpDT.Columns.Add("Orden", GetType(Integer))
+ TmpDT.Columns.Add("TipoDocto", GetType(String))
+ 'OC
+ TmpDT.Columns.Add("CveOrdenCompraDetalle", GetType(Integer))
+ TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
+ TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
+ TmpDT.Columns.Add("CantidadFacturadaRem", GetType(Decimal))
+ TmpDT.Columns.Add("CantidadFacturadaCot", GetType(Decimal))
+ TmpDT.Columns.Add("CantidadFacturadaPed2", GetType(Decimal))
+ TmpDT.Columns.Add("CantidadInventario", GetType(Decimal))
+ TmpDT.Columns.Add("ClaveSATFraccionArancelaria", GetType(String))
+ TmpDT.Columns.Add("ClaveSATUnidadAduana", GetType(String))
+ TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String))
+ TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String))
+ TmpDT.Columns.Add("CveTamaño", GetType(Integer))
+ TmpDT.Columns.Add("EsCargo", GetType(Boolean))
+
+ Return TmpDT
+ End Function
+ Private Function InicializaDTVentasNCProntoPago() As DataTable
+ Dim DtVentasNC = New DataTable
+ DtVentasNC.Columns.Add("CveVenta", GetType(Integer))
+ DtVentasNC.Columns.Add("Importe", GetType(Decimal))
+ DtVentasNC.Columns.Add("FolioFiscal", GetType(String))
+ DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "TC", .DataType = GetType(Decimal), .DefaultValue = 1})
+ DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "TCCambioValuacion", .DataType = GetType(Decimal), .DefaultValue = 1})
+ DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "CveEstatusFactura", .DataType = GetType(Integer), .DefaultValue = -1})
+
+ Return DtVentasNC
+ End Function
+
+ Public Class MensajeProntoPago
+ Public Property ObjFacturaProntoPago As Modelos.Factura
+ Public Property Mensaje As Modelos.Factura.MMensajeFactura
+ End Class
+
+#End Region
+
End Class
\ No newline at end of file
diff --git a/vwd.webinfo b/vwd.webinfo
index 6f5921d9b..3de4958f8 100644
--- a/vwd.webinfo
+++ b/vwd.webinfo
@@ -150,6 +150,10 @@
+
+
+
+