Modificar precio de PS por Marca

This commit is contained in:
janeth arvizu
2019-08-30 12:48:46 -07:00
parent 11ee44c8d6
commit 41b8e23d9a
5 changed files with 524 additions and 68 deletions

4
.gitignore vendored
View File

@@ -6,3 +6,7 @@
/Menu
/Web.config
/Log.txt
/.vs/localhost/v14/.suo
/LogMail.txt
/.vs
/packages

View File

@@ -1796,6 +1796,87 @@ Public Class ClsProductosServicios
End Function
#End Region
#Region "Porcentaje Marcas de Productos"
Public Function GetPorcentajeMarcas(CveCliente As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_PorcentajeMarcasGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener los porcentajes de las Marcas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function AddPorcentajeMarcas(CveCliente As Integer, CveMarca As Integer, PorcentajeProducto As Decimal, CveUsuario As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_PorcentajeMarcasAdd")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveMarca", SqlDbType.Int).Value = CveMarca
.Add("@PorcentajeProducto", SqlDbType.SmallMoney).Value = PorcentajeProducto
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al agregar el porcentaje de la Marca.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function UpdatePorcentajeMarcas(CveCliente As Integer, CveMarca As Integer, PorcentajeProducto As Decimal) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_PorcentajeMarcasUpdate")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveMarca", SqlDbType.Int).Value = CveMarca
.Add("@PorcentajeProducto", SqlDbType.SmallMoney).Value = PorcentajeProducto
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al actualizar el porcentaje de la Marca.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function RemovePorcentajeMarcas(CveCliente As Integer, CveMarca As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_PorcentajeMarcasRemove")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveMarca", SqlDbType.Int).Value = CveMarca
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al eliminar el porcentaje de la Marca.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
#End Region
#Region "IDisposable Support"

View File

@@ -255,10 +255,18 @@
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel runat="server" ID="UpPorcentajeMarcas" RenderMode="Inline" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkPorcentajeMarcas" Visible="False" data-toggle="tooltip" data-placement="left" title="Modificar Precio de PS por Marca." runat="server" Text="<i class='fa fa-pencil'></i> Modificar Precio por Marca"></asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel runat="server" ID="UpPorcentajePrecios" RenderMode="Inline" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkPorcentajePrecios" Visible="False" data-toggle="tooltip" data-placement="left" title="Modificar Precio de Productos." runat="server" Text="<i class='fa fa-pencil'></i> Modificar Precios"></asp:LinkButton>
<asp:LinkButton ID="LnkPorcentajePrecios" Visible="False" data-toggle="tooltip" data-placement="left" title="Modificar Precio por PS." runat="server" Text="<i class='fa fa-pencil'></i> Modificar Precio por Producto"></asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>
@@ -5464,13 +5472,13 @@
</div>
<%-- END MODAL UNIFICAR EMPRESA CRM --%>
<%-- MODAL MODIFICAR PORCENTAJE PRECIOS --%>
<div id="DivPorcentajePrecios" class="modal ADS fade" role="dialog">
<%-- MODAL MODIFICAR PORCENTAJE MARCAS --%>
<div id="DivPorcentajeMarcas" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content" style="width: 700px;">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Modificar Precio de Productos</h4>
<h4 class="modal-title">Modificar Precio de Productos por Marca</h4>
</div>
<asp:UpdatePanel ID="UpPorcentaje" UpdateMode="Conditional" runat="server">
<ContentTemplate>
@@ -5502,7 +5510,7 @@
</asp:DropDownList>
<br />
<ADS:Dropdownlost runat="server" ID="DdlProducto2" CssStyle="width: 100%;" CssClassDdl="select2me" DataTextField="PSCodigo" DataValueField="CvePS" />--%>
<%-- <asp:RequiredFieldValidator ID="RFVProducto2" InitialValue="-1" runat="server" ControlToValidate="DdlProducto2" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Producto''</b> es necesario, por favor ingréselo." ValidationGroup="GprAgregaPS"></asp:RequiredFieldValidator>
<%-- <asp:RequiredFieldValidator ID="RFVProducto2" InitialValue="-1" runat="server" ControlToValidate="DdlProducto2" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Producto''</b> es necesario, por favor ingréselo." ValidationGroup="GprAgrega"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEProducto2" runat="server" HighlightCssClass="vco" TargetControlID="RFVProducto2" Width="300px"></ajax:ValidatorCalloutExtender>--%>
</div>
</div>
@@ -5511,16 +5519,16 @@
<asp:Label ID="LbPrecioG" DataFormatString="{0:N2}" Width="55px" MaxLength="15" runat="server"></asp:Label>
</td>--%>
<td>
<asp:TextBox ID="txtPorcentaje" CssClass="form-control input-sm" Width="55px" MaxLength="15" runat="server" ValidationGroup="GprAgregaPS" Style="text-align: right"></asp:TextBox>
<asp:TextBox ID="txtPorcentaje" CssClass="form-control input-sm" Width="55px" MaxLength="15" runat="server" ValidationGroup="GprAgrega" Style="text-align: right"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="ftbe" runat="server" TargetControlID="txtPorcentaje" FilterType="Custom, Numbers" ValidChars=".," />
<asp:RequiredFieldValidator ID="RFVPorcentaje" runat="server" ControlToValidate="txtPorcentaje" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''%'' Porcentaje</b> es necesario, por favor ingréselo." ValidationGroup="GprAgregaPS"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="RFVPorcentaje" runat="server" ControlToValidate="txtPorcentaje" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''%'' Porcentaje</b> es necesario, por favor ingréselo." ValidationGroup="GprAgrega"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEPorcentaje" runat="server" HighlightCssClass="vco" TargetControlID="RFVPorcentaje" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
<%-- <td>
<asp:Label ID="LbPrecioA" Width="55px" MaxLength="15" runat="server" ClientIDMode="Static"></asp:Label>
</td>--%>
<td align="center">
<asp:LinkButton ID="LbAgregar" runat="server" CssClass="btn btn-default" ValidationGroup="GprAgregaPS" Text="Agregar" />
<asp:LinkButton ID="LbAgregarMarca" runat="server" CssClass="btn btn-default" ValidationGroup="GprAgrega" Text="Agregar" />
</td>
</tr>
</tbody>
@@ -5545,7 +5553,7 @@
</ItemTemplate>
<ItemStyle Width="28px"></ItemStyle>
</asp:TemplateField>
<asp:BoundField HeaderText="" ReadOnly="true" DataField="Producto" ItemStyle-Width="200px" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="" ReadOnly="true" DataField="Marca" ItemStyle-Width="200px" ItemStyle-HorizontalAlign="Left" />
<%-- <asp:BoundField HeaderText="" ReadOnly="true" DataField="PrecioG" ItemStyle-Width="73px" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" />--%>
@@ -5564,6 +5572,137 @@
<%-- <asp:BoundField HeaderText="" ReadOnly="true" DataField="PrecioA" ItemStyle-Width="73px" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" />--%>
<asp:TemplateField>
<EditItemTemplate>
<center>
<asp:LinkButton ID="imgU" runat="server" AlternateText="Actualizar" CausesValidation="True" CommandName="Update" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" ValidationGroup="GrpGV" />
&nbsp;<asp:LinkButton ID="imgC" runat="server" AlternateText="Cancelar" CausesValidation="False" CommandName="Cancel" CssClass="btn btn-circle btn-sm red" Text="<i class='fa fa-times'></i>" />
</center>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="imgE" runat="server" AlternateText="Editar" CausesValidation="False" CommandName="Edit" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
<asp:LinkButton ID="lnkRemove" runat="server" AlternateText="Eliminar" OnClick="DeleteRowMarca" CommandArgument='<%# Eval("No")%>' CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Seguro que desea eliminar el porcentaje?" data-btn-ok-label="si" />
</ItemTemplate>
<ItemStyle Width="73px"></ItemStyle>
</asp:TemplateField>
</Columns>
<RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnGuardarPorcentajesMarca" runat="server" Text="Guardar" CssClass="btn btn-primary" />
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
<%-- FIN MODAL MODIFICAR PORCENTAJE MARCAS --%>
<%-- MODAL MODIFICAR PRECIOS PS --%>
<div id="DivPorcentajePrecios" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content" style="width: 700px;">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Modificar Precio de Productos</h4>
</div>
<asp:UpdatePanel ID="UpPorcentajeP" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div class="modal-body">
<div class="row" style="margin: 5px;">
<table border="0" cellpadding="0" class="Widthall grides" cellspacing="0">
<tbody>
<tr class="Titulos">
<th style="width: 28px">#</th>
<th style="width: 200px">Clasificación<br />
Producto </th>
<th width="73px">Precio<br />
General </th>
<th width="73px">%</th>
<th width="73px">Precio<br />
Aplicado </th>
<th style="width: 73px;"></th>
</tr>
<tr align="center">
<td></td>
<td style="text-align: center;">
<div class="psagregar">
<div class="comboxes">
<asp:DropDownList ID="DdlClasificacion2" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Clasificacion" DataValueField="CveClasificacion" Width="100%" Class="form-control input-sm select2me">
<asp:ListItem Selected="True" Text="Seleccione la Clasificación (Todas)" Value="-1"></asp:ListItem>
</asp:DropDownList>
<br />
<ADS:Dropdownlost runat="server" ID="DdlProducto2" CssStyle="width: 100%;" CssClassDdl="select2me" DataTextField="PSCodigo" DataValueField="CvePS" />
</div>
</div>
</td>
<td>
<asp:Label ID="LbPrecioG" DataFormatString="{0:N2}" Width="55px" MaxLength="15" runat="server"></asp:Label>
</td>
<td>
<asp:TextBox ID="TxtPorcentajePS" CssClass="form-control input-sm" Width="55px" MaxLength="15" runat="server" ValidationGroup="GprAgregaPS" Style="text-align: right"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" TargetControlID="TxtPorcentajePS" FilterType="Custom, Numbers" ValidChars=".," />
<asp:RequiredFieldValidator ID="RFVPorcentajeP" runat="server" ControlToValidate="TxtPorcentajePS" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''%'' Porcentaje</b> es necesario, por favor ingréselo." ValidationGroup="GprAgregaPS"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender4" runat="server" HighlightCssClass="vco" TargetControlID="RFVPorcentajeP" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
<td>
<asp:Label ID="LbPrecioA" Width="55px" MaxLength="15" runat="server" ClientIDMode="Static"></asp:Label>
</td>
<td align="center">
<asp:LinkButton ID="LbAgregar" runat="server" CssClass="btn btn-default" ValidationGroup="GprAgregaPS" Text="Agregar" />
</td>
</tr>
</tbody>
</table>
<asp:Button ID="BtnCambiaPorcentaje" Text="" OnClick="BtnCambiaPorcentaje_Click" ClientIDMode="Static" Style="display: none;" runat="server" />
</div>
<br />
<div class="row" style="margin: 5px;">
<asp:UpdatePanel ID="UpPorcentajePS" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvP" runat="server" GridLines="none" CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" DataKeyNames="No" EmptyDataText="Aún no hay registros." AutoGenerateColumns="False" AllowPaging="False" ShowHeaderWhenEmpty="True">
<Columns>
<asp:TemplateField HeaderText="" ItemStyle-Font-Size="6pt">
<EditItemTemplate>
<asp:Literal ID="lbNo" runat="server" Text='<%# Eval("No")%>'></asp:Literal>
</EditItemTemplate>
<ItemTemplate>
<asp:Literal ID="lbNo" runat="server" Text='<%# Eval("No")%>'></asp:Literal>
</ItemTemplate>
<ItemStyle Width="28px"></ItemStyle>
</asp:TemplateField>
<asp:BoundField HeaderText="" ReadOnly="true" DataField="Producto" ItemStyle-Width="200px" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="" ReadOnly="true" DataField="PrecioG" ItemStyle-Width="73px" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" />
<asp:TemplateField HeaderText="">
<EditItemTemplate>
<asp:TextBox ID="TxtPorcentajeP" CssClass="form-control input-sm" runat="server" Width="80px" Text='<%# Eval("PorcentajeProducto", "{0:N2}")%>' Style="text-align: right"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="ftbe" runat="server" TargetControlID="txtPorcentajeP" FilterType="Custom, Numbers" ValidChars=".," />
</EditItemTemplate>
<ItemTemplate>
<asp:Literal ID="lblPorcentajeP" runat="server" Text='<%# Eval("PorcentajeProducto", "{0:N2}")%>'></asp:Literal>
</ItemTemplate>
<ItemStyle Width="73px" HorizontalAlign="Right"></ItemStyle>
<FooterStyle HorizontalAlign="Right"></FooterStyle>
</asp:TemplateField>
<asp:BoundField HeaderText="" ReadOnly="true" DataField="PrecioA" ItemStyle-Width="73px" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" />
<asp:TemplateField>
<EditItemTemplate>
<center>
@@ -5597,7 +5736,8 @@
</div>
</div>
</div>
<%-- FIN MODAL IMPORTAR SALDOS --%>
<%-- FIN MODAL MODIFICAR PRECIOS PS --%>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">

View File

@@ -1253,6 +1253,7 @@ Partial Class Clientes
'CargaFormaPago33()
'CargaComboCFDI()
LnkPorcentajeMarcas.Visible = True
LnkPorcentajePrecios.Visible = True
If UsuarioActual.TienePermisoProceso(261) Then LnkVerGrafica.Visible = True
@@ -8132,14 +8133,12 @@ Partial Class Clientes
End Sub
#End Region
#Region "PORCENTAJE PRECIO DE PRODUCTOS"
Private Sub LnkPorcentajePrecios_Click(sender As Object, e As EventArgs) Handles LnkPorcentajePrecios.Click
RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajePrecios"))
#Region "PORCENTAJE PRECIO DE MARCAS"
Private Sub LnkPorcentajeMarcas_Click(sender As Object, e As EventArgs) Handles LnkPorcentajeMarcas.Click
RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajeMarcas"))
CreaDT()
'txtPorcentaje.Attributes.Add("onchange", String.Format("FnCambiaPorcentaje({0});", "5"))
'CargaPorcentajesProductos()
CargaMarcas()
LimpiaModalPorcentaje()
End Sub
@@ -8156,6 +8155,7 @@ Partial Class Clientes
DTPorcentajeTemp.Columns.Add(column)
DTPorcentajeTemp.Columns.Add("CveMarca", GetType(Integer))
DTPorcentajeTemp.Columns.Add("Marca", GetType(String))
DTPorcentajeTemp.Columns.Add("PorcentajeProducto", GetType(Decimal))
DTPorcentajeTemp.Columns.Add("Estatus", GetType(String))
DTPorcentajePrecios = DTPorcentajeTemp.Clone
@@ -8171,58 +8171,11 @@ Partial Class Clientes
CargaGridPorcentajes()
UpPorcentaje.Update()
End Sub
'Private Sub CargaPorcentajesProductos()
' 'Llenar el dropdownlist de Secciones
' If UsuarioActual.CveEmpresa = 66 Then
' DdlClasificacion2.DataSource = GlobalDTSubFamilias(UsuarioActual.CveEmpresa).FiltraParametros("", Orderby:="Clasificacion")
' Else
' Dim ObjClasificaciones As New ClsClasificaciones
' If ObjClasificaciones.GetClasificacionesExistencias(UsuarioActual.CveEmpresa) Then
' DdlClasificacion2.DataSource = ObjClasificaciones.DtResultados
' End If
' ObjClasificaciones.Dispose()
' End If
' DdlClasificacion2.DataBind()
' CargaPS()
' CargaGridPorcentajes()
' UpPorcentaje.Update()
'End Sub
'Private Sub CargaPS()
' DdlProducto2.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
' If UsuarioActual.CveEmpresa = 66 Then
' DdlProducto2.ddlWS.Attributes.Add("data-pagina", "Inventarios")
' End If
' If Not DdlProducto2.UsaWebService AndAlso CType(DdlProducto2.DataSource, DataTable) Is Nothing Then
' DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoPS = 2")
' DdlProducto2.DataBind()
' DdlProducto2.ddl.Items.Insert(0, New ListItem("Seleccione", "-1"))
' End If
'End Sub
'Protected Sub DdlProducto2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlProducto2.selectedindexchange
' DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero, DdlProducto2)
'End Sub
'Private Sub DdlProducto2IndexChange(CvePSParametro As Integer, Ddl As ADServerControl.Dropdownlost)
' Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
' If drPS IsNot Nothing Then
' Dim Precio = drPS("Precio").ToString.ToDouble
' LbPrecioG.Text = Precio.FormatoNumero()
' LbPrecioA.Text = ((Precio * txtPorcentaje.Text.ToDecimal) / 100).FormatoNumero
' End If
'End Sub
Private Sub CargaGridPorcentajes()
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPorcentajeProductos(CveCliente) Then
If ObjPS.GetPorcentajeMarcas(CveCliente) Then
DTPorcentajePrecios = ObjPS.DtResultados
GvM.DataSource = DTPorcentajePrecios
End If
@@ -8244,13 +8197,14 @@ Partial Class Clientes
DdlMarcaPS.SelectedValue = "-1"
End Sub
Protected Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click
Protected Sub LbAgregarMarca_Click(sender As Object, e As EventArgs) Handles LbAgregarMarca.Click
If txtPorcentaje.Text.ToDecimal >= 0 And txtPorcentaje.Text.ToDecimal <= 100 Then
Dim registro As DataRow = DTPorcentajePrecios.NewRow
registro.Item("No") = DTPorcentajePrecios.Rows.Count + 1
registro.Item("CveMarca") = DdlMarcaPS.SelectedValue.ToEntero
registro.Item("Marca") = DdlMarcaPS.SelectedItem.Text
registro.Item("PorcentajeProducto") = txtPorcentaje.Text.ToDecimal
registro.Item("Estatus") = "I"
DTPorcentajePrecios.Rows.Add(registro)
@@ -8262,7 +8216,7 @@ Partial Class Clientes
LimpiaModalPorcentaje()
End Sub
Protected Sub DeleteRow(sender As Object, e As EventArgs)
Protected Sub DeleteRowMarca(sender As Object, e As EventArgs)
Dim lnkRemove As LinkButton = DirectCast(sender, LinkButton)
@@ -8322,6 +8276,238 @@ Partial Class Clientes
End Sub
Protected Sub BtnGuardarPorcentajesMarca_Click(sender As Object, e As EventArgs) Handles BtnGuardarPorcentajesMarca.Click
Dim TieneError As Boolean = False
Dim ObjPS As New ClsProductosServicios
ObjPS.IniciaTransacSQL()
For Each Dr As DataRow In DTPorcentajePrecios.Rows
If Dr("Estatus").ToString <> "" Then
If Dr("Estatus").ToString = "I" Then
If Not ObjPS.AddPorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal, UsuarioActual.CveUsuario) Then
TieneError = True
End If
ElseIf Dr("Estatus").ToString = "U" Then
If Not ObjPS.UpdatePorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal) Then
TieneError = True
End If
ElseIf Dr("Estatus").ToString = "D" Then
If Not ObjPS.RemovePorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero) Then
TieneError = True
End If
End If
End If
Next
If TieneError Then
ObjPS.RollBack()
Else
ObjPS.Commit()
Alert("Los Porcentajes se guardaron correctamente.", TipoMensaje.MsgInformacion)
RegistraScript("$('#DivPorcentajeMarcas').modal('hide')", "hidemodal")
End If
ObjPS.Dispose()
End Sub
#End Region
#Region "PORCENTAJE PRECIO DE PRODUCTOS"
Private Sub LnkPorcentajePrecios_Click(sender As Object, e As EventArgs) Handles LnkPorcentajePrecios.Click
RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajePrecios"))
CreaDT2()
TxtPorcentajePS.Attributes.Add("onchange", String.Format("FnCambiaPorcentaje({0});", "5"))
CargaPorcentajesProductos()
LimpiaModalPorcentaje2()
End Sub
Private Sub CreaDT2()
Dim DTPorcentajeTemp As New DataTable
Dim column As DataColumn = New DataColumn("No")
column.DataType = Type.GetType("System.Int32")
With column
.AutoIncrement = True
.AutoIncrementSeed = 1
.AutoIncrementStep = 1
End With
DTPorcentajeTemp.Columns.Add(column)
DTPorcentajeTemp.Columns.Add("CvePS", GetType(Integer))
DTPorcentajeTemp.Columns.Add("Producto", GetType(String))
DTPorcentajeTemp.Columns.Add("PrecioG", GetType(Decimal))
DTPorcentajeTemp.Columns.Add("PorcentajeProducto", GetType(Decimal))
DTPorcentajeTemp.Columns.Add("PrecioA", GetType(Decimal))
DTPorcentajeTemp.Columns.Add("Estatus", GetType(String))
DTPorcentajePrecios = DTPorcentajeTemp.Clone
End Sub
Private Sub CargaPorcentajesProductos()
'Llenar el dropdownlist de Secciones
If UsuarioActual.CveEmpresa = 66 Then
DdlClasificacion2.DataSource = GlobalDTSubFamilias(UsuarioActual.CveEmpresa).FiltraParametros("", Orderby:="Clasificacion")
Else
Dim ObjClasificaciones As New ClsClasificaciones
If ObjClasificaciones.GetClasificacionesExistencias(UsuarioActual.CveEmpresa) Then
DdlClasificacion2.DataSource = ObjClasificaciones.DtResultados
End If
ObjClasificaciones.Dispose()
End If
DdlClasificacion2.DataBind()
CargaPS()
CargaGridPorcentajes2()
UpPorcentajeP.Update()
End Sub
Private Sub CargaPS()
DdlProducto2.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
If UsuarioActual.CveEmpresa = 66 Then
DdlProducto2.ddlWS.Attributes.Add("data-pagina", "Inventarios")
End If
If Not DdlProducto2.UsaWebService AndAlso CType(DdlProducto2.DataSource, DataTable) Is Nothing Then
DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoPS = 2")
DdlProducto2.DataBind()
DdlProducto2.ddl.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
End Sub
Protected Sub DdlProducto2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlProducto2.selectedindexchange
DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero, DdlProducto2)
End Sub
Private Sub DdlProducto2IndexChange(CvePSParametro As Integer, Ddl As ADServerControl.Dropdownlost)
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
If drPS IsNot Nothing Then
Dim Precio = drPS("Precio").ToString.ToDouble
LbPrecioG.Text = Precio.FormatoNumero()
LbPrecioA.Text = ((Precio * TxtPorcentajePS.Text.ToDecimal) / 100).FormatoNumero
End If
End Sub
Private Sub CargaGridPorcentajes2()
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPorcentajeProductos(CveCliente) Then
DTPorcentajePrecios = ObjPS.DtResultados
GvP.DataSource = DTPorcentajePrecios
End If
ObjPS.Dispose()
GvP.DataBind()
UpPorcentajePS.Update()
End Sub
Private Sub CargaDTPorcentajePrecios2(DtTemp As DataTable)
GvP.DataSource = DtTemp
GvP.DataBind()
UpPorcentajePS.Update()
End Sub
Private Sub LimpiaModalPorcentaje2()
TxtPorcentajePS.Text = ""
DdlClasificacion2.SelectedValue = "-1"
DdlProducto2.SelectedText = ""
End Sub
Protected Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click
If DdlProducto2.SelectedText <> "" Then
If TxtPorcentajePS.Text.ToDecimal >= 0 And TxtPorcentajePS.Text.ToDecimal <= 100 Then
Dim registro As DataRow = DTPorcentajePrecios.NewRow
registro.Item("No") = DTPorcentajePrecios.Rows.Count + 1
registro.Item("CvePS") = DdlProducto2.SelectedValue.ToEntero
registro.Item("Producto") = DdlProducto2.SelectedText
registro.Item("PrecioG") = LbPrecioG.Text.ToDecimal
registro.Item("PrecioA") = LbPrecioG.Text.ToDecimal * TxtPorcentajePS.Text.ToDecimal / 100
registro.Item("PorcentajeProducto") = TxtPorcentajePS.Text.ToDecimal
registro.Item("Estatus") = "I"
DTPorcentajePrecios.Rows.Add(registro)
CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' "))
Else
Alert("El Porcentaje debe estar en un rango entre 0 y 100", TipoMensaje.MsgAdvertencia)
End If
Else
Alert("El campo <b>''Producto''</b> es necesario, por favor ingréselo.", TipoMensaje.MsgAdvertencia)
End If
LimpiaModalPorcentaje()
End Sub
Protected Sub DeleteRow(sender As Object, e As EventArgs)
Dim lnkRemove As LinkButton = DirectCast(sender, LinkButton)
If DTPorcentajePrecios.Rows.Count > 0 And lnkRemove.CommandArgument.ToString.Length > 0 Then
Dim i As Integer
i = lnkRemove.CommandArgument.ToString.ToEntero
Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", i))
If Drs.Count > 0 Then
If CveCliente > 0 AndAlso Drs(0)("CvePS").ToString.ToEntero > 0 Then
Drs(0)("Estatus") = "D"
Else
Drs(0).Delete()
End If
End If
DTPorcentajePrecios.AcceptChanges()
End If
GvP.EditIndex = -1
CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' "))
End Sub
Protected Sub GvP_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvP.RowEditing
GvP.EditIndex = e.NewEditIndex
CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' "))
End Sub
Protected Sub GvP_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvP.RowCancelingEdit
GvP.EditIndex = -1
CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' "))
End Sub
Protected Sub GvP_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvP.RowUpdating
Dim PorcentajeProducto As Double = GvP.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP").Text.ToDouble
If PorcentajeProducto >= 0 And PorcentajeProducto <= 100 Then
Dim No As Integer = GvP.Rows(e.RowIndex).DataKey("No").ToEntero
Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", No))
If Drs.Count > 0 Then
Drs(0)("PorcentajeProducto") = PorcentajeProducto
Drs(0)("PrecioA") = Drs(0)("PrecioG").ToString.ToDouble * PorcentajeProducto / 100
Drs(0)("Estatus") = "U"
End If
DTPorcentajePrecios.AcceptChanges()
GvP.EditIndex = -1
CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' "))
Else
Alert("El Porcentaje debe estar en un rango entre 0 y 100", TipoMensaje.MsgAdvertencia)
End If
End Sub
Protected Sub BtnGuardarPorcentajes_Click(sender As Object, e As EventArgs) Handles BtnGuardarPorcentajes.Click
Dim TieneError As Boolean = False
@@ -8362,9 +8548,9 @@ Partial Class Clientes
End Sub
'Protected Sub BtnCambiaPorcentaje_Click(sender As Object, e As EventArgs)
' DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero, DdlProducto2)
'End Sub
Protected Sub BtnCambiaPorcentaje_Click(sender As Object, e As EventArgs)
DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero, DdlProducto2)
End Sub
#End Region
#Region " A C U M U L A D O R E S"

45
localhost.sln Normal file
View File

@@ -0,0 +1,45 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2035
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "http://localhost", "http://localhost", "{82D0C8D1-3CF5-471D-92AF-71A9AE4B4335}"
ProjectSection(WebsiteProperties) = preProject
SccProjectName = ""$/localhost", CAAAAAAA"
SccAuxPath = ""
SccLocalPath = "."
SccProvider = "MSSCCI:Microsoft Visual SourceSafe"
UseIISExpress = "false"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.6"
Debug.AspNetCompiler.VirtualPath = "/localhost"
Debug.AspNetCompiler.PhysicalPath = "..\..\..\..\..\inetpub\SIGIT\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost"
Release.AspNetCompiler.PhysicalPath = "..\..\..\..\..\inetpub\SIGIT\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
SlnRelativePath = "..\..\..\..\..\inetpub\SIGIT\"
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{82D0C8D1-3CF5-471D-92AF-71A9AE4B4335}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{82D0C8D1-3CF5-471D-92AF-71A9AE4B4335}.Debug|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B4590109-7BF9-411C-A1AE-792C02707CE6}
EndGlobalSection
EndGlobal