This commit is contained in:
2024-08-21 07:11:21 -07:00
8 changed files with 345 additions and 7 deletions

View File

@@ -6247,13 +6247,14 @@ Public Class ClsInventarios
Return Retorno Return Retorno
End Function End Function
Public Function UpdatePedidoDetalleCantidad(CveVentaDetalle As Integer, Cantidad As Decimal) As Boolean Public Function UpdatePedidoDetalleCantidad(CveVentaDetalle As Integer, Cantidad As Decimal, Optional Opcion As Integer = 1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasDetalleCantidadUpdate") DataAdapter("PA_Vta_VentasDetalleCantidadUpdate")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVentaDetalle .Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVentaDetalle
.Add("@Cantidad", SqlDbType.Money).Value = Cantidad .Add("@Cantidad", SqlDbType.Money).Value = Cantidad
.Add("@Opcion", SqlDbType.Int).Value = Opcion
End With End With
Try Try

View File

@@ -10819,7 +10819,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Ventas/RepComisionesSMS.aspx".ToUpper(), 1347) PaginaDict.Add("/Ventas/RepComisionesSMS.aspx".ToUpper(), 1347)
PaginaDict.Add("/Ventas/RepVencimientosCredito.aspx".ToUpper(), 146) PaginaDict.Add("/Ventas/RepVencimientosCredito.aspx".ToUpper(), 146)
PaginaDict.Add("/Ventas/CatMotivosDevoluciones.aspx".ToUpper(), 786) PaginaDict.Add("/Ventas/CatMotivosDevoluciones.aspx".ToUpper(), 786)
PaginaDict.Add("/Ventas/CatPSSubProyectosVendedores.aspx".ToUpper(), 787)
#End Region #End Region
#Region "Varios" #Region "Varios"

View File

@@ -7426,6 +7426,60 @@ Public Class ClsVentas
Return Retorno Return Retorno
End Function End Function
#Region "PRODUCTOS/SERVICIOS, SUBPROYECTOS Y VENDEDORES"
Public Function GetPSSubProyectosVendedores(CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_ProductosSubProyectosVendedoresGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener los ps, subproyectos y vendedores.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function AddPSSubProyectosVendedores(CvePS As Integer, CveSubProyecto As Integer, CveVendedor As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_ProductosSubProyectosVendedoresAdd")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al guardar el ps, subproyecto y vendedor.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function RemovePSSubProyectosVendedores(CvePS As Integer, CveSubProyecto As Integer, CveVendedor As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_ProductosSubProyectosVendedoresRemove")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al eliminar el ps, subproyecto y vendedor.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
#End Region
#Region "IDisposable Support" #Region "IDisposable Support"

View File

@@ -170,23 +170,30 @@
DataKeyNames="EsDevolucionVenta" DataKeyNames="EsDevolucionVenta"
data-sort="true" EmptyDataText="No se encontraron resultados." AutoGenerateColumns="False" > data-sort="true" EmptyDataText="No se encontraron resultados." AutoGenerateColumns="False" >
<Columns> <Columns>
<%--0--%>
<asp:BoundField HeaderText="Tipo Docto" DataField="TipoDocto" ItemStyle-Width="55px" /> <asp:BoundField HeaderText="Tipo Docto" DataField="TipoDocto" ItemStyle-Width="55px" />
<%--1--%>
<asp:HyperLinkField DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="~/Ventas/Ventas.aspx?CveVenta={0}" Target="_blank" ItemStyle-Width="80px" HeaderText="SerieFolio" ControlStyle-CssClass="Texto" DataTextField="SerieFolio" /> <asp:HyperLinkField DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="~/Ventas/Ventas.aspx?CveVenta={0}" Target="_blank" ItemStyle-Width="80px" HeaderText="SerieFolio" ControlStyle-CssClass="Texto" DataTextField="SerieFolio" />
<%-- <asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Center" />--%>
<asp:TemplateField HeaderText="Fecha" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Center"> <asp:TemplateField HeaderText="Fecha" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Center">
<ItemTemplate> <ItemTemplate>
<asp:Label ID="LtlFechaFactura" runat="server" ></asp:Label> <asp:Label ID="LtlFechaFactura" runat="server" ></asp:Label>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<%--2--%>
<asp:HyperLinkField DataNavigateUrlFields="CveCliente" DataNavigateUrlFormatString="~/Ventas/Clientes.aspx?CveCliente={0}" Target="_blank" HeaderText="Cliente" ControlStyle-CssClass="Texto" ItemStyle-HorizontalAlign="Left" DataTextField="Nombre" /> <asp:HyperLinkField DataNavigateUrlFields="CveCliente" DataNavigateUrlFormatString="~/Ventas/Clientes.aspx?CveCliente={0}" Target="_blank" HeaderText="Cliente" ControlStyle-CssClass="Texto" ItemStyle-HorizontalAlign="Left" DataTextField="Nombre" />
<%--3--%>
<asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:n2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:n2}" ItemStyle-HorizontalAlign="Right" />
<%--4--%>
<asp:BoundField HeaderText="Sucursal" DataField="SubProyecto" ItemStyle-Width="100px" /> <asp:BoundField HeaderText="Sucursal" DataField="SubProyecto" ItemStyle-Width="100px" />
<%--5--%>
<asp:BoundField HeaderText="Tipo Venta" DataField="TipoVenta" Visible="false" /> <asp:BoundField HeaderText="Tipo Venta" DataField="TipoVenta" Visible="false" />
<%--6--%>
<asp:BoundField HeaderText="Médico" DataField="Medico" Visible="false" /> <asp:BoundField HeaderText="Médico" DataField="Medico" Visible="false" />
<%--7--%>
<asp:BoundField HeaderText="Procedimiento" DataField="Procedimiento" Visible="false" /> <asp:BoundField HeaderText="Procedimiento" DataField="Procedimiento" Visible="false" />
<%--8--%>
<asp:BoundField HeaderText="Sutido" DataField="Surtido" DataFormatString="{0:n2}" ItemStyle-HorizontalAlign="Right" />
<%--9--%>
<asp:TemplateField ItemStyle-Width="70px" HeaderText="Acción" ItemStyle-HorizontalAlign="Center"> <asp:TemplateField ItemStyle-Width="70px" HeaderText="Acción" ItemStyle-HorizontalAlign="Center">
<ItemTemplate> <ItemTemplate>

View File

@@ -88,6 +88,7 @@ Partial Class RepNotasSinAlmacen
GvVentas.Columns(6).Visible = True GvVentas.Columns(6).Visible = True
GvVentas.Columns(7).Visible = True GvVentas.Columns(7).Visible = True
GvVentas.Columns(8).Visible = True GvVentas.Columns(8).Visible = True
GvVentas.Columns(9).Visible = True
TxtFechaF.Text = NowADS.AddDays(3).ToShortDateString TxtFechaF.Text = NowADS.AddDays(3).ToShortDateString
GvVentas.Columns(4).Visible = False GvVentas.Columns(4).Visible = False

View File

@@ -7,6 +7,11 @@ Imports System.Data
Imports System.Data.SqlClient Imports System.Data.SqlClient
Imports System.Diagnostics Imports System.Diagnostics
Imports System.ServiceModel.Security Imports System.ServiceModel.Security
Imports RVCFDI.RVLTimbrado
Imports Microsoft.Owin.Security.Provider
Imports Telerik.Web.UI
Partial Class OS_OrdenesServicios Partial Class OS_OrdenesServicios
Inherits ClsPaginas Inherits ClsPaginas
@@ -3139,6 +3144,37 @@ Partial Class OS_OrdenesServicios
ProcesoOK = False ProcesoOK = False
End If End If
Dim DT_Ventas_Detalles As DataTable = DTSolicitudDev.FiltraParametros("", "", {"CantidadPedido", "CvePS", "CveVentaDetalle"})
DT_Ventas_Detalles.Columns.Add("CantidadUsada", GetType(Decimal))
DT_Ventas_Detalles.AcceptChanges()
For Each dRow As DataRow In DT_Ventas_Detalles.Rows
For Each gvRow As GridViewRow In GvMU.Rows
Dim CantidadUsada As Decimal = gvRow.FCTextBox("TxtUtilizado").Text.ToDecimal
If dRow("CvePS").ToString.ToDecimal = gvRow.DataKey("CvePS").ToDecimal AndAlso CantidadUsada > 0 Then
dRow("CantidadUsada") = dRow("CantidadUsada").ToString.ToDecimal + CantidadUsada
End If
Next
Next
For Each dRow As DataRow In DT_Ventas_Detalles.Rows
Dim CantidadUsada As Decimal = dRow("CantidadUsada").ToString.ToDecimal
If dRow("CantidadUsada").ToString.ToDecimal < dRow("CantidadPedido").ToString.ToDecimal Then
If Not ObjInventario.UpdatePedidoDetalleCantidad(dRow("CveVentaDetalle").ToString.ToEntero, CantidadUsada, 2) Then
ProcesoOK = False
Exit For
End If
End If
Next
Else Else
If ProcesoOK Then If ProcesoOK Then
Dim AplicaDevolucion As Boolean = False Dim AplicaDevolucion As Boolean = False
@@ -3424,6 +3460,44 @@ Partial Class OS_OrdenesServicios
Dim CveMoneda As Integer = -1 Dim CveMoneda As Integer = -1
Dim tCveVendedor As Integer = -1 Dim tCveVendedor As Integer = -1
Dim CountDetalles As Integer = 0
Dim PuEnCero As Boolean = False
For Each GvRow As GridViewRow In GvMU.Rows
Dim CantidadRegistro As Decimal = GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal
Dim PU As Decimal = GvRow.DataKey("PU").ToDecimal
Dim CodigoPS As String = GvRow.DataKey("CodigoPS")
If CantidadRegistro > 0 Then
If PU > 0 Then
CountDetalles = CountDetalles + 1
Else
Alert($"Prodcuto {CodigoPS} con precio unitario en cero.", TipoMensaje.MsgAdvertencia)
PuEnCero = True
End If
End If
Next
If PuEnCero Then
Respuesta.CveVenta = -1
Respuesta.SerieFolio = ""
Respuesta.dtdetalle = New DataTable
Return Respuesta
End If
If CountDetalles = 0 Then
Respuesta.CveVenta = -1
Respuesta.SerieFolio = ""
Respuesta.dtdetalle = New DataTable
Alert("Remision sin detalles.", TipoMensaje.MsgAdvertencia)
Return Respuesta
End If
If ObjVentas.GetVenta(CvePedido, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.GetVenta(CvePedido, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Copy().Rows(0) Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Copy().Rows(0)
CveMoneda = DbRowVenta("CveMoneda").ToString.ToEntero CveMoneda = DbRowVenta("CveMoneda").ToString.ToEntero

View File

@@ -0,0 +1,94 @@
<%@ Page Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="True" CodeFile="CatPSSubProyectosVendedores.aspx.vb" Inherits="Ventas_CatPSSubProyectosVendedores" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
Catalogo de Productos/Servicios, SubProyectos y Vendedores
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="HA" runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkAgregar" OnClick="LnkAgregar_Click" runat="server"><i class="fa fa-plus"></i>Agregar</asp:LinkButton></li>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row" style="margin-right: 10px; margin-top: 18px;" align="right">
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvPSSubProyectosVendedores.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvPSSubProyectosVendedores.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
<br />
<asp:GridView ID="GvPSSubProyectosVendedores" runat="server" GridLines="None" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="100%" AutoGenerateColumns="False"
DataKeyNames="CvePS,CodigoPS,CveSubProyecto,SubProyecto,CveVendedor,Vendedor" >
<Columns>
<asp:TemplateField HeaderText="PS" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblps" runat="server" Text='<%# Eval("CodigoPS")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SubProyecto" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblsubproyecto" runat="server" Text='<%# Eval("SubProyecto")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Vendedor" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblvendedor" runat="server" Text='<%# Eval("Vendedor")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="15%" HeaderText="Comandos">
<ItemTemplate>
<asp:LinkButton ID="imgD" runat="server" OnClick="LnkEliminar_Click" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar?" data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DModalAdd" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpModalAdd" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header ">
<h4 class="modal-title">
<asp:Literal ID="ltltitulo" Text="Productos/Servicios, SubProyectos y Vendedores" runat="server"> </asp:Literal></h4>
</div>
<div class="modal-body">
<div class="form-group form-md-line-input input-iconright">
<ADS:Dropdownlost runat="server" ID="DdlPS" CssStyle="width:100%" CssClass="form-control input-sm DdlPS" CssClassDdl="select2me" DataTextField="PSCodigo" DataValueField="CvePS" />
<label for="<%= DdlPS.ClientID.ToString()%>">
Productos / Servicio:<label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSubProyecto" CssClass="form-control input-sm select2me" Width="100%" runat="server" DataTextField="SubProyecto" DataValueField="CveSubProyecto"></asp:DropDownList>
<label for="<%= DdlSubProyecto.ClientID.ToString()%>">SubProyecto:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlVendedor" DataTextField="Vendedor" DataValueField="CveVendedor" CausesValidation="true" runat="server" Width="100%" AppendDataBoundItems="true" CssClass="form-control input-sm select2me"></asp:DropDownList>
<label for="<%= DdlVendedor.ClientID.ToString()%>">Vendedor:</label>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnAdd" OnClick="BtnAdd_Click" runat="server" Text="Agregar" CssClass="btn btn-primary" />
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>

View File

@@ -0,0 +1,107 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Partial Class Ventas_CatPSSubProyectosVendedores
Inherits ClsPaginas
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Not IsPostBack Then
CargaDatos()
CargaCombos()
End If
End Sub
Protected Sub CargaDatos()
Dim ObjVentas As ClsVentas = New ClsVentas()
If ObjVentas.GetPSSubProyectosVendedores(UsuarioActual.CveEmpresa) Then
GvPSSubProyectosVendedores.DataSource = ObjVentas.DtResultados
GvPSSubProyectosVendedores.DataBind()
End If
ObjVentas.Dispose()
UpDatos.Update()
End Sub
Protected Sub CargaCombos()
DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then
DdlPS.SelectedText = ""
DdlPS.SelectedValue = "-1"
Else
DdlPS.ddl.Items.Clear()
DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
DdlPS.ddl.DataBind()
DdlPS.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1"))
End If
DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
DdlVendedor.DataBind()
DdlVendedor.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlSubProyecto.DataSource = GlobalDTSubProyectos(UsuarioActual.CveEmpresa)
DdlSubProyecto.DataBind()
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
UpModalAdd.Update()
End Sub
Protected Sub LimpiaRegistro()
DdlPS.SelectedValue = "-1"
DdlPS.SelectedText = ""
DdlVendedor.SelectedIndex = 0
DdlSubProyecto.SelectedIndex = 0
UpModalAdd.Update()
End Sub
Protected Sub LnkAgregar_Click(ByVal sender As Object, ByVal e As EventArgs)
RegistraScript("$('#DModalAdd').modal();")
LimpiaRegistro()
UpModalAdd.Update()
End Sub
Protected Sub BtnAdd_Click(ByVal sender As Object, ByVal e As EventArgs)
If DdlPS.SelectedValue = "" Then
Alert("Tiene que seleccionar un producto/servicio.")
Return
End If
If DdlVendedor.SelectedValue = "-1" Then
Alert("Tiene que seleccionar un vendedor.")
Return
End If
If DdlSubProyecto.SelectedValue = "-1" Then
Alert("Tiene que seleccionar un subproyecto.")
Return
End If
Dim ObjVentas As ClsVentas = New ClsVentas()
Dim Continuar As Boolean = ObjVentas.AddPSSubProyectosVendedores(DdlPS.SelectedValue.ToEntero(), DdlSubProyecto.SelectedValue.ToEntero(), DdlVendedor.SelectedValue.ToEntero())
ObjVentas.Dispose()
If Continuar Then
RegistraScript("$('#DModalAdd').modal('hide');")
LimpiaRegistro()
Alert("El registro se ha agregado")
CargaDatos()
End If
End Sub
Protected Sub LnkEliminar_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim gvRow As GridViewRow = CType(((CType(sender, LinkButton)).NamingContainer), GridViewRow)
Dim ObjVentas As ClsVentas = New ClsVentas()
Dim Continuar As Boolean = ObjVentas.RemovePSSubProyectosVendedores(gvRow.DataKey("CvePS").ToEntero(), gvRow.DataKey("CveSubProyecto").ToEntero(), gvRow.DataKey("CveVendedor").ToEntero())
ObjVentas.Dispose()
If Continuar Then
CargaDatos()
Alert("El registro se ha eliminado")
End If
End Sub
End Class