From 6690bac9624e5d9ef9e593dff4524c41be3f4424 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Tue, 10 Sep 2024 11:15:03 -0700 Subject: [PATCH] Promiciones actualizacion PSultimo costo --- Transportes/RepContratos.aspx.vb | 92 ++++++++++++++++++++++++--- Ventas/Promociones.aspx.vb | 89 +++++++++++--------------- Ventas/RepVentasUtilidadPadre.aspx | 2 + Ventas/RepVentasUtilidadPadre.aspx.vb | 5 ++ 4 files changed, 128 insertions(+), 60 deletions(-) diff --git a/Transportes/RepContratos.aspx.vb b/Transportes/RepContratos.aspx.vb index 7fff06263..ea8f5663a 100644 --- a/Transportes/RepContratos.aspx.vb +++ b/Transportes/RepContratos.aspx.vb @@ -66,17 +66,23 @@ Partial Class ListadoContratos End If ObjContratos.Dispose() - 'Generamos Folio - NumeroContrato - Dim CveSubProyecto As Integer = GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", "TipoSucursal = 1").ToEntero + + UpTitulos.Update() + End Sub + + Private Sub CargaFolio() + 'Dim CveSubProyecto As Integer = GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", "TipoSucursal = 1").ToEntero + Dim ObjFolio As New ClsGralFolios - If ObjFolio.GetFolios("Con", UsuarioActual.CveEmpresa, CveSubProyecto:=CveSubProyecto) Then + If ObjFolio.GetFolios("Con", UsuarioActual.CveEmpresa, CveSubProyecto:=-1) Then If ObjFolio.DtResultados.Rows.Count > 0 Then Dim drr As DataRow = ObjFolio.DtResultados.FiltroPrimero("") LbFolio.Text = $"{drr("Serie").ToString}-{drr("FActual").ToString}" End If End If + ObjFolio.Dispose() - UpTitulos.Update() + UpModal.Update() End Sub #End Region #Region "Contrato" @@ -189,11 +195,12 @@ Partial Class ListadoContratos ErrorProceso = True End If - - 'Aumentamos Folio - Dim ObjFolios As New ClsGralFolios(ObjContratos.IniciaTransacSQL()) - If Not ObjFolios.UpdateFolioActual(DdlSubProyectoModal.SelectedValue.ToEntero, "Con", True, UsuarioActual.CveEmpresa) Then - ErrorProceso = True + If Not ErrorProceso Then + 'Aumentamos Folio + Dim ObjFolios As New ClsGralFolios(ObjContratos.IniciaTransacSQL()) + If Not ObjFolios.UpdateFolioActual(-1, "Con", True, UsuarioActual.CveEmpresa) Then + ErrorProceso = True + End If End If @@ -400,7 +407,74 @@ Partial Class ListadoContratos #End Region Protected Sub LnkAgregarContrato_Click(sender As Object, e As EventArgs) + CargaFolio() RegistraScript("$('#ModalAgregar').modal({ backdrop: 'static', keyboard: false });") UpTitulos.Update() End Sub + + + 'Private Sub CargaFolios(Optional FacturarDocumentoNuevo As Boolean = False) + + + ' Dim ObjFolios As New ClsGralFolios() + ' Dim TipoDoctoConsulta As String = "" + + ' If ObjFolios.GetFolios(TipoDoctoConsulta, UsuarioActual.CveEmpresa) Then + ' Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue)) + ' If DT.Rows.Count > 0 Then + ' ViewState("CveFolio") = DT.Rows(0)("CveFolio").ToString().ToEntero() + ' 'ViewState("NumAprobacion") = CLng(DT.Rows(0)("Aprobacion").ToString()) + ' 'ViewState("FechaAprobacion") = DT.Rows(0)("FechaAprobacion").ToString().ToDate + ' ViewState("FolioActual") = DT.Rows(0)("FActual").ToString() + ' If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveVenta > 0 AndAlso Not EsCreaApartirDe AndAlso Not String.IsNullOrEmpty(SerieVenta) Then + ' LblSerie.Text = SerieVenta + ' Else + ' LblSerie.Text = DT.Rows(0)("Serie").ToString() + ' End If + ' TxtFolio.Text = DT.Rows(0)("FActual").ToString() + + ' If Not FacturarDocumentoNuevo Then + ' If Not CveEmpresaCRM > 0 Then + ' 'SI ES UNA REMISION EXISTENTE, NO MOSTRAR LOS BOTONES + ' If Not (CveVenta > 0 AndAlso DdlTipoComprobante.SelectedValue = "Rem") Then + ' BtnCrearApartirDe.Enabled = EstatusCliente AndAlso TieneBloqueoPorCreditoVencimiento = 0 + ' BtnEmitirImprimir.Visible = EstatusCliente AndAlso TieneBloqueoPorCreditoVencimiento = 0 + ' TrVistaPrevia.Visible = EstatusCliente + ' End If + ' Else + ' If TipoDoctoConsulta.Contiene("Ing", "Egs", "Ant", "Dev") Then + ' BtnCrearApartirDe.Enabled = EstatusCliente AndAlso TieneBloqueoPorCreditoVencimiento = 0 + ' BtnEmitirImprimir.Visible = EstatusCliente AndAlso TieneBloqueoPorCreditoVencimiento = 0 + ' TrVistaPrevia.Visible = EstatusCliente + ' Else + ' BtnCrearApartirDe.Enabled = True + ' BtnEmitirImprimir.Visible = True + ' TrVistaPrevia.Visible = True + ' End If + ' End If + + ' End If + + ' UpFacturar.Update() + ' Else + + ' If DdlTipoComprobante.Items.Count > 0 Then + ' Alert("No tiene registrados Folios para " & DdlTipoComprobante.SelectedItem.Text & " en esta sucursal.", TipoMensaje.MsgAdvertencia) + ' Else + ' Alert("No tiene permisos para generar ningun tipo de documento.", TipoMensaje.MsgAdvertencia) + ' End If + + ' TrEmitir.Visible = False + ' TrVistaPrevia.Visible = False + ' BtnCrearApartirDe.Enabled = False + ' BtnEmitirImprimir.Visible = False + ' UpFacturar.Update() + ' End If + ' DT.Dispose() + ' End If + ' ObjFolios.Dispose() + ' 'End If + + 'End Sub + End Class diff --git a/Ventas/Promociones.aspx.vb b/Ventas/Promociones.aspx.vb index 8145920a7..0209b38d3 100644 --- a/Ventas/Promociones.aspx.vb +++ b/Ventas/Promociones.aspx.vb @@ -85,18 +85,18 @@ Partial Class Ventas_Promociones End Property - Private Property DTPSUltimoCosto As DataTable - Get - If ViewState("DTPSUltimoCosto") Is Nothing Then - ViewState("DTPSUltimoCosto") = New DataTable - End If + '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 + ' Return CType(ViewState("DTPSUltimoCosto"), DataTable) + ' End Get + ' Set(value As DataTable) + ' ViewState("DTPSUltimoCosto") = value + ' End Set + 'End Property Private Property PermisoAutorizPromocionPorcentaje As Boolean Get @@ -159,7 +159,7 @@ Partial Class Ventas_Promociones PorMinMasCostoVentaFnc129 = UsuarioActual.Empresa.Funcionalidad(129).ToDecimal PermisoAutorizPromocionPorcentaje = UsuarioActual.TienePermisoProceso(386) - EmpresaFnc382 = If(UsuarioActual.Empresa.Funcionalidad(352) = "1", True, False) 'Grupo díaz + EmpresaFnc382 = If(UsuarioActual.Empresa.Funcionalidad(382) = "1", True, False) 'Grupo díaz 'EmpresaFnc382 = True ''Para pruebas CvePromocion = -1 @@ -345,20 +345,20 @@ Partial Class Ventas_Promociones Private Sub CargaDTUltimoCosto() - If Not EmpresaFnc382 Then - Exit Sub + 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 - DTPSUltimoCosto = New DataTable - Dim ObjInv As New ClsInventarios - - If ObjInv.GetUltimoCosto(UsuarioActual.CveEmpresa) Then - DTPSUltimoCosto = ObjInv.DtResultados - End If - - ObjInv.Dispose() End Sub @@ -619,6 +619,16 @@ Partial Class Ventas_Promociones 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 @@ -1141,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) @@ -1321,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 @@ -1335,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 @@ -1414,7 +1401,6 @@ Partial Class Ventas_Promociones Next - If Errores.ToString.Length = 0 Then DTPlantilla.AcceptChanges() Return True @@ -1423,23 +1409,24 @@ 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 - Protected Sub BtnProvbarEnvio_Click(sender As Object, e As EventArgs) MandaCorreoNotificacionPromocionBloqueo(CvePromocion, TxtPromocion.Text.Trim) End Sub diff --git a/Ventas/RepVentasUtilidadPadre.aspx b/Ventas/RepVentasUtilidadPadre.aspx index 29e4da7cb..c7916d2c1 100644 --- a/Ventas/RepVentasUtilidadPadre.aspx +++ b/Ventas/RepVentasUtilidadPadre.aspx @@ -242,7 +242,9 @@ + + diff --git a/Ventas/RepVentasUtilidadPadre.aspx.vb b/Ventas/RepVentasUtilidadPadre.aspx.vb index 5558b8770..34f7ee3d0 100644 --- a/Ventas/RepVentasUtilidadPadre.aspx.vb +++ b/Ventas/RepVentasUtilidadPadre.aspx.vb @@ -32,6 +32,11 @@ Partial Class Ventas_RepVentasUtilidadPadre Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then + If UsuarioActual.Empresa.Funcionalidad(382) <> "1" Then + GvDatos.Columns(3).Visible = False + GvDatos.Columns(5).Visible = False + End If + CargaCombos() End If End Sub