diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 5dadb0640..4790a1252 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -25055,6 +25055,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" @@ -25130,7 +25138,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 @@ -25271,7 +25279,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() @@ -25280,6 +25288,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 @@ -25344,9 +25358,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() @@ -25394,28 +25408,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" + Dim ObjAcum2 As New ClsAcumuladores + 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 - 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 @@ -25528,17 +25545,32 @@ 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 ObjAcum2 As New ClsAcumuladores + 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 - ObjAcum2.Dispose() + UpModalRemisionesNC.Update() End If