BDH. Cambiar tabla de usados por un solo dropdown, agregar marca de usado y vigencia
This commit is contained in:
@@ -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)
|
||||
|
||||
179
Ventas/PV.aspx
179
Ventas/PV.aspx
@@ -2746,58 +2746,81 @@
|
||||
</div>
|
||||
|
||||
<div id="DivRecepcionUsados" runat="server">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<label>Modelo:</label>
|
||||
<br />
|
||||
<asp:DropDownList ID="DdlModeloAuto" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="ModeloMarca" DataValueField="CveModeloAuto">
|
||||
</asp:DropDownList>
|
||||
<div class="portlet light xspadding bordered">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<i class="icon-pin font-green"></i>
|
||||
<span class="caption-subject bold uppercase">Datos de Usados </span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript;" class="collapse" data-original-title="" title=""></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label>Año:</label>
|
||||
<br />
|
||||
<asp:TextBox ID="TxtAnioVehiculo" type="number" runat="server" Height="100%" Width="100%" CssClass="form-control" CausesValidation="true"></asp:TextBox>
|
||||
<div class="portlet-body form">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<label>Tipo Servicio:</label>
|
||||
<br />
|
||||
<asp:DropDownList ID="DdlTipoServicio" CssClass="form-control input-sm select2me" runat="server" CausesValidation="true">
|
||||
<asp:ListItem Text="Seleccione" Value="-1"></asp:ListItem>
|
||||
<asp:ListItem Text="Particular" Value="1" Selected="True"></asp:ListItem>
|
||||
<asp:ListItem Text="Comercial" Value="2"></asp:ListItem>
|
||||
<asp:ListItem Text="Taxi" Value="3"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Modelo:</label>
|
||||
<br />
|
||||
<asp:DropDownList ID="DdlModeloAuto" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="ModeloMarca" DataValueField="CveModeloAuto">
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Año:</label>
|
||||
<br />
|
||||
<asp:TextBox ID="TxtAnioVehiculo" type="number" runat="server" Height="100%" Width="100%" CssClass="form-control" CausesValidation="true"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<label>Usado:</label>
|
||||
<br />
|
||||
<asp:DropDownList ID="DdlRecepcionUsados" CssClass="form-control input-sm select2me" runat="server" CausesValidation="true" DataTextField="CodigoPS" DataValueField="CvePSCargo" Width="100%" OnSelectedIndexChanged="DdlRecepcionUsados_SelectedIndexChanged" AutoPostBack="true">
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label>BCI:</label>
|
||||
<br />
|
||||
<asp:DropDownList ID="DdlBCIUsado" CssClass="form-control input-sm select2me" runat="server" CausesValidation="true" DataTextField="BCI" DataValueField="CveBCIUsado" Width="100%">
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlMarcaUsado" CssClass="form-control input-sm select2me" runat="server" DataTextField="Marca" DataValueField="CveMarcaUsado" Width="100%">
|
||||
<asp:ListItem Selected="True" Text="Seleccione la Marca" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<label for="<%= DdlMarcaUsado.ClientID.ToString()%>">Marca:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="<%= TxtFechaAjuste.ClientID.ToString()%>">Fecha Vigencia:</label>
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100% !important; padding: 0px;">
|
||||
<asp:TextBox ID="TxtFechaVigencia" CssClass="form-control input-sm ADSMaskDate" Width="100%" runat="server"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="LnkFechaVigencia" class="btn default " Text=" <i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
<ajax:MaskedEditExtender ID="MEEFechaVigencia" runat="server" TargetControlID="TxtFechaVigencia" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="CEFechaVigencia" TargetControlID="TxtFechaVigencia" PopupButtonID="LnkFechaVigencia" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
|
||||
<asp:RequiredFieldValidator ID="RFVFechaVigencia" runat="server" ControlToValidate="TxtFechaVigencia" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Vigencia''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEFechaVigencia" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaVigencia"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<label>Tipo Servicio:</label>
|
||||
<br />
|
||||
<asp:DropDownList ID="DdlTipoServicio" CssClass="form-control input-sm select2me" runat="server" CausesValidation="true">
|
||||
<asp:ListItem Text="Seleccione" Value="-1"></asp:ListItem>
|
||||
<asp:ListItem Text="Particular" Value="1" Selected="True"></asp:ListItem>
|
||||
<asp:ListItem Text="Comercial" Value="2"></asp:ListItem>
|
||||
<asp:ListItem Text="Taxi" Value="3"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<div class="col-md-6"></div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12" visible="false">
|
||||
<asp:GridView ID="GvRecepcionUsados" runat="server" GridLines="None" ShowHeaderWhenEmpty="true" CssClass="table table-hover table-striped ScrollAD mysmallbtn"
|
||||
data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" data-height="100"
|
||||
DataKeyNames="CvePSCargo,CveUM,Cargo,CveTamaño,CodigoPS">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="CodigoPS" HeaderText="Tamaño" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="35%" />
|
||||
<asp:TemplateField HeaderText="Cantidad" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20%">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtCantidad" CssClass="form-control linewhitsize" runat="server" Width="90%" Height="30px"></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender ID="FTBECantidad" runat="server" TargetControlID="TxtCantidad" FilterType="Custom, Numbers" ValidChars="." />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="BCI" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="25%">
|
||||
<ItemTemplate>
|
||||
<asp:DropDownList ID="DdlBCIUsado" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="BCI" DataValueField="CveBCIUsado" Width="90%">
|
||||
</asp:DropDownList>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
@@ -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 }
|
||||
|
||||
@@ -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}<br>", Retorno.Mensajes(Retorno.Mensajes.Count - 1))
|
||||
SbAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF Factura</a></li></ul><br/>", 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}<br>", Retorno.Mensajes(Retorno.Mensajes.Count - 1))
|
||||
SbAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF Factura</a></li></ul><br/>", 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
|
||||
|
||||
Reference in New Issue
Block a user