--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>
|
||||
</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>
|
||||
|
||||
</ContentTemplate>
|
||||
@@ -481,9 +481,9 @@
|
||||
<ContentTemplate>
|
||||
<div class="row">
|
||||
<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"
|
||||
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>
|
||||
<asp:TemplateField HeaderText="Folio">
|
||||
<ItemTemplate>
|
||||
@@ -534,10 +534,10 @@
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField HeaderText="R Nombres" Visible="false">
|
||||
<asp:TemplateField HeaderText="Reprocesar" Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="LnkRenombrarArchivos" CssClass="btn btn-circle btn-sm blue" OnClick="LnkRenombrarArchivos_Click" runat="server" ToolTip="Renombrar Archivos"
|
||||
Text="Renombrar" />
|
||||
<asp:LinkButton ID="LnkReprocesar" CssClass="btn btn-circle btn-sm blue" OnClick="LnkReprocesar_Click" runat="server" ToolTip="Reprocesar"
|
||||
Text="Reprocesar" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
@@ -567,7 +567,7 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<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 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());
|
||||
LnkConsultar_Click(null, null);
|
||||
|
||||
//if (UsuarioActual.CveRol == 1)
|
||||
//{
|
||||
// GVSolicitudesNominas.Columns[8].Visible = true;
|
||||
//}
|
||||
if (UsuarioActual.CveRol == 1)
|
||||
{
|
||||
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))
|
||||
{
|
||||
GVSolicitudesPendientes.DataSource = nom.DtResultados;
|
||||
GVSolicitudesPendientes.DataSource = nom.DtResultados.Copy();
|
||||
if (nom.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
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))
|
||||
{
|
||||
GVSolicitudesNominas.DataSource = nom.DtResultados.FiltraParametros("EfectoComprobante = 'I'");
|
||||
GVSolicitudesNominas.DataBind();
|
||||
GVSolicitudesHistorial.DataSource = nom.DtResultados.FiltraParametros("EfectoComprobante = 'I'");
|
||||
GVSolicitudesHistorial.DataBind();
|
||||
}
|
||||
}
|
||||
UPModalViewSolicitudes.Update();
|
||||
@@ -173,13 +173,14 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
||||
}
|
||||
protected void LnkShowXmlCarga_Click(object sender, EventArgs e)
|
||||
{
|
||||
TxtArchivo.Text = "";
|
||||
TxtArchivo.Text = "";
|
||||
|
||||
RegistraScript("$('#Modalcargaxml').modal();");
|
||||
}
|
||||
protected void LnkCargarXML_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)
|
||||
{
|
||||
{
|
||||
try
|
||||
{
|
||||
var TipoMensaje = ModExtensiones.TipoMensaje.MsgInformacion;
|
||||
StringBuilder sbResultado = new StringBuilder();
|
||||
StringBuilder sbResultado = new StringBuilder();
|
||||
foreach (GridViewRow GvRow in GVSolicitudesPendientes.Rows)
|
||||
{
|
||||
int CveSolicitudActual = GvRow.DataKey("CveSolicitud").ToEntero();
|
||||
@@ -284,8 +285,8 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
||||
List<string> resultSolicitud = new List<string>();
|
||||
List<string> resultVerificacion = new List<string>();
|
||||
var ResultadoVerificaionOK = false;
|
||||
var SeVerifico = false;
|
||||
|
||||
var SeVerifico = 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}.");
|
||||
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Alert(sbResultado.ToString(), TipoMensaje);
|
||||
@@ -406,7 +407,7 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
||||
{
|
||||
if (e.Row.DataKey("Fecha") == "")
|
||||
e.Row.Attributes.Add("class", "Totales");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
@@ -562,12 +563,11 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
||||
Response.TransmitFile(Archivo.FullName);
|
||||
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.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)
|
||||
{
|
||||
|
||||
int Contador = 0;
|
||||
|
||||
System.IO.DirectoryInfo DirInfo = new System.IO.DirectoryInfo(DirectoryPath);
|
||||
IEnumerable<System.IO.FileInfo> files = DirInfo.EnumerateFiles();
|
||||
|
||||
foreach (var f in files)
|
||||
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
|
||||
|
||||
var TipoMensaje = ModExtensiones.TipoMensaje.MsgInformacion;
|
||||
StringBuilder sbResultado = new StringBuilder();
|
||||
|
||||
int CveSolicitudActual = GvRow.DataKey("CveSolicitud").ToEntero();
|
||||
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)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.IO.File.Move(f.FullName, $@"{f.DirectoryName}\{UUID.ToUpper()}.XML");
|
||||
Contador++;
|
||||
}
|
||||
catch (Exception ex3)
|
||||
{
|
||||
ModExtensiones.GuardaLog(ex3.StackTrace);
|
||||
}
|
||||
|
||||
|
||||
//ClsNominas objNominas = new ClsNominas();
|
||||
//objNominas.UpdateSolicitudDetalleCveSolicitudDetalle(UsuarioActual.CveEmpresa, UUID, CveSolicitudDetalle);
|
||||
//objNominas.Dispose();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Alert("Archivos Renombrados ");
|
||||
}
|
||||
|
||||
private string ValorXML(System.Xml.XmlNode n, string Campo, string Retorno = "")
|
||||
{
|
||||
System.Xml.XmlNode o = n.Attributes.Cast<System.Xml.XmlAttribute>().SingleOrDefault(a => string.Compare(a.Name, Campo, true) == 0);
|
||||
if (o == null)
|
||||
return Retorno;
|
||||
else
|
||||
return o.Value;
|
||||
}
|
||||
|
||||
protected void LnkRenombrarArchivos_Click(object sender, EventArgs e)
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
|
||||
var CveSolicitudDetalle = GvRow.DataKey("CveSolicitudDetalle").ToEntero();
|
||||
var UrlDirectorio = $"{UsuarioActual.Empresa.Ruta}DescargasSATXML\\Ingresos\\{CveSolicitudDetalle}";
|
||||
CargaComprobanteXML(UrlDirectorio, CveSolicitudDetalle);
|
||||
if (!(ObjApiVerificacion == null))
|
||||
{
|
||||
resultVerificacion = ObjApiVerificacion.Select(token => token.Values().Aggregate((i, j) => $"{i}|{j}").Value<string>()).ToList();
|
||||
ResultadoVerificaionOK = bool.Parse(resultVerificacion[0]);
|
||||
SeVerifico = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (resultSolicitud.Count >= 4)
|
||||
{
|
||||
sbResultado.Append($"({resultSolicitud[1]})<br> Folio:{Folio} <br> ");
|
||||
}
|
||||
else
|
||||
{
|
||||
sbResultado.Append($"Solicitud pendiente de verificar en SAT <br> Folio:{Folio} <br>");
|
||||
}
|
||||
|
||||
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
|
||||
}
|
||||
|
||||
|
||||
if (SeVerifico && resultVerificacion.Count >= 4)
|
||||
{
|
||||
if (ResultadoVerificaionOK)
|
||||
{
|
||||
sbResultado.Append($"Solicitud procesada.<br> Folio: {Folio} <br> {resultVerificacion[1]}");
|
||||
}
|
||||
else
|
||||
{
|
||||
sbResultado.Append($"Solicitud no verificada <br> Folio: {Folio}{resultVerificacion[1]}.<br>");
|
||||
TipoMensaje = ModExtensiones.TipoMensaje.MsgAdvertencia;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
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