Refacturacion con anticipos y NC

This commit is contained in:
2020-02-11 21:03:42 -07:00
parent aeee23fd81
commit 173de6ebe4
3 changed files with 74 additions and 37 deletions

View File

@@ -6515,6 +6515,17 @@
} }
function LimitaSaldoRNCChk(TxtImporte, Saldo) { function LimitaSaldoRNCChk(TxtImporte, Saldo) {
var Importe = 0; 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 != '') { if (TxtImporte.value != '') {
Importe = parseFloat(TxtImporte.value); Importe = parseFloat(TxtImporte.value);
} }
@@ -6525,6 +6536,7 @@
TxtImporte.value = FormatoNumero(Importe, 2);; TxtImporte.value = FormatoNumero(Importe, 2);;
} }
} }
}
function CalculaTotalChk(Total, SubTotal, TxtTotalGv, TxtImporte, Saldo, Porcentaje, Chk) { function CalculaTotalChk(Total, SubTotal, TxtTotalGv, TxtImporte, Saldo, Porcentaje, Chk) {
var Importe = 0, ImporteSinPorcentaje = 0; var Importe = 0, ImporteSinPorcentaje = 0;

View File

@@ -6771,19 +6771,25 @@ Partial Class Ventas
TieneAnticipo = True TieneAnticipo = True
CveAnticipoPadre = row2.DataKey("CveVenta").ToEntero CveAnticipoPadre = row2.DataKey("CveVenta").ToEntero
ObjFactura.CveVentaRelacion = CveAnticipoPadre 'relaciona al anticipo
CveAnticipo = CveAnticipoPadre CveAnticipo = CveAnticipoPadre
'CUANDO ES REFACTURACION DEBE RELACIONAR CON LA FACTURA REFACTURADA
If NuevaFactura <> 1 Then
ObjFactura.CveVentaRelacion = CveAnticipoPadre 'relaciona al anticipo
ObjFactura.ImporteRelacion = row2.FCTextBox($"TxtAnticipo{actualindex}").Text.ToDecimal ObjFactura.ImporteRelacion = row2.FCTextBox($"TxtAnticipo{actualindex}").Text.ToDecimal
FolioFiscalRelacionado = row2.DataKey("FolioFiscal") FolioFiscalRelacionado = row2.DataKey("FolioFiscal")
ObjFactura.CveVentaPadre = row2.DataKey("CveVenta").ToEntero ObjFactura.CveVentaPadre = row2.DataKey("CveVenta").ToEntero
Else
ObjFactura.CveVentaRelacion = CveDevolucion
End If
End If End If
actualindex = actualindex + 1 actualindex = actualindex + 1
Next Next
End If End If
Dim EsNCAmortizacion As Boolean = False Dim EsNCAmortizacion As Boolean = False
If DdlTipoComprobante.SelectedValue = "Egs" AndAlso ChkAplicaNCAnticipo.Checked Then If ObjFactura.TipoDocto = "Egs" AndAlso ChkAplicaNCAnticipo.Checked Then
EsNCAmortizacion = True EsNCAmortizacion = True
End If End If
@@ -6847,7 +6853,14 @@ Partial Class Ventas
' cambiar la condicion para saber si hay seleccionado ' cambiar la condicion para saber si hay seleccionado
If (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse NCDescuento Then If (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse NCDescuento Then
Try Try
CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveAnticipoPadre, NCDescuento:=NCDescuento) Dim CveVentaRelacionada As Integer = -1
If NuevaFactura = 1 Then
CveVentaRelacionada = ObjFactura.CveVenta
Else
CveVentaRelacionada = CveAnticipoPadre
End If
CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento)
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing, If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing,
Nothing, NCDescuento:=NCDescuento) Then Nothing, NCDescuento:=NCDescuento) Then
Obj2.Add(ObjFacturaDevolucion) Obj2.Add(ObjFacturaDevolucion)
@@ -7524,6 +7537,8 @@ Partial Class Ventas
End If End If
End If End If
'SI NO ES REFACTURACION
If NuevaFactura <> 1 Then
If DtVentasNC Is Nothing Then InicializaDTVentasNC() If DtVentasNC Is Nothing Then InicializaDTVentasNC()
Dim Drt = DtVentasNC.NewRow Dim Drt = DtVentasNC.NewRow
Drt("CveVenta") = ObjFactura.CveVenta Drt("CveVenta") = ObjFactura.CveVenta
@@ -7531,6 +7546,7 @@ Partial Class Ventas
Drt("FolioFiscal") = ObjFactura.FolioFiscal Drt("FolioFiscal") = ObjFactura.FolioFiscal
DtVentasNC.Rows.Add(Drt) DtVentasNC.Rows.Add(Drt)
DtVentasNC.AcceptChanges() DtVentasNC.AcceptChanges()
End If
End Sub End Sub
@@ -7648,7 +7664,14 @@ Partial Class Ventas
factura.RetIVA = TotalRetIVA factura.RetIVA = TotalRetIVA
factura.RetISR = TotalRetISR factura.RetISR = TotalRetISR
factura.Total = Total factura.Total = Total
'SI ES REFACTURACION DEBE RELACIONAR CON LA VENTA NUEVA
If NuevaFactura = 1 Then
factura.CveVentaPadre = ObjFactura.CveVenta
Else
factura.CveVentaPadre = CveVentaP factura.CveVentaPadre = CveVentaP
End If
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
DtVentasNC.Rows(0)("Importe") = Total DtVentasNC.Rows(0)("Importe") = Total

View File

@@ -13,6 +13,8 @@
<Service ID="{C0C07587-41A7-46C8-8FBD-3F9C8EBE2DDC}"/> <Service ID="{C0C07587-41A7-46C8-8FBD-3F9C8EBE2DDC}"/>
</StartupServices> </StartupServices>
</VisualWebDeveloper> </VisualWebDeveloper>