diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb
index bc165de82..6242b9d0e 100644
--- a/App_Code/ClsProductosServicios.vb
+++ b/App_Code/ClsProductosServicios.vb
@@ -1450,6 +1450,22 @@ Public Class ClsProductosServicios
Return Retorno
End Function
+ Public Function GetMarcasUsados(CveEmpresa As Integer) As Boolean
+ Dim Retorno As Boolean = False
+ DataAdapter("PA_Gral_MarcasUsadosGet")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al obtener el Catálogo de Marcas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+
+ Return Retorno
+ End Function
+
Public Function AddMarcas(Marca As String, Estatus As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx
index 9a9fffbe4..298cbe993 100644
--- a/Ventas/Ventas.aspx
+++ b/Ventas/Ventas.aspx
@@ -3635,15 +3635,17 @@
@@ -7577,6 +7584,100 @@
}
}
+ function CalculaSaldoRNCBonChkDesc(TxtImporte, Saldo, Chk) {
+ if (Chk.checked) {
+ TxtImporte.value = FormatoNumero(Saldo, 2);
+ } else {
+ TxtImporte.value = "";
+ }
+ //if (Chk.checked) {
+ // let SaldoMaximoUtilizable = ToDouble(HdnSMUBonDesc.value)
+ // let ImportesAsignados = 0;
+
+ // $('.ImportesRNCBon').each(function () {
+ // if ($(this).context.id != TxtImporte.id) {
+ // ImportesAsignados += ToDouble($(this).val());
+ // }
+ // });
+ // let Importe = SaldoMaximoUtilizable - ImportesAsignados;
+
+ // if (Importe > 0) {
+ // if (Saldo > Importe) {
+ // TxtImporte.value = FormatoNumero(Importe, 2);
+ // } else {
+ // TxtImporte.value = FormatoNumero(Saldo, 2);
+ // }
+ // } else {
+ // if (SaldoMaximoUtilizable > 0) {
+ // TxtImporte.value = "";
+ // Chk.checked = false;
+ // } else {
+ // TxtImporte.value = FormatoNumero(Saldo, 2);
+ // }
+
+ // }
+
+ //} else {
+ // TxtImporte.value = "";
+ //}
+ }
+ function LimitaSaldoRNCBonChkDesc(TxtImporte, Saldo) {
+ //var Importe = 0;
+
+ //if (TxtImporte.value.includes('.')) {
+ // return;
+ //}
+ //if (TxtImporte.value.includes(',')) {
+ // return;
+ //}
+
+ //var regex = new RegExp("^[-+]?[0-9]+\.[0-9]+$");
+
+ //if (regex.test(TxtImporte.value)) {
+ // if (TxtImporte.value != '') {
+ // Importe = parseFloat(TxtImporte.value);
+ // }
+
+ // if (Importe > Saldo) {
+ // TxtImporte.value = FormatoNumero(Saldo, 2);
+ // } else {
+ // TxtImporte.value = FormatoNumero(Importe, 2);;
+ // }
+ //}
+
+ var Importe = 0;
+
+ if (TxtImporte.value.includes('.')) {
+ return;
+ }
+ if (TxtImporte.value.includes(',')) {
+ return;
+ }
+
+ var regex = new RegExp("^[-+]?[0-9]+\.[0-9]+$");
+
+ if (regex.test(TxtImporte.value)) {
+ if (TxtImporte.value != '') {
+ Importe = parseFloat(TxtImporte.value);
+ }
+
+ let SaldoMaximoUtilizable = parseFloat(Saldo)
+ //let ImportesAsignados = 0;
+ //$('.ImportesRNCBon').each(function () {
+ // if ($(this).context.id != TxtImporte.id) {
+ // ImportesAsignados += ToDouble($(this).val());
+ // }
+ //});
+ let ImporteDiferencia = SaldoMaximoUtilizable; //- ImportesAsignados;
+
+ if (Importe > ImporteDiferencia) {
+ TxtImporte.value = FormatoNumero(ImporteDiferencia, 2);
+ } else {
+ TxtImporte.value = FormatoNumero(Importe, 2);;
+ }
+ }
+ }
+
function CalculaSaldoRNCBonChk(TxtImporte, Saldo, Chk) {
//if (Chk.checked) {
// TxtImporte.value = FormatoNumero(Saldo, 2);
@@ -7584,7 +7685,7 @@
// TxtImporte.value = "";
//}
if (Chk.checked) {
- let SaldoMaximoUtilizable = ToDouble(HdnSMUBonDesc.value)
+ let SaldoMaximoUtilizable = ToDouble(HdnSMUBon.value)
let ImportesAsignados = 0;
$('.ImportesRNCBon').each(function () {
@@ -7654,7 +7755,7 @@
Importe = parseFloat(TxtImporte.value);
}
- let SaldoMaximoUtilizable = parseFloat(HdnSMUBonDesc.value)
+ let SaldoMaximoUtilizable = parseFloat(HdnSMUBon.value)
let ImportesAsignados = 0;
$('.ImportesRNCBon').each(function () {
if ($(this).context.id != TxtImporte.id) {
@@ -8806,31 +8907,31 @@
function CerrarModalRemNC() {
if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1') {
- AplicarValidarRNC(true);
- CompararNC();
+ AplicarValidarRNC(true);
+ CompararNC();
+ }
+ $('#ModalAplicarRemisionesNC').modal('hide');
}
- $('#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;
- }
- });
- }
- };
+ 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;
+ }
+ });
+ }
+ };
- function showDivAgregarSucursal() {
+ function showDivAgregarSucursal() {
- $('#<%= TxtNombreSucursal.ClientID %>').val('');
+ $('#<%= TxtNombreSucursal.ClientID %>').val('');
$('#<%= TxtDireccionSucursal.ClientID %>').val('');
$('#<%= TxtNumExtSucursal.ClientID %>').val('');
$('#<%= TxtNumIntSucursal.ClientID %>').val('');
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index c62583b0d..b681a9e4f 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -5464,6 +5464,12 @@ Partial Class Ventas
TrVistaPrevia.Visible = EstatusCliente
End If
+ If ViewState("CveDevolucion") IsNot Nothing AndAlso ViewState("NuevaFactura") IsNot Nothing Then
+ If (CveDevolucion > 0 AndAlso NuevaFactura = 1) Then
+ BtnEmitirImprimir.Visible = EstatusCliente
+ TrVistaPrevia.Visible = EstatusCliente
+ End If
+ End If
'CUANDO SEA COTIZACION Y SEA COMPUPROVEEDORES (EMPRESA 72) NO DEBE ENVIAR CORREO AL CLIENTE
If UsuarioActual.CveEmpresa = 72 AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then
@@ -12840,6 +12846,40 @@ Partial Class Ventas
End If
End If
+ If ObjFactura.RetIVA <> 0 AndAlso ObjFactura.CveTipoRetencion = 4 Then
+ Dim PorcentajeImpuestoPago As Decimal = TmpDT.MAX("PorcentajeRetIVA").ToDecimal
+ Dim IdCtaContableRetIVA = 0
+ 'RETIVA X TRASLADAR
+ 'OBTENER CUENTAS
+
+ If ObjConta.GetRetCuenta(313, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then
+ 'Conta ContPAQ
+ IdCtaContableRetIVA = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
+ Else
+ IdCtaContableRetIVA = 0
+ End If
+
+ Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 313, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.RetIVA) / ObjFactura.Total, Referencia, 313, Concepto, Fecha, IdCtaContableRetIVA, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.RetIVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
+
+ 'RETIVA PAGADO
+ If ObjConta.GetRetCuenta(314, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then
+ 'Conta ContPAQ
+ IdCtaContableRetIVA = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
+ Else
+ IdCtaContableRetIVA = 0
+ End If
+
+ Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 314, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.RetIVA) / ObjFactura.Total, Referencia, 314, Concepto, Fecha, IdCtaContableRetIVA, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.RetIVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
+ End If
+
Else
ErrorPrepoliza = True
@@ -16924,7 +16964,7 @@ Partial Class Ventas
End If
- TotalCalculableImpuestos = ((Cantidad * (PU)) - Descuento).RoundSQL
+ TotalCalculableImpuestos = ((Cantidad * (PU)) - Descuento)
TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
Row("PU") = PU
@@ -16994,7 +17034,7 @@ Partial Class Ventas
Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales)
Row("TipoDescuento") = HdnTipoDescuento.Value
Row("CvePromocionDetalle") = CvePromocionDetalle
- Row("Total") = (Cantidad * PU).RoundSQL(NumeroDecimales)
+ Row("Total") = (Cantidad * PU)
Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales)
'Row("AsientoContableVentas") = DrPS("AsientoContableVentas")
@@ -17121,7 +17161,7 @@ Partial Class Ventas
End If
PU = PU.RoundSQL(6)
DrPoliza("PU") = PU
- TotalCalculableImpuestos = (DrPoliza("Cantidad").ToString().ToDecimal * (PU)).RoundSQL
+ TotalCalculableImpuestos = (DrPoliza("Cantidad").ToString().ToDecimal * (PU))
If DrPSAdicional("IVA").ToString().Contiene("-1", "") Then
DrPoliza("PorcentajeIVA") = PorcentajeIVA
@@ -17139,7 +17179,7 @@ Partial Class Ventas
DrPoliza("IEPS") = DrPoliza("ImporteIEPS")
DrPoliza("Descuento") = 0 ' Descuento
DrPoliza("TipoDescuento") = HdnTipoDescuento.Value
- DrPoliza("Total") = (DrPoliza("Cantidad").ToString().ToDecimal * PU).RoundSQL(NumeroDecimales)
+ DrPoliza("Total") = (DrPoliza("Cantidad").ToString().ToDecimal * PU)
DrPoliza("TotalImporte") = (DrPoliza("Cantidad").ToString().ToDecimal * PU).RoundSQL(NumeroDecimales)
DrPoliza("SATClaveProdServ") = DrPSAdicional("SATClavePS")
DrPoliza("SATClaveUM") = DrPSAdicional("SATClaveUnidadMedida")
@@ -25170,7 +25210,10 @@ Partial Class Ventas
GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas
GvRemisionesNCBon.DataBind()
- LtlSMUBon.Text = String.Format("{0:N2}", Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal())
+ Dim SMUBon As Decimal = Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal()
+
+ LtlSMUBon.Text = String.Format("{0:N2}", SMUBon)
+ HdnSMUBon.Value = SMUBon.ToString()
UpModalRemisionesNC.Update()
End Sub
@@ -25302,26 +25345,26 @@ Partial Class Ventas
GvDescNCBonificaciones.DataBind()
'SI ES CREDITO
- If RBLPago.SelectedValue = "1" Then
- Dim ImporteUsados As Decimal = Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal()
- HdnSMUBonDesc.Value = ImporteUsados.ToString()
- LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", ImporteUsados)
- 'SI ES CONTADO
- ElseIf RBLPago.SelectedValue = "2" Then
- Dim ImporteUsados As Decimal = 0
+ 'If RBLPago.SelectedValue = "1" Then
+ ' Dim ImporteUsados As Decimal = Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal()
+ ' HdnSMUBonDesc.Value = ImporteUsados.ToString()
+ ' LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", ImporteUsados)
+ ' 'SI ES CONTADO
+ 'ElseIf RBLPago.SelectedValue = "2" Then
+ ' Dim ImporteUsados As Decimal = 0
- For Each Row As DataRow In Me.TmpDT.FiltraParametros("EsCargo = True").Rows
- Dim PUBonificacion As Decimal = GlobalDTAcumTamaños().FiltroPrimeroValor("Bonificacion", $"CvePSCargo={Row("CvePS")}").ToDecimal()
+ ' For Each Row As DataRow In Me.TmpDT.FiltraParametros("EsCargo = True").Rows
+ ' Dim PUBonificacion As Decimal = GlobalDTAcumTamaños().FiltroPrimeroValor("Bonificacion", $"CvePSCargo={Row("CvePS")}").ToDecimal()
- Dim TotalBonificacion As Decimal = (Row("Cantidad").ToString().ToDecimal() * PUBonificacion)
- Dim IVABonificacion As Decimal = (TotalBonificacion * Row("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2)
+ ' Dim TotalBonificacion As Decimal = (Row("Cantidad").ToString().ToDecimal() * PUBonificacion)
+ ' Dim IVABonificacion As Decimal = (TotalBonificacion * Row("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2)
- ImporteUsados += TotalBonificacion + IVABonificacion
- Next
- HdnSMUBonDesc.Value = ImporteUsados.ToString()
- LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", ImporteUsados)
+ ' ImporteUsados += TotalBonificacion + IVABonificacion
+ ' Next
+ ' HdnSMUBonDesc.Value = ImporteUsados.ToString()
+ ' LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", ImporteUsados)
- End If
+ 'End If
UpDescNC.Update()
End Sub
@@ -25351,8 +25394,8 @@ Partial Class Ventas
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", $"CalculaSaldoRNCBonChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
- e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCBonChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
+ e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCBonChkDesc({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
+ e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCBonChkDesc({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
End If
End Sub
@@ -29909,15 +29952,15 @@ Partial Class Ventas
End If
Next
- Dim LimiteBonficaciones As Decimal = LblSaldoMaximoBonificacion.Text.Trim().ToDecimal()
+ 'Dim LimiteBonficaciones As Decimal = LblSaldoMaximoBonificacion.Text.Trim().ToDecimal()
- 'VERIFICA EL LIMITE DE LOS USADOS
- If ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado) > LimiteBonficaciones Then
- Alert($"La suma de las remisiones de nota de crédito de tipo 'Bonificación' no debe superar el limite.
Total RNC: {ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado):N2}.
Total Usados: {LimiteUsados:N2}", TipoMensaje.MsgAdvertencia)
- ListaNCDesc.Clear()
- ListaNCBonificacion.Clear()
- Exit Sub
- End If
+ ''VERIFICA EL LIMITE DE LOS USADOS
+ 'If ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado) > LimiteBonficaciones Then
+ ' Alert($"La suma de las remisiones de nota de crédito de tipo 'Bonificación' no debe superar el limite.
Total RNC: {ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado):N2}.
Total Usados: {LimiteUsados:N2}", TipoMensaje.MsgAdvertencia)
+ ' ListaNCDesc.Clear()
+ ' ListaNCBonificacion.Clear()
+ ' Exit Sub
+ 'End If
ElseIf RblRNCTipoDesc.SelectedValue.Contiene("2") Then
@@ -29940,15 +29983,15 @@ Partial Class Ventas
End If
Next
- Dim LimiteBonficaciones As Decimal = LblSaldoMaximoBonificacion.Text.Trim().ToDecimal()
+ 'Dim LimiteBonficaciones As Decimal = LblSaldoMaximoBonificacion.Text.Trim().ToDecimal()
- 'VERIFICA EL LIMITE DE LOS USADOS
- If ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado) > LimiteBonficaciones Then
- Alert($"La suma de las remisiones de nota de crédito de tipo 'Bonificación' no debe superar el limite.
Total RNC: {ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado):N2}.
Total Usados: {LimiteUsados:N2}", TipoMensaje.MsgAdvertencia)
- ListaNCDesc.Clear()
- ListaNCBonificacion.Clear()
- Exit Sub
- End If
+ ''VERIFICA EL LIMITE DE LOS USADOS
+ 'If ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado) > LimiteBonficaciones Then
+ ' Alert($"La suma de las remisiones de nota de crédito de tipo 'Bonificación' no debe superar el limite.
Total RNC: {ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado):N2}.
Total Usados: {LimiteUsados:N2}", TipoMensaje.MsgAdvertencia)
+ ' ListaNCDesc.Clear()
+ ' ListaNCBonificacion.Clear()
+ ' Exit Sub
+ 'End If
'SI SON SOLO BONIFICACIONES GENERA LA NC PRINCIPAL EN BASE A ESAS
If RblRNCTipoDesc.SelectedValue.ToString() = "2" AndAlso ListaNCDesc.Count = 0 Then
@@ -29965,6 +30008,13 @@ Partial Class Ventas
TotalProntoPago = TmpDT.SUM("ImporteProntoPago").ToDecimal
End If
+ If TotalRemNCAplicado > TxtTotal.Text.ToDecimal() Then
+ Alert($"La suma de las remisiones de nota de crédito no debe superar el total de la factura.
Total RNC: {TotalRemNCAplicado:N2}.
Total Factura: {TxtTotal.Text.ToDecimal():N2}", TipoMensaje.MsgAdvertencia)
+ ListaNCDesc.Clear()
+ ListaNCBonificacion.Clear()
+ Exit Sub
+ End If
+
HdnTotalRNC.Value = TotalRemNCAplicado.ToString()
LblDescuentosRNC.Text = TotalRemNCAplicado.FormatoNumero
LblTotalAPagar.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado - TotalProntoPago).FormatoNumero