BDH. marcas de usados, quitar restriccion de saldo en bonificaciones, verificar estatus en refacturacion
This commit is contained in:
@@ -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.<br/>Total RNC: {ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado):N2}.<br/>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.<br/>Total RNC: {ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado):N2}.<br/>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.<br/>Total RNC: {ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado):N2}.<br/>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.<br/>Total RNC: {ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado):N2}.<br/>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.<br/>Total RNC: {TotalRemNCAplicado:N2}.<br/>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
|
||||
|
||||
Reference in New Issue
Block a user