- cambio en modalidad un solo proyecto

This commit is contained in:
2024-09-11 05:51:12 -07:00
parent 511ad51130
commit 0d6c230472

View File

@@ -6,7 +6,6 @@ Imports System.Data.SqlClient
Imports System.IO
Imports Extensiones
Imports GemBox.Spreadsheet
Imports Microsoft.Ajax.Utilities
Imports Newtonsoft.Json
Partial Class OC_OC
@@ -37,6 +36,15 @@ Partial Class OC_OC
ViewState("CveUsuarioAsignado") = value
End Set
End Property
Private Property ModalidadSubProyectoGeneral As Boolean
Get
Return If(IsNothing(ViewState("ModalidadSubProyectoGeneral")), False, CBool(ViewState("ModalidadSubProyectoGeneral")))
End Get
Set(value As Boolean)
ViewState("ModalidadSubProyectoGeneral") = value
End Set
End Property
Private Property TipoOC As String
Get
If ViewState("TipoOC") Is Nothing Then
@@ -636,6 +644,8 @@ Partial Class OC_OC
GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa) = Nothing
CargaDatosAgregarPS()
CveProveedorOriginal = -1
EnviarNotificacionWhatsApp("526621430964", "hola34 https:/sig.adssistemas.mx/ventas/ventas.aspx")
EnviarNotificacionWhatsApp("526621430964", "", "hello_world")
'MODALIDAD MULTIEMPRESA
CveEmpresaActual = UsuarioActual.CveEmpresa
If CveEmpresaActual > 0 Then
@@ -666,7 +676,7 @@ Partial Class OC_OC
DdlSubProyectoGral.DataBind()
DdlSubProyectoGral.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
DdlSubProyectoGral.SelectedValueExist(UsuarioActual.CveSubProyecto)
ModalidadSubProyectoGeneral = True
TdProyectoSubPrpyectoDdl.Visible = False
TdProyectoSubPrpyecto.Visible = False
GvD.Columns(4).Visible = False
@@ -674,9 +684,6 @@ Partial Class OC_OC
End If
'CARGA YA REGISTRADO
If Request("OC") IsNot Nothing AndAlso IsNumeric(Request("OC")) AndAlso Request("OC").ToEntero > 0 Then
@@ -902,15 +909,9 @@ Partial Class OC_OC
'DdlSubProyectoEntrega.DataSource = DtEstatusUsuarios.FiltraParametros(" SPEstatus = 1 ", "", {"CveSubProyecto", "SubProyecto"})
End If
DdlSubProyecto.DataBind()
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
'DdlSubProyectoEntrega.DataBind()
'DdlSubProyectoEntrega.Items.Insert(0, New ListItem("Seleccione", "-1"))
If ModalidadSubProyectoGeneral Then DdlSubProyecto.SelectedValueExist(DdlSubProyectoGral.SelectedValue)
DdlSubProyectoContrato.Items.Clear()
DdlSubProyectoContrato.DataSource = DtEstatusUsuarios.FiltraParametros("", "", {"CveSubProyecto", "SubProyecto"}) 'If(UsuarioActual.Empresa.Funcionalidad(102) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, CveEmpresaActual, -1, 1), GlobalDTSubProyectos( CveEmpresaActual )) ' DtEstatusUsuarios.FiltraParametros("", "", {"CveSubProyecto", "SubProyecto"})
DdlSubProyectoContrato.DataBind()
@@ -1386,7 +1387,7 @@ Partial Class OC_OC
TipoOC = If(TipoOS, "OS", TipoOC)
If ObjFolios.GetFolios(If(TipoOC = "REQ", "Req", TipoOC), CveEmpresaActual) Then
Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros("Estado = 'Activo'")
If UsuarioActual.CveEmpresa = 189 Then tCveSubProyecto = DdlSubProyectoGral.SelectedValue.ToEntero
If ModalidadSubProyectoGeneral Then tCveSubProyecto = DdlSubProyectoGral.SelectedValue.ToEntero
'Verificar primero en la sucursal del usuario
Dim dts As DataRow = DT.FiltraParametros("CveSubProyecto = " + tCveSubProyecto.ToString).FiltroPrimero("")
If dts IsNot Nothing Then
@@ -1580,7 +1581,7 @@ Partial Class OC_OC
TxtPorcentajeProntoPago.Text = (100 * objOC.PorcentajeProntoPago).ToString("###.00")
If UsuarioActual.CveEmpresa = 189 Then
If ModalidadSubProyectoGeneral Then
Dim existeCvesubproyecto As Boolean = False
If objOC.DtResultados.Rows(0)("CveSubProyectoGral").ToString.ToEntero > 0 Then
For Each tmpItem As ListItem In DdlSubProyectoGral.Items
@@ -2110,16 +2111,14 @@ Partial Class OC_OC
Dim Filtro As String = If(DdlProyecto.SelectedValue.ToEntero > 0 AndAlso UsuarioActual.Empresa.Tipo_CentroCosto.Contiene(4, 5), String.Format("CveProyecto = {0}", DdlProyecto.SelectedValue.ToEntero), "")
DdlSubProyecto.Items.Clear()
If CveOrdenCompra <> Nothing AndAlso CveOrdenCompra > 0 Then
DdlSubProyecto.DataSource = DtEstatusUsuarios.FiltraParametros(Filtro, "", {"CveSubProyecto", "SubProyecto"})
Else
DdlSubProyecto.DataSource = DtEstatusUsuarios.FiltraParametros(" SPEstatus = 1 ").FiltraParametros(Filtro, "", {"CveSubProyecto", "SubProyecto"})
'DdlSubProyecto.DataSource = DtEstatusUsuarios.FiltraParametros(" SPEstatus = 1 ", "", {"CveSubProyecto", "SubProyecto"})
End If
DdlSubProyecto.DataBind()
If ModalidadSubProyectoGeneral Then DdlSubProyecto.SelectedValueExist(DdlSubProyectoGral.SelectedValue)
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
End Sub
Private Sub CargaSubProyectosEdit(DdlSP As DropDownList, CveProyectoEdit As Integer)
@@ -2158,7 +2157,6 @@ Partial Class OC_OC
End If
UPProv.Update() : UPPEmp.Update()
End Sub
@@ -2883,7 +2881,7 @@ Partial Class OC_OC
If Not TieneError Then ' AGREGAR ORDEN DE COMPRA
Dim tCveSubProyecto As Integer = -1
If UsuarioActual.CveEmpresa = 189 Then tCveSubProyecto = DdlSubProyectoGral.SelectedValue.ToEntero
If ModalidadSubProyectoGeneral Then tCveSubProyecto = DdlSubProyectoGral.SelectedValue.ToEntero
If OC.AddOrdenCompra(If(TipoOS, "OS", TipoOC), tCveSubProyecto, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CveEstatusNuevo, If(TxtFechaEstimadaEntrega.Text.Trim = "", "-1", TxtFechaEstimadaEntrega.Text.Trim),
LugarEntrega, UsuarioActual.CveUsuario, CveEmpresaActual, GvD.Rows(0).FCHiddenField("HdnCvePresupuestoEgreso").Value.ToString.ToEntero, pCveProveedor:=CveProveedor, pCveProveedorSucursal:=CveProveedorSucursal,
@@ -3550,7 +3548,7 @@ Partial Class OC_OC
HuboError = True
End If
Dim CveSubProyecto As Integer = -1
If UsuarioActual.CveEmpresa = 189 Then CveSubProyecto = DdlSubProyectoGral.SelectedValue.ToEntero
If ModalidadSubProyectoGeneral Then CveSubProyecto = DdlSubProyectoGral.SelectedValue.ToEntero
If (Not HuboError) AndAlso objOrdenCompra.AddOrdenCompra("OC", CveSubProyecto, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CveEstatusInicialOC, TxtFechaEstimadaEntrega.Text, LugarEntrega,
CveUsuario, CveEmpresaActual, 0, pCveProveedor:=CveProveedor, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text,
@@ -3627,7 +3625,7 @@ Partial Class OC_OC
End If
Dim tCveSubProyecto As Integer = -1
If UsuarioActual.CveEmpresa = 189 Then tCveSubProyecto = DdlSubProyectoGral.SelectedValue.ToEntero
If ModalidadSubProyectoGeneral Then tCveSubProyecto = DdlSubProyectoGral.SelectedValue.ToEntero
If (Not HuboError) AndAlso objOrdenCompra.AddOrdenCompra("OC", tCveSubProyecto, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CveEstatusInicialOC, TxtFechaEstimadaEntrega.Text, LugarEntrega,
CveUsuario, CveEmpresaActual, 0, pCveProveedor:=DdlProveedores.SelectedValue.ToEntero, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveUsuarioAsignado:=DdlUsuariosAsignado.SelectedValue.ToEntero(), CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text,
@@ -9232,7 +9230,7 @@ Partial Class OC_OC
If ObjCon.GetPresupuestosResumen(UsuarioActual.CveEmpresa, -1, FechaCompra.FirstDayOfMonth, FechaCompra.LastDayOfMonth, 2) Then
Dim ColumnaSaldo As String = "Saldo"
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then ColumnaSaldo = "SaldoComprometido"
Dim resultadosFiltrados = From row In ObjCon.DtResultados.AsEnumerable()
Dim resultadosFiltrados = From row In ObjCon.DtResultados.FiltraParametros("CveClasificacion > 0 and CveSubProyecto > 0").AsEnumerable()
Select row
If ObjCon.DtResultados.Rows.Count > 0 Then
@@ -9252,14 +9250,14 @@ Partial Class OC_OC
Dim Diferencia As Decimal = saldoTotal - TotalAcumuladoTabla - ValImporte
If (Diferencia) < 0 Then
Alert($"No hay presupuesto disponible en: <br/> Subproyecto:<b> {ValSubProyecto}</b> Clasificación:<b> {ValClasificacion}</b>. Se excede por <b>{ Math.Abs(Diferencia).FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
Alert($"No hay presupuesto disponible en: <br/> Subproyecto:<b> {ValSubProyecto}</b> <br/>Clasificación:<b> {ValClasificacion}</b>. Se excede por <b>{ Math.Abs(Diferencia).FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
respuesta = False
Else
respuesta = True
End If
respuesta = True
Else
Alert($"No hay presupuesto disponible en: <br/> Subproyecto:<b> {ValSubProyecto}</b></b> Clasificación:<b> {ValClasificacion}</b>.", TipoMensaje.MsgAdvertencia)
Alert($"No hay presupuesto disponible en: <br/> Subproyecto:<b> {ValSubProyecto}</b></b> <br/>Clasificación:<b> {ValClasificacion}</b>.", TipoMensaje.MsgAdvertencia)
respuesta = False
End If
Else
@@ -9296,14 +9294,14 @@ Partial Class OC_OC
If (Diferencia) < 0 Then
Alert($"No hay presupuesto disponible en: <br/> Subproyecto: <b>{item.SubProyecto}</b><br/> Clasificación <b>{item.Clasificacion}</b>. Se excede por <b>{Math.Abs(Diferencia).FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
respuesta = False
respuesta = True
Exit For
Else
respuesta = True
End If
Else
Alert($"No hay presupuesto disponible en: <br/> Subproyecto: <b>{item.SubProyecto}</b><br/> Clasificación <b>{item.Clasificacion}</b>.", TipoMensaje.MsgAdvertencia)
respuesta = False
respuesta = True
Exit For
End If
Else
@@ -9566,22 +9564,18 @@ Partial Class OC_OC
For Each gvr As GridViewRow In GvD.Rows
Dim Cantidad, Importe, Descuento As Decimal
Dim CveUnidad, CveClasificacion, CvePS, CveSubProyecto, CveProyecto, CveCultivoCuadroDetalle As Integer
Dim Obs, UM, Clasificacion, PS, SubProyecto, Proyecto, Cuadro As String
Dim CveUnidad, CveClasificacion As Integer
Dim Obs, UM, Clasificacion, PS As String
Cantidad = gvr.FCTextBox("TxtEMCantEdit").Text.Trim.ToDecimal
Importe = gvr.FCTextBox("TxtEMImporteEdit").Text.Trim.ToDecimal
Descuento = gvr.FCTextBox("TxtEMDescuentoEdit").Text.Trim.ToDecimal
Obs = gvr.FCTextBox("TxtEMObsPS").Text.Trim
'
Obs = gvr.FCTextBox("TxtEMObsPS").Text.Trim '
CveUnidad = gvr.DataKey("CveUnidadMedida").ToEntero
UM = gvr.FCLiteral("LA").Text
CveClasificacion = gvr.DataKey("CveClasificacion").ToEntero
Clasificacion = gvr.FCLabel("LblClasificacion").Text
'SE TOMAN VALORES EN CASO DE QUE LA CvePS SEA DIFERENTE DE LA ANTERIOR
Dim CvePSAnterior As Integer = gvr.DataKey("CvePS").ToEntero
PS = gvr.DataKey("PS").ToString
@@ -9617,13 +9611,10 @@ Partial Class OC_OC
If dr(0)("TipoDato").ToString.ToEntero = 2 Then dr(0)("TipoDato") = 1
DtDetalle.AcceptChanges()
Next
CargaDatosDetalles()
Return True
End Function