diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb
index 2f7ac71dc..a52ab1a98 100644
--- a/App_Code/ClsAcumuladores.vb
+++ b/App_Code/ClsAcumuladores.vb
@@ -833,7 +833,7 @@ Public Class ClsAcumuladores
#Region "P O L I Z A - V I R T U A L"
Public Function AddPolizaVirtual(CveVenta As Integer, CveVentaDetalle As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, Descuento As Decimal, Total As Decimal,
TipoServicio As Integer, TipoPoliza As Integer, CveModeloAuto As Integer, AnioVehiculo As Integer, TieneUsado As Boolean, FechaUsado As DateTime,
- CvePSUsado As Integer, CveBCIUsado As Integer) As Boolean
+ CvePSUsado As Integer, CveBCIUsado As Integer, CveMarcaUsado As Integer) As Boolean
Dim Retorno As Boolean = False
SqlDataAdapter("PA_Vta_PolizaVirtualAdd")
With SqlAdapter.SelectCommand.Parameters
@@ -852,6 +852,7 @@ Public Class ClsAcumuladores
.Add("@FechaUsado", SqlDbType.DateTime).Value = FechaUsado
.Add("@CvePSUsado", SqlDbType.Int).Value = CvePSUsado
.Add("@CveBCIUsado", SqlDbType.Int).Value = CveBCIUsado
+ .Add("@CveMarcaUsado", SqlDbType.Int).Value = CveMarcaUsado
End With
Try
SqlAdapter.Fill(Data)
diff --git a/Ventas/PV.aspx b/Ventas/PV.aspx
index 0ac8d7586..0fb66d53a 100644
--- a/Ventas/PV.aspx
+++ b/Ventas/PV.aspx
@@ -2746,58 +2746,81 @@
-
-
-
-
-
-
+
+
+
+
+ Datos de Usados
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -3562,37 +3585,37 @@
$get(Row).style.backgroundColor = "#82b6db";
$get(Obj).focus();
var total = parseFloat($('#<%= LblSaldoVenta.ClientID%>').text().replace(',', ''));
- $get(Obj).value = 0;
- var suma = 0;
- $('#<%= GVAnticipos.ClientID%> input[type="text"]').each(function (index) {
- var currentsaldo = parseFloat($(this).val())
- if (isNaN(currentsaldo)) { currentsaldo = 0 }
- suma = currentsaldo + suma;
- });
- var txtvalue = total - suma;
- if (txtvalue < 0) { txtvalue = 0; }
- if (txtvalue < Saldo) { Saldo = txtvalue.toFixed(2); }
- $get(Obj).value = Saldo;
- $get("HdnAnticipos").value = parseFloat($get("HdnAnticipos").value) + parseFloat(Saldo);
- } else {
- $get(Obj).readOnly = true;
- $get("HdnAnticipos").value = parseFloat($get("HdnAnticipos").value) - parseFloat($get(Obj).value);
- $get(Obj).value = "";
- $get(Row).style.backgroundColor = "#ffffff";
- }
- //if ($("input:checkbox:not(:checked)"))
- SetText2($get("LblTotalAnticipos"), formato_numero($get("HdnAnticipos").value, 2, '.', ','));
- }
- function imprimircotizacion() {
- __doPostBack('ctl00$HB$LnkImprimir', '');
- }
- function ValidaMontoMenor(Obj, Monto) {
- debugger;
- Monto = ToDouble($('#C_Tab_TabGenerales_TxtTotal').val())
-
- var ValorTxt = Obj.value;
+ $get(Obj).value = 0;
var suma = 0;
- var total = parseFloat($('#<%= LblSaldoVenta.ClientID%>').text().replace(',', ''));
+ $('#<%= GVAnticipos.ClientID%> input[type="text"]').each(function (index) {
+ var currentsaldo = parseFloat($(this).val())
+ if (isNaN(currentsaldo)) { currentsaldo = 0 }
+ suma = currentsaldo + suma;
+ });
+ var txtvalue = total - suma;
+ if (txtvalue < 0) { txtvalue = 0; }
+ if (txtvalue < Saldo) { Saldo = txtvalue.toFixed(2); }
+ $get(Obj).value = Saldo;
+ $get("HdnAnticipos").value = parseFloat($get("HdnAnticipos").value) + parseFloat(Saldo);
+ } else {
+ $get(Obj).readOnly = true;
+ $get("HdnAnticipos").value = parseFloat($get("HdnAnticipos").value) - parseFloat($get(Obj).value);
+ $get(Obj).value = "";
+ $get(Row).style.backgroundColor = "#ffffff";
+ }
+ //if ($("input:checkbox:not(:checked)"))
+ SetText2($get("LblTotalAnticipos"), formato_numero($get("HdnAnticipos").value, 2, '.', ','));
+ }
+ function imprimircotizacion() {
+ __doPostBack('ctl00$HB$LnkImprimir', '');
+ }
+ function ValidaMontoMenor(Obj, Monto) {
+ debugger;
+ Monto = ToDouble($('#C_Tab_TabGenerales_TxtTotal').val())
+
+ var ValorTxt = Obj.value;
+ var suma = 0;
+ var total = parseFloat($('#<%= LblSaldoVenta.ClientID%>').text().replace(',', ''));
$('#<%= GVAnticipos.ClientID%> input[type="text"]').each(function (index) {
var currentsaldo = parseFloat($(this).val())
if (isNaN(currentsaldo)) { currentsaldo = 0 }
diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb
index d03fdcbe8..fafcab128 100644
--- a/Ventas/PV.aspx.vb
+++ b/Ventas/PV.aspx.vb
@@ -1271,15 +1271,22 @@ Partial Class PV
Using ObjMarcas As New ClsProductosServicios
If ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) Then
- DdlMarcaPS.DataSource = ObjMarcas.DtResultados
- DdlMarcaPSAjuste.DataSource = ObjMarcas.DtResultados
+ DdlMarcaPS.DataSource = ObjMarcas.DtResultados.Copy()
+ DdlMarcaPSAjuste.DataSource = ObjMarcas.DtResultados.Copy()
+ End If
+
+ If ObjMarcas.GetMarcasUsados(UsuarioActual.CveEmpresa) Then
+ DdlMarcaUsado.DataSource = ObjMarcas.DtResultados.Copy()
End If
End Using
+
DdlMarcaPS.DataBind()
DdlMarcaPSAjuste.DataBind()
+ DdlMarcaUsado.DataBind()
DdlMarcaPS.Items.Insert(0, New ListItem("Todas", "-1"))
DdlMarcaPSAjuste.Items.Insert(0, New ListItem("Todas", "-1"))
+ DdlMarcaUsado.Items.Insert(0, New ListItem("Seleccione", "-1"))
UpModalVenta.Update()
UpAjuste.Update()
@@ -2005,7 +2012,7 @@ Partial Class PV
For Each drow As DataRow In TmpDTPolizaVirtual.Rows
If ObjAcum.AddPolizaVirtual(CveVenta, drow("CveVentaDetalle").ToString().ToEntero(), drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("Descuento").ToString.ToDecimal,
drow("Total").ToString.ToDecimal, drow("TipoServicio").ToString.ToEntero, drow("TipoPoliza").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero, drow("AnioVehiculo").ToString.ToEntero, CBool(drow("TieneUsado").ToString),
- drow("FechaUsado").ToString().ToDateTime, drow("CvePSUsado").ToString.ToEntero, drow("CveBCIUsado").ToString.ToEntero) Then
+ drow("FechaUsado").ToString().ToDateTime, drow("CvePSUsado").ToString.ToEntero, drow("CveBCIUsado").ToString.ToEntero, drow("CveMarcaUsado").ToString.ToEntero) Then
Else
OcurrioError = True
Exit For
@@ -3255,17 +3262,47 @@ Partial Class PV
If ObjFactura.CveCliente > 0 Then
If TmpDT.Rows.Count > 0 Then
- Dim Retorno = ObjFactura.EmitirFactura()
- If Retorno.CveVenta > 0 Then
- Dim SbAlert As New StringBuilder
- SbAlert.AppendFormat("{0} ", Retorno.Mensajes(Retorno.Mensajes.Count - 1))
- SbAlert.AppendFormat("
", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta)))
+ Dim TieneError As Boolean = False
- Dim urlFactura As String = $"/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta))}"
- Dim urlAjuste As String = ""
+ Dim ObjAcum As New ClsAcumuladores
+ Dim ObjContPaq As ClsContPAQi = Nothing
+ If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
+ ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa)
+ End If
+
+ Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
+ Dim urlFactura As String = ""
+ Dim urlAjuste = ""
+ Dim SbAlert As New StringBuilder
+
+ Try
+ Retorno = ObjFactura.EmitirFactura(Transac:=ObjAcum.IniciaTransacSQL(), ObjContPaqTransac:=ObjContPaq)
+
+ If Retorno IsNot Nothing AndAlso Retorno.CveVenta > 0 Then
+
+ If ObjFactura.TipoDocto = "Rem" Then
+ If ObjAcum.GetPolizasVirtuales(Retorno.CveVenta) Then
+ Dim DtPoliza As DataTable = ObjAcum.DtResultados.Copy()
+
+ For Each Row As DataRow In ObjFactura.DtPolizasVirtuales.Rows
+ Dim CvePolizaVirtual As Integer = DtPoliza.FiltroPrimeroValor("CvePolizaVirtual", $"CveVentaDetalle={Row("CveVentaDetalle")}").ToEntero()
+
+ If Not ObjAcum.UpdatePolizaVirtual(CvePolizaVirtual, Row("CveMarcaUsado").ToString().ToEntero(), Row("FechaUsado").ToString().ToDateTime()) Then
+ SbAlert.Append("Error al guardar la póliza virtual")
+ TieneError = True
+ Exit For
+ End If
+ Next
+
+ DtPoliza.Dispose()
+ Else
+ SbAlert.Append("Error al obtener la póliza virtual")
+ TieneError = True
+ End If
+
+ End If
- Using ObjAcum As New ClsAcumuladores
If ObjAcum.GetGarantiasDetalle(Retorno.CveVenta) Then
Dim RowGarantia As DataRow = ObjAcum.DtResultados.FiltroPrimero("")
If RowGarantia IsNot Nothing Then
@@ -3274,9 +3311,33 @@ Partial Class PV
urlAjuste = $"/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AJUSTE&CVEGARANTIADETALLE={0}", RowGarantia("CveGarantiaDetalle")))}"
End If
End If
- End Using
- Retorno.Mensajes(Retorno.Mensajes.Count - 1) = SbAlert.ToString()
+ SbAlert.AppendFormat("{0} ", Retorno.Mensajes(Retorno.Mensajes.Count - 1))
+ SbAlert.AppendFormat("
", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta)))
+
+ urlFactura = $"/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta))}"
+
+ Else
+ TieneError = True
+ End If
+ Catch ex As Exception
+ TieneError = True
+ OnError("Ocurrió un error al generar el documento", ex)
+ End Try
+
+ If TieneError Then
+ ObjAcum.RollBack()
+ If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
+
+ ObjAcum.Dispose()
+ If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
+
+ Else
+ ObjAcum.Commit()
+ If ObjContPaq IsNot Nothing Then ObjContPaq.Commit()
+
+ ObjAcum.Dispose()
+ If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
RegistraScript($"descargarPDF('{urlFactura}','{urlAjuste}');", "Imprimir")
@@ -3284,12 +3345,20 @@ Partial Class PV
If DivBloqueo.Visible Then
Retorno.LigaPV = "bloquearAcceso();"
End If
+ End If
+ If Retorno IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
+ Retorno.Mensajes(Retorno.Mensajes.Count - 1) = SbAlert.ToString()
End If
For Each Mensaje In Retorno.Mensajes
Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), If(Retorno.TieneError, "", Retorno.LigaPV), ShowCloseButton:=False)
Next
+
+ If ObjFactura IsNot Nothing Then
+ ObjFactura.Dispose()
+ End If
+
Else
Alert("No hay partidas agregadas a la factura", TipoMensaje.MsgAdvertencia)
End If
@@ -3783,11 +3852,11 @@ Partial Class PV
'Muestra la tabla de tamaños
If drPS("CveTamaño").ToString().ToEntero() > 0 Then
DivRecepcionUsados.Visible = True
- If DdlTipoComprobante.SelectedValue <> "Rem" Then
- GvRecepcionUsados.Columns(2).Visible = False
- Else
- GvRecepcionUsados.Columns(2).Visible = True
- End If
+ 'If DdlTipoComprobante.SelectedValue <> "Rem" Then
+ ' GvRecepcionUsados.Columns(2).Visible = False
+ 'Else
+ ' GvRecepcionUsados.Columns(2).Visible = True
+ 'End If
End If
DdlUnidadMedida.Items.Clear()
@@ -4335,11 +4404,13 @@ Partial Class PV
ChkAgregar.Checked = True
- For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
- If Gvr.RowType = DataControlRowType.DataRow Then
- Gvr.FCTextBox("TxtCantidad").Text = ""
- End If
- Next
+ 'For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
+ ' If Gvr.RowType = DataControlRowType.DataRow Then
+ ' Gvr.FCTextBox("TxtCantidad").Text = ""
+ ' End If
+ 'Next
+
+ DdlRecepcionUsados.SelectedValueExist("-1")
DivRecepcionUsados.Visible = False
LimpiaAjuste()
@@ -4590,14 +4661,20 @@ Partial Class PV
Dim Entregado As Decimal = 0
Dim UltimoEntregado As Decimal = 0
- For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
- If Gvr.RowType = DataControlRowType.DataRow Then
- If Gvr.FCTextBox("TxtCantidad").Text.ToEntero() > 0 Then
- Entregado += (Gvr.FCTextBox("TxtCantidad").Text.ToEntero * Gvr.DataKey("Cargo").ToDecimal)
- UltimoEntregado = Gvr.DataKey("Cargo").ToDecimal
- End If
- End If
- Next
+ 'For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
+ ' If Gvr.RowType = DataControlRowType.DataRow Then
+ ' If Gvr.FCTextBox("TxtCantidad").Text.ToEntero() > 0 Then
+ ' Entregado += (Gvr.FCTextBox("TxtCantidad").Text.ToEntero * Gvr.DataKey("Cargo").ToDecimal)
+ ' UltimoEntregado = Gvr.DataKey("Cargo").ToDecimal
+ ' End If
+ ' End If
+ 'Next
+ If DdlRecepcionUsados.SelectedValue.ToEntero() > 0 Then
+ Dim DrTamanio As DataRow = GlobalDTAcumTamaños.FiltroPrimero($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo = {DdlRecepcionUsados.SelectedValue}")
+
+ Entregado += (1D * DrTamanio("Cargo").ToString().ToDecimal)
+ UltimoEntregado += (DrTamanio("Cargo").ToString().ToDecimal)
+ End If
If Entregado > 0 Then
'Calcular Vendido
@@ -4916,13 +4993,13 @@ Partial Class PV
If CveVentaDetalle <= 0 AndAlso Not EsCargo Then
Dim ListaPSCargo = CalculaUsados(Consec)
If ListaPSCargo.Count > 0 Then
- CalculaRecepcionUsados(GvRecepcionUsados, CvePS, ListaPSCargo)
+ CalculaRecepcionUsados(CvePS, ListaPSCargo)
End If
ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then
EliminarUsados()
Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False)
If ListaPSCargo.Count > 0 Then
- CalculaRecepcionUsados(GvRecepcionUsados, CvePS, ListaPSCargo)
+ CalculaRecepcionUsados(CvePS, ListaPSCargo)
End If
End If
@@ -6271,14 +6348,20 @@ Partial Class PV
CargaModelos()
CargaBCIAjuste()
- GvRecepcionUsados.DataSource = DtTamanios
+ DdlRecepcionUsados.DataSource = DtTamanios
GvRecepcionUsadosModal.DataSource = DtTamanios
+ TxtFechaVigencia.Text = Now.ToString("dd/MM/yyyy")
+
DdlTipoUso.DataBind()
DdlTipoDefecto.DataBind()
DdlFacturas.DataBind()
- GvRecepcionUsados.DataBind()
+ DdlRecepcionUsados.DataBind()
+
+ DdlRecepcionUsados.Items.Insert(0, New ListItem("Sin usado recibido", "-1"))
+ DdlBCIUsado.Items.Insert(0, New ListItem("Seleccione", "-1"))
+
GvRecepcionUsadosModal.DataBind()
CreaDTmpDTAjustes()
@@ -6300,12 +6383,12 @@ Partial Class PV
DdlModeloAuto.DataBind()
End Sub
- Protected Sub GvRecepcionUsados_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvRecepcionUsados.RowDataBound
- If e.Row.RowType = DataControlRowType.DataRow Then
- e.Row.FCDropDownList("DdlBCIUsado").DataSource = DTBCIUsados.FiltraParametros(String.Format("CveTamaño = {0}", e.Row.DataKey("CveTamaño")))
- e.Row.FCDropDownList("DdlBCIUsado").DataBind()
- End If
- End Sub
+ 'Protected Sub GvRecepcionUsados_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvRecepcionUsados.RowDataBound
+ ' If e.Row.RowType = DataControlRowType.DataRow Then
+ ' e.Row.FCDropDownList("DdlBCIUsado").DataSource = DTBCIUsados.FiltraParametros(String.Format("CveTamaño = {0}", e.Row.DataKey("CveTamaño")))
+ ' e.Row.FCDropDownList("DdlBCIUsado").DataBind()
+ ' End If
+ 'End Sub
Private Sub CargaPSAjuste()
'DdlPSAjuste.Items.Clear()
@@ -6790,12 +6873,17 @@ Partial Class PV
Protected Sub ChkAjuste_CheckedChanged(sender As Object, e As EventArgs)
If ChkAjuste.Checked Then
- For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
- If Gvr.RowType = DataControlRowType.DataRow Then
- Gvr.FCTextBox("TxtCantidad").Text = ""
- Gvr.FCTextBox("TxtCantidad").Enabled = False
- End If
- Next
+ 'For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
+ ' If Gvr.RowType = DataControlRowType.DataRow Then
+ ' Gvr.FCTextBox("TxtCantidad").Text = ""
+ ' Gvr.FCTextBox("TxtCantidad").Enabled = False
+ ' End If
+ 'Next
+
+ DdlRecepcionUsados.SelectedValueExist("-1")
+ DdlRecepcionUsados.Enabled = False
+ DdlBCIUsado.SelectedValueExist("-1")
+ DdlBCIUsado.Enabled = False
DivAjuste.Visible = True
TxtCantidad.Text = "1"
@@ -6810,12 +6898,17 @@ Partial Class PV
TxtPrecio.Text = TxtPrecio.Text
TxtObsPS.Text = "Descuento por garantía"
Else
- For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
- If Gvr.RowType = DataControlRowType.DataRow Then
- Gvr.FCTextBox("TxtCantidad").Text = ""
- Gvr.FCTextBox("TxtCantidad").Enabled = True
- End If
- Next
+ 'For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
+ ' If Gvr.RowType = DataControlRowType.DataRow Then
+ ' Gvr.FCTextBox("TxtCantidad").Text = ""
+ ' Gvr.FCTextBox("TxtCantidad").Enabled = True
+ ' End If
+ 'Next
+
+ DdlRecepcionUsados.SelectedValueExist("-1")
+ DdlRecepcionUsados.Enabled = True
+ DdlBCIUsado.SelectedValueExist("-1")
+ DdlBCIUsado.Enabled = True
DivAjuste.Visible = False
TxtCantidad.Enabled = True
@@ -6877,6 +6970,7 @@ Partial Class PV
TmpDTPolizaVirtual.Columns.Add("FechaUsado", GetType(DateTime))
TmpDTPolizaVirtual.Columns.Add("CvePSUsado", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("CveBCIUsado", GetType(Integer))
+ TmpDTPolizaVirtual.Columns.Add("CveMarcaUsado", GetType(Integer))
End Sub
Private Function AddPolizaVirtual(CvePS As Integer) As Boolean
Dim Retorno As Boolean = True
@@ -6916,7 +7010,7 @@ Partial Class PV
Dim Total As Decimal = ((Cantidad * PU) - Descuento).RoundSQL(2)
Dim TipoServicio As Integer = DdlTipoServicio.SelectedValue.ToEntero()
- Dim FechaUsado As DateTime = If(TxtFechaAjuste.Text.ToDateTime() < MinFecha, Now, TxtFechaAjuste.Text.ToDateTime())
+ Dim FechaUsado As DateTime = If(TxtFechaVigencia.Text.ToDateTime() < MinFecha, Now, TxtFechaVigencia.Text.ToDateTime())
Dim CveModeloAuto As Integer = DdlModeloAuto.SelectedValue.ToEntero()
Dim AnioVehiculo As Integer = TxtAnioVehiculo.Text.ToEntero()
Dim TipoPoliza As Integer = 1 'VENTA
@@ -6929,21 +7023,25 @@ Partial Class PV
End If
End If
- Dim TieneUsado As Boolean = GvRecepcionUsados.Rows.Cast(Of GridViewRow).Any(Function(GvRow) GvRow.RowType = DataControlRowType.DataRow AndAlso GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0)
+ Dim TieneUsado As Boolean = (DdlRecepcionUsados.SelectedValue.ToEntero() > 0) 'GvRecepcionUsados.Rows.Cast(Of GridViewRow).Any(Function(GvRow) GvRow.RowType = DataControlRowType.DataRow AndAlso GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0)
Dim CvePSUsado As Integer = -1
Dim CveBCIUsado As Integer = -1
If TieneUsado Then
- For Each GvRow As GridViewRow In GvRecepcionUsados.Rows
- If GvRow.RowType = DataControlRowType.DataRow Then
- If GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0 Then
- CvePSUsado = GvRow.DataKey("CvePSCargo").ToEntero()
- CveBCIUsado = GvRow.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero()
+ 'For Each GvRow As GridViewRow In GvRecepcionUsados.Rows
+ ' If GvRow.RowType = DataControlRowType.DataRow Then
+ ' If GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0 Then
+ ' CvePSUsado = GvRow.DataKey("CvePSCargo").ToEntero()
+ ' CveBCIUsado = GvRow.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero()
+
+ ' Exit For
+ ' End If
+ ' End If
+ 'Next
+
+ CvePSUsado = DdlRecepcionUsados.SelectedValue.ToEntero()
+ CveBCIUsado = DdlBCIUsado.SelectedValue.ToEntero()
- Exit For
- End If
- End If
- Next
End If
Dim Row As DataRow = TmpDTPolizaVirtual.NewRow()
@@ -6961,6 +7059,7 @@ Partial Class PV
Row("FechaUsado") = FechaUsado
Row("CvePSUsado") = CvePSUsado
Row("CveBCIUsado") = CveBCIUsado
+ Row("CveMarcaUsado") = DdlMarcaUsado.SelectedValue.ToEntero()
TmpDTPolizaVirtual.Rows.Add(Row)
@@ -6992,7 +7091,7 @@ Partial Class PV
EmitirImprimirNew()
End Sub
- Private Sub CalculaRecepcionUsados(Gv As GridView, CvePS As Integer, ListaPSCargo As List(Of Integer))
+ Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer))
If Modalidad = "U" Then
If TmpDTRecepcionUsados.Rows.Count > 0 Then
@@ -7014,28 +7113,48 @@ Partial Class PV
Dim StrTamanios As New StringBuilder()
StrTamanios.Append("Se recibierón los siguientes usados:")
- For Each Gvr As GridViewRow In Gv.Rows
- If Gvr.RowType = DataControlRowType.DataRow Then
+ 'For Each Gvr As GridViewRow In Gv.Rows
+ ' If Gvr.RowType = DataControlRowType.DataRow Then
- If Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal > 0 Then
- TotalCargos += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal * Gvr.DataKey("Cargo").ToDecimal
- TotalCantidad += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal
- StrTamanios.AppendFormat("{0},", Gvr.DataKey("CodigoPS"))
+ ' If Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal > 0 Then
+ ' TotalCargos += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal * Gvr.DataKey("Cargo").ToDecimal
+ ' TotalCantidad += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal
+ ' StrTamanios.AppendFormat("{0},", Gvr.DataKey("CodigoPS"))
- Dim Row As DataRow = TmpDTRecepcionUsados.NewRow()
- Row("CvePS") = Gvr.DataKey("CvePSCargo").ToEntero
- Row("CvePSRelacionado") = CvePS
- Row("Cantidad") = Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal
- Row("CveUM") = Gvr.DataKey("CveUM").ToEntero
- Row("CveVentaDetalle") = -1
- Row("PU") = Gvr.DataKey("Cargo").ToDouble
- Row("CveBCIUsado") = Gvr.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero
- Row("CveModeloAuto") = DdlModeloAuto.SelectedValue.ToEntero
- TmpDTRecepcionUsados.Rows.Add(Row)
+ ' Dim Row As DataRow = TmpDTRecepcionUsados.NewRow()
+ ' Row("CvePS") = Gvr.DataKey("CvePSCargo").ToEntero
+ ' Row("CvePSRelacionado") = CvePS
+ ' Row("Cantidad") = Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal
+ ' Row("CveUM") = Gvr.DataKey("CveUM").ToEntero
+ ' Row("CveVentaDetalle") = -1
+ ' Row("PU") = Gvr.DataKey("Cargo").ToDouble
+ ' Row("CveBCIUsado") = Gvr.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero
+ ' Row("CveModeloAuto") = DdlModeloAuto.SelectedValue.ToEntero
+ ' TmpDTRecepcionUsados.Rows.Add(Row)
- End If
- End If
- Next
+ ' End If
+ ' End If
+ 'Next
+
+ Dim DrTamanio As DataRow = GlobalDTAcumTamaños.FiltroPrimero($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo = {DdlRecepcionUsados.SelectedValue}")
+
+ If DdlRecepcionUsados.SelectedValue.ToEntero() > 0 Then
+ TotalCargos += 1D * DrTamanio("Cargo").ToString().ToDecimal
+ TotalCantidad += 1D
+ StrTamanios.AppendFormat("{0},", DrTamanio("CodigoPS"))
+
+ Dim Row As DataRow = TmpDTRecepcionUsados.NewRow()
+ Row("CvePS") = DrTamanio("CvePSCargo").ToString().ToEntero
+ Row("CvePSRelacionado") = CvePS
+ Row("Cantidad") = 1D
+ Row("CveUM") = DrTamanio("CveUM").ToString().ToEntero
+ Row("CveVentaDetalle") = -1
+ Row("PU") = DrTamanio("Cargo").ToString().ToDecimal
+ Row("CveBCIUsado") = DdlBCIUsado.SelectedValue.ToEntero
+ Row("CveModeloAuto") = DdlModeloAuto.SelectedValue.ToEntero
+ TmpDTRecepcionUsados.Rows.Add(Row)
+
+ End If
If TotalCargos > 0 Then
StrTamanios.Remove(StrTamanios.Length - 1, 1)
@@ -7587,4 +7706,12 @@ Partial Class PV
Response.Redirect($"~/Ventas/PV.aspx")
End Sub
+ Protected Sub DdlRecepcionUsados_SelectedIndexChanged(sender As Object, e As EventArgs)
+ Dim DrTamanio As DataRow = GlobalDTAcumTamaños.FiltroPrimero($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo = {DdlRecepcionUsados.SelectedValue}")
+
+ DdlBCIUsado.DataSource = DTBCIUsados.FiltraParametros(String.Format("CveTamaño = {0}", DrTamanio("CveTamaño")))
+ DdlBCIUsado.DataBind()
+
+ UpModalVenta.Update()
+ End Sub
End Class