diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 2d8280cbb..f34c3b52e 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -6283,6 +6283,24 @@ Public Class ClsInventarios Return Retorno 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 " ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index eeaf57f4e..3af79410f 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -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, 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 - DataAdapter("PA_Vta_RepVentasUtilidadGet") + DataAdapter("PA_Vta_RepVentasUtilidadGetOIC") With SqlAdapter.SelectCommand.Parameters .Add("@FechaI", SqlDbType.Date).Value = FechaInicio diff --git a/Bin/System.Memory.dll b/Bin/System.Memory.dll index 5d1947056..461719979 100644 Binary files a/Bin/System.Memory.dll and b/Bin/System.Memory.dll differ diff --git a/Empresas/Grales/Formatos/ClienteCxC.rdlc b/Empresas/Grales/Formatos/ClienteCxC.rdlc index 66484ea9c..0bd5e4747 100644 --- a/Empresas/Grales/Formatos/ClienteCxC.rdlc +++ b/Empresas/Grales/Formatos/ClienteCxC.rdlc @@ -1,1483 +1,5 @@ - - - - - - - - 0.85026cm - - - 1.23183cm - - - 1.81391cm - - - 2.50182cm - - - 2.80321cm - - - 2.15786cm - - - 2.32096cm - - - 2.55473cm - - - 2.13141cm - - - 2.43359cm - - - - - 0.61323cm - - - - - true - true - - - - - Tipo - - - - - - - Textbox37 - - - DimGray - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Folio - - - - - - - Textbox1 - - - DimGray - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Fecha - - - - - - - Textbox3 - - - DimGray - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - F. Vencimiento - - - - - - - Textbox5 - - - DimGray - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Dias Vencidos - - - - - - - Textbox7 - - - DimGray - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Original - - - - - - - Textbox9 - - - DimGray - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - $ Abonado - - - - - - - Textbox11 - - - DimGray - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - % Abonado - - - - - - - Textbox13 - - - DimGray - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Saldo - - - - - - - Textbox15 - - - DimGray - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - % A Pagar - - - - - - - Textbox26 - - - DimGray - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.51323cm - - - - - true - true - - - - - =Fields!TipoDocto.Value - - - - - - - TipoDocto1 - - - Silver - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!Folio.Value - - - - - - - Folio - - - Silver - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!Fecha.Value - - - - - - - Fecha1 - - - Silver - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!FechaVencimiento.Value - - - - - - - FechaVencimiento1 - - - Silver - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!DiasVencidos.Value - - - - - - - DiasVencidos1 - - - Silver - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!Original.Value - - - - - - - Original1 - - - Silver - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!Abonado.Value - - - - - - - Abonado1 - - - Silver - 2pt - 2pt - 2pt - 2pt - es-MX - - - - - - - - true - true - - - - - =Fields!PorRecuperado.Value - - - - - - - PorRecuperado1 - - - Silver - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!Saldo.Value - - - - - - - Saldo1 - - - Silver - 2pt - 2pt - 2pt - 2pt - en-US - - - - - - - - true - true - - - - - =Fields!PorXRecuperar.Value - - - - - - - PorXRecuperar1 - - - Silver - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.51323cm - - - - - true - true - - - - - =Fields!TipoDocto.Value - - - - - - - TipoDocto - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!Folio.Value - - - - - - - Folio2 - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!Fecha.Value - - - - - - - Fecha - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!FechaVencimiento.Value - - - - - - - FechaVencimiento - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!DiasVencidos.Value - - - - - - - DiasVencidos - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!Original.Value - - - - - - - Original - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!Abonado.Value - - - - - - - Abonado - - - 2pt - 2pt - 2pt - 2pt - es-MX - - - - - - - - true - true - - - - - =Fields!PorRecuperado.Value - - - - - - - PorRecuperado - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!Saldo.Value - - - - - - - Saldo - - - 2pt - 2pt - 2pt - 2pt - es-MX - - - - - - - - true - true - - - - - =Fields!PorXRecuperar.Value - - - - - - - PorXRecuperar - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - - - - - - - - - - - - - - - - - - After - - - - - - - =Fields!TipoDocto.Value<>"" - - - - - =Fields!TipoDocto.Value="" - - - - - - - true - true - true - true - DataSet1 - 0.39771cm - 0.18357cm - 1.63969cm - 20.79958cm - - - - - - 1.09375in - - - - - - true - true - - - - - =Parameters!NombreEmpresa.Value - - - - - - - Textbox1 - 0.34396cm - 5.66347cm - 0.6cm - 9.70195cm - 1 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!DireccionEmpresa.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!TelefonoEmpresa.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - 0.88222cm - true - true - - - true - true - - - - - ="Página " & Globals.PageNumber & " de " & Globals.TotalPages - - - - - - - Textbox3 - 0.17639cm - 17.02419cm - 0.63087cm - 3.95896cm - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Fecha Impresión: - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =CDate(now) - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Usuario: - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!UsuarioImprimio.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 29.7cm - 21cm - 0cm - 0cm - 0cm - 1cm - 0.13cm - + + + + + + Textbox37 + + + DimGray + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Folio + + + + + + + Textbox1 + + + DimGray + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Fecha + + + + + + + Textbox3 + + + DimGray + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + F. Vencimiento + + + + + + + Textbox5 + + + DimGray + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Dias Vencidos + + + + + + + Textbox7 + + + DimGray + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Original + + + + + + + Textbox9 + + + DimGray + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + $ Abonado + + + + + + + Textbox11 + + + DimGray + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + % Abonado + + + + + + + Textbox13 + + + DimGray + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Saldo + + + + + + + Textbox15 + + + DimGray + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + % A Pagar + + + + + + + Textbox26 + + + DimGray + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.51323cm + + + + + true + true + + + + + =Fields!TipoDocto.Value + + + + + + + TipoDocto1 + + + Silver + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Folio.Value + + + + + + + Folio + + + Silver + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Fecha.Value + + + + + + + Fecha1 + + + Silver + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!FechaVencimiento.Value + + + + + + + FechaVencimiento1 + + + Silver + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!DiasVencidos.Value + + + + + + + DiasVencidos1 + + + Silver + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Original.Value + + + + + + + Original1 + + + Silver + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Abonado.Value + + + + + + + Abonado1 + + + Silver + 2pt + 2pt + 2pt + 2pt + es-MX + + + + + + + + true + true + + + + + =Fields!PorRecuperado.Value + + + + + + + PorRecuperado1 + + + Silver + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Saldo.Value + + + + + + + Saldo1 + + + Silver + 2pt + 2pt + 2pt + 2pt + en-US + + + + + + + + true + true + + + + + =Fields!PorXRecuperar.Value + + + + + + + PorXRecuperar1 + + + Silver + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.51323cm + + + + + true + true + + + + + =Fields!TipoDocto.Value + + + + + + + TipoDocto + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Folio.Value + + + + + + + Folio2 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Fecha.Value + + + + + + + Fecha + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!FechaVencimiento.Value + + + + + + + FechaVencimiento + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!DiasVencidos.Value + + + + + + + DiasVencidos + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Original.Value + + + + + + + Original + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Abonado.Value + + + + + + + Abonado + + + 2pt + 2pt + 2pt + 2pt + es-MX + + + + + + + + true + true + + + + + =Fields!PorRecuperado.Value + + + + + + + PorRecuperado + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Saldo.Value + + + + + + + Saldo + + + 2pt + 2pt + 2pt + 2pt + es-MX + + + + + + + + true + true + + + + + =Fields!PorXRecuperar.Value + + + + + + + PorXRecuperar + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + + + + + After + + + + + + + =Fields!TipoDocto.Value<>"" + + + + + =Fields!TipoDocto.Value="" + + + + + + + true + true + true + true + DataSet1 + 0.39771cm + 0.18357cm + 1.63969cm + 20.79958cm + + + + + + 1.09375in + + + + + + true + true + + + + + =Parameters!NombreEmpresa.Value + + + + + + + Textbox1 + 0.34396cm + 5.66347cm + 0.6cm + 9.70195cm + 1 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!DireccionEmpresa.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!TelefonoEmpresa.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + 0.88222cm + true + true + + + true + true + + + + + ="Página " & Globals.PageNumber & " de " & Globals.TotalPages + + + + + + + Textbox3 + 0.17639cm + 17.02419cm + 0.63087cm + 3.95896cm + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha Impresión: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =CDate(now) + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Usuario: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!UsuarioImprimio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 29.7cm + 21cm + 0cm + 0cm + 0cm + 1cm + 0.13cm + Promociones @@ -35,7 +40,7 @@
- DATOS GENERALES + DATOS GENERALES
@@ -180,7 +185,7 @@
- PRODUCTOS / SERVICIOS + PRODUCTOS / SERVICIOS
@@ -195,7 +200,7 @@
@@ -276,7 +281,6 @@ - @@ -306,15 +310,25 @@
- +
-
- -
+ +
+ +
+ +
+ +
+ +
+
diff --git a/Ventas/Promociones.aspx.vb b/Ventas/Promociones.aspx.vb index 1103cae83..681176951 100644 --- a/Ventas/Promociones.aspx.vb +++ b/Ventas/Promociones.aspx.vb @@ -1,11 +1,13 @@ Option Explicit On Option Strict On +Imports System.Activities.Expressions Imports System.Data Imports DocumentFormat.OpenXml.Drawing.Diagrams Imports Extensiones Imports iText.StyledXmlParser.Css.Resolve.Shorthand.Impl Imports Microsoft.Owin.Security.Provider +Imports Telerik.Web.UI Partial Class Ventas_Promociones Inherits ClsPaginas @@ -59,7 +61,6 @@ Partial Class Ventas_Promociones Private Property CvePromocionPadre As Integer Get - If ViewState("CvePromocionPadre") Is Nothing Then ViewState("CvePromocionPadre") = -1 End If @@ -70,21 +71,114 @@ Partial Class Ventas_Promociones End Set 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 Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not Page.IsPostBack Then + PorMinMasCostoVentaFnc129 = UsuarioActual.Empresa.Funcionalidad(129).ToDecimal + PermisoAutorizPromocionPorcentaje = UsuarioActual.TienePermisoProceso(386) + + EmpresaFnc382 = If(UsuarioActual.Empresa.Funcionalidad(382) = "1", True, False) 'Grupo díaz + 'EmpresaFnc382 = True ''Para pruebas + CvePromocion = -1 CargaValoresIniciales() CargaMonedas() + CargaDTUltimoCosto() If Request("CvePromocion") IsNot Nothing AndAlso Request("CvePromocion").ToString.ToEntero > 0 Then CvePromocion = Request("CvePromocion").ToString.ToEntero CargaDatos() LnkAgrgarPlantillaPS.Visible = False + + + ValidaPromosiones(False) + If EmpresaFnc382 AndAlso ChkEstatus.Checked = False AndAlso BloqueadoPromocionPorcentaje AndAlso Not PermisoAutorizPromocionPorcentaje Then + ChkEstatus.Enabled = False + End If + Else ChkEstatus.Enabled = True ChkEstatus.Checked = True @@ -219,6 +313,9 @@ Partial Class Ventas_Promociones TempDT.Columns.Add("IncluyeImpuestos", GetType(Boolean)) + TempDT.Columns.Add("UltimoCosto", GetType(Decimal)) + TempDT.Columns.Add("CostoPromedio", GetType(Decimal)) + TempDTOrigial = TempDT.Copy @@ -244,6 +341,26 @@ Partial Class Ventas_Promociones + End Sub + + Private Sub CargaDTUltimoCosto() + + If EmpresaFnc382 Then + Dim DTPSUltimoCosto = New DataTable + + Dim ObjInv As New ClsInventarios + + If ObjInv.GetUltimoCosto(UsuarioActual.CveEmpresa) Then + DTPSUltimoCosto = ObjInv.DtResultados + End If + + ObjInv.Dispose() + End If + + + + + End Sub #Region " PS " @@ -305,6 +422,7 @@ Partial Class Ventas_Promociones End If ChkEstatus.Checked = If(Dr("Estatus").ToString = "True", True, False) + EstatusOriginal = ChkEstatus.Checked DdlMoneda.SelectedValueExist(Dr("CveMoneda").ToString) DdlMarca.SelectedValueExist(Dr("CveMarca").ToString) DdlTipoAplicacion.SelectedValueExist(Dr("TipoAplicacion").ToString) @@ -356,6 +474,10 @@ Partial Class Ventas_Promociones ChangeDdlProducto() LbPUActual.Text = "" + LblCostoPromedio.Text = "" + LblUltimoCosto.Text = "" + + DdlTipoPromocion.SelectedValue = "-1" TxtPromocionConcepto.Text = "" TxtCantMinima.Text = "1" @@ -423,6 +545,10 @@ Partial Class Ventas_Promociones Dr("CodigoPS") = If(String.IsNullOrEmpty(DdlPS.SelectedText), "Todos", DdlPS.SelectedText) Dr("PUAnterior") = LbPUActual.Text.ToDecimal + Dr("UltimoCosto") = LblUltimoCosto.Text.ToDecimal + Dr("CostoPromedio") = LblCostoPromedio.Text.ToDecimal + + Dr("CveTipoPromocion") = DdlTipoPromocion.SelectedValue.ToEntero Dr("TipoPromocion") = DdlTipoPromocion.SelectedItem.Text Dr("Promocion") = TxtPromocionConcepto.Text @@ -478,7 +604,78 @@ Partial Class Ventas_Promociones CargaGrid() RegistraScript("$('#DivAgregar').modal('hide')") + + ValidaPromosiones(True) + End Sub + + + Private Sub ValidaPromosiones(Bloquear As Boolean) + + + If Not EmpresaFnc382 Then + BloqueadoPromocionPorcentaje = False + Exit Sub + End If + + + Dim DTPSUltimoCosto = New DataTable + + Dim ObjInv As New ClsInventarios + If ObjInv.GetUltimoCosto(UsuarioActual.CveEmpresa) Then + DTPSUltimoCosto = ObjInv.DtResultados + End If + ObjInv.Dispose() + + + + 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) DivRestricciones.Visible = ChkRestricciones.Checked End Sub @@ -509,6 +706,9 @@ Partial Class Ventas_Promociones End If LbPUActual.Text = Gvr.DataKey("PUAnterior").FormatoNumero + LblUltimoCosto.Text = Gvr.DataKey("UltimoCosto").FormatoNumero + LblCostoPromedio.Text = Gvr.DataKey("CostoPromedio").FormatoNumero + DdlTipoPromocion.SelectedValue = Gvr.DataKey("CveTipoPromocion") 'DdlTipoPromocion_SelectedIndexChanged(sender, Nothing) TxtPromocionConcepto.Text = Gvr.DataKey("Promocion").FormatoNumero(4) @@ -560,6 +760,9 @@ Partial Class Ventas_Promociones Private Sub GuardaPromocion() + + ValidaPromosiones(True) + Dim CveCliente As Integer = If(DdlClientes.SelectedValue = "", -1, DdlClientes.SelectedValue.ToEntero) Dim ObjVentas As New ClsVentas Dim TieneError As Boolean = False @@ -599,6 +802,11 @@ Partial Class Ventas_Promociones End If ObjVentas.Dispose() + + If Not TieneError AndAlso BloqueadoPromocionPorcentaje Then + MandaCorreoNotificacionPromocionBloqueo(CvePromocion, TxtPromocion.Text.Trim) + End If + End Sub @@ -654,24 +862,6 @@ Partial Class Ventas_Promociones If Not TieneError Then - '366 Estatus - - '367 CvePS - '368 PUPromocion - '369 CveTipoPromocion - '370 Cantidad Minima - '371 AplicaRestriccion - '372 HoraInicio - '373 HoraFin - - '374 AplicaLunes - '375 AplicaMartes - '376 AplicaMiercoles - '377 AplicaJueves - '378 AplicaViernes - '379 AplicaSabado - '380 AplicaDomingo - '381 IncluyeImpuestos Dim Dr2 As DataRow = TempDTOrigial.FiltraParametros($"CvePromocionDetalle = {Dr("CvePromocionDetalle").ToString}").Rows(0) @@ -700,12 +890,7 @@ Partial Class Ventas_Promociones End If - 'If Not TieneError And Dr("AplicaRestriccion").ToString <> Dr2("AplicaRestriccion").ToString Then - ' If Not ObjGral.AddHistorialBitacora(371, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Dr2("AplicaRestriccion").ToString, $"{Dr("CodigoPS").ToString} - {Dr("AplicaRestriccion").ToString}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, "Se elimino " & Dr("CodigoPS").ToString, "PS", "", CvePromocion:=CvePromocion) Then - ' TieneError = True - ' Exit For - ' End If - 'End If + If Not TieneError And Dr("HoraInicio").ToString <> Dr2("HoraInicio").ToString Then If Not ObjGral.AddHistorialBitacora(372, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Dr("HoraInicio").ToString, $"{Dr("CodigoPS").ToString} - {Dr2("HoraInicio").ToString}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, "Se elimino " & Dr("CodigoPS").ToString, "PS", "", CvePromocion:=CvePromocion) Then @@ -847,6 +1032,15 @@ Partial Class Ventas_Promociones TieneError = True 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, "Se Autorizo con bloqueo", "No", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, "", "", "", CvePromocion:=CvePromocion) Then + TieneError = True + End If + + End If + If UsuarioActual.Empresa.Funcionalidad(563) <> "" Then If Not ObjVentas.SincronizarPromocionesClonar(CvePromocion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 2) Then @@ -867,6 +1061,51 @@ Partial Class Ventas_Promociones End Sub #End Region +#Region "ENVIAR CORREO PROMOSION BLOQUEADA" + + + Private Sub MandaCorreoNotificacionPromocionBloqueo(CvePromocionNueva As Integer, PromocionNueva As String) + Dim Asunto, Para, ArrayCC, Body, URL As String + Asunto = $"Promoción {PromocionNueva} requiere autorización" + Para = "" + ArrayCC = "" + URL = "" + + If Request.Url.Port = 80 Then + URL = $"{Request.Url.Scheme}://{Request.Url.Host}{Request.Url.AbsolutePath}?CvePromocion={CvePromocionNueva}" + Else + URL = $"{Request.Url.Scheme}://{Request.Url.Host}:{Request.Url.Port}{Request.Url.AbsolutePath}?CvePromocion={CvePromocionNueva}" + End If + + Body = $"Se a registrado promoción que requiere autorización {PromocionNueva}" + + Dim objUsu As New ClsSisUsuarios + Dim ListaCorreos As New List(Of String) + If objUsu.GetPermisosPorUsuarioProcesos(-1, -1, -1, -1, 386, CveEmpresa:=UsuarioActual.CveEmpresa) Then + For Each dRow As DataRow In objUsu.DtResultados.Rows + If dRow("Correo").ToString.Trim.Length > 0 Then + ListaCorreos.Add(dRow("Correo").ToString) + End If + Next + End If + objUsu.Dispose() + + If ListaCorreos.Count > 0 Then + + Para = String.Join(";", ListaCorreos) + + Dim Mail As New ClsSisMail() + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, ArrayCC, LSRutasMail) + + End If + + + End Sub + + +#End Region + #Region " ELIMINAR " Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) @@ -912,22 +1151,6 @@ Partial Class Ventas_Promociones End Sub #End Region - 'Protected Sub DdlTipoPromocion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoPromocion.SelectedIndexChanged - ' If DdlTipoPromocion.SelectedValue = "3" Then - ' DivCantMinima.Visible = True - ' Else - ' DivCantMinima.Visible = False - ' End If - 'End Sub - - - - - - - - - Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) @@ -1092,11 +1315,6 @@ Partial Class Ventas_Promociones ObjPS.Dispose() - 'Dim ObjGral As New ClsGenerales - 'If ObjGral.GetRinTamanios(UsuarioActual.CveEmpresa) Then - ' DTRines = ObjGral.DtResultados - 'End If - 'ObjGral.Dispose() DTRines = GlobalDTPSRinTamaños(UsuarioActual.CveEmpresa) Dim RegistroActual As Integer = 1 @@ -1106,8 +1324,6 @@ Partial Class Ventas_Promociones Dim ClasificacionStr, CodigoStr, TipoPromocionStr, PromocionStr, CantidadMinimaStr, RinStr, IncluyeImpuestosStr As String - - ClasificacionStr = dRow("Clasificacion").ToString.Trim CodigoStr = dRow("Codigo").ToString.Trim TipoPromocionStr = dRow("TipoPromocion").ToString.Trim @@ -1185,7 +1401,6 @@ Partial Class Ventas_Promociones Next - If Errores.ToString.Length = 0 Then DTPlantilla.AcceptChanges() Return True @@ -1194,8 +1409,23 @@ Partial Class Ventas_Promociones Return False End If - - - End Function + + Protected Sub DdlPS_selectedindexchange(sender As Object, e As EventArgs) + + Dim DTPSUltimoCosto = New DataTable + + Dim ObjInv As New ClsInventarios + If ObjInv.GetUltimoCosto(UsuarioActual.CveEmpresa) Then + DTPSUltimoCosto = ObjInv.DtResultados + End If + ObjInv.Dispose() + + LblUltimoCosto.Text = DTPSUltimoCosto.FiltroPrimeroValor("UltimoCosto", $"CvePS = {DdlPS.SelectedValue}").FormatoNumero + LblCostoPromedio.Text = DTPSUltimoCosto.FiltroPrimeroValor("CostoPromedio", $"CvePS = {DdlPS.SelectedValue}").FormatoNumero + + UpAgregar.Update() + End Sub + + End Class \ No newline at end of file diff --git a/Ventas/RepPedidosSTF.aspx b/Ventas/RepPedidosSTF.aspx index 93dfabfb4..625503cf3 100644 --- a/Ventas/RepPedidosSTF.aspx +++ b/Ventas/RepPedidosSTF.aspx @@ -18,11 +18,21 @@ Reporte de Pedidos - -
  • - -
  • - + + + +
  • + Imprimir Pedidos +
  • +
  • + +
  • +
    + + + +
    +
    @@ -57,7 +67,7 @@ --%>
    - +
    @@ -69,41 +79,41 @@