This commit is contained in:
2021-08-17 21:17:31 -07:00
39 changed files with 50420 additions and 1992 deletions

View File

@@ -6968,7 +6968,10 @@ Partial Class Ventas
Dim CuentaPredial As String
Cantidad = GvPS.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.ToDecimal
PU = (GvPS.Rows(e.RowIndex).FCTextBox("TxtPrecio").Text.ToDecimal).RoundSQL(6)
ObjDescuento.ImporteDescuento = (GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Text.ToDecimal).RoundSQL(NumeroDecimales)
Dim DescuentoManual As Decimal = (GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Text.ToDecimal).RoundSQL(NumeroDecimales)
ObjDescuento.ImporteDescuento = DescuentoManual
CuentaPredial = GvPS.Rows(e.RowIndex).FCTextBox("TxtPredial").Text.Trim
If PU <= 0 AndAlso UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
@@ -6980,6 +6983,11 @@ Partial Class Ventas
ObjDescuento = CalcularDescuentos(TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero(), Cantidad, PU)
End If
'SI ESTA HABILITADO LA OPCION DE DESCUENTO, SE AGREGO UN DESCUENTO MANUAL Y NO TIENE PROMOCION
If GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Enabled AndAlso (ObjDescuento.CvePromocionDetalle <= 0 AndAlso ObjDescuento.ImporteDescuento <= 0) AndAlso DescuentoManual > 0 Then
ObjDescuento.ImporteDescuento = DescuentoManual
End If
Dim CantidadOriginal As Decimal = GvPS.Rows(e.RowIndex).DataKey("Cantidad").ToDecimal()
Dim DatarowPS As DataRow = Nothing
@@ -25057,6 +25065,14 @@ Partial Class Ventas
End Sub
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
Case "1" 'CARGOS
LtlCargos.Text = "CARGOS"
@@ -25132,7 +25148,7 @@ Partial Class Ventas
If ChkMostarProductosRNC.Checked Then
DivRNCCargos.Visible = False
DivRNCCargosDetalle.Visible = True
CargaRNCDetalle(DdlVentaUsado.SelectedValue.ToEntero())
CargaRNCDetalle(DdlVentaUsado.SelectedValue.ToEntero(), CargaSoloGarantias:=RblRNCTipo.SelectedValue = "3")
Else
DivRNCCargos.Visible = True
DivRNCCargosDetalle.Visible = False
@@ -25204,26 +25220,38 @@ Partial Class Ventas
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
Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
If CargarSoloGarantias Then
Dim SaldoMaximo As Decimal = DtNC.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True")
If SaldoMaximo > 0 Then
HdnSaldoMaximoUsados.Value = RowUsadosNC("ValorConImpuestos").ToString()
LtlSMU.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
HdnSaldoMaximoUsados.Value = SaldoMaximo.ToString()
LtlSMU.Text = SaldoMaximo.FormatoNumero(2)
Else
HdnSaldoMaximoUsados.Value = "0"
LtlSMU.Text = "0"
End If
Else
'DivSMU.Visible = False
HdnSaldoMaximoUsados.Value = "0"
LtlSMU.Text = "0"
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2)
DivSMU.Visible = True
Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
If SaldoMaximo > 0 Then
HdnSaldoMaximoUsados.Value = RowUsadosNC("ValorConImpuestos").ToString()
LtlSMU.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
Else
HdnSaldoMaximoUsados.Value = "0"
LtlSMU.Text = "0"
End If
Else
'DivSMU.Visible = False
HdnSaldoMaximoUsados.Value = "0"
LtlSMU.Text = "0"
End If
ObjAcum.Dispose()
End If
ObjAcum.Dispose()
End If
Else
HdnSaldoMaximoUsados.Value = "0"
@@ -25273,7 +25301,7 @@ Partial Class Ventas
UpDescNC.Update()
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 ObjMovtos As New ClsMovimientos()
@@ -25282,6 +25310,12 @@ Partial Class Ventas
End If
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.TmpDTRNCDetalleSelecciondas = Nothing
@@ -25313,18 +25347,30 @@ Partial Class Ventas
End If
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)
If CargaSoloGarantias Then
Dim SaldoMaximo As Decimal = TmpDTRNCDetalle.SUMD("Total", "TipoRNC = 1")
If SaldoMaximo > 0 Then
HdnSaldoMaximoUsados.Value = SaldoMaximo.ToString()
LtlSMU.Text = SaldoMaximo.FormatoNumero(2)
Else
HdnSaldoMaximoUsados.Value = "0"
LtlSMU.Text = "0"
End If
Else
'DivSMU.Visible = False
HdnSaldoMaximoUsados.Value = "0"
LtlSMU.Text = "0"
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"
LtlSMU.Text = "0"
End If
ObjAcum.Dispose()
End If
ObjAcum.Dispose()
End If
UpModalRemisionesNC.Update()
@@ -25346,9 +25392,9 @@ Partial Class Ventas
Me.TmpDTRNCDetalleSelecciondas.Clear()
If CargarSoloGarantias Then
GvDescNCCargosDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 1")
GvDescNCCargosDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 1 AND EsGarantia = True")
Else
GvDescNCCargosDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 1")
GvDescNCCargosDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 1 AND EsGarantia = False")
End If
GvDescNCCargosDetalle.DataBind()
@@ -25396,28 +25442,31 @@ Partial Class Ventas
GvRemisionesNCBonDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 2")
GvRemisionesNCBonDetalle.DataBind()
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(5)
DivSMU.Visible = True
HdnSMUBon.Value = RowUsadosNC("ValorConImpuestos").ToString()
LtlSMUBon.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
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())
LtlSMUBon.Text = String.Format("{0:N2}", ImporteBon)
HdnSMUBon.Value = ImporteBon.ToString()
DtDetalleFactura.Dispose()
Else
'DivSMU.Visible = False
HdnSMUBon.Value = "0"
LtlSMUBon.Text = "0"
If TmpDTRNCBonificacionesSeleccionadas IsNot Nothing Then
Dim SaldoMaximo As Decimal = TmpDTRNCBonificacionesSeleccionadas.SUMD("Saldo")
If SaldoMaximo > 0 Then
HdnSMUBon.Value = SaldoMaximo.ToString()
LtlSMUBon.Text = SaldoMaximo.FormatoNumero(2)
Else
HdnSMUBon.Value = "0"
LtlSMUBon.Text = "0"
End If
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()
End Sub
@@ -25530,17 +25579,30 @@ Partial Class Ventas
'LtlSMUBon.Text = String.Format("{0:N2}", SMUBon)
'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
If ObjAcum2.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
Dim RowUsadosNC As DataRow = ObjAcum2.DtResultados.Rows(5)
HdnSMUBon.Value = RowUsadosNC("ValorConImpuestos").ToString()
LtlSMUBon.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
LtlSMUBon.Text = String.Format("{0:N2}", ImporteBon)
HdnSMUBon.Value = ImporteBon.ToString()
DtDetalleFactura.Dispose()
Else
HdnSMUBon.Value = "0"
LtlSMUBon.Text = "0"
Dim SaldoMaximo As Decimal = TmpDTRNCBonificacionesSeleccionadas.SUMD("Saldo")
If SaldoMaximo > 0 Then
HdnSMUBon.Value = SaldoMaximo.ToString()
LtlSMUBon.Text = SaldoMaximo.FormatoNumero(2)
Else
HdnSMUBon.Value = "0"
LtlSMUBon.Text = "0"
End If
End If
ObjAcum2.Dispose()
UpModalRemisionesNC.Update()
End If
@@ -26303,8 +26365,14 @@ Partial Class Ventas
'SI ES ACUMULADOR LAS OBSERVACIOENS DEBEN SER EL NOMBRE DEL ACUMULADOR
If GlobalDTAcumTamaños().FiltroPrimero($"CvePSCargo = {CvePSCargo}") IsNot Nothing Then
Obs = RowUsado("CodigoPS").ToString()
'Else
' Obs = RowUsado("Obs").ToString()
End If
'SI TIENE BCI EN LAS OBSERVACIONES AGREGARLO A LA FACTURA
If Not String.IsNullOrEmpty(RowUsado("Observaciones").ToString()) Then
If String.IsNullOrEmpty(Obs) Then
Obs = RowUsado("Observaciones").ToString()
Else
Obs = String.Format("{0} - {1}", Obs, RowUsado("Observaciones").ToString())
End If
End If
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then