--FIX solicitudes de ingreso
This commit is contained in:
@@ -62,7 +62,7 @@
|
|||||||
<asp:LinkButton ID="LnkShowSolicitudes" OnClick="LnkShowSolicitudes_Click" runat="server"> <i class="fa fa-external-link"></i> Solicitudes</asp:LinkButton>
|
<asp:LinkButton ID="LnkShowSolicitudes" OnClick="LnkShowSolicitudes_Click" runat="server"> <i class="fa fa-external-link"></i> Solicitudes</asp:LinkButton>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<asp:LinkButton ID="LnkShowXmlCarga" OnClick="LnkShowXmlCarga_Click" runat="server"> <i class="fa fa-xml"></i> Caga XML Local</asp:LinkButton>
|
<asp:LinkButton ID="LnkShowXmlCarga" OnClick="LnkShowXmlCarga_Click" Visible="false" runat="server"> <i class="fa fa-xml"></i> Cargar XML Local</asp:LinkButton>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
@@ -481,9 +481,9 @@
|
|||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<asp:GridView ID="GVSolicitudesNominas" runat="server" GridLines="None" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" AutoGenerateColumns="False" OnRowDataBound="GVSolicitudesNominas_RowDataBound"
|
<asp:GridView ID="GVSolicitudesHistorial" runat="server" GridLines="None" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" AutoGenerateColumns="False" OnRowDataBound="GVSolicitudesHistorial_RowDataBound"
|
||||||
ShowHeaderWhenEmpty="true" EmptyDataText="No se encontraron registros"
|
ShowHeaderWhenEmpty="true" EmptyDataText="No se encontraron registros"
|
||||||
DataKeyNames="CveSolicitudDetalle,CveSolicitud,idSolicitudCFDI,idSolicitudMetadata,Estatus,Observaciones,FechaInicio,FechaFin,FechaIng,CveUsuarioIng,CveEmpresa,ArchivoXML,Folio,CveTipoSolicitud,TipoDescargaStr">
|
DataKeyNames="CveSolicitudDetalle,CveSolicitud,idSolicitud,idSolicitudCFDI,idSolicitudMetadata,Estatus,Observaciones,FechaInicio,FechaFin,FechaIng,CveUsuarioIng,CveEmpresa,ArchivoXML,Folio,CveTipoSolicitud,TipoDescargaStr">
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:TemplateField HeaderText="Folio">
|
<asp:TemplateField HeaderText="Folio">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
@@ -534,10 +534,10 @@
|
|||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="R Nombres" Visible="false">
|
<asp:TemplateField HeaderText="Reprocesar" Visible="false">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:LinkButton ID="LnkRenombrarArchivos" CssClass="btn btn-circle btn-sm blue" OnClick="LnkRenombrarArchivos_Click" runat="server" ToolTip="Renombrar Archivos"
|
<asp:LinkButton ID="LnkReprocesar" CssClass="btn btn-circle btn-sm blue" OnClick="LnkReprocesar_Click" runat="server" ToolTip="Reprocesar"
|
||||||
Text="Renombrar" />
|
Text="Reprocesar" />
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
@@ -567,7 +567,7 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
<h4 class="modal-title">Carga Xml</h4>
|
<h4 class="modal-title">Cargar Xml</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
|||||||
TxtRpdFechaFin.Text = string.Format("{0:dd/MM/yyyy}", NowADS().AddMonths(-1).LastDayOfMonth());
|
TxtRpdFechaFin.Text = string.Format("{0:dd/MM/yyyy}", NowADS().AddMonths(-1).LastDayOfMonth());
|
||||||
LnkConsultar_Click(null, null);
|
LnkConsultar_Click(null, null);
|
||||||
|
|
||||||
//if (UsuarioActual.CveRol == 1)
|
if (UsuarioActual.CveRol == 1)
|
||||||
//{
|
{
|
||||||
// GVSolicitudesNominas.Columns[8].Visible = true;
|
GVSolicitudesHistorial.Columns[9].Visible = true;
|
||||||
//}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
|||||||
|
|
||||||
if (nom.SolicitudesGet(-1, UsuarioActual.CveEmpresa, CveTipoSolicitud: 3, Estatus: 0, Top: 50))
|
if (nom.SolicitudesGet(-1, UsuarioActual.CveEmpresa, CveTipoSolicitud: 3, Estatus: 0, Top: 50))
|
||||||
{
|
{
|
||||||
GVSolicitudesPendientes.DataSource = nom.DtResultados;
|
GVSolicitudesPendientes.DataSource = nom.DtResultados.Copy();
|
||||||
if (nom.DtResultados.Rows.Count > 0)
|
if (nom.DtResultados.Rows.Count > 0)
|
||||||
{
|
{
|
||||||
LnkverificarSolicitudes.Visible = true;
|
LnkverificarSolicitudes.Visible = true;
|
||||||
@@ -158,8 +158,8 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
|||||||
|
|
||||||
if (nom.SolicitudesGet(-1, UsuarioActual.CveEmpresa, CveTipoSolicitud: 3, Estatus: 1, Top: 50))
|
if (nom.SolicitudesGet(-1, UsuarioActual.CveEmpresa, CveTipoSolicitud: 3, Estatus: 1, Top: 50))
|
||||||
{
|
{
|
||||||
GVSolicitudesNominas.DataSource = nom.DtResultados.FiltraParametros("EfectoComprobante = 'I'");
|
GVSolicitudesHistorial.DataSource = nom.DtResultados.FiltraParametros("EfectoComprobante = 'I'");
|
||||||
GVSolicitudesNominas.DataBind();
|
GVSolicitudesHistorial.DataBind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UPModalViewSolicitudes.Update();
|
UPModalViewSolicitudes.Update();
|
||||||
@@ -173,13 +173,14 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
|||||||
}
|
}
|
||||||
protected void LnkShowXmlCarga_Click(object sender, EventArgs e)
|
protected void LnkShowXmlCarga_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
TxtArchivo.Text = "";
|
TxtArchivo.Text = "";
|
||||||
|
|
||||||
RegistraScript("$('#Modalcargaxml').modal();");
|
RegistraScript("$('#Modalcargaxml').modal();");
|
||||||
}
|
}
|
||||||
protected void LnkCargarXML_Click(object sender, EventArgs e)
|
protected void LnkCargarXML_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
}
|
|
||||||
|
}
|
||||||
protected void LnkSolicitarSat_Click(object sender, EventArgs e)
|
protected void LnkSolicitarSat_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -269,11 +270,11 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void LnkverificarSolicitudes_Click(object sender, EventArgs e)
|
protected void LnkverificarSolicitudes_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var TipoMensaje = ModExtensiones.TipoMensaje.MsgInformacion;
|
var TipoMensaje = ModExtensiones.TipoMensaje.MsgInformacion;
|
||||||
StringBuilder sbResultado = new StringBuilder();
|
StringBuilder sbResultado = new StringBuilder();
|
||||||
foreach (GridViewRow GvRow in GVSolicitudesPendientes.Rows)
|
foreach (GridViewRow GvRow in GVSolicitudesPendientes.Rows)
|
||||||
{
|
{
|
||||||
int CveSolicitudActual = GvRow.DataKey("CveSolicitud").ToEntero();
|
int CveSolicitudActual = GvRow.DataKey("CveSolicitud").ToEntero();
|
||||||
@@ -284,8 +285,8 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
|||||||
List<string> resultSolicitud = new List<string>();
|
List<string> resultSolicitud = new List<string>();
|
||||||
List<string> resultVerificacion = new List<string>();
|
List<string> resultVerificacion = new List<string>();
|
||||||
var ResultadoVerificaionOK = false;
|
var ResultadoVerificaionOK = false;
|
||||||
var SeVerifico = false;
|
var SeVerifico = false;
|
||||||
|
|
||||||
var ResultadoSolicitudOK = false;
|
var ResultadoSolicitudOK = false;
|
||||||
|
|
||||||
|
|
||||||
@@ -369,10 +370,10 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
|||||||
{
|
{
|
||||||
sbResultado.Append($"Se presento un error al verificar la solicitud <br> Folio: {Folio}.");
|
sbResultado.Append($"Se presento un error al verificar la solicitud <br> Folio: {Folio}.");
|
||||||
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
|
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Alert(sbResultado.ToString(), TipoMensaje);
|
Alert(sbResultado.ToString(), TipoMensaje);
|
||||||
@@ -406,7 +407,7 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
|||||||
{
|
{
|
||||||
if (e.Row.DataKey("Fecha") == "")
|
if (e.Row.DataKey("Fecha") == "")
|
||||||
e.Row.Attributes.Add("class", "Totales");
|
e.Row.Attributes.Add("class", "Totales");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e)
|
protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||||
@@ -562,12 +563,11 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
|||||||
Response.TransmitFile(Archivo.FullName);
|
Response.TransmitFile(Archivo.FullName);
|
||||||
Response.End();
|
Response.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void GVSolicitudesNominas_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
protected void GVSolicitudesHistorial_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||||
|
{
|
||||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||||
{
|
{
|
||||||
if (e.Row.DataKey("ArchivoXML").Length > 0)
|
if (e.Row.DataKey("ArchivoXML").Length > 0)
|
||||||
@@ -598,115 +598,88 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CargaComprobanteXML(string DirectoryPath, int CveSolicitudDetalle)
|
protected void LnkReprocesar_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
|
||||||
int Contador = 0;
|
|
||||||
|
var TipoMensaje = ModExtensiones.TipoMensaje.MsgInformacion;
|
||||||
System.IO.DirectoryInfo DirInfo = new System.IO.DirectoryInfo(DirectoryPath);
|
StringBuilder sbResultado = new StringBuilder();
|
||||||
IEnumerable<System.IO.FileInfo> files = DirInfo.EnumerateFiles();
|
|
||||||
|
int CveSolicitudActual = GvRow.DataKey("CveSolicitud").ToEntero();
|
||||||
foreach (var f in files)
|
string idSolicitud = GvRow.DataKey("idSolicitud").Trim();
|
||||||
|
int CveTipoSolicitud = GvRow.DataKey("CveTipoSolicitud").ToEntero();
|
||||||
|
int CveSolicitudDetalle = GvRow.DataKey("CveSolicitudDetalle").ToEntero();
|
||||||
|
int Folio = GvRow.DataKey("Folio").ToEntero();
|
||||||
|
|
||||||
|
List<string> resultSolicitud = new List<string>();
|
||||||
|
List<string> resultVerificacion = new List<string>();
|
||||||
|
var ResultadoVerificaionOK = false;
|
||||||
|
var SeVerifico = false;
|
||||||
|
|
||||||
|
var ResultadoSolicitudOK = false;
|
||||||
|
|
||||||
|
var api = new GeneralesAPII();
|
||||||
|
|
||||||
|
resultSolicitud = new List<string>();
|
||||||
|
resultSolicitud.Add("true");
|
||||||
|
resultSolicitud.Add("");
|
||||||
|
resultSolicitud.Add("");
|
||||||
|
resultSolicitud.Add("");
|
||||||
|
|
||||||
|
ResultadoSolicitudOK = true;
|
||||||
|
|
||||||
|
if (ResultadoSolicitudOK)
|
||||||
{
|
{
|
||||||
|
JToken ObjApiVerificacion = (JToken)api.ProcesarSolicitudSAT(UsuarioActual.CveEmpresa, CveTipoSolicitud, CveSolicitudActual, CveSolicitudDetalle);
|
||||||
|
|
||||||
if (f.Extension.ToUpper() == ".XML")
|
|
||||||
{
|
|
||||||
string UUID = "";
|
|
||||||
System.Xml.XmlDocument XMLDoc = new System.Xml.XmlDocument();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
XMLDoc.Load(f.FullName);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
string a = ex.Message;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var oReader = new System.IO.StreamReader(f.FullName, System.Text.Encoding.GetEncoding("ISO-8859-1"));
|
|
||||||
XMLDoc.Load(oReader);
|
|
||||||
oReader.Dispose();
|
|
||||||
}
|
|
||||||
catch (Exception ex2)
|
|
||||||
{
|
|
||||||
// GuardaLog("Error al intentar leer el XML del SAT. Error:" + ex2.ToString());
|
|
||||||
ModExtensiones.GuardaLog(ex2.StackTrace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
System.Xml.XmlNode nodo = XMLDoc.DocumentElement;
|
|
||||||
string Version = ValorXML(nodo, "version");
|
|
||||||
|
|
||||||
System.Xml.XmlNamespaceManager namespaces = new System.Xml.XmlNamespaceManager(XMLDoc.NameTable);
|
|
||||||
string Prefijo = XMLDoc.DocumentElement.Prefix == "" ? "cfd" : XMLDoc.DocumentElement.Prefix;
|
|
||||||
string cfdVer = "";
|
|
||||||
|
|
||||||
if (Version == "3.2")
|
|
||||||
{
|
|
||||||
Prefijo = "cfd";
|
|
||||||
cfdVer = "http://www.sat.gob.mx/cfd/2";
|
|
||||||
}
|
|
||||||
else if (Version == "3.3")
|
|
||||||
cfdVer = "http://www.sat.gob.mx/cfd/3";
|
|
||||||
else
|
|
||||||
cfdVer = "http://www.sat.gob.mx/cfd/4";
|
|
||||||
|
|
||||||
namespaces.AddNamespace(Prefijo, cfdVer);
|
|
||||||
namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital");
|
|
||||||
namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal");
|
|
||||||
namespaces.AddNamespace("registrofiscal", "http://www.sat.gob.mx/registrofiscal");
|
|
||||||
|
|
||||||
System.Xml.XmlNode node;
|
|
||||||
node = XMLDoc.SelectSingleNode(string.Format("//{0}:Emisor", Prefijo), namespaces);
|
|
||||||
|
|
||||||
System.Xml.XmlNode nodeComp = XMLDoc.SelectSingleNode(string.Format("//{0}:Complemento", Prefijo), namespaces);
|
|
||||||
if (node != null)
|
|
||||||
{
|
|
||||||
System.Xml.XmlNode nodeTFD = nodeComp.SelectSingleNode(string.Format("//{0}:TimbreFiscalDigital", "tfd"), namespaces);
|
|
||||||
UUID = ValorXML(nodeTFD, "UUID", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (UUID.Length > 0)
|
if (!(ObjApiVerificacion == null))
|
||||||
{
|
{
|
||||||
try
|
resultVerificacion = ObjApiVerificacion.Select(token => token.Values().Aggregate((i, j) => $"{i}|{j}").Value<string>()).ToList();
|
||||||
{
|
ResultadoVerificaionOK = bool.Parse(resultVerificacion[0]);
|
||||||
System.IO.File.Move(f.FullName, $@"{f.DirectoryName}\{UUID.ToUpper()}.XML");
|
SeVerifico = true;
|
||||||
Contador++;
|
}
|
||||||
}
|
else
|
||||||
catch (Exception ex3)
|
{
|
||||||
{
|
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
|
||||||
ModExtensiones.GuardaLog(ex3.StackTrace);
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
else
|
||||||
//ClsNominas objNominas = new ClsNominas();
|
{
|
||||||
//objNominas.UpdateSolicitudDetalleCveSolicitudDetalle(UsuarioActual.CveEmpresa, UUID, CveSolicitudDetalle);
|
if (resultSolicitud.Count >= 4)
|
||||||
//objNominas.Dispose();
|
{
|
||||||
|
sbResultado.Append($"({resultSolicitud[1]})<br> Folio:{Folio} <br> ");
|
||||||
|
}
|
||||||
|
else
|
||||||
}
|
{
|
||||||
}
|
sbResultado.Append($"Solicitud pendiente de verificar en SAT <br> Folio:{Folio} <br>");
|
||||||
}
|
}
|
||||||
|
|
||||||
Alert("Archivos Renombrados ");
|
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ValorXML(System.Xml.XmlNode n, string Campo, string Retorno = "")
|
|
||||||
{
|
if (SeVerifico && resultVerificacion.Count >= 4)
|
||||||
System.Xml.XmlNode o = n.Attributes.Cast<System.Xml.XmlAttribute>().SingleOrDefault(a => string.Compare(a.Name, Campo, true) == 0);
|
{
|
||||||
if (o == null)
|
if (ResultadoVerificaionOK)
|
||||||
return Retorno;
|
{
|
||||||
else
|
sbResultado.Append($"Solicitud procesada.<br> Folio: {Folio} <br> {resultVerificacion[1]}");
|
||||||
return o.Value;
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
protected void LnkRenombrarArchivos_Click(object sender, EventArgs e)
|
sbResultado.Append($"Solicitud no verificada <br> Folio: {Folio}{resultVerificacion[1]}.<br>");
|
||||||
{
|
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
|
||||||
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
|
}
|
||||||
var CveSolicitudDetalle = GvRow.DataKey("CveSolicitudDetalle").ToEntero();
|
}
|
||||||
var UrlDirectorio = $"{UsuarioActual.Empresa.Ruta}DescargasSATXML\\Ingresos\\{CveSolicitudDetalle}";
|
else
|
||||||
CargaComprobanteXML(UrlDirectorio, CveSolicitudDetalle);
|
{
|
||||||
|
sbResultado.Append($"Se presento un error al verificar la solicitud <br> Folio: {Folio}.");
|
||||||
|
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
Alert(sbResultado.ToString(), TipoMensaje);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -755,6 +728,10 @@ public class GeneralesAPII : ADSNetLibraryzI.HelpersI.ConexionesI.SIGAPII.BaseSI
|
|||||||
public object VerificaSolicitudesNominas(int CveEmpresa, int CveTipoSolicitud, int CveSolicitud)
|
public object VerificaSolicitudesNominas(int CveEmpresa, int CveTipoSolicitud, int CveSolicitud)
|
||||||
{
|
{
|
||||||
return getData<object>($"VerificaSolicitudesNominas/{CveEmpresa}/{CveTipoSolicitud}/{CveSolicitud}", null, ADSNetLibraryzI.HelpersI.ConexionesI.SIGAPII.requestMethod.GET, false);
|
return getData<object>($"VerificaSolicitudesNominas/{CveEmpresa}/{CveTipoSolicitud}/{CveSolicitud}", null, ADSNetLibraryzI.HelpersI.ConexionesI.SIGAPII.requestMethod.GET, false);
|
||||||
|
}
|
||||||
|
public object ProcesarSolicitudSAT(int CveEmpresa, int CveTipoSolicitud, int CveSolicitud, int CveSolicitudDetalle)
|
||||||
|
{
|
||||||
|
return getData<object>($"ProcesarSolicitudSAT/{CveEmpresa}/{CveTipoSolicitud}/{CveSolicitud}/{CveSolicitudDetalle}", null, ADSNetLibraryzI.HelpersI.ConexionesI.SIGAPII.requestMethod.GET, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user