diff --git a/App_Code/ClsEdocumentacion.vb b/App_Code/ClsEdocumentacion.vb index 576b6b90b..3bce49ab7 100644 --- a/App_Code/ClsEdocumentacion.vb +++ b/App_Code/ClsEdocumentacion.vb @@ -34,18 +34,6 @@ Public Class ClsEdocumentacion End Sub -#End Region -#Region "materialidad" - - Public Function Materialidad_Tablero(cveEmpresa As Int32, anio As Int32, mes As Int32) As Boolean - Dim retorno As Boolean = False - DataAdapter("PA_Materialidad_TableroGET", CommandType.StoredProcedure) - addParameters("@CveEmpresa", SqlDbType.Int, cveEmpresa) - addParameters("@Anio", SqlDbType.Int, anio) - addParameters("@Mes", SqlDbType.Int, mes) - retorno = RunQuery("Ocurrió un error al obtener el Materialidad_Tablero.") - Return retorno - End Function #End Region #Region "Propiedades" Public ReadOnly Property DSResultados() As DataSet @@ -559,6 +547,18 @@ Public Class ClsEdocumentacion End Function +#Region "materialidad" + + Public Function Materialidad_Tablero(cveEmpresa As Int32, anio As Int32, mes As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Materialidad_TableroGET", CommandType.StoredProcedure) + addParameters("@CveEmpresa", SqlDbType.Int, cveEmpresa) + addParameters("@Anio", SqlDbType.Int, anio) + addParameters("@Mes", SqlDbType.Int, mes) + retorno = RunQueryds("Ocurrió un error al obtener el materialidad tablero.") + Return retorno + End Function +#End Region #Region "CRUD_Edoc_MaterialidadEnvios" Public Function Edoc_MaterialidadEnviosGet(cveMaterialidadEnvios As Int32, cveCliente As Int32, cveUsuario As Int32, cveEmpresa As Int32) As Boolean Dim retorno As Boolean = False diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index 409c84a51..8823cda54 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -87,7 +87,66 @@ Public Class ClsNominas #End Region - +#Region "CRUD_NomFonacot" + Public Function NomFonacotGet(CveEmpresa As Integer, cveFonacot As Int32, cvePersonal As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Nom_FonacotGet", CommandType.StoredProcedure) + addParameters("@CveFonacot", SqlDbType.Int, cveFonacot) + addParameters("@CvePersonal", SqlDbType.Int, cvePersonal) + addParameters("@CveEmpresa", SqlDbType.Int, CveEmpresa) + retorno = RunQuery("Ocurrió un error al obtener el NomFonacot.") + Return retorno + End Function + Public Function NomFonacotAdd(CveEmpresa As Integer, cvePersonal As Int32, numeroCredito As String, descripcion As String, periodo As Int32, cveTipoCalculo As Int32, importeCredito As Decimal, importeFijo As Decimal, pagosHechos As Decimal, montoAcumulado As Decimal, saldo As Decimal, cveEstatus As Int32, observaciones As String, cveUsuarioIng As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Nom_FonacotAdd", CommandType.StoredProcedure) + addParameters("@CvePersonal", SqlDbType.Int, cvePersonal) + addParameters("@NumeroCredito", SqlDbType.VarChar, numeroCredito) + addParameters("@Descripcion", SqlDbType.VarChar, descripcion) + addParameters("@Periodo", SqlDbType.Int, periodo) + addParameters("@CveTipoCalculo", SqlDbType.Int, cveTipoCalculo) + addParameters("@ImporteCredito", SqlDbType.Money, importeCredito) + addParameters("@ImporteFijo", SqlDbType.Money, importeFijo) + addParameters("@PagosHechos", SqlDbType.Money, pagosHechos) + addParameters("@MontoAcumulado", SqlDbType.Money, montoAcumulado) + addParameters("@Saldo", SqlDbType.Money, saldo) + addParameters("@CveEstatus", SqlDbType.Int, cveEstatus) + addParameters("@Observaciones", SqlDbType.VarChar, observaciones) + addParameters("@CveUsuarioIng", SqlDbType.Int, cveUsuarioIng) + addParameters("@CveEmpresa", SqlDbType.Int, CveEmpresa) + retorno = RunQuery("Ocurrió un error al agregar el NomFonacot.") + Return retorno + End Function + Public Function NomFonacotUp(CveEmpresa As Integer, cveFonacot As Int32, cvePersonal As Int32, numeroCredito As String, descripcion As String, periodo As Int32, cveTipoCalculo As Int32, importeCredito As Decimal, importeFijo As Decimal, pagosHechos As Decimal, montoAcumulado As Decimal, saldo As Decimal, cveEstatus As Int32, observaciones As String, cveUsuarioIng As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Nom_FonacotUp", CommandType.StoredProcedure) + addParameters("@CveFonacot", SqlDbType.Int, cveFonacot) + addParameters("@CvePersonal", SqlDbType.Int, cvePersonal) + addParameters("@NumeroCredito", SqlDbType.VarChar, numeroCredito) + addParameters("@Descripcion", SqlDbType.VarChar, descripcion) + addParameters("@Periodo", SqlDbType.Int, periodo) + addParameters("@CveTipoCalculo", SqlDbType.Int, cveTipoCalculo) + addParameters("@ImporteCredito", SqlDbType.Money, importeCredito) + addParameters("@ImporteFijo", SqlDbType.Money, importeFijo) + addParameters("@PagosHechos", SqlDbType.Money, pagosHechos) + addParameters("@MontoAcumulado", SqlDbType.Money, montoAcumulado) + addParameters("@Saldo", SqlDbType.Money, saldo) + addParameters("@CveEstatus", SqlDbType.Int, cveEstatus) + addParameters("@Observaciones", SqlDbType.VarChar, observaciones) + addParameters("@CveUsuarioIng", SqlDbType.Int, cveUsuarioIng) + addParameters("@CveEmpresa", SqlDbType.Int, CveEmpresa) + retorno = RunQuery("Ocurrió un error al actualizar el NomFonacot.") + Return retorno + End Function + Public Function NomFonacotRemove(CveEmpresa As Integer, cveFonacot As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Nom_FonacotRemove", CommandType.StoredProcedure) + addParameters("@CveFonacot", SqlDbType.Int, cveFonacot) + addParameters("@CveEmpresa", SqlDbType.Int, CveEmpresa) + retorno = RunQuery("Ocurrió un error al eliminar el NomFonacot.") + Return retorno + End Function +#End Region Public Function IniciaTransacSQL() As SqlTransaction If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() Return SqlTransacc diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb index 945a70ac8..ba5cd008c 100644 --- a/App_Code/ClsRH.vb +++ b/App_Code/ClsRH.vb @@ -125,6 +125,60 @@ Public Class ClsRH End Sub #End Region + Public Sub addParameters(varsql As String, sqltipe As SqlDbType, valor As Object) + SqlAdapter.SelectCommand.Parameters.Add(varsql, sqltipe).Value = valor + End Sub + Public Function RunQuery(errormsg As String) As Boolean + Dim retorno As Boolean = False + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + retorno = False + OnError(errormsg, ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return retorno + End Function +#Region "CRUD_VacacionesEmpresas" + Public Function VacacionesEmpresasGet(cveEmpresa As Int32, inicio As Int32, fin As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_RH_VacacionesEmpresasGet", CommandType.StoredProcedure) + addParameters("@CveEmpresa", SqlDbType.Int, cveEmpresa) + addParameters("@Inicio", SqlDbType.Int, inicio) + addParameters("@Fin", SqlDbType.Int, fin) + retorno = RunQuery("Ocurrió un error al obtener el Vacaciones Empresas.") + Return retorno + End Function + Public Function VacacionesEmpresasAdd(cveEmpresa As Int32, inicio As Int32, fin As Int32, diasVacaciones As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_RH_VacacionesEmpresasAdd", CommandType.StoredProcedure) + addParameters("@CveEmpresa", SqlDbType.Int, cveEmpresa) + addParameters("@Inicio", SqlDbType.Int, inicio) + addParameters("@Fin", SqlDbType.Int, fin) + addParameters("@DiasVacaciones", SqlDbType.Int, diasVacaciones) + retorno = RunQuery("Ocurrió un error al agregar el Vacaciones Empresas.") + Return retorno + End Function + Public Function VacacionesEmpresasUp(cveEmpresa As Int32, inicio As Int32, fin As Int32, diasVacaciones As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_RH_VacacionesEmpresasUp", CommandType.StoredProcedure) + addParameters("@CveEmpresa", SqlDbType.Int, cveEmpresa) + addParameters("@Inicio", SqlDbType.Int, inicio) + addParameters("@Fin", SqlDbType.Int, fin) + addParameters("@DiasVacaciones", SqlDbType.Int, diasVacaciones) + retorno = RunQuery("Ocurrió un error al actualizar el Vacaciones Empresas.") + Return retorno + End Function + Public Function VacacionesEmpresasRemove(cveEmpresa As Int32, inicio As Int32, fin As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_RH_VacacionesEmpresasRemove", CommandType.StoredProcedure) + addParameters("@CveEmpresa", SqlDbType.Int, cveEmpresa) + addParameters("@Inicio", SqlDbType.Int, inicio) + addParameters("@Fin", SqlDbType.Int, fin) + retorno = RunQuery("Ocurrió un error al eliminar el Vacaciones Empresas.") + Return retorno + End Function +#End Region Public Function AgroOrigenGet(CveEmpresa As Int32, CveOrigen As Integer, Estatus As Integer, CveTipoNomina As Integer, CveSubProyecto As Integer, GPO As Integer) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Agro_OrigenGet", CommandType.StoredProcedure) diff --git a/App_Code/ClsSisEmpresas.vb b/App_Code/ClsSisEmpresas.vb index df98ac503..5a0ddaf30 100644 --- a/App_Code/ClsSisEmpresas.vb +++ b/App_Code/ClsSisEmpresas.vb @@ -344,7 +344,6 @@ Public Class ClsSisEmpresas _Empresa.CodigoRegimenFiscal = Data.Rows(0)("CodigoRegimenFiscal").ToString _Empresa.RFC = Data.Rows(0)("RFC").ToString _Empresa.CURP = Data.Rows(0)("CURP").ToString - _Empresa.RegistroPatronal = Data.Rows(0)("RegistroPatronal").ToString.ToString _Empresa.Telefono = Data.Rows(0)("Telefono").ToString _Empresa.Contacto = Data.Rows(0)("Contacto").ToString _Empresa.Mail = Data.Rows(0)("Mail").ToString diff --git a/App_Code/Empresa.vb b/App_Code/Empresa.vb index aeb1ff7b7..04f741dd0 100644 --- a/App_Code/Empresa.vb +++ b/App_Code/Empresa.vb @@ -16,7 +16,6 @@ Public Class Empresa Public Property CP As Integer Public Property RFC As String Public Property CURP As String - Public Property RegistroPatronal As String Public Property Telefono As String Public Property Contacto As String Public Property Mail As String diff --git a/App_Code/LogicNominas.vb b/App_Code/LogicNominas.vb index 12a49ab51..9ccd14525 100644 --- a/App_Code/LogicNominas.vb +++ b/App_Code/LogicNominas.vb @@ -173,6 +173,7 @@ Public Class LogicNominas End If If continuar AndAlso objPersonal.GetPersonal(CvePersonal, UsuarioActual.CveEmpresa) AndAlso objPersonal.DtResultados.Rows.Count > 0 Then RFC = objPersonal.RFC + cfdi.Emisor.RegistroPatronal = objPersonal.DtResultados.Rows(0)("RegistroPatronal").ToString() NombreCompleto = objPersonal.NombreCompleto Sindicalizado = objPersonal.DtResultados.Rows(0)("Sindicalizado").ToString().ToUpper().Contiene("TRUE", "1") @@ -310,7 +311,6 @@ Public Class LogicNominas cfdi.Nomina.NumDiasPagados = DiasPagados cfdi.Emisor.Nombre = UsuarioActual.Empresa.Empresa cfdi.Emisor.RFC = UsuarioActual.Empresa.RFC - cfdi.Emisor.RegistroPatronal = UsuarioActual.Empresa.RegistroPatronal cfdi.Emisor.RegimenFiscal = UsuarioActual.Empresa.CodigoRegimenFiscal 'aplica persona fisica debe de tener CURP If cfdi.Emisor.RegimenFiscal.Contiene("605", "606", "608", "611", "612", "614", "616", "621", "622", "629", "630", "615") Then diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 8be4b0926..cf9b6fc77 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -1958,7 +1958,7 @@ Partial Class Bancos_IE cfdi.Nomina.NumDiasPagados = 1 cfdi.Emisor.Nombre = UsuarioActual.Empresa.Empresa cfdi.Emisor.RFC = UsuarioActual.Empresa.RFC - cfdi.Emisor.RegistroPatronal = UsuarioActual.Empresa.RegistroPatronal + cfdi.Emisor.RegistroPatronal = objPersonal.DtResultados.Rows(0)("RegistroPatronal").ToString() cfdi.Emisor.RegimenFiscal = UsuarioActual.Empresa.CodigoRegimenFiscal 'aplica persona fisica debe de tener CURP @@ -2277,7 +2277,7 @@ Partial Class Bancos_IE ' If Msg = String.Empty Then ' 'Nodo emisor - ' Msg = CFDi.ObjCompNomina12.CargarEmisor("", UsuarioActual.Empresa.RegistroPatronal, UsuarioActual.Empresa.RFC) + ' Msg = CFDi.ObjCompNomina12.CargarEmisor("", objPersonal.DtResultados.Rows(0)("RegistroPatronal").ToString(), UsuarioActual.Empresa.RFC) ' 'If Msg = String.Empty Then Msg = CFDi.EmisorRegimen(UsuarioActual.Empresa.CodigoRegimenFiscal) ' If Msg = String.Empty Then ' 'Nodo Entidad SNCF diff --git a/Compras/ReembolsosComprobaciones.aspx.vb b/Compras/ReembolsosComprobaciones.aspx.vb index 552e6d08b..d035cbd6d 100644 --- a/Compras/ReembolsosComprobaciones.aspx.vb +++ b/Compras/ReembolsosComprobaciones.aspx.vb @@ -1967,7 +1967,7 @@ Partial Class Compras_ReembolsosComprobaciones cfdi.Nomina.NumDiasPagados = 1 cfdi.Emisor.Nombre = UsuarioActual.Empresa.Empresa cfdi.Emisor.RFC = UsuarioActual.Empresa.RFC - cfdi.Emisor.RegistroPatronal = UsuarioActual.Empresa.RegistroPatronal + cfdi.Emisor.RegistroPatronal = objPersonal.DtResultados.Rows(0)("RegistroPatronal").ToString() cfdi.Emisor.RegimenFiscal = UsuarioActual.Empresa.CodigoRegimenFiscal 'aplica persona fisica debe de tener CURP diff --git a/Documentacion/TableroMaterialidad.aspx b/Documentacion/TableroMaterialidad.aspx index 69fbb1c06..158694f72 100644 --- a/Documentacion/TableroMaterialidad.aspx +++ b/Documentacion/TableroMaterialidad.aspx @@ -1,18 +1,84 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="TableroMaterialidad.aspx.cs" Inherits="Documentacion_TableroMaterialidad" %> - + - + + - + - + - + + + + +
  • + +
  • +
  • + Cargar Doctos + <%--Cargar Doctos--%> +
  • +
  • + Cargar XML PDF + <%--Cargar XML PDF--%> +
  • +
  • + Enviar
  • +
    +
    - + - + @@ -65,8 +131,10 @@
    - - Materialidad informacion del periodo + + informacion + +
    @@ -77,10 +145,6 @@
    -
    - - -
    @@ -88,8 +152,8 @@
    - - Documentos Generales + + Resumen
    @@ -107,33 +171,79 @@
    -
    -
    +
    +
    -
    - +
    +
    Documentos
    +
    + + + + +
    -
    Documentos Generales
    +
    Documentos
    +
    -
    +
    +
    +
    +
    +
    Generales
    +
    + + + + +
    +
    +
    Documentos
    +
    +
    +
    -
    +
    -
    - +
    +
    Por cliente
    +
    + + + + +
    -
    Cargados
    +
    Documentos
    -
    +
    -
    +
    -
    - +
    +
    Por empleado
    +
    + + + + +
    -
    Faltantes
    +
    Documentos
    @@ -147,6 +257,93 @@ +
    + + + + + + + + + + + + + + + + + + + + + + +
    Documentos por clienteDocumentos por empleado
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    @@ -174,9 +371,580 @@
    + + + + <%----%> + + + + + + + + + - + + + diff --git a/Documentacion/TableroMaterialidad.aspx.cs b/Documentacion/TableroMaterialidad.aspx.cs index 76dd97edf..d744e2bd4 100644 --- a/Documentacion/TableroMaterialidad.aspx.cs +++ b/Documentacion/TableroMaterialidad.aspx.cs @@ -1,19 +1,1818 @@ using System; using System.Collections.Generic; +using System.Data; +using System.Globalization; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; +using Extensiones; -public partial class Documentacion_TableroMaterialidad : ClsPaginas +using System.IO; +using System.IO.Compression; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml; +using System.Xml.Linq; +using iTextSharp.text.pdf; +using iTextSharp.text.pdf.parser; + + +public partial class Documentacion_TableroMaterialidad : ClsPaginas { + #region "Propiedades" + + public Boolean ActualizarDocumentacion + { + get { return ViewState["ActualizarDocumentacion"] != null ? (Boolean)ViewState["ActualizarDocumentacion"] : false; } + set { ViewState["ActualizarDocumentacion"] = value; } + } + public int CveDocumentacion + { + get { return ViewState["CveDocumentacion"] != null ? ViewState["CveDocumentacion"].ToString().ToEntero() : 0; } + set { ViewState["CveDocumentacion"] = value; } + } + public int anio + { + get { return ViewState["anio"] != null ? ViewState["anio"].ToString().ToEntero() : 0; } + set { ViewState["anio"] = value; } + } + public int mes + { + get { return ViewState["mes"] != null ? ViewState["mes"].ToString().ToEntero() : 0; } + set { ViewState["mes"] = value; } + } + + public string directorio + { + get { return ViewState["directorio"] != null ? ViewState["directorio"].ToString() : string.Empty; } + set + { + if (ViewState["directorio"] != null && !string.IsNullOrEmpty(ViewState["directorio"].ToString())) + { + System.IO.Directory.Delete(ViewState["directorio"].ToString(), true); + } + ViewState["directorio"] = value; + } + } + public string xmlobject + { + get { return ViewState["xmlobject"] != null ? ViewState["xmlobject"].ToString() : string.Empty; } + set + { + ViewState["xmlobject"] = value; + } + } + #endregion protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + + Txtanio.Text = DateTime.Now.Year.ToString(); + int mes = DateTime.Now.Month; + ddlMes.SelectedValueExist(String.Format("{0}{1}", (mes < 10 ? "0" : ""), mes)); + Txtanio.Text = "2021"; + ddlMes.SelectedValueExist("11"); + cargadatos(); + } + } + public void cargadatos() + { + anio = Txtanio.Text.ToEntero(); + mes = ddlMes.SelectedValue.ToEntero(); + DateTime fecha = String.Format("{0}-{1}{2}-01", anio, (mes < 10 ? "0" : ""), mes).ToDateTime(); + using (ClsEdocumentacion edoc = new ClsEdocumentacion()) + { + LtlPeriodo.Text = fecha.ToString("MMMM yyyy", CultureInfo.CreateSpecificCulture("es-MX")); + edoc.Materialidad_Tablero(UsuarioActual.CveEmpresa, anio, mes); + if (edoc.DtResultados.Rows.Count > 0) + { + DataRow drow = edoc.DtResultados.Rows[0]; + + LtlDoctosTotal.Text = String.Format("{0}", drow["Doctos"]); + LtlDoctosEntregados.Text = String.Format("{0}", drow["DoctosOk"]); + LtlDoctosRestantes.Text = String.Format("{0}", drow["DoctosR"]); + + LtlDoctosGralesTotal.Text = String.Format("{0}", drow["DoctosG"]); + LtlDoctosGralesEntregados.Text = String.Format("{0}", drow["DoctosOkG"]); + LtlDoctosGralesRestantes.Text = String.Format("{0}", drow["DoctosRG"]); + + LtlDoctosXclienteTotal.Text = String.Format("{0}", drow["DoctosC"]); + LtlDoctosXclienteEntregados.Text = String.Format("{0}", drow["DoctosOkC"]); + LtlDoctosXclienteRestantes.Text = String.Format("{0}", drow["DoctosRC"]); + + LtlDoctosXEmplTotal.Text = String.Format("{0}", drow["DoctosE"]); + LtlDoctosXEmplEntregados.Text = String.Format("{0}", drow["DoctosOkE"]); + LtlDoctosXEmplRestantes.Text = String.Format("{0}", drow["DoctosRE"]); + } + if (edoc.DSResultados.Tables.Count > 1) + { + GVMaterialidad.DataSource = edoc.DSResultados.Tables[1]; + GVMaterialidad.DataBind(); + } + + + } + + } + protected void BtnConsultar_Click(object sender, EventArgs e) + { + cargadatos(); + } + + protected void lblcliente_Click(object sender, EventArgs e) { } - protected void BtnConsultar_Click(object sender, EventArgs e) + protected void GVMaterialidad_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + string toolTip = ""; + int CveCliente = e.Row.DataKey("CveCliente").ToEntero(); + int Confactura = e.Row.DataKey("Confactura").ToEntero(); + int ConAsistencia = e.Row.DataKey("ConAsistencia").ToEntero(); + if (ConAsistencia == 0) + { + e.Row.CssClass = "warning"; + toolTip = string.Format("{0}{1} cliente con factura sin asistencia registrada.", toolTip, (toolTip.Length > 0 ? " " : "")); + } + //if (PeriodoOk <= 0) + //{ + // e.Row.CssClass = "warning"; + // toolTip = string.Format("{0}{1}Esta nomina no pertenece a este periodo", toolTip, (toolTip.Length > 0 ? " " : "")); + //} + if (CveCliente <= 0) + { + e.Row.CssClass = "danger"; + toolTip = string.Format("{0}{1}Asistencia sin cliente asignado", toolTip, (toolTip.Length > 0 ? " " : "")); + } + /* + if (CvePeriodo <= 0) + { + e.Row.CssClass = "danger"; + toolTip = string.Format("{0}{1}No se encontro el periodo", toolTip, (toolTip.Length > 0 ? " " : "")); + }*/ + e.Row.Attributes.Add("data-toggle", "toolTip"); + e.Row.ToolTip = toolTip; + } + } + + protected void LnkDownFiles_Click(object sender, EventArgs e) + { + + } + + + + + protected void BtnAddClienteDocumento_Click(object sender, EventArgs e) + { + List litsarchivoxml = Anexo.getfiles().Archivos; + int CveDocumentacion = DdlDocumentacion.SelectedValue.ToEntero(); + int CveDocumentacionElectronica = 0; + string obs = TxtObservaciones.Text; + string rutaempresa = string.Format("{0}\\materialidad\\", UsuarioActual.Empresa.Ruta); + if (!System.IO.Directory.Exists(rutaempresa)) + { + System.IO.Directory.CreateDirectory(rutaempresa); + } + foreach (Archivo arch in litsarchivoxml) + { + + DateTime fecha = string.Format("{0}-{1}-01", anio, mes).ToDateTime(); + using (ClsEdocumentacion edoc = new ClsEdocumentacion()) + { + CveDocumentacionElectronica = edoc.DocumentacionElectronicaAdd(CveDocumentacion, -1, -1, -1, 1, obs, "", UsuarioActual.CveUsuario, fecha, fecha, Periodo: string.Format("{0}{1}", anio, mes).ToEntero()); + if (CveDocumentacionElectronica > 0) + { + + edoc.DocumentacionElectronicaUpdate(CveDocumentacionElectronica, CveDocumentacion, -1, -1, -1, 2, obs, string.Format("{0}.{1}", CveDocumentacionElectronica, arch.Extension.ToLower()), UsuarioActual.CveUsuario, fecha, fecha, arch.filenameO); + System.IO.File.Move(arch.FileUrl, string.Format("{2}{0}.{1}", CveDocumentacionElectronica, arch.Extension.ToLower(), rutaempresa)); + Alert("los registros se guardaron correctamente"); + cargadatos(); + RegistraScript("$('#ModalDoctos').modal('hide');"); + Anexo.Text = "[]"; + } + } + } + + + } + + protected void LckOpModalDoctos_Click(object sender, EventArgs e) + { + DateTime fecha = string.Format("{0}-{1}-01", anio, mes).ToDateTime(); + LtlPeriodo.Text = fecha.ToString("MMMM yyyy", System.Globalization.CultureInfo.CreateSpecificCulture("es-MX"));//string.Format(""); + UpModalDoctos.Update(); + RegistraScript("$('#ModalDoctos').modal();"); + } + + protected void LckOpModalDoctosPDFXML_Click(object sender, EventArgs e) + { + DateTime fecha = string.Format("{0}-{1}-01", anio, mes).ToDateTime(); + LtlPeriodoXMLPDF.Text = fecha.ToString("MMMM yyyy", System.Globalization.CultureInfo.CreateSpecificCulture("es-MX")); + RegistraScript("$('#ModalDoctosxmlpdf').modal();showhideprocesarguardar =0; openguardar();"); + Upxmlpdf.Update(); + } + + protected void LnkCargarZip_Click(object sender, EventArgs e) + { + List litsarchivoxml = Anexoxmlpdf.getfiles().Archivos; + if (litsarchivoxml.Count > 0) + { + Archivo archivoxml = litsarchivoxml[0]; + if (archivoxml.Extension.ToLower() == "zip") + { + xmlobject = null; + string text; + string[] lines; + string[] splitword; + List fechas = new List(); + string foliofiscal = string.Empty; + string CURP = string.Empty; + directorio = string.Empty; + char[] delimiterChars = { ' ', ',', '.', ':', '\t' }; + Regex rgxfecha = new Regex(@"^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[13-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$"); + Regex rgxcurp = new Regex("^(([A-ZÑ&]{4})([0-9]{2})([0][13578]|[1][02])(([0][1-9]|[12][\\d])|[3][01])([A-Z0-9]{3}))|(([A-ZÑ&]{4})([0-9]{2})([0][13456789]|[1][012])(([0][1-9]|[12][\\d])|[3][0])([A-Z0-9]{3}))|(([A-ZÑ&]{4})([02468][048]|[13579][26])[0][2]([0][1-9]|[12][\\d])([A-Z0-9]{3}))|(([A-ZÑ&]{4})([0-9]{2})[0][2]([0][1-9]|[1][0-9]|[2][0-8])([A-Z0-9]{3}))$"); + + + directorio = archivoxml.FileUrl.Substring(0, archivoxml.FileUrl.Length - 4); + System.IO.Directory.CreateDirectory(directorio); + ZipFile.ExtractToDirectory(archivoxml.FileUrl, directorio); + + System.Xml.Linq.XDocument xmlarchivos = new System.Xml.Linq.XDocument(); + XElement xfolder = new XElement("folder"); + foreach (var urfile in System.IO.Directory.GetFiles(directorio, "*", SearchOption.AllDirectories)) + { + XElement xfile = new XElement("archivo"); + xfile.SetAttributeValue("URL", urfile); + xfile.SetAttributeValue("EXT", Path.GetExtension(urfile).ToLower()); + if (Path.GetExtension(urfile).ToLower() == ".xml") + { + var xmlobj = ADSistemaLibrary3.SatXml.XmlSatCFDI.readXML(urfile); + + xfile.SetAttributeValue("UUID", xmlobj.complemento.UUID); + xfile.SetAttributeValue("Receptor", xmlobj.receptor.Nombre); + xfile.SetAttributeValue("RfcReceptor", xmlobj.receptor.Rfc); + xfile.SetAttributeValue("RfcEmisor", xmlobj.emisor.Rfc); + xfile.SetAttributeValue("Emisor", xmlobj.emisor.Nombre); + xfile.SetAttributeValue("SubTotal", xmlobj.comprobante.SubTotal); + xfile.SetAttributeValue("Descuento", xmlobj.comprobante.Descuento); + xfile.SetAttributeValue("Total", xmlobj.comprobante.Total); + xfile.SetAttributeValue("Serie", xmlobj.comprobante.Serie); + xfile.SetAttributeValue("Folio", xmlobj.comprobante.Folio); + xfile.SetAttributeValue("Fecha", xmlobj.comprobante.Fecha); + + + xfile.SetAttributeValue("FechaPago", xmlobj.complemento.nomina12.FechaPago); + xfile.SetAttributeValue("FechaInicio", xmlobj.complemento.nomina12.FechaInicio); + xfile.SetAttributeValue("FechaFin", xmlobj.complemento.nomina12.FechaFin); + xfile.SetAttributeValue("NumDiasPagados", xmlobj.complemento.nomina12.NumDiasPagados); + xfile.SetAttributeValue("TotalPercepciones", xmlobj.complemento.nomina12.TotalPercepciones); + xfile.SetAttributeValue("TotalDeducciones", xmlobj.complemento.nomina12.TotalDeducciones); + xfile.SetAttributeValue("CURP", xmlobj.complemento.nomina12.Receptor.CURP); + xfile.SetAttributeValue("NSS", xmlobj.complemento.nomina12.Receptor.NSS); + xfile.SetAttributeValue("TN", xmlobj.complemento.nomina12.TipoNomina); + xfile.SetAttributeValue("NDP", xmlobj.complemento.nomina12.NumDiasPagados); + xfile.SetAttributeValue("TP", xmlobj.complemento.nomina12.Receptor.TipoPeriodo); + foreach (var con in xmlobj.complemento.nomina12.Percepciones) + { + XElement concepto = new XElement("con"); + concepto.SetAttributeValue("TCon", "P"); + concepto.SetAttributeValue("SV", "0"); + concepto.SetAttributeValue("Tipo", con.TipoPercepcion); + concepto.SetAttributeValue("Clave", con.Clave); + concepto.SetAttributeValue("Concepto", con.Concepto); + concepto.SetAttributeValue("Importe", con.ImporteGravado + con.ImporteExento); + concepto.SetAttributeValue("ImporteG", con.ImporteGravado); + concepto.SetAttributeValue("ImporteE", con.ImporteExento); + xfile.Add(concepto); + } + foreach (var con in xmlobj.complemento.nomina12.OtrosPagos) + { + XElement concepto = new XElement("con"); + concepto.SetAttributeValue("TCon", "D"); + concepto.SetAttributeValue("SV", "0"); + concepto.SetAttributeValue("Tipo", con.TipoOtroPago); + concepto.SetAttributeValue("Clave", con.Clave); + concepto.SetAttributeValue("Concepto", con.Concepto); + concepto.SetAttributeValue("Importe", -con.Importe); + concepto.SetAttributeValue("ImporteG", -con.Importe); + concepto.SetAttributeValue("ImporteE", 0); + xfile.Add(concepto); + } + foreach (var con in xmlobj.complemento.nomina12.Deducciones) + { + if (con.TipoDeduccion == "-001-") { } + else + { + XElement concepto = new XElement("con"); + concepto.SetAttributeValue("TCon", "D"); + if (con.TipoDeduccion == "-000-") + { + concepto.SetAttributeValue("SV", "1"); + concepto.SetAttributeValue("Tipo", "000"); + } + else + { + concepto.SetAttributeValue("SV", "0"); + concepto.SetAttributeValue("Tipo", con.TipoDeduccion); + } + concepto.SetAttributeValue("Clave", con.Clave); + concepto.SetAttributeValue("Concepto", con.Concepto); + concepto.SetAttributeValue("Importe", con.Importe); + concepto.SetAttributeValue("ImporteG", con.Importe); + concepto.SetAttributeValue("ImporteE", 0); + xfile.Add(concepto); + } + } + + } + else if (Path.GetExtension(urfile).ToLower() == ".pdf") + { + try + { + PdfReader reader = new PdfReader(urfile); + + text = PdfTextExtractor.GetTextFromPage(reader, 1, new LocationTextExtractionStrategy()); + foliofiscal = string.Empty; + CURP = string.Empty; + fechas.RemoveAll(z => true); + lines = text.Split('\n'); + foreach (string linea in lines) + { + foreach (string word in Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(linea)).Split(delimiterChars)) + { + if (word.Length == 36 && (splitword = word.Split('-')).Length == 5 && + splitword[0].Length == 8 && splitword[1].Length == 4 && splitword[2].Length == 4 && + splitword[3].Length == 4 && splitword[4].Length == 12) + { + foliofiscal = word; + } + if (rgxcurp.IsMatch(word)) + { + CURP = word; + } + if (rgxfecha.IsMatch(word)) + { + fechas.Add(word); + } + } + } + + + + reader.Close(); + } + catch (Exception) { } + if (fechas.Count > 2) + { + + xfile.SetAttributeValue("FechaInicio", fechas[2].ToDateTime().ToString("yyyy-MM-dd")); + } + if (fechas.Count > 3) + { + + xfile.SetAttributeValue("FechaFin", fechas[3].ToDateTime().ToString("yyyy-MM-dd")); + } + + xfile.SetAttributeValue("CURP", CURP); + xfile.SetAttributeValue("UUID", foliofiscal); + } + + + xfolder.Add(xfile); + } + xmlarchivos.Add(xfolder); + xmlobject = xmlarchivos.ToString(); + //System.IO.StreamWriter archivoW = null; + //try { archivoW = new System.IO.StreamWriter(string.Format("{0}xml.txt", directorio), true, System.Text.Encoding.UTF8); } catch (Exception) { } + //if (archivoW != null) + //{ + // try { archivoW.WriteLine(xmlobject); } catch (Exception) { } + // try + // { + // archivoW.Close(); + // archivoW.Dispose(); + // } + // catch (Exception) { } + //} + + } + foreach (Archivo obj in litsarchivoxml) + { + System.IO.File.Delete(obj.FileUrl); + } + if (!string.IsNullOrEmpty(xmlobject)) + { + procesararchivo(xmlobject, string.Format("{0}{1}", anio, mes).ToEntero()); + } + Anexoxmlpdf.Text = "[]"; + RegistraScript("showhideprocesarguardar =1; openguardar();"); + Upxmlpdf.Update(); + //RegistraScript("$('#ModalDoctosxmlpdf').modal();"); + } + + + } + public void procesararchivo(string xmlobject, int periodo, bool guardarInformacion = false) + { + + using (ClsEdocumentacion edoc = new ClsEdocumentacion()) + { + if (edoc.materialidadDoctos(xmlobject, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, periodo, guardarInformacion)) + { + if (edoc.DtResultados.Rows.Count > 0) + { + DataRow row = edoc.DtResultados.Rows[0]; + LtlNoDoctos.Text = row["AllFiles"].ToString().ToEntero().ToString("N0"); + LtlOtrosDoctos.Text = row["OTROSFiles"].ToString().ToEntero().ToString("N0"); + LtlNoXml.Text = row["XMLFiles"].ToString().ToEntero().ToString("N0"); + LtlNoPDF.Text = row["PDFFiles"].ToString().ToEntero().ToString("N0"); + + } + pnlinconsistencias.Visible = (edoc.DSResultados.Tables[2].FiltraParametros("CvePersonal IS NULL OR CvePeriodo IS NULL OR PeriodoOk =0").Rows.Count > 0); + if (edoc.DSResultados.Tables.Count > 2) + { + GVmaterialidadDoctos.DataSource = edoc.DSResultados.Tables[2]; + GVmaterialidadDoctos.DataBind(); + } + if (edoc.DSResultados.Tables.Count > 3) + { + GvPersonal.DataSource = edoc.DSResultados.Tables[3].FiltraParametros("CvePersonal IS NULL"); + GvPersonal.DataBind(); + } + if (edoc.DSResultados.Tables.Count > 4) + { + GvPeriodo.DataSource = edoc.DSResultados.Tables[4].FiltraParametros("CvePeriodo IS NULL"); + GvPeriodo.DataBind(); + } + } + Upxmlpdf.Update(); + } + } + + protected void LnkProcesarDoctos_Click(object sender, EventArgs e) + { + + procesararchivo(xmlobject, string.Format("{0}{1}", anio, mes).ToEntero(), true); + //procesararchivo(xmlobject, string.Format("{0}{1}", anio, mes).ToEntero(), false); + } + protected void GVmaterialidadDoctos_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + string toolTip = ""; + int PeriodoOk = e.Row.DataKey("PeriodoOk").ToEntero(); + int cvePersonal = e.Row.DataKey("CvePersonal").ToEntero(); + int CvePeriodo = e.Row.DataKey("CvePeriodo").ToEntero(); + int CveNomina = e.Row.DataKey("CveNomina").ToEntero(); + if (CveNomina > 0) + { + e.Row.CssClass = "info"; + toolTip = string.Format("{0}{1}Nomina registrada.", toolTip, (toolTip.Length > 0 ? " " : "")); + } + if (PeriodoOk <= 0) + { + e.Row.CssClass = "warning"; + toolTip = string.Format("{0}{1}Esta nomina no pertenece a este periodo", toolTip, (toolTip.Length > 0 ? " " : "")); + } + if (cvePersonal <= 0) + { + e.Row.CssClass = "danger"; + toolTip = string.Format("{0}{1}No se encontro el personal", toolTip, (toolTip.Length > 0 ? " " : "")); + } + /* + if (CvePeriodo <= 0) + { + e.Row.CssClass = "danger"; + toolTip = string.Format("{0}{1}No se encontro el periodo", toolTip, (toolTip.Length > 0 ? " " : "")); + }*/ + + e.Row.ToolTip = toolTip; + } + } + protected void btnshowdoc_Click(object sender, EventArgs e) + { + GVdocelect.DataSource = new DataTable(); + GVMaterialidadEnvios.DataSource = new DataTable(); + using (ClsEdocumentacion edoc = new ClsEdocumentacion()) + { + if (edoc.DocumentacionElectronicaGet(-1, -1, -1, UsuarioActual.CveEmpresa, -1, -1, -2, string.Format("{0}{1}", anio, mes).ToEntero())) + { + GVdocelect.DataSource = edoc.DtResultados.FiltraParametros(string.Format("CveDocumentacion ={0}", TxtcveDocumentacion.Text.ToEntero())); + } + if (edoc.Edoc_MaterialidadEnviosGet(-1, TxtcveCliente.Text.ToEntero(), -1, UsuarioActual.CveEmpresa)) + { + + GVMaterialidadEnvios.DataSource = edoc.DtResultados; + } + + } + GVMaterialidadEnvios.DataBind(); + GVdocelect.DataBind(); + RegistraScript("$('#ModalShowDoctos').modal()"); + } + + protected void LnkEliminardocto_Click(object sender, EventArgs e) + { + int CveDocumentacionElectronica = ((GridViewRow)((LinkButton)sender).NamingContainer).DataKey("CveDocumentacionElectronica").ToEntero(); + string Adjunto = ((GridViewRow)((LinkButton)sender).NamingContainer).DataKey("Adjunto"); + using (ClsEdocumentacion edoc = new ClsEdocumentacion()) + { + if (edoc.DocumentacionElectronicaRemove(CveDocumentacionElectronica, -1)) + { + string ruta = string.Format("{0}\\materialidad\\{1}", UsuarioActual.Empresa.Ruta, Adjunto); + if (System.IO.File.Exists(ruta)) + { + try + { + System.IO.File.Delete(ruta); + } + catch (Exception) { } + } + if (edoc.DocumentacionElectronicaGet(-1, -1, -1, UsuarioActual.CveEmpresa, -1, -1, -2, string.Format("{0}{1}", anio, mes).ToEntero())) + { + GVdocelect.DataSource = edoc.DtResultados.FiltraParametros(string.Format("CveDocumentacion ={0}", TxtcveDocumentacion.Text.ToEntero())); + GVdocelect.DataBind(); + } + Alert("El documento se a eliminado"); + } + } + } + + protected void BtnDocumentacionElectronica_Click(object sender, EventArgs e) + { + String Adjunto = TxtCveDocumentacionElectronica.Text; + string ruta = string.Format("{0}\\materialidad\\{1}", UsuarioActual.Empresa.Ruta, Adjunto); + using (ClsEdocumentacion edoc = new ClsEdocumentacion()) + { + if (System.IO.File.Exists(ruta)) + { + + + System.IO.FileInfo file = new System.IO.FileInfo(ruta); + string mimeType = "text/plain"; + try + { + mimeType = MimeMapping.GetMimeMapping(ruta); + } + catch (Exception ex) + { + } + // Response.Write(path) + Response.Clear(); + Response.ClearHeaders(); + Response.ClearContent(); + Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(TxtDoctoName.Text)}"); + Response.AddHeader("Content-Length", file.Length.ToString()); + Response.ContentType = mimeType; + Response.Flush(); + Response.TransmitFile(file.FullName); + Response.End(); + } + else + { + Alert("no se encontro el documento."); + } + + } + } + + protected void Btnenviardocto_Click(object sender, EventArgs e) + { + int periodo = string.Format("{0}{1}", anio, mes).ToEntero(); + DataTable dtdoctos = null; + DataTable dtdocs = null; + string CorreoCumplimiento = string.Empty; + using (ClsEdocumentacion edoc = new ClsEdocumentacion()) + { + if (edoc.TableroMaterialidadGET(UsuarioActual.CveEmpresa, anio, mes) && edoc.DSResultados.Tables.Count > 1) + { + dtdoctos = edoc.DSResultados.Tables[0]; + } + if (edoc.DocumentacionElectronicaGet(-1, -1, -1, UsuarioActual.CveEmpresa, -1, -1, -2, periodo)) + { + dtdocs = edoc.DtResultados.FiltraParametros(string.Format("CveDocumentacionElectronica>0")); + } + DataRow row = null; + foreach (string item in TxtClientescorreo.Text.Split(',')) + { + if (item.ToEntero() > 0 && dtdoctos != null && (row = dtdoctos.FiltroPrimero(string.Format("CveCliente ={0}", item))) != null && dtdocs != null && dtdocs.Rows.Count > 0 && !string.IsNullOrEmpty(CorreoCumplimiento = row["CorreoCumplimiento"].ToString())) + { + edoc.Edoc_MaterialidadEnviosAdd(item.ToEntero(), periodo, dtdocs.Rows.Count, "Envio", CorreoCumplimiento, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa); + } + } + } + Alert("El correo se ha enviado."); + + } + + protected void BtnAgregarDocumento_Click(object sender, EventArgs e) + { + + Txtdocumentacion.Text = ""; + TxtOrden.Text = "1"; + TxtPeriodicidad.Text = "1"; + TxtDiasLimite.Text = "1"; + BtnAgregarDocumentoModal.Text = "Agregar"; + LtlTituloModalDocumentacion.Text = "Agregar documentación"; + DdlDocumentacionTipo.SelectedIndex = 0; + chkEstatus.Checked = true; + chkRequerido.Checked = true; + + ActualizarDocumentacion = false; + UpModalDocumentacion.Update(); + RegistraScript("$('#divAgregarDocumentacion').modal({ backdrop: 'static', keyboard: false});"); + } + + + + protected void BtnAgregarDocumentoModal_Click(object sender, EventArgs e) + { + using (ClsEdocumentacion objRH = new ClsEdocumentacion()) + { + int intCompleto = 0; + int _estatus = 0; + int _requerido = 0; + string _formato = ""; + + + if (chkEstatus.Checked) + _estatus = 1; + + if (chkRequerido.Checked) + _requerido = 1; + + if (ActualizarDocumentacion) + { + //_formato = GuardarArchivo(CveDocumentacion); + if (objRH.DocumentacionUpdate(CveDocumentacion, Txtdocumentacion.Text.Trim(), _formato, DdlDocumentacionTipo.SelectedValue.ToEntero(), _estatus, TxtOrden.Text.ToEntero(), _requerido, TxtDiasLimite.Text.ToEntero(), ChkAplicaDiasLimite.Checked, ChkAplicaFechaVencimiento.Checked, UsuarioActual.Empresa.CveEmpresa, TxtPeriodicidad.Text.ToEntero())) + { + RegistraScript(string.Format("$('#{0}').modal('hide');", "divAgregarDocumentacion")); + Alert("Documento Actualizado correctamente.", ModExtensiones.TipoMensaje.MsgInformacion); + cargadatos(); + } + } + else if (objRH.DocumentacionAdd(Txtdocumentacion.Text.Trim(), _formato, DdlDocumentacionTipo.SelectedValue.ToEntero(), _estatus, TxtOrden.Text.ToEntero(), _requerido, TxtDiasLimite.Text.ToEntero(), ChkAplicaDiasLimite.Checked, ChkAplicaFechaVencimiento.Checked, UsuarioActual.Empresa.CveEmpresa, TxtPeriodicidad.Text.ToEntero())) + { + //CveDocumentacion = objRH.DtResultados(0)(0).ToString.ToEntero; + //_formato = GuardarArchivo(CveDocumentacion); + if (objRH.DocumentacionUpdate(CveDocumentacion, Txtdocumentacion.Text.Trim(), _formato, DdlDocumentacionTipo.SelectedValue.ToEntero(), _estatus, TxtOrden.Text.ToEntero(), _requerido, TxtDiasLimite.Text.ToEntero(), ChkAplicaDiasLimite.Checked, ChkAplicaFechaVencimiento.Checked, UsuarioActual.Empresa.CveEmpresa, TxtPeriodicidad.Text.ToEntero())) + { + } + + RegistraScript(string.Format("$('#{0}').modal('hide');", "divAgregarDocumentacion")); + Alert("Documento agregado correctamente.", ModExtensiones.TipoMensaje.MsgInformacion); + cargadatos(); + } + + ActualizarDocumentacion = false; + + } + + } +public class archivoxmlpdf +{ + string rutaarchivo { get; set; } + string extension { get; set; } + + + string RfcReceptor { get; set; } + string RfcEmisor { get; set; } + string Emisor { get; set; } + string Receptor { get; set; } + decimal SubTotal { get; set; } + decimal Descuento { get; set; } + decimal Total { get; set; } + + + string FechaPago { get; set; } + string periodo { get { return string.Format("", FechaInicialPago, FechaFinalPago); } } + + string FechaInicialPago { get; set; } + string FechaFinalPago { get; set; } + string Curp { get; set; } + int NumDiasPagados { get; set; } + decimal TotalPercepciones { get; set; } + decimal TotalDeducciones { get; set; } + +} +} + +namespace ADSistemaLibrary3.SatXml +{ + public class XmlSatCFDI + { + public XmlSatCFDI() + { + comprobante = new CFDIComprobante(); + emisor = new CFDIEmisor(); + receptor = new CFDIReceptor(); + complemento = new CFDIComplemento(); + cFDIRelacionados = new List(); + conceptos = new List(); + Impuestos = new List(); + } + public CFDIComprobante comprobante; + public CFDIEmisor emisor; + public CFDIReceptor receptor; + public CFDIComplemento complemento; + public List cFDIRelacionados; + public List conceptos; + public List Impuestos; + public List GetConceptosforpdf() + { + List lcon = new List(); + if (conceptos != null) + { + int _orden = 0; + foreach (CFDIConcepto item in conceptos) + { + _orden += 1; + CFDIConcepto_I con = new CFDIConcepto_I + { + tipo = 1, + orden = _orden, + ClaveProdServ = item.ClaveProdServ, + NoIdentificacion = item.NoIdentificacion, + Cantidad = item.Cantidad, + ClaveUnidad = item.ClaveUnidad, + Unidad = item.Unidad, + ValorUnitario = item.ValorUnitario, + Importe = item.Importe, + Descuento = item.Descuento, + NumeroPedimento = item.NumeroPedimento, + CuentaPredial = item.CuentaPredial, + Descripcion = item.Descripcion + }; + int index = 0; + foreach (CFDIConceptoImpuesto Imp in item.Impuestos) + { + index++; + if (index > 1) + { + lcon.Add(con); + con = new CFDIConcepto_I + { + tipo = 2, + orden = _orden, + }; + + } + + con.Impuesto = Imp.ImpuestoTexto; + con.Impuesto_Tipo = Imp.Tipo; + con.Impuesto_Base = Imp.Base; + con.Impuesto_TipoFactor = Imp.TipoFactor; + con.Impuesto_TasaOCuota = Imp.TasaOCuota; + con.Impuesto_Importe = Imp.Importe; + } + lcon.Add(con); + } + } + + return lcon; + } + + public static XmlSatCFDI readXML(string fileUrl) + { + XmlSatCFDI xmlCFDI = new XmlSatCFDI(); + bool canread = true; + //keys + string keyComprobante = "Comprobante"; + string keyCfdiRelacionados = "CfdiRelacionados"; + string keyEmisor = "Emisor"; + string keyReceptor = "Receptor"; + string keyConceptos = "Conceptos"; + string keyImpuestos = "Impuestos"; + string keyComplemento = "Complemento"; + //endkeys + string[] PrimerNivel = new string[] { keyCfdiRelacionados, keyEmisor, keyReceptor, keyConceptos, keyImpuestos, keyComplemento }; + //(canread = xtr.Read()) para evitar ciclos infinitos, todos los .Read() los guardo en la variable Canread y en los while reviso primero esta variable + if (File.Exists(fileUrl)) + { + XmlReaderSettings settings = new XmlReaderSettings(); + settings.ConformanceLevel = ConformanceLevel.Fragment; + settings.IgnoreWhitespace = true; + settings.IgnoreComments = true; + using (XmlReader xtr = XmlReader.Create(fileUrl, settings)) + { + + while ((canread = xtr.Read()) && !(xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("cfdi:", "") == keyComprobante)) + { + //if (xtr.NodeType != XmlNodeType.Element) { while (xtr.Read() && xtr.NodeType != XmlNodeType.Element) { } } + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("cfdi:", "") == keyComprobante) + { + int Nivel = xtr.Depth; + bool cont = xtr.MoveToFirstAttribute(); + while (cont) + { + + 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.Replace("cfdi:", ""))) + { + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("cfdi:", "") == 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.Replace("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.Replace("cfdi:", "") == keyEmisor) + { + + + 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": xmlCFDI.emisor.Rfc = 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.Replace("cfdi:", "") == keyReceptor) + { + int curentNivel = xtr.Depth; + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "RFC": xmlCFDI.receptor.Rfc = xtr.Value; break; + case "NOMBRE": xmlCFDI.receptor.Nombre = 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.Replace("cfdi:", "") == keyConceptos) + { + int cDepth = xtr.Depth; + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepth) + { + if (xtr.Name.Replace("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.Replace("cfdi:", "") == "Impuestos") + { + int cDepthc = xtr.Depth; + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepthc) + { + if (xtr.Name.Replace("cfdi:", "") == "Traslado" || xtr.Name.Replace("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.Replace("cfdi:", "") == "InformacionAduanera") + { + concepto.NumeroPedimento = xtr.GetAttribute("NumeroPedimento"); + rednew = false; while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("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.Replace("cfdi:", "") == keyImpuestos) + { + int cDepth = xtr.Depth; + + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepth) + { + CFDIImpuesto impuest = new CFDIImpuesto(); + if (xtr.Name.Replace("cfdi:", "") == "Traslado" || xtr.Name.Replace("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.Replace("cfdi:", "") == keyComplemento) + { + int cDepth = xtr.Depth; + + bool enterdept = true; + bool noavance = true; + xmlCFDI.complemento.nomina12 = new CFDINomina(); + while (canread && (xtr.Depth > cDepth || enterdept)) + { + enterdept = false; + if (noavance) + { + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + noavance = true; + if (xtr.NodeType == XmlNodeType.Element && xtr.LocalName == "TimbreFiscalDigital" && xmlCFDI.comprobante.Version != null) + { + 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 = xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("SelloCFD") : xtr.GetAttribute("selloCFD"); + xmlCFDI.complemento.NoCertificadoSAT = xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("NoCertificadoSAT") : xtr.GetAttribute("noCertificadoSAT"); + xmlCFDI.complemento.SelloSAT = xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("SelloSAT") : xtr.GetAttribute("selloSAT"); + + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + noavance = false; + } + if (xtr.NodeType == XmlNodeType.Element && xtr.LocalName.ToUpper() == "NOMINA" && xmlCFDI.comprobante.Version != null) + { + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "FECHAPAGO": xmlCFDI.complemento.nomina12.FechaPago = xtr.Value.ToDateTime(); break; + case "FECHAINICIALPAGO": xmlCFDI.complemento.nomina12.FechaInicio = xtr.Value; break; + case "FECHAFINALPAGO": xmlCFDI.complemento.nomina12.FechaFin = xtr.Value; break; + case "NUMDIASPAGADOS": xmlCFDI.complemento.nomina12.NumDiasPagados = xtr.Value.ToEntero(); break; + case "TIPONOMINA": xmlCFDI.complemento.nomina12.TipoNomina = xtr.Value; break; + case "VERSION": xmlCFDI.complemento.nomina12.Version = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + noavance = false; + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == "NOMINA12:RECEPTOR") + { + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "CURP": xmlCFDI.complemento.nomina12.Receptor.CURP = xtr.Value; break; + case "NUMSEGURIDADSOCIAL": xmlCFDI.complemento.nomina12.Receptor.NSS = xtr.Value; break; + case "FECHAINICIORELLABORAL": xmlCFDI.complemento.nomina12.Receptor.FechaInicioContrato = xtr.Value; break; + case "ANTIGÜEDAD": xmlCFDI.complemento.nomina12.Receptor.Antiguedad = xtr.Value; break; + case "TIPOCONTRATO": xmlCFDI.complemento.nomina12.Receptor.TipoContrato = xtr.Value; break; + case "NUMEMPLEADO": xmlCFDI.complemento.nomina12.Receptor.CodigoEmpleado = xtr.Value; break; + case "DEPARTAMENTO": xmlCFDI.complemento.nomina12.Receptor.Departamento = xtr.Value; break; + case "TIPOREGIMEN": xmlCFDI.complemento.nomina12.Receptor.CodigoRegimenContratacion = xtr.Value; break; + case "SINDICALIZADO": xmlCFDI.complemento.nomina12.Receptor.Sindicalizado = xtr.Value; break; + case "TIPOJORNADA": xmlCFDI.complemento.nomina12.Receptor.CodigoTipoJornada = xtr.Value; break; + case "PUESTO": xmlCFDI.complemento.nomina12.Receptor.Puesto = xtr.Value; break; + case "RIESGOPUESTO": xmlCFDI.complemento.nomina12.Receptor.CodigoRiesgoPuesto = xtr.Value; break; + case "SALARIOBASECOTAPOR": xmlCFDI.complemento.nomina12.Receptor.SBC = xtr.Value.ToDouble(); break; + case "SALARIODIARIOINTEGRADO": xmlCFDI.complemento.nomina12.Receptor.SDI = xtr.Value.ToDouble(); break; + case "CLAVEENTFED": xmlCFDI.complemento.nomina12.Receptor.CodigoEntidadFederativa = xtr.Value; break; + case "PERIODICIDADPAGO": xmlCFDI.complemento.nomina12.Receptor.TipoPeriodo = xtr.Value; break; + case "CUENTABANCARIA": xmlCFDI.complemento.nomina12.Receptor.NumeroCuenta = xtr.Value; break; + case "BANCO": xmlCFDI.complemento.nomina12.Receptor.CodigoBanco = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + noavance = false; + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == "NOMINA12:PERCEPCION") + { + if (xmlCFDI.complemento.nomina12.Percepciones == null) + { + xmlCFDI.complemento.nomina12.Percepciones = new List(); + } + CFDINominaPercepciones concepto = new CFDINominaPercepciones(); + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "CLAVE": concepto.Clave = xtr.Value; break; + case "TIPOPERCEPCION": concepto.TipoPercepcion = xtr.Value; break; + case "IMPORTEGRAVADO": concepto.ImporteGravado = xtr.Value.ToDecimal(); break; + case "IMPORTEEXENTO": concepto.ImporteExento = xtr.Value.ToDecimal(); break; + case "CONCEPTO": concepto.Concepto = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xmlCFDI.complemento.nomina12.Percepciones.Add(concepto); + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + noavance = false; + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == "NOMINA12:DEDUCCION") + { + if (xmlCFDI.complemento.nomina12.Deducciones == null) + { + xmlCFDI.complemento.nomina12.Deducciones = new List(); + } + CFDINominaDeducciones concepto = new CFDINominaDeducciones(); + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "CLAVE": concepto.Clave = xtr.Value; break; + case "TIPODEDUCCION": concepto.TipoDeduccion = xtr.Value; break; + case "IMPORTE": concepto.Importe = xtr.Value.ToDecimal(); break; + case "CONCEPTO": concepto.Concepto = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xmlCFDI.complemento.nomina12.Deducciones.Add(concepto); + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + noavance = false; + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == "NOMINA12:OTROPAGO") + { + if (xmlCFDI.complemento.nomina12.OtrosPagos == null) + { + xmlCFDI.complemento.nomina12.OtrosPagos = new List(); + } + CFDINominaOtrosPagos concepto = new CFDINominaOtrosPagos(); + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "CLAVE": concepto.Clave = xtr.Value; break; + case "TIPOOTROPAGO": concepto.TipoOtroPago = xtr.Value; break; + case "IMPORTE": concepto.Importe = xtr.Value.ToDecimal(); break; + case "CONCEPTO": concepto.Concepto = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xmlCFDI.complemento.nomina12.OtrosPagos.Add(concepto); + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + noavance = false; + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == "NOMINA12:SUBSIDIOALEMPLEO") + { + if (xmlCFDI.complemento.nomina12.Deducciones == null) + { + xmlCFDI.complemento.nomina12.Deducciones = new List(); + } + CFDINominaDeducciones concepto = new CFDINominaDeducciones(); + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + concepto.TipoDeduccion = "-000-"; + concepto.Clave = "D025"; + concepto.Concepto = "Subsidio acreditable"; + switch (xtr.Name.ToUpper()) + { + case "SubsidioCausado": concepto.Importe = -xtr.Value.ToDecimal(); break; + } + cont = xtr.MoveToNextAttribute(); + } + CFDINominaDeducciones concepto2 = new CFDINominaDeducciones(); + concepto2.TipoDeduccion = "-001-"; + concepto2.Clave = concepto.Clave; + concepto2.Concepto = concepto.Concepto; + concepto2.Importe = -concepto.Importe; + xmlCFDI.complemento.nomina12.Deducciones.Add(concepto2); + xmlCFDI.complemento.nomina12.Deducciones.Add(concepto); + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + noavance = false; + } + if (xtr.NodeType == XmlNodeType.Element && xtr.LocalName.ToUpper() == "PAGOS" && xmlCFDI.comprobante.Version != null) + { + 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) { } + noavance = false; + } + } + } + } + } + else + { + //si no entro en ninguna de los anteriores no se debe ciclar + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + } + } + + } + } + if (xmlCFDI.comprobante.Version == "3.3" || xmlCFDI.comprobante.Version == "3.2") + { + return xmlCFDI; + } + else + { + return null; + } + } + + public class utilValores + { + public utilValores(string nombre, string valor) + { + Nombre = nombre; + Valor = valor; + } + public string Nombre { get; set; } + public string Valor { get; set; } + } + public class utilImage + { + public utilImage(byte[] imagenByte) + { + ImagenByte = imagenByte; + } + public byte[] ImagenByte { get; set; } + } + } + + public class CFDIComplemento + { + + public string xmlns_tfd { get; set; } + public string xsi_schemaLocation { get; set; } + public string Version { get; set; } + public string UUID { get; set; } + public string FechaTimbrado { get; set; } + public string RfcProvCertif { get; set; } + public string SelloCFD { get; set; } + public string NoCertificadoSAT { get; set; } + public string SelloSAT { get; set; } + public CFDIPago Pagos { get; set; } + public CFDINomina nomina12 { get; set; } + public string CadenaOriginal + { + get + { + return string.Format("||{0}|{1}|{2}|{3}|{4}|{5}||", Version, UUID, FechaTimbrado, RfcProvCertif, SelloCFD, NoCertificadoSAT); + } + } + + } + public class CFDIComprobante + { + public string xmlns_cfdi { get; set; } + public string xmlns_xsi { get; set; } + public string xsi_schemaLocation { get; set; } + public string Version { get; set; } + public string Serie { get; set; } + public string Folio { get; set; } + public string Fecha { get; set; } + public string Moneda { get; set; } + public decimal SubTotal { get; set; } + public decimal Total { get; set; } + public decimal Descuento { get; set; } + public decimal TipoCambio { get; set; } + public string TipoDeComprobante { get; set; } + + public string TipoDeComprobanteSIG + { + get + { + string retorno = ""; + if (Version == "3.3") + { + switch (TipoDeComprobante) + { + case "I": + retorno = "Ing"; + break; + case "E": + retorno = "Egs"; + break; + case "P": + retorno = "PA"; + break; + //case "T": + // retorno = "Traslado"; + // break; + //case "N": + // retorno = "Nómina"; + // break; + + default: + break; + } + } + else if (Version == "3.2") + { + switch (TipoDeComprobante) + { + case "ingreso": + retorno = "Ing"; + break; + case "egreso": + retorno = "Egs"; + break; + case "P": + retorno = "PA"; + break; + //case "T": + // retorno = "Traslado"; + // break; + //case "N": + // retorno = "Nómina"; + // break; + + default: + break; + } + } + else { retorno = TipoDeComprobante; } + return retorno; + } + } + public string TipoDeComprobanteTexto + { + get + { + string retorno = ""; + + if (Version == "3.3") + { + switch (TipoDeComprobante) + { + case "I": + retorno = "Ingreso"; + break; + case "E": + retorno = "Egreso"; + break; + case "P": + retorno = "Pago"; + break; + case "T": + retorno = "Traslado"; + break; + case "N": + retorno = "Nómina"; + break; + + default: + retorno = TipoDeComprobante; + break; + } + } + else if (Version == "3.2") + { + switch (TipoDeComprobante) + { + case "ingreso": + retorno = "Ing"; + break; + case "egreso": + retorno = "Egs"; + break; + case "P": + retorno = "PA"; + break; + //case "T": + // retorno = "Traslado"; + // break; + //case "N": + // retorno = "Nómina"; + // break; + + default: + retorno = TipoDeComprobante; + break; + } + } + else { retorno = TipoDeComprobante; } + return retorno; + } + } + public string FormaPago { get; set; } + + public string FormaPagoTexto + { + get + { + string retorno = ""; + + switch (FormaPago) + { + case "01": retorno = "Efectivo"; break; + case "02": retorno = "Cheque nominativo"; break; + case "03": retorno = "Transferencia electrónica de fondos"; break; + case "04": retorno = "Tarjeta de crédito"; break; + case "05": retorno = "Monedero electrónico"; break; + case "06": retorno = "Dinero electrónico"; break; + case "08": retorno = "Vales de despensa"; break; + case "12": retorno = "Dación en pago"; break; + case "13": retorno = "Pago por subrogación"; break; + case "14": retorno = "Pago por consignación"; break; + case "15": retorno = "Condonación"; break; + case "17": retorno = "Compensación"; break; + case "23": retorno = "Novación"; break; + case "24": retorno = "Confusión"; break; + case "25": retorno = "Remisión de deuda"; break; + case "26": retorno = "Prescripción o caducidad"; break; + case "27": retorno = "A satisfacción del acreedor"; break; + case "28": retorno = "Tarjeta de débito"; break; + case "29": retorno = "Tarjeta de servicios"; break; + case "30": retorno = "Aplicación de anticipos"; break; + case "31": retorno = "Intermediario pagos"; break; + case "99": retorno = "Por definir"; break; + default: retorno = FormaPago; break; + } + return retorno; + } + } + public string MetodoPago { get; set; } + public string MetodoPagoTexto + { + get + { + string retorno = ""; + + switch (MetodoPago) + { + case "PUE": retorno = "Pago en una sola exhibición"; break; + case "PPD": retorno = "Pago en parcialidades o diferido"; break; + default: retorno = MetodoPago; break; + } + return retorno; + } + } + public string CondicionesDePago { get; set; } + public string LugarExpedicion { get; set; } + public string Confirmacion { get; set; } + public string NoCertificado { get; set; } + public string Sello { get; set; } + public string Certificado { get; set; } + + } + + public class CFDIConcepto + { + public CFDIConcepto() + { + Impuestos = new List(); + } + public string ClaveProdServ { get; set; } + public string NoIdentificacion { get; set; } + public string Cantidad { get; set; } + public string ClaveUnidad { get; set; } + public string Unidad { get; set; } + public decimal ValorUnitario { get; set; } + public decimal Importe { get; set; } + public decimal Descuento { get; set; } + public string NumeroPedimento { get; set; } + public string CuentaPredial { get; set; } + public string Descripcion { get; set; } + public List Impuestos { get; set; } + } + + public class CFDIConcepto_I + { + public int tipo { get; set; } + public int orden { get; set; } + public string ClaveProdServ { get; set; } + public string NoIdentificacion { get; set; } + public string Cantidad { get; set; } + public string ClaveUnidad { get; set; } + public string Unidad { get; set; } + public decimal ValorUnitario { get; set; } + public decimal Importe { get; set; } + public decimal Descuento { get; set; } + public string NumeroPedimento { get; set; } + public string CuentaPredial { get; set; } + public string Descripcion { get; set; } + + + public string Impuesto { get; set; } + + public string Impuesto_Tipo { get; set; } + public decimal Impuesto_Base { get; set; } + public string Impuesto_TipoFactor { get; set; } + public string Impuesto_TasaOCuota { get; set; } + public decimal Impuesto_Importe { get; set; } + } + + public class CFDIConceptoImpuesto + { + public string Impuesto { get; set; } + public string ImpuestoTexto + { + get + { + string retorno = ""; + + switch (Impuesto) + { + case "001": retorno = "ISR"; break; + case "002": retorno = "IVA"; break; + case "003": retorno = "IEPS"; break; + } + return retorno; + } + } + public string Tipo { get; set; } + public decimal Base { get; set; } + public string TipoFactor { get; set; } + public string TasaOCuota { get; set; } + public decimal Importe { get; set; } + + } + + public class CFDIEmisor + { + public string RegimenFiscal { get; set; } + + public string RegimenFiscalTexto + { + get + { + string retorno = ""; + + switch (RegimenFiscal) + { + case "601": retorno = "General de Ley Personas Morales"; break; + case "603": retorno = "Personas Morales con Fines no Lucrativos"; break; + case "605": retorno = "Sueldos y Salarios e Ingresos Asimilados a Salarios"; break; + case "606": retorno = "Arrendamiento"; break; + case "608": retorno = "Demás ingresos"; break; + case "609": retorno = "Consolidación"; break; + case "610": retorno = "Residentes en el Extranjero sin Establecimiento Permanente en México"; break; + case "611": retorno = "Ingresos por Dividendos (socios y accionistas)"; break; + case "612": retorno = "Personas Físicas con Actividades Empresariales y Profesionales"; break; + case "614": retorno = "Ingresos por intereses"; break; + case "616": retorno = "Sin obligaciones fiscales"; break; + case "620": retorno = "Sociedades Cooperativas de Producción que optan por diferir sus ingresos"; break; + case "621": retorno = "Incorporación Fiscal"; break; + case "622": retorno = "Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras"; break; + case "623": retorno = "Opcional para Grupos de Sociedades"; break; + case "624": retorno = "Coordinados"; break; + case "628": retorno = "Hidrocarburos"; break; + case "607": retorno = "Régimen de Enajenación o Adquisición de Bienes"; break; + case "629": retorno = "De los Regímenes Fiscales Preferentes y de las Empresas Multinacionales"; break; + case "630": retorno = "Enajenación de acciones en bolsa de valores"; break; + case "615": retorno = "Régimen de los ingresos por obtención de premios"; break; + + } + return retorno; + } + } + public string Nombre { get; set; } + public string Rfc { get; set; } + + } + + public class CFDIImpuesto + { + public string Tipo { get; set; } + public string Impuesto { get; set; } + public string ImpuestoTexto + { + get + { + string retorno = ""; + + switch (Impuesto) + { + case "001": retorno = "ISR"; break; + case "002": retorno = "IVA"; break; + case "003": retorno = "IEPS"; break; + } + return retorno; + } + } + public string TipoFactor { get; set; } + public string TasaOCuota { get; set; } + public decimal Importe { get; set; } + } + + public class CFDIPago + { + public CFDIPago() + { + doctosRelacionados = new List(); + } + public string FechaPago { get; set; } + public string FormaDePagoP { get; set; } + public string FormaDePagoPText { get; set; } + public string MonedaP { get; set; } + public decimal Monto { get; set; } + public decimal TipoCambioP { get; set; } + public string NumOperacion { get; set; } + public string NomBancoOrdExt { get; set; } + public string RfcEmisorCtaOrd { get; set; } + public string CtaOrdenante { get; set; } + public string RfcEmisorCtaBen { get; set; } + public string CtaBeneficiario { get; set; } + public List doctosRelacionados { get; set; } + } + + public class CFDIPagoDoctoRelacionado + { + public string IdDocumento { get; set; } + public string Serie { get; set; } + public string Folio { get; set; } + public string MonedaDR { get; set; } + public string MetodoDePagoDR { get; set; } + public string NumParcialidad { get; set; } + public decimal ImpSaldoAnt { get; set; } + public decimal ImpPagado { get; set; } + public decimal ImpSaldoInsoluto { get; set; } + } + + public class CFDIReceptor + { + public string Rfc { get; set; } + public string Nombre { get; set; } + public string ResidenciaFiscal { get; set; } + public string NumRegIdTrib { get; set; } + public string UsoCFDI { get; set; } + public string UsoCFDITexto + { + get + { + string retorno = "N/A"; + + switch (UsoCFDI) + { + case "G01": + retorno = "Adquisición de mercancías"; + break; + case "G02": + retorno = "Devoluciones, descuentos o bonificaciones"; + break; + case "G03": + retorno = "Gastos en general"; + break; + case "I01": + retorno = "Construcciones"; + break; + case "I02": + retorno = "Mobiliario y equipo de oficina por inversiones"; + break; + case "I03": + retorno = "Equipo de transporte"; + break; + case "I04": + retorno = "Equipo de cómputo y accesorios"; + break; + case "I05": + retorno = "Dados, troqueles, moldes, matrices y herramental"; + break; + case "I06": + retorno = "Comunicaciones telefónicas"; + break; + case "I07": + retorno = "Comunicaciones satelitales"; + break; + case "I08": + retorno = "Otra maquinaria y equipo"; + break; + case "D01": + retorno = "Honorarios médicos, dentales y gastos hospitalarios."; + break; + case "D02": + retorno = "Gastos médicos por incapacidad o discapacidad"; + break; + case "D03": + retorno = "Gastos funerales."; + break; + case "D04": + retorno = "Donativos."; + break; + case "D05": + retorno = "Intereses reales efectivamente pagados por créditos hipotecarios (casa habitación)."; + break; + case "D06": + retorno = "Aportaciones voluntarias al SAR."; + break; + case "D07": + retorno = "Primas por seguros de gastos médicos."; + break; + case "D08": + retorno = "Gastos de transportación escolar obligatoria."; + break; + case "D09": + retorno = "Depósitos en cuentas para el ahorro, primas que tengan como base planes de pensiones."; + break; + case "D10": + retorno = "Pagos por servicios educativos (colegiaturas)"; + break; + case "P01": + retorno = "Por definir"; + break; + + default: + break; + } + return retorno; + } + } + + } + + public class CFDIRelacionado + { + public string TipoRelacion { get; set; } + public string TipoRelacionTexto + { + + get + { + string retorno; + + switch (TipoRelacion) + { + case "01": retorno = "Nota de crédito de los documentos relacionados"; break; + case "02": retorno = "Nota de débito de los documentos relacionados"; break; + case "03": retorno = "Devolución de mercancía sobre facturas o traslados previos"; break; + case "04": retorno = "Sustitución de los CFDI previos"; break; + case "05": retorno = "Traslados de mercancias facturados previamente"; break; + case "06": retorno = "Factura generada por los traslados previos"; break; + case "07": retorno = "CFDI por aplicación de anticipo"; break; + default: + retorno = "Por definir"; + break; + } + return retorno; + } + } + public string UUID { get; set; } } } \ No newline at end of file diff --git a/Documentacion/TableroMaterialidad2.aspx.cs b/Documentacion/TableroMaterialidad2.aspx.cs index e61923b6b..529d8ac71 100644 --- a/Documentacion/TableroMaterialidad2.aspx.cs +++ b/Documentacion/TableroMaterialidad2.aspx.cs @@ -118,6 +118,17 @@ public partial class Documentacion_TableroMaterialidad2 : ClsPaginas } + protected void BtnConsultar_Click(object sender, EventArgs e) + { + cargadatos(); + } + + protected void BtnEnviarDoctos_Click(object sender, EventArgs e) + { + Alert("El correo se ha enviado."); + } + + protected void BtnAddClienteDocumento_Click(object sender, EventArgs e) { @@ -153,17 +164,6 @@ public partial class Documentacion_TableroMaterialidad2 : ClsPaginas } - protected void BtnEnviarDoctos_Click(object sender, EventArgs e) - { - Alert("El correo se ha enviado."); - } - - protected void BtnConsultar_Click(object sender, EventArgs e) - { - cargadatos(); - } - - protected void LckOpModalDoctos_Click(object sender, EventArgs e) { DateTime fecha = string.Format("{0}-{1}-01", anio, mes).ToDateTime(); @@ -214,7 +214,7 @@ public partial class Documentacion_TableroMaterialidad2 : ClsPaginas xfile.SetAttributeValue("EXT", Path.GetExtension(urfile).ToLower()); if (Path.GetExtension(urfile).ToLower() == ".xml") { - var xmlobj = ADSistemaLibrary3.SatXml.XmlSatCFDI.readXML(urfile); + var xmlobj = ADSistemaLibrary43.SatXml.XmlSatCFDI.readXML(urfile); xfile.SetAttributeValue("UUID", xmlobj.complemento.UUID); xfile.SetAttributeValue("Receptor", xmlobj.receptor.Nombre); @@ -421,7 +421,7 @@ public partial class Documentacion_TableroMaterialidad2 : ClsPaginas { procesararchivo(xmlobject, string.Format("{0}{1}", anio, mes).ToEntero(), true); - procesararchivo(xmlobject, string.Format("{0}{1}", anio, mes).ToEntero(), false); + //procesararchivo(xmlobject, string.Format("{0}{1}", anio, mes).ToEntero(), false); } protected void GVmaterialidadDoctos_RowDataBound(object sender, GridViewRowEventArgs e) { @@ -665,7 +665,7 @@ public class archivoxmlpdf } -namespace ADSistemaLibrary3.SatXml +namespace ADSistemaLibrary43.SatXml { public class XmlSatCFDI { diff --git a/Nomina/Nomina.aspx b/Nomina/Nomina.aspx index 13bcf21a4..88f86d330 100644 --- a/Nomina/Nomina.aspx +++ b/Nomina/Nomina.aspx @@ -954,11 +954,7 @@ - - - - - + @@ -1066,11 +1062,173 @@
    +
    -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%--
    @@ -1129,7 +1287,7 @@
    -
    +
    --%>
    @@ -2491,6 +2649,100 @@ + + + + + + + +
    +
    +
    + + Agregar +
    +
    + + +
    +
    + +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    + + + + + + + + + + + + + + + + + + <%-- + + + + --%> + + + + + + + +
    +
    +
    +
    @@ -2675,7 +2927,7 @@
    - + @@ -2702,6 +2954,7 @@
    + Valor
    diff --git a/Nomina/Nomina.aspx.cs b/Nomina/Nomina.aspx.cs index f6f1b0368..77fb867dc 100644 --- a/Nomina/Nomina.aspx.cs +++ b/Nomina/Nomina.aspx.cs @@ -1298,8 +1298,8 @@ public partial class Nomina_Nomina2 : ClsPaginas { CveMotivoCancelacion = rowc["CveSATMotivoCancelacion"].ToString().ToEntero(); } - - if (ObjTimbrado.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, RFCEmisor, 4, CveSATMotivoCancelacion: CveMotivoCancelacion))//,CveSATMotivoCancelacion:= + var reultado = ObjTimbrado.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, RFCEmisor, 4, CveSATMotivoCancelacion: CveMotivoCancelacion); + if (true)//,CveSATMotivoCancelacion:= { try { @@ -1685,6 +1685,16 @@ public partial class Nomina_Nomina2 : ClsPaginas #region SobreRecibo propiedades + protected int CveFonacot + { + get + { + if (ViewState["CveFonacot"] == null) { return 0; } + else { return ViewState["CveFonacot"].ToString().ToEntero(); } + } + + set { ViewState["CveFonacot"] = value; } + } protected int SRCvePersonal { get @@ -1837,12 +1847,13 @@ public partial class Nomina_Nomina2 : ClsPaginas using (ClsRH objpersonal = new ClsRH()) { - - if (objpersonal.GetAsistencias(SRCvePersonal, -1, -1, -1, -1,-1, FechaInicioPeriodo, FechaFinPeriodo, UsuarioActual.CveEmpresa)) + + if (objpersonal.GetAsistencias(SRCvePersonal, -1, -1, -1, -1, -1, FechaInicioPeriodo, FechaFinPeriodo, UsuarioActual.CveEmpresa)) { GVAsistencia.DataSource = objpersonal.DtResultados.FiltraParametros("Fecha IS NOT NULL"); } - else{ + else + { GVAsistencia.DataSource = null; - } + } } GVAsistencia.DataBind(); } @@ -1888,7 +1899,7 @@ public partial class Nomina_Nomina2 : ClsPaginas bool continuar = false; using (ClsRH ObjPersonal = new ClsRH()) { - if (ObjPersonal.AddAsistencia(SRCvePersonal, -2, -2, TxtFechaAsistencia.Text.Trim().ToDate(), + if (ObjPersonal.AddAsistencia(SRCvePersonal, -2, -2, TxtFechaAsistencia.Text.Trim().ToDate(), DdlTipoAsistenciasB.SelectedValue.ToEntero(), TxtPorPago.Text.Trim().ToDouble(), TxtHorasDobles.Text.Trim().ToDouble(), TxtHorasTriples.Text.Trim().ToDouble(), DdlMotivoHoraExtra.SelectedValue.ToEntero(), TxtObservaciones.Text.Trim(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) { @@ -1915,11 +1926,11 @@ public partial class Nomina_Nomina2 : ClsPaginas foreach (GridViewRow Row in GVAsistencia.Rows) { - if (!ObjPersonal.AddAsistencia(SRCvePersonal, -2,-2, Row.FCLiteral("LtlFecha").Text.Trim().ToDate(), - Row.FCDropDownList("DdlTipoAsistencias").SelectedValue.ToEntero(), - Row.FCTextBox("TxtPorPago").Text.Trim().ToDouble(), - Row.FCTextBox("TxtHorasDobles").Text.Trim().ToDouble(), Row.FCTextBox("TxtHorasTriples").Text.Trim().ToDouble(), - Row.FCDropDownList("DdlMotivoHoraExtra").SelectedValue.ToEntero(), Row.FCTextBox("TxtObservaciones").Text.Trim(), + if (!ObjPersonal.AddAsistencia(SRCvePersonal, -2, -2, Row.FCLiteral("LtlFecha").Text.Trim().ToDate(), + Row.FCDropDownList("DdlTipoAsistencias").SelectedValue.ToEntero(), + Row.FCTextBox("TxtPorPago").Text.Trim().ToDouble(), + Row.FCTextBox("TxtHorasDobles").Text.Trim().ToDouble(), Row.FCTextBox("TxtHorasTriples").Text.Trim().ToDouble(), + Row.FCDropDownList("DdlMotivoHoraExtra").SelectedValue.ToEntero(), Row.FCTextBox("TxtObservaciones").Text.Trim(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) { OcurrioError = true; @@ -1956,7 +1967,7 @@ public partial class Nomina_Nomina2 : ClsPaginas e.Row.Cells[3].HorizontalAlign = HorizontalAlign.Left; //if ((e.Row.DBCampo("Fecha"))) - e.Row.FCLiteral("LtlFecha").Text = e.Row.DBCampo("Fecha").ToDate().ToShortDateString(); + e.Row.FCLiteral("LtlFecha").Text = e.Row.DBCampo("Fecha").ToDate().ToShortDateString(); if (e.Row.FCLiteral("LtlCliente").Text != "N/A") e.Row.FCLiteral("LtlCliente").Text = "" + e.Row.DBCampo("Cliente") + ""; e.Row.FCTextBox("TxtPorPago").Text = e.Row.DBCampo("PorcentajePago"); @@ -2663,6 +2674,12 @@ public partial class Nomina_Nomina2 : ClsPaginas TxtmcImporteGrabado.Text = string.Format("{0:N2}", drow["ImporteGravado"]); Txtmcvalor.Text = string.Format("{0:N2}", drow["Valor"]); } + else + { + ChkCalAutomaticoV.Checked = true; + ChkCalAutomaticoG.Checked = true; + + } } else { @@ -2864,6 +2881,7 @@ public partial class Nomina_Nomina2 : ClsPaginas #endregion cargasobrericiboconceptos(); + CargaFonacot(); #region "Infonavit" { using (ClsRH objper = new ClsRH()) @@ -2891,24 +2909,24 @@ public partial class Nomina_Nomina2 : ClsPaginas - frow = objper.DtResultados.FiltroPrimero("CveSistema =4"); - TxtFonValor.Text = ""; - DdlFonTipoAplicacion.SelectedValueExist("-1"); - TxtFonDescripcion.Text = ""; - TxtFonNumCredito.Text = ""; - TxtFonFechaInicio.Text = ""; - ChkFonacot.Checked = false; - if (frow != null) - { + //frow = objper.DtResultados.FiltroPrimero("CveSistema =4"); + //TxtFonValor.Text = ""; + //DdlFonTipoAplicacion.SelectedValueExist("-1"); + //TxtFonDescripcion.Text = ""; + //TxtFonNumCredito.Text = ""; + //TxtFonFechaInicio.Text = ""; + //ChkFonacot.Checked = false; + //if (frow != null) + //{ - TxtFonValor.Text = String.Format("{0:###,###.##}", frow["Importe"]); - DdlFonTipoAplicacion.SelectedValueExist(frow["TipoAplicacion"].ToString()); + // TxtFonValor.Text = String.Format("{0:###,###.##}", frow["Importe"]); + // DdlFonTipoAplicacion.SelectedValueExist(frow["TipoAplicacion"].ToString()); - TxtFonDescripcion.Text = String.Format("{0}", frow["Descripcion02"]); - TxtFonNumCredito.Text = String.Format("{0}", frow["Descripcion01"]); - TxtFonFechaInicio.Text = String.Format("{0:dd/MM/yyyy}", frow["FInicioAplicacion"]); - ChkFonacot.Checked = frow["estatus"].ToString().ToUpper().Contiene("1", "TRUE"); - } + // TxtFonDescripcion.Text = String.Format("{0}", frow["Descripcion02"]); + // TxtFonNumCredito.Text = String.Format("{0}", frow["Descripcion01"]); + // TxtFonFechaInicio.Text = String.Format("{0:dd/MM/yyyy}", frow["FInicioAplicacion"]); + // ChkFonacot.Checked = frow["estatus"].ToString().ToUpper().Contiene("1", "TRUE"); + //} } } @@ -2916,6 +2934,129 @@ public partial class Nomina_Nomina2 : ClsPaginas UpModalConceptos.Update(); } + + #region fonacot + + public void LimpiarFonacot() + { + TxtFonValor.Text = ""; + TxtFonImporteCredito.Text = ""; + TxtFonPagosHechos.Text = ""; + DdlFonTipoAplicacion.SelectedValueExist("-1"); + TxtFonDescripcion.Text = ""; + TxtFonNumCredito.Text = ""; + TxtFonFechaInicio.Text = ""; + ChkFonacot.Checked = false; + } + protected void CargaFonacot() + { + using (ClsNominas onom = new ClsNominas()) + { + onom.NomFonacotGet(UsuarioActual.CveEmpresa, -1, SRCvePersonal); + GVNomFonacot.DataSource = onom.DtResultados; + GVNomFonacot.DataBind(); + } + UpFonacotGrid.Update(); + } + + protected void LnAddFonacot_Click(object sender, EventArgs e) + { + LimpiarFonacot(); + CveFonacot = -1; + RegistraScript("$('#ModalFonacot').modal();"); + } + protected void LnkEditarNomFonacot_Click(object sender, EventArgs e) + { + GridViewRow gvrow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveFonacot = gvrow.DataKey("CveFonacot").ToEntero(); + Int32 cvePersonal = gvrow.DataKey("CvePersonal").ToEntero(); + string numeroCredito = gvrow.DataKey("NumeroCredito"); + string descripcion = gvrow.DataKey("Descripcion"); + Int32 periodo = gvrow.DataKey("Periodo").ToEntero(); + Int32 cveTipoCalculo = gvrow.DataKey("CveTipoCalculo").ToEntero(); + decimal importeCredito = gvrow.DataKey("ImporteCredito").ToDecimal(); + decimal importeFijo = gvrow.DataKey("ImporteFijo").ToDecimal(); + decimal pagosHechos = gvrow.DataKey("PagosHechos").ToDecimal(); + decimal montoAcumulado = gvrow.DataKey("MontoAcumulado").ToDecimal(); + decimal saldo = gvrow.DataKey("Saldo").ToDecimal(); + Int32 cveEstatus = gvrow.DataKey("CveEstatus").ToEntero(); + string observaciones = gvrow.DataKey("Observaciones"); + if ((periodo < 10000000)) + periodo = 20000101; + LimpiarFonacot(); + + TxtFonValor.Text = importeFijo.ToString(); + TxtFonImporteCredito.Text = importeCredito.ToString(); + TxtFonPagosHechos.Text = pagosHechos.ToString(); + DdlFonTipoAplicacion.SelectedValueExist(cveTipoCalculo.ToString()); + TxtFonDescripcion.Text = descripcion; + TxtFonNumCredito.Text = numeroCredito; + TxtFonFechaInicio.Text = string.Format("{2}/{1}/{0}", periodo.ToString().Substring(0, 4), periodo.ToString().Substring(4, 2), periodo.ToString().Substring(6, 2)); + ChkFonacot.Checked = (cveEstatus == 1); + UpModalFonacot.Update(); + RegistraScript("$('#ModalFonacot').modal();"); + } + + protected void LnkEliminarNomFonacot_Click(object sender, EventArgs e) + { + GridViewRow gvrow = (GridViewRow)(((LinkButton)sender).NamingContainer); + + int cveFonacot = gvrow.DataKey("CveFonacot").ToEntero(); + bool Continuar = false; + using (ClsNominas onom = new ClsNominas()) + { + Continuar = onom.NomFonacotRemove(UsuarioActual.CveEmpresa, cveFonacot); + } + if ((Continuar)) + { + CargaFonacot(); + Alert("El registro fonacot se ha eliminado"); + } + } + protected void LnkGuardarFonacot_Click(object sender, EventArgs e) + { + decimal importe = TxtFonValor.Text.ToDecimal(); + decimal importeTotal = TxtFonImporteCredito.Text.ToDecimal(); + decimal importePagado = TxtFonPagosHechos.Text.ToDecimal(); + int TipoAplicacion = DdlFonTipoAplicacion.SelectedValue.ToEntero(); + int NoPagos = 0; + double SaldoIni = 0; + string descripcion02 = TxtFonDescripcion.Text; + string NumCredito = TxtFonNumCredito.Text; + string fecha = TxtFonFechaInicio.Text.Replace("_", ""); + int estatus = ChkFonacot.Checked ? 1 : 0; + int periodo = 20000101; + if (fecha.Length > 8) + { + fecha = fecha.ToDateTime().ToString("yyyy/MM/dd"); + periodo = fecha.ToDateTime().ToString("yyyyMMdd").ToEntero(); + } + else + fecha = ""; + + bool continuar = false; + using (ClsNominas onom = new ClsNominas()) + { + if ((CveFonacot == -1)) + continuar = onom.NomFonacotAdd(UsuarioActual.CveEmpresa, SRCvePersonal, NumCredito, descripcion02, periodo, TipoAplicacion, importeTotal, importe, importePagado, 0, 0, estatus, "", UsuarioActual.CveUsuario); + else + continuar = onom.NomFonacotUp(UsuarioActual.CveEmpresa, CveFonacot, SRCvePersonal, NumCredito, descripcion02, periodo, TipoAplicacion, importeTotal, importe, importePagado, 0, 0, estatus, "", UsuarioActual.CveUsuario); + } + // Old Borrar Caudillo 01/Marzo/2022 + // Using ObjPersonal As ClsRH = New ClsRH() + // If Not ObjPersonal.AddConcepto(CvePersonal, -1, importe, TipoAplicacion, NoPagos, SaldoIni, UsuarioActual.CveUsuario, 4, NumCredito, descripcion02, fecha, "", estatus, UsuarioActual.CveEmpresa) Then continuar = False + // End Using + + if (continuar) + { + Alert("Se actualizo el calculo de fonacot"); + CargaFonacot(); + RegistraScript("$('#ModalFonacot').modal('hide');"); + } + } + + #endregion + public void cargasobrericiboconceptos() { @@ -3843,7 +3984,7 @@ public partial class Nomina_Nomina2 : ClsPaginas public void loadtablas() { - + CargaVacacionesEmpresas(); using (ClsNominas objnom = new ClsNominas()) { if (objnom.GetTablasNomina(UsuarioActual.CveEmpresa) && objnom.DTSetResultados.Tables.Count > 1) @@ -4035,7 +4176,7 @@ public partial class Nomina_Nomina2 : ClsPaginas string strTipo = ""; string strPeriodoNum = ""; string strUbicacion = string.Format("{0}, {1}, {2}, {3}, C.P. {4}", UsuarioActual.Empresa.Direccion, UsuarioActual.Empresa.Colonia, UsuarioActual.Empresa.Ciudad, UsuarioActual.Empresa.Estado, UsuarioActual.Empresa.CP).ToLower(); - string strRegPatImss = UsuarioActual.Empresa.RegistroPatronal; + string strRegPatImss = "";// objPersonal.DtResultados.Rows(0)("RegistroPatronal").ToString(); string strRFC = UsuarioActual.Empresa.RFC; string strfecha = DateTime.Now.ToString("dd/MMM/yyyy", System.Globalization.CultureInfo.CreateSpecificCulture("es-MX")); string strhora = DateTime.Now.ToString("HH:mm:ss", System.Globalization.CultureInfo.CreateSpecificCulture("es-MX")); @@ -5553,35 +5694,7 @@ public partial class Nomina_Nomina2 : ClsPaginas UpMovtosPermanentes.Update(); } #endregion - - protected void LnkGuardarFonacot_Click(object sender, EventArgs e) - { - double importe = TxtFonValor.Text.ToDouble(); - int TipoAplicacion = DdlFonTipoAplicacion.SelectedValue.ToEntero(); - int NoPagos = 0; - double SaldoIni = 0; - string descripcion02 = TxtFonDescripcion.Text; - string descripcion01 = TxtFonNumCredito.Text; - string fecha = TxtFonFechaInicio.Text.Replace("_", ""); - int estatus = ChkFonacot.Checked ? 1 : 0; - if (fecha.Length > 8) - fecha = fecha.ToDateTime().ToString("yyyy/MM/dd"); - else - fecha = ""; - bool continuar = true; - using (ClsRH ObjPersonal = new ClsRH()) - { - if (!ObjPersonal.AddConcepto(SRCvePersonal, -1, importe, TipoAplicacion, NoPagos, SaldoIni, UsuarioActual.CveUsuario, 4, descripcion01, descripcion02, fecha, "", estatus, UsuarioActual.CveEmpresa)) - continuar = false; - } - if (continuar) - { - LnkConsultar_Click(null, null); - mostrarConceptos(); - Alert("Se actualizo el calculo de fonacot"); - } - - } + protected void LnkAutorizar_Click(object sender, EventArgs e) { @@ -7844,7 +7957,8 @@ public partial class Nomina_Nomina2 : ClsPaginas decimal Total = TxtTotal.Text.ToDecimal(); string RFCReceptor = TxtRFCReceptor.Text; string RFCEmisor = TxtRFCEmisor.Text; - if (ObjTimbrado.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, RFCEmisor, 4)) + var resultado = ObjTimbrado.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, RFCEmisor, 4); + if (true) { Alert($"La nómina con folio fiscal '{FolioFiscal}' fue cancelada ante el SAT", TipoMensaje.MsgInformacion); } @@ -7957,6 +8071,55 @@ public partial class Nomina_Nomina2 : ClsPaginas } + protected void CargaVacacionesEmpresas() + { + using (ClsRH ObjVaca = new ClsRH()) + { + ObjVaca.VacacionesEmpresasGet(UsuarioActual.CveEmpresa, -1, -1); + GVVacacionesEmpresas.DataSource = ObjVaca.DtResultados; + ObjVaca.Dispose(); + } + GVVacacionesEmpresas.DataBind(); + upDatosVacaEmpre.Update(); + } + protected void BtnVacaADD_Click(object sender, EventArgs e) + { + + int diasVacaciones = TxtVacadiasVacaciones.Text.ToEntero(); + int Cinicio = TxtVacaInicio.Text.ToEntero(); + int Cfin = TxtVacaFin.Text.ToEntero(); + bool Continuar = false; + using (ClsRH ObjVaca = new ClsRH()) + { + + Continuar = ObjVaca.VacacionesEmpresasAdd(UsuarioActual.CveEmpresa, Cinicio, Cfin, diasVacaciones); + } + if (Continuar) + { + this.RegistraScript("$('#DModalVacacionesEmpresas').modal('hide');"); + CargaVacacionesEmpresas(); + upDatosVacaEmpre.Update(); + this.Alert("El Vacaciones_Empresas Se ha agregado"); + } + } + + protected void LnkEliminarVaca_Click(object sender, EventArgs e) + { + GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + int CcveEmpresa = gvRow.DataKey("CveEmpresa").ToEntero(); + int Cinicio = gvRow.DataKey("Inicio").ToEntero(); + int Cfin = gvRow.DataKey("Fin").ToEntero(); + bool Continuar = false; + using (ClsRH ObjVaca = new ClsRH()) + { + Continuar = ObjVaca.VacacionesEmpresasRemove(CcveEmpresa, Cinicio, Cfin); + } + if (Continuar) + { + CargaVacacionesEmpresas(); + this.Alert("El Vacaciones_Empresas Se ha Eliminado"); + } + } } diff --git a/RH/Personal.aspx b/RH/Personal.aspx index acf815e4d..a866ce7fe 100644 --- a/RH/Personal.aspx +++ b/RH/Personal.aspx @@ -1459,8 +1459,7 @@
    - - + <%----%> @@ -1672,13 +1671,13 @@
    -
    +
    -
    +
    @@ -1686,7 +1685,7 @@
    -
    +
    @@ -1699,7 +1698,7 @@
    -
    +
    @@ -1707,7 +1706,7 @@
    -
    +
    @@ -1721,12 +1720,12 @@
    -
    +
    -
    +
    @@ -1745,68 +1744,172 @@
    - +
    -
    -
    -
    - - -
    -
    -
    -
    - - -
    -
    -
    -
    -
    -
    - - - - - - -
    -
    -
    -
    - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -
    -
    -
    - - - - - -
    -
    - - - -
    -
    -
    -
    - -
    -
    -
    - -
    -
    + +
    @@ -1936,43 +2039,43 @@ <%----%> - - - - - - - - - - @@ -4005,8 +4108,8 @@ Agregar--%> -
    -
    +
    +
    diff --git a/RH/Personal.aspx.vb b/RH/Personal.aspx.vb index f9d095166..a95d6d4cd 100644 --- a/RH/Personal.aspx.vb +++ b/RH/Personal.aspx.vb @@ -16,6 +16,18 @@ Partial Class RH_Personal #Region "P R O P I E D A D E S" + Property CveFonacot As Integer + Get + If ViewState("CveFonacot") Is Nothing Then + Return -1 + Else + Return DirectCast(ViewState("CveFonacot"), Integer) + End If + End Get + Set(value As Integer) + ViewState("CveFonacot") = value + End Set + End Property Private Property DTCuentasBancos As DataTable Get Return CType(ViewState("DTCuentasBancos"), DataTable) @@ -900,6 +912,7 @@ Partial Class RH_Personal ViewState("CvePersonal") = -1 BtnEliminar.Visible = False CarcaConceptosNomina() + CargaFonacot() For Each Gvr As GridViewRow In GVConceptos.Rows If CBool(Gvr.DataKey("Obligatorio")) Then Gvr.FCCheckBox("ChkAplica").Checked = True @@ -1690,6 +1703,7 @@ Partial Class RH_Personal 'Carga Conceptos de Nómina CarcaConceptosNomina() + CargaFonacot() 'Carga Pagos no Bancarios CargarPagosNoBancarios() 'Carga Resguardos @@ -2555,22 +2569,22 @@ Partial Class RH_Personal End If - frow = ObjPersonal.DtResultados.FiltroPrimero("CveSistema =4") - TxtFonValor.Text = "" - DdlFonTipoAplicacion.SelectedValueExist("-1") - TxtFonDescripcion.Text = "" - TxtFonNumCredito.Text = "" - TxtFonFechaInicio.Text = "" - ChkFonacot.Checked = False - If Not IsNothing(frow) Then - TxtFonValor.Text = String.Format("{0:###,###.##}", frow("Importe")) - DdlFonTipoAplicacion.SelectedValueExist(frow("TipoAplicacion").ToString()) + 'frow = ObjPersonal.DtResultados.FiltroPrimero("CveSistema =4") + 'TxtFonValor.Text = "" + 'DdlFonTipoAplicacion.SelectedValueExist("-1") + 'TxtFonDescripcion.Text = "" + 'TxtFonNumCredito.Text = "" + 'TxtFonFechaInicio.Text = "" + 'ChkFonacot.Checked = False + 'If Not IsNothing(frow) Then + ' TxtFonValor.Text = String.Format("{0:###,###.##}", frow("Importe")) + ' DdlFonTipoAplicacion.SelectedValueExist(frow("TipoAplicacion").ToString()) - TxtFonDescripcion.Text = String.Format("{0}", frow("Descripcion02")) - TxtFonNumCredito.Text = String.Format("{0}", frow("Descripcion01")) - TxtFonFechaInicio.Text = String.Format("{0:dd/MM/yyyy}", frow("FInicioAplicacion")) - ChkFonacot.Checked = frow("estatus").ToString().ToUpper().Contiene("1", "TRUE") - End If + ' TxtFonDescripcion.Text = String.Format("{0}", frow("Descripcion02")) + ' TxtFonNumCredito.Text = String.Format("{0}", frow("Descripcion01")) + ' TxtFonFechaInicio.Text = String.Format("{0:dd/MM/yyyy}", frow("FInicioAplicacion")) + ' ChkFonacot.Checked = frow("estatus").ToString().ToUpper().Contiene("1", "TRUE") + 'End If Else GVConceptos.DataSource = Nothing End If @@ -6521,30 +6535,115 @@ Partial Class RH_Personal gvrow.FCTextBox("TxtPorPago").Text = "87.5" End If End Sub + + Public Sub LimpiarFonacot() + TxtFonValor.Text = "" + TxtFonImporteCredito.Text = "" + TxtFonPagosHechos.Text = "" + DdlFonTipoAplicacion.SelectedValueExist("-1") + TxtFonDescripcion.Text = "" + TxtFonNumCredito.Text = "" + TxtFonFechaInicio.Text = "" + ChkFonacot.Checked = False + End Sub + Protected Sub CargaFonacot() + + Using onom As ClsNominas = New ClsNominas() + onom.NomFonacotGet(UsuarioActual.CveEmpresa, -1, CvePersonal) + GVNomFonacot.DataSource = onom.DtResultados + GVNomFonacot.DataBind() + End Using + UpFonacotGrid.Update() + End Sub + + Protected Sub LnAddFonacot_Click(sender As Object, e As EventArgs) + LimpiarFonacot() + CveFonacot = -1 + RegistraScript("$('#ModalFonacot').modal();") + End Sub + Protected Sub LnkEditarNomFonacot_Click(sender As Object, e As EventArgs) + Dim gvrow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + CveFonacot = gvrow.DataKey("CveFonacot").ToEntero() + Dim cvePersonal As Int32 = gvrow.DataKey("CvePersonal").ToEntero() + Dim numeroCredito As String = gvrow.DataKey("NumeroCredito") + Dim descripcion As String = gvrow.DataKey("Descripcion") + Dim periodo As Int32 = gvrow.DataKey("Periodo").ToEntero() + Dim cveTipoCalculo As Int32 = gvrow.DataKey("CveTipoCalculo").ToEntero() + Dim importeCredito As Decimal = gvrow.DataKey("ImporteCredito").ToDecimal() + Dim importeFijo As Decimal = gvrow.DataKey("ImporteFijo").ToDecimal() + Dim pagosHechos As Decimal = gvrow.DataKey("PagosHechos").ToDecimal() + Dim montoAcumulado As Decimal = gvrow.DataKey("MontoAcumulado").ToDecimal() + Dim saldo As Decimal = gvrow.DataKey("Saldo").ToDecimal() + Dim cveEstatus As Int32 = gvrow.DataKey("CveEstatus").ToEntero() + Dim observaciones As String = gvrow.DataKey("Observaciones") + If (periodo < 10000000) Then + periodo = 20000101 + + End If + LimpiarFonacot() + + TxtFonValor.Text = importeFijo.ToString() + TxtFonImporteCredito.Text = importeCredito.ToString() + TxtFonPagosHechos.Text = pagosHechos.ToString() + DdlFonTipoAplicacion.SelectedValueExist(cveTipoCalculo.ToString()) + TxtFonDescripcion.Text = descripcion + TxtFonNumCredito.Text = numeroCredito + TxtFonFechaInicio.Text = String.Format("{2}/{1}/{0}", periodo.ToString().Substring(0, 4), periodo.ToString().Substring(4, 2), periodo.ToString().Substring(6, 2)) + ChkFonacot.Checked = (cveEstatus = 1) + UpModalFonacot.Update() + RegistraScript("$('#ModalFonacot').modal();") + End Sub + + Protected Sub LnkEliminarNomFonacot_Click(sender As Object, e As EventArgs) + Dim gvrow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim cveFonacot As Integer = gvrow.DataKey("CveFonacot").ToEntero() + Dim Continuar As Boolean = False + Using onom As ClsNominas = New ClsNominas() + Continuar = onom.NomFonacotRemove(UsuarioActual.CveEmpresa, cveFonacot) + End Using + If (Continuar) Then + CargaFonacot() + Alert("El registro fonacot se ha eliminado") + End If + End Sub Protected Sub LnkGuardarFonacot_Click(sender As Object, e As EventArgs) - Dim importe As Double = TxtFonValor.Text.ToDouble() + Dim importe As Decimal = TxtFonValor.Text.ToDecimal() + Dim importeTotal As Decimal = TxtFonImporteCredito.Text.ToDecimal() + Dim importePagado As Decimal = TxtFonPagosHechos.Text.ToDecimal() Dim TipoAplicacion As Integer = DdlFonTipoAplicacion.SelectedValue.ToEntero() Dim NoPagos As Integer = 0 Dim SaldoIni As Double = 0 Dim descripcion02 As String = TxtFonDescripcion.Text - Dim descripcion01 As String = TxtFonNumCredito.Text + Dim NumCredito As String = TxtFonNumCredito.Text Dim fecha As String = TxtFonFechaInicio.Text.Replace("_", "") Dim estatus As Integer = If(ChkFonacot.Checked, 1, 0) - + Dim periodo As Integer = 20000101 If fecha.Length > 8 Then fecha = fecha.ToDateTime().ToString("yyyy/MM/dd") + periodo = fecha.ToDateTime().ToString("yyyyMMdd").ToEntero() Else fecha = "" End If - Dim continuar As Boolean = True + Dim continuar As Boolean = False + Using onom As ClsNominas = New ClsNominas() + If (CveFonacot = -1) Then + continuar = onom.NomFonacotAdd(UsuarioActual.CveEmpresa, CvePersonal, NumCredito, descripcion02, periodo, TipoAplicacion, importeTotal, importe, importePagado, 0, 0, estatus, "", UsuarioActual.CveUsuario) + Else + continuar = onom.NomFonacotUp(UsuarioActual.CveEmpresa, CveFonacot, CvePersonal, NumCredito, descripcion02, periodo, TipoAplicacion, importeTotal, importe, importePagado, 0, 0, estatus, "", UsuarioActual.CveUsuario) - Using ObjPersonal As ClsRH = New ClsRH() - If Not ObjPersonal.AddConcepto(CvePersonal, -1, importe, TipoAplicacion, NoPagos, SaldoIni, UsuarioActual.CveUsuario, 4, descripcion01, descripcion02, fecha, "", estatus, UsuarioActual.CveEmpresa) Then continuar = False + End If End Using + ' Old Borrar Caudillo 01/Marzo/2022 + 'Using ObjPersonal As ClsRH = New ClsRH() + ' If Not ObjPersonal.AddConcepto(CvePersonal, -1, importe, TipoAplicacion, NoPagos, SaldoIni, UsuarioActual.CveUsuario, 4, NumCredito, descripcion02, fecha, "", estatus, UsuarioActual.CveEmpresa) Then continuar = False + 'End Using If continuar Then Alert("Se actualizo el calculo de fonacot") + CargaFonacot() + RegistraScript("$('#ModalFonacot').modal('hide');") End If End Sub Protected Sub LnkCalcularFactor_Click(sender As Object, e As EventArgs) @@ -6804,5 +6903,7 @@ Partial Class RH_Personal End Sub + + End Class diff --git a/Sistemas/Empresa.aspx.vb b/Sistemas/Empresa.aspx.vb index 66b11a5ce..308775ce2 100644 --- a/Sistemas/Empresa.aspx.vb +++ b/Sistemas/Empresa.aspx.vb @@ -257,7 +257,6 @@ Partial Class Sistemas_Empresa TxtImporte.Text = .Importe.ToString 'NUEVOS - TxtRegistoPatronal.Text = .RegistroPatronal TxtAreaGeografica.Text = .AreaGeografica DdlProtocolo.Text = .Buzon_Tipo
    + + + + + + + + + +