From 7e7dbe28b84e96f48af0eb99d6702187e86fb4b8 Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Wed, 2 Dec 2020 13:41:41 -0700 Subject: [PATCH 1/2] --- App_Code/ClsClaseBase.vb | 93 ++++++++ Nomina/Aguinaldo.aspx | 97 +++++--- Nomina/Aguinaldo.aspx.cs | 479 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 635 insertions(+), 34 deletions(-) diff --git a/App_Code/ClsClaseBase.vb b/App_Code/ClsClaseBase.vb index a51bde5ba..d5857b782 100644 --- a/App_Code/ClsClaseBase.vb +++ b/App_Code/ClsClaseBase.vb @@ -120,6 +120,83 @@ Public Class ClsClaseBase SqlAdapter.SelectCommand.Parameters.Add(name, tipo).Value = valor End If End Sub + + Public Function runQuerystr(Query As String, Optional Listaparametros As List(Of parametroQuery) = Nothing, Optional msgError As String = "", Optional mostrarError As Boolean = True) As Boolean + Dim retorno As Boolean = False + Try + If SqlConexion.State = ConnectionState.Open Then + SqlAdapter.SelectCommand.Parameters.Clear() + SqlAdapter.SelectCommand.CommandText = Query + SqlAdapter.SelectCommand.CommandType = CommandType.Text + Data = New DataTable() + If Not IsNothing(Listaparametros) Then + For Each pr As parametroQuery In Listaparametros + If Not IsNothing(pr.SqlDataType) Then + If Not IsNothing(pr.ParameterDirection) Then + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Direction = pr.ParameterDirection + Else + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Value = If(Not IsNothing(pr.SqlValue), pr.SqlValue, DBNull.Value) + End If + Else + SqlAdapter.SelectCommand.Parameters.AddWithValue(pr.ParameterName, pr.SqlValue) + End If + Next + End If + + SqlAdapter.Fill(Data) + retorno = True + Else + Dim InfoAdicional As String = "Se intenta realizar una conexion con una conexion cerrada" + InfoAdicional = $"{InfoAdicional}{Environment.NewLine}{msgError}{Environment.NewLine}" + GuardaLog(InfoAdicional) + End If + Catch sqEx As SqlException + retorno = False + setOnError(msgError, sqEx) + Catch ex As Exception + retorno = False + setOnError(msgError, ex) + End Try + Return retorno + End Function + Public Function ExecQuery(Query As String, Optional Listaparametros As List(Of parametroQuery) = Nothing, Optional msgError As String = "", Optional mostrarError As Boolean = True) As Integer + Dim retorno As Integer = -1 + Try + If SqlConexion.State = ConnectionState.Open Then + SqlAdapter.SelectCommand.Parameters.Clear() + SqlAdapter.SelectCommand.CommandText = Query + SqlAdapter.SelectCommand.CommandType = CommandType.Text + If Not IsNothing(Listaparametros) Then + For Each pr As parametroQuery In Listaparametros + If Not IsNothing(pr.SqlDataType) Then + If Not IsNothing(pr.ParameterDirection) Then + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Direction = pr.ParameterDirection + Else + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Value = If(Not IsNothing(pr.SqlValue), pr.SqlValue, DBNull.Value) + End If + Else + SqlAdapter.SelectCommand.Parameters.AddWithValue(pr.ParameterName, pr.SqlValue) + End If + Next + End If + + retorno = SqlAdapter.SelectCommand.ExecuteNonQuery() + Else + Dim InfoAdicional As String = "Se intenta realizar una conexion con una conexion cerrada" + InfoAdicional = $"{InfoAdicional}{Environment.NewLine}{msgError}{Environment.NewLine}" + GuardaLog(InfoAdicional) + End If + Catch sqEx As SqlException + retorno = -1 + setOnError(msgError, sqEx) + Catch ex As Exception + retorno = -1 + setOnError(msgError, ex) + End Try + Return retorno + End Function + + Protected Function RunQuery(msgOnError As String) As Boolean Dim retorno As Boolean = False @@ -203,3 +280,19 @@ Public Class ClsClaseBase End Sub End Class + +Public Class parametroQuery + Public Sub New(parameterName As String, sqlValue As Object, Optional sqlDataType As SqlDbType = Nothing, Optional parameterDirection As ParameterDirection = Nothing) + Me.ParameterName = parameterName + Me.SqlDataType = sqlDataType + Me.ParameterDirection = parameterDirection + Me.SqlValue = sqlValue + + End Sub + + Public Property ParameterName As String + Public Property SqlDataType As SqlDbType + Public Property ParameterDirection As ParameterDirection + Public Property SqlValue As Object + +End Class \ No newline at end of file diff --git a/Nomina/Aguinaldo.aspx b/Nomina/Aguinaldo.aspx index a4f20fae3..456282339 100644 --- a/Nomina/Aguinaldo.aspx +++ b/Nomina/Aguinaldo.aspx @@ -3,6 +3,26 @@ + @@ -51,7 +71,7 @@
-
+
@@ -59,35 +79,55 @@
- Total Aguinaldo + Total aguinaldo
-
+
-
+ +
Autorizado
-
+
-
+ +
Días ejercicio
+
+
+
+
+
+ +
+
+ UMA +
+
+
+
+
+
+
+ +
@@ -97,37 +137,31 @@ - + - + - + - + - + - + - + - + - + - + - - - - - - - + @@ -135,7 +169,13 @@ - + + + + + + + @@ -143,6 +183,7 @@ + <%-- @@ -174,7 +215,7 @@ diff --git a/Nomina/Aguinaldo.aspx.cs b/Nomina/Aguinaldo.aspx.cs index c0d0f5939..e1507fd52 100644 --- a/Nomina/Aguinaldo.aspx.cs +++ b/Nomina/Aguinaldo.aspx.cs @@ -1,7 +1,10 @@ using System; using System.Collections.Generic; +using System.Configuration; using System.Data; +using System.Data.SqlClient; using System.Linq; +using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; @@ -42,6 +45,7 @@ public partial class Nomina_Aguinaldo : ClsPaginas DdlTipoPeriodo.SelectedIndex = 0; } } + LtlUma.Text = "86.88"; } @@ -58,13 +62,14 @@ public partial class Nomina_Aguinaldo : ClsPaginas DTAguinaldos = objnom.DtResultados; GVCalcularAguinaldo.DataSource = DTAguinaldos; LtlTotal.Text = string.Format("{0:N2}", DTAguinaldos.SUM("Aguinaldo")); - LtlAutorizado.Text = string.Format("{0:N2}", DTAguinaldos.SUM("Aguinaldo","CveNomina>0")); - + LtlAutorizado.Text = string.Format("{0:N2}", DTAguinaldos.SUM("Aguinaldo", "CveNomina>0")); + LtldiasEjercicio.Text = string.Format("{0}/12/31", ejercicio).ToDate().DayOfYear.ToString(); } GVCalcularAguinaldo.DataBind(); LnkAutorizarModal.Visible = true; + BtnRecalcular_Click(sender, null); upDatosPA_N.Update(); } private void CargaPeriodos() @@ -149,7 +154,7 @@ public partial class Nomina_Aguinaldo : ClsPaginas { continuar = false; Alert("debe agregar un concepto para el calculo del aguinaldo", ModExtensiones.TipoMensaje.ToastAdventencia); - } + } } if (continuar) { @@ -169,9 +174,9 @@ public partial class Nomina_Aguinaldo : ClsPaginas ImporteGravado = row["AguinaldoGravado"].ToString().ToDecimal(); ImporteExento = Importe - ImporteGravado; ImporteValor = row["DiasLaborados"].ToString().ToDecimal(); - - if (CvePersonal > 0 && Importe>0 && row["CveNomina"].ToString().ToEntero()==0) + + if (CvePersonal > 0 && Importe > 0 && row["CveNomina"].ToString().ToEntero() == 0) { if (objNomina.GetNom_Nominas(-1, CvePersonal, CvePeriodoSeleccionado, -1, UsuarioActual.CveEmpresa)) { @@ -261,4 +266,466 @@ public partial class Nomina_Aguinaldo : ClsPaginas } } } -} \ No newline at end of file + + protected void BtnRecalcular_Click(object sender, EventArgs e) + { + decimal uma = 86.88m; + decimal aguiexentogral = uma * 30; + decimal salariodiario = 0; + decimal diasanio = 366; + decimal diaslaborados = 0; + decimal diasaguinaldo = 0; + decimal diasaguipago = 0; + decimal salariomensual = 0; + decimal aguinaldo = 0; + decimal aguinaldoexcento = 0; + decimal aguinaldogravado = 0; + decimal diasmes = 30.5m; + decimal FraccionI = 0; + decimal FraccionII_1 = 0; + decimal FraccionII_2 = 0; + decimal FraccionIII_1 = 0; + decimal FraccionIII_2 = 0; + decimal FraccionV = 0; + decimal FraccionIV = 0; + + decimal Aguinaldoapagar = 0; + decimal AguinaldoapagarTotal = 0; + StringBuilder str = new StringBuilder(); + using (ClsClaseBaseD objbase = new ClsClaseBaseD()) + { + + foreach (GridViewRow gvrow in GVCalcularAguinaldo.Rows) + { + salariodiario = gvrow.FCTextBox("TxtsueldoDiario").Text.ToDecimal(); + diaslaborados = gvrow.FCTextBox("TxtdiasLaborados").Text.ToDecimal(); + diasaguinaldo = gvrow.FCTextBox("TxtdiasAguinaldo").Text.ToDecimal(); + if (salariodiario > 0) + { + + diasaguipago = (diaslaborados / diasanio) * diasaguinaldo; + salariomensual = salariodiario * 30; + aguinaldo = diasaguipago * salariodiario; + aguinaldoexcento = (aguiexentogral > aguinaldo ? aguinaldo : aguiexentogral); + aguinaldogravado = aguinaldo - aguinaldoexcento; + if (aguinaldogravado > 0) { + FraccionI = (aguinaldogravado / diasanio) * diasmes; + FraccionII_1 = salariomensual + FraccionI; + str.Clear(); + str.AppendFormat("SELECT dbo.Fnc_NomValues(40, 0, 00, -1, {0}, {1}, {1}) isrFraccionII_2,", FraccionII_1, diasmes); + str.AppendFormat(" dbo.Fnc_NomValues(40, 0, 00, -1, {0}, {1}, {1}) isrFraccionIII_1", salariomensual, diasmes); + if (objbase.runQuerystr(str.ToString())) + { + DataRow drow = objbase.DtResultados.Rows[0]; + FraccionII_2 = drow["isrFraccionII_2"].ToString().ToDecimal(); + FraccionIII_1 = drow["isrFraccionIII_1"].ToString().ToDecimal(); + } + else { break; } + + FraccionIII_2 = FraccionII_2 - FraccionIII_1; + FraccionV = FraccionIII_2 / FraccionI; + FraccionIV = aguinaldogravado * FraccionV; + Aguinaldoapagar = aguinaldo - FraccionIV; + } + else + { + + FraccionIV = 0; + Aguinaldoapagar = aguinaldo - FraccionIV; + } + } + else + { + aguinaldo = 0; + Aguinaldoapagar = 0; + aguinaldogravado = 0; + FraccionIV = 0; + } + AguinaldoapagarTotal += Aguinaldoapagar; + gvrow.FCLabel("lblsueldoAguinaldoCompleto").Text = string.Format("${0:N2}", aguinaldo); + gvrow.FCLabel("lblAguinaldo").Text = string.Format("${0:N2}", Aguinaldoapagar); + gvrow.FCLabel("lblAguinaldoGravado").Text = string.Format("${0:N2}", aguinaldogravado); + gvrow.FCLabel("lblISRAguinaldo").Text = string.Format("${0:N2}", FraccionIV); + } + + } + LtlTotal.Text =string.Format("${0:N2}", AguinaldoapagarTotal); + + /* + * + * + + lblAguinaldo + lblAguinaldoGravado + lblISRAguinaldo + + salario diario +dias año +Dias laborados +dias Aguinaldo +dias aguinaldo(PAGO) +UMA +Salario mensual +Aguinaldo +Aguinaldo excento +Aguinaldo gravado + +dias mes +FraccionI +FraccionII +FraccionII +FraccionIII +FraccionIII +FraccionV +FraccionIV + +Aguinaldoapagar + + + + + * + */ + } +} + + class ClsClaseBaseD : IDisposable +{ + protected SqlConnection SqlConexion; + protected SqlDataAdapter SqlAdapter; + protected DataTable datos; + protected DataSet DTSet; + public DataTable DtResultados + { + get + { + return datos; + } + } + public DataSet DTSetResultados + { + get + { + return DTSet; + } + } + protected bool disposedValue = false; + protected bool EsTransaccion = false; + public string MyCurrentError; + // REGISTRAR CONEXIÓN + private int CveConexion = 0; + + public ClsClaseBaseD(ClsClaseBaseD adsObj = null) + { + if (adsObj != null && adsObj.SqlAdapter != null && adsObj.SqlAdapter.SelectCommand != null && adsObj.SqlAdapter.SelectCommand.Transaction != null) + { + SqlConexion = adsObj.SqlConexion; + SqlAdapter = adsObj.SqlAdapter; + EsTransaccion = true; + } + else + { + SqlConexion = new SqlConnection(); + SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString; + try + { + SqlConexion.Open(); + SqlAdapter = new SqlDataAdapter("", SqlConexion); + ConexionAdd(); + } + catch (Exception ex) + { + this.OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex); + } + } + } + + public void SqlDataAdapter(string StrSQL, CommandType TipoComando = CommandType.StoredProcedure) + { + if (SqlConexion.State == ConnectionState.Open) + { + SqlAdapter.SelectCommand.Parameters.Clear(); + SqlAdapter.SelectCommand.CommandText = StrSQL; + SqlAdapter.SelectCommand.CommandType = TipoComando; + datos = new DataTable(); + DTSet = new DataSet(); + } + } + protected void DataAdapter(string StrSQL, CommandType TipoComando = CommandType.Text) + { + + // if (SqlAdapter.SelectCommand == null) + // { + // if ((sqlCommand != null)) + // { + // SqlAdapter.SelectCommand = sqlCommand; + // } + // else + // { + // SqlAdapter.SelectCommand = new SqlCommand(); + // } + // SqlAdapter.SelectCommand.Connection = SqlConexion; + // } + + if (SqlConexion.State == ConnectionState.Open) + { + SqlAdapter.SelectCommand.Parameters.Clear(); + SqlAdapter.SelectCommand.CommandText = StrSQL; + SqlAdapter.SelectCommand.CommandType = TipoComando; + datos = new DataTable(); + DTSet = new DataSet(); + } + } + + private void ConexionAdd() + { + if (ConfigurationManager.AppSettings["RegistraConexion"] != null && ConfigurationManager.AppSettings["RegistraConexion"].ToString() == "1") + { + try + { + SqlDataAdapter("PA_Sis_RegistrarConexion"); + { + var withBlock = SqlAdapter.SelectCommand.Parameters; + withBlock.Add("@Clase", SqlDbType.VarChar).Value = this.GetType().Name; + withBlock.Add("@Modulo", SqlDbType.VarChar).Value = string.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString(), HttpContext.Current.Request.QueryString.ToString()); + withBlock.Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output; + } + SqlAdapter.Fill(datos); + CveConexion = SqlAdapter.SelectCommand.Parameters["@IDConexion"].Value.ToString().ToEntero(); + } + catch (Exception ex) + { + this.OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()); + } + } + } + + private void ConexionClose() + { + if (CveConexion > 0 && ConfigurationManager.AppSettings["RegistraConexion"] != null && ConfigurationManager.AppSettings["RegistraConexion"].ToString() == "1") + { + SqlDataAdapter(string.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text); + + try + { + SqlAdapter.Fill(datos); + } + catch (Exception ex) + { + this.OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()); + } + CveConexion = 0; + } + } + protected void addParameters(string name, SqlDbType tipo, object valor) + { + if (SqlConexion.State == ConnectionState.Open) + SqlAdapter.SelectCommand.Parameters.Add(name, tipo).Value = valor; + } + + public bool runQuerystr(string Query, List Listaparametros = null, string msgError = "", bool mostrarError = true) + { + bool retorno = false; + try + { + if (SqlConexion.State == ConnectionState.Open) + { + SqlAdapter.SelectCommand.Parameters.Clear(); + SqlAdapter.SelectCommand.CommandText = Query; + SqlAdapter.SelectCommand.CommandType = CommandType.Text; + datos = new DataTable(); + if (Listaparametros!= null) + { + foreach (parametroQuery pr in Listaparametros) + { + if (pr.SqlDataType != null) + { + if (pr.ParameterDirection != null) + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Direction = pr.ParameterDirection; + else + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Value = pr.SqlValue != null ? pr.SqlValue : DBNull.Value; + } + else + SqlAdapter.SelectCommand.Parameters.AddWithValue(pr.ParameterName, pr.SqlValue); + } + } + + SqlAdapter.Fill(datos); + retorno = true; + } + else + { + string InfoAdicional = "Se intenta realizar una conexion con una conexion cerrada"; + InfoAdicional = $"{InfoAdicional}{Environment.NewLine}{msgError}{Environment.NewLine}"; + ModExtensiones.GuardaLog(InfoAdicional); + } + } + catch (SqlException sqEx) + { + retorno = false; + setOnError(msgError, sqEx); + } + catch (Exception ex) + { + retorno = false; + setOnError(msgError, ex); + } + return retorno; + } + public int ExecQuery(string Query, List Listaparametros = null, string msgError = "", bool mostrarError = true) + { + int retorno = -1; + try + { + if (SqlConexion.State == ConnectionState.Open) + { + SqlAdapter.SelectCommand.Parameters.Clear(); + SqlAdapter.SelectCommand.CommandText = Query; + SqlAdapter.SelectCommand.CommandType = CommandType.Text; + if (Listaparametros!= null) + { + foreach (parametroQuery pr in Listaparametros) + { + if ( pr.SqlDataType != null) + { + if ( pr.ParameterDirection != null) + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Direction = pr.ParameterDirection; + else + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Value = pr.SqlValue != null ? pr.SqlValue : DBNull.Value; + } + else + SqlAdapter.SelectCommand.Parameters.AddWithValue(pr.ParameterName, pr.SqlValue); + } + } + + retorno = SqlAdapter.SelectCommand.ExecuteNonQuery(); + } + else + { + string InfoAdicional = "Se intenta realizar una conexion con una conexion cerrada"; + InfoAdicional = $"{InfoAdicional}{Environment.NewLine}{msgError}{Environment.NewLine}"; + this.GuardaLog(InfoAdicional); + } + } + catch (SqlException sqEx) + { + retorno = -1; + setOnError(msgError, sqEx); + } + catch (Exception ex) + { + retorno = -1; + setOnError(msgError, ex); + } + return retorno; + } + + + protected bool RunQuery(string msgOnError) + { + bool retorno = false; + + try + { + SqlAdapter.Fill(datos); + retorno = true; + } + catch (Exception ex) + { + retorno = false; + + setOnError(msgOnError, ex); + } + return retorno; + } + protected bool RunQueryDS(string msgOnError) + { + bool retorno = false; + + try + { + SqlAdapter.Fill(DTSet); + retorno = true; + } + catch (Exception ex) + { + retorno = false; + + setOnError(msgOnError, ex); + } + return retorno; + } + public void setOnError(string Mensaje, Exception Exeption) + { + string InfoAdicional = ""; + if (SqlAdapter != null && SqlAdapter.SelectCommand != null && SqlAdapter.SelectCommand.Parameters != null) + InfoAdicional = SqlAdapter.SelectCommand.Parameters.ParametrosInfo(); + MyCurrentError = string.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString(), "\r\n", InfoAdicional); + this.OnError(Mensaje, Exeption, InfoAdicional); + } + public void IniciaTransacSQL() + { + SqlAdapter.SelectCommand.Transaction = SqlConexion.BeginTransaction(); + EsTransaccion = true; + } + + public void Commit() + { + SqlAdapter.SelectCommand.Transaction.Commit(); + SqlConexion.Close(); + } + + public void RollBack() + { + SqlAdapter.SelectCommand.Transaction.Rollback(); + SqlConexion.Close(); + } + public void Dispose() + { + ConexionClose(); + if ((SqlConexion != null)) + { + if (SqlConexion.State == ConnectionState.Open) + { + try + { + if ((SqlAdapter != null)) + SqlAdapter.Dispose(); + + SqlConexion.Close(); + } + catch (Exception ex) + { + this.OnError("Ocurrió un error al intentar cerrar la base de datos.", ex); + } + } + SqlConexion.Dispose(); + } + + if (datos != null) + datos.Dispose(); + if (SqlAdapter != null) + SqlAdapter.Dispose(); + + if (DTSet != null) + DTSet.Dispose(); + + GC.SuppressFinalize(this); + } +} + +public class parametroQuery +{ + public parametroQuery(string parameterName, object sqlValue, SqlDbType sqlDataType = default(SqlDbType), ParameterDirection parameterDirection = default(ParameterDirection)) + { + this.ParameterName = parameterName; + this.SqlDataType = sqlDataType; + this.ParameterDirection = parameterDirection; + this.SqlValue = sqlValue; + } + + public string ParameterName { get; set; } + public SqlDbType SqlDataType { get; set; } + public ParameterDirection ParameterDirection { get; set; } + public object SqlValue { get; set; } +} From f69da7bd8c3ca5e61c90faf3a73f124f6faa96d4 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Wed, 2 Dec 2020 21:14:48 -0700 Subject: [PATCH 2/2] nuevos filtros al reporte de solicitudes anticipo y en ventas al se puede cancenlar una factura de tipo docto pedi2 --- App_Code/ClsOC.vb | 4 +++- OC/RepSolicitudesAnticipo.aspx | 15 ++++++++++++++- OC/RepSolicitudesAnticipo.aspx.cs | 15 ++++++++++++++- Ventas/Ventas.aspx.vb | 12 ++++++++++-- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/App_Code/ClsOC.vb b/App_Code/ClsOC.vb index 98e94a859..829a5b2f1 100644 --- a/App_Code/ClsOC.vb +++ b/App_Code/ClsOC.vb @@ -2524,7 +2524,7 @@ Public Class ClsOC End Function #End Region #Region "REP SOLICITUDES ANTICIPO" - Public Function GetRepSolicitudAnticipos(CveEmpresa As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date, CveEventoEstatus As Integer) As Boolean + Public Function GetRepSolicitudAnticipos(CveEmpresa As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date, CveEventoEstatus As Integer, Optional CveUsuario As Integer = -1, Optional CveSubProyecto As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_RepSolicitudAnticipoGet") @@ -2534,6 +2534,8 @@ Public Class ClsOC .Add("@FechaI", SqlDbType.DateTime).Value = FechaI .Add("@FechaF", SqlDbType.DateTime).Value = FechaF .Add("@CveEventoEstatus", SqlDbType.Int).Value = CveEventoEstatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto End With Try diff --git a/OC/RepSolicitudesAnticipo.aspx b/OC/RepSolicitudesAnticipo.aspx index 4c03a5549..14e80d0fe 100644 --- a/OC/RepSolicitudesAnticipo.aspx +++ b/OC/RepSolicitudesAnticipo.aspx @@ -30,7 +30,7 @@
- <%----%> +
@@ -81,6 +81,19 @@
diff --git a/OC/RepSolicitudesAnticipo.aspx.cs b/OC/RepSolicitudesAnticipo.aspx.cs index ae72827e5..67228491a 100644 --- a/OC/RepSolicitudesAnticipo.aspx.cs +++ b/OC/RepSolicitudesAnticipo.aspx.cs @@ -73,10 +73,23 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas txtFechaI.Text = DateTime.Now.AddMonths(-1).FirstDayOfMonth().ToShortDateString(); txtFechaF.Text = DateTime.Now.ToShortDateString(); CveProveedor = -1; + CargaSubProyectos(); CargaProveedor(); + CargaUsuarios(); CargaDatos(); } + private void CargaSubProyectos() + { + CargarCentrosDeCosto(null,DdlSubProyecto,null,lblSubProyecto); + } + + private void CargaUsuarios() + { + DdlUsuarios.DataSource = get_GlobalDTUsuarios(CveEmpresa:UsuarioActual.CveEmpresa); + DdlUsuarios.DataBind(); + } + protected void CargaProveedor() { DdlProveedores.setEsWebService(true); @@ -93,7 +106,7 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas FechaI = (txtFechaI.Text.ToString() != "" ? txtFechaI.Text.ToDateTime() : MinFecha); FechaF = (txtFechaF.Text.ToString() != "" ? txtFechaF.Text.ToDateTime() : DateTime.Now); - if (ObjOC.GetRepSolicitudAnticipos(UsuarioActual.CveEmpresa, CveProveedor, FechaI, FechaF, DdlEstatus.SelectedValue.ToEntero())) + if (ObjOC.GetRepSolicitudAnticipos(UsuarioActual.CveEmpresa, CveProveedor, FechaI, FechaF, DdlEstatus.SelectedValue.ToEntero(),DdlUsuarios.SelectedValue.ToEntero(),DdlSubProyecto.SelectedValue.ToEntero())) { DtDatos = ObjOC.DtResultados; GvSolicitudes.DataSource = DtDatos; diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 2a8583eed..bc64ed41d 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3926,7 +3926,7 @@ Partial Class Ventas LblAlertRefacInv.Visible = True End If - If DdlTipoComprobante.SelectedValue.Contiene("Egs", "Ing", "Ant", "Dev", "Rem", "DPe", "RNC") AndAlso Not CveEstatus.Contiene(4, 5, 12, 13, 20) Then + If DdlTipoComprobante.SelectedValue.Contiene("Egs", "Ing", "Ant", "Dev", "Rem", "DPe", "RNC", "Pd2") AndAlso Not CveEstatus.Contiene(4, 5, 12, 13, 20) Then If UsuarioActual.TienePermisoProceso(159) Then Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto"))) If TienePermiso <> "" Then @@ -20880,8 +20880,16 @@ Partial Class Ventas RegistraScript("$('#ModalCancelarDocumento').modal();") UpCancelarDocumento.Update() sb.Clear() + ElseIf DdlTipoComprobante.SelectedValue.Contiene("Pd2") Then + Dim ObjVentas As New ClsVentas + If ObjVentas.UpdateEstatusVenta(CveVenta, 22, UsuarioActual.CveEmpresa) Then + Dim redirectString As String = String.Format("document.location.href=""/Ventas/Ventas.aspx?CveVenta={0}""", CveVenta) + Alert("Pedido cancelado.", JSBtnAceptar:=redirectString) + ', "document.location.href=""/Ventas/Ventas.aspx?CveVenta=" & CveVenta + End If + ObjVentas.Dispose() Else - CancelarDocumento() + CancelarDocumento() End If End Sub