Cambios BDH
This commit is contained in:
@@ -144,6 +144,22 @@ Partial Class Ventas
|
||||
ViewState("TmpDTRNCBonificacionesSeleccionadas") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TmpDTRNCDetalle As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("TmpDTRNCDetalle")), Nothing, CType(ViewState("TmpDTRNCDetalle"), DataTable))
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("TmpDTRNCDetalle") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TmpDTRNCDetalleSelecciondas As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("TmpDTRNCDetalleSelecciondas")), Nothing, CType(ViewState("TmpDTRNCDetalleSelecciondas"), DataTable))
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("TmpDTRNCDetalleSelecciondas") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TmpDTError As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("TmpDTError")), Nothing, CType(ViewState("TmpDTError"), DataTable))
|
||||
@@ -1861,6 +1877,22 @@ Partial Class Ventas
|
||||
ViewState("SerieVenta") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property AplicaDocumentoNuevoNC As Boolean
|
||||
Get
|
||||
Return CBool(IfNull(ViewState("AplicaDocumentoNuevoNC"), "False", ViewState("AplicaDocumentoNuevoNC")))
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("AplicaDocumentoNuevoNC") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property AplicaRNCXDetalle As Boolean
|
||||
Get
|
||||
Return CBool(IfNull(ViewState("AplicaRNCXDetalle"), "False", ViewState("AplicaRNCXDetalle")))
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("AplicaRNCXDetalle") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
@@ -3928,6 +3960,7 @@ Partial Class Ventas
|
||||
TmpDT = ObjVentas.DtResultados
|
||||
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
|
||||
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
|
||||
TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer))
|
||||
GvPS.DataSource = ObjVentas.DtResultados
|
||||
GvPS.DataBind()
|
||||
|
||||
@@ -5617,7 +5650,7 @@ Partial Class Ventas
|
||||
|
||||
Dim ObjClientes As New ClsClientes
|
||||
If ObjClientes.GetHistorialVentas(CveCliente, 1000, CveClienteSucursal:=-1, TipoDocto:="Ing", CveEstatusFactura:=-1, FechaI:=Now.AddMonths(-1)) Then
|
||||
DdlVentaUsado.DataSource = ObjClientes.DtResultados
|
||||
DdlVentaUsado.DataSource = ObjClientes.DtResultados.FiltraParametros("UsadoMarcado = 0")
|
||||
End If
|
||||
ObjClientes.Dispose()
|
||||
|
||||
@@ -8575,7 +8608,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
'SI NO ES REFACTURACION
|
||||
If NuevaFactura <> 1 Then
|
||||
If NuevaFactura <> 1 AndAlso Not AplicaDocumentoNuevoNC Then
|
||||
If DtVentasNC Is Nothing Then InicializaDTVentasNC()
|
||||
Dim Drt = DtVentasNC.NewRow
|
||||
Drt("CveVenta") = ObjFactura.CveVenta
|
||||
@@ -10497,6 +10530,15 @@ Partial Class Ventas
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
|
||||
'SI SE FACTURA UNA RNC SE MUESTRA
|
||||
If UsuarioActual.CveEmpresa = 140 AndAlso factura.TipoDocto = "Egs" Then
|
||||
If Row("CveVentaDetalleRNC").ToString().ToEntero() > 0 Then
|
||||
If Not ObjVentas.AddVentaDetalleRNCFacturada(Row("CveVentaDetalleRNC").ToString().ToEntero(), ObjVentas.CveVentaDetalle, Row("Cantidad").ToString().ToDecimal()) Then
|
||||
ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.")
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
@@ -11589,6 +11631,13 @@ Partial Class Ventas
|
||||
CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera
|
||||
End If
|
||||
|
||||
'ACTUALIZA SI LA VENTA FUE MARCADA CON OTRA PARA EL FILTRO DE USADOS
|
||||
If ObjRNC.Num3 > 0 Then
|
||||
If Not ObjVentas.UpdateVentaRNCUsado(ObjRNC.CveVenta, ObjRNC.Num3.ToEntero()) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
End If
|
||||
|
||||
IdCtaContableCliente = IdCtaContable
|
||||
CveCuentaCliente = CveCuenta
|
||||
|
||||
@@ -16508,6 +16557,7 @@ Partial Class Ventas
|
||||
|
||||
TmpDT.Columns.Add("EsOutSourcing", GetType(Boolean))
|
||||
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
|
||||
TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer))
|
||||
|
||||
TmpDT.Columns("EsOutSourcing").DefaultValue = False
|
||||
TmpDT.Columns("EsCargo").DefaultValue = False
|
||||
@@ -23570,6 +23620,18 @@ Partial Class Ventas
|
||||
ObjMovtos.Dispose()
|
||||
GvCxC.DataBind()
|
||||
End Sub
|
||||
Protected Sub ChkMostarProductosRNC_CheckedChanged(sender As Object, e As EventArgs)
|
||||
If ChkMostarProductosRNC.Checked Then
|
||||
DivRNCCargos.Visible = False
|
||||
DivRNCCargosDetalle.Visible = True
|
||||
CargaRNCDetalle(DdlVentaUsado.SelectedValue.ToEntero())
|
||||
Else
|
||||
DivRNCCargos.Visible = True
|
||||
DivRNCCargosDetalle.Visible = False
|
||||
CargaRNC(DdlVentaUsado.SelectedValue.ToEntero())
|
||||
End If
|
||||
UpModalRemisionesNC.Update()
|
||||
End Sub
|
||||
Private Sub CargaRNC(Optional CveVentaUsado As Integer = -1)
|
||||
Dim DtNC As DataTable = Nothing
|
||||
|
||||
@@ -23603,8 +23665,58 @@ Partial Class Ventas
|
||||
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
|
||||
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2)
|
||||
DivSMU.Visible = True
|
||||
HdnSaldoMaximoUsados.Value = RowUsadosNC("Valor").ToString()
|
||||
LtlSMU.Text = RowUsadosNC("Valor").ToString().ToDecimal().FormatoNumero(2)
|
||||
HdnSaldoMaximoUsados.Value = RowUsadosNC("ValorConImpuestos").ToString()
|
||||
LtlSMU.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
|
||||
Else
|
||||
DivSMU.Visible = False
|
||||
HdnSaldoMaximoUsados.Value = "0"
|
||||
LtlSMU.Text = "0"
|
||||
End If
|
||||
ObjAcum.Dispose()
|
||||
End If
|
||||
|
||||
UpModalRemisionesNC.Update()
|
||||
UpDescNC.Update()
|
||||
End Sub
|
||||
Private Sub CargaRNCDetalle(Optional CveVentaUsado As Integer = -1)
|
||||
Dim DtNC As DataTable = Nothing
|
||||
|
||||
Dim ObjMovtos As New ClsMovimientos()
|
||||
If ObjMovtos.GetRemisionesNCCliente(CveCliente, True, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
|
||||
Me.TmpDTRNCDetalle = ObjMovtos.DtResultados.Copy()
|
||||
End If
|
||||
ObjMovtos.Dispose()
|
||||
|
||||
Me.TmpDTRNCDetalle.Columns.Add(New DataColumn("CveVentaDetalleNCGenerada", GetType(Integer)))
|
||||
|
||||
Me.TmpDTRNCDetalleSelecciondas = Nothing
|
||||
Me.TmpDTRNCDetalleSelecciondas = TmpDTRNCDetalle.Clone()
|
||||
Me.TmpDTRNCDetalleSelecciondas.Clear()
|
||||
|
||||
GvRemisionesNCDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 1")
|
||||
'GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas
|
||||
|
||||
'Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2")
|
||||
'Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal))
|
||||
'Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal))
|
||||
'Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
|
||||
|
||||
GvRemisionesNCDetalle.DataBind()
|
||||
'GvRemisionesNCBon.DataBind()
|
||||
|
||||
If CveVentaUsado > 0 Then
|
||||
DivSMU.Visible = True
|
||||
Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa)
|
||||
Dim SaldoMaximoUsados As Decimal = FacUsado.DtDetalle.SUM("Total", "EsCargo = True").ToDecimal() + FacUsado.DtDetalle.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
|
||||
HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString()
|
||||
LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUsados)
|
||||
Else
|
||||
Dim ObjAcum As New ClsAcumuladores
|
||||
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
|
||||
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2)
|
||||
DivSMU.Visible = True
|
||||
HdnSaldoMaximoUsados.Value = RowUsadosNC("ValorConImpuestos").ToString()
|
||||
LtlSMU.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
|
||||
Else
|
||||
DivSMU.Visible = False
|
||||
HdnSaldoMaximoUsados.Value = "0"
|
||||
@@ -23814,6 +23926,15 @@ Partial Class Ventas
|
||||
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub GvRemisionesNCDetalle_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRemisionesNCDetalle.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("CveVentaDetalleRNC").ToEntero() = 0 Then
|
||||
e.Row.CssClass = "Totales"
|
||||
e.Row.FCCheckBox("ChkAplicar").Visible = False
|
||||
e.Row.FCTextBox("TxtCantidadRNC").Visible = False
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlNCNivelImporte_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
Dim ImporteReferencia As Double = 0, PorcentajeMaximo As Double = 0
|
||||
@@ -23842,7 +23963,7 @@ Partial Class Ventas
|
||||
'SOLO APLICA SI NO HAY DOCUMENTOS QUE SELECCIONAR
|
||||
If UsuarioActual.CveEmpresa = 140 Then
|
||||
If GvCxC.Rows.Count = 0 OrElse GvCxC.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("ChkCxC").Checked) = 0 Then
|
||||
Alert("No se ha seleccionado ninguna nota de crédito, en caso de no seleccionar ninguna se creará una nueva nota de crédito. ¿Está seguro de realizar esta acción?", TipoMensaje.MsgConfirmacion, JSBtnAceptar:="BtnAplicaNuevaNC();", TextoConfirmacion:=" Si ", TextoCancelacion:=" No ")
|
||||
Alert("No se ha seleccionado ninguna factura, en caso de no seleccionar ninguna se creará una nueva nota de crédito. ¿Está seguro de realizar esta acción?", TipoMensaje.MsgConfirmacion, JSBtnAceptar:="BtnAplicaNuevaNC();", TextoConfirmacion:=" Si ", TextoCancelacion:=" No ")
|
||||
Else
|
||||
AplicarNotaCreditoDesdeVenta()
|
||||
End If
|
||||
@@ -23898,6 +24019,7 @@ Partial Class Ventas
|
||||
Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional AplicaNuevoDocumento As Boolean = False, Optional AplicoNCFacturaActual As Boolean = False)
|
||||
|
||||
Try
|
||||
Me.AplicaDocumentoNuevoNC = AplicaNuevoDocumento
|
||||
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
If DrPS Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
|
||||
@@ -24066,11 +24188,22 @@ Partial Class Ventas
|
||||
TmpDTDescNC.Clear()
|
||||
|
||||
If UsuarioActual.CveEmpresa = 140 Then
|
||||
If AplicaRNCXDetalle Then
|
||||
CrearDTNCCargoDetalle(ListaNCDesc, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
Else
|
||||
CrearDTNCCargo(ListaNCDesc, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
End If
|
||||
|
||||
CrearDTNCCargo(ListaNCDesc, DtImpuestos, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
|
||||
'CONSULTA EL CONCEPTO DE NC
|
||||
Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
|
||||
Dim NCBonificacion As Integer = 0
|
||||
If ArrayNC.Length > 4 Then
|
||||
NCBonificacion = ArrayNC(4).ToEntero()
|
||||
End If
|
||||
|
||||
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
|
||||
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=360481).FiltroPrimero("")
|
||||
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCBonificacion).FiltroPrimero("")
|
||||
If DrPSBonificacion IsNot Nothing Then
|
||||
CrearDTNCBonificacion(ListaNCDesc, DtImpuestosBonificacion, TmpDTDescNC, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
Else
|
||||
@@ -24107,9 +24240,20 @@ Partial Class Ventas
|
||||
'DEBE AGREGAR LOS USADOS DE LA REMISION EN LA NOTA DE CREDITO
|
||||
If UsuarioActual.CveEmpresa = 140 AndAlso (ListaRemisionesNC IsNot Nothing AndAlso ListaRemisionesNC.Count > 0) Then
|
||||
|
||||
CrearDTNCCargo(ListaRemisionesNC, DtImpuestos, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
If AplicaRNCXDetalle Then
|
||||
CrearDTNCCargoDetalle(ListaRemisionesNC, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
Else
|
||||
CrearDTNCCargo(ListaRemisionesNC, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
End If
|
||||
|
||||
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
|
||||
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=360481).FiltroPrimero("")
|
||||
'CONSULTA EL CONCEPTO DE NC
|
||||
Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
|
||||
Dim NCBonificacion As Integer = 0
|
||||
If ArrayNC.Length > 4 Then
|
||||
NCBonificacion = ArrayNC(4).ToEntero()
|
||||
End If
|
||||
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCBonificacion).FiltroPrimero("")
|
||||
If DrPSBonificacion IsNot Nothing Then
|
||||
CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
Else
|
||||
@@ -24170,42 +24314,104 @@ Partial Class Ventas
|
||||
UPCondicionesPago.Update()
|
||||
|
||||
End Sub
|
||||
Private Sub CrearDTNCCargo(ListaNC As List(Of Modelos.Factura), DtImpuestos As DataTable, ByRef TmpDTCargo As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
|
||||
For Each Dr As DataRow In DtImpuestos.Rows
|
||||
For Each RNC In ListaNC
|
||||
Dim UltimoRenglonRNC As Integer = 1
|
||||
For Each RowUsado As DataRow In RNC.DtDetalle.Rows
|
||||
Private Sub CrearDTNCCargo(ListaNC As List(Of Modelos.Factura), ByRef TmpDTCargo As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
|
||||
For Each RNC In ListaNC
|
||||
Dim UltimoRenglonRNC As Integer = 1
|
||||
Dim TotalAcumuladoRNC As Decimal = 0
|
||||
|
||||
Dim PorcentajeUsado = ((RowUsado("Total").ToString().ToDecimal() - RowUsado("Descuento").ToString().ToDecimal() + RowUsado("ImporteIVA").ToString().ToDecimal() + RowUsado("ImporteIEPS").ToString().ToDecimal() - RowUsado("ImporteRetIVA").ToString().ToDecimal() - RowUsado("ImporteRetISR").ToString().ToDecimal()) / RNC.Total) / ListaNC.Count
|
||||
Dim Obs = RowUsado("CodigoPS").ToString()
|
||||
For Each RowUsado As DataRow In RNC.DtDetalle.Rows
|
||||
|
||||
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
|
||||
Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
|
||||
Dim PorcentajeAplicado = (RNC.TotalRemNCAplicado / RNC.Total)
|
||||
|
||||
Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal() * PorcentajeAplicado
|
||||
|
||||
Dim Obs = RowUsado("CodigoPS").ToString()
|
||||
|
||||
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
|
||||
Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
|
||||
End If
|
||||
|
||||
Dim ImportePU = RowUsado("PU").ToString().ToDecimal
|
||||
|
||||
Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU)
|
||||
|
||||
Dim ImporteIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
|
||||
Dim ImporteIEPS = (TotalCalculableImpuestos * RowUsado("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2)
|
||||
Dim ImporteRetIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2)
|
||||
Dim ImporteRetISR = (TotalCalculableImpuestos * RowUsado("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2)
|
||||
Dim ImporteTotal = TotalCalculableImpuestos
|
||||
|
||||
TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
|
||||
|
||||
'SI ES EL ULTIMO REGLON REALIZA UN AJUSTE
|
||||
If UltimoRenglonRNC = RNC.DtDetalle.Rows.Count Then
|
||||
Dim Ajuste As Decimal = 0
|
||||
If Math.Abs(RNC.TotalRemNCAplicado - TotalAcumuladoRNC) > 0.00 Then
|
||||
Ajuste = RNC.TotalRemNCAplicado - TotalAcumuladoRNC
|
||||
|
||||
ImporteIVA += Ajuste
|
||||
End If
|
||||
End If
|
||||
UltimoRenglonRNC += 1
|
||||
|
||||
Dim ImportePU = Dr("ImportePU").ToString().ToDecimal * PorcentajeUsado
|
||||
Dim ImporteIVA = Dr("ImporteIVA").ToString().ToDecimal * PorcentajeUsado
|
||||
Dim ImporteRetIVA = Dr("ImporteRetIVA").ToString().ToDecimal * PorcentajeUsado
|
||||
Dim ImporteRetISR = Dr("ImporteRetISR").ToString().ToDecimal * PorcentajeUsado
|
||||
Dim ImporteIEPS = Dr("ImporteIEPS").ToString().ToDecimal * PorcentajeUsado
|
||||
Dim ImporteTotal = Dr("ImporteTotal").ToString().ToDecimal * PorcentajeUsado
|
||||
|
||||
'If UltimoRenglonRNC = RNC.DtDetalle.Rows.Count Then
|
||||
' ImportePU += Ajuste
|
||||
'End If
|
||||
|
||||
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
|
||||
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
|
||||
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
|
||||
Obs, 1, ImportePU, Dr("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, Dr("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
|
||||
Dr("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, Dr("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0.0, ImporteTotal, "", "", -1, -1,
|
||||
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
|
||||
|
||||
UltimoRenglonRNC += 1
|
||||
Next
|
||||
|
||||
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.0, ImporteTotal, "", "", -1, -1,
|
||||
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalle").ToString().ToEntero())
|
||||
Next
|
||||
|
||||
Next
|
||||
End Sub
|
||||
Private Sub CrearDTNCCargoDetalle(ListaNC As List(Of Modelos.Factura), ByRef TmpDTCargo As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
|
||||
For Each RNC In ListaNC
|
||||
Dim UltimoRenglonRNC As Integer = 1
|
||||
Dim TotalAcumuladoRNC As Decimal = 0
|
||||
|
||||
For Each RowUsado As DataRow In Me.TmpDTRNCDetalleSelecciondas.FiltraParametros($"CveVenta={RNC.CveVenta}").Rows
|
||||
|
||||
Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal()
|
||||
|
||||
Dim Obs = RowUsado("CodigoPS").ToString()
|
||||
|
||||
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
|
||||
Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
|
||||
End If
|
||||
|
||||
Dim ImportePU = RowUsado("PU").ToString().ToDecimal
|
||||
|
||||
Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU)
|
||||
|
||||
Dim ImporteIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
|
||||
Dim ImporteIEPS = 0 '(TotalCalculableImpuestos * RowUsado("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2)
|
||||
Dim ImporteRetIVA = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2)
|
||||
Dim ImporteRetISR = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2)
|
||||
Dim ImporteTotal = TotalCalculableImpuestos
|
||||
|
||||
TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA)
|
||||
|
||||
'SI ES EL ULTIMO REGLON REALIZA UN AJUSTE
|
||||
If UltimoRenglonRNC = RNC.DtDetalle.Rows.Count Then
|
||||
Dim Ajuste As Decimal = 0
|
||||
If Math.Abs(RNC.TotalRemNCAplicado - TotalAcumuladoRNC) > 0.00 Then
|
||||
Ajuste = RNC.TotalRemNCAplicado - TotalAcumuladoRNC
|
||||
|
||||
ImporteIVA += Ajuste
|
||||
End If
|
||||
End If
|
||||
UltimoRenglonRNC += 1
|
||||
|
||||
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
|
||||
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.0, ImporteTotal, "", "", -1, -1,
|
||||
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero())
|
||||
Next
|
||||
|
||||
Next
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub CrearDTNCBonificacion(ListaNC As List(Of Modelos.Factura), DtImpuestosBonificacion As DataTable, ByRef TmpDTNC As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
|
||||
'SI TIENE DE BONIFICACION LOS AGREGA
|
||||
If DtImpuestosBonificacion IsNot Nothing AndAlso ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
|
||||
@@ -24213,39 +24419,54 @@ Partial Class Ventas
|
||||
TmpDTDescNCBonificacion = TmpDTNC.Clone()
|
||||
TmpDTDescNCBonificacion.Clear()
|
||||
|
||||
For Each Dr As DataRow In DtImpuestosBonificacion.Rows
|
||||
For Each RNC In ListaNCBonificacion
|
||||
Dim UltimoRenglonRNC As Integer = 1
|
||||
For Each RNCBonificacion In ListaNCBonificacion
|
||||
Dim UltimoRenglonRNC As Integer = 1
|
||||
Dim TotalAcumuladoRNC As Decimal = 0
|
||||
|
||||
Dim RNCCargo = ListaNC.Where(Function(f) f.CveVenta = RNC.CveVentaRNCCargo).FirstOrDefault()
|
||||
Dim RNCCargo = ListaNC.Where(Function(f) f.CveVenta = RNCBonificacion.CveVentaRNCCargo).FirstOrDefault()
|
||||
|
||||
For Each RowCargo As DataRow In RNCCargo.DtDetalle.Rows
|
||||
For Each RowCargo As DataRow In RNCCargo.DtDetalle.Rows
|
||||
|
||||
Dim PorcentajeCargo = ((RowCargo("Total").ToString().ToDecimal() - RowCargo("Descuento").ToString().ToDecimal() + RowCargo("ImporteIVA").ToString().ToDecimal() + RowCargo("ImporteIEPS").ToString().ToDecimal() - RowCargo("ImporteRetIVA").ToString().ToDecimal() - RowCargo("ImporteRetISR").ToString().ToDecimal()) / RNCCargo.Total) / ListaNCBonificacion.Count
|
||||
Dim PorcentajeAplicado = (RNCBonificacion.TotalRemNCAplicado / RNCBonificacion.Total)
|
||||
|
||||
Dim Obs = RowCargo("CodigoPS").ToString()
|
||||
Dim Cantidad As Decimal = RowCargo("Cantidad").ToString().ToDecimal() * PorcentajeAplicado
|
||||
|
||||
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
|
||||
Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
|
||||
Dim Obs = RowCargo("CodigoPS").ToString()
|
||||
|
||||
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
|
||||
Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
|
||||
End If
|
||||
|
||||
Dim ImportePU = RowCargo("PUBonificacion").ToString().ToDecimal
|
||||
|
||||
Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU)
|
||||
|
||||
Dim ImporteIVA = (TotalCalculableImpuestos * RowCargo("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
|
||||
Dim ImporteIEPS = (TotalCalculableImpuestos * RowCargo("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2)
|
||||
Dim ImporteRetIVA = (TotalCalculableImpuestos * RowCargo("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2)
|
||||
Dim ImporteRetISR = (TotalCalculableImpuestos * RowCargo("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2)
|
||||
Dim ImporteTotal = TotalCalculableImpuestos
|
||||
|
||||
TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
|
||||
|
||||
'SI ES EL ULTIMO REGLON REALIZA UN AJUSTE
|
||||
If UltimoRenglonRNC = RNCCargo.DtDetalle.Rows.Count Then
|
||||
Dim Ajuste As Decimal = 0
|
||||
If Math.Abs(RNCBonificacion.TotalRemNCAplicado - TotalAcumuladoRNC) > 0.00 Then
|
||||
Ajuste = RNCBonificacion.TotalRemNCAplicado - TotalAcumuladoRNC
|
||||
|
||||
ImporteIVA += Ajuste
|
||||
End If
|
||||
End If
|
||||
UltimoRenglonRNC += 1
|
||||
|
||||
Dim ImportePU = Dr("ImportePU").ToString().ToDecimal * PorcentajeCargo
|
||||
Dim ImporteIVA = Dr("ImporteIVA").ToString().ToDecimal * PorcentajeCargo
|
||||
Dim ImporteRetIVA = Dr("ImporteRetIVA").ToString().ToDecimal * PorcentajeCargo
|
||||
Dim ImporteRetISR = Dr("ImporteRetISR").ToString().ToDecimal * PorcentajeCargo
|
||||
Dim ImporteIEPS = Dr("ImporteIEPS").ToString().ToDecimal * PorcentajeCargo
|
||||
Dim ImporteTotal = Dr("ImporteTotal").ToString().ToDecimal * PorcentajeCargo
|
||||
|
||||
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
|
||||
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
|
||||
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
|
||||
Obs, 1, ImportePU, Dr("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, Dr("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
|
||||
Dr("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, Dr("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0.0, ImporteTotal, "", "", -1, -1,
|
||||
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.0, ImporteTotal, "", "", -1, -1,
|
||||
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
|
||||
|
||||
UltimoRenglonRNC += 1
|
||||
Next
|
||||
|
||||
Next
|
||||
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
@@ -24360,7 +24581,7 @@ Partial Class Ventas
|
||||
PorcentajeRetISR As Double, ImporteRetISR As Double, PorcentajeIEPS As Double, ImporteIEPS As Double, TipoDescuento As Integer, Descuento As Double,
|
||||
Total As Double, 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)
|
||||
CveVentaDetalleRemision As Integer, CveVentaDetalleCotizacion As Integer, Optional CveTamaño As Integer = -1, Optional CveVentaDetalleRNC As Integer = -1)
|
||||
|
||||
Dim Row As DataRow = Nothing
|
||||
Row = TmpDT.NewRow()
|
||||
@@ -24420,6 +24641,7 @@ Partial Class Ventas
|
||||
Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
|
||||
|
||||
Row("CveTamaño") = CveTamaño
|
||||
Row("CveVentaDetalleRNC") = CveVentaDetalleRNC
|
||||
|
||||
TmpDT.Rows.Add(Row)
|
||||
End Sub
|
||||
@@ -27235,6 +27457,8 @@ Partial Class Ventas
|
||||
|
||||
#Region "D E S C U E N T O S X R E M I S I O N D E N O T A D E C R E D I T O"
|
||||
Protected Sub BtnAplicarRemisionNC_Click(sender As Object, e As EventArgs)
|
||||
Me.AplicaRNCXDetalle = False
|
||||
|
||||
If ListaRemisionesNC Is Nothing Then
|
||||
ListaRemisionesNC = New List(Of Modelos.Factura)
|
||||
Else
|
||||
@@ -27248,69 +27472,139 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
Dim TotalRemNCAplicado As Decimal = 0
|
||||
For Each GvRow As GridViewRow In GvRemisionesNC.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
If GvRow.FCCheckBox("ChkAplicar").Checked Then
|
||||
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
|
||||
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
|
||||
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
|
||||
|
||||
If RemNC.TotalRemNCAplicado <= 0 Then
|
||||
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
|
||||
ListaRemisionesNC.Clear()
|
||||
Exit Sub
|
||||
If ChkMostarProductosRNC.Checked Then
|
||||
|
||||
Me.AplicaRNCXDetalle = True
|
||||
|
||||
For Each GvRow As GridViewRow In GvRemisionesNCDetalle.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
If GvRow.FCCheckBox("ChkAplicar").Checked Then
|
||||
Dim Rows = TmpDTRNCDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}")
|
||||
For Each row In Rows
|
||||
row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToEntero()
|
||||
TmpDTRNCDetalleSelecciondas.Rows.Add(row.ItemArray)
|
||||
Next
|
||||
End If
|
||||
|
||||
ListaRemisionesNC.Add(RemNC)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
'SI TIENE ALGUN AJUSTE O GARANTIA
|
||||
If ListaRemisionesNC.Any(Function(RNC) RNC.Num2 = 1) Then
|
||||
For Each RNC In ListaRemisionesNC.Where(Function(x) x.Num2 = 1)
|
||||
Dim Salir As Boolean = False
|
||||
Using ObjAcum As New ClsAcumuladores
|
||||
If ObjAcum.GetGarantiasDetalle(RNC.CveVenta) Then
|
||||
'SI ES GARANTIA TOTAL
|
||||
If ObjAcum.DtResultados.MAX("PorcentajeAjuste") = "1" Then
|
||||
DdlNCPS.SelectedValueExist(443174)
|
||||
DdlNCPS.Enabled = False
|
||||
Salir = True
|
||||
Else
|
||||
DdlNCPS.SelectedValueExist(443173)
|
||||
DdlNCPS.Enabled = False
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
|
||||
If Salir Then
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each Dr As DataRow In TmpDTRNCDetalleSelecciondas.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows
|
||||
Dim RemNC As New Modelos.Factura(UsuarioActual, Dr("CveVenta").ToString().ToEntero(), UsuarioActual.CveEmpresa)
|
||||
|
||||
Dim TotalRNC As Decimal = 0
|
||||
For Each GvRow As GridViewRow In GvRemisionesNCDetalle.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If GvRow.FCCheckBox("ChkAplicar").Checked AndAlso GvRow.DataKey("CveVenta").ToEntero() = Dr("CveVenta").ToString().ToEntero() Then
|
||||
|
||||
Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal()
|
||||
Dim PU = GvRow.DataKey("PU").ToDecimal()
|
||||
Dim PorcentajeIVA As Decimal = GvRow.DataKey("PorcentajeIVA").ToDecimal()
|
||||
|
||||
Dim TotalCalculableImpuestos As Decimal = (Cantidad * PU)
|
||||
Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * PorcentajeIVA).RoundSQL(2)
|
||||
|
||||
Dim TotalRNCDetalle As Decimal = (TotalCalculableImpuestos + ImporteIVA)
|
||||
|
||||
TotalRNC += TotalRNCDetalle
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
RemNC.TotalRemNCAplicado = TotalRNC
|
||||
'MARCA LA VENTA QUE FUE USADA PARA EL FILTRO
|
||||
RemNC.Num3 = DdlVentaUsado.SelectedValue.ToEntero()
|
||||
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
|
||||
|
||||
If RemNC.TotalRemNCAplicado <= 0 Then
|
||||
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
|
||||
ListaRemisionesNC.Clear()
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
ListaRemisionesNC.Add(RemNC)
|
||||
Next
|
||||
|
||||
Else
|
||||
DdlNCPS.Enabled = True
|
||||
End If
|
||||
|
||||
For Each GvRow As GridViewRow In GvRemisionesNC.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
If GvRow.FCCheckBox("ChkAplicar").Checked Then
|
||||
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
|
||||
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
|
||||
'MARCA LA VENTA QUE FUE USADA PARA EL FILTRO
|
||||
RemNC.Num3 = DdlVentaUsado.SelectedValue.ToEntero()
|
||||
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
|
||||
|
||||
For Each GvRow As GridViewRow In GvRemisionesNCBon.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
If GvRow.FCCheckBox("ChkAplicar").Checked Then
|
||||
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
|
||||
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
|
||||
RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVentaRNCCargo").ToEntero()
|
||||
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
|
||||
If RemNC.TotalRemNCAplicado <= 0 Then
|
||||
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
|
||||
ListaRemisionesNC.Clear()
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If RemNC.TotalRemNCAplicado <= 0 Then
|
||||
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
|
||||
ListaNCBonificacion.Clear()
|
||||
Exit Sub
|
||||
ListaRemisionesNC.Add(RemNC)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
'SI TIENE ALGUN AJUSTE O GARANTIA
|
||||
If ListaRemisionesNC.Any(Function(RNC) RNC.Num2 = 1) Then
|
||||
For Each RNC In ListaRemisionesNC.Where(Function(x) x.Num2 = 1)
|
||||
Dim Salir As Boolean = False
|
||||
|
||||
Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
|
||||
Dim NCAjuste As Integer = -1
|
||||
Dim NCGarantiaTotal As Integer = -1
|
||||
If ArrayNC.Length > 2 Then
|
||||
NCAjuste = ArrayNC(1).ToEntero()
|
||||
NCGarantiaTotal = ArrayNC(2).ToEntero()
|
||||
End If
|
||||
|
||||
ListaNCBonificacion.Add(RemNC)
|
||||
End If
|
||||
Using ObjAcum As New ClsAcumuladores
|
||||
If ObjAcum.GetGarantiasDetalle(RNC.CveVenta) Then
|
||||
'SI ES GARANTIA TOTAL
|
||||
If ObjAcum.DtResultados.MAX("PorcentajeAjuste") = "1" Then
|
||||
DdlNCPS.SelectedValueExist(NCGarantiaTotal)
|
||||
DdlNCPS.Enabled = False
|
||||
Salir = True
|
||||
Else
|
||||
DdlNCPS.SelectedValueExist(NCAjuste)
|
||||
DdlNCPS.Enabled = False
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
|
||||
If Salir Then
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
DdlNCPS.Enabled = True
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
For Each GvRow As GridViewRow In GvRemisionesNCBon.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
If GvRow.FCCheckBox("ChkAplicar").Checked Then
|
||||
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
|
||||
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
|
||||
RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVentaRNCCargo").ToEntero()
|
||||
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
|
||||
|
||||
If RemNC.TotalRemNCAplicado <= 0 Then
|
||||
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
|
||||
ListaNCBonificacion.Clear()
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
ListaNCBonificacion.Add(RemNC)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
TxtImportesRemisionesNC.Text = TotalRemNCAplicado.FormatoNumero
|
||||
TxtNCImporte.Text = TotalRemNCAplicado.FormatoNumero
|
||||
@@ -27330,6 +27624,12 @@ Partial Class Ventas
|
||||
Dim CveSATNC = "84111506"
|
||||
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).Rows(0)
|
||||
|
||||
Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
|
||||
If ArrayNC.Length > 0 Then
|
||||
Dim CvePSNC As Integer = ArrayNC(0).ToEntero()
|
||||
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSNC, AplicaParaVenta:=1).Rows(0)
|
||||
End If
|
||||
|
||||
If DrPS Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
@@ -27372,14 +27672,22 @@ Partial Class Ventas
|
||||
If ListaNCDesc.Any(Function(RNC) RNC.Num2 = 1) Then
|
||||
For Each RNC In ListaRemisionesNC.Where(Function(x) x.Num2 = 1)
|
||||
Dim Salir As Boolean = False
|
||||
|
||||
Dim NCAjuste As Integer = -1
|
||||
Dim NCGarantiaTotal As Integer = -1
|
||||
If ArrayNC.Length > 2 Then
|
||||
NCAjuste = ArrayNC(1).ToEntero()
|
||||
NCGarantiaTotal = ArrayNC(2).ToEntero()
|
||||
End If
|
||||
|
||||
Using ObjAcum As New ClsAcumuladores
|
||||
If ObjAcum.GetGarantiasDetalle(RNC.CveVenta) Then
|
||||
'SI ES GARANTIA TOTAL
|
||||
If ObjAcum.DtResultados.MAX("PorcentajeAjuste") = "1" Then
|
||||
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=443174, AplicaParaVenta:=1).Rows(0)
|
||||
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCGarantiaTotal, AplicaParaVenta:=1).Rows(0)
|
||||
Salir = True
|
||||
Else
|
||||
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=443173, AplicaParaVenta:=1).Rows(0)
|
||||
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCAjuste, AplicaParaVenta:=1).Rows(0)
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
@@ -27499,7 +27807,7 @@ Partial Class Ventas
|
||||
#End Region
|
||||
|
||||
Protected Sub BtnModalAplicarRemisionesNC_Click(sender As Object, e As EventArgs)
|
||||
CargaRNC()
|
||||
ChkMostarProductosRNC_CheckedChanged(ChkMostarProductosRNC, EventArgs.Empty)
|
||||
RegistraScript("$('#ModalAplicarRemisionesNC').modal({backdrop: 'static', keyboard: false });")
|
||||
End Sub
|
||||
|
||||
@@ -28096,4 +28404,5 @@ Partial Class Ventas
|
||||
Public ImporteBonificacion As Decimal = 0
|
||||
Public IVABonificacion As Decimal = 0
|
||||
End Class
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user