4to. Revisión Promociones
This commit is contained in:
@@ -6267,6 +6267,24 @@ Public Class ClsInventarios
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function GetUltimoCosto(CveEmpresa As Integer) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
DataAdapter("PA_Inv_UltimoCostoGet")
|
||||||
|
|
||||||
|
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 consultar los productos por ultimo costo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
#Region " IDisposable Support "
|
#Region " IDisposable Support "
|
||||||
' IDisposable
|
' IDisposable
|
||||||
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
|
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
|
||||||
|
|||||||
@@ -3385,7 +3385,7 @@ Public Class ClsVentas
|
|||||||
Public Function GetReportePadreVentasUtilidad(CveVendedor As String, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Gpo As Integer,
|
Public Function GetReportePadreVentasUtilidad(CveVendedor As String, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Gpo As Integer,
|
||||||
CvePS As Integer, CveCategoria As Integer, CveClasificacion As Integer, CveMarca As Integer, EsGarantia As Integer, EsFilial As Integer) As Boolean
|
CvePS As Integer, CveCategoria As Integer, CveClasificacion As Integer, CveMarca As Integer, EsGarantia As Integer, EsFilial As Integer) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_Vta_RepVentasUtilidadGet")
|
DataAdapter("PA_Vta_RepVentasUtilidadGetOIC")
|
||||||
|
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
.Add("@FechaI", SqlDbType.Date).Value = FechaInicio
|
.Add("@FechaI", SqlDbType.Date).Value = FechaInicio
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2315,7 +2315,8 @@ select.input-sm {
|
|||||||
|
|
||||||
.contabilidadbody .portlet-title .font-green,
|
.contabilidadbody .portlet-title .font-green,
|
||||||
.contabilidadbody .portlet-title .font-green a {
|
.contabilidadbody .portlet-title .font-green a {
|
||||||
color: #F7F7F7 !important;
|
color: #26a69a !important;
|
||||||
|
/*color: #F7F7F7 !important;*/
|
||||||
}
|
}
|
||||||
/*RH recursos humanos*/
|
/*RH recursos humanos*/
|
||||||
.rhumanosbody .page-bar .page-breadcrumb > li > a,
|
.rhumanosbody .page-bar .page-breadcrumb > li > a,
|
||||||
|
|||||||
@@ -19,6 +19,11 @@
|
|||||||
<asp:Content ID="Content3" ContentPlaceHolderID="CP" runat="Server">
|
<asp:Content ID="Content3" ContentPlaceHolderID="CP" runat="Server">
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content4" ContentPlaceHolderID="CSS" runat="Server">
|
<asp:Content ID="Content4" ContentPlaceHolderID="CSS" runat="Server">
|
||||||
|
<style>
|
||||||
|
.font-green {
|
||||||
|
color: #26a69a !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content5" ContentPlaceHolderID="E" runat="Server">
|
<asp:Content ID="Content5" ContentPlaceHolderID="E" runat="Server">
|
||||||
Promociones
|
Promociones
|
||||||
@@ -35,7 +40,7 @@
|
|||||||
<div class="portlet-title">
|
<div class="portlet-title">
|
||||||
<div class="caption font-green">
|
<div class="caption font-green">
|
||||||
<i class="icon-pin font-green"></i>
|
<i class="icon-pin font-green"></i>
|
||||||
<span class="caption-subject bold uppercase">DATOS GENERALES</span>
|
<span class="caption-subject font-green bold uppercase">DATOS GENERALES</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
@@ -180,7 +185,7 @@
|
|||||||
<div class="portlet-title">
|
<div class="portlet-title">
|
||||||
<div class="caption font-green">
|
<div class="caption font-green">
|
||||||
<i class="icon-pin font-green"></i>
|
<i class="icon-pin font-green"></i>
|
||||||
<span class="caption-subject bold uppercase">PRODUCTOS / SERVICIOS</span>
|
<span class="caption-subject font-green bold uppercase">PRODUCTOS / SERVICIOS</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="tools">
|
<div class="tools">
|
||||||
|
|
||||||
@@ -195,7 +200,7 @@
|
|||||||
<div class="portlet-body form">
|
<div class="portlet-body form">
|
||||||
|
|
||||||
<asp:GridView ID="GvDatos"
|
<asp:GridView ID="GvDatos"
|
||||||
DataKeyNames="CvePromocionDetalle, CveClasificacion, CvePS, CodigoPS, HoraInicio, HoraFin, CveTipoPromocion, Promocion, PUAnterior, AplicaRestriccion, AplicaLunes, AplicaMartes, AplicaMiercoles, AplicaJueves, AplicaViernes, AplicaSabado, AplicaDomingo, CantidadMinima, CveRinTamaño,IncluyeImpuestos"
|
DataKeyNames="CvePromocionDetalle, CveClasificacion, CvePS, CodigoPS, HoraInicio, HoraFin, CveTipoPromocion, Promocion, PUAnterior, AplicaRestriccion, AplicaLunes, AplicaMartes, AplicaMiercoles, AplicaJueves, AplicaViernes, AplicaSabado, AplicaDomingo, CantidadMinima, CveRinTamaño,IncluyeImpuestos, UltimoCosto, CostoPromedio"
|
||||||
CssClass="table table-striped table-hover Widthall mysmallbtn" AutoGenerateColumns="false" GridLines="None" EmptyDataText="Aun no se registran detalles" runat="server"
|
CssClass="table table-striped table-hover Widthall mysmallbtn" AutoGenerateColumns="false" GridLines="None" EmptyDataText="Aun no se registran detalles" runat="server"
|
||||||
OnRowDataBound="GvDatos_RowDataBound"
|
OnRowDataBound="GvDatos_RowDataBound"
|
||||||
>
|
>
|
||||||
@@ -306,15 +311,25 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<label class="col-md-3 truncate">Producto:</label>
|
<label class="col-md-3 truncate">Producto:</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<ADS:Dropdownlost runat="server" Enabled="true" ID="DdlPS" CssStyle="width: 100%;" CssClassDdl="select2me" DataTextField="PSCodigo" DataValueField="CvePS"/>
|
<ADS:Dropdownlost runat="server" Enabled="true" ID="DdlPS" CssStyle="width: 100%;" CssClassDdl="select2me" DataTextField="PSCodigo" DataValueField="CvePS" Onselectedindexchange="DdlPS_selectedindexchange" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row" style="display:none">
|
||||||
<label class="col-md-3 truncate">P.U. Actual:</label>
|
<label class="col-md-3 truncate">Ultimo Costo:</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-3">
|
||||||
<asp:Label Text="" ID="LbPUActual" runat="server" />
|
<asp:Label Text="" ID="LbPUActual" runat="server" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<label class="col-md-3 truncate">Ultimo Costo:</label>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<asp:Label Text="" ID="LblUltimoCosto" runat="server" />
|
||||||
|
</div>
|
||||||
|
<label class="col-md-3 truncate">Costo Promedio:</label>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<asp:Label Text="" ID="LblCostoPromedio" runat="server" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label class="col-md-3 truncate">Tipo Promoción:</label>
|
<label class="col-md-3 truncate">Tipo Promoción:</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
Option Explicit On
|
Option Explicit On
|
||||||
Option Strict On
|
Option Strict On
|
||||||
|
|
||||||
|
Imports System.Activities.Expressions
|
||||||
Imports System.Data
|
Imports System.Data
|
||||||
Imports DocumentFormat.OpenXml.Drawing.Diagrams
|
Imports DocumentFormat.OpenXml.Drawing.Diagrams
|
||||||
Imports Extensiones
|
Imports Extensiones
|
||||||
@@ -59,7 +60,6 @@ Partial Class Ventas_Promociones
|
|||||||
|
|
||||||
Private Property CvePromocionPadre As Integer
|
Private Property CvePromocionPadre As Integer
|
||||||
Get
|
Get
|
||||||
|
|
||||||
If ViewState("CvePromocionPadre") Is Nothing Then
|
If ViewState("CvePromocionPadre") Is Nothing Then
|
||||||
ViewState("CvePromocionPadre") = -1
|
ViewState("CvePromocionPadre") = -1
|
||||||
End If
|
End If
|
||||||
@@ -70,21 +70,115 @@ Partial Class Ventas_Promociones
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Private Property PorMinMasCostoVentaFnc129 As Decimal
|
||||||
|
Get
|
||||||
|
|
||||||
|
If ViewState("PorMinMasCostoVentaFnc129") Is Nothing Then
|
||||||
|
ViewState("PorMinMasCostoVentaFnc129") = -1
|
||||||
|
End If
|
||||||
|
Return ViewState("PorMinMasCostoVentaFnc129").ToString.ToDecimal
|
||||||
|
End Get
|
||||||
|
Set(value As Decimal)
|
||||||
|
ViewState("PorMinMasCostoVentaFnc129") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
|
||||||
|
Private Property DTPSUltimoCosto As DataTable
|
||||||
|
Get
|
||||||
|
If ViewState("DTPSUltimoCosto") Is Nothing Then
|
||||||
|
ViewState("DTPSUltimoCosto") = New DataTable
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return CType(ViewState("DTPSUltimoCosto"), DataTable)
|
||||||
|
End Get
|
||||||
|
Set(value As DataTable)
|
||||||
|
ViewState("DTPSUltimoCosto") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Private Property PermisoAutorizPromocionPorcentaje As Boolean
|
||||||
|
Get
|
||||||
|
If ViewState("PermisoAutorizPromocionPorcentaje") Is Nothing Then
|
||||||
|
ViewState("PermisoAutorizPromocionPorcentaje") = False
|
||||||
|
End If
|
||||||
|
Return Boolean.Parse(ViewState("PermisoAutorizPromocionPorcentaje").ToString)
|
||||||
|
End Get
|
||||||
|
Set(value As Boolean)
|
||||||
|
ViewState("PermisoAutorizPromocionPorcentaje") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Private Property BloqueadoPromocionPorcentaje As Boolean
|
||||||
|
Get
|
||||||
|
|
||||||
|
If ViewState("BloqueadoPromocionPorcentaje") Is Nothing Then
|
||||||
|
ViewState("BloqueadoPromocionPorcentaje") = False
|
||||||
|
End If
|
||||||
|
Return Boolean.Parse(ViewState("BloqueadoPromocionPorcentaje").ToString)
|
||||||
|
End Get
|
||||||
|
Set(value As Boolean)
|
||||||
|
ViewState("BloqueadoPromocionPorcentaje") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Private Property EmpresaFnc382 As Boolean
|
||||||
|
Get
|
||||||
|
|
||||||
|
If ViewState("EmpresaFnc382") Is Nothing Then
|
||||||
|
ViewState("EmpresaFnc382") = False
|
||||||
|
End If
|
||||||
|
Return Boolean.Parse(ViewState("EmpresaFnc382").ToString)
|
||||||
|
End Get
|
||||||
|
Set(value As Boolean)
|
||||||
|
ViewState("EmpresaFnc382") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Private Property EstatusOriginal As Boolean
|
||||||
|
Get
|
||||||
|
If ViewState("EstatusOriginal") Is Nothing Then
|
||||||
|
ViewState("EstatusOriginal") = False
|
||||||
|
End If
|
||||||
|
Return Boolean.Parse(ViewState("EstatusOriginal").ToString)
|
||||||
|
End Get
|
||||||
|
Set(value As Boolean)
|
||||||
|
ViewState("EstatusOriginal") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||||
|
|
||||||
If Not Page.IsPostBack Then
|
If Not Page.IsPostBack Then
|
||||||
|
|
||||||
|
PorMinMasCostoVentaFnc129 = UsuarioActual.Empresa.Funcionalidad(129).ToDecimal
|
||||||
|
PermisoAutorizPromocionPorcentaje = UsuarioActual.TienePermisoProceso(386)
|
||||||
|
|
||||||
|
EmpresaFnc382 = If(UsuarioActual.Empresa.Funcionalidad(352) = "1", True, False) 'Grupo díaz
|
||||||
|
'EmpresaFnc382 = True ''Para pruebas
|
||||||
|
|
||||||
CvePromocion = -1
|
CvePromocion = -1
|
||||||
CargaValoresIniciales()
|
CargaValoresIniciales()
|
||||||
CargaMonedas()
|
CargaMonedas()
|
||||||
|
CargaDTUltimoCosto()
|
||||||
|
|
||||||
If Request("CvePromocion") IsNot Nothing AndAlso Request("CvePromocion").ToString.ToEntero > 0 Then
|
If Request("CvePromocion") IsNot Nothing AndAlso Request("CvePromocion").ToString.ToEntero > 0 Then
|
||||||
|
|
||||||
CvePromocion = Request("CvePromocion").ToString.ToEntero
|
CvePromocion = Request("CvePromocion").ToString.ToEntero
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
LnkAgrgarPlantillaPS.Visible = False
|
LnkAgrgarPlantillaPS.Visible = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ValidaPromosiones(False)
|
||||||
|
If EmpresaFnc382 AndAlso ChkEstatus.Checked = False AndAlso BloqueadoPromocionPorcentaje AndAlso Not PermisoAutorizPromocionPorcentaje Then
|
||||||
|
ChkEstatus.Enabled = False
|
||||||
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
ChkEstatus.Enabled = True
|
ChkEstatus.Enabled = True
|
||||||
ChkEstatus.Checked = True
|
ChkEstatus.Checked = True
|
||||||
@@ -219,6 +313,9 @@ Partial Class Ventas_Promociones
|
|||||||
|
|
||||||
TempDT.Columns.Add("IncluyeImpuestos", GetType(Boolean))
|
TempDT.Columns.Add("IncluyeImpuestos", GetType(Boolean))
|
||||||
|
|
||||||
|
TempDT.Columns.Add("UltimoCosto", GetType(Decimal))
|
||||||
|
TempDT.Columns.Add("CostoPromedio", GetType(Decimal))
|
||||||
|
|
||||||
|
|
||||||
TempDTOrigial = TempDT.Copy
|
TempDTOrigial = TempDT.Copy
|
||||||
|
|
||||||
@@ -244,6 +341,26 @@ Partial Class Ventas_Promociones
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargaDTUltimoCosto()
|
||||||
|
|
||||||
|
If Not EmpresaFnc382 Then
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
DTPSUltimoCosto = New DataTable
|
||||||
|
|
||||||
|
Dim ObjInv As New ClsInventarios
|
||||||
|
|
||||||
|
If ObjInv.GetUltimoCosto(UsuarioActual.CveEmpresa) Then
|
||||||
|
DTPSUltimoCosto = ObjInv.DtResultados
|
||||||
|
End If
|
||||||
|
|
||||||
|
ObjInv.Dispose()
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#Region " PS "
|
#Region " PS "
|
||||||
@@ -305,6 +422,7 @@ Partial Class Ventas_Promociones
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
ChkEstatus.Checked = If(Dr("Estatus").ToString = "True", True, False)
|
ChkEstatus.Checked = If(Dr("Estatus").ToString = "True", True, False)
|
||||||
|
EstatusOriginal = ChkEstatus.Checked
|
||||||
DdlMoneda.SelectedValueExist(Dr("CveMoneda").ToString)
|
DdlMoneda.SelectedValueExist(Dr("CveMoneda").ToString)
|
||||||
DdlMarca.SelectedValueExist(Dr("CveMarca").ToString)
|
DdlMarca.SelectedValueExist(Dr("CveMarca").ToString)
|
||||||
DdlTipoAplicacion.SelectedValueExist(Dr("TipoAplicacion").ToString)
|
DdlTipoAplicacion.SelectedValueExist(Dr("TipoAplicacion").ToString)
|
||||||
@@ -356,6 +474,10 @@ Partial Class Ventas_Promociones
|
|||||||
ChangeDdlProducto()
|
ChangeDdlProducto()
|
||||||
|
|
||||||
LbPUActual.Text = ""
|
LbPUActual.Text = ""
|
||||||
|
LblCostoPromedio.Text = ""
|
||||||
|
LblUltimoCosto.Text = ""
|
||||||
|
|
||||||
|
|
||||||
DdlTipoPromocion.SelectedValue = "-1"
|
DdlTipoPromocion.SelectedValue = "-1"
|
||||||
TxtPromocionConcepto.Text = ""
|
TxtPromocionConcepto.Text = ""
|
||||||
TxtCantMinima.Text = "1"
|
TxtCantMinima.Text = "1"
|
||||||
@@ -423,6 +545,10 @@ Partial Class Ventas_Promociones
|
|||||||
Dr("CodigoPS") = If(String.IsNullOrEmpty(DdlPS.SelectedText), "Todos", DdlPS.SelectedText)
|
Dr("CodigoPS") = If(String.IsNullOrEmpty(DdlPS.SelectedText), "Todos", DdlPS.SelectedText)
|
||||||
Dr("PUAnterior") = LbPUActual.Text.ToDecimal
|
Dr("PUAnterior") = LbPUActual.Text.ToDecimal
|
||||||
|
|
||||||
|
Dr("UltimoCosto") = LblUltimoCosto.Text.ToDecimal
|
||||||
|
Dr("CostoPromedio") = LblCostoPromedio.Text.ToDecimal
|
||||||
|
|
||||||
|
|
||||||
Dr("CveTipoPromocion") = DdlTipoPromocion.SelectedValue.ToEntero
|
Dr("CveTipoPromocion") = DdlTipoPromocion.SelectedValue.ToEntero
|
||||||
Dr("TipoPromocion") = DdlTipoPromocion.SelectedItem.Text
|
Dr("TipoPromocion") = DdlTipoPromocion.SelectedItem.Text
|
||||||
Dr("Promocion") = TxtPromocionConcepto.Text
|
Dr("Promocion") = TxtPromocionConcepto.Text
|
||||||
@@ -478,7 +604,68 @@ Partial Class Ventas_Promociones
|
|||||||
|
|
||||||
CargaGrid()
|
CargaGrid()
|
||||||
RegistraScript("$('#DivAgregar').modal('hide')")
|
RegistraScript("$('#DivAgregar').modal('hide')")
|
||||||
|
|
||||||
|
ValidaPromosiones(True)
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Private Sub ValidaPromosiones(Bloquear As Boolean)
|
||||||
|
|
||||||
|
|
||||||
|
If Not EmpresaFnc382 Then
|
||||||
|
BloqueadoPromocionPorcentaje = False
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
If PorMinMasCostoVentaFnc129 > 0 Then
|
||||||
|
|
||||||
|
For Each dRow As DataRow In TempDT.Rows
|
||||||
|
|
||||||
|
Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero
|
||||||
|
Dim UltimoCosto As Decimal = dRow("UltimoCosto").ToString.ToDecimal
|
||||||
|
Dim CveTipoPromocion As Integer = dRow("CveTipoPromocion").ToString.ToEntero ' 1 importe 2 % descuento
|
||||||
|
Dim Promocion As Decimal = dRow("Promocion").ToString.ToDecimal
|
||||||
|
|
||||||
|
If UltimoCosto = 0 Then
|
||||||
|
UltimoCosto = DTPSUltimoCosto.FiltroPrimeroValor("UltimoCosto", $"CvePS = {CvePS}").ToDecimal
|
||||||
|
End If
|
||||||
|
|
||||||
|
If CvePS > 0 AndAlso UltimoCosto > 0 AndAlso CveTipoPromocion.Contiene(1, 2) Then
|
||||||
|
|
||||||
|
If CveTipoPromocion = 1 Then 'importe
|
||||||
|
|
||||||
|
'Sacamos el porcentaje
|
||||||
|
Dim PorDescuento As Decimal = 100 - ((Promocion * 100) / UltimoCosto)
|
||||||
|
|
||||||
|
If PorDescuento > PorMinMasCostoVentaFnc129 Then
|
||||||
|
BloqueadoPromocionPorcentaje = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
|
||||||
|
ElseIf CveTipoPromocion = 2 Then '% descuento
|
||||||
|
If Promocion > PorMinMasCostoVentaFnc129 Then
|
||||||
|
BloqueadoPromocionPorcentaje = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
If BloqueadoPromocionPorcentaje AndAlso Bloquear Then
|
||||||
|
ChkEstatus.Checked = False
|
||||||
|
ChkEstatus.Enabled = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
UpGenerales.Update()
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
Protected Sub ChkRestricciones_CheckedChanged(sender As Object, e As EventArgs)
|
Protected Sub ChkRestricciones_CheckedChanged(sender As Object, e As EventArgs)
|
||||||
DivRestricciones.Visible = ChkRestricciones.Checked
|
DivRestricciones.Visible = ChkRestricciones.Checked
|
||||||
End Sub
|
End Sub
|
||||||
@@ -509,6 +696,9 @@ Partial Class Ventas_Promociones
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
LbPUActual.Text = Gvr.DataKey("PUAnterior").FormatoNumero
|
LbPUActual.Text = Gvr.DataKey("PUAnterior").FormatoNumero
|
||||||
|
LblUltimoCosto.Text = Gvr.DataKey("UltimoCosto").FormatoNumero
|
||||||
|
LblCostoPromedio.Text = Gvr.DataKey("CostoPromedio").FormatoNumero
|
||||||
|
|
||||||
DdlTipoPromocion.SelectedValue = Gvr.DataKey("CveTipoPromocion")
|
DdlTipoPromocion.SelectedValue = Gvr.DataKey("CveTipoPromocion")
|
||||||
'DdlTipoPromocion_SelectedIndexChanged(sender, Nothing)
|
'DdlTipoPromocion_SelectedIndexChanged(sender, Nothing)
|
||||||
TxtPromocionConcepto.Text = Gvr.DataKey("Promocion").FormatoNumero(4)
|
TxtPromocionConcepto.Text = Gvr.DataKey("Promocion").FormatoNumero(4)
|
||||||
@@ -560,6 +750,9 @@ Partial Class Ventas_Promociones
|
|||||||
|
|
||||||
|
|
||||||
Private Sub GuardaPromocion()
|
Private Sub GuardaPromocion()
|
||||||
|
|
||||||
|
ValidaPromosiones(True)
|
||||||
|
|
||||||
Dim CveCliente As Integer = If(DdlClientes.SelectedValue = "", -1, DdlClientes.SelectedValue.ToEntero)
|
Dim CveCliente As Integer = If(DdlClientes.SelectedValue = "", -1, DdlClientes.SelectedValue.ToEntero)
|
||||||
Dim ObjVentas As New ClsVentas
|
Dim ObjVentas As New ClsVentas
|
||||||
Dim TieneError As Boolean = False
|
Dim TieneError As Boolean = False
|
||||||
@@ -847,6 +1040,15 @@ Partial Class Ventas_Promociones
|
|||||||
TieneError = True
|
TieneError = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If EmpresaFnc382 AndAlso EstatusOriginal = False AndAlso ChkEstatus.Checked And BloqueadoPromocionPorcentaje Then
|
||||||
|
|
||||||
|
Dim objGeneral As New ClsGenerales(ObjVentas.IniciaTransacSQL)
|
||||||
|
If Not objGeneral.AddHistorialBitacora(360, -1, -1, -1, -1, -1, -1, -1, "Si Autoriza con bloqueo", "No", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, "", "", "", CvePromocion:=CvePromocion) Then
|
||||||
|
TieneError = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(563) <> "" Then
|
If UsuarioActual.Empresa.Funcionalidad(563) <> "" Then
|
||||||
|
|
||||||
If Not ObjVentas.SincronizarPromocionesClonar(CvePromocion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 2) Then
|
If Not ObjVentas.SincronizarPromocionesClonar(CvePromocion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 2) Then
|
||||||
@@ -1198,4 +1400,16 @@ Partial Class Ventas_Promociones
|
|||||||
|
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Protected Sub DdlPS_selectedindexchange(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LblUltimoCosto.Text = DTPSUltimoCosto.FiltroPrimeroValor("UltimoCosto", $"CvePS = {DdlPS.SelectedValue}").FormatoNumero
|
||||||
|
LblCostoPromedio.Text = DTPSUltimoCosto.FiltroPrimeroValor("CostoPromedio", $"CvePS = {DdlPS.SelectedValue}").FormatoNumero
|
||||||
|
|
||||||
|
UpAgregar.Update()
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
@@ -19,9 +19,17 @@
|
|||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||||
|
|
||||||
<li>
|
<asp:UpdatePanel runat="server" ID="UpAcciones" UpdateMode="Always">
|
||||||
|
<ContentTemplate>
|
||||||
</li>
|
<li>
|
||||||
|
<asp:LinkButton ID="LnkImprimirPedidos" runat="server" Visible="false" OnClick="LnkImprimirPedidos_Click"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Imprimir Pedidos</asp:LinkButton>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ContentTemplate>
|
||||||
|
<Triggers>
|
||||||
|
<asp:PostBackTrigger ControlID="LnkImprimirPedidos" />
|
||||||
|
</Triggers>
|
||||||
|
</asp:UpdatePanel>
|
||||||
|
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||||
@@ -129,6 +137,9 @@
|
|||||||
<asp:Label ID="LblCliente" runat="server" Text='<%#Eval("NombreComercial") %>'></asp:Label><br />
|
<asp:Label ID="LblCliente" runat="server" Text='<%#Eval("NombreComercial") %>'></asp:Label><br />
|
||||||
<asp:Label ID="LblDir" Font-Italic="true" runat="server" Text='<%#Eval("DireccionEnvio") %>'></asp:Label>
|
<asp:Label ID="LblDir" Font-Italic="true" runat="server" Text='<%#Eval("DireccionEnvio") %>'></asp:Label>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
|
<HeaderTemplate>
|
||||||
|
Sucursal<br /> <asp:Label ID="LblDir3" Font-Italic="true" runat="server" Text="Dirección"></asp:Label>
|
||||||
|
</HeaderTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="SerieFolio" ItemStyle-HorizontalAlign="Left">
|
<asp:TemplateField HeaderText="SerieFolio" ItemStyle-HorizontalAlign="Left">
|
||||||
@@ -163,7 +174,11 @@
|
|||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
|
<asp:TemplateField HeaderText="Obs" ItemStyle-HorizontalAlign="Left">
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:Label ID="LblObs" runat="server" Text='<%#Eval("Observaciones") %>'></asp:Label>
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
<asp:TemplateField HeaderText="Vendedor" ItemStyle-HorizontalAlign="Left">
|
<asp:TemplateField HeaderText="Vendedor" ItemStyle-HorizontalAlign="Left">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:Label ID="LblVendedor" runat="server" Text='<%#Eval("Vendedor") %>'></asp:Label>
|
<asp:Label ID="LblVendedor" runat="server" Text='<%#Eval("Vendedor") %>'></asp:Label>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Imports System.Activities.Expressions
|
|||||||
Imports System.Data
|
Imports System.Data
|
||||||
Imports DocumentFormat.OpenXml.Office.CustomUI
|
Imports DocumentFormat.OpenXml.Office.CustomUI
|
||||||
Imports Extensiones
|
Imports Extensiones
|
||||||
|
Imports Microsoft.Reporting.WebForms
|
||||||
Partial Class Ventas_RepPedidosSTF
|
Partial Class Ventas_RepPedidosSTF
|
||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
|
|
||||||
@@ -66,6 +67,8 @@ Partial Class Ventas_RepPedidosSTF
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub CargaDatos()
|
Protected Sub CargaDatos()
|
||||||
|
LnkImprimirPedidos.Visible = False
|
||||||
|
|
||||||
|
|
||||||
DatosGV = New DataTable
|
DatosGV = New DataTable
|
||||||
|
|
||||||
@@ -97,7 +100,9 @@ Partial Class Ventas_RepPedidosSTF
|
|||||||
DatosGV.Columns.Add("CodigoPSOrg", GetType(String))
|
DatosGV.Columns.Add("CodigoPSOrg", GetType(String))
|
||||||
|
|
||||||
GvDatos.DataSource = DatosGV
|
GvDatos.DataSource = DatosGV
|
||||||
|
If DatosGV IsNot Nothing AndAlso DatosGV.Rows.Count > 0 Then
|
||||||
|
LnkImprimirPedidos.Visible = True
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
ObjVentas.Dispose()
|
ObjVentas.Dispose()
|
||||||
GvDatos.DataBind()
|
GvDatos.DataBind()
|
||||||
@@ -113,7 +118,17 @@ Partial Class Ventas_RepPedidosSTF
|
|||||||
DTProductosEdicion = New DataTable
|
DTProductosEdicion = New DataTable
|
||||||
Dim ObjVentas As ClsVentas = New ClsVentas()
|
Dim ObjVentas As ClsVentas = New ClsVentas()
|
||||||
If ObjVentas.GetPSSubProyectosVendedores(UsuarioActual.CveEmpresa) Then
|
If ObjVentas.GetPSSubProyectosVendedores(UsuarioActual.CveEmpresa) Then
|
||||||
DTProductosEdicion = ObjVentas.DtResultados.FiltraParametros($" CveVendedor = {UsuarioActual.CveVendedor}")
|
|
||||||
|
|
||||||
|
DTProductosEdicion = ObjVentas.DtResultados
|
||||||
|
'If UsuarioActual.CveRol = 1 Then
|
||||||
|
' DTProductosEdicion = ObjVentas.DtResultados.FiltraParametros("", "CodigoPS", {"CvePS", "CodigoPS", "Precio"})
|
||||||
|
'Else
|
||||||
|
' DTProductosEdicion = ObjVentas.DtResultados.FiltraParametros($" CveVendedor = {UsuarioActual.CveVendedor}")
|
||||||
|
'End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
ObjVentas.Dispose()
|
ObjVentas.Dispose()
|
||||||
|
|
||||||
@@ -137,7 +152,7 @@ Partial Class Ventas_RepPedidosSTF
|
|||||||
If e.Row.DBCampo("CveVendedor") = "" OrElse e.Row.DBCampo("CvePS") = "" Then
|
If e.Row.DBCampo("CveVendedor") = "" OrElse e.Row.DBCampo("CvePS") = "" Then
|
||||||
Else
|
Else
|
||||||
|
|
||||||
e.Row.FCDropDownList("DdlPS").DataSource = DTProductosEdicion
|
e.Row.FCDropDownList("DdlPS").DataSource = DTProductosEdicion.FiltraParametros($"CveVendedor = {e.Row.DataKey("CveVendedor")}")
|
||||||
e.Row.FCDropDownList("DdlPS").DataBind()
|
e.Row.FCDropDownList("DdlPS").DataBind()
|
||||||
e.Row.FCDropDownList("DdlPS").SelectedValueExist(e.Row.DBCampo("CvePS"))
|
e.Row.FCDropDownList("DdlPS").SelectedValueExist(e.Row.DBCampo("CvePS"))
|
||||||
|
|
||||||
@@ -232,6 +247,7 @@ Partial Class Ventas_RepPedidosSTF
|
|||||||
TmpDTRemis.Columns.Add("GastosEnvio", GetType(Decimal))
|
TmpDTRemis.Columns.Add("GastosEnvio", GetType(Decimal))
|
||||||
TmpDTRemis.Columns.Add("Observacion", GetType(String))
|
TmpDTRemis.Columns.Add("Observacion", GetType(String))
|
||||||
|
|
||||||
|
|
||||||
TmpDTRemis.Columns.Add("CantidadOrg", GetType(Decimal))
|
TmpDTRemis.Columns.Add("CantidadOrg", GetType(Decimal))
|
||||||
TmpDTRemis.Columns.Add("CvePSOrg", GetType(Integer))
|
TmpDTRemis.Columns.Add("CvePSOrg", GetType(Integer))
|
||||||
TmpDTRemis.Columns.Add("CodigoPSOrg", GetType(String))
|
TmpDTRemis.Columns.Add("CodigoPSOrg", GetType(String))
|
||||||
@@ -256,11 +272,22 @@ Partial Class Ventas_RepPedidosSTF
|
|||||||
drp("CvePSOrg") = gvr.DataKey("CvePSOrg").ToEntero
|
drp("CvePSOrg") = gvr.DataKey("CvePSOrg").ToEntero
|
||||||
drp("CodigoPSOrg") = gvr.DataKey("CodigoPSOrg")
|
drp("CodigoPSOrg") = gvr.DataKey("CodigoPSOrg")
|
||||||
|
|
||||||
|
|
||||||
TmpDTRemis.Rows.Add(drp)
|
TmpDTRemis.Rows.Add(drp)
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
Dim DTDeriesFolio As DataTable = TmpDTRemis.FiltraParametros("", "", {"Observacion"})
|
||||||
|
Dim Observaciones As String = ""
|
||||||
|
Dim lista As New List(Of String)
|
||||||
|
For Each drow As DataRow In DTDeriesFolio.Rows
|
||||||
|
lista.Add(drow("Observacion").ToString)
|
||||||
|
Next
|
||||||
|
|
||||||
|
Observaciones = String.Join(", ", lista)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If TmpDTRemis IsNot Nothing AndAlso TmpDTRemis.Rows.Count = 0 Then
|
If TmpDTRemis IsNot Nothing AndAlso TmpDTRemis.Rows.Count = 0 Then
|
||||||
Alert("No se ha seleccionado ninguna partida, favor de seleccionar", TipoMensaje.MsgAdvertencia)
|
Alert("No se ha seleccionado ninguna partida, favor de seleccionar", TipoMensaje.MsgAdvertencia)
|
||||||
@@ -275,7 +302,10 @@ Partial Class Ventas_RepPedidosSTF
|
|||||||
For Each drt As DataRow In TmpDTRemis.FiltraParametros("", DistinctColumns:={"CveCliente", "CveSubProyecto", "CveVendedor", "GastosEnvio"}).Rows
|
For Each drt As DataRow In TmpDTRemis.FiltraParametros("", DistinctColumns:={"CveCliente", "CveSubProyecto", "CveVendedor", "GastosEnvio"}).Rows
|
||||||
|
|
||||||
Dim ObjFactura As Modelos.Factura = Modelos.Factura.CrearVentaNueva(UsuarioActual, drt("CveSubProyecto").ToString.ToEntero, drt("CveCliente").ToString.ToEntero, 1, "Rem")
|
Dim ObjFactura As Modelos.Factura = Modelos.Factura.CrearVentaNueva(UsuarioActual, drt("CveSubProyecto").ToString.ToEntero, drt("CveCliente").ToString.ToEntero, 1, "Rem")
|
||||||
|
|
||||||
ObjFactura.CveVendedor = drt("CveVendedor").ToString.ToEntero
|
ObjFactura.CveVendedor = drt("CveVendedor").ToString.ToEntero
|
||||||
|
ObjFactura.Observaciones = Observaciones
|
||||||
|
|
||||||
For Each dr As DataRow In TmpDTRemis.FiltraParametros($"CveCliente ={drt("CveCliente")} AND CveVendedor = {drt("CveVendedor")} AND CveSubProyecto = {drt("CveSubProyecto")}").Rows
|
For Each dr As DataRow In TmpDTRemis.FiltraParametros($"CveCliente ={drt("CveCliente")} AND CveVendedor = {drt("CveVendedor")} AND CveSubProyecto = {drt("CveSubProyecto")}").Rows
|
||||||
|
|
||||||
If ObjFactura IsNot Nothing Then
|
If ObjFactura IsNot Nothing Then
|
||||||
@@ -296,7 +326,7 @@ Partial Class Ventas_RepPedidosSTF
|
|||||||
TieneError = True
|
TieneError = True
|
||||||
Exit For
|
Exit For
|
||||||
Else
|
Else
|
||||||
If Not ObjA.UpdateEstatusAlmacen(dr("CveVentaDetalle").ToString.ToEntero, 0) Then
|
If Not ObjA.UpdateEstatusAlmacen(dr("CveVentaDetalle").ToString.ToEntero, 1) Then
|
||||||
TieneError = True
|
TieneError = True
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -343,4 +373,48 @@ Partial Class Ventas_RepPedidosSTF
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Protected Sub LnkImprimirPedidos_Click(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
|
Dim FechaI As String = txtFechaI.Text
|
||||||
|
Dim FechaF As String = txtFechaF.Text
|
||||||
|
If txtFechaI.Text = "" Then FechaI = "-1"
|
||||||
|
If txtFechaF.Text = "" Then FechaF = "-1"
|
||||||
|
|
||||||
|
Dim Sucursal As String = If(DdlSubProyecto.SelectedValue = "-1", "", $" <b>Sucursal:</b> {DdlSubProyecto.SelectedItem.Text}")
|
||||||
|
Dim Vendedor As String = If(DdlVendedor.SelectedValue = "-1", "", $" <b>Vendedor:</b> {DdlVendedor.SelectedItem.Text}")
|
||||||
|
|
||||||
|
Dim FechaIn As String = If(txtFechaI.Text = "", "", $" <b>Fecha Inicio:</b> {txtFechaI.Text}")
|
||||||
|
Dim FechaFn As String = If(txtFechaF.Text = "", "", $" <b>Fecha Fin:</b> {txtFechaF.Text}")
|
||||||
|
|
||||||
|
Dim TituloReporte As String = "Reporte de Pedidos"
|
||||||
|
|
||||||
|
If DatosGV.Rows.Count > 0 Then
|
||||||
|
|
||||||
|
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/RepProveedorCxP.rpt", UsuarioActual.Empresa.Ruta))
|
||||||
|
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||||
|
|
||||||
|
Dim params As New List(Of ReportParameter)
|
||||||
|
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||||
|
params.Add(New ReportParameter("FechaInicio", FechaI))
|
||||||
|
params.Add(New ReportParameter("FechaFin", FechaF))
|
||||||
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||||
|
params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString))
|
||||||
|
params.Add(New ReportParameter("TituloReporte", TituloReporte))
|
||||||
|
params.Add(New ReportParameter("AgrupadoPor", $" {Sucursal}{Vendedor}{FechaIn}{FechaFn}"))
|
||||||
|
|
||||||
|
If Imagen.Exists Then ''POR EMPRESA
|
||||||
|
params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}"))
|
||||||
|
Else
|
||||||
|
params.Add(New ReportParameter("LogoPath", ""))
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ImprimirPDF("Empresas/Grales/Formatos/RepPedidos.rdlc", DatosGV, params, "ReportePedidos")
|
||||||
|
Else
|
||||||
|
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user