-- Editar lista de precios cuando se edita una partida funcionalidad 109 y 360

This commit is contained in:
2024-04-01 17:48:50 -07:00
parent e280f83de6
commit 001119b51e
2 changed files with 95 additions and 25 deletions

View File

@@ -1005,7 +1005,7 @@
<div class="cbp-item graphic">
<div class="cbp-caption">
<div class="cbp-caption-defaultWrap">
<img runat="server" id="imgImagen" style="max-height:250px !important; max-width:250px !important;">
<img runat="server" id="imgImagen" style="max-height: 250px !important; max-width: 250px !important;">
</div>
</div>
</div>
@@ -1365,15 +1365,24 @@
</div>
</ItemTemplate>
<EditItemTemplate>
<asp:Literal ID="LtlPU" runat="server" Text='<%# Eval("PU") %>' Visible="false"></asp:Literal>
<asp:TextBox ID="TxtPrecio" runat="server" CausesValidation="true" MaxLength="12" Text='<%# Eval("PU", "{0:0.00####}") %>' ValidationGroup="GprGV" Width="78px" Height="24px"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="SoloNumeros" runat="server" TargetControlID="TxtPrecio" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVPrecio" runat="server" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GprGV"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCPrecio" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<div class="row" id="DivPrecioLista" runat="server" visible="false">
<div class="col-md-12">
<asp:DropDownList ID="DdlPrecioListaEdit" runat="server" Width="100%" CssClass="select2me" DataValueField="CvePrecioLista" DataTextField="PrecioLista" OnSelectedIndexChanged="DdlPrecioListaEdit_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
</div>
</div>
<div class="row">
<div class="col-md-12">
<asp:Literal ID="LtlPU" runat="server" Text='<%# Eval("PU") %>' Visible="false"></asp:Literal>
<asp:TextBox ID="TxtPrecio" runat="server" CausesValidation="true" MaxLength="12" Text='<%# Eval("PU", "{0:0.00####}") %>' ValidationGroup="GprGV" Width="78px" Height="24px"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="SoloNumeros" runat="server" TargetControlID="TxtPrecio" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVPrecio" runat="server" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GprGV"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCPrecio" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVPrecioEdit" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GprGV"></asp:CustomValidator>
<asp:CustomValidator ID="CVPrecioEdit" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GprGV"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VCEPrecioEdit" runat="server" HighlightCssClass="vco" TargetControlID="CVPrecioEdit" Width="300px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="VCEPrecioEdit" runat="server" HighlightCssClass="vco" TargetControlID="CVPrecioEdit" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</EditItemTemplate>
</asp:TemplateField>
<%--10--%>
@@ -7965,15 +7974,15 @@
<div class="col-md-8">
<div class="row">
<asp:Panel ID="PnlRFCCliente" runat="server" DefaultButton="BtnValidarRFC">
<div class="form-group form-md-line-input input-iconright col-xs-9">
<asp:TextBox ID="TxtRFCCliente" Style="text-transform: uppercase;" placeholder="Ingrese el RFC para su validación" runat="server" CssClass="form-control" MaxLength="13" CausesValidation="true"></asp:TextBox>
<asp:RegularExpressionValidator ID="REVRFCCliente" runat="server" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''RFC''</b> es incorrecto, por favor ingréselo." ValidationGroup="GrpGuardarCliente" ControlToValidate="TxtRFCCliente" ValidationExpression="^[a-zñA-ZÑ.)(/\\&-]{3,4}(\d{6})((\D|\d){2})((\D|\d){1})$"></asp:RegularExpressionValidator>
<label for="<%= TxtRFCCliente.ClientID.ToString()%>">RFC:</label>
</div>
<div class="form-group form-md-line-input input-iconright col-xs-3">
<asp:Button ID="BtnValidarRFC" runat="server" CssClass="btn btn-success" Text="Validar" />
</div>
</asp:Panel>
<div class="form-group form-md-line-input input-iconright col-xs-9">
<asp:TextBox ID="TxtRFCCliente" Style="text-transform: uppercase;" placeholder="Ingrese el RFC para su validación" runat="server" CssClass="form-control" MaxLength="13" CausesValidation="true"></asp:TextBox>
<asp:RegularExpressionValidator ID="REVRFCCliente" runat="server" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''RFC''</b> es incorrecto, por favor ingréselo." ValidationGroup="GrpGuardarCliente" ControlToValidate="TxtRFCCliente" ValidationExpression="^[a-zñA-ZÑ.)(/\\&-]{3,4}(\d{6})((\D|\d){2})((\D|\d){1})$"></asp:RegularExpressionValidator>
<label for="<%= TxtRFCCliente.ClientID.ToString()%>">RFC:</label>
</div>
<div class="form-group form-md-line-input input-iconright col-xs-3">
<asp:Button ID="BtnValidarRFC" runat="server" CssClass="btn btn-success" Text="Validar" />
</div>
</asp:Panel>
</div>
</div>
<div class="col-md-4">

View File

@@ -3697,12 +3697,8 @@ Partial Class Ventas
Private Sub CargaListasPrecios()
DivPrecioLista.Visible = True
Using ObjVta As New ClsVentas
If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then
DdlPrecioLista.DataSource = ObjVta.DtResultados
DdlPrecioLista.SelectedValue = ObjVta.DtResultados.FiltroPrimeroValor("CvePrecioLista", "Predeterminada = 'True'")
End If
End Using
DdlPrecioLista.DataSource = GlobalDTPrecioListas(UsuarioActual.CveEmpresa)
DdlPrecioLista.SelectedValue = GlobalDTPrecioListas(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "Predeterminada = 'True'")
DdlPrecioLista.DataBind()
'DdlPrecioLista.Items.Insert(0, New ListItem("Seleccione", "-1"))
@@ -8343,6 +8339,14 @@ Partial Class Ventas
End If
End If
If UsuarioActual.Empresa.Funcionalidad(360) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
e.Row.FCHtmlGenericControl("DivPrecioLista").Visible = True
e.Row.FCDropDownList("DdlPrecioListaEdit").DataSource = GlobalDTPrecioListas(UsuarioActual.CveEmpresa)
e.Row.FCDropDownList("DdlPrecioListaEdit").DataBind()
e.Row.FCDropDownList("DdlPrecioListaEdit").SelectedValueExist(e.Row.DBCampo("CvePrecioLista"))
End If
'Si es facturacion de OC o Contrato
If CveContrato > 0 AndAlso Not CveVenta > 0 AndAlso Not CveCicloComercial > 0 Then
e.Row.FCLinkButton("imgClone").Visible = False
@@ -8827,13 +8831,21 @@ Partial Class Ventas
TmpDT.Rows.Remove(TmpDT.Rows(e.RowIndex))
CalculaUsados()
Dim CvePrecioLista As Integer = -1
Dim PrecioLista As String = ""
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(360) = "1" Then
CvePrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedValue.ToEntero()
PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text
End If
AgregarProductoServicio(Cantidad, DdlUM.SelectedValue.ToEntero(), DdlUM.SelectedItem.Text, DdlCla.SelectedValue.ToEntero(), DdlCla.SelectedItem.Text,
GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue.ToEntero(), GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedText,
GvPS.Rows(e.RowIndex).FCTextBox("TxtObsPS").Text.Trim, PU, ObjDescuento.ImporteDescuento,
GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").SelectedValue.ToEntero(), GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").SelectedItem.Text,
GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero(), GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").SelectedItem.Text,
CuentaPredial:=CuentaPredial, CveVentaDetalle:=GvPS.Rows(e.RowIndex).DataKey("CveVentaDetalle").ToString().ToEntero(), SeActualiza:=True, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle,
ObjDescuento:=ObjDescuento, NumTurnos:=NumTurnos)
ObjDescuento:=ObjDescuento, NumTurnos:=NumTurnos, CvePrecioLista:=CvePrecioLista, PrecioLista:=PrecioLista)
' TmpDT.Rows(e.RowIndex)("CveUM") = Ddl.SelectedValue
' TmpDT.Rows(e.RowIndex)("UM") = Ddl.SelectedItem.Text
@@ -8918,6 +8930,16 @@ Partial Class Ventas
TmpDT.Rows(e.RowIndex)("Proyecto") = GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").SelectedItem.Text
End If
Dim CvePrecioLista As Integer = -1
Dim PrecioLista As String = ""
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(360) = "1" Then
CvePrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedValue.ToEntero()
PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text
TmpDT.Rows(e.RowIndex)("CvePrecioLista") = CvePrecioLista
TmpDT.Rows(e.RowIndex)("PrecioLista") = PrecioLista
End If
If GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").Items.Count = 0 Then
TmpDT.Rows(e.RowIndex)("SubProyecto") = "Sin SubProyecto Asignado"
@@ -17639,10 +17661,18 @@ Partial Class Ventas
End If
'SI ESTA AGREGANDO TOMAR DEL SELECCIONADO
If DivPrecioLista.Visible AndAlso CvePrecioListaSugerido > 0 Then
CvePrecioListaPS = CvePrecioListaSugerido
End If
'SI ES EDICION DE PS
If CvePrecioListaSugerido > 0 AndAlso (UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(360) = "1") Then
If GvPS.EditIndex >= 0 Then
CvePrecioListaPS = CvePrecioListaSugerido
End If
End If
Dim CvePrecioListaPredeterminada = -1
Dim AplicaPredeterminado As Boolean = False
@@ -17721,13 +17751,44 @@ Partial Class Ventas
If (GvRow.RowState = DataControlRowState.Edit OrElse GvRow.RowState = 5) Then
Dim CvePSParametro = ddlPSEdit.SelectedValue.ToEntero()
Dim DdlPrecioListaEdit = GvRow.FCDropDownList("DdlPrecioListaEdit")
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
If DrPS IsNot Nothing Then
'SUGIERE PRECIO
Dim PrecioSugerido As Decimal = 0
Dim tPrecioSugerido As Decimal = 0
tPrecioSugerido = DrPS("Precio").ToString().ToDecimal
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePSParametro, DrPS("CveClasificacion").ToString().ToEntero())
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePSParametro, DrPS("CveClasificacion").ToString().ToEntero(), CvePrecioListaSugerido:=DdlPrecioListaEdit.SelectedValue.ToEntero())
PrecioSugerido = ObjPrecioSugerido.PrecioSugerido
If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido
GvRow.FCTextBox("TxtPrecio").Text = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere
End If
End If
End If
End If
End Sub
Protected Sub DdlPrecioListaEdit_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(360) = "1" Then
If GvPS.EditIndex >= 0 Then
Dim DdlPrecioListaEdit = DirectCast(sender, DropDownList)
Dim GvRow = DirectCast(DdlPrecioListaEdit.NamingContainer, GridViewRow)
If (GvRow.RowState = DataControlRowState.Edit OrElse GvRow.RowState = 5) Then
Dim CvePSParametro = GvRow.FCDropDownLost("DdlPS").SelectedValue.ToEntero()
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
If DrPS IsNot Nothing Then
'SUGIERE PRECIO
Dim PrecioSugerido As Decimal = 0
Dim tPrecioSugerido As Decimal = 0
tPrecioSugerido = DrPS("Precio").ToString().ToDecimal
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePSParametro, DrPS("CveClasificacion").ToString().ToEntero(), CvePrecioListaSugerido:=DdlPrecioListaEdit.SelectedValue.ToEntero())
PrecioSugerido = ObjPrecioSugerido.PrecioSugerido