Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -437,10 +437,17 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
{
|
||||
//ASIGNAMOS ESTATUS EMITIDA
|
||||
CveEstatus = 3;
|
||||
string Estatus = "Emitida";
|
||||
//SI ES REFACTURACION, DEBE QUEDAR COMO CANCELACION PENDIENTE PARA ENVIAR LA CANCELACION DE NUEVO
|
||||
if (EsRefacturacion)
|
||||
{
|
||||
CveEstatus = 23;
|
||||
Estatus = "Cancelación pendiente";
|
||||
}
|
||||
var ObjVentas = new ClsVentas();
|
||||
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
sb.Append("El estatus de la factura fue cambiado a 'Emitida'.");
|
||||
sb.Append($"El estatus de la factura fue cambiado a '{Estatus}'.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -452,10 +459,17 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
{
|
||||
//ASIGNAMOS ESTATUS EMITIDA
|
||||
CveEstatus = 3;
|
||||
string Estatus = "Emitida";
|
||||
//SI ES REFACTURACION, DEBE QUEDAR COMO CANCELACION PENDIENTE PARA ENVIAR LA CANCELACION DE NUEVO
|
||||
if (EsRefacturacion)
|
||||
{
|
||||
CveEstatus = 23;
|
||||
Estatus = "Cancelación pendiente";
|
||||
}
|
||||
var ObjVentas = new ClsVentas();
|
||||
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
sb.Append("El estatus de la factura fue cambiado a 'Emitida'.");
|
||||
sb.Append($"El estatus de la factura fue cambiado a '{Estatus}'.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -11239,8 +11239,15 @@ Partial Class Ventas
|
||||
|
||||
Dim tTipoAmortizacion As Integer = If(DdlTipoAmortizacionAnticipo.SelectedValue = "2", 1, 2)
|
||||
|
||||
Dim ForzarAjuste As Boolean = False
|
||||
|
||||
DtImpuestos = CargaDtImpuestosNC(gvrt.DataKey("CveVenta").ToString().ToEntero(), gvrt.FCTextBox(String.Format("TxtAnticipo{0}", gvrt.RowIndex)).Text.ToDecimal, AplicaImpuestosLocales:=True, NCDescuento:=False, NivelTotal:=tTipoAmortizacion)
|
||||
'EL IMPORTE DE NC NO PUEDE SER MAYOR AL DE LA FACTURA
|
||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso (tTipoAmortizacion = 1) Then
|
||||
ForzarAjuste = True
|
||||
End If
|
||||
|
||||
'SI LA APLICACION DE ANTICIPO SE HACE A NIVEL TOTAL, FORZAR EL AJUSTE POR REDONDEO
|
||||
DtImpuestos = CargaDtImpuestosNC(gvrt.DataKey("CveVenta").ToString().ToEntero(), gvrt.FCTextBox(String.Format("TxtAnticipo{0}", gvrt.RowIndex)).Text.ToDecimal, AplicaImpuestosLocales:=True, NCDescuento:=False, NivelTotal:=tTipoAmortizacion, ForzarAjuste:=ForzarAjuste)
|
||||
|
||||
Dim query = From ddr In DtImpuestos
|
||||
Group By PorcentajeIVA = ddr("PorcentajeIVA").ToString().ToDecimal,
|
||||
@@ -11251,9 +11258,9 @@ Partial Class Ventas
|
||||
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,
|
||||
ImporteRetIVA = x.Sum(Function(s) s("ImporteRetIVA").ToString().ToDecimal()).RoundSQL(2),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetIVA,
|
||||
ImporteRetISR = x.Sum(Function(s) s("ImporteRetISR").ToString().ToDecimal()).RoundSQL(2),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetISR,
|
||||
ImporteIEPS = x.Sum(Function(s) s("ImporteIEPS").ToString().ToDecimal()).RoundSQL(2), 'Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeIEPS,
|
||||
PorcentajeIVA = PorcentajeIVA,
|
||||
PorcentajeRetIVA = PorcentajeRetIVA,
|
||||
PorcentajeRetISR = PorcentajeRetISR,
|
||||
@@ -11303,13 +11310,13 @@ Partial Class Ventas
|
||||
'**** IMPUESTOS LOCALES
|
||||
|
||||
factura.DtDetalle = tmpcon
|
||||
Dim TotalSubTotal As Decimal = tmpcon.SUM("TotalImporte").ToDecimal
|
||||
Dim TotalDescuentos As Decimal = tmpcon.SUM("Descuento").ToDecimal
|
||||
Dim TotalSubTotal As Decimal = tmpcon.SUMD("TotalImporte").RoundSQL(2)
|
||||
Dim TotalDescuentos As Decimal = tmpcon.SUMD("Descuento")
|
||||
|
||||
Dim TotalIVA As Decimal = tmpcon.SUM("ImporteIVA").ToDecimal
|
||||
Dim TotalIEPS As Decimal = tmpcon.SUM("ImporteIEPS").ToDecimal
|
||||
Dim TotalRetIVA As Decimal = tmpcon.SUM("ImporteRetIVA").ToDecimal
|
||||
Dim TotalRetISR As Decimal = tmpcon.SUM("ImporteRetISR").ToDecimal
|
||||
Dim TotalIVA As Decimal = tmpcon.SUMD("ImporteIVA")
|
||||
Dim TotalIEPS As Decimal = tmpcon.SUMD("ImporteIEPS")
|
||||
Dim TotalRetIVA As Decimal = tmpcon.SUMD("ImporteRetIVA")
|
||||
Dim TotalRetISR As Decimal = tmpcon.SUMD("ImporteRetISR")
|
||||
Dim Total As Decimal = 0
|
||||
Dim TotalImpuestosLocales As Decimal = factura.TotalImpuestoLocal.ToString().ToDecimal
|
||||
Total = (TotalSubTotal - TotalDescuentos + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales)
|
||||
@@ -11343,6 +11350,9 @@ Partial Class Ventas
|
||||
|
||||
Else
|
||||
ErrorList.Add("No se encontró un producto para generar la nota de crédito")
|
||||
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
|
||||
DtVentasNC.Rows.Clear()
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -14778,49 +14788,12 @@ Partial Class Ventas
|
||||
CveVentaAmortizacionAplicar = ObjFactura.CveVenta
|
||||
End If
|
||||
|
||||
''Cuando se está amortizando con un anticipo y es la modalidad de NC
|
||||
'If ObjFactura.TipoDocto.Contiene("Ing") AndAlso CveAnticipo > 0 AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
|
||||
' ConceptoContableAplicar = 11
|
||||
' CveVentaAplicar = CveAnticipo
|
||||
' CveVentaAmortizacionAplicar = ObjFactura.CveVenta
|
||||
'End If
|
||||
|
||||
' If UsuarioActual.CveEmpresa = 119 Then
|
||||
|
||||
'código fijo en base el porcentaje iva, que se afecten las clasificaciones
|
||||
'For i = 0 To TmpDTDetalle.Rows.Count - 1
|
||||
|
||||
' 'se excluyen las clasificaciones anteriores para que se asignen las de ingreso
|
||||
' If Not TmpDTDetalle(i)("CveClasificacion").ToString().Contiene("19958", "19933", "18097", "24479") Then
|
||||
|
||||
' 'If TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal > 0 Then
|
||||
' ' If TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal = 0.08 Then
|
||||
' ' TmpDTDetalle(i)("CveClasificacion") = 20242 'clasif: ventas tasa 8%
|
||||
' ' Else
|
||||
' ' TmpDTDetalle(i)("CveClasificacion") = 19929 'clasif: ventas tasa 16%
|
||||
' ' End If
|
||||
|
||||
' ' Else
|
||||
' ' TmpDTDetalle(i)("CveClasificacion") = 19930 'clasif: ventas tasa 0%
|
||||
' ' End If
|
||||
|
||||
' 'reclasifica la clasificación del producto, por la del ingreso correspondiente a su iva
|
||||
' If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal).Rows.Count > 0 Then
|
||||
' TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal).Rows(0)("CveClasificacion").ToString()
|
||||
' End If
|
||||
|
||||
' End If
|
||||
|
||||
'Next
|
||||
|
||||
' End If
|
||||
|
||||
DT = TmpDTDetalle.FiltraParametros($"CvePS <> {CvePSAmortizacion}", "", {"CveClasificacion", "CveSubProyecto", "PorcentajeIVA"})
|
||||
|
||||
If DT.Rows.Count > 0 Then
|
||||
'Se agrega movimiento separado por la cuenta de ventas (ER)
|
||||
For Each Row2 As DataRow In DT.Rows
|
||||
importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador
|
||||
importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1} AND PorcentajeIVA = {2}", Row2("CveClasificacion"), Row2("CveSubProyecto"), Row2("PorcentajeIVA"))).ToString().ToDecimal()) * ValorMultiplicador
|
||||
importeMX = importeMovimiento * tipoCambio * Multiplicador
|
||||
FechaMovimiento = ObjFactura.FechaPago
|
||||
Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString().ToEntero() > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}"), "")} - {If(Row2("CveSubProyecto").ToString().ToEntero() > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString()}"), "Sin SubProyecto Asignado")}"
|
||||
@@ -14834,8 +14807,6 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
|
||||
'CveCuenta = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresosSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero()
|
||||
|
||||
If importeMovimiento <> 0 Then
|
||||
|
||||
If IdCtaContable <= 0 Then
|
||||
@@ -14861,37 +14832,12 @@ Partial Class Ventas
|
||||
Dim CveVentaAplicar = ObjFactura.CveVenta
|
||||
Dim CveVentaAmortizacionAplicar = -1
|
||||
|
||||
'If UsuarioActual.CveEmpresa = 119 Then
|
||||
|
||||
' 'código fijo en base el porcentaje iva, que se afecten las clasificaciones
|
||||
' For i = 0 To TmpDTDetalle.Rows.Count - 1
|
||||
|
||||
' 'se excluyen las clasificaciones anteriores para que se asignen las de ingreso
|
||||
' If Not TmpDTDetalle(i)("CveClasificacion").ToString().Contiene("19958", "19933", "18097") Then
|
||||
|
||||
' If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDouble).Rows.Count > 0 Then
|
||||
' TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDouble).Rows(0)("CveClasificacion").ToString()
|
||||
' End If
|
||||
|
||||
' End If
|
||||
|
||||
' Next
|
||||
|
||||
'End If
|
||||
|
||||
DT = TmpDTDetalle.FiltraParametros($"CvePS <> {CvePSAmortizacion}", "", {"CveClasificacion", "CveSubProyecto", "PorcentajeIVA"})
|
||||
|
||||
If DT.Rows.Count > 0 Then
|
||||
'Se agrega movimiento separado por la cuenta de ventas (ER)
|
||||
For Each Row2 As DataRow In DT.Rows
|
||||
importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador
|
||||
|
||||
'If ObjFactura.TipoDocto = "Egs" Then
|
||||
' importeMovimiento += (TmpDTDetalle.SUM("ImporteIVA", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador
|
||||
' importeMovimiento += (TmpDTDetalle.SUM("ImporteIEPS", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador
|
||||
' importeMovimiento -= (TmpDTDetalle.SUM("ImporteRetIVA", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador
|
||||
' importeMovimiento -= (TmpDTDetalle.SUM("ImporteRetISR", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador
|
||||
'End If
|
||||
importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1} AND PorcentajeIVA = {2}", Row2("CveClasificacion"), Row2("CveSubProyecto"), Row2("PorcentajeIVA"))).ToString().ToDecimal) * ValorMultiplicador
|
||||
|
||||
importeMX = importeMovimiento * tipoCambio * Multiplicador
|
||||
FechaMovimiento = ObjFactura.FechaPago
|
||||
@@ -14907,10 +14853,6 @@ Partial Class Ventas
|
||||
IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero()
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa = 119 Then
|
||||
If Row2("CveClasificacion").ToString() = "19930" Then IdCtaContable = 1141
|
||||
If Row2("CveClasificacion").ToString() = "19929" Then IdCtaContable = 1142
|
||||
End If
|
||||
|
||||
If importeMovimiento <> 0 Then
|
||||
|
||||
@@ -15324,8 +15266,12 @@ Partial Class Ventas
|
||||
|
||||
If (importeMovimiento <> 0 OrElse (importeMovimiento = 0 AndAlso ObjFactura.Total = 0 AndAlso ConceptoContable = 1)) And Not ErrorPrepoliza Then
|
||||
|
||||
|
||||
|
||||
If IdCtaContable <= 0 Then
|
||||
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString())
|
||||
If Not (UsuarioActual.CveEmpresa.Contiene(7, 11, 12, 122, 145) And ConceptoContable.Contiene(8, 13, 14, 15, 19, 22, 61, 185, 186, 327, 328)) Then
|
||||
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString())
|
||||
End If
|
||||
idCuentaContabilizacion = 0
|
||||
End If
|
||||
|
||||
@@ -23659,8 +23605,9 @@ Partial Class Ventas
|
||||
End If
|
||||
End Using
|
||||
|
||||
'SI TIENE UN ANTICIPO RELACIONADO O VIENE DE UNA REFACTURACION
|
||||
If RowVentas IsNot Nothing Then
|
||||
If RowVentas("TipoDocto").ToString().Contiene("Ing") AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then
|
||||
If RowVentas("TipoDocto").ToString().Contiene("Ing", "Ant") AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then
|
||||
CargaInventario(Me.CveVenta)
|
||||
End If
|
||||
End If
|
||||
@@ -29997,7 +29944,7 @@ Partial Class Ventas
|
||||
|
||||
Next
|
||||
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
|
||||
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, Optional ForzarAjuste As Boolean = False) As DataTable
|
||||
Dim Total As Decimal = 0, SubTotal As Decimal = 0, Saldo As Decimal = 0
|
||||
|
||||
Dim TmpDT As DataTable = Nothing
|
||||
@@ -30115,6 +30062,24 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
'SI LA DIFERENCIA ES MENOR O IGUAL A 1 CENTAVO, AJUSTAR EL TOTAL
|
||||
If ForzarAjuste Then
|
||||
'ASUSTO LA DIFERENCIA EN LOS IMPUESTOS
|
||||
Dim difTmp As Decimal = Importe - importeNC
|
||||
If Math.Abs(difTmp) > 0.00D AndAlso Math.Abs(difTmp) <= 0.01D Then
|
||||
'SI TIENE IVA, AJUSTAR AQUI
|
||||
If DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteIVA").ToString().ToDecimal() > 0 Then
|
||||
Dim ImporteIVAAjustado As Decimal = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteIVA").ToString().ToDecimal + difTmp
|
||||
DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteIVA") = ImporteIVAAjustado
|
||||
Else
|
||||
Dim ImporteAjustado As Decimal = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal").ToString().ToDecimal + difTmp
|
||||
DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal") = ImporteAjustado
|
||||
DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImportePU") = ImporteAjustado
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not NCDescuento Then
|
||||
Me.TmpDT = TmpDT
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user