diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb
index 46ca6341d..d2b74dfa7 100644
--- a/App_Code/ClsAcumuladores.vb
+++ b/App_Code/ClsAcumuladores.vb
@@ -926,7 +926,7 @@ Public Class ClsAcumuladores
Return Retorno
End Function
- Public Function DistribuidorMovtosGet(CveCliente As Integer, CveEmpresa As Integer, Optional FechaI As Date = MinFecha, Optional FechaF As Date = MaxFecha) As Boolean
+ Public Function DistribuidorMovtosGet(CveCliente As Integer, CveEmpresa As Integer, Optional FechaI As Date = MinFecha, Optional FechaF As Date = MaxFecha, Optional CveVentaRNCCargo As Integer = -1) As Boolean
Dim Retorno As Boolean = False
'Data = New DataTable
@@ -937,6 +937,7 @@ Public Class ClsAcumuladores
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@FechaI", SqlDbType.Date).Value = FechaI
.Add("@FechaF", SqlDbType.Date).Value = FechaF
+ .Add("@CveVentaRNCCargo", SqlDbType.Int).Value = CveVentaRNCCargo
End With
Try
diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb
index 45ff1f778..da59d111c 100644
--- a/App_Code/Modelos.vb
+++ b/App_Code/Modelos.vb
@@ -5612,6 +5612,7 @@ Namespace Modelos
Public Property RefacturacionGeneroNC As Boolean = False
Public Property Pagado As Decimal
Public Property DescuentoProntoPago As Decimal
+ Public Property CveVentaRNCCargo As Integer
'Public Property Sucursal As SucursalModel
Public Property SubProyecto As Modelos.SubProyectoModel
diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx
index af213df24..fe81513fa 100644
--- a/Ashx/SIGWeb.ashx
+++ b/Ashx/SIGWeb.ashx
@@ -43,18 +43,56 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
ActualizaPrePoliza(context)
Case "getpersonal"
getpersonal(context)
+ Case "getcontratos"
+ GetContratos(context)
Case "GettingCURP"
context.Response.Write(GettingCURP(context.Request("Curp").ToString(), context.Request("year").ToString().ToEntero()))
Case "ValidaCURP"
context.Response.Write(ValidaCURP(context.Request("Curp").ToString()))
Case "sendMail"
context.Response.Write(sendMail(context))
+ Case "sendMailLPM"
+ context.Response.Write(sendMail(context))
End Select
Catch ex As Exception
ex.GuardaLog(ex.Message)
End Try
End Sub
+
+ Private Function sendMailLPM(context As HttpContext) As String
+ Dim retorno As String = "true"
+ Dim nombre As String = ""
+ Dim correo As String = ""
+ Dim asunto As String = ""
+ Dim cuerpo As String = ""
+ Dim obj = context.Request("Nombre") 'Nombre=' + $('#Nombre').val() +'Correo=' + $('#Correo').val() +'Sitio=' + $('#Sitio').val() +'Cuerpo=' + $('#Cuerpo').val() +
+ If Not IsNothing(obj) Then
+ nombre = obj.ToString()
+ End If
+ obj = context.Request("Correo")
+ If Not IsNothing(obj) Then
+ correo = obj.ToString()
+ End If
+ obj = context.Request("Asunto")
+ If Not IsNothing(obj) Then
+ asunto = obj.ToString()
+ End If
+ obj = context.Request("Cuerpo")
+ If Not IsNothing(obj) Then
+ cuerpo = obj.ToString().Replace("< ", "<")
+ End If
+ Dim Body As String = String.Format("Prospecto : {0} Correo : {1} Asunto : {2}
{3}", nombre, correo, asunto, cuerpo)
+ Dim para As String = "contacto@localizacionprecisa.com;caudillo.90d@gmail.com;"
+ 'para = ""
+ Dim Mail As New ClsSisMail()
+ If Mail.SendMail(ClsPaginas.EmpresaNotificaciones, para, "NotificaciónProspecto", Body) Then
+ retorno = "true"
+ Else
+ retorno = "false"
+ End If
+ Return retorno
+ End Function
Private Function sendMail(context As HttpContext) As String
Dim retorno As String = "true"
Dim nombre As String = ""
@@ -1080,4 +1118,38 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
Return retorno
End Function
#End Region
+
+#Region "Get Contratos"
+ Private Function GetContratos(ByVal context As HttpContext) As String
+ Dim retorno As String = ""
+ Dim DtRetorno As DataTable = Nothing
+
+ Dim usuario As Usuario = UsuarioActual(context)
+ Dim CveEmpresa As String
+ If IsNothing(usuario) Then
+ context.Response.Write("")
+ Else
+ CveEmpresa = usuario.CveEmpresa
+ Dim Name = IfNull(context.Request("Name"), "-1").ToString
+
+ Dim dt As DataTable = DirectCast(context.Application("GlobalDTContratos"), DataTable).FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa))
+ If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
+ DtRetorno = dt.FiltraParametros(String.Format("NumeroContrato like '%{0}%'", Name))
+ End If
+ dt.Dispose()
+ End If
+
+ If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then
+ DtRetorno.Columns("CveContrato").ColumnName = "id"
+ DtRetorno.Columns("NumeroContrato").ColumnName = "text"
+ retorno = JsonConvert.SerializeObject(DtRetorno).ToString
+ context.Response.Write(retorno)
+ Else
+ context.Response.Write("[]")
+ End If
+
+ DtRetorno.Dispose()
+ Return retorno
+ End Function
+#End Region
End Class
\ No newline at end of file
diff --git a/Compras/CatProveedores.aspx b/Compras/CatProveedores.aspx
index 54e4c06be..3599a49e7 100644
--- a/Compras/CatProveedores.aspx
+++ b/Compras/CatProveedores.aspx
@@ -100,7 +100,7 @@
-
+
+
+
+
+
+
+
+
+
-
+
+
diff --git a/Contratos/Contrato.aspx.vb b/Contratos/Contrato.aspx.vb
index 59f211c7d..75be99a9c 100644
--- a/Contratos/Contrato.aspx.vb
+++ b/Contratos/Contrato.aspx.vb
@@ -1199,13 +1199,16 @@ Partial Class Contratos_Default
GvFianzas.DataBind()
UpGvFianzas.Update()
- End Sub
+ End Sub
#End Region
-
+
#Region " GUARDAR "
- Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
- Dim ObjContratos As New ClsContratos
- Dim ObjInventarios As New ClsInventarios(ObjContratos.IniciaTransacSQL)
+ Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
+
+ If DdlContratista.SelectedValue.ToEntero = -1 And DdlCliente.SelectedValue.ToEntero = -1 Then
+ Alert("Debe seleccionar con quién está haciendo el contrato. Proveedor o Cliente", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
Dim TieneError = False
Dim Modificado = False
@@ -1221,21 +1224,30 @@ Partial Class Contratos_Default
Maximo = txtMaximo.Text.ToDouble
Total = TxtTotal.Text.ToDouble
+ If DdlTipoContrato.SelectedValue = "25" AndAlso DdlPeriodo.SelectedValue.ToEntero() <= 0 Then
+ Alert("Debe seleccionar el periodo de facturación.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
If DdlMoneda.SelectedIndex > 0 Then
If TxtTipoCambio.Text.Trim.Length = 0 Or TxtTipoCambio.Text.Trim.ToDouble = 0.0 Then
Alert("Cuando seleccione una moneda diferente a peso debe especificar el tipo de cambio.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
- End If
-
-
- 'Crear Contrato
- If Not CveContrato > 0 Then
+ End If
+
+ If CveContrato > 0 Then
If DdlContratista.SelectedValue.ToEntero = -1 And DdlCliente.SelectedValue.ToEntero = -1 Then
Alert("Debe seleccionar con quién está haciendo el contrato. Proveedor o Cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
- End If
+ End If
+ End If
+
+ Dim ObjContratos As New ClsContratos
+ Dim ObjInventarios As New ClsInventarios(ObjContratos.IniciaTransacSQL)
+
+ 'Crear Contrato
+ If Not CveContrato > 0 Then
CveContrato = ObjContratos.AddContratos(TxtNumeroContrato.Text, TxtDescripcionContrato.Text, TxtNumeroLicitacion.Text.Trim, DdlContratista.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, -1, TxtFechaInicial.Text.ToDate, TxtFechaFinal.Text.ToDate,
TxtUbicacion.Text, TxtResponsable.Text, DdlSubProyectoContrato.SelectedValue.ToEntero, TxtPorIVA.Text.ToDouble, TxtPorAnticipo.Text.ToDouble, TxtPorAmortizacionAnticipo.Text.ToDouble,
@@ -1323,18 +1335,9 @@ Partial Class Contratos_Default
TieneError = True
End If
-
-
-
-
-
-
Else
Modificado = True
- If DdlContratista.SelectedValue.ToEntero = -1 And DdlCliente.SelectedValue.ToEntero = -1 Then
- Alert("Debe seleccionar con quién está haciendo el contrato. Proveedor o Cliente", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
+
Dim ArchivoUpdate As String = "-1"
If Session("FileExtension").ToString <> "" Then
@@ -1433,16 +1436,8 @@ Partial Class Contratos_Default
End If
-
-
-
-
End If
- 'If Not TieneError Then
- ' TieneError = GuardarAlmacen(ObjInventarios)
- 'End If
-
If TieneError Then
ObjContratos.RollBack()
Else
@@ -1461,12 +1456,11 @@ Partial Class Contratos_Default
End If
-
UpGral.Update()
ObjContratos.Dispose()
- End Sub
+ End Sub
#End Region
-
+
#Region " ELIMINAR "
Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click
Dim objContratos As New ClsContratos
diff --git a/Contratos/FacturacionMasiva.aspx b/Contratos/FacturacionMasiva.aspx
index ad378c4fb..431aa81db 100644
--- a/Contratos/FacturacionMasiva.aspx
+++ b/Contratos/FacturacionMasiva.aspx
@@ -34,14 +34,11 @@
Cliente:
-
-
-
+
Contrato:
-
-
-
+
+
Sucursal:
diff --git a/Contratos/FacturacionMasiva.aspx.vb b/Contratos/FacturacionMasiva.aspx.vb
index d43c26fc3..d4d6f5fd4 100644
--- a/Contratos/FacturacionMasiva.aspx.vb
+++ b/Contratos/FacturacionMasiva.aspx.vb
@@ -111,8 +111,9 @@ Partial Class Contratos_FacturacionMasiva
If Not IsPostBack Then
FolioVigentes = False
CargaCombos()
- txtFechaI.Text = DateTime.Today.ToString("d")
- txtFechaF.Text = DateTime.Today.ToString("d")
+ Dim FechaRef = DateTime.Now
+ txtFechaI.Text = $"01/{FechaRef.Month}/{FechaRef.Year}"
+ txtFechaF.Text = txtFechaI.Text.ToDate().AddMonths(1).ToString("dd/MM/yyyy")
CargaDatos(-1, -1)
CreaDTVentas()
Mensaje = ""
@@ -131,11 +132,44 @@ Partial Class Contratos_FacturacionMasiva
ValidaFolio()
Dim ObjContratos As New ClsContratos
- If ObjContratos.CicloComercialGet(CveContrato, CveCliente, -1, UsuarioActual.CveEmpresa, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, DdlSucursal.SelectedValue.ToEntero) Then
- DTCicloComercial = ObjContratos.DtResultados().FiltraParametros($"FueFacturado = 0")
- GvCiclosComerciales.DataSource = DTCicloComercial
- End If
- ObjContratos.Dispose()
+ Try
+ If ObjContratos.CicloComercialGet(CveContrato, CveCliente, -1, UsuarioActual.CveEmpresa, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, DdlSucursal.SelectedValue.ToEntero) Then
+ DTCicloComercial = ObjContratos.DtResultados.Clone
+
+ For Each Row As DataRow In ObjContratos.DtResultados().FiltraParametros($"FueFacturado = 0").Rows
+
+ If Row("Observaciones").ToString().Contains("{DIA}") Then
+ Row("Observaciones") = Row("Observaciones").ToString().Replace("{DIA}", DateTime.Now.Day.ToString())
+ End If
+
+ If Row("Observaciones").ToString().Contains("{MES}") Then
+ Dim fecha As DateTime = DateTime.Now
+ Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
+ Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
+
+ Row("Observaciones") = Row("Observaciones").ToString().Replace("{MES}", nombreMes)
+ End If
+
+ If Row("Observaciones").ToString().Contains("{AÑO}") Then
+ Row("Observaciones") = Row("Observaciones").ToString().Replace("{AÑO}", DateTime.Now.Year.ToString())
+ End If
+
+ If Row("Observaciones").ToString().Contains("{TC}") Then
+ Row("Observaciones") = Row("Observaciones").ToString().Replace("{TC}", GlobalTipoCambio(Now).FormatoNumero)
+ End If
+
+ DTCicloComercial.Rows.Add(Row.ItemArray)
+ Next
+
+
+ End If
+ Catch ex As Exception
+ DTCicloComercial = Nothing
+ OnError("Ocurrió un error al obtener las facturas a realizar", ex)
+ End Try
+ ObjContratos.Dispose()
+
+ GvCiclosComerciales.DataSource = DTCicloComercial
GvCiclosComerciales.DataBind()
UpGv.Update()
End Sub
@@ -174,14 +208,9 @@ Partial Class Contratos_FacturacionMasiva
Dim sb As New StringBuilder()
For Each row As GridViewRow In GvCiclosComerciales.Rows
- If row.FCCheckBox("chkDis").Checked Then
- Dim fecha As DateTime = DateTime.Now ', row.DataKey("FechaVenc").ToString.ToDateTime()
- Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
- Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
+ If row.FCCheckBox("chkDis").Checked Then
- Dim Etiqueta As String = String.Format("{0} - {1}", nombreMes, fecha.Year)
-
- Dim Resp = EmitirImprimir(row.DataKey("CveCicloComercial").ToString.ToEntero, Etiqueta)
+ Dim Resp = EmitirImprimir(row.DataKey("CveCicloComercial").ToString.ToEntero)
For Each Msg In Resp.Mensajes
sb.AppendFormat("{0}", Msg)
@@ -212,10 +241,10 @@ Partial Class Contratos_FacturacionMasiva
EjecutarFacturacion()
End Sub
- Private Function EmitirImprimir(pCveCicloComercial As Integer, Etiqueta As String) As Modelos.Factura.MMensajeFactura
+ Private Function EmitirImprimir(pCveCicloComercial As Integer) As Modelos.Factura.MMensajeFactura
Dim Resp As New Modelos.Factura.MMensajeFactura
ViewState("CveCicloComercial") = pCveCicloComercial
- CreaObjetosVenta(Etiqueta)
+ CreaObjetosVenta()
If ObjFactura Is Nothing Or ObjFactura.Cliente Is Nothing Then
Alert("Ocurrió un error al procesar los datos de la Venta.", TipoMensaje.MsgError)
ObjFactura = Nothing
@@ -438,7 +467,7 @@ Partial Class Contratos_FacturacionMasiva
TmpDT.Columns.Add("CveTamaño", GetType(Integer))
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
End Sub
- Private Sub CreaObjetosVenta(Etiqueta As String, Optional VistaPrevia As Boolean = False)
+ Private Sub CreaObjetosVenta(Optional VistaPrevia As Boolean = False)
Dim ObjFolios As New ClsGralFolios()
Dim Folio As String = ""
Dim Serie As String = ""
@@ -472,7 +501,7 @@ Partial Class Contratos_FacturacionMasiva
ObjFactura.MetodoPago = "Efectivo"
ObjFactura.FechaPago = DateTime.Today
ObjFactura.MotivoDescuento = ""
- ObjFactura.Observaciones = Etiqueta + " " + TxtObservaciones.Text + " " + DR("Observaciones").ToString
+ ObjFactura.Observaciones = TxtObservaciones.Text + " " + DR("Observaciones").ToString
ObjFactura.FechaEjecucion = DateTime.Today
'ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {1}")
ObjFactura.UsuarioCreo = UsuarioActual.Usuario
@@ -553,9 +582,9 @@ Partial Class Contratos_FacturacionMasiva
DtR("CodigoPS") = row("CodigoPS")
DtR("SATClaveProdServ") = row("SATClaveProdServ")
DtR("NoIdentificacion") = row("NoIdentificacion")
- DtR("CveTipoPS") = DrPS("CveTipoPS")
- DtR("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario")
- DtR("Obs") = Etiqueta + " " + TxtObservaciones.Text + " " + row("Observacion").ToString
+ DtR("CveTipoPS") = drPS("CveTipoPS")
+ DtR("CveTipoInvPS") = drPS("Inv_CveMetodoInventario")
+ DtR("Obs") = TxtObservaciones.Text + " " + row("Observacion").ToString
DtR("PU") = row("PU")
DtR("IVA") = row("PorcentajeIVA")
DtR("PorcentajeIVA") = row("PorcentajeIVA")
diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb
index 5d912970f..659934309 100644
--- a/Inventarios/EntradasSalidas.aspx.vb
+++ b/Inventarios/EntradasSalidas.aspx.vb
@@ -4196,7 +4196,7 @@ Partial Class Inventarios_EntradasSalidas
ElProductoChange()
TxtnSerie.Text = Serie
TxtnLote.Text = Lote
- DdlSeccionAlmacen.SelectedValue = CveSeccionAlmacen.ToString
+ DdlSeccionAlmacen.SelectedValueExist(CveSeccionAlmacen.ToString)
TxtnFechaCaducidad.Text = If(Caducidad = "", MinFecha.ToString, Caducidad)
AgregarPS()
txtPrecio.Text = ""
diff --git a/Inventarios/PopUpExistenciasAlmacen.aspx.vb b/Inventarios/PopUpExistenciasAlmacen.aspx.vb
index 8ad38121e..b71e823e5 100644
--- a/Inventarios/PopUpExistenciasAlmacen.aspx.vb
+++ b/Inventarios/PopUpExistenciasAlmacen.aspx.vb
@@ -95,7 +95,7 @@ Partial Class Inventarios_Default
End Sub
Private Sub CargaDatos(CvePS As Integer, Tipo As Integer)
- If ValidarFiltrosSeleccionados() Then
+ If ValidarFiltrosSeleccionados() OrElse CvePS > 0 Then
Dim ObjInventarios As New ClsInventarios()
If ObjInventarios.GetExistenciasProducto(CvePS, -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"),
ExcluyeApartados:=-1, ExcluyeAdelantado:=1, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero, TopSelect:=100) Then
diff --git a/Metronic/assets/admin/layout/css/custom.css b/Metronic/assets/admin/layout/css/custom.css
index 39800e20f..9dcbcfc51 100644
--- a/Metronic/assets/admin/layout/css/custom.css
+++ b/Metronic/assets/admin/layout/css/custom.css
@@ -2962,4 +2962,7 @@ select.select2-offscreen, select.select2-offscreen:focus {
.ADScroller > div > table.table.table-smallpadding > tbody > tr > td:nth-last-child(1) span, table.ScrollAD.table.table-smallpadding > tbody > tr > td:nth-last-child(1) span,
.ADScroller > div > table.table.table-smallpadding > tbody > tr > th:nth-last-child(1) span, table.ScrollAD.table.table-smallpadding > tbody > tr > th:nth-last-child(1) span{
padding-right: 7px;
+}
+div.mypaste * {
+ display: none;
}
\ No newline at end of file
diff --git a/Nomina/Nomina2.aspx.cs b/Nomina/Nomina2.aspx.cs
index 757b5cd09..ca3f173e2 100644
--- a/Nomina/Nomina2.aspx.cs
+++ b/Nomina/Nomina2.aspx.cs
@@ -3466,6 +3466,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
if (continuar)
{
objNomina.Commit();
+ Alert("La nomina se autorizó correctamente.");
}
else
{
@@ -3473,9 +3474,15 @@ public partial class Nomina_Nomina2 : ClsPaginas
}
}
+ if(dtr != null){
dtr.Dispose();
- dtconp.Dispose();
- Alert("Termine");
+
+ }
+ if (dtconp != null)
+ {
+ dtconp.Dispose();
+
+ }
}
protected void LnkCargaAsistenciaMasiva_Click(object sender, EventArgs e)
diff --git a/RH/CatPuesto.aspx b/RH/CatPuesto.aspx
index 7ee708fd4..e17c81fcb 100644
--- a/RH/CatPuesto.aspx
+++ b/RH/CatPuesto.aspx
@@ -26,7 +26,7 @@
-
'); tr.append(td);
} else {
@@ -7857,5 +8082,21 @@
$('#ModalAplicarRemisionesNC').modal('hide');
}
+ var verficaRNC = function () {
+ var total = 0;
+ if ('<%= UsuarioActual.CveEmpresa %>' == '140') {
+ $(".ChkAplicaRNC > input").each(function () {
+ if (this.checked) {
+ total = total + 1;
+ }
+ if (total == 2) {
+ alert("No se puede seleccionar mas de una remisión de nota de crédito.");
+ this.checked = false;
+ return false;
+ }
+ });
+ }
+ };
+
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index e7a4fe5e6..9d25b9949 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -112,6 +112,38 @@ Partial Class Ventas
ViewState("TmpDTDescNC") = value
End Set
End Property
+ Private Property TmpDTDescNCBonificacion As DataTable
+ Get
+ Return If(IsNothing(ViewState("TmpDTDescNCBonificacion")), Nothing, CType(ViewState("TmpDTDescNCBonificacion"), DataTable))
+ End Get
+ Set(value As DataTable)
+ ViewState("TmpDTDescNCBonificacion") = value
+ End Set
+ End Property
+ Private Property TmpDTBonificacion As DataTable
+ Get
+ Return If(IsNothing(ViewState("TmpDTBonificacion")), Nothing, CType(ViewState("TmpDTBonificacion"), DataTable))
+ End Get
+ Set(value As DataTable)
+ ViewState("TmpDTBonificacion") = value
+ End Set
+ End Property
+ Private Property TmpDTRNCBonificacionesCliente As DataTable
+ Get
+ Return If(IsNothing(ViewState("TmpDTRNCBonificacionesCliente")), Nothing, CType(ViewState("TmpDTRNCBonificacionesCliente"), DataTable))
+ End Get
+ Set(value As DataTable)
+ ViewState("TmpDTRNCBonificacionesCliente") = value
+ End Set
+ End Property
+ Private Property TmpDTRNCBonificacionesSeleccionadas As DataTable
+ Get
+ Return If(IsNothing(ViewState("TmpDTRNCBonificacionesSeleccionadas")), Nothing, CType(ViewState("TmpDTRNCBonificacionesSeleccionadas"), DataTable))
+ End Get
+ Set(value As DataTable)
+ ViewState("TmpDTRNCBonificacionesSeleccionadas") = value
+ End Set
+ End Property
Private Property TmpDTError As DataTable
Get
Return If(IsNothing(ViewState("TmpDTError")), Nothing, CType(ViewState("TmpDTError"), DataTable))
@@ -292,6 +324,14 @@ Partial Class Ventas
ViewState("ListaNCDesc") = value
End Set
End Property
+ Private Property ListaNCBonificacion As List(Of Modelos.Factura)
+ Get
+ Return If(IsNothing(ViewState("ListaNCBonificacion")), Nothing, CType(ViewState("ListaNCBonificacion"), List(Of Modelos.Factura)))
+ End Get
+ Set(value As List(Of Modelos.Factura))
+ ViewState("ListaNCBonificacion") = 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)))
@@ -404,6 +444,15 @@ Partial Class Ventas
ViewState("RequiereAlmacenOrigen") = value
End Set
End Property
+
+ Private Property AplicoNCFacturaActual As Boolean
+ Get
+ Return If(IsNothing(ViewState("AplicoNCFacturaActual")), False, CType(ViewState("AplicoNCFacturaActual"), Boolean))
+ End Get
+ Set(value As Boolean)
+ ViewState("AplicoNCFacturaActual") = value
+ End Set
+ End Property
Private Property EmpresaActual As Empresa
Get
Return CType(ViewState("EmpresaActual"), Empresa)
@@ -1389,6 +1438,14 @@ Partial Class Ventas
ViewState("ObjFacturaDevolucion") = value
End Set
End Property
+ Private Property ObjFacturaBonificacion As Modelos.Factura
+ Get
+ Return CType(ViewState("ObjFacturaBonificacion"), Modelos.Factura)
+ End Get
+ Set(value As Modelos.Factura)
+ ViewState("ObjFacturaBonificacion") = value
+ End Set
+ End Property
Private Property ObjFacturaNC As Modelos.Factura
Get
Return CType(ViewState("ObjFacturaNC"), Modelos.Factura)
@@ -3269,6 +3326,8 @@ Partial Class Ventas
If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa, -1, -1, 1) Then
If ObjContratos.DtResultados.Rows.Count > 0 Then
+ Dim CveContratoTipo = ObjContratos.DtResultados.Rows(0)("CveContratoTipo").ToString.ToEntero
+
'Cargamos los datos del Cliente
DtContratos = ObjContratos.DtResultados
ViewState("CveCliente") = ObjContratos.DtResultados(0)("CveCliente").ToString().ToEntero()
@@ -3289,6 +3348,8 @@ Partial Class Ventas
BtnIniciarContrato_Click(Nothing, Nothing)
DdlContratosModal.SelectedValue = CveContrato.ToString()
DdlContratosModal_SelectedIndexChanged(Nothing, Nothing)
+ DdlAlmacenAsignado.Enabled = False
+ DdlAlmacenOrigen.Enabled = False
ElseIf TipoContrato = 0 Then
'Mostramos los almacenes
DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()} {If(DdlTipoComprobante.SelectedValue = "Ped", "", "AND CveTipoAlmacen IN (4,10)")}")
@@ -3312,8 +3373,8 @@ Partial Class Ventas
DdlAlmacenAsignado.Items.Insert(0, New ListItem(dr("Almacen").ToString(), dr("CveAlmacen").ToString()))
End If
End If
- DdlAlmacenAsignado.SelectedValue = ObjContratos.CveAlmacen.ToString()
- DdlAlmacenAsignado.Enabled = False
+ DdlAlmacenAsignado.SelectedValueExist(ObjContratos.CveAlmacen.ToString())
+
Else
If (DdlAlmacenAsignado.Items.FindByValue("89") Is Nothing) Then
Dim dr As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", "89"))
@@ -3322,20 +3383,31 @@ Partial Class Ventas
DdlAlmacenAsignado.Enabled = False
End If
End If
- DdlAlmacenAsignado.SelectedValue = "89"
+ DdlAlmacenAsignado.SelectedValueExist("89")
End If
If ObjContratos.CveAlmacenOrigen > 0 AndAlso TipoContrato = 0 Then
DdlAlmacenOrigen.Visible = True
RequiereAlmacenOrigen = True
+
+ If CveContratoTipo.Contiene(7, 9, 13, 21, 27) Then
+ Dim CveTipoAlmacenOrigen = "12,15"
+ If CveContratoTipo.Contiene(27) Then
+ CveTipoAlmacenOrigen = "1"
+ End If
+
+ DdlAlmacenOrigen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()} {If(DdlTipoComprobante.SelectedValue = "Ped", "", $"AND CveTipoAlmacen IN ({CveTipoAlmacenOrigen})")}")
+ DdlAlmacenOrigen.DataBind()
+ End If
+
If (DdlAlmacenOrigen.Items.FindByValue(ObjContratos.CveAlmacenOrigen.ToString()) Is Nothing) Then
Dim dr As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", ObjContratos.CveAlmacenOrigen.ToString()))
If dr IsNot Nothing Then
DdlAlmacenOrigen.Items.Insert(0, New ListItem(dr("Almacen").ToString(), dr("CveAlmacen").ToString()))
End If
End If
- DdlAlmacenOrigen.SelectedValue = ObjContratos.CveAlmacenOrigen.ToString()
- DdlAlmacenOrigen.Enabled = False
+ DdlAlmacenOrigen.SelectedValueExist(ObjContratos.CveAlmacenOrigen.ToString())
+ DdlAlmacenOrigen.Enabled = True
End If
Else
@@ -4410,6 +4482,8 @@ Partial Class Ventas
If TmpDT.SUM("CantidadFacturadaRem") < TmpDT.SUM("Cantidad") Then
BtnsFacturar.Visible = True
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
+
'ACTIVA CONVERSION DE MONEDA
If DdlMoneda.SelectedValue.ToEntero() = 1 Then
TrConversionDolares.Visible = True
@@ -4430,6 +4504,7 @@ Partial Class Ventas
Else
BtnsFacturar.Visible = False
End If
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
End If
End If
@@ -4461,6 +4536,7 @@ Partial Class Ventas
If TmpDT.SUM("CantidadFacturadaCot") < TmpDT.SUM("Cantidad") AndAlso DdlTipoComprobante.SelectedValue.Contiene("Cot") Then
BtnGenerarRemision.Visible = If(CveEstatus = 10, False, True)
BtnsFacturar.Visible = True
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
End If
End If
@@ -5109,10 +5185,10 @@ Partial Class Ventas
End If
If UsuarioActual.Empresa.CvePlataforma = 2 Then LnkOCs.Visible = False
- If UsuarioActual.Empresa.UsaInventarios Then
- RblTipo.Items.Remove(RblTipo.Items.FindByValue("1"))
- RblTipo.Items.Remove(RblTipo.Items.FindByValue("2"))
- End If
+ 'If UsuarioActual.Empresa.UsaInventarios Then
+ ' RblTipo.Items.Remove(RblTipo.Items.FindByValue("1"))
+ ' RblTipo.Items.Remove(RblTipo.Items.FindByValue("2"))
+ 'End If
UpnTools.Update()
'UpRemisionesFacturas.Update()
@@ -5268,6 +5344,21 @@ Partial Class Ventas
If CveCliente > 0 Then CargaAnticipos(CveCliente) : UpAnticipos.Update()
+ If CveCliente > 0 AndAlso UsuarioActual.CveEmpresa = 140 Then
+ DivVentasUsados.Visible = True
+
+ Dim ObjClientes As New ClsClientes
+ If ObjClientes.GetHistorialVentas(CveCliente, 1000, CveClienteSucursal:=-1, TipoDocto:="Ing", CveEstatusFactura:=-1, FechaI:=Now.AddMonths(-1)) Then
+ DdlVentaUsado.DataSource = ObjClientes.DtResultados
+ End If
+ ObjClientes.Dispose()
+
+ DdlVentaUsado.DataBind()
+
+ DdlVentaUsado.Items.Insert(0, New ListItem("Seleccione", "-1"))
+
+ UpModalRemisionesNC.Update()
+ End If
If RequiereOC Then
Dim Documentacion As String = ""
@@ -5356,6 +5447,7 @@ Partial Class Ventas
If Opcion = 1 Then
BtnEmitirImprimir.Visible = False
BtnsFacturar.Visible = False
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
BtnGenerarRemision.Visible = False
LnkPedido2SinFacturar.Visible = False
LnkCotizaciones.Visible = False
@@ -5408,6 +5500,7 @@ Partial Class Ventas
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
BtnsFacturar.Visible = False
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
BtnGenerarRemision.Visible = False
LnkPedido2SinFacturar.Visible = False
LnkCotizaciones.Visible = False
@@ -5446,6 +5539,7 @@ Partial Class Ventas
BtnGenerarOS.Visible = False
BtnEmitirImprimir.Visible = True
BtnsFacturar.Visible = False
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
Else
If DdlTipoComprobante.SelectedValue.Contiene("Pd2") Then
@@ -5455,6 +5549,7 @@ Partial Class Ventas
BtnGenerarOS.Visible = False
BtnEmitirImprimir.Visible = False
BtnsFacturar.Visible = False
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
If ViewState("CveCliente").ToString().ToEntero() <> ViewState("CveClienteAnterior").ToString().ToEntero() Then
If Opcion > 0 Then
If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
@@ -7127,7 +7222,7 @@ Partial Class Ventas
'SI ES AMORTIZACION 3.3
Dim Obj2 As New List(Of Object)
- Dim NCDescuento As Boolean = (ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0)
+ Dim NCDescuento As Boolean = ((ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) OrElse (ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0))
If ErrorList.Count = 0 Then
' cambiar la condicion para saber si hay seleccionado
If (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse NCDescuento Then
@@ -7139,11 +7234,28 @@ Partial Class Ventas
CveVentaRelacionada = CveAnticipoPadre
End If
- CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento)
- If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing,
- Nothing, NCDescuento:=NCDescuento) Then
- Obj2.Add(ObjFacturaDevolucion)
+ If (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse (ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) Then
+ CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento)
+ If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing,
+ Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDesc, IndexNC:=(DtVentasNC.Rows.Count - 1)) Then
+ Obj2.Add(ObjFacturaDevolucion)
+ End If
End If
+
+ If ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
+ 'SI HAY UNA NOTA DE CREDITO REGISTRADA ANTERIORMENTE LIMPIA EL REGISTRO
+ If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
+ DtVentasNC.Rows.RemoveAt(DtVentasNC.Rows.Count - 1)
+ End If
+
+ CreaObjetosVentaBonificacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento)
+ If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaBonificacion, ObjBancos, Nothing,
+ Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCBonificacion, IndexNC:=(DtVentasNC.Rows.Count - 1)) Then
+ Obj2.Add(ObjFacturaBonificacion)
+ End If
+ End If
+
+
Catch ex As Exception
OnError("Ocurrió un error al generar nota de crédito de amortización", ex)
ErrorList.Add("No se pudo generar la nota de crédito de amortización")
@@ -7839,8 +7951,245 @@ Partial Class Ventas
End Sub
+ Private Sub CreaObjetosVentaBonificacion(ObjVentas As ClsVentas, FolioFiscalRelacionado As String, CveAnticipoPadre As Integer,
+ Optional CveVentasPadre As Integer = -1, Optional NCDescuento As Boolean = False)
+ ObjFacturaBonificacion = New Modelos.Factura
+
+ ObjFacturaBonificacion.CveUsuario = UsuarioActual.CveUsuario
+ ObjFacturaBonificacion.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero()
+
+ If CveVentasPadre > 0 Then
+ ObjFacturaBonificacion.CveVentaPadre = CveVentasPadre
+ ObjFacturaBonificacion.CveVentaRelacion = CveVentasPadre
+ Else
+ ObjFacturaBonificacion.CveVentaPadre = ObjVentas.CveVenta
+ ObjFacturaBonificacion.CveVentaRelacion = ObjVentas.CveVenta
+ End If
+
+ ObjFacturaBonificacion.CveEmpresa = UsuarioActual.CveEmpresa
+ ObjFacturaBonificacion.TipoCambio = If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.Trim.ToDecimal)
+ ObjFacturaBonificacion.ConvertirPesos = ChkConvertirDoctoPesos.Checked
+ ObjFacturaBonificacion.CveMoneda = DdlMoneda.SelectedValue.ToEntero()
+ ObjFacturaBonificacion.Moneda = DdlMoneda.SelectedItem.Text
+ ObjFacturaBonificacion.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", $"CveMoneda = {DdlMoneda.SelectedValue}")
+ 'ObjFacturaDevolucion.RefDocto = TxtDocto.Text.Trim
+ 'ObjFacturaDevolucion.Folio = If(ExFolioFactura, FolioXML.ToEntero(), -1)
+ ObjFacturaBonificacion.Serie = LblSerie.Text
+ ObjFacturaBonificacion.Fecha = New Date(TxtFecha.Text.Trim.ToDate.Year, TxtFecha.Text.Trim.ToDate.Month, TxtFecha.Text.Trim.ToDate.Day, Now.Hour, Now.Minute, Now.Second)
+ ObjFacturaBonificacion.CvePrePoliza = -1
+ ObjFacturaBonificacion.CveMetodoPago = 0 'DdlMetodoPago.SelectedValue.ToEntero()
+ ObjFacturaBonificacion.MetodoPago = ""
+ ObjFacturaBonificacion.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {DdlMetodoPago33.SelectedValue}")
+ ObjFacturaBonificacion.UsuarioCreo = LblUsuario.Text.Trim
+ ' ObjFacturaDevolucion.CveCondicionEntrega = If(DdlFormaEntrega.SelectedItem IsNot Nothing, DdlFormaEntrega.SelectedValue.ToEntero(), -1)
+ ' ObjFacturaDevolucion.CondicionEntrega = If(DdlFormaEntrega.SelectedItem IsNot Nothing, DdlFormaEntrega.SelectedItem.Text, "")
+ 'ObjFacturaDevolucion.NumeroCuenta = TxtNumCtaPago.Text.Trim
+ 'ObjFacturaDevolucion.Cliente.NumCtaPago = TxtNumCtaPago.Text.Trim
+ ObjFacturaBonificacion.CondicionesPago = If(RBLPago.SelectedValue = "2", 0, 1) ' 0 - Contado, 1 - Credito
+ ObjFacturaBonificacion.FormaPago = 0
+
+ ObjFacturaBonificacion.TipoDocto = "Egs"
+ ObjFacturaBonificacion.Fecha = Now
+
+ ObjFacturaBonificacion.Version = "3.3"
+ ObjFacturaBonificacion.CveMetodoPago33 = 1
+ ObjFacturaBonificacion.MetodoPago33 = "Pago en una sola exhibición"
+ ObjFacturaBonificacion.ClaveMetodoPagoSAT = "PUE"
+
+ ObjFacturaBonificacion.CveFormaPago33 = 21
+ ObjFacturaBonificacion.FormaPago33 = "Aplicación de anticipos"
+ ObjFacturaBonificacion.FormaPagoSAT33 = "30"
+
+ ObjFacturaBonificacion.CveUsoCFDI = DdlUsoCFDI.SelectedValue.ToEntero()
+ ObjFacturaBonificacion.UsoCFDI = DdlUsoCFDI.SelectedItem.Text
+ ObjFacturaBonificacion.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}")
+
+ ObjFacturaBonificacion.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero()
+ ObjFacturaBonificacion.TipoRelacion = "07"
+
+ Dim Fol As New List(Of String)
+ Fol.Add(FolioFiscalRelacionado)
+ ObjFacturaBonificacion.UUIDRelacionados = Fol
+
+ Select Case ObjFacturaBonificacion.TipoDocto
+ Case "Ing"
+ ObjFacturaBonificacion.TipoDocumento = "Factura"
+ Case "REM"
+ ObjFacturaBonificacion.TipoDocumento = "Remision"
+ Case "Cot"
+ ObjFacturaBonificacion.TipoDocumento = "Cotizacion"
+ Case "Egs"
+ ObjFacturaBonificacion.TipoDocumento = "Nota de Crédito"
+ Case "Dev"
+ ObjFacturaBonificacion.TipoDocumento = "Nota de Devolución"
+ Case Else
+ ObjFacturaBonificacion.TipoDocumento = ""
+ End Select
+
+ If ObjFacturaBonificacion.TipoDocto IsNot Nothing Then
+ ViewState("TipoDoctoDevolucion") = ObjFacturaBonificacion.TipoDocto
+ End If
+
+ ObjFacturaBonificacion.Fech1 = TxtFech1.Text.Trim.ToDate
+ ObjFacturaBonificacion.Fech2 = TxtFech2.Text.Trim.ToDate
+ ObjFacturaBonificacion.Fech3 = TxtFech3.Text.Trim.ToDate
+ ObjFacturaBonificacion.Alfa1 = TxtAlfa1.Text.Trim
+ ObjFacturaBonificacion.Alfa2 = TxtAlfa2.Text.Trim
+ ObjFacturaBonificacion.Alfa3 = TxtAlfa3.Text.Trim
+ ObjFacturaBonificacion.Num1 = TxtNum1.Text.Trim.ToDouble
+ ObjFacturaBonificacion.Num2 = TxtNum2.Text.Trim.ToDouble
+ ObjFacturaBonificacion.Num3 = If(ObjFacturaBonificacion.TipoDocto = "OP", DdlOrdenPago.SelectedValue.ToDouble, TxtNum3.Text.Trim.ToDouble)
+ ObjFacturaBonificacion.FechaPago = TxtFechaPago.Text.ToDate
+
+ ObjFacturaBonificacion.CveCorte = CveCorte
+ ObjFacturaBonificacion.CveMesa = -1
+ ObjFacturaBonificacion.NumeroPersonas = 0
+ ObjFacturaBonificacion.CveContrato = If(CveContrato > 0, CveContrato, CvePresupuesto)
+ ObjFacturaBonificacion.DescripcionContrato = If(DdlContratosModal.SelectedItem IsNot Nothing, DdlContratosModal.SelectedItem.Text, "")
+ ObjFacturaBonificacion.CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero()
+ ObjFacturaBonificacion.Entrega = Entrega
+ ObjFacturaBonificacion.Vigencia = TxtFechaVencimientoCotizacion.Text.ToDate
+
+ ObjFacturaBonificacion.CveVentaPadre = CveAnticipoPadre
+ ObjFacturaBonificacion.CveVendedor = DdlVendedor.SelectedValue.ToEntero()
+ If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then
+ DdlVendedor.Enabled = False
+ End If
+
+ ObjFacturaBonificacion.FechaEjecucion = TxtFechaEjecucion.Text.Trim.ToDate
+ ObjFacturaBonificacion.CveSucursalEjecucion = DdlSucursalEjecucion.SelectedValue.ToEntero()
+ ObjFacturaBonificacion.CveSucursalCobranza = DdlSucursalCobranza.SelectedValue.ToEntero()
+
+ ObjFacturaBonificacion.AtencionA = If(ObjFacturaBonificacion.TipoDocto = "Cot" Or (ObjFacturaBonificacion.TipoDocto.Contiene("Ing", "Rem") AndAlso LblRFC.Text = "XAXX010101000"), TxtAtencionA.Text, "-1")
+ ObjFacturaBonificacion.MotivoDescuento = TxtMotivoDescuento.Text.Trim
+ ObjFacturaBonificacion.Observaciones = TxtObsFact.Text.Trim
+ ObjFacturaBonificacion.Det_OrdenCompra = TxtDet_OrdenCompra.Text.Trim
+ ObjFacturaBonificacion.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim
+ ObjFacturaBonificacion.MonedaAbreviatura = ""
+
+ If TmpDTImpuestos Is Nothing Then
+ CreaDTImpuestos()
+ Else
+ TmpDTImpuestos.Clear()
+ End If
+
+ Dim DR As DataRow = TmpDTImpuestos.NewRow()
+
+ If TxtSubTotal.Text.ToDecimal <> 0 Then DR("ImpuestoLocal") = "SubTotal" : DR("Importe") = TxtSubTotal.Text.ToDecimal : DR("Orden") = 10 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+ If LblDescuentos.Text.Trim.ToDecimal <> 0 Then DR("ImpuestoLocal") = "Descuentos" : DR("Importe") = LblDescuentos.Text.Trim.ToDecimal : DR("Orden") = 20 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+ If LblAmortizacion.Text.Trim.ToDecimal <> 0 Then DR("ImpuestoLocal") = "Amort.Ant" : DR("Importe") = LblAmortizacion.Text.Trim.ToDecimal : DR("Orden") = 30 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+ If TxtSubTotal2.Text.ToDecimal <> TxtSubTotal.Text.ToDecimal Then DR("ImpuestoLocal") = "SubTotal 2" : DR("Importe") = TxtSubTotal2.Text.ToDecimal : DR("Orden") = 40 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+ If TxtIVA.Text.ToDecimal <> 0 Then DR("ImpuestoLocal") = "IVA" : DR("Importe") = TxtIVA.Text.ToDecimal : DR("Orden") = 50 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+
+ If TxtRetIVA.Text.ToDecimal <> 0 Then DR("ImpuestoLocal") = "Ret.IVA" : DR("Importe") = TxtRetIVA.Text.ToDecimal : DR("Orden") = 60 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+ If TxtRetISR.Text.ToDecimal <> 0 Then DR("ImpuestoLocal") = "Ret.ISR" : DR("Importe") = TxtRetISR.Text.ToDecimal : DR("Orden") = 70 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+
+
+ 'If DdlFormatoImpresion.SelectedValue.ToEntero() = 3 Or DdlFormatoImpresion.SelectedValue.ToEntero() = 4 Then
+ ' DR("ImpuestoLocal") = "Subtotal2" : DR("Importe") = (TxtSubTotal.Text.ToDecimal + TxtIVA.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal) : DR("Orden") = 55 : TmpDTImpuestos.Rows.Add(DR)
+
+ ' DR = TmpDTImpuestos.NewRow()
+ 'End If
+
+ For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
+ If gvr.RowType = DataControlRowType.DataRow Then
+ Dim Orden As Integer = 80
+ If gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal > 0 Then
+ DR("ImpuestoLocal") = gvr.DataKey("ImpuestoLocal").ToString() : DR("Importe") = gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal.RoundSQL(2) : DR("Orden") = Orden : DR("Porcentaje") = gvr.DataKey("Porcentaje").ToString() : DR("TipoImpuesto") = gvr.DataKey("TipoImpuesto").ToString() : DR("IdCtaContable") = gvr.DataKey("IdCtaContable").ToString().ToEntero() : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+ Orden = Orden + 1
+ End If
+ 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)
+
+ ObjFacturaBonificacion.DtDeduccion = TmpDTImpuestos.FiltraParametros("", Orderby:="Orden ASC")
+
+ 'DETALLES
+ PreparaNCBonificacion(ObjFacturaBonificacion)
+
+ 'otros
+ ObjFacturaBonificacion.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim
+ ObjFacturaBonificacion.Det_OrdenCompra = TxtDet_OrdenCompra.Text.Trim
+
+
+ ObjFacturaBonificacion.CveNCaVincular = DdlNCFactura.SelectedValue.ToEntero()
+
+ If ObjFacturaBonificacion.CveMoneda <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then
+ ObjFacturaBonificacion.TipoCambio = 1
+ ObjFacturaBonificacion.CveMoneda = 1
+ End If
+
+ ObjFacturaBonificacion.DtFirmas = DTmpF
+
+ 'CLIENTE
+ ObjFacturaBonificacion.CveCliente = CveCliente
+ ObjFacturaBonificacion.SetCliente()
+
+ ''SUCURSAL
+ 'ObjFacturaBonificacion.CveSucursal = DdlSucursal.SelectedValue.ToEntero()
+ 'ObjFacturaBonificacion.SetSucursalMatriz(Me)
+ 'ObjFacturaBonificacion.SetSucursal(Me)
+
+ ObjFacturaBonificacion.ClienteSucursal = New Modelos.SucursalModel
+ ObjFacturaBonificacion.ClienteSucursal.NoExt = CliNoExt
+ ObjFacturaBonificacion.ClienteSucursal.NoInt = CliNoInt
+ ObjFacturaBonificacion.ClienteSucursal.Localidad = CliLocalidad
+ ObjFacturaBonificacion.ClienteSucursal.Direccion = LblDireccion.Text
+ ObjFacturaBonificacion.ClienteSucursal.Colonia = LblColonia.Text
+ ObjFacturaBonificacion.ClienteSucursal.Municipio = LblCiudad.Text
+ ObjFacturaBonificacion.ClienteSucursal.Estado = LblEstado.Text
+ ObjFacturaBonificacion.ClienteSucursal.CP = LblCP.Text
+ ObjFacturaBonificacion.ClienteSucursal.Pais = CliPais
+ ObjFacturaBonificacion.ClienteSucursal.CorreoSucursal = CliCorreoCot.ToString()
+ ObjFacturaBonificacion.ClienteSucursal.TelefonoSucursal = LblTelefono.Text
+ ObjFacturaBonificacion.ClienteSucursal.Sucursal = If(DdlSucursalCliente.SelectedValue.ToEntero() > 0, DdlSucursalCliente.SelectedItem.Text, "")
+
+
+
+ ObjFacturaBonificacion.SetSubProyectoMatriz(Me)
+ ObjFacturaBonificacion.SetSubProyecto(Me)
+
+ 'ENVIO DIRECCION
+ ObjFacturaBonificacion.EnviarA = New Modelos.EnviarAModel
+ If ChkDireccionEnvio.Checked Then
+ If TmpDTEnvioDireccion IsNot Nothing AndAlso TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows.Count > 0 Then
+ For Each Row As DataRow In TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows
+ ObjFacturaBonificacion.EnviarA.CveDireccionEnvio = Row("CveDireccionEnvio").ToString().ToEntero()
+ ObjFacturaBonificacion.EnviarA.EnvioDireccion = Row("EnvioDireccion").ToString()
+ ObjFacturaBonificacion.EnviarA.EnvioColonia = Row("EnvioColonia").ToString()
+ ObjFacturaBonificacion.EnviarA.EnvioCiudad = Row("EnvioCiudad").ToString()
+ ObjFacturaBonificacion.EnviarA.EnvioEstado = Row("EnvioEstado").ToString()
+ ObjFacturaBonificacion.EnviarA.EnvioCP = Row("EnvioCP").ToString()
+ Next
+ End If
+ End If
+
+ 'SI NO ES REFACTURACION
+ If NuevaFactura <> 1 Then
+ If DtVentasNC Is Nothing Then InicializaDTVentasNC()
+ Dim Drt = DtVentasNC.NewRow
+ Drt("CveVenta") = ObjFactura.CveVenta
+ Drt("Importe") = 0
+ Drt("FolioFiscal") = ObjFactura.FolioFiscal
+ DtVentasNC.Rows.Add(Drt)
+ DtVentasNC.AcceptChanges()
+ End If
+
+ 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, Optional NCDescuento As Boolean = False) As Boolean
+ ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos, Optional NCDescuento As Boolean = False,
+ Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional IndexNC As Integer = 0) As Boolean
Dim ProcesoCorrecto As Boolean = True
'GENERAMOS EL NUEVO FOLIO
@@ -7859,16 +8208,16 @@ Partial Class Ventas
If NCDescuento Then
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
- DtVentasNC.Rows(0)("Importe") = factura.Total
- DtVentasNC.Rows(0)("TC") = factura.TipoCambio
- DtVentasNC.Rows(0)("TCCambioValuacion") = factura.TipoCambio
+ DtVentasNC.Rows(IndexNC)("Importe") = factura.Total
+ DtVentasNC.Rows(IndexNC)("TC") = factura.TipoCambio
+ DtVentasNC.Rows(IndexNC)("TCCambioValuacion") = factura.TipoCambio
End If
- factura.Timbre = PreParaTimbre(ObjFacturaDevolucion)
+ factura.Timbre = PreParaTimbre(factura)
factura.CveVentaPadre = Me.CveVenta
'Registramos la venta
- GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True, NCDescuento:=True)
+ GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=False, NCDescuento:=True, ListaNCDescuento:=ListaNCDescuento)
Else
'GENERO LOS DATOS DE LA NC
@@ -9509,7 +9858,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, ByRef 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, Optional NCDescuento As Boolean = False)
+ ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing)
Dim Msgok As New StringBuilder
Dim CveAlmacenTraspasoOrigen As Integer = -1
@@ -9865,7 +10214,7 @@ Partial Class Ventas
If ErrorList.Count = 0 Then
'prepoliza
- GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento)
+ GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento)
If ErrorList.Count = 0 Then
'INVENTARIOS
@@ -9899,7 +10248,8 @@ Partial Class Ventas
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, Optional NCDescuento As Boolean = False, Optional ValorMultiplicador As Integer = 1)
+ ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False,
+ Optional ValorMultiplicador As Integer = 1, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing)
Dim CveIE As Integer = -1
Dim DT As DataTable = Nothing
@@ -9918,7 +10268,7 @@ Partial Class Ventas
If DdlTipoComprobante.SelectedValue <> "Cot" Then
If factura.CvePrePoliza > 0 Then
- If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, ValorMultiplicador, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento) Then
+ If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, ValorMultiplicador, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento) 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
@@ -9929,7 +10279,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, Optional NCDescuento As Boolean = False) As Boolean
+ ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing) As Boolean
Try
Dim DT As DataTable
Dim CvePlantilaPoliza As Integer
@@ -10269,91 +10619,100 @@ Partial Class Ventas
If EsNCAmortizacion Then
'' aqui no se registra el pago como NC, se deja para el registro de la aplicaion del anticipo
'' esto para trasladar los impuestos.
- If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") Then
- For Each row2 As GridViewRow In GVAnticipos.Rows
- If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 3 Then
- If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then
- CveIEAnticipo = row2.DataKey("CveIE").ToString().ToEntero()
- importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal)
- Dim ImporteAnticipo As Decimal = importeMovimiento
- If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
+ If Not AplicoNCFacturaActual Then
+ If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") Then
- If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then ImporteAnticipo = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal * row2.DataKey("SubTotalAnticipo").ToDecimal
+ For Each row2 As GridViewRow In GVAnticipos.Rows
+ If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 3 Then
+ If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then
+ CveIEAnticipo = row2.DataKey("CveIE").ToString().ToEntero()
+ importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal)
+ Dim ImporteAnticipo As Decimal = importeMovimiento
+ If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
- IdCtaContable = IdCtaContAnticipos
- CveCuenta = CveCuentaAnticipos
- CveSubProyectoContabilizar = CveSubProyectoVenta
+ If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then ImporteAnticipo = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal * row2.DataKey("SubTotalAnticipo").ToDecimal
- If importeMovimiento <> 0 Then
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteAnticipo, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=ImporteAnticipo * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
- ErrorPrepoliza = True
- Exit For
- Else
- ViewState("SeGuardoPrePoliza") = True
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContClientes, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
+ IdCtaContable = IdCtaContAnticipos
+ CveCuenta = CveCuentaAnticipos
+ CveSubProyectoContabilizar = CveSubProyectoVenta
+
+ If importeMovimiento <> 0 Then
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteAnticipo, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=ImporteAnticipo * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
Exit For
- End If
- 'se hace acreditamiento de impuestos
- 'IVA X TRASLADAR
- Dim EsAnticipoEspecial As Boolean = False
+ Else
+ ViewState("SeGuardoPrePoliza") = True
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContClientes, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
+ 'se hace acreditamiento de impuestos
+ 'IVA X TRASLADAR
+ Dim EsAnticipoEspecial As Boolean = False
- If UsuarioActual.CveEmpresa.Contiene(1, 119) Then EsAnticipoEspecial = True
- If EsAnticipoEspecial Then
- Dim PorcentajeImpuestoPago As Decimal = TmpDT.MAX("PorcentajeIVA").ToDecimal
- '' si se esta aplicando NC por amortizaion, se trasladan impuestos
- If EsNCAmortizacion Then
- Dim IngresoIVA As Decimal = TxtIVA.Text.ToDecimal
- Dim IngresoIEPS As Decimal = TxtIEPS.Text.ToDecimal
- Dim IngresoTotal As Decimal = TxtTotal.Text.ToDecimal
+ If UsuarioActual.CveEmpresa.Contiene(1, 119) Then EsAnticipoEspecial = True
+ If EsAnticipoEspecial Then
+ Dim PorcentajeImpuestoPago As Decimal = TmpDT.MAX("PorcentajeIVA").ToDecimal
+ '' si se esta aplicando NC por amortizaion, se trasladan impuestos
+ If EsNCAmortizacion Then
+ Dim IngresoIVA As Decimal = TxtIVA.Text.ToDecimal
+ Dim IngresoIEPS As Decimal = TxtIEPS.Text.ToDecimal
+ Dim IngresoTotal As Decimal = TxtTotal.Text.ToDecimal
- If IngresoIVA > 0 Then
+ If IngresoIVA > 0 Then
- IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
- Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
- ErrorPrepoliza = True
- Exit For
- End If
- 'IVA PAGADO
- IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado)
- Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
- ErrorPrepoliza = True
- Exit For
- End If
- End If
-
-
- If IngresoIEPS > 0 Then
- 'IEPS X TRASLADAR
- Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
- If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
- ErrorPrepoliza = True
- Exit For
+ IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
+ Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
+ 'IVA PAGADO
+ IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado)
+ Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
End If
- 'IEPS PAGADO
- Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
- If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
- ErrorPrepoliza = True
- Exit For
+
+ If IngresoIEPS > 0 Then
+ 'IEPS X TRASLADAR
+ Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
+ If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
+
+ 'IEPS PAGADO
+ Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
+ If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
End If
End If
End If
+
+
+
End If
-
-
-
End If
+
End If
-
End If
- End If
- Next
+ Next
+ End If
+ ElseIf AplicoNCFacturaActual AndAlso ChkAplicaNCAnticipo.Checked Then
+ 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
End If
+
Else
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
@@ -10730,7 +11089,7 @@ Partial Class Ventas
Dim ListaNC As List(Of Modelos.Factura) = Nothing
If NCDescuento Then
- ListaNC = ListaNCDesc
+ ListaNC = ListaNCDescuento
Else
ListaNC = ListaRemisionesNC
End If
@@ -15034,43 +15393,47 @@ Partial Class Ventas
Private Sub AgregarPS()
'SELECCIONA EL PS DEPENDIENDO LA MODALIDAD (CODIGO BARRAS - DDL)
- Dim CvePS As Integer = -1
- If DIVCod.Visible Then
- CvePS = HdnCvePS.Value.ToEntero()
- Else
- CvePS = DdlPS.SelectedValue.ToEntero()
- End If
-
- If ValidaAgregarPS(CvePS, DdlUnidadMedida.SelectedValue.ToEntero(), TxtPrecio.Text.Trim.ToDouble, HdnTipoPS.Value.ToEntero()) Then
-
- If UsuarioActual.Empresa.Funcionalidad(507) = DdlPS.SelectedValue Then
- CvePSAmortizacion = DdlPS.SelectedValue.ToEntero().ToEntero()
+ Try
+ Dim CvePS As Integer = -1
+ If DIVCod.Visible Then
+ CvePS = HdnCvePS.Value.ToEntero()
+ Else
+ CvePS = DdlPS.SelectedValue.ToEntero()
End If
- 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
+ If ValidaAgregarPS(CvePS, DdlUnidadMedida.SelectedValue.ToEntero(), TxtPrecio.Text.Trim.ToDouble, HdnTipoPS.Value.ToEntero()) Then
+
+ If UsuarioActual.Empresa.Funcionalidad(507) = DdlPS.SelectedValue Then
+ CvePSAmortizacion = DdlPS.SelectedValue.ToEntero().ToEntero()
+ End If
+
+ 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
+ End If
+
+ 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)
+
+ CalculaUsados()
+
+ CalculaTotalesVenta()
+
+ LimpiaAgregar()
+
+ 'SI EL PORLET DE COMERCIO EXTERIOR EXTERIOR ESTA VISIBLE SE ACTUALIZAN LOS PRODUCTOS DEL GRIDVIEW
+ If AplicaComercioExterior Then
+ CargaGvComercioExterior()
+ End If
End If
-
- 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)
-
- CalculaUsados()
-
- CalculaTotalesVenta()
-
- LimpiaAgregar()
-
- 'SI EL PORLET DE COMERCIO EXTERIOR EXTERIOR ESTA VISIBLE SE ACTUALIZAN LOS PRODUCTOS DEL GRIDVIEW
- If AplicaComercioExterior Then
- CargaGvComercioExterior()
- End If
- End If
- UpPS.Update()
+ UpPS.Update()
+ Catch ex As Exception
+ OnError("Ocurrió un error al agregar el producto", ex)
+ End Try
End Sub
@@ -15191,7 +15554,7 @@ Partial Class Ventas
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) As Boolean
+ Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1, Optional EsCargo As Boolean = False) As Boolean
Dim Retorno As Boolean = False
If Not CvePS > 0 Then
@@ -15237,6 +15600,8 @@ Partial Class Ventas
Row("CvePS") = CvePS
Row("Obs") = Obs
+
+
Dim DrPS As DataRow = Nothing
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
@@ -15361,6 +15726,7 @@ Partial Class Ventas
Row("CveVentaDetallePedido2") = CveVentaDetallePedido2
Row("CuentaPredial") = CuentaPredial
Row("EsOutSourcing") = DrPS("EsOutSourcing")
+ Row("EsCargo") = EsCargo
If UsuarioActual.CveEmpresa = 119 Then
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
@@ -15575,6 +15941,7 @@ Partial Class Ventas
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
TmpDT.Columns("EsOutSourcing").DefaultValue = False
+ TmpDT.Columns("EsCargo").DefaultValue = False
End Sub
Private Sub CreaDTmpC()
@@ -18497,7 +18864,7 @@ Partial Class Ventas
End If
If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then
- Dim TotalNC As Decimal = If(ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0, LblTotalNC.Text.Trim().ToDecimal(), 0)
+ Dim TotalNC As Decimal = If((ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) OrElse (ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0), LblTotalNC.Text.Trim().ToDecimal(), 0)
If TotalNC > 0 Then
If (DtPagos.SUM("Importe").ToString().ToDecimal() + AmortizacionNC + 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)
@@ -18755,14 +19122,15 @@ Partial Class Ventas
If ObjInv.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjInv.DtResultados.Rows.Count > 0 Then
CargaGVInv(ObjInv.DtResultados)
- Else
- 'si es la empresa 119, Candado, no permiter refacturar, si no se ha surtido, para que cancele la factura mejor.
- If UsuarioActual.CveEmpresa = 119 AndAlso LkRefacturacion.Visible AndAlso ObjInv.DtResultados.Rows.Count = 0 Then
- LkRefacturacion.Visible = False
- End If
End If
End If
ObjInv.Dispose()
+
+ 'si es la empresa 119, Candado, no permiter refacturar, si no se ha surtido, para que cancele la factura mejor.
+ If UsuarioActual.CveEmpresa = 119 AndAlso LkRefacturacion.Visible AndAlso VentaSaldoAlmacen = 0 Then
+ LkRefacturacion.Visible = False
+ End If
+
End Sub
Private Sub CargaGVInv(DtTemporal As DataTable)
@@ -21049,7 +21417,7 @@ Partial Class Ventas
If CveMovimientoEntradaGeneral > 0 Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaConsignacion, UsuarioActual.CveEmpresa) Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
- If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=-3, Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
+ If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
Return False
End If
Next
@@ -22403,6 +22771,10 @@ Partial Class Ventas
UpAplicarNC.Update()
End Sub
+ Protected Sub DdlVentaUsado_SelectedIndexChanged(sender As Object, e As EventArgs)
+ CargaRNC(DdlVentaUsado.SelectedValue.ToEntero())
+ End Sub
+
Private Sub InicializaAplicarNCMasiva()
'If Not UsuarioActual.CveUsuario = 100 Then
@@ -22440,28 +22812,164 @@ Partial Class Ventas
ObjMovtos.Dispose()
GvCxC.DataBind()
End Sub
- Private Sub CargaRNC()
- Dim ObjMovtos As New ClsMovimientos()
+ Private Sub CargaRNC(Optional CveVentaUsado As Integer = -1)
+ Dim DtNC As DataTable = Nothing
+ Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
- GvRemisionesNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
+ DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
End If
ObjMovtos.Dispose()
+
+ TmpDTRNCBonificacionesSeleccionadas = Nothing
+
+ GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1")
+ GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas
+
+ Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2")
+ Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal))
+ Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
+
GvRemisionesNC.DataBind()
+ GvRemisionesNCBon.DataBind()
+
+ If CveVentaUsado > 0 Then
+ Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa)
+ LtlSMU.Text = String.Format("{0:N2}", FacUsado.DtDetalle.SUM("Total", "EsCargo = True").ToDecimal())
+ Else
+ LtlSMU.Text = String.Format("{0:N2}", 0)
+ End If
+
UpModalRemisionesNC.Update()
End Sub
Private Sub CargaDescRNC()
-
+ Dim DtNC As DataTable = Nothing
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
- GvDescNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
+ DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
End If
ObjMovtos.Dispose()
- GvDescNC.DataBind()
+
+ TmpDTRNCBonificacionesSeleccionadas = Nothing
+
+ GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1")
+ GvDescNCBonificaciones.DataSource = TmpDTRNCBonificacionesSeleccionadas
+
+ Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2")
+ Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal))
+ Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
+
+ GvDescNCCargos.DataBind()
+ GvDescNCBonificaciones.DataBind()
+
+ LblSaldoMaximoUsados.Text = String.Format("{0:N2}", Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal())
UpDescNC.Update()
End Sub
- Protected Sub GvDescNC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNC.RowDataBound
+
+ Protected Sub ChkAplicarRNC_CheckedChanged(sender As Object, e As EventArgs)
+ Dim ChkAplicarRNC As CheckBox = DirectCast(sender, CheckBox)
+ Dim GvRow As GridViewRow = DirectCast(ChkAplicarRNC.NamingContainer, GridViewRow)
+
+ If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
+ TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
+ End If
+
+ Dim CveVentaBonificacion As Integer = -1
+ Dim ImporteBonificacion As Decimal = 0
+ Using ObjAcum As New ClsAcumuladores
+ If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=GvRow.DataKey("CveVenta").ToEntero()) Then
+ Dim RowMovto As DataRow = ObjAcum.DtResultados.FiltroPrimero("")
+
+ CveVentaBonificacion = RowMovto("CveVentaBonificacion").ToString().ToEntero()
+ ImporteBonificacion = RowMovto("ImporteBonificacion").ToString().ToDecimal()
+ End If
+ End Using
+
+ If CveVentaBonificacion > 0 Then
+ Dim RowBonificacion As DataRow = Me.TmpDTRNCBonificacionesCliente.FiltroPrimero($"CveVenta = {CveVentaBonificacion}")
+ RowBonificacion("ImporteBonificacion") = ImporteBonificacion
+ RowBonificacion("CveVentaRNCCargo") = GvRow.DataKey("CveVenta").ToEntero()
+
+ If ChkAplicarRNC.Checked Then
+ TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray)
+ Else
+ Dim RowEliminar As DataRow = Me.TmpDTRNCBonificacionesSeleccionadas.Select($"CveVenta = {CveVentaBonificacion}").FirstOrDefault()
+ TmpDTRNCBonificacionesSeleccionadas.Rows.Remove(RowEliminar)
+ End If
+
+ End If
+
+ 'VERIFICA SI TIENE BONIFICACIONES PARA AGREGARLAS
+ If TmpDTRNCBonificacionesSeleccionadas IsNot Nothing AndAlso TmpDTRNCBonificacionesSeleccionadas.Rows.Count > 0 Then
+ DivRNCBonificaciones.Visible = True
+ Else
+ DivRNCBonificaciones.Visible = False
+ End If
+
+ GvDescNCBonificaciones.DataSource = TmpDTRNCBonificacionesSeleccionadas
+ GvDescNCBonificaciones.DataBind()
+
+ LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal())
+
+ UpDescNC.Update()
+
+ End Sub
+ Protected Sub ChkAplicarNCBon_CheckedChanged(sender As Object, e As EventArgs)
+ Dim ChkAplicarRNC As CheckBox = DirectCast(sender, CheckBox)
+ Dim GvRow As GridViewRow = DirectCast(ChkAplicarRNC.NamingContainer, GridViewRow)
+
+ If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
+ TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
+ End If
+
+ Dim CveVentaBonificacion As Integer = -1
+ Dim ImporteBonificacion As Decimal = 0
+ Using ObjAcum As New ClsAcumuladores
+ If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=GvRow.DataKey("CveVenta").ToEntero()) Then
+ Dim RowMovto As DataRow = ObjAcum.DtResultados.FiltroPrimero("")
+
+ CveVentaBonificacion = RowMovto("CveVentaBonificacion").ToString().ToEntero()
+ ImporteBonificacion = RowMovto("ImporteBonificacion").ToString().ToDecimal()
+ End If
+ End Using
+
+ If CveVentaBonificacion > 0 Then
+ Dim RowBonificacion As DataRow = Me.TmpDTRNCBonificacionesCliente.FiltroPrimero($"CveVenta = {CveVentaBonificacion}")
+ RowBonificacion("ImporteBonificacion") = ImporteBonificacion
+ RowBonificacion("CveVentaRNCCargo") = GvRow.DataKey("CveVenta").ToEntero()
+
+ If ChkAplicarRNC.Checked Then
+ TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray)
+ Else
+ Dim RowEliminar As DataRow = Me.TmpDTRNCBonificacionesSeleccionadas.Select($"CveVenta = {CveVentaBonificacion}").FirstOrDefault()
+ TmpDTRNCBonificacionesSeleccionadas.Rows.Remove(RowEliminar)
+ End If
+
+ End If
+
+ 'VERIFICA SI TIENE BONIFICACIONES PARA AGREGARLAS
+ If TmpDTRNCBonificacionesSeleccionadas IsNot Nothing AndAlso TmpDTRNCBonificacionesSeleccionadas.Rows.Count > 0 Then
+ DivRNCBon.Visible = True
+ Else
+ DivRNCBon.Visible = False
+ End If
+
+ GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas
+ GvRemisionesNCBon.DataBind()
+
+ LtlSMUBon.Text = String.Format("{0:N2}", Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal())
+
+ UpModalRemisionesNC.Update()
+
+ End Sub
+ Protected Sub GvDescNCCargos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCCargos.RowDataBound
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
+ e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
+ End If
+ End Sub
+ Protected Sub GvDescNCBonificaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCBonificaciones.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
@@ -22557,11 +23065,11 @@ Partial Class Ventas
End If
ObjVentas.Dispose()
- AplicarNC(DdlNCPS.SelectedValue.ToEntero(), EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked, AplicaImpuestosLocales:=AplicaImpuestosLocales, AplicaNuevoDocumento:=AplicaNuevoDocumento)
+ AplicarNC(DdlNCPS.SelectedValue.ToEntero(), EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked, AplicaImpuestosLocales:=AplicaImpuestosLocales, AplicaNuevoDocumento:=AplicaNuevoDocumento, AplicoNCFacturaActual:=True)
End Sub
- Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional AplicaNuevoDocumento As Boolean = False)
+ Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional AplicaNuevoDocumento As Boolean = False, Optional AplicoNCFacturaActual As Boolean = False)
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
@@ -22586,6 +23094,8 @@ Partial Class Ventas
End If
End If
+ Me.AplicoNCFacturaActual = AplicoNCFacturaActual
+
'CREAMOS DT PARA UTILIZAR AL TIMBRAR
InicializaDTVentasNC()
@@ -22604,12 +23114,21 @@ Partial Class Ventas
DtImpuestos.AcceptChanges()
Dim AcumuladoNC As Decimal = 0
+ Dim DtImpuestosBonificacion As DataTable = DtImpuestos.Copy()
+
If Not AplicaNuevoDocumento Then
If AplicaNCMasiva Then
If NCDescuento Then
For Each RNC In ListaNCDesc
DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
Next
+
+ 'SI HAY RNC DE BONIFICACION SE AGREGAN
+ If ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
+ For Each RNC In ListaNCBonificacion
+ DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
+ Next
+ End If
Else
For Each Gvr As GridViewRow In GvCxC.Rows
@@ -22641,16 +23160,19 @@ Partial Class Ventas
End If
Else
For Each RNC In ListaRemisionesNC
- DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
+ DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore)
+ Next
+ For Each RNC In ListaNCBonificacion
+ DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore)
Next
End If
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
+ 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),
@@ -22662,9 +23184,25 @@ Partial Class Ventas
PorcentajeRetIVA = PorcentajeRetIVA,
PorcentajeRetISR = PorcentajeRetISR,
PorcentajeIEPS = PorcentajeIEPS
- '(1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
- 'Dim DrSubProyecto = GlobalDTSubProyectos(-1, TmpDT.FiltroPrimeroValor("CveSubProyecto", "", "ImporteTotal DESC").ToEntero(), UsuarioActual.CveEmpresa, -1).FiltroPrimero("")
+
+ Dim queryBonificacion = From dr In DtImpuestosBonificacion
+ 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) (s("ImporteIVA").ToString().ToDecimal)).RoundSQL(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
+
Dim DrSubProyecto = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, -1).FiltroPrimero("")
@@ -22674,6 +23212,7 @@ Partial Class Ventas
End If
DtImpuestos = query.QueryToDataTable(False)
+ DtImpuestosBonificacion = queryBonificacion.QueryToDataTable(False)
If Not NCDescuento Then
LimpiaDocumentoNC()
@@ -22690,13 +23229,20 @@ Partial Class Ventas
TmpDTDescNC = TmpDT.Clone()
TmpDTDescNC.Clear()
- For Each Dr As DataRow In DtImpuestos.Rows
- AgregaTempDT(TmpDTDescNC, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
- DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
- TxtNCObservaciones.Text.Trim, 1, 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
+ If UsuarioActual.CveEmpresa = 140 Then
+
+ CrearDTNCCargo(ListaNCDesc, DtImpuestos, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
+ CrearDTNCBonificacion(ListaNCDesc, DtImpuestosBonificacion, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
+
+ Else
+ For Each Dr As DataRow In DtImpuestos.Rows
+ AgregaTempDT(TmpDTDescNC, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
+ DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
+ TxtNCObservaciones.Text.Trim, 1, 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 If
TrTipoRelacion.Visible = True
DdlTiposRelacion.SelectedValueExist("1")
@@ -22714,21 +23260,32 @@ Partial Class Ventas
Dim UltimoRenglon As Integer = 1
Dim Ajuste As Decimal = 0
- For Each Dr As DataRow In DtImpuestos.Rows
- Acumulado12 += Dr("ImportePU").ToString().ToDecimal.RoundSQL + Dr("ImporteIVA").ToString().ToDecimal.RoundSQL + Dr("ImporteIEPS").ToString().ToDecimal
- If UltimoRenglon = DtImpuestos.Rows.Count Then
- 'ajusta 5 centavos de diferencia
- If Acumulado12 <> AcumuladoNC And Math.Abs(Acumulado12 - AcumuladoNC) <= 0.05 Then
- Ajuste = (Acumulado12 - AcumuladoNC)
+ 'DEBE AGREGAR LOS USADOS DE LA REMISION EN LA NOTA DE CREDITO
+ If UsuarioActual.CveEmpresa = 140 AndAlso ListaRemisionesNC.Count > 0 Then
+
+ CrearDTNCCargo(ListaRemisionesNC, DtImpuestos, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
+ CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
+
+ Else
+ For Each Dr As DataRow In DtImpuestos.Rows
+ Acumulado12 += Dr("ImportePU").ToString().ToDecimal.RoundSQL + Dr("ImporteIVA").ToString().ToDecimal.RoundSQL + Dr("ImporteIEPS").ToString().ToDecimal
+ If UltimoRenglon = DtImpuestos.Rows.Count Then
+ 'ajusta 5 centavos de diferencia
+ If Acumulado12 <> AcumuladoNC And Math.Abs(Acumulado12 - AcumuladoNC) <= 0.05 Then
+ Ajuste = (Acumulado12 - AcumuladoNC)
+ End If
End If
- End If
- UltimoRenglon += 1
- AgregaTempDT(TmpDT, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
- DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
- TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal + Ajuste, 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
+ UltimoRenglon += 1
+
+ AgregaTempDT(TmpDT, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
+ DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
+ TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal + Ajuste, 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 If
+
GvPS.DataSource = TmpDT
GvPS.DataBind()
@@ -22757,7 +23314,87 @@ Partial Class Ventas
End If
End Sub
- Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal, Optional NCDescuento As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional NivelTotal As Integer = 1) As DataTable
+ Private Sub CrearDTNCCargo(ListaNC As List(Of Modelos.Factura), DtImpuestos As DataTable, ByRef TmpDTCargo As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
+ For Each Dr As DataRow In DtImpuestos.Rows
+ For Each RNC In ListaNC
+ Dim UltimoRenglonRNC As Integer = 1
+ For Each RowUsado As DataRow In RNC.DtDetalle.Rows
+
+ Dim PorcentajeUsado = (RowUsado("Total").ToString().ToDecimal() - RowUsado("Descuento").ToString().ToDecimal() + RowUsado("ImporteIVA").ToString().ToDecimal() + RowUsado("ImporteIEPS").ToString().ToDecimal() - RowUsado("ImporteRetIVA").ToString().ToDecimal() - RowUsado("ImporteRetISR").ToString().ToDecimal()) / RNC.Total
+ Dim Obs = RowUsado("CodigoPS").ToString()
+
+ If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
+ Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
+ End If
+
+ Dim ImportePU = Dr("ImportePU").ToString().ToDecimal * PorcentajeUsado
+ Dim ImporteIVA = Dr("ImporteIVA").ToString().ToDecimal * PorcentajeUsado
+ Dim ImporteRetIVA = Dr("ImporteRetIVA").ToString().ToDecimal * PorcentajeUsado
+ Dim ImporteRetISR = Dr("ImporteRetISR").ToString().ToDecimal * PorcentajeUsado
+ Dim ImporteIEPS = Dr("ImporteIEPS").ToString().ToDecimal * PorcentajeUsado
+ Dim ImporteTotal = Dr("ImporteTotal").ToString().ToDecimal * PorcentajeUsado
+
+ 'If UltimoRenglonRNC = RNC.DtDetalle.Rows.Count Then
+ ' ImportePU += Ajuste
+ 'End If
+
+ AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
+ DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
+ Obs, 1, ImportePU, Dr("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, Dr("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
+ Dr("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, Dr("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0.0, ImporteTotal, "", "", -1, -1,
+ DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
+
+ UltimoRenglonRNC += 1
+ Next
+
+ Next
+ Next
+ End Sub
+ Private Sub CrearDTNCBonificacion(ListaNC As List(Of Modelos.Factura), DtImpuestosBonificacion As DataTable, ByRef TmpDTNC As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
+ 'SI TIENE DE BONIFICACION LOS AGREGA
+ If DtImpuestosBonificacion IsNot Nothing AndAlso ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
+
+ TmpDTDescNCBonificacion = TmpDTNC.Clone()
+ TmpDTDescNCBonificacion.Clear()
+
+ For Each Dr As DataRow In DtImpuestosBonificacion.Rows
+ For Each RNC In ListaNCBonificacion
+ Dim UltimoRenglonRNC As Integer = 1
+
+ Dim RNCCargo = ListaNC.Where(Function(f) f.CveVenta = RNC.CveVentaRNCCargo).FirstOrDefault()
+
+ For Each RowCargo As DataRow In RNCCargo.DtDetalle.Rows
+
+ Dim PorcentajeCargo = (RowCargo("Total").ToString().ToDecimal() - RowCargo("Descuento").ToString().ToDecimal() + RowCargo("ImporteIVA").ToString().ToDecimal() + RowCargo("ImporteIEPS").ToString().ToDecimal() - RowCargo("ImporteRetIVA").ToString().ToDecimal() - RowCargo("ImporteRetISR").ToString().ToDecimal()) / RNCCargo.Total
+
+ Dim Obs = RowCargo("CodigoPS").ToString()
+
+ If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
+ Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
+ End If
+
+ Dim ImportePU = Dr("ImportePU").ToString().ToDecimal * PorcentajeCargo
+ Dim ImporteIVA = Dr("ImporteIVA").ToString().ToDecimal * PorcentajeCargo
+ Dim ImporteRetIVA = Dr("ImporteRetIVA").ToString().ToDecimal * PorcentajeCargo
+ Dim ImporteRetISR = Dr("ImporteRetISR").ToString().ToDecimal * PorcentajeCargo
+ Dim ImporteIEPS = Dr("ImporteIEPS").ToString().ToDecimal * PorcentajeCargo
+ Dim ImporteTotal = Dr("ImporteTotal").ToString().ToDecimal * PorcentajeCargo
+
+ AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
+ DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
+ Obs, 1, ImportePU, Dr("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, Dr("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
+ Dr("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, Dr("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0.0, ImporteTotal, "", "", -1, -1,
+ DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
+
+ UltimoRenglonRNC += 1
+ Next
+
+ Next
+ Next
+ End If
+ End Sub
+
+ Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal, Optional NCDescuento As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional NivelTotal As Integer = 1, Optional AplicaNCUsado As Boolean = False) As DataTable
Dim Total As Decimal = 0, SubTotal As Decimal = 0, Saldo As Decimal = 0
Dim TmpDT As DataTable = Nothing
@@ -22777,7 +23414,7 @@ Partial Class Ventas
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
End If
- If AplicaNCMasiva Then
+ If AplicaNCMasiva OrElse AplicaNCUsado Then
If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
Total = ObjVentas.DtResultados()(0)("Total").ToString().ToDecimal
@@ -22823,8 +23460,10 @@ Partial Class Ventas
Dr("ImporteTotal") = importePuTemp.RoundSQL(2)
+ Dim TotalCalculableImpuestosIVA As Decimal = importePuTemp * (1 + Dr("PorcentajeIEPS").ToString().ToDecimal)
+
Dr("ImporteIEPS") = (importePuTemp * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2)
- Dr("ImporteIVA") = ((importePuTemp + Dr("ImporteIEPS").ToString().ToDecimal) * Dr("PorcentajeIVA").ToString().ToDecimal)
+ Dr("ImporteIVA") = ((TotalCalculableImpuestosIVA) * Dr("PorcentajeIVA").ToString().ToDecimal)
Dr("ImporteRetIVA") = (importePuTemp * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteRetISR") = (importePuTemp * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2)
@@ -22844,55 +23483,12 @@ Partial Class Ventas
'codigo para ajuste de centavo, si el importe total no cuadra con los totales
Dim difTmp As Decimal = Importe - importeNC
- 'el ajuste procede si no tiene iva,ni ieps, con iva sin ieps,
If Math.Abs(difTmp) > 0.00D Then
- 'filtro si hay renglon sin impuestos.
- Dim drDIF As DataRow() = DtImpuestosLocal.Select("ImporteIVA = 0 AND ImporteIEPS = 0")
-
- If drDIF IsNot Nothing AndAlso drDIF.Length > 0 Then
- Dim ImporteAjustado0 As Decimal = drDIF(0)("ImporteTotal").ToString().ToDecimal + difTmp
- drDIF(0)("ImporteTotal") = ImporteAjustado0
- drDIF(0)("ImportePU") = ImporteAjustado0
- Else
- 'filtro si hay renglon sin impuestos.
- Dim drDIF2 As DataRow() = DtImpuestosLocal.Select("ImporteIVA > 0 AND ImporteIEPS = 0")
-
- If drDIF2 IsNot Nothing AndAlso drDIF2.Length > 0 Then
- Dim PorIVA As Decimal = drDIF2(0)("PorcentajeIVA").ToString().ToDecimal
- Dim ImporteAjustado1 As Decimal = drDIF2(0)("ImporteTotal").ToString().ToDecimal + (difTmp / (1 + PorIVA)) 'saco el PU sin iva
- drDIF2(0)("ImportePU") = ImporteAjustado1
- drDIF2(0)("ImporteTotal") = ImporteAjustado1
- drDIF2(0)("ImporteIVA") = (ImporteAjustado1) * drDIF2(0)("PorcentajeIVA").ToString().ToDecimal
- Else
- ' ajustar cuando tiene ieps y no iva
- Dim drDIF3 As DataRow() = DtImpuestosLocal.Select("ImporteIVA = 0 AND ImporteIEPS > 0")
-
- If drDIF3 IsNot Nothing AndAlso drDIF3.Length > 0 Then
- Dim PorIEPS As Decimal = drDIF3(0)("PorcentajeIEPS").ToString().ToDecimal
- Dim ImporteAjustado1 As Decimal = drDIF3(0)("ImporteTotal").ToString().ToDecimal + (difTmp / (1 + PorIEPS)) 'saco el PU sin iva
- drDIF3(0)("ImportePU") = ImporteAjustado1
- drDIF3(0)("ImporteTotal") = ImporteAjustado1
- drDIF3(0)("ImporteIEPS") = (ImporteAjustado1) * drDIF3(0)("PorcentajeIEPS").ToString().ToDecimal
- Else
- ' ajustar cuando tiene ieps e iva
- Dim drDIF4 As DataRow() = DtImpuestosLocal.Select("ImporteIVA > 0 AND ImporteIEPS > 0")
-
- If drDIF4 IsNot Nothing AndAlso drDIF4.Length > 0 Then
- Dim PorIEPS As Decimal = drDIF4(0)("PorcentajeIEPS").ToString().ToDecimal
- Dim PorIVA As Decimal = drDIF4(0)("PorcentajeIVA").ToString().ToDecimal
- Dim ImporteAntesIVA As Decimal = (difTmp / (1 + PorIVA))
- Dim ImporteAjustado1 As Decimal = drDIF4(0)("ImporteTotal").ToString().ToDecimal + +(ImporteAntesIVA / (1 + PorIEPS)) 'saco el PU sin iva
- drDIF4(0)("ImportePU") = ImporteAjustado1
- drDIF4(0)("ImporteTotal") = ImporteAjustado1
- drDIF4(0)("ImporteIEPS") = (ImporteAjustado1) * drDIF4(0)("PorcentajeIEPS").ToString().ToDecimal
- drDIF4(0)("ImporteIVA") = (ImporteAjustado1 + drDIF4(0)("ImporteIEPS").ToString.ToDecimal) * drDIF4(0)("PorcentajeIVA").ToString().ToDecimal
- End If
- End If
- End If
-
- End If
-
+ 'asusto la diferencia en el último concepto
+ Dim ImporteAjustado As Decimal = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal").ToString().ToDecimal + Math.Abs(difTmp)
+ DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal") = ImporteAjustado
+ DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImportePU") = ImporteAjustado
End If
If Not NCDescuento Then
@@ -24483,11 +25079,9 @@ Partial Class Ventas
If dtSeleccionadas.Rows.Count > 0 Then
Select Case RblTipo.SelectedValue
Case "1" 'T O T A L G E N E R A L
-
For Each row As DataRow In dtSeleccionadas.Rows
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
Next
-
IsTotalxConcepto = False
Dim PU As Decimal = dtSeleccionadas.SUM("SubTotal").ToDecimal
Dim PS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa)(0)
@@ -24498,12 +25092,11 @@ Partial Class Ventas
PS("Clasificacion").ToString(), PS("CvePS").ToString().ToEntero(), PS("PS").ToString(), "", PU, 0,
rowSP("CveProyecto").ToString().ToEntero(), rowSP("Proyecto").ToString(), rowSP("CveSubProyecto").ToString().ToEntero(), rowSP("SubProyecto").ToString(), RegeneraIEPS:=True)
+ CalculaTotalesVenta()
Case "2" 'T O T A L X R E M I S I O N
-
For Each row As DataRow In dtSeleccionadas.Rows
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
Next
-
Dim PS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa)(0)
Dim rowSP As DataRow = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa)(0)
Dim IVA As Double = If(dtSeleccionadas.SUM("Iva") > 0, dtSeleccionadas.SUM("Iva") / dtSeleccionadas.SUM("SubTotal"), 0.16)
@@ -24515,8 +25108,8 @@ Partial Class Ventas
End If
Next
+ CalculaTotalesVenta()
Case "3" 'T O T A L X C O N C E P T O
-
IsTotalxConcepto = True
Dim sb As New StringBuilder
If ChkRemProductos.Checked Then
@@ -24532,9 +25125,7 @@ Partial Class Ventas
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
Next
End If
-
sb.Remove(sb.Length - 1, 1)
-
CargaConceptosRemisionPorFacturar(sb.ToString(), If(ChkRemProductos.Checked, 2, 1))
sb.Clear()
End Select
@@ -25113,6 +25704,7 @@ Partial Class Ventas
BtnEditarCotizacion.Visible = False
BtnGenerarOS.Visible = False
BtnsFacturar.Visible = False
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
HLOrdendeCompra.Visible = False
LBAplicaDevolucion.Visible = False
'LkNotaCredito.Visible = False
@@ -25646,7 +26238,7 @@ Partial Class Ventas
AgregarProductoServicio(drowPsTamaños("Cantidad").ToString().ToEntero(), drowPsTamaños("CveUnidadMedida").ToString().ToEntero(), drowPsTamaños("UnidadMedida").ToString(),
drowPsTamaños("CveClasificacion").ToString().ToEntero(), drowPsTamaños("Clasificacion").ToString(), drowPsTamaños("CvePS").ToString().ToEntero(),
drowPsTamaños("PS").ToString(), "", drowPsTamaños("PU").ToString().ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString().ToEntero(),
- drowPsTamaños("SubProyecto").ToString(), CveVentaDetalle:=CveVentaDetalleDevolucion)
+ drowPsTamaños("SubProyecto").ToString(), CveVentaDetalle:=CveVentaDetalleDevolucion, EsCargo:=True)
End If
Next
@@ -25730,6 +26322,12 @@ Partial Class Ventas
ListaRemisionesNC.Clear()
End If
+ If ListaNCBonificacion Is Nothing Then
+ ListaNCBonificacion = New List(Of Modelos.Factura)
+ Else
+ ListaNCBonificacion.Clear()
+ End If
+
Dim TotalRemNCAplicado As Decimal = 0
For Each GvRow As GridViewRow In GvRemisionesNC.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
@@ -25749,6 +26347,25 @@ Partial Class Ventas
End If
Next
+ For Each GvRow As GridViewRow In GvRemisionesNCBon.Rows
+ If GvRow.RowType = DataControlRowType.DataRow Then
+ If GvRow.FCCheckBox("ChkAplicar").Checked Then
+ Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
+ RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
+ RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVentaRNCCargo").ToEntero()
+ TotalRemNCAplicado += RemNC.TotalRemNCAplicado
+
+ If RemNC.TotalRemNCAplicado <= 0 Then
+ Alert($"Debe asignar un importe en la siguiente remisión: {RemNC.SerieFolio}", TipoMensaje.MsgAdvertencia)
+ ListaNCBonificacion.Clear()
+ Exit Sub
+ End If
+
+ ListaNCBonificacion.Add(RemNC)
+ End If
+ End If
+ Next
+
TxtImportesRemisionesNC.Text = TotalRemNCAplicado.FormatoNumero
TxtNCImporte.Text = TotalRemNCAplicado.FormatoNumero
@@ -25779,8 +26396,14 @@ Partial Class Ventas
ListaNCDesc.Clear()
End If
+ If ListaNCBonificacion Is Nothing Then
+ ListaNCBonificacion = New List(Of Modelos.Factura)
+ Else
+ ListaNCBonificacion.Clear()
+ End If
+
Dim TotalRemNCAplicado As Decimal = 0
- For Each GvRow As GridViewRow In GvDescNC.Rows
+ For Each GvRow As GridViewRow In GvDescNCCargos.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
@@ -25798,6 +26421,34 @@ Partial Class Ventas
End If
Next
+ Dim LimiteUsados As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal()
+
+ 'VERIFICA EL LIMITE DE LOS USADOS
+ If TotalRemNCAplicado > LimiteUsados Then
+ Alert($"La suma de las remisiones de nota de crédito de tipo 'Cargo' no debe superar el total de Usados. Total RNC: {TotalRemNCAplicado:N2}. Total Usados: {LimiteUsados:N2}", TipoMensaje.MsgAdvertencia)
+ ListaNCDesc.Clear()
+ Exit Sub
+ End If
+
+ For Each GvRow As GridViewRow In GvDescNCBonificaciones.Rows
+ If GvRow.RowType = DataControlRowType.DataRow Then
+ If GvRow.FCCheckBox("ChkAplicar").Checked Then
+ Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
+ RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
+ RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVentaRNCCargo").ToEntero()
+ TotalRemNCAplicado += RemNC.TotalRemNCAplicado
+
+ If RemNC.TotalRemNCAplicado <= 0 Then
+ Alert($"Debe asignar un importe en la siguiente remisión: {RemNC.SerieFolio}", TipoMensaje.MsgAdvertencia)
+ ListaNCBonificacion.Clear()
+ Exit Sub
+ End If
+
+ ListaNCBonificacion.Add(RemNC)
+ End If
+ End If
+ Next
+
LblDescuentosRNC.Text = TotalRemNCAplicado.FormatoNumero
LblTotalNC.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado).FormatoNumero
@@ -25835,6 +26486,33 @@ Partial Class Ventas
End If
End Sub
+
+ Protected Sub PreparaNCBonificacion(ByRef factura As Modelos.Factura)
+ If ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
+ factura.DtDetalle = Me.TmpDTDescNCBonificacion
+ '**** IMPUESTOS LOCALES
+
+ Dim TotalSubTotal As Decimal = TmpDTDescNCBonificacion.SUM("TotalImporte").ToDecimal
+ Dim TotalDescuentos As Decimal = TmpDTDescNCBonificacion.SUM("Descuento").ToDecimal
+
+ Dim TotalIVA As Decimal = TmpDTDescNCBonificacion.SUM("ImporteIVA").ToDecimal
+ Dim TotalIEPS As Decimal = TmpDTDescNCBonificacion.SUM("ImporteIEPS").ToDecimal
+ Dim TotalRetIVA As Decimal = TmpDTDescNCBonificacion.SUM("ImporteRetIVA").ToDecimal
+ Dim TotalRetISR As Decimal = TmpDTDescNCBonificacion.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 = TotalDescuentos
+ factura.IVA = TotalIVA
+ factura.IEPS = TotalIEPS
+ factura.RetIVA = TotalRetIVA
+ factura.RetISR = TotalRetISR
+ factura.Total = Total
+
+ End If
+ End Sub
#End Region
Protected Sub BtnModalAplicarRemisionesNC_Click(sender As Object, e As EventArgs)
@@ -26377,4 +27055,5 @@ Partial Class Ventas
End Sub
#End Region
+
End Class
\ No newline at end of file