This commit is contained in:
2024-09-23 09:40:26 -07:00
17 changed files with 1832 additions and 94 deletions

View File

@@ -723,6 +723,42 @@
</div>
</div>
</div>
<div class="row">
<div class="col-md-12" id="DivListaPrecios" runat="server" visible="false">
<div class="portlet xspadding light bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-briefcase font-green"></i>
<span class="caption-subject bold uppercase">Lista de Precios &nbsp;&nbsp;</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
</div>
<div class="portlet-body form">
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvMultiple" Width="100%" runat="server" GridLines="None" ClientIDMode="Static" AutoGenerateColumns="false" DataKeyNames="CvePrecioLista,PrecioLista,Precio"
CssClass="table table-striped table-advance table-hover ScrollAD mysmallbtn" data-sort="true" EmptyDataText="No se encontraron registros" OnRowDataBound="GvMultiple_RowDataBound">
<Columns>
<asp:BoundField DataField="PrecioLista" HeaderText="Lista de Precio" />
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<HeaderTemplate>
<asp:Label ID="LtlLista" runat="server">Precio</asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtPrecio" runat="server" MaxLength="39" onkeypress="return onlyNumberKey(event)" Style="text-align: right !important;"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
@@ -2672,7 +2708,19 @@
}
//TERMINA: ECOMMERCE
function onlyNumberKey(evt) {
// Only ASCII character in that range allowed
var ASCIICode = (evt.which) ? evt.which : evt.keyCode
if (ASCIICode > 31 && (ASCIICode < 48 || ASCIICode > 57)) {
if (ASCIICode == 46) {
return true
} else {
return false;
}
}
return true;
}
</script>

View File

@@ -141,6 +141,15 @@ Partial Class ProductosyServicios
ViewState("Imagen") = value
End Set
End Property
Private Property DtPreciosMultiple As DataTable
Get
Return If(IsNothing(ViewState("DtPreciosMultiple")), Nothing, CType(ViewState("DtPreciosMultiple"), DataTable))
End Get
Set(value As DataTable)
ViewState("DtPreciosMultiple") = value
End Set
End Property
#End Region
Private ReadOnly Property PermiteClasificacion2 As Boolean
@@ -273,6 +282,9 @@ Partial Class ProductosyServicios
'CargaFamilia(ViewState("CveSubFamilia").ToString.ToEntero)
CargaSucursaless()
CargaImpuestosLocales()
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
CargaListaPrecios()
End If
If UsuarioActual.TienePermisoProceso(122) Then
BtnEliminar.Visible = False
@@ -1714,6 +1726,10 @@ Partial Class ProductosyServicios
Next
End If
If Not TieneError AndAlso UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
GuardarListasPrecios(ObjProductosServicios)
End If
If ObjProductosServicios.CvePS > 0 And Not TieneError Then
TieneError = GuardaEcommerce()
End If
@@ -2967,6 +2983,58 @@ Partial Class ProductosyServicios
#End Region
#Region "LISTA PRECIOS"
Private Sub CargaListaPrecios()
Dim objPS As New ClsProductosServicios
If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, -1, CveClasificacion:=-1, CvePS:=CvePS,
CveProveedor:=-1, Estado:=-1, Marcas:="-1", CveModelo:=-1) Then
DtPreciosMultiple = objPS.DtResultados.Copy()
GvMultiple.DataSource = DtPreciosMultiple
End If
objPS.Dispose()
DivListaPrecios.Visible = True
GvMultiple.DataBind()
End Sub
Protected Sub GvMultiple_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim Valor As Decimal = DtPreciosMultiple.Rows(e.Row.RowIndex)(2).ToString().ToDecimal()
e.Row.FCTextBox("TxtPrecio").Text = Valor.FormatoNumero(2)
End If
End Sub
Private Sub GuardarListasPrecios(ObjPS As ClsProductosServicios)
Dim TieneError As Boolean = False
Try
For Each GvRow As GridViewRow In GvMultiple.Rows
Dim CvePrecioLista As Integer = GvRow.DataKey("CvePrecioLista").ToEntero()
Dim Precio As Decimal = GvRow.FCTextBox("TxtPrecio").Text.ToDecimal()
TieneError = Not ObjPS.UpdatePSPreciosLista(Precio, CvePrecioLista, 0, CvePS, UsuarioActual.CveUsuario, NowADS(), True)
If TieneError Then
Exit For
End If
Next
Catch ex As Exception
OnError("Ocurrió un error al actualizar precios", ex)
TieneError = True
End Try
If TieneError Then
Alert("Ocurrió un error al actualizar precios", TipoMensaje.MsgError)
End If
End Sub
#End Region
#Region "EXISTENCIAS"
Protected Sub GVExistencias_RowDataBound(sender As Object, e As GridViewRowEventArgs)

View File

@@ -56,6 +56,9 @@
<li>
<asp:LinkButton ID="LnkVerGrafica" OnClick="LnkVerGrafica_Click" runat="server">Ver Grafica</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkModalPorcentajes" OnClick="LnkModalPorcentajes_Click" runat="server" Visible="false"><i class="fa fa-list" aria-hidden="true"></i> Consultar porcentajes</asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>
<li>
@@ -275,6 +278,106 @@
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DivModalPorcetajes" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog modal-lg" runat="server" ID="UpModalPorcentajes" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content" style="width:700px!important">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">
<asp:Label ID="LblModalTituloPorcentajes" runat="server" ClientIDMode="Static" Text="">Consulta Porcentajes</asp:Label>
</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-3">
<div class="form-group form-md-line-input input-iconright date date-picker date date-picker" style="min-width: 135px; margin-top: -10px !important;">
<label for="<%= TxtModalFechaInicio.ClientID.ToString()%>" style="color: #888888;">Fecha Inicio: </label>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;">
<asp:TextBox ID="TxtModalFechaInicio" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Width="100px"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkTxtModalFechaInicio" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="METxtModalFechaInicio" runat="server" TargetControlID="TxtModalFechaInicio" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CETxtModalFechaInicio" TargetControlID="TxtModalFechaInicio" PopupButtonID="LnkTxtModalFechaInicio" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RfvTxtModalFechaInicio" CssClass="help-block errorimput" runat="server" ControlToValidate="TxtModalFechaInicio" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Inicio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpModalPorcentaje"></asp:RequiredFieldValidator>
</div>
</div>
<div class="col-md-3">
<div class="form-group form-md-line-input input-iconright date date-picker date date-picker" style="min-width: 135px; margin-top: -10px !important;">
<label for="<%= TxtModalFechaFin.ClientID.ToString()%>" style="color: #888888;">Fecha Fin: </label>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;">
<asp:TextBox ID="TxtModalFechaFin" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Width="100px"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkTxtModalFechaFin" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="METxtModalFechaFin" runat="server" TargetControlID="TxtModalFechaFin" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CETxtModalFechaFin" TargetControlID="TxtModalFechaFin" PopupButtonID="LnkTxtModalFechaFin" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RfvLnkTxtModalFechaFin" CssClass="help-block errorimput" runat="server" ControlToValidate="TxtModalFechaFin" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Fin''</b> es necesario, por favor ingréselo." ValidationGroup="GrpModalPorcentaje"></asp:RequiredFieldValidator>
</div>
</div>
<div class="col-md-3">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtModalPorcentaje" runat="server" CausesValidation="true" CssClass="form-control" MaxLength="13" Text="5" Enabled="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RfvTxtModalPorcentaje" CssClass="help-block errorimput" runat="server" ControlToValidate="TxtModalPorcentaje" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Porcentaje''</b> es necesario, por favor ingréselo." ValidationGroup="GrpModalPorcentaje"></asp:RequiredFieldValidator>
<ajax:FilteredTextBoxExtender ID="FIETTxtModalPorcentaje" TargetControlID="TxtModalPorcentaje" FilterType="Numbers,Custom" ValidChars="-" runat="server" />
<label for="<%= TxtModalPorcentaje.ClientID.ToString()%>">Porcentaje Menor a:</label>
</div>
</div>
<div class="col-md-3">
<asp:Button runat="server" ID="BtnModalConsultaPorcentaje" CssClass="btn btn-primary" Text="Consultar" CausesValidation="true" ValidationGroup="GrpModalPorcentaje" OnClick="BtnModalConsultaPorcentaje_Click" />
</div>
</div>
<div class="row">
<div class="col-md-12" style="height:10px!important"></div>
</div>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvPorcentajes" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Ventas Utilidad con los filtros especificados"
CssClass="table table-advance table-hover Widthall ScrollAD" data-sort="true" GridLines="None" OnRowDataBound="GvPorcentajes_RowDataBound" >
<Columns>
<asp:BoundField ItemStyle-HorizontalAlign="Left" HeaderText="SubProyecto" DataField="SubProyecto" ItemStyle-Width="200px" />
<asp:HyperLinkField ItemStyle-HorizontalAlign="Center" HeaderText="Serie Folio" DataTextField="SerieFolio" DataTextFormatString="{0}" Target="_blank"
DataNavigateUrlFields="CveVenta"
DataNavigateUrlFormatString="Ventas.aspx?CveVenta={0}" />
<asp:BoundField ItemStyle-HorizontalAlign="Center" HeaderText="Fecha" DataField="FechaVenta" DataFormatString="{0:d}" ItemStyle-Width="100px" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="SubTotal" DataField="SubTotal" DataFormatString="{0:N}" ItemStyle-Width="100px" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="Costo" DataField="Costo" DataFormatString="{0:N}" ItemStyle-Width="100px" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="% Neto" DataField="PorNeto" DataFormatString="{0:N}" ItemStyle-Width="100px" />
</Columns>
</asp:GridView>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div id="DivModalGrafica" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog modal-lg" runat="server" ID="UPModalProd" UpdateMode="Conditional">
<ContentTemplate>
@@ -288,18 +391,20 @@
<div class="modal-body">
<div class="row">
<label class="col-md-1 truncate">Ver:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlVer" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlVer_SelectedIndexChanged" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
<asp:ListItem Selected="True" Text="Neto" Value="1"></asp:ListItem>
<asp:ListItem Text="Rentabilidad" Value="2"></asp:ListItem>
</asp:DropDownList>
</div>
<label class="col-md-1 truncate">Ver:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlVer" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlVer_SelectedIndexChanged" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
<asp:ListItem Selected="True" Text="Neto" Value="1"></asp:ListItem>
<asp:ListItem Text="Rentabilidad" Value="2"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
<br />
<br />
<div id="chartdiv"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
</div>
@@ -307,6 +412,10 @@
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>

View File

@@ -32,19 +32,37 @@ Partial Class Ventas_RepVentasUtilidadPadre
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
'If UsuarioActual.Empresa.Funcionalidad(382) <> "1" Then
' GvDatos.Columns(3).Visible = False
' GvDatos.Columns(5).Visible = False
'End If
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
LnkModalPorcentajes.Visible = True
End If
CargaCombos()
End If
End Sub
Private Property SubProyectoConf As String
Get
If ViewState("SubProyectoConf") Is Nothing Then
ViewState("SubProyectoConf") = ""
End If
Return ViewState("SubProyectoConf").ToString
End Get
Set(value As String)
ViewState("SubProyectoConf") = value
End Set
End Property
#Region " INICIALIZA VALORES "
Private Sub CargaCombos()
TxtModalFechaInicio.Text = NowADS().FirstDayOfMonth.ToShortDateString
TxtModalFechaFin.Text = NowADS().LastDayOfMonth.ToShortDateString
txtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString
txtFechaF.Text = NowADS().LastDayOfMonth.ToShortDateString
@@ -108,6 +126,12 @@ Partial Class Ventas_RepVentasUtilidadPadre
LblNeto.Text = "0"
LblPorNeto.Text = "0"
Dim LblSubProyectoConf As New Label
CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyectoConf)
SubProyectoConf = LblSubProyectoConf.Text
End Sub
Protected Sub DdlCategoria_SelectedIndexChanged(sender As Object, e As EventArgs)
@@ -315,4 +339,42 @@ Partial Class Ventas_RepVentasUtilidadPadre
#End Region
Protected Sub LnkModalPorcentajes_Click(sender As Object, e As EventArgs)
GvPorcentajes.DataSource = Nothing
GvPorcentajes.DataBind()
UpModalPorcentajes.Update()
RegistraScript("$('#DivModalPorcetajes').modal(`show`);")
End Sub
Protected Sub BtnModalConsultaPorcentaje_Click(sender As Object, e As EventArgs)
Dim ObjVentas As New ClsVentas()
Dim FechaI As Date = TxtModalFechaInicio.Text.ToDate
Dim FechaF As Date = TxtModalFechaFin.Text.ToDate
If TxtModalFechaInicio.Text = "" Then FechaI = MinFecha
If TxtModalFechaFin.Text = "" Then FechaF = MaxFecha
If ObjVentas.GetReporteVentasUtilidad("-1", -1, "-1", FechaI, FechaF, UsuarioActual.CveEmpresa, -1, -1, -1, -1, -1) Then
GvPorcentajes.DataSource = ObjVentas.DtResultados.FiltraParametros($" CveVenta > 0 AND PorNeto <= {TxtModalPorcentaje.Text.ToDecimal} AND TipoDocto = 'Ing' AND CveEstatusFactura IN(2,3) ")
End If
ObjVentas.Dispose()
GvPorcentajes.DataBind()
ObjVentas.Dispose()
UpModalPorcentajes.Update()
End Sub
Protected Sub GvPorcentajes_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.Header Then
e.Row.Cells(0).Text = SubProyectoConf
End If
End Sub
End Class