diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 55c6e7eca..43c95d644 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -174,7 +174,7 @@ Public Class ClsGenerales Return retorno End Function - Public Function RepConciliacionSatGET(cveEmpresa As Int32, tipoDocto As String, fechaI As String, fechaF As String) As Boolean + Public Function RepConciliacionSATGet(cveEmpresa As Int32, tipoDocto As String, fechaI As String, fechaF As String) As Boolean Dim retorno As Boolean = False DataAdapter("PA_RepConciliacionSatGET", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index 23ac5b7b2..9da716735 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -277,6 +277,49 @@ Public Class ClsNominas End Try Return retorno End Function + Public Function ComparativoSATNominasGet(cveEmpresa As Integer, xml As String, FechaInicio As DateTime, FechaFin As DateTime, CveTipoPeriodo As Integer) As Boolean + Dim retorno As Boolean = False + DTSet = New DataSet() + DataAdapter("[PA_Nom_ComparativoSATNominasGet]", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@xml", SqlDbType.Xml).Value = xml + .Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@TipoPeriodo", SqlDbType.Int).Value = CveTipoPeriodo + End With + Try + SqlAdapter.Fill(DTSet) + If DTSet.Tables.Count > 0 Then + Data = DTSet.Tables(0) + End If + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de Percepciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + Public Function ReportedeNominasGet(cveEmpresa As Integer, FechaInicio As DateTime, FechaFin As DateTime, CveTipoPeriodo As Integer) As Boolean + Dim retorno As Boolean = False + DTSet = New DataSet() + DataAdapter("[PA_Nom_ReportedeNominasGet]", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@TipoPeriodo", SqlDbType.Int).Value = CveTipoPeriodo + End With + Try + SqlAdapter.Fill(DTSet) + If DTSet.Tables.Count > 0 Then + Data = DTSet.Tables(0) + End If + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de Percepciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function Public Function ReportedePercepcionesDeduccionesGet(cveEmpresa As Integer, FechaInicio As DateTime, FechaFin As DateTime, CveTipoPeriodo As Integer) As Boolean Dim retorno As Boolean = False DTSet = New DataSet() diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 4c116ea6f..fce6c2e3a 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -3863,6 +3863,7 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/SolicitudesSAT.aspx".ToUpper(), 717) PaginaDict.Add("/Nomina/CatConceptos2.aspx".ToUpper(), -1) + PaginaDict.Add("/Nomina/NomTimbrados.aspx".ToUpper(), 920) PaginaDict.Add("/Nomina/Aguinaldo.aspx".ToUpper(), -1) PaginaDict.Add("/Nomina/RepInversiondeNomina.aspx".ToUpper(), 906) PaginaDict.Add("/RH/DiasFestivos.aspx".ToUpper(), -1) diff --git a/Bin/ClosedXML.dll b/Bin/ClosedXML.dll index 4065a321f..0bdfccd36 100644 Binary files a/Bin/ClosedXML.dll and b/Bin/ClosedXML.dll differ diff --git a/Bin/DocumentFormat.OpenXml.dll b/Bin/DocumentFormat.OpenXml.dll index 1698758e5..7978b0462 100644 Binary files a/Bin/DocumentFormat.OpenXml.dll and b/Bin/DocumentFormat.OpenXml.dll differ diff --git a/Nomina/Finiquito.aspx.cs b/Nomina/Finiquito.aspx.cs index 5b28459b6..8b6561580 100644 --- a/Nomina/Finiquito.aspx.cs +++ b/Nomina/Finiquito.aspx.cs @@ -134,7 +134,7 @@ public partial class Nomina_Finiquito : ClsPaginas HypCodigo.Text = drow["Codigo"].ToString(); HypEmpleado.Text = drow["NombreCompleto"].ToString(); - HypCodigo.NavigateUrl =$"/RH/Personal.aspx?CvePersonal={drow["CvePersonal"]}"; + HypCodigo.NavigateUrl = $"/RH/Personal.aspx?CvePersonal={drow["CvePersonal"]}"; LblPuesto.Text = drow["Puesto"].ToString(); LblSalario.Text = drow["SalarioDiario"].ToString(); LtlAreaGeografica.Text = drow["AreaGeografica"].ToString(); @@ -147,7 +147,7 @@ public partial class Nomina_Finiquito : ClsPaginas FechaInicio = LblFechaAlta.Text.ToDateTime(); TxtFechaBaja.Text = string.Format("{0:dd/MM/yyyy}", da["FechaFin"]); { - if(da["CveMotivoBaja"].ToString() == "") + if (da["CveMotivoBaja"].ToString() == "") { chkIndemnizacion.Checked = true; chkSeparacionUnica.Checked = true; @@ -158,18 +158,19 @@ public partial class Nomina_Finiquito : ClsPaginas chkIndemnizacion.Checked = da["ValIndemnizacion"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" }); chkSeparacionUnica.Checked = da["ValSeparacionunica"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" }); chkPrimaantiguedad.Checked = da["ValPrimadeantiguedad"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" }); - } + } } DdlMotivoBaja.SelectedValueExist(da["CveMotivoBaja"]); - TxtSalarioMinimo.Text = $"{da["SalarioMinimo"]:N2}" ; + TxtSalarioMinimo.Text = $"{da["SalarioMinimo"]:N2}"; ChkesLiquidacion.Checked = (da["esLiquidacion"].ToString() == "1" || da["esLiquidacion"].ToString().ToUpper() == "TRUE"); CvePeriodoIndemnizacion = da["CvePeriodoIndemnizacion"].ToString().ToEntero(); CvePeriodoFiniquito = da["CvePeriodoFiniquito"].ToString().ToEntero(); - if (CvePeriodoIndemnizacion > 0) + if (CvePeriodoFiniquito > 0) { LnkCancelar.Visible = true; + LnkSimular.Visible = false; using (ClsNominas onom = new ClsNominas()) { loadsobrerecibo(onom); @@ -208,17 +209,17 @@ public partial class Nomina_Finiquito : ClsPaginas { decimal retorno = 0; - decimal mes =12; - retorno =(fechafin.Year -fechainicio.Year ) - (fechafin.Month > fechainicio.Month ? 0 : (fechafin.Month == fechainicio.Month && fechafin.Day > fechainicio.Day ? 0 : 1)); - retorno +=(((fechafin.Month == fechainicio.Month && fechafin.Day > fechainicio.Day ? fechainicio.Month : fechafin.Month + (fechafin.Month > fechainicio.Month ? 0 : 12)) - fechainicio.Month) / mes); - /* DateTime zeroTime = new DateTime(1, 1, 1); - TimeSpan span; - if (fechainicio < fechafin) - { - span = fechafin - fechainicio; - decimal years = (zeroTime + span).Year - 1; - retorno = Math.Round(years + (span.TotalDays.ToString().ToDecimal() / 365), 4); - }*/ + decimal mes = 12; + retorno = (fechafin.Year - fechainicio.Year) - (fechafin.Month > fechainicio.Month ? 0 : (fechafin.Month == fechainicio.Month && fechafin.Day > fechainicio.Day ? 0 : 1)); + retorno += (((fechafin.Month == fechainicio.Month && fechafin.Day > fechainicio.Day ? fechainicio.Month : fechafin.Month + (fechafin.Month > fechainicio.Month ? 0 : 12)) - fechainicio.Month) / mes); + /* DateTime zeroTime = new DateTime(1, 1, 1); + TimeSpan span; + if (fechainicio < fechafin) + { + span = fechafin - fechainicio; + decimal years = (zeroTime + span).Year - 1; + retorno = Math.Round(years + (span.TotalDays.ToString().ToDecimal() / 365), 4); + }*/ return retorno; } @@ -232,7 +233,7 @@ public partial class Nomina_Finiquito : ClsPaginas { using (ClsNominas onom = new ClsNominas()) { - if (onom.DeleteNom_NominasDetalles(SRCveConcepto, CvePersonal, CvePeriodoIndemnizacion)) + if (onom.DeleteNom_NominasDetalles(SRCveConcepto, CvePersonal, CvePeriodoFiniquito)) { Alert("el importe sera tomado del calculo y no del valor fijo"); } @@ -294,7 +295,7 @@ public partial class Nomina_Finiquito : ClsPaginas } protected void DdlmcConceptos_SelectedIndexChanged(object sender, EventArgs e) - { + { int CveConcepto = DdlmcConceptos.SelectedValue.ToEntero(); TxtmcImporte.Text = ""; TxtmcImporteGrabado.Text = ""; @@ -806,7 +807,7 @@ public partial class Nomina_Finiquito : ClsPaginas double percepcionesindem = 0; double deduccionesindem = 0; foreach (DataRow row in dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 And CveSistema IN(10,11,32) ").Rows) - { + { int CveConcepto = row["CveConcepto"].ToString().ToEntero(); string Concepto = row["Concepto"].ToString(); string Codigo = row["Codigo"].ToString(); @@ -902,15 +903,15 @@ public partial class Nomina_Finiquito : ClsPaginas SubTotales.CveConceptoP = 0; SubTotales.ConceptoP = "Total Percepciones"; SubTotales.EstatusP = -2; - SubTotales.ImporteP = dtempleados.SUM("SumaPercepciones", string.Format("CvePersonal = {0}", SRCvePersonal))- percepcionesindem; + SubTotales.ImporteP = dtempleados.SUM("SumaPercepciones", string.Format("CvePersonal = {0}", SRCvePersonal)) - percepcionesindem; ///Alert(SubTotales.ImporteP.ToString()); - + SubTotales.CveConceptoD = 0; SubTotales.ConceptoD = "Total Deducciones"; SubTotales.EstatusD = -2; - SubTotales.ImporteD = dtempleados.SUM("SumaDeducciones", string.Format("CvePersonal = {0}", SRCvePersonal))- deduccionesindem; - + SubTotales.ImporteD = dtempleados.SUM("SumaDeducciones", string.Format("CvePersonal = {0}", SRCvePersonal)) - deduccionesindem; + double neto = SubTotales.ImporteP - SubTotales.ImporteD; NConcepto Totales = new NConcepto(); Totales.CveConceptoD = 0; @@ -1026,14 +1027,14 @@ public partial class Nomina_Finiquito : ClsPaginas SubTotales.CveConceptoP = 0; SubTotales.ConceptoP = "Total Percepciones"; SubTotales.EstatusP = -2; - SubTotales.ImporteP = percepcionesindem; + SubTotales.ImporteP = percepcionesindem; ///Alert(SubTotales.ImporteP.ToString()); SubTotales.CveConceptoD = 0; SubTotales.ConceptoD = "Total Deducciones"; SubTotales.EstatusD = -2; - SubTotales.ImporteD = deduccionesindem; + SubTotales.ImporteD = deduccionesindem; double neto = SubTotales.ImporteP - SubTotales.ImporteD; NConcepto Totales = new NConcepto(); @@ -1062,15 +1063,15 @@ public partial class Nomina_Finiquito : ClsPaginas using (ClsRH ObjPersonal = new ClsRH()) using (ClsNominas onom = new ClsNominas(ObjPersonal.IniciaTransacSQL())) { - if (continuar =ObjPersonal.UpPersonalAltas(CvePersonal, "", TxtFechaBaja.Text.ToDateTime().ToString("yyyy/MM/dd"), -1, DdlMotivoBaja.SelectedValue.ToEntero(), ChkesLiquidacion.Checked,chkIndemnizacion.Checked ,chkSeparacionUnica.Checked, chkPrimaantiguedad.Checked) && ObjPersonal.GetPersonalAltas(CvePersonal) && ObjPersonal.DtResultados.Rows.Count > 0) + if (continuar = ObjPersonal.UpPersonalAltas(CvePersonal, "", TxtFechaBaja.Text.ToDateTime().ToString("yyyy/MM/dd"), -1, DdlMotivoBaja.SelectedValue.ToEntero(), ChkesLiquidacion.Checked, chkIndemnizacion.Checked, chkSeparacionUnica.Checked, chkPrimaantiguedad.Checked) && ObjPersonal.GetPersonalAltas(CvePersonal) && ObjPersonal.DtResultados.Rows.Count > 0) { DataRow da = ObjPersonal.DtResultados.Rows[0]; CvePeriodoIndemnizacion = da["CvePeriodoIndemnizacion"].ToString().ToEntero(); - CvePeriodoFiniquito = da["CvePeriodoFiniquito"].ToString().ToEntero(); + CvePeriodoFiniquito = da["CvePeriodoFiniquito"].ToString().ToEntero(); } if (continuar) { - continuar = onom.GetFiniquitosPersonal(CvePersonal, UsuarioActual.CveEmpresa,diasindemnizacion:Txtdiasindemnizacion.Text.ToEntero()); + continuar = onom.GetFiniquitosPersonal(CvePersonal, UsuarioActual.CveEmpresa, diasindemnizacion: Txtdiasindemnizacion.Text.ToEntero()); } if (continuar) { @@ -1081,7 +1082,7 @@ public partial class Nomina_Finiquito : ClsPaginas ObjPersonal.RollBack(); } if (continuar) - { loadsobrerecibo(onom); } + { loadsobrerecibo(onom);LnkCancelar.Visible = true; LnkSimular.Visible = false; } } } @@ -1291,7 +1292,9 @@ public partial class Nomina_Finiquito : ClsPaginas { if (onom.RemoveFiniquito(CvePersonal, UsuarioActual.CveEmpresa, CvePersonalAltas)) { + loadsobrerecibo(onom); Alert("se ha eliminado el proceso de finiquito"); + UPDatos.Update(); } } } @@ -1310,7 +1313,7 @@ public partial class Nomina_Finiquito : ClsPaginas using (ClsRH ObjPersonal = new ClsRH()) using (ClsNominas onom = new ClsNominas(ObjPersonal.IniciaTransacSQL())) { - if (continuar =ObjPersonal.UpPersonalAltas(CvePersonal, "", TxtFechaBaja.Text.ToDateTime().ToString("yyyy/MM/dd"), -1, DdlMotivoBaja.SelectedValue.ToEntero(), ChkesLiquidacion.Checked, chkIndemnizacion.Checked, chkSeparacionUnica.Checked, chkPrimaantiguedad.Checked) && ObjPersonal.GetPersonalAltas(CvePersonal) && ObjPersonal.DtResultados.Rows.Count > 0) + if (continuar = ObjPersonal.UpPersonalAltas(CvePersonal, "", TxtFechaBaja.Text.ToDateTime().ToString("yyyy/MM/dd"), -1, DdlMotivoBaja.SelectedValue.ToEntero(), ChkesLiquidacion.Checked, chkIndemnizacion.Checked, chkSeparacionUnica.Checked, chkPrimaantiguedad.Checked) && ObjPersonal.GetPersonalAltas(CvePersonal) && ObjPersonal.DtResultados.Rows.Count > 0) { DataRow da = ObjPersonal.DtResultados.Rows[0]; CvePeriodoIndemnizacion = da["CvePeriodoIndemnizacion"].ToString().ToEntero(); @@ -1335,7 +1338,7 @@ public partial class Nomina_Finiquito : ClsPaginas } UPDatos.Update(); } - + protected void BtnAceptarMC_Click(object sender, EventArgs e) { @@ -1356,7 +1359,7 @@ public partial class Nomina_Finiquito : ClsPaginas objNomina.IniciaTransacSQL(); if (continuar) { - if (objNomina.GetNom_Nominas(-1, CvePersonal, CvePeriodoIndemnizacion, -1, UsuarioActual.CveEmpresa)) + if (objNomina.GetNom_Nominas(-1, CvePersonal, CvePeriodoFiniquito, -1, UsuarioActual.CveEmpresa)) { if (objNomina.DtResultados.Rows.Count > 0) { @@ -1364,7 +1367,7 @@ public partial class Nomina_Finiquito : ClsPaginas } else { - if (objNomina.AddNom_Nominas(-1, 1, CvePersonal, CvePeriodoIndemnizacion, Total, 0, 0, Total, CveMoneda, 1, CveMetodoPago, DateTime.Now, "Deducciones nómina", + if (objNomina.AddNom_Nominas(-1, 1, CvePersonal, CvePeriodoFiniquito, Total, 0, 0, Total, CveMoneda, 1, CveMetodoPago, DateTime.Now, "Deducciones nómina", "", "", "", "", 0, 0, 0, new DateTime(), new DateTime(), new DateTime(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, false)) { CveNomina = objNomina.CveNomina; @@ -1389,7 +1392,7 @@ public partial class Nomina_Finiquito : ClsPaginas if (continuar) { - if (!objNomina.AddUPNom_NominasDetalles(CveNomina, CvePeriodoIndemnizacion, CvePersonal, CveConcepto, ImporteConcepto, ImporteGravadoConcepto, ImporteExentoConcepto, ImporteValor, UsuarioActual.CveUsuario, true)) + if (!objNomina.AddUPNom_NominasDetalles(CveNomina, CvePeriodoFiniquito, CvePersonal, CveConcepto, ImporteConcepto, ImporteGravadoConcepto, ImporteExentoConcepto, ImporteValor, UsuarioActual.CveUsuario, true)) { continuar = false; } @@ -1424,6 +1427,7 @@ public partial class Nomina_Finiquito : ClsPaginas Alert("Debe seleccionar un concepto.", TipoMensaje.MsgAdvertencia); } } + UPDatos.Update(); } diff --git a/Nomina/NomTimbrados.aspx b/Nomina/NomTimbrados.aspx new file mode 100644 index 000000000..e2178613e --- /dev/null +++ b/Nomina/NomTimbrados.aspx @@ -0,0 +1,207 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="NomTimbrados.aspx.cs" Inherits="Nomina_NomTimbrados" %> + + + + + + + + Reporte SAT + + + + + + + + + + + +
+
+
+
+ + + + + +
+
+ + + + + +
+
+ +
+
+ + + + + +
+
+
+ +
+
+
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + diff --git a/Nomina/NomTimbrados.aspx.cs b/Nomina/NomTimbrados.aspx.cs new file mode 100644 index 000000000..b43e87d9f --- /dev/null +++ b/Nomina/NomTimbrados.aspx.cs @@ -0,0 +1,667 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Data; +using Extensiones; +using System.Xml; + +public partial class Nomina_NomTimbrados : ClsPaginas +{ + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + TxtRpdFechaInicio.Text = string.Format(" {0:dd/MM/yyyy}", DateTime.Now.AddMonths(-1).FirstDayOfMonth()); + TxtRpdFechaFin.Text = string.Format(" {0:dd/MM/yyyy}", DateTime.Now.AddMonths(-1).LastDayOfMonth()); + // readTimbres(); + } + } + public DataTable initxmldatatable() + { + DataTable dt = new DataTable(); + dt.Columns.Add("NOMBREReceptor", typeof(String)); + dt.Columns.Add("nrnumseguridadsocial", typeof(String)); + dt.Columns.Add("RFCReceptor", typeof(String)); + dt.Columns.Add("nrcurp", typeof(String)); + dt.Columns.Add("nrnumempleado", typeof(String)); + dt.Columns.Add("SERIE", typeof(String)); + dt.Columns.Add("FOLIO", typeof(String)); + dt.Columns.Add("TIPODECOMPROBANTE", typeof(String)); + dt.Columns.Add("TOTAL", typeof(decimal)); + dt.Columns.Add("SUBTOTAL", typeof(decimal)); + dt.Columns.Add("DESCUENTO", typeof(decimal)); + dt.Columns.Add("RFCEmisor", typeof(String)); + /*I nomina12:nomina*/ + dt.Columns.Add("tiponomina", typeof(String)); + dt.Columns.Add("fechapago", typeof(DateTime)); + dt.Columns.Add("fechainicialpago", typeof(DateTime)); + dt.Columns.Add("fechafinalpago", typeof(DateTime)); + dt.Columns.Add("numdiaspagados", typeof(Int32)); + dt.Columns.Add("totalpercepciones", typeof(decimal)); + dt.Columns.Add("totaldeducciones", typeof(decimal)); + dt.Columns.Add("totalotrospagos", typeof(decimal)); + /*E nomina12:nomina*/ + + /*I nomina12:emisor*/ + dt.Columns.Add("registropatronal", typeof(String)); + dt.Columns.Add("rfcpatronorigen", typeof(String)); + /*E nomina12:emisor*/ + + /*I nomina12:receptor*/ + dt.Columns.Add("nrfechainiciorellaboral", typeof(DateTime)); + dt.Columns.Add("nrantiguedad", typeof(String));//antigüedad + dt.Columns.Add("nrtipocontrato", typeof(String)); + dt.Columns.Add("nrsindicalizado", typeof(String)); + dt.Columns.Add("nrtipojornada", typeof(String)); + dt.Columns.Add("nrtiporegimen", typeof(String)); + dt.Columns.Add("nrdepartamento", typeof(String)); + dt.Columns.Add("nrpuesto", typeof(String)); + dt.Columns.Add("nrriesgopuesto", typeof(String)); + dt.Columns.Add("nrperiodicidadpago", typeof(String)); + dt.Columns.Add("nrbanco", typeof(String)); + dt.Columns.Add("nrcuentabancaria", typeof(String)); + dt.Columns.Add("nrsalariobasecotapor", typeof(decimal)); + dt.Columns.Add("nrsalariodiariointegrado", typeof(decimal)); + dt.Columns.Add("nrclaveentfed", typeof(String)); + /*E nomina12:receptor*/ + + /*I nomina12:percepciones*/ + dt.Columns.Add("totalsueldos", typeof(decimal)); + dt.Columns.Add("totalgravado", typeof(decimal)); + dt.Columns.Add("totalexento", typeof(decimal)); + /*E nomina12:percepciones*/ + + /*I nomina12:deducciones*/ + dt.Columns.Add("totalotrasdeducciones", typeof(decimal)); + dt.Columns.Add("totalimpuestosretenidos", typeof(decimal)); + /*E nomina12:deducciones*/ + + + dt.Columns.Add("uuid", typeof(String)); + dt.Columns.Add("fechatimbrado", typeof(DateTime)); + /*I nomina12:otrospagos*/ + //dt.Columns.Add("", typeof(decimal)); + /*E nomina12:otrospagos*/ + + return dt; + } + public string readTimbres() + { + string ruta = string.Format("{0}XML\\Nomina\\", UsuarioActual.Empresa.Ruta); + + string keyComprobante = "cfdi:Comprobante"; + string keyCfdiRelacionados = "cfdi:CfdiRelacionados".ToUpper(); + string keyEmisor = "cfdi:Emisor".ToUpper(); + string keyReceptor = "cfdi:Receptor".ToUpper(); + string keyConceptos = "cfdi:Conceptos".ToUpper(); + string keyImpuestos = "cfdi:Impuestos".ToUpper(); + string keyComplemento = "cfdi:Complemento".ToUpper(); + string[] PrimerNivel = new string[] { keyCfdiRelacionados, keyEmisor, keyReceptor, keyConceptos, keyImpuestos, keyComplemento }; + XmlReaderSettings settings = new XmlReaderSettings(); + settings.ConformanceLevel = ConformanceLevel.Fragment; + settings.IgnoreWhitespace = true; + settings.IgnoreComments = true; + DataTable dt = initxmldatatable(); + foreach (string txtName in System.IO.Directory.GetFiles(ruta, "*.xml")) + { + DataRow drow = dt.NewRow(); + bool canread = true; + using (XmlReader xtr = XmlReader.Create(txtName, settings)) + { + while (canread = xtr.Read()) + { + + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == keyComprobante.ToUpper()) + { + int Nivel = xtr.Depth; + bool cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "SERIE": drow["SERIE"] = xtr.Value; break; + case "FOLIO": drow["FOLIO"] = xtr.Value; break; + case "SUBTOTAL": drow["SUBTOTAL"] = xtr.Value; break; + case "TOTAL": drow["TOTAL"] = xtr.Value; break; + case "DESCUENTO": drow["DESCUENTO"] = xtr.Value; break; + case "TIPODECOMPROBANTE": drow["TIPODECOMPROBANTE"] = xtr.Value; break; + } + switch (xtr.Name.ToUpper()) + { + //case "XMLNS:CFDI": xmlCFDI.comprobante.xmlns_cfdi = xtr.Value; break; + //case "XMLNS:XSI": xmlCFDI.comprobante.xmlns_xsi = xtr.Value; break; + //case "XSI:SCHEMALOCATION": xmlCFDI.comprobante.xsi_schemaLocation = xtr.Value; break; + //case "VERSION": xmlCFDI.comprobante.Version = xtr.Value; break; + //case "SERIE": xmlCFDI.comprobante.Serie = xtr.Value; break; + //case "FOLIO": xmlCFDI.comprobante.Folio = xtr.Value; break; + //case "FECHA": xmlCFDI.comprobante.Fecha = xtr.Value; break; + //case "MONEDA": xmlCFDI.comprobante.Moneda = xtr.Value; break; + //case "SUBTOTAL": decimal SubTotal = 0; decimal.TryParse(xtr.Value, out SubTotal); xmlCFDI.comprobante.SubTotal = SubTotal; break; + //case "TOTAL": decimal Total = 0; decimal.TryParse(xtr.Value, out Total); xmlCFDI.comprobante.Total = Total; break; + //case "DESCUENTO": decimal Descuento = 0; decimal.TryParse(xtr.Value, out Descuento); xmlCFDI.comprobante.Descuento = Descuento; break; + //case "TIPOCAMBIO": decimal TipoCambio = 0; decimal.TryParse(xtr.Value, out TipoCambio); xmlCFDI.comprobante.TipoCambio = TipoCambio; break; + //case "TIPODECOMPROBANTE": xmlCFDI.comprobante.TipoDeComprobante = xtr.Value; break; + //case "FORMAPAGO": xmlCFDI.comprobante.FormaPago = xtr.Value; break; + //case "FORMADEPAGO": xmlCFDI.comprobante.FormaPago = xtr.Value; break; + //case "METODOPAGO": xmlCFDI.comprobante.MetodoPago = xtr.Value; break; + //case "METODODEPAGO": xmlCFDI.comprobante.MetodoPago = xtr.Value; break; + //case "CONDICIONESDEPAGO": xmlCFDI.comprobante.CondicionesDePago = xtr.Value; break; + //case "LUGAREXPEDICION": xmlCFDI.comprobante.LugarExpedicion = xtr.Value; break; + //case "CONFIRMACION": xmlCFDI.comprobante.Confirmacion = xtr.Value; break; + //case "NOCERTIFICADO": xmlCFDI.comprobante.NoCertificado = xtr.Value; break; + //case "SELLO": xmlCFDI.comprobante.Sello = xtr.Value; break; + //case "CERTIFICADO": xmlCFDI.comprobante.Certificado = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + cont = xtr.MoveToFirstAttribute(); + + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > Nivel) + { + if (PrimerNivel.Contains(xtr.Name.ToUpper())) + { + if (xtr.NodeType == XmlNodeType.Element && xtr.Name == keyCfdiRelacionados) + { + int cDepth = xtr.Depth; + + string TipoRelacion = null; + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "TIPORELACION": TipoRelacion = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepth) + { + //if (xtr.Name == "cfdi:CfdiRelacionado") + //{ + // CFDIRelacionado cfdir = new CFDIRelacionado(); + // cfdir.TipoRelacion = TipoRelacion; + // cfdir.UUID = xtr.GetAttribute("UUID"); + // xmlCFDI.cFDIRelacionados.Add(cfdir); + //} + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == keyEmisor.ToUpper()) + { + + + int curentNivel = xtr.Depth; + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + //case "REGIMENFISCAL": xmlCFDI.emisor.RegimenFiscal = xtr.Value; break; + //case "NOMBRE": xmlCFDI.emisor.Nombre = xtr.Value; break; + case "RFC": drow["RFCEmisor"] = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + while ((canread = xtr.Read()) && !(xtr.NodeType == XmlNodeType.Element && curentNivel >= xtr.Depth)) { }//continua hasta que no tenga nodos y (el nodo sea tipo elemnto y ete en el mismo nivel) + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == keyReceptor.ToUpper()) + { + int curentNivel = xtr.Depth; + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "RFC": drow["RFCReceptor"] = xtr.Value; break; + case "NOMBRE": drow["NOMBREReceptor"] = xtr.Value; break; + //case "RESIDENCIAFISCAL": xmlCFDI.receptor.ResidenciaFiscal = xtr.Value; break; + //case "NUMREGIDTRIB": xmlCFDI.receptor.NumRegIdTrib = xtr.Value; break; + //case "USOCFDI": xmlCFDI.receptor.UsoCFDI = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + + while ((canread = xtr.Read()) && !(xtr.NodeType == XmlNodeType.Element && curentNivel >= xtr.Depth)) { }//continua hasta que no tenga nodos y (el nodo sea tipo elemnto y ete en el mismo nivel) + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == keyConceptos.ToUpper()) + { + int cDepth = xtr.Depth; + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepth) + { + if (xtr.Name == "cfdi:Concepto") + { + int cDepthb = xtr.Depth; + //CFDIConcepto concepto = new CFDIConcepto(); + + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + //case "CLAVEPRODSERV": concepto.ClaveProdServ = xtr.Value; break; + //case "NOIDENTIFICACION": concepto.NoIdentificacion = xtr.Value; break; + //case "CANTIDAD": concepto.Cantidad = xtr.Value; break; + //case "CLAVEUNIDAD": concepto.ClaveUnidad = xtr.Value; break; + //case "UNIDAD": concepto.Unidad = xtr.Value; break; + //case "VALORUNITARIO": decimal ValorUnitario = 0; decimal.TryParse(xtr.Value, out ValorUnitario); concepto.ValorUnitario = ValorUnitario; ; break; + //case "IMPORTE": decimal Importe = 0; decimal.TryParse(xtr.Value, out Importe); concepto.Importe = Importe; ; break; + //case "DESCUENTO": decimal DDescuento = 0; decimal.TryParse(xtr.Value, out DDescuento); concepto.Descuento = DDescuento; ; break; + //case "DESCRIPCION": concepto.Descripcion = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepthb) + { + if (xtr.NodeType == XmlNodeType.Element && xtr.Name == "cfdi:Impuestos") + { + int cDepthc = xtr.Depth; + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepthc) + { + if (xtr.Name == "cfdi:Traslado" || xtr.Name == "cfdi:Retencion") + { + //CFDIConceptoImpuesto impuesto = new CFDIConceptoImpuesto(); + //impuesto.Impuesto = xtr.GetAttribute("Impuesto"); + //impuesto.Tipo = xtr.LocalName; + //decimal Base = 0; + //decimal.TryParse(xtr.GetAttribute("Base"), out Base); + //impuesto.Base = Base; + //impuesto.TipoFactor = xtr.GetAttribute("TipoFactor"); + //decimal tasaOCuota = 0; + //decimal.TryParse(xtr.GetAttribute("TasaOCuota"), out tasaOCuota); + //impuesto.TasaOCuota = impuesto.TipoFactor == "Tasa" ? (tasaOCuota * 100).ToString("N4") : xtr.GetAttribute("TasaOCuota"); + //decimal ImImporte = 0; + //decimal.TryParse(xtr.GetAttribute("Importe"), out ImImporte); + //impuesto.Importe = ImImporte; + + //concepto.Impuestos.Add(impuesto); + } + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + + } + } + else + { + bool rednew = true; + if (xtr.NodeType == XmlNodeType.Element && xtr.Name == "cfdi:InformacionAduanera") + { + //concepto.NumeroPedimento = xtr.GetAttribute("NumeroPedimento"); + rednew = false; while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name == "cfdi:CuentaPredial") + { + //concepto.CuentaPredial = xtr.GetAttribute("CuentaPredial"); + rednew = false; while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + if (rednew) { while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } } + + } + } + + //xmlCFDI.conceptos.Add(concepto); + } + } + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == keyImpuestos.ToUpper()) + { + int cDepth = xtr.Depth; + + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepth) + { + //CFDIImpuesto impuest = new CFDIImpuesto(); + //if (xtr.Name == "cfdi:Traslado" || xtr.Name == "cfdi:Retencion" && xmlCFDI.comprobante.Version != null) + //{ + // impuest.Tipo = xtr.LocalName == "Traslado" ? "Traslados" : (xtr.LocalName == "Retencion" ? "Retenciones" : ""); + // impuest.Impuesto = xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("Impuesto") : xtr.GetAttribute("impuesto"); + // impuest.TipoFactor = xtr.GetAttribute("TipoFactor"); + // impuest.TasaOCuota = xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("TasaOCuota") : xtr.GetAttribute("tasa"); + // decimal ImImporte = 0; + // decimal.TryParse((xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("Importe") : xtr.GetAttribute("importe")), out ImImporte); + // impuest.Importe = ImImporte; + // xmlCFDI.Impuestos.Add(impuest); + //} + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + + } + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == keyComplemento.ToUpper()) + { + int cDepth = xtr.Depth; + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepth) + { + //string version = xmlCFDI.comprobante.Version != null ? xmlCFDI.comprobante.Version : ""; + if (xtr.NodeType == XmlNodeType.Element && xtr.LocalName.ToUpper() == "TimbreFiscalDigital".ToUpper()) + { + + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "UUID": drow["uuid"] = xtr.Value; break; + case "FECHATIMBRADO": drow["fechatimbrado"] = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + //xmlCFDI.complemento.xmlns_tfd = xtr.GetAttribute("xmlns:tfd"); + //xmlCFDI.complemento.xsi_schemaLocation = xtr.GetAttribute("xsi:schemaLocation"); + //xmlCFDI.complemento.Version = xtr.GetAttribute("Version"); + //xmlCFDI.complemento.UUID = xtr.GetAttribute("UUID"); + //xmlCFDI.complemento.FechaTimbrado = xtr.GetAttribute("FechaTimbrado"); + //xmlCFDI.complemento.RfcProvCertif = xtr.GetAttribute("RfcProvCertif"); + //xmlCFDI.complemento.SelloCFD = version == "3.3" ? xtr.GetAttribute("SelloCFD") : xtr.GetAttribute("selloCFD"); + //xmlCFDI.complemento.NoCertificadoSAT = version == "3.3" ? xtr.GetAttribute("NoCertificadoSAT") : xtr.GetAttribute("noCertificadoSAT"); + //xmlCFDI.complemento.SelloSAT = version == "3.3" ? xtr.GetAttribute("SelloSAT") : xtr.GetAttribute("selloSAT"); + + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.LocalName == "Pagos") + { + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + //xmlCFDI.complemento.Pagos = new CFDIPago(); + int depthpagos = xtr.Depth; + bool conts = xtr.MoveToFirstAttribute(); + while (conts) + { + + decimal Base = 0; + switch (xtr.Name.ToUpper()) + { + //case "FECHAPAGO": xmlCFDI.complemento.Pagos.FechaPago = xtr.Value; break; + //case "FORMADEPAGOP": xmlCFDI.complemento.Pagos.FormaDePagoP = xtr.Value; break; + //case "FORMADEPAGOPTEXT": xmlCFDI.complemento.Pagos.FormaDePagoPText = xtr.Value; break; + //case "MONEDAP": xmlCFDI.complemento.Pagos.MonedaP = xtr.Value; break; + //case "MONTO": decimal.TryParse(xtr.Value, out Base); xmlCFDI.complemento.Pagos.Monto = Base; break; + //case "TIPOCAMBIOP": decimal.TryParse(xtr.Value, out Base); xmlCFDI.complemento.Pagos.TipoCambioP = Base; break; + //case "NUMOPERACION": xmlCFDI.complemento.Pagos.NumOperacion = xtr.Value; break; + //case "NOMBANCOORDEXT": xmlCFDI.complemento.Pagos.NomBancoOrdExt = xtr.Value; break; + //case "RFCEMISORCTAORD": xmlCFDI.complemento.Pagos.RfcEmisorCtaOrd = xtr.Value; break; + //case "CTAORDENANTE": xmlCFDI.complemento.Pagos.CtaOrdenante = xtr.Value; break; + //case "RFCEMISORCTABEN": xmlCFDI.complemento.Pagos.RfcEmisorCtaBen = xtr.Value; break; + //case "CTABENEFICIARIO": xmlCFDI.complemento.Pagos.CtaBeneficiario = xtr.Value; break; + } + conts = xtr.MoveToNextAttribute(); + } + conts = xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > depthpagos) + { + //CFDIPagoDoctoRelacionado objpago = new CFDIPagoDoctoRelacionado(); + conts = xtr.MoveToFirstAttribute(); + while (conts) + { + + decimal Basep = 0; + switch (xtr.Name.ToUpper()) + { + //case "IDDOCUMENTO": objpago.IdDocumento = xtr.Value; break; + //case "SERIE": objpago.Serie = xtr.Value; break; + //case "FOLIO": objpago.Folio = xtr.Value; break; + //case "MONEDADR": objpago.MonedaDR = xtr.Value; break; + //case "METODODEPAGODR": objpago.MetodoDePagoDR = xtr.Value; break; + //case "NUMPARCIALIDAD": objpago.NumParcialidad = xtr.Value; break; + //case "IMPSALDOANT": decimal.TryParse(xtr.Value, out Basep); objpago.ImpSaldoAnt = Basep; break; + //case "IMPPAGADO": decimal.TryParse(xtr.Value, out Basep); objpago.ImpPagado = Basep; break; + //case "IMPSALDOINSOLUTO": decimal.TryParse(xtr.Value, out Basep); objpago.ImpSaldoInsoluto = Basep; break; + + } + conts = xtr.MoveToNextAttribute(); + } + conts = xtr.MoveToFirstAttribute(); + //xmlCFDI.complemento.Pagos.doctosRelacionados.Add(objpago); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == "nomina12:Nomina".ToUpper()) + { + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "TIPONOMINA": drow["tiponomina"] = xtr.Value; break; + case "FECHAPAGO": drow["fechapago"] = xtr.Value; break; + case "FECHAINICIALPAGO": drow["fechainicialpago"] = xtr.Value; break; + case "FECHAFINALPAGO": drow["fechafinalpago"] = xtr.Value; break; + case "NUMDIASPAGADOS": drow["numdiaspagados"] = xtr.Value; break; + case "TOTALPERCEPCIONES": drow["totalpercepciones"] = xtr.Value; break; + case "TOTALDEDUCCIONES": drow["totaldeducciones"] = xtr.Value; break; + case "TOTALOTROSPAGOS": drow["totalotrospagos"] = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == "nomina12:emisor".ToUpper()) + { + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "REGISTROPATRONAL": drow["registropatronal"] = xtr.Value; break; + case "RFCPATRONORIGEN": drow["rfcpatronorigen"] = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == "nomina12:Receptor".ToUpper()) + { + + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "CURP": drow["nrcurp"] = xtr.Value; break; + case "NUMSEGURIDADSOCIAL": drow["nrnumseguridadsocial"] = xtr.Value; break; + case "FECHAINICIORELLABORAL": drow["nrfechainiciorellaboral"] = xtr.Value; break; + case "ANTIGÜEDAD": drow["nrantiguedad"] = xtr.Value; break; + case "TIPOCONTRATO": drow["nrtipocontrato"] = xtr.Value; break; + case "SINDICALIZADO": drow["nrsindicalizado"] = xtr.Value; break; + case "TIPOJORNADA": drow["nrtipojornada"] = xtr.Value; break; + case "TIPOREGIMEN": drow["nrtiporegimen"] = xtr.Value; break; + case "NUMEMPLEADO": drow["nrnumempleado"] = xtr.Value; break; + case "DEPARTAMENTO": drow["nrdepartamento"] = xtr.Value; break; + case "PUESTO": drow["nrpuesto"] = xtr.Value; break; + case "RIESGOPUESTO": drow["nrriesgopuesto"] = xtr.Value; break; + case "PERIODICIDADPAGO": drow["nrperiodicidadpago"] = xtr.Value; break; + case "BANCO": drow["nrbanco"] = xtr.Value; break; + case "CUENTABANCARIA": drow["nrcuentabancaria"] = xtr.Value; break; + case "SALARIOBASECOTAPOR": drow["nrsalariobasecotapor"] = xtr.Value; break; + case "SALARIODIARIOINTEGRADO": drow["nrsalariodiariointegrado"] = xtr.Value; break; + case "CLAVEENTFED": drow["nrclaveentfed"] = xtr.Value; break; + case "": drow[""] = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.Name == "nomina12:Percepciones") + { + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "TOTALSUELDOS": drow["totalsueldos"] = xtr.Value; break; + case "TOTALGRAVADO": drow["totalgravado"] = xtr.Value; break; + case "TOTALEXENTO": drow["totalexento"] = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.Name == "nomina12:Percepcion") + { + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.Name == "nomina12:Deducciones") + { + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "TOTALOTRASDEDUCCIONES": drow["totalotrasdeducciones"] = xtr.Value; break; + case "TOTALIMPUESTOSRETENIDOS": drow["totalimpuestosretenidos"] = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.Name == "nomina12:Deduccion") + { + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + else + { + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + + } + } + } + } + else + { + //si no entro en ninguna de los anteriores no se debe ciclar + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + } + } + } + } + dt.Rows.Add(drow); + //using (StreamReader sr = new StreamReader(txtName)) + //{ + // sb.AppendLine(txtName.ToString()); + // sb.AppendLine("= = = = = ="); + // sb.Append(sr.ReadToEnd()); + // sb.AppendLine(); + // sb.AppendLine(); + //} + } + dt.TableName = "satxml"; + //GVNominasXmlsat.DataSource = dt; + //GVNominasXmlsat.DataBind(); + + + System.Xml.Linq.XDocument doc = new System.Xml.Linq.XDocument(); + System.Xml.Linq.XElement element = new System.Xml.Linq.XElement("XmlNominas"); + foreach (DataRow item in dt.Rows) + { + + System.Xml.Linq.XElement elementrow = new System.Xml.Linq.XElement("nom"); + foreach (DataColumn col in dt.Columns) + { + System.Xml.Linq.XElement elementcol = new System.Xml.Linq.XElement(col.ColumnName); + if (col.DataType ==typeof(DateTime )) + { + if (item[col.ColumnName] == null) { } else + { + elementcol.Value =string.Format("{0:yyyy/MM/dd HH}:{0:mm}:{0:ss}", item[col.ColumnName]); + + } + } + else + { + elementcol.Value = item[col.ColumnName].ToString(); + + } + //elementrow.SetAttributeValue(new System.Xml.Linq.XName() {LocalName(col.ColumnName) }, item[col.ColumnName]); + elementrow.Add(elementcol); + } + element.Add(elementrow); + } + doc.Add(element); + + + // new System.Xml.Linq.XDocument(new System.Xml.Linq.XElement("XmlNominas", dt.Rows.Select(x => new System.Xml.Linq.XElement("XmlNomina", x)))); + + //System.IO.StringWriter writer = new System.IO.StringWriter(); + //dt.WriteXml(writer, XmlWriteMode.WriteSchema, false); + return doc.ToString(); + } + + public void loadinfo() + { + string xml =readTimbres(); + using (ClsNominas onom = new ClsNominas()) + { + if (onom.ComparativoSATNominasGet(UsuarioActual.CveEmpresa, xml, TxtRpdFechaInicio.Text.ToDateTime(), TxtRpdFechaFin.Text.ToDateTime(), DdlTipoPeriodo.SelectedValue.ToEntero()) ) + { + GVNominasXmlsat.DataSource = onom.DtResultados ; + GVNominasXmlsat.DataBind(); + } + } + Updatos.Update(); + } + + + //public bool AddUnoaUnoCuestionario(string Cuestionario, string Comentario, int CveUsuario, List ListPreguntas, int CveEmpresa) + //{ + // bool retorno = false; + + // System.Xml.Linq.XDocument xmlPreguntas = null; + // if (ListPreguntas != null && ListPreguntas.Count > 0) + // xmlPreguntas = new System.Xml.Linq.XDocument(new System.Xml.Linq.XElement("Preguntas", ListPreguntas.Select(x => new System.Xml.Linq.XElement("CveUnoaUnoPregunta", x)))); + // DataAdapter("PA_OI_UnoaUnoCuestionarioAdd", CommandType.StoredProcedure); + // { + // var withBlock = SqlAdapter.SelectCommand.Parameters; + // withBlock.Add("@Cuestionario", SqlDbType.VarChar).Value = (Cuestionario); + // withBlock.Add("@Comentario", SqlDbType.VarChar).Value = (Comentario); + // withBlock.Add("@CveUsuario", SqlDbType.Int).Value = (CveUsuario); + // withBlock.Add("@CveEmpresa", SqlDbType.Int).Value = (CveEmpresa); + // withBlock.Add("@xmlPreguntas", SqlDbType.Xml).Value = xmlPreguntas == null ? DBNull.Value : (object)xmlPreguntas.ToString(); + // } + // try + // { + // SqlAdapter.Fill(Data); + // retorno = true; + // } + // catch (Exception ex) + // { + // OnError("Ocurrió un error al agregar el cuestionario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()); + // } + // return retorno; + //} + + + + protected void LnkConsultar_Click(object sender, EventArgs e) + { + loadinfo(); + } + + protected void GVNominasXmlsat_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + if (e.Row.DataKey("Tipo") == "1") + { + e.Row.CssClass = "SubTotales"; + } + } + } +} \ No newline at end of file diff --git a/Nomina/Nomina.aspx b/Nomina/Nomina.aspx index 369061bf9..f0db650f5 100644 --- a/Nomina/Nomina.aspx +++ b/Nomina/Nomina.aspx @@ -9,6 +9,10 @@ content: "\f1c1"; } + label.compoonenlabel { + padding-top: 5px; + } + .lblforchk { font-size: 13px; color: #888888; @@ -252,19 +256,19 @@
- +
- +
- +
@@ -272,16 +276,6 @@
- -
- - - -
-
- - -
@@ -310,19 +304,25 @@
- +
- +
- Fecha Pago: + +
+ + + +
+ Fecha Pago:
@@ -341,7 +341,7 @@
- +
@@ -349,6 +349,10 @@
+
+ + +
@@ -592,33 +596,65 @@
- +
-
- - - - +
+
+
+ + + + +
+
+
+
+ + +
+
-
- - -
-
- +
+
+
+ -
-
- +
+
+
+
+ +
+
+
+
+ + + + +
+
-
- - - - +
+ +
+ + + + +
+
+ +
+ + + + +
+
@@ -2330,7 +2366,8 @@ Neto a pagar - + + diff --git a/Nomina/Nomina.aspx.cs b/Nomina/Nomina.aspx.cs index c689f3b71..4a3e7887a 100644 --- a/Nomina/Nomina.aspx.cs +++ b/Nomina/Nomina.aspx.cs @@ -195,7 +195,13 @@ public partial class Nomina_Nomina2 : ClsPaginas LnkVerCalculoISR.Visible = (UsuarioActual.CveUsuario == 100); TxtPeriodo.Text = $"{DateTime.Now:yyyyMM}"; CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyeccto); + CargarCentrosDeCosto(DdlAsisProyecto, DdlAsisSubProyecto, LblAsisProyecto, LblAsisSubProyecto); divddlproyeto.Visible = DdlProyecto.Visible; + PnlProyecto.Visible = DdlProyecto.Visible; + if (PnlProyecto.Visible) + { + PnlSubProyecto.CssClass = "col-md-6"; + } cargaEjercicios(); CargaTiposPeriodo(); cargaPeriodos(); @@ -4900,7 +4906,7 @@ public partial class Nomina_Nomina2 : ClsPaginas using (ClsRH objpersonal = new ClsRH()) { - if (objpersonal.AddAsistencia(CvePersonal, -1, -1, fecha, DdlTipoAsistencias.SelectedValue.ToEntero(), TxtPorPago.Text.Trim().ToDouble(), TxtHorasDobles.Text.Trim().ToDouble(), + if (objpersonal.AddAsistencia(CvePersonal, -1, DdlAsisSubProyecto.SelectedValue.ToEntero(), fecha, DdlTipoAsistencias.SelectedValue.ToEntero(), TxtPorPago.Text.Trim().ToDouble(), TxtHorasDobles.Text.Trim().ToDouble(), TxtHorasTriples.Text.Trim().ToDouble(), DdlMotivoHoraExtra.SelectedValue.ToEntero(), TxtObservaciones.Text.Trim(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) { @@ -4915,6 +4921,7 @@ public partial class Nomina_Nomina2 : ClsPaginas DateTime fecha = TxtasisFecha.Text.ToDate(); DataRow drow = dtempleados.FiltroPrimero(string.Format("CvePersonal={0}", CvePersonal)); TxtPersonal.Text = drow["nombre"].ToString(); + DdlAsisSubProyecto.SelectedValueExist("-1"); if (DdlTipoAsistencias.Items.Count == 1) { DdlTipoAsistencias.DataSource = GlobalDTAsistenciasInasistencias.FiltraParametros(string.Format("CveEmpresa = {0}", UsuarioActual.CveEmpresa)); @@ -4935,6 +4942,7 @@ public partial class Nomina_Nomina2 : ClsPaginas { DataRow dr = objpersonal.DtResultados.Rows[0]; DdlTipoAsistencias.SelectedValueExist(dr["CveAsistenciasInasistencias"].ToString()); + DdlAsisSubProyecto.SelectedValueExist(dr["CveSubProyecto"].ToString()); TxtPorPago.Text = dr["PorcentajePago"].ToString(); TxtHorasDobles.Text = dr["HorasDobles"].ToString(); TxtHorasTriples.Text = dr["HorasTriples"].ToString(); diff --git a/RH/Personal.aspx.vb b/RH/Personal.aspx.vb index a30525de5..6fee14312 100644 --- a/RH/Personal.aspx.vb +++ b/RH/Personal.aspx.vb @@ -6440,6 +6440,13 @@ Partial Class RH_Personal RegistraScript("$('#Dmodamodificarsalario').modal()") UpModSalario.Update() End Sub + + Protected Sub UpdatePersonalAlta_Click(sender As Object, e As EventArgs) + + End Sub + Protected Sub DeletePersonalAlta_Click(sender As Object, e As EventArgs) + + End Sub Protected Sub LnkDescargaFormatoParametros_Click(sender As Object, e As EventArgs) diff --git a/vwd.webinfo b/vwd.webinfo index 9a8ca7cdf..847b634a6 100644 --- a/vwd.webinfo +++ b/vwd.webinfo @@ -264,6 +264,8 @@ + +