Correciones en bonificaciones

This commit is contained in:
2021-08-09 15:35:25 -07:00
parent 2128c4a582
commit 907793665c

View File

@@ -25055,6 +25055,14 @@ Partial Class Ventas
End Sub End Sub
Protected Sub RblRNCTipo_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub RblRNCTipo_SelectedIndexChanged(sender As Object, e As EventArgs)
ChkMostarProductosRNC.Checked = False
DivRNCCargosDetalle.Visible = False
DivRNCCargos.Visible = True
ChkMostarProductosRNCBon.Checked = False
DivRNCBonificacionesDetalle.Visible = False
DivRNCBonificaciones.Visible = True
Select Case RblRNCTipo.SelectedValue Select Case RblRNCTipo.SelectedValue
Case "1" 'CARGOS Case "1" 'CARGOS
LtlCargos.Text = "CARGOS" LtlCargos.Text = "CARGOS"
@@ -25130,7 +25138,7 @@ Partial Class Ventas
If ChkMostarProductosRNC.Checked Then If ChkMostarProductosRNC.Checked Then
DivRNCCargos.Visible = False DivRNCCargos.Visible = False
DivRNCCargosDetalle.Visible = True DivRNCCargosDetalle.Visible = True
CargaRNCDetalle(DdlVentaUsado.SelectedValue.ToEntero()) CargaRNCDetalle(DdlVentaUsado.SelectedValue.ToEntero(), CargaSoloGarantias:=RblRNCTipo.SelectedValue = "3")
Else Else
DivRNCCargos.Visible = True DivRNCCargos.Visible = True
DivRNCCargosDetalle.Visible = False DivRNCCargosDetalle.Visible = False
@@ -25271,7 +25279,7 @@ Partial Class Ventas
UpDescNC.Update() UpDescNC.Update()
End Sub End Sub
Private Sub CargaRNCDetalle(Optional CveVentaUsado As Integer = -1) Private Sub CargaRNCDetalle(Optional CveVentaUsado As Integer = -1, Optional CargaSoloGarantias As Boolean = False)
Dim DtNC As DataTable = Nothing Dim DtNC As DataTable = Nothing
Dim ObjMovtos As New ClsMovimientos() Dim ObjMovtos As New ClsMovimientos()
@@ -25280,6 +25288,12 @@ Partial Class Ventas
End If End If
ObjMovtos.Dispose() ObjMovtos.Dispose()
If CargaSoloGarantias Then
TmpDTRNCDetalle = TmpDTRNCDetalle.FiltraParametros("EsGarantia = True")
Else
TmpDTRNCDetalle = TmpDTRNCDetalle.FiltraParametros("EsGarantia = False")
End If
Me.TmpDTRNCDetalle.Columns.Add(New DataColumn("CveVentaDetalleNCGenerada", GetType(Integer))) Me.TmpDTRNCDetalle.Columns.Add(New DataColumn("CveVentaDetalleNCGenerada", GetType(Integer)))
Me.TmpDTRNCDetalleSelecciondas = Nothing Me.TmpDTRNCDetalleSelecciondas = Nothing
@@ -25344,9 +25358,9 @@ Partial Class Ventas
Me.TmpDTRNCDetalleSelecciondas.Clear() Me.TmpDTRNCDetalleSelecciondas.Clear()
If CargarSoloGarantias Then If CargarSoloGarantias Then
GvDescNCCargosDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 1") GvDescNCCargosDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 1 AND EsGarantia = True")
Else Else
GvDescNCCargosDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 1") GvDescNCCargosDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 1 AND EsGarantia = False")
End If End If
GvDescNCCargosDetalle.DataBind() GvDescNCCargosDetalle.DataBind()
@@ -25394,28 +25408,31 @@ Partial Class Ventas
GvRemisionesNCBonDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 2") GvRemisionesNCBonDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 2")
GvRemisionesNCBonDetalle.DataBind() GvRemisionesNCBonDetalle.DataBind()
Dim ObjAcum As New ClsAcumuladores If DdlVentaUsado.SelectedValue.ToEntero() > 0 Then
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then Dim DtDetalleFactura As DataTable = Nothing
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(5) Using ObjVentas As New ClsVentas
DivSMU.Visible = True If ObjVentas.GetVentaDetalle(DdlVentaUsado.SelectedValue.ToEntero()) Then
HdnSMUBon.Value = RowUsadosNC("ValorConImpuestos").ToString() DtDetalleFactura = ObjVentas.DtResultados.FiltraParametros("EsCargo = True")
LtlSMUBon.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2) End If
End Using
Dim ImporteBon As Decimal = DtDetalleFactura.SUMD("PUBonificacion") * (1 + DtDetalleFactura.MAX("PorcentajeIVA").ToDecimal())
LtlSMUBon.Text = String.Format("{0:N2}", ImporteBon)
HdnSMUBon.Value = ImporteBon.ToString()
DtDetalleFactura.Dispose()
Else Else
'DivSMU.Visible = False Dim ObjAcum2 As New ClsAcumuladores
HdnSMUBon.Value = "0" If ObjAcum2.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
LtlSMUBon.Text = "0" Dim RowUsadosNC As DataRow = ObjAcum2.DtResultados.Rows(6)
HdnSMUBon.Value = RowUsadosNC("ValorConImpuestos").ToString()
LtlSMUBon.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
Else
HdnSMUBon.Value = "0"
LtlSMUBon.Text = "0"
End If
ObjAcum2.Dispose()
End If End If
ObjAcum.Dispose()
'Dim SaldoMaximoUsados As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
'If SaldoMaximoUsados > 0 Then
' HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString()
' LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUsados)
'Else
' HdnSaldoMaximoUsados.Value = "0"
' LblSaldoMaximoUsados.Text = "0"
'End If
UpModalRemisionesNC.Update() UpModalRemisionesNC.Update()
End Sub End Sub
@@ -25528,17 +25545,32 @@ Partial Class Ventas
'LtlSMUBon.Text = String.Format("{0:N2}", SMUBon) 'LtlSMUBon.Text = String.Format("{0:N2}", SMUBon)
'HdnSMUBon.Value = SMUBon.ToString() 'HdnSMUBon.Value = SMUBon.ToString()
If DdlVentaUsado.SelectedValue.ToEntero() > 0 Then
Dim DtDetalleFactura As DataTable = Nothing
Using ObjVentas As New ClsVentas
If ObjVentas.GetVentaDetalle(DdlVentaUsado.SelectedValue.ToEntero()) Then
DtDetalleFactura = ObjVentas.DtResultados.FiltraParametros("EsCargo = True")
End If
End Using
Dim ImporteBon As Decimal = DtDetalleFactura.SUMD("PUBonificacion") * (1 + DtDetalleFactura.MAX("PorcentajeIVA").ToDecimal())
Dim ObjAcum2 As New ClsAcumuladores LtlSMUBon.Text = String.Format("{0:N2}", ImporteBon)
If ObjAcum2.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then HdnSMUBon.Value = ImporteBon.ToString()
Dim RowUsadosNC As DataRow = ObjAcum2.DtResultados.Rows(5)
HdnSMUBon.Value = RowUsadosNC("ValorConImpuestos").ToString() DtDetalleFactura.Dispose()
LtlSMUBon.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
Else Else
HdnSMUBon.Value = "0" Dim ObjAcum2 As New ClsAcumuladores
LtlSMUBon.Text = "0" If ObjAcum2.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
Dim RowUsadosNC As DataRow = ObjAcum2.DtResultados.Rows(6)
HdnSMUBon.Value = RowUsadosNC("ValorConImpuestos").ToString()
LtlSMUBon.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
Else
HdnSMUBon.Value = "0"
LtlSMUBon.Text = "0"
End If
ObjAcum2.Dispose()
End If End If
ObjAcum2.Dispose()
UpModalRemisionesNC.Update() UpModalRemisionesNC.Update()
End If End If