From d553788bc072614901439daf0836b4f0c6eeb11d Mon Sep 17 00:00:00 2001 From: rakcsle Date: Sat, 7 Sep 2024 14:52:40 -0700 Subject: [PATCH] =?UTF-8?q?4to.=20Revisi=C3=B3n=20Promociones?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsInventarios.vb | 18 + App_Code/ClsVentas.vb | 2 +- Empresas/Grales/Formatos/ClienteCxC.rdlc | 2962 ++++++++++--------- Metronic/assets/admin/layout/css/custom.css | 3 +- Ventas/Promociones.aspx | 29 +- Ventas/Promociones.aspx.vb | 216 +- Ventas/RepPedidosSTF.aspx | 23 +- Ventas/RepPedidosSTF.aspx.vb | 82 +- 8 files changed, 1838 insertions(+), 1497 deletions(-) diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 9d36dd399..e9d4f65d1 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -6267,6 +6267,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/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 @@
@@ -306,15 +311,25 @@
- +
-
- -
+ +
+ +
+ +
+ +
+ +
+
diff --git a/Ventas/Promociones.aspx.vb b/Ventas/Promociones.aspx.vb index 1103cae83..fb16837a2 100644 --- a/Ventas/Promociones.aspx.vb +++ b/Ventas/Promociones.aspx.vb @@ -1,6 +1,7 @@ Option Explicit On Option Strict On +Imports System.Activities.Expressions Imports System.Data Imports DocumentFormat.OpenXml.Drawing.Diagrams Imports Extensiones @@ -59,7 +60,6 @@ Partial Class Ventas_Promociones Private Property CvePromocionPadre As Integer Get - If ViewState("CvePromocionPadre") Is Nothing Then ViewState("CvePromocionPadre") = -1 End If @@ -70,21 +70,115 @@ 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(352) = "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 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 #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,68 @@ 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 + + + 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 +696,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 +750,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 @@ -847,6 +1040,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, "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 Not ObjVentas.SincronizarPromocionesClonar(CvePromocion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 2) Then @@ -1198,4 +1400,16 @@ Partial Class Ventas_Promociones 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 \ No newline at end of file diff --git a/Ventas/RepPedidosSTF.aspx b/Ventas/RepPedidosSTF.aspx index 93dfabfb4..db0cdcc0a 100644 --- a/Ventas/RepPedidosSTF.aspx +++ b/Ventas/RepPedidosSTF.aspx @@ -19,9 +19,17 @@ -
  • - -
  • + + +
  • + Imprimir Pedidos +
  • + +
    + + + +
    @@ -129,6 +137,9 @@
    + + Sucursal
    +
    @@ -163,7 +174,11 @@ - + + + + + diff --git a/Ventas/RepPedidosSTF.aspx.vb b/Ventas/RepPedidosSTF.aspx.vb index 7aaa02d40..5b8f96950 100644 --- a/Ventas/RepPedidosSTF.aspx.vb +++ b/Ventas/RepPedidosSTF.aspx.vb @@ -5,6 +5,7 @@ Imports System.Activities.Expressions Imports System.Data Imports DocumentFormat.OpenXml.Office.CustomUI Imports Extensiones +Imports Microsoft.Reporting.WebForms Partial Class Ventas_RepPedidosSTF Inherits ClsPaginas @@ -66,6 +67,8 @@ Partial Class Ventas_RepPedidosSTF End Sub Protected Sub CargaDatos() + LnkImprimirPedidos.Visible = False + DatosGV = New DataTable @@ -97,7 +100,9 @@ Partial Class Ventas_RepPedidosSTF DatosGV.Columns.Add("CodigoPSOrg", GetType(String)) GvDatos.DataSource = DatosGV - + If DatosGV IsNot Nothing AndAlso DatosGV.Rows.Count > 0 Then + LnkImprimirPedidos.Visible = True + End If End If ObjVentas.Dispose() GvDatos.DataBind() @@ -113,7 +118,17 @@ Partial Class Ventas_RepPedidosSTF DTProductosEdicion = New DataTable Dim ObjVentas As ClsVentas = New ClsVentas() 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 ObjVentas.Dispose() @@ -137,7 +152,7 @@ Partial Class Ventas_RepPedidosSTF If e.Row.DBCampo("CveVendedor") = "" OrElse e.Row.DBCampo("CvePS") = "" Then 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").SelectedValueExist(e.Row.DBCampo("CvePS")) @@ -232,6 +247,7 @@ Partial Class Ventas_RepPedidosSTF TmpDTRemis.Columns.Add("GastosEnvio", GetType(Decimal)) TmpDTRemis.Columns.Add("Observacion", GetType(String)) + TmpDTRemis.Columns.Add("CantidadOrg", GetType(Decimal)) TmpDTRemis.Columns.Add("CvePSOrg", GetType(Integer)) TmpDTRemis.Columns.Add("CodigoPSOrg", GetType(String)) @@ -256,11 +272,22 @@ Partial Class Ventas_RepPedidosSTF drp("CvePSOrg") = gvr.DataKey("CvePSOrg").ToEntero drp("CodigoPSOrg") = gvr.DataKey("CodigoPSOrg") + TmpDTRemis.Rows.Add(drp) End If 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 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 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.Observaciones = Observaciones + 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 @@ -296,7 +326,7 @@ Partial Class Ventas_RepPedidosSTF TieneError = True Exit For Else - If Not ObjA.UpdateEstatusAlmacen(dr("CveVentaDetalle").ToString.ToEntero, 0) Then + If Not ObjA.UpdateEstatusAlmacen(dr("CveVentaDetalle").ToString.ToEntero, 1) Then TieneError = True End If End If @@ -343,4 +373,48 @@ Partial Class Ventas_RepPedidosSTF End If 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", "", $" Sucursal: {DdlSubProyecto.SelectedItem.Text}") + Dim Vendedor As String = If(DdlVendedor.SelectedValue = "-1", "", $" Vendedor: {DdlVendedor.SelectedItem.Text}") + + Dim FechaIn As String = If(txtFechaI.Text = "", "", $" Fecha Inicio: {txtFechaI.Text}") + Dim FechaFn As String = If(txtFechaF.Text = "", "", $" Fecha Fin: {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