--FIX nc en cobro por caja
This commit is contained in:
@@ -1282,9 +1282,9 @@
|
||||
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
|
||||
|
||||
//si es con.nc,es.el.total
|
||||
let Total = ToDouble($get("C_LtlSaldo").value);
|
||||
let Total = ToDouble($get("C_LtlSaldo").value.replace(",",""));
|
||||
|
||||
let SaldoCompra = parseFloat(parseFloat($get("C_LtlSaldo").value).toFixed(2));
|
||||
let SaldoCompra = parseFloat(parseFloat($get("C_LtlSaldo").value.replace(",", "")).toFixed(2));
|
||||
|
||||
if (t.checked) {
|
||||
|
||||
@@ -1319,13 +1319,13 @@
|
||||
|
||||
function FnCambiaAnt(chk, txt, saldo) {
|
||||
|
||||
let Total = ToDouble($get("C_LtlSaldo").value);// ToDouble($get('TxtSubTotal').value);
|
||||
let Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));// ToDouble($get('TxtSubTotal').value);
|
||||
|
||||
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
|
||||
let importeTxt = parseFloat(txt.value.replace(/,/g, ''));
|
||||
|
||||
if (TipoAnticipo == '4') {
|
||||
Total = ToDouble($get("C_LtlSaldo").value);
|
||||
Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));
|
||||
}
|
||||
|
||||
if (isNaN(importeTxt)) {
|
||||
|
||||
@@ -758,123 +758,122 @@ Partial Class Ventas_PVCobranza
|
||||
|
||||
Private Function GenerarFactura(ByRef VentaRemision As Venta, ByRef ObjVentas As ClsVentas, ByRef ObjClientes As ClsClientes) As Modelos.Factura.MMensajeFactura
|
||||
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
|
||||
|
||||
Dim DtRemisiones As New DataTable
|
||||
DtRemisiones.Columns.Add(New DataColumn("CveVenta", GetType(Integer)))
|
||||
DtRemisiones.Columns.Add(New DataColumn("SerieFolio", GetType(String)))
|
||||
|
||||
DtRemisiones.Rows.Add({VentaRemision.CveVenta, VentaRemision.SerieFolio})
|
||||
|
||||
Dim RemisionesLista As New List(Of Integer)
|
||||
RemisionesLista.Add(VentaRemision.CveVenta)
|
||||
|
||||
Dim DtRemisionesPS As New DataTable()
|
||||
Dim DtPagosFacturaGlobal As New DataTable()
|
||||
|
||||
If ObjClientes.GetVentasRemisionesTotales(VentaRemision.CveCliente, VentaRemision.CveVenta.ToString(), 1, UsuarioActual.CveEmpresa) Then
|
||||
DtRemisionesPS = ObjClientes.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, VentaRemision.CveSubProyecto, VentaRemision.CveCliente, VentaRemision.CveMoneda, "Ing")
|
||||
|
||||
ObjFactura.RemisionesLista = RemisionesLista
|
||||
ObjFactura.DtRemisionesPS = DtRemisionesPS
|
||||
ObjFactura.DtRemisiones = DtRemisiones
|
||||
|
||||
Dim DtPagos As DataTable = New DataTable("DtPagosFactura")
|
||||
DtPagos.Columns.Add(New DataColumn("CveFormaPago", GetType(Integer)))
|
||||
DtPagos.Columns.Add(New DataColumn("Importe", GetType(Decimal)))
|
||||
|
||||
If TxtImporteCredito.Text.ToDecimal > 0 Then
|
||||
DtPagos.Rows.Add({4, TxtImporteCredito.Text.ToDecimal})
|
||||
End If
|
||||
|
||||
If TxtImporteDebito.Text.ToDecimal > 0 Then
|
||||
DtPagos.Rows.Add({18, TxtImporteDebito.Text.ToDecimal})
|
||||
End If
|
||||
|
||||
If TxtImporteCheque.Text.ToDecimal > 0 Then
|
||||
DtPagos.Rows.Add({2, TxtImporteCheque.Text.ToDecimal})
|
||||
End If
|
||||
|
||||
If TxtImporteTransferencia.Text.ToDecimal > 0 Then
|
||||
DtPagos.Rows.Add({3, TxtImporteTransferencia.Text.ToDecimal})
|
||||
End If
|
||||
|
||||
If TxtImporteEfectivo.Text.ToDecimal > 0 Then
|
||||
DtPagos.Rows.Add({1, TxtImporteEfectivo.Text.ToDecimal})
|
||||
End If
|
||||
|
||||
|
||||
Dim PagoMaximo = DtPagos.MAX("Importe")
|
||||
|
||||
Dim CveFormaPago As Integer = DtPagos.FiltroPrimeroValor("CveFormaPago", $"Importe = {PagoMaximo}").ToEntero()
|
||||
|
||||
If CveFormaPago > 0 Then
|
||||
ObjFactura.CveFormaPago33 = CveFormaPago
|
||||
ObjFactura.CveMetodoPago33 = 1
|
||||
End If
|
||||
|
||||
For Each Dr As DataRow In ObjFactura.DtRemisionesPS.Rows
|
||||
ObjFactura.AgregarPS(Dr("CvePS").ToString().ToEntero(), Dr("Cantidad").ToString().ToDecimal(), Dr("PU").ToString().ToDecimal(), Dr("Descuento").ToString().ToDecimal, Dr("Obs").ToString(), CveUM:=Dr("CveUM").ToString().ToEntero(),
|
||||
CveProyecto:=Dr("CveProyecto").ToString().ToEntero(), CveSubProyecto:=Dr("CveSubProyecto").ToString().ToEntero(), CveVentaDetallePadre:=Dr("CveVentaDetalle").ToString().ToEntero(), CveVentaDetalleRemision:=Dr("CveVentaDetalle").ToString().ToEntero(),
|
||||
PorcentajeIVA:=Dr("PorcentajeIVA").ToString().ToDecimal())
|
||||
Next
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(567) = "1" Then
|
||||
ObjFactura.GenerarSalidaAlmacen = True
|
||||
ObjFactura.DtInventario = ObjFactura.DtDetalle.FiltraParametros("CveTipoPS = 2").Copy()
|
||||
ObjFactura.CveAlmacen = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 1 AND CveSubProyecto = {VentaRemision.CveSubProyecto}", "Orden").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
|
||||
ObjFactura.CalculaTotales()
|
||||
|
||||
ObjFactura.PreparaTimbre()
|
||||
|
||||
If HdnTipoAmortizacion.Value = "4" Then
|
||||
Dim DtAnticipos As New DataTable()
|
||||
DtAnticipos.Columns.Add("CveVenta", GetType(Integer))
|
||||
DtAnticipos.Columns.Add("Importe", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("CveConceptoContable", GetType(Integer))
|
||||
DtAnticipos.Columns.Add("CveIE", GetType(Integer))
|
||||
DtAnticipos.Columns.Add("FolioFiscal", GetType(String))
|
||||
DtAnticipos.Columns.Add("Descuentos", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("TotalAnticipo", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("SubTotalAnticipo", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("CveMoneda", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("Fecha", GetType(DateTime))
|
||||
DtAnticipos.Columns.Add("TipoCambioPago", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("Folio", GetType(String))
|
||||
|
||||
For Each GvRow As GridViewRow In GVAnticipos.Rows
|
||||
If GvRow.FCCheckBox("Chk" & GvRow.RowIndex) IsNot Nothing AndAlso GvRow.FCCheckBox("Chk" & GvRow.RowIndex).Checked Then
|
||||
Dim CveVenta = GvRow.DataKey("CveVenta").ToEntero()
|
||||
Dim Importe = GvRow.FCTextBox(String.Format("TxtAnticipo{0}", GvRow.RowIndex)).Text.ToDecimal()
|
||||
Dim CveConceptoContable = GvRow.DataKey("CveConceptoContable").ToEntero()
|
||||
Dim CveIE = GvRow.DataKey("CveIE").ToEntero()
|
||||
|
||||
Dim FolioFiscal = GvRow.DataKey("FolioFiscal")
|
||||
Dim Descuentos As Decimal = GvRow.DataKey("Descuentos").ToDecimal()
|
||||
Dim TotalAnticipo As Decimal = GvRow.DataKey("TotalAnticipo").ToDecimal()
|
||||
Dim SubTotalAnticipo As Decimal = GvRow.DataKey("SubTotalAnticipo").ToDecimal()
|
||||
Dim CveMoneda As Integer = GvRow.DataKey("CveMoneda").ToEntero()
|
||||
Dim Fecha As DateTime = GvRow.DataKey("Fecha").ToDateTime()
|
||||
Dim TipoCambioPago As Decimal = GvRow.DataKey("TipoCambioPago").ToDecimal()
|
||||
Dim Folio = GvRow.DataKey("Folio")
|
||||
|
||||
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio)
|
||||
End If
|
||||
Next
|
||||
|
||||
ObjFactura.EsNCAmortizacion = True
|
||||
ObjFactura.CveTipoAmortizacionAnticipo = 4
|
||||
ObjFactura.DtAnticiposAplicados = DtAnticipos
|
||||
End If
|
||||
|
||||
Dim SbAlert As New StringBuilder()
|
||||
|
||||
Try
|
||||
Dim DtRemisiones As New DataTable
|
||||
DtRemisiones.Columns.Add(New DataColumn("CveVenta", GetType(Integer)))
|
||||
DtRemisiones.Columns.Add(New DataColumn("SerieFolio", GetType(String)))
|
||||
|
||||
DtRemisiones.Rows.Add({VentaRemision.CveVenta, VentaRemision.SerieFolio})
|
||||
|
||||
Dim RemisionesLista As New List(Of Integer)
|
||||
RemisionesLista.Add(VentaRemision.CveVenta)
|
||||
|
||||
Dim DtRemisionesPS As New DataTable()
|
||||
Dim DtPagosFacturaGlobal As New DataTable()
|
||||
|
||||
If ObjClientes.GetVentasRemisionesTotales(VentaRemision.CveCliente, VentaRemision.CveVenta.ToString(), 1, UsuarioActual.CveEmpresa) Then
|
||||
DtRemisionesPS = ObjClientes.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, VentaRemision.CveSubProyecto, VentaRemision.CveCliente, VentaRemision.CveMoneda, "Ing")
|
||||
|
||||
ObjFactura.RemisionesLista = RemisionesLista
|
||||
ObjFactura.DtRemisionesPS = DtRemisionesPS
|
||||
ObjFactura.DtRemisiones = DtRemisiones
|
||||
|
||||
Dim DtPagos As DataTable = New DataTable("DtPagosFactura")
|
||||
DtPagos.Columns.Add(New DataColumn("CveFormaPago", GetType(Integer)))
|
||||
DtPagos.Columns.Add(New DataColumn("Importe", GetType(Decimal)))
|
||||
|
||||
If TxtImporteCredito.Text.ToDecimal > 0 Then
|
||||
DtPagos.Rows.Add({4, TxtImporteCredito.Text.ToDecimal})
|
||||
End If
|
||||
|
||||
If TxtImporteDebito.Text.ToDecimal > 0 Then
|
||||
DtPagos.Rows.Add({18, TxtImporteDebito.Text.ToDecimal})
|
||||
End If
|
||||
|
||||
If TxtImporteCheque.Text.ToDecimal > 0 Then
|
||||
DtPagos.Rows.Add({2, TxtImporteCheque.Text.ToDecimal})
|
||||
End If
|
||||
|
||||
If TxtImporteTransferencia.Text.ToDecimal > 0 Then
|
||||
DtPagos.Rows.Add({3, TxtImporteTransferencia.Text.ToDecimal})
|
||||
End If
|
||||
|
||||
If TxtImporteEfectivo.Text.ToDecimal > 0 Then
|
||||
DtPagos.Rows.Add({1, TxtImporteEfectivo.Text.ToDecimal})
|
||||
End If
|
||||
|
||||
|
||||
Dim PagoMaximo = DtPagos.MAX("Importe")
|
||||
|
||||
Dim CveFormaPago As Integer = DtPagos.FiltroPrimeroValor("CveFormaPago", $"Importe = {PagoMaximo}").ToEntero()
|
||||
|
||||
If CveFormaPago > 0 Then
|
||||
ObjFactura.CveFormaPago33 = CveFormaPago
|
||||
ObjFactura.CveMetodoPago33 = 1
|
||||
End If
|
||||
|
||||
For Each Dr As DataRow In ObjFactura.DtRemisionesPS.Rows
|
||||
ObjFactura.AgregarPS(Dr("CvePS").ToString().ToEntero(), Dr("Cantidad").ToString().ToDecimal(), Dr("PU").ToString().ToDecimal(), Dr("Descuento").ToString().ToDecimal, Dr("Obs").ToString(), CveUM:=Dr("CveUM").ToString().ToEntero(),
|
||||
CveProyecto:=Dr("CveProyecto").ToString().ToEntero(), CveSubProyecto:=Dr("CveSubProyecto").ToString().ToEntero(), CveVentaDetallePadre:=Dr("CveVentaDetalle").ToString().ToEntero(), CveVentaDetalleRemision:=Dr("CveVentaDetalle").ToString().ToEntero(),
|
||||
PorcentajeIVA:=Dr("PorcentajeIVA").ToString().ToDecimal())
|
||||
Next
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(567) = "1" Then
|
||||
ObjFactura.GenerarSalidaAlmacen = True
|
||||
ObjFactura.DtInventario = ObjFactura.DtDetalle.FiltraParametros("CveTipoPS = 2").Copy()
|
||||
ObjFactura.CveAlmacen = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 1 AND CveSubProyecto = {VentaRemision.CveSubProyecto}", "Orden").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
|
||||
ObjFactura.CalculaTotales()
|
||||
|
||||
ObjFactura.PreparaTimbre()
|
||||
|
||||
If HdnTipoAmortizacion.Value = "4" Then
|
||||
Dim DtAnticipos As New DataTable()
|
||||
DtAnticipos.Columns.Add("CveVenta", GetType(Integer))
|
||||
DtAnticipos.Columns.Add("Importe", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("CveConceptoContable", GetType(Integer))
|
||||
DtAnticipos.Columns.Add("CveIE", GetType(Integer))
|
||||
DtAnticipos.Columns.Add("FolioFiscal", GetType(String))
|
||||
DtAnticipos.Columns.Add("Descuentos", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("TotalAnticipo", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("SubTotalAnticipo", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("CveMoneda", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("Fecha", GetType(DateTime))
|
||||
DtAnticipos.Columns.Add("TipoCambioPago", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("Folio", GetType(String))
|
||||
|
||||
For Each GvRow As GridViewRow In GVAnticipos.Rows
|
||||
If GvRow.FCCheckBox("Chk" & GvRow.RowIndex) IsNot Nothing AndAlso GvRow.FCCheckBox("Chk" & GvRow.RowIndex).Checked Then
|
||||
Dim CveVenta = GvRow.DataKey("CveVenta").ToEntero()
|
||||
Dim Importe = GvRow.FCTextBox(String.Format("TxtAnticipo{0}", GvRow.RowIndex)).Text.ToDecimal()
|
||||
Dim CveConceptoContable = GvRow.DataKey("CveConceptoContable").ToEntero()
|
||||
Dim CveIE = GvRow.DataKey("CveIE").ToEntero()
|
||||
|
||||
Dim FolioFiscal = GvRow.DataKey("FolioFiscal")
|
||||
Dim Descuentos As Decimal = GvRow.DataKey("Descuentos").ToDecimal()
|
||||
Dim TotalAnticipo As Decimal = GvRow.DataKey("TotalAnticipo").ToDecimal()
|
||||
Dim SubTotalAnticipo As Decimal = GvRow.DataKey("SubTotalAnticipo").ToDecimal()
|
||||
Dim CveMoneda As Integer = GvRow.DataKey("CveMoneda").ToEntero()
|
||||
Dim Fecha As DateTime = GvRow.DataKey("Fecha").ToDateTime()
|
||||
Dim TipoCambioPago As Decimal = GvRow.DataKey("TipoCambioPago").ToDecimal()
|
||||
Dim Folio = GvRow.DataKey("Folio")
|
||||
|
||||
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio)
|
||||
End If
|
||||
Next
|
||||
|
||||
ObjFactura.EsNCAmortizacion = True
|
||||
ObjFactura.CveTipoAmortizacionAnticipo = 4
|
||||
ObjFactura.DtAnticiposAplicados = DtAnticipos
|
||||
End If
|
||||
|
||||
Retorno = ObjFactura.EmitirFactura(False, Transac:=ObjVentas.IniciaTransacSQL(), Modulo:="Cobranza/GuardarVenta", MostrarURL:=True)
|
||||
Retorno.Factura = ObjFactura
|
||||
|
||||
@@ -944,81 +943,85 @@ Partial Class Ventas_PVCobranza
|
||||
|
||||
Private Function GenerarNC(ByRef Venta As Venta, ByRef ObjVentas As ClsVentas) As Modelos.Factura.MMensajeFactura
|
||||
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
|
||||
Dim ObjNC = Modelos.Factura.CrearVentaNueva(UsuarioActual, Venta.CveSubProyecto, Venta.CveCliente, Venta.CveMoneda, "Egs")
|
||||
|
||||
Dim Total As Decimal = TxtNCDev.Text.ToDecimal()
|
||||
Dim subTotal As Decimal = (Total / (1D + Venta.PorcentajeIVA))
|
||||
'Dim IVA = (subTotal * Factura.PorcentajeIVA).RoundSQL(2)
|
||||
Dim PU As Decimal = subTotal
|
||||
Dim Cantidad As Decimal = 1D
|
||||
Dim Descuento As Decimal = 0
|
||||
Dim Obs = ""
|
||||
|
||||
ObjNC.AgregarPS(DdlNCPSAnt.SelectedValue.ToEntero(), Cantidad, PU, Descuento, Obs, CveSubProyecto:=Venta.CveSubProyecto, PorcentajeIVA:=Venta.PorcentajeIVA)
|
||||
ObjNC.CalculaTotales()
|
||||
|
||||
Dim DtVentasNC = New DataTable
|
||||
DtVentasNC.Columns.Add("CveVenta", GetType(Integer))
|
||||
DtVentasNC.Columns.Add("Importe", GetType(Decimal))
|
||||
DtVentasNC.Columns.Add("FolioFiscal", GetType(String))
|
||||
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "TC", .DataType = GetType(Decimal), .DefaultValue = 1})
|
||||
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "TCCambioValuacion", .DataType = GetType(Decimal), .DefaultValue = 1})
|
||||
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "CveEstatusFactura", .DataType = GetType(Integer), .DefaultValue = -1})
|
||||
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "Folio", .DataType = GetType(String), .DefaultValue = ""})
|
||||
|
||||
DtVentasNC.Rows.Add(Venta.CveVenta, Total, "")
|
||||
|
||||
ObjNC.DtVentasNC = DtVentasNC
|
||||
|
||||
Dim DtVentasRelacionadas As New DataTable()
|
||||
DtVentasRelacionadas.Columns.Add("CveVenta", GetType(Integer))
|
||||
DtVentasRelacionadas.Rows.Add(Venta.CveVenta)
|
||||
|
||||
ObjNC.DtVentasRelacionadas = DtVentasRelacionadas
|
||||
|
||||
Dim DtAnticipos As New DataTable()
|
||||
DtAnticipos.Columns.Add("CveVenta", GetType(Integer))
|
||||
DtAnticipos.Columns.Add("Importe", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("CveConceptoContable", GetType(Integer))
|
||||
DtAnticipos.Columns.Add("CveIE", GetType(Integer))
|
||||
DtAnticipos.Columns.Add("FolioFiscal", GetType(String))
|
||||
DtAnticipos.Columns.Add("Descuentos", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("TotalAnticipo", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("SubTotalAnticipo", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("CveMoneda", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("Fecha", GetType(DateTime))
|
||||
DtAnticipos.Columns.Add("TipoCambioPago", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("Folio", GetType(String))
|
||||
|
||||
For Each GvRow As GridViewRow In GVAnticipos.Rows
|
||||
If GvRow.FCCheckBox("Chk" & GvRow.RowIndex) IsNot Nothing AndAlso GvRow.FCCheckBox("Chk" & GvRow.RowIndex).Checked Then
|
||||
Dim CveVenta = GvRow.DataKey("CveVenta").ToEntero()
|
||||
Dim Importe = GvRow.FCTextBox(String.Format("TxtAnticipo{0}", GvRow.RowIndex)).Text.ToDecimal()
|
||||
Dim CveConceptoContable = GvRow.DataKey("CveConceptoContable").ToEntero()
|
||||
Dim CveIE = GvRow.DataKey("CveIE").ToEntero()
|
||||
|
||||
Dim FolioFiscal = GvRow.DataKey("FolioFiscal")
|
||||
Dim Descuentos As Decimal = GvRow.DataKey("Descuentos").ToDecimal()
|
||||
Dim TotalAnticipo As Decimal = GvRow.DataKey("TotalAnticipo").ToDecimal()
|
||||
Dim SubTotalAnticipo As Decimal = GvRow.DataKey("SubTotalAnticipo").ToDecimal()
|
||||
Dim CveMoneda As Integer = GvRow.DataKey("CveMoneda").ToEntero()
|
||||
Dim Fecha As DateTime = GvRow.DataKey("Fecha").ToDateTime()
|
||||
Dim TipoCambioPago As Decimal = GvRow.DataKey("TipoCambioPago").ToDecimal()
|
||||
Dim Folio = GvRow.DataKey("Folio")
|
||||
|
||||
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio)
|
||||
End If
|
||||
Next
|
||||
|
||||
ObjNC.EsNCAmortizacion = True
|
||||
ObjNC.CveTipoAmortizacionAnticipo = 2
|
||||
ObjNC.DtAnticiposAplicados = DtAnticipos
|
||||
|
||||
ObjNC.PreparaTimbre()
|
||||
|
||||
Dim SbAlert As New StringBuilder()
|
||||
|
||||
Try
|
||||
Dim ObjNC = Modelos.Factura.CrearVentaNueva(UsuarioActual, Venta.CveSubProyecto, Venta.CveCliente, Venta.CveMoneda, "Egs")
|
||||
|
||||
Dim Total As Decimal = TxtNCDev.Text.ToDecimal()
|
||||
Dim subTotal As Decimal = (Total / (1D + Venta.PorcentajeIVA))
|
||||
'Dim IVA = (subTotal * Factura.PorcentajeIVA).RoundSQL(2)
|
||||
Dim PU As Decimal = subTotal
|
||||
Dim Cantidad As Decimal = 1D
|
||||
Dim Descuento As Decimal = 0
|
||||
Dim Obs = ""
|
||||
|
||||
ObjNC.AgregarPS(DdlNCPSAnt.SelectedValue.ToEntero(), Cantidad, PU, Descuento, Obs, CveSubProyecto:=Venta.CveSubProyecto, PorcentajeIVA:=Venta.PorcentajeIVA)
|
||||
ObjNC.CalculaTotales()
|
||||
|
||||
Dim DtVentasNC = New DataTable
|
||||
DtVentasNC.Columns.Add("CveVenta", GetType(Integer))
|
||||
DtVentasNC.Columns.Add("Importe", GetType(Decimal))
|
||||
DtVentasNC.Columns.Add("FolioFiscal", GetType(String))
|
||||
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "TC", .DataType = GetType(Decimal), .DefaultValue = 1})
|
||||
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "TCCambioValuacion", .DataType = GetType(Decimal), .DefaultValue = 1})
|
||||
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "CveEstatusFactura", .DataType = GetType(Integer), .DefaultValue = -1})
|
||||
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "Folio", .DataType = GetType(String), .DefaultValue = ""})
|
||||
|
||||
DtVentasNC.Rows.Add(Venta.CveVenta, Total, "")
|
||||
|
||||
ObjNC.DtVentasNC = DtVentasNC
|
||||
|
||||
Dim DtVentasRelacionadas As New DataTable()
|
||||
DtVentasRelacionadas.Columns.Add("CveVenta", GetType(Integer))
|
||||
DtVentasRelacionadas.Rows.Add(Venta.CveVenta)
|
||||
|
||||
ObjNC.DtVentasRelacionadas = DtVentasRelacionadas
|
||||
|
||||
Dim DtAnticipos As New DataTable()
|
||||
DtAnticipos.Columns.Add("CveVenta", GetType(Integer))
|
||||
DtAnticipos.Columns.Add("Importe", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("CveConceptoContable", GetType(Integer))
|
||||
DtAnticipos.Columns.Add("CveIE", GetType(Integer))
|
||||
DtAnticipos.Columns.Add("FolioFiscal", GetType(String))
|
||||
DtAnticipos.Columns.Add("Descuentos", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("TotalAnticipo", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("SubTotalAnticipo", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("CveMoneda", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("Fecha", GetType(DateTime))
|
||||
DtAnticipos.Columns.Add("TipoCambioPago", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("Folio", GetType(String))
|
||||
|
||||
For Each GvRow As GridViewRow In GVAnticipos.Rows
|
||||
If GvRow.FCCheckBox("Chk" & GvRow.RowIndex) IsNot Nothing AndAlso GvRow.FCCheckBox("Chk" & GvRow.RowIndex).Checked Then
|
||||
Dim CveVenta = GvRow.DataKey("CveVenta").ToEntero()
|
||||
Dim Importe = GvRow.FCTextBox(String.Format("TxtAnticipo{0}", GvRow.RowIndex)).Text.ToDecimal()
|
||||
Dim CveConceptoContable = GvRow.DataKey("CveConceptoContable").ToEntero()
|
||||
Dim CveIE = GvRow.DataKey("CveIE").ToEntero()
|
||||
|
||||
Dim FolioFiscal = GvRow.DataKey("FolioFiscal")
|
||||
Dim Descuentos As Decimal = GvRow.DataKey("Descuentos").ToDecimal()
|
||||
Dim TotalAnticipo As Decimal = GvRow.DataKey("TotalAnticipo").ToDecimal()
|
||||
Dim SubTotalAnticipo As Decimal = GvRow.DataKey("SubTotalAnticipo").ToDecimal()
|
||||
Dim CveMoneda As Integer = GvRow.DataKey("CveMoneda").ToEntero()
|
||||
Dim Fecha As DateTime = GvRow.DataKey("Fecha").ToDateTime()
|
||||
Dim TipoCambioPago As Decimal = GvRow.DataKey("TipoCambioPago").ToDecimal()
|
||||
Dim Folio = GvRow.DataKey("Folio")
|
||||
|
||||
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio)
|
||||
End If
|
||||
Next
|
||||
|
||||
ObjNC.EsNCAmortizacion = True
|
||||
ObjNC.CveTipoAmortizacionAnticipo = 2
|
||||
ObjNC.DtAnticiposAplicados = DtAnticipos
|
||||
|
||||
ObjNC.PreparaTimbre()
|
||||
|
||||
ObjNC.CveFormaPago33 = 21 'Aplicación de anticipos
|
||||
ObjNC.CveMetodoPago33 = 1
|
||||
ObjNC.CveMetodoPago = 1
|
||||
|
||||
Retorno = ObjNC.EmitirFactura(False, Transac:=ObjVentas.IniciaTransacSQL(), Modulo:="Cobranza/GuardarVenta", MostrarURL:=True)
|
||||
Retorno.Factura = ObjNC
|
||||
|
||||
|
||||
Reference in New Issue
Block a user