diff --git a/App_Code/CLSErrorMessage.vb b/App_Code/CLSErrorMessage.vb new file mode 100644 index 000000000..550e561bf --- /dev/null +++ b/App_Code/CLSErrorMessage.vb @@ -0,0 +1,18 @@ +Imports ClosedXML.Excel.XLPredefinedFormat +Imports System.Buffers +Imports Microsoft.VisualBasic + +Public NotInheritable Class CLSErrorMessage + + + Public Shared Function GetErrorMesagge(mesage As String, ex As Exception, tipoMensaje As Extensiones.ModExtensiones.TipoMensaje) As Tuple(Of String, Extensiones.ModExtensiones.TipoMensaje) + Dim newmesage As String = mesage + Dim newtipoMensaje As Extensiones.ModExtensiones.TipoMensaje = tipoMensaje + If ex.ToString().ToLower().Contains("chk_rh_personalsalarioimss") Then + newmesage = "El salario base cotización no puede ser menor al salario diario integrado" + newtipoMensaje = Extensiones.ModExtensiones.TipoMensaje.MsgAdvertencia + End If + + Return Tuple.Create(newmesage, newtipoMensaje) + End Function +End Class diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index d29728f94..44f5a3d97 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -642,6 +642,22 @@ Public Class ClsNominas retorno = RunQuery("Ocurrió un error al obtener el valor de la UMA.") Return retorno End Function + Public Function GetEfectivaleXLS(CvePeriodo As Int32, CveEmpresa As Int32, CvePersonal As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Nom_EfectivaleXLSGet", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el layout de nóminas(Efetivale).", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function Public Function GetDispersionnominaXLS(CvePeriodo As Int32, CveEmpresa As Int32) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Nom_DispersionnominaXLS", CommandType.StoredProcedure) @@ -1455,7 +1471,7 @@ Public Class ClsNominas Public Function AddConcepto(Codigo As String, Concepto As String, Tipo As String, Formula As String, Sistema As Boolean, Estado As Boolean, CveConceptoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer, EsRetencion As Boolean, CveClasificacion As Integer, CveTipoGasto As Integer, TipoCalculo As Boolean, CveConceptoContable As Integer, AplicaFiniquito As Integer, AutomaticoGlobal As Integer, Especie As Integer, Imprimir As Integer, CveSATConcepto As Integer, - ctaImporteNegativoProv As Integer, contabiliza As Integer, CargoOAbono As Integer, cveConceptoContableB As Integer, CveCuentaB As Integer, CveConceptoContablePasivo As Integer) As Integer + ctaImporteNegativoProv As Integer, contabiliza As Integer, CargoOAbono As Integer, cveConceptoContableB As Integer, CveCuentaB As Integer, CveConceptoContablePasivo As Integer, Optional AplicaEfectivale As Integer = 0) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Nom_ConceptosAdd") @@ -1488,6 +1504,7 @@ Public Class ClsNominas .Add("CveConceptoContableB", SqlDbType.Int).Value = cveConceptoContableB .Add("CveCuentaB", SqlDbType.Int).Value = CveCuentaB .Add("CveConceptoContablePasivo", SqlDbType.Int).Value = CveConceptoContablePasivo + .Add("AplicaEfectivale", SqlDbType.Int).Value = AplicaEfectivale End With @@ -1514,7 +1531,8 @@ Public Class ClsNominas Public Function UpdateConcepto(Codigo As String, Concepto As String, Tipo As String, Formula As String, Sistema As Boolean, Estado As Boolean, CveConceptoPadre As Integer, CveConcepto As Integer, EsRetencion As Boolean, CveClasificacion As Integer, CveTipoGasto As Integer, TipoCalculo As Boolean, CveConceptoContable As Integer, AplicaFiniquito As Integer, AutomaticoGlobal As Integer, Especie As Integer, Imprimir As Integer, CveSATConcepto As Integer, CveEmpresa As Integer, - ctaImporteNegativoProv As Integer, contabiliza As Integer, CargoOAbono As Integer, cveConceptoContableB As Integer, CveCuentaB As Integer, CveConceptoContablePasivo As Integer) As Boolean + ctaImporteNegativoProv As Integer, contabiliza As Integer, CargoOAbono As Integer, cveConceptoContableB As Integer, CveCuentaB As Integer, + CveConceptoContablePasivo As Integer, Optional AplicaEfectivale As Integer = 0) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Nom_ConceptosUpdate") @@ -1546,6 +1564,7 @@ Public Class ClsNominas .Add("CveConceptoContableB", SqlDbType.Int).Value = cveConceptoContableB .Add("CveCuentaB", SqlDbType.Int).Value = CveCuentaB .Add("CveConceptoContablePasivo", SqlDbType.Int).Value = CveConceptoContablePasivo + .Add("AplicaEfectivale", SqlDbType.Int).Value = AplicaEfectivale End With Try diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 5bb948f6b..e3cf0a3af 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -600,6 +600,9 @@ Namespace Extensiones Public Sub OnError(Obj As Object, Mensaje As String, Exeption As Exception, Optional InfoAdicional As String = "", Optional TipoMensaje As TipoMensaje = TipoMensaje.MsgError) GuardaLog(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) + Dim resultado = CLSErrorMessage.GetErrorMesagge(Mensaje, Exeption, TipoMensaje) + Mensaje = resultado.Item1 + TipoMensaje = resultado.Item2 Alert(Obj, Mensaje, TipoMensaje) If WebConfigurationManager.AppSettings("SiteName") IsNot Nothing AndAlso WebConfigurationManager.AppSettings("SiteName").ToString = "1" Then MandaCorreoError(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) End Sub diff --git a/Nomina/ConceptoNomina.aspx b/Nomina/ConceptoNomina.aspx index 067ac9bc9..443e37391 100644 --- a/Nomina/ConceptoNomina.aspx +++ b/Nomina/ConceptoNomina.aspx @@ -424,12 +424,16 @@ - +
+ +
+ +
diff --git a/Nomina/ConceptoNomina.aspx.cs b/Nomina/ConceptoNomina.aspx.cs index 812c420ba..cba504251 100644 --- a/Nomina/ConceptoNomina.aspx.cs +++ b/Nomina/ConceptoNomina.aspx.cs @@ -362,7 +362,7 @@ public partial class Nomina_CatConcepto : ClsPaginas int CveConceptoContablePasivo = DdlConceptoContablePasivo.SelectedValue.ToEntero(); int IdCtaContableB = (DdlCtaContableB.DataValueField == "Id" ? DdlCtaContableB.SelectedValue.ToEntero() : 0); int CveCuentaB = (DdlCtaContableB.DataValueField == "Id" ? 0 : DdlCtaContableB.SelectedValue.ToEntero()); - + int AplicaEfectivale = chkAplicaEfectivale.Checked ? 1 : 0; ClsNominas ObjNomina = new ClsNominas(); ObjNomina.IniciaTransacSQL(); @@ -372,7 +372,7 @@ public partial class Nomina_CatConcepto : ClsPaginas { TieneError = !ObjNomina.UpdateConcepto(codigo, concepto, tipo, formula, sistema, estado, CveConceptoPadre, CveConcepto, retencion, CveClasificacion, CveTipoGasto, tipoCalculo, CveConceptoContable, AplicaFiniquito, AutomaticoGlobal, Especie, Imprimir, CveSATConcepto, - UsuarioActual.CveEmpresa, ctaImporteNegativoProv, contabiliza, CargoOAbono, cveConceptoContableB , CveCuentaB, CveConceptoContablePasivo); + UsuarioActual.CveEmpresa, ctaImporteNegativoProv, contabiliza, CargoOAbono, cveConceptoContableB , CveCuentaB, CveConceptoContablePasivo, AplicaEfectivale); if (!TieneError) { @@ -404,7 +404,7 @@ public partial class Nomina_CatConcepto : ClsPaginas { CveConcepto = ObjNomina.AddConcepto(codigo, concepto, tipo, formula, sistema, estado, CveConceptoPadre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, retencion, CveClasificacion, CveTipoGasto, tipoCalculo, CveConceptoContable, AplicaFiniquito, AutomaticoGlobal, Especie, Imprimir, - CveSATConcepto, ctaImporteNegativoProv, contabiliza, CargoOAbono, cveConceptoContableB, CveCuentaB, CveConceptoContablePasivo); + CveSATConcepto, ctaImporteNegativoProv, contabiliza, CargoOAbono, cveConceptoContableB, CveCuentaB, CveConceptoContablePasivo, AplicaEfectivale); @@ -502,6 +502,7 @@ public partial class Nomina_CatConcepto : ClsPaginas ChkEstado.Checked = drow["Estado"].Equals("Activo"); ChkSistema.Checked = drow["Sistema"].Equals("Sí"); ChkAutomaticoLiquidacion.Checked = drow["AplicaFiniquito"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" }); + chkAplicaEfectivale.Checked = drow["AplicaEfectivale"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" }); ChkContabiliza.Checked = drow["Contabiliza"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" }); chkCtaImporteNegativoProv.Checked = drow["CtaImporteNegativoProv"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" }); ChkAutomaticoGlobal.Checked = drow["AutomaticoGlobal"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" }); @@ -671,4 +672,9 @@ public partial class Nomina_CatConcepto : ClsPaginas //} } + + protected void chkAplicaEfectivale_CheckedChanged(object sender, EventArgs e) + { + + } } \ No newline at end of file diff --git a/Nomina/Nomina.aspx.cs b/Nomina/Nomina.aspx.cs index 0ca01bdac..2e2f0452c 100644 --- a/Nomina/Nomina.aspx.cs +++ b/Nomina/Nomina.aspx.cs @@ -710,7 +710,7 @@ public partial class Nomina_Nomina2 : ClsPaginas LnkTimbrarTodos.Visible = (dtempleados.Rows.Count > 0 && dtempleados.COUNT("CvePersonal", "SeTimbro=0 AND CvePersonal >0 AND NomAutorizado =1") > 0); } - } + } } @@ -7198,7 +7198,7 @@ public partial class Nomina_Nomina2 : ClsPaginas } using (ClsNominas ObjMovt = new ClsNominas()) { - ObjMovt.GetMovtoPermanenteSaldos(UsuarioActual.CveEmpresa, SRCvePersonal, CcveMovtoPermanente); + ObjMovt.GetMovtoPermanenteSaldos(UsuarioActual.CveEmpresa, SRCvePersonal, CcveMovtoPermanente); GVMovtoPermanenteSaldos.DataSource = ObjMovt.DtResultados; GVMovtoPermanenteSaldos.DataBind(); } @@ -10019,28 +10019,31 @@ public partial class Nomina_Nomina2 : ClsPaginas libro.Cell(row, column++).Value = "XTIPOPEDIDO"; libro.Cell(row, column++).Value = "XNUMERO"; libro.Cell(row, column++).Value = "XIMPORTE"; - //libro.Cell(row, column++).Value = "CLABE"; - //libro.Cell(row, column++).Value = "Neto"; + int maxxolumn = column; libro.Range(row, 1, row, column - 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White; libro.Range(row, 1, row, column - 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)); DataRow dcon; decimal subtotal = 0; - if (dtempleados != null && dtempleados.Rows.Count > 0 && dtConceptos != null && dtConceptos.Rows.Count > 0 && (dcon = dtConceptos.FiltroPrimero("Tipo ='P' AND Codigo = 'P028' ")) != null) + DataTable dt = null; + using (ClsNominas objnom = new ClsNominas()) { - foreach (DataRow dRow in dtempleados.FiltraParametros("CvePersonal > 0").Rows) + objnom.GetEfectivaleXLS(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa, -1); + dt = objnom.DtResultados; + } + if (dt != null && dt.Rows.Count > 0) + { + + foreach (DataRow dRow in dt.Rows) { - decimal importe = dRow[string.Format("V_{0}", dcon["CveConcepto"])].ToString().ToDecimal(); - if (importe > 0) - { - subtotal = subtotal + importe; - row++; - column = 1; - libro.Cell(row, column++).Value = "'103646-1"; - libro.Cell(row, column++).Value = "'DISPERSION"; - libro.Cell(row, column++).Value = string.Format("'{0}", dRow["Codigo"]); - libro.Cell(row, column++).Value = importe; - } + decimal importe = dRow["Importe"].ToString().ToDecimal(); + subtotal = subtotal + importe; + row++; + column = 1; + libro.Cell(row, column++).Value = string.Format("'{0}", dRow["XCLIENTE"]); + libro.Cell(row, column++).Value = string.Format("'{0}", dRow["XTIPOPEDIDO"]); + libro.Cell(row, column++).Value = string.Format("'{0}", dRow["CodigoDispersionVale"]); + libro.Cell(row, column++).Value = importe; } } libro.Cell(1, 2).Value = subtotal; @@ -10383,7 +10386,7 @@ public partial class Nomina_Nomina2 : ClsPaginas if (!ErroresValidaciones) { - DataRow RowCuenta = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta: DdlCuenta.SelectedValue.ToEntero(), CveEmpresa: UsuarioActual.CveEmpresa).FiltroPrimero(""); + DataRow RowCuenta = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta: DdlCuenta.SelectedValue.ToEntero(), CveEmpresa: UsuarioActual.CveEmpresa).FiltroPrimero(""); var ClaveMoneda = "001"; // PESOS MEXICANOS //REGISTRO DE CONTROL - IMPORTACIÓN