Sumar dias de vencimiento en fecha de pago en lineas adicionales, correcion de timbrado de NC en CFDI 4.0

This commit is contained in:
2022-10-05 17:51:07 -07:00
parent d0e6b39fb8
commit 2d999d42fe

View File

@@ -5773,7 +5773,7 @@ Partial Class Ventas
ObjVentas = New ClsVentas()
End If
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
Dim drv As DataRow = ObjVentas.DtResultados.Rows(0)
@@ -5915,7 +5915,7 @@ Partial Class Ventas
'cuando es refacturacion, la fecha de pago debe de ser la misma
If UsuarioActual.Empresa.Funcionalidad(526) = "1" Then
' Dim ObjVenta As New ClsVentas
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
TxtFechaPago.Text = ObjVentas.DtResultados(0)("FechaVencimiento").ToString().ToDate.ToShortDateString
End If
@@ -6784,7 +6784,7 @@ Partial Class Ventas
Row("CveVenta") = DdlFacturaARelacionar.SelectedValue.ToEntero()
Using ObjVentas As New ClsVentas
If ObjVentas.GetVenta(DdlFacturaARelacionar.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
If ObjVentas.GetVenta(DdlFacturaARelacionar.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, VerificaAlmacen:=False) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
Row("SerieFolio") = ObjVentas.DtResultados(0)("SerieFolio").ToString()
Row("FolioFiscal") = ObjVentas.DtResultados(0)("FolioFiscal").ToString()
End If
@@ -7547,7 +7547,7 @@ Partial Class Ventas
If DdlNCFactura.Items.Count = 0 Then
Dim ObjClientes As New ClsVentas()
If ObjClientes.GetVenta(pCveVenta, UsuarioActual.CveEmpresa) AndAlso ObjClientes.DtResultados.Rows.Count > 0 Then
If ObjClientes.GetVenta(pCveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) AndAlso ObjClientes.DtResultados.Rows.Count > 0 Then
DTFacNC = ObjClientes.DtResultados
Dim drvv As DataRow = DTFacNC.FiltroPrimero("")
DTFacNC.Columns.Add("Factura", GetType(String), " Folio + ' - ' +' $' + Total + ' - ' + Fecha ")
@@ -22597,7 +22597,7 @@ Partial Class Ventas
Private Sub InventarioMov(Optional CveVentaPadre As Integer = -1)
If CveVentaPadre > 0 Then
Dim ObjVentas As New ClsVentas()
If ObjVentas.GetVenta(CveVentaPadre, UsuarioActual.CveEmpresa) Then
If ObjVentas.GetVenta(CveVentaPadre, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
If ObjVentas.DtResultados.Rows.Count > 0 AndAlso ObjVentas.DtResultados.Rows(0)("TipoDocto").ToString() = "Ing" AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then
' Dim CveEstatusRefacturacion As Integer = ObjVentas.DtResultados.Rows(0)("CveEstatusRefacturacion").ToString().ToEntero()
@@ -22739,7 +22739,7 @@ Partial Class Ventas
End Sub
Protected Sub LBDevolucionAlmacen_Click(sender As Object, e As EventArgs)
Dim ObjVentas As New ClsVentas
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
Me.DevolucionAlmacen = DbRowVenta("EsDevolucionVenta").ToString().ToEntero()
@@ -24704,7 +24704,7 @@ Partial Class Ventas
Dim ObjVentas As New ClsVentas()
Dim ObjInventarios As New ClsInventarios
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
@@ -26133,7 +26133,7 @@ Partial Class Ventas
ViewState("CveVenta") = IfNull(Request("CveVenta"), 0).ToString.ToEntero
Dim Obj As New ClsVentas
If Obj.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
If Obj.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
Dim DbRowVenta As DataRow = Obj.DtResultados.FiltroPrimero("")
ViewState("SaldoVenta") = DbRowVenta("Saldo").ToString()
Total = DbRowVenta("Total").ToString.ToDecimal
@@ -28166,7 +28166,7 @@ Partial Class Ventas
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString.ToDecimal, Dr("PorcentajeIVA").ToString.ToDecimal, Dr("ImporteIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal,
Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0, Dr("ImporteTotal").ToString().ToDecimal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString())
Next
End If
@@ -28237,7 +28237,7 @@ Partial Class Ventas
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal + Ajuste, Dr("PorcentajeIVA").ToString().ToDecimal, Dr("ImporteIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal,
Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0, Dr("ImporteTotal").ToString().ToDecimal(), "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString())
Next
End If
@@ -28369,7 +28369,7 @@ Partial Class Ventas
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowUsado("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
RowUsado("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowUsado("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalle").ToString().ToEntero())
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalle").ToString().ToEntero(), CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString())
End If
@@ -28462,7 +28462,7 @@ Partial Class Ventas
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, 0, ImporteRetIVA,
0, ImporteRetISR, 0, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero())
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero(), CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString())
End If
@@ -28554,7 +28554,7 @@ Partial Class Ventas
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString())
End If
Next
@@ -28648,7 +28648,7 @@ Partial Class Ventas
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString())
End If
Next
@@ -28736,7 +28736,7 @@ Partial Class Ventas
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, 0, ImporteRetIVA,
0, ImporteRetISR, 0, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero())
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero(), CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString())
End If
@@ -28823,7 +28823,7 @@ Partial Class Ventas
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowRNC("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowRNC("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
RowRNC("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowRNC("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowRNC("CveVentaDetalle").ToString().ToEntero())
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowRNC("CveVentaDetalle").ToString().ToEntero(), CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString())
End If
@@ -28859,7 +28859,7 @@ Partial Class Ventas
Dim FechaFactura As DateTime = Now
If AplicaNCMasiva OrElse AplicaNCUsado Then
If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa) Then
If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
Total = ObjVentas.DtResultados()(0)("Total").ToString().ToDecimal
SubTotal = ObjVentas.DtResultados()(0)("SubTotal").ToString().ToDecimal
@@ -28965,7 +28965,8 @@ Partial Class Ventas
PorcentajeRetISR As Decimal, ImporteRetISR As Decimal, PorcentajeIEPS As Decimal, ImporteIEPS As Decimal, TipoDescuento As Integer, Descuento As Decimal,
Total As Decimal, Serie As String, TiempoEntrega As String, CvePresupuestoIngreso As Integer, EntregaDirecta As Integer, SATClaveProdServ As String,
SATClaveUM As String, CveContratoDetalle As Integer, CveVentaDetalle As Integer, CveMovimientoDetallePedido As Integer, CveOrdenCompraDetalle As Integer,
CveVentaDetalleRemision As Integer, CveVentaDetalleCotizacion As Integer, Optional CveTamaño As Integer = -1, Optional CveVentaDetalleRNC As Integer = -1)
CveVentaDetalleRemision As Integer, CveVentaDetalleCotizacion As Integer, Optional CveTamaño As Integer = -1, Optional CveVentaDetalleRNC As Integer = -1,
Optional CodigoObjetoImpuesto As String = "")
Dim Row As DataRow = Nothing
Row = TmpDT.NewRow()
@@ -29027,6 +29028,8 @@ Partial Class Ventas
Row("CveTamaño") = CveTamaño
Row("CveVentaDetalleRNC") = CveVentaDetalleRNC
Row("CodigoObjetoImpuesto") = CodigoObjetoImpuesto
TmpDT.Rows.Add(Row)
End Sub
@@ -29143,7 +29146,7 @@ Partial Class Ventas
Else
ObjVentasAplicar = New ClsVentas
End If
If ObjVentasAplicar.GetVenta(pCveVenta, UsuarioActual.CveEmpresa) AndAlso ObjVentasAplicar.DtResultados.Rows.Count > 0 Then
If ObjVentasAplicar.GetVenta(pCveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) AndAlso ObjVentasAplicar.DtResultados.Rows.Count > 0 Then
Folio = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("SerieFolio").ToString()
FolioFiscal = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("FolioFiscal").ToString()
TC = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("TipoCambio").ToString().ToDecimal()
@@ -29711,7 +29714,7 @@ Partial Class Ventas
Guia = ObjInventario.DtResultados.Rows(0)("Guia").ToString()
End If
End If
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
SerieFolio = ObjVentas.DtResultados.Rows(0)("SerieFolio").ToString()
PedidoContrato = ObjVentas.DtResultados.Rows(0)("PedidoContrato").ToString()
@@ -29762,7 +29765,7 @@ Partial Class Ventas
Guia = ObjInventario.DtResultados.Rows(0)("Guia").ToString()
End If
End If
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
SerieFolio = ObjVentas.DtResultados.Rows(0)("SerieFolio").ToString()
PedidoContrato = ObjVentas.DtResultados.Rows(0)("PedidoContrato").ToString()
@@ -32028,7 +32031,7 @@ Partial Class Ventas
If TipoDoctoViejo = "PA" Then
Dim RowVenta As DataRow = Nothing
Dim ObjVentas As New ClsVentas
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
RowVenta = ObjVentas.DtResultados.Rows(0)
End If
ObjVentas.Dispose()
@@ -32063,7 +32066,7 @@ Partial Class Ventas
Dim ErrorTrans As Boolean = False
Dim FechaVencimientoAnterior As String = ""
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
FechaVencimientoAnterior = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDate.ToShortDateString
Else
@@ -33969,7 +33972,7 @@ Partial Class Ventas
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
End If
If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa) Then
If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
Total = ObjVentas.DtResultados()(0)("Total").ToString.ToDecimal
SubTotal = ObjVentas.DtResultados()(0)("SubTotal").ToString.ToDecimal
@@ -35322,16 +35325,26 @@ Partial Class Ventas
Using ObjVentas As New ClsVentas
If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, FechaVencimientoConsulta:=MinFecha) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
TxtFechaPago.Text = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy")
Me.SaldoLineaAdicional = ObjVentas.DtResultados.Rows(0)("Saldo").ToString().ToDecimal()
Me.CveCategoriaLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveCategoria").ToString().ToEntero()
Me.CveMonedaLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveMoneda").ToString().ToEntero()
Dim RowLinea As DataRow = ObjVentas.DtResultados.Rows(0)
If RowLinea IsNot Nothing Then
TxtFechaPago.Text = RowLinea("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy")
'AL FACTURAR CON LINEA ADICIONAL TIPO PO, SE SUMARÁN LOS DIAS DE VENCIMIENTO A LA FECHA ACTUAL
If RowLinea("TipoLinea").ToString() = "2" Then
TxtFechaPago.Text = Now.AddDays(RowLinea("DiasVencimiento").ToString().ToEntero()).ToString("dd/MM/yyyy")
End If
Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero()
Me.CveMonedaLineaAdicional = RowLinea("CveMoneda").ToString().ToEntero()
End If
End If
End If
End Using
Else
Me.SaldoLineaAdicional = 0
Me.CveCategoriaLineaAdicional = 0
TxtFechaPago.Text = Now.ToString("dd/MM/yyyy")
End If
UpParametros.Update()