Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -3542,16 +3542,16 @@ Public Class ClsCompras
|
||||
|
||||
Public Function GetVinculacionRNC(UUID As String, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Comp_ComprasMedicosRemove")
|
||||
DataAdapter("PA_Comp_VinculacionRNCGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@UUID", SqlDbType.VarChar).Value = UUID
|
||||
.Add("@CveMedico", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al eliminar gasto de médico.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
OnError("Ocurrió un error al obtener las remisiones de nota de crédito relacionadas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
@@ -231,11 +231,7 @@
|
||||
</asp:UpdatePanel>
|
||||
|
||||
|
||||
<asp:UpdatePanel runat="server">
|
||||
<ContentTemplate>
|
||||
<asp:LinkButton Visible="false" runat="server" ID="LnkRegistroRNC" class="btn btn-primary" OnClick="LnkRegistroRNC_Click"><i class="fa fa-search"></i> Prueba</asp:LinkButton>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
|
||||
<div class="row" style="margin-left: 0px; margin-right: 0px;">
|
||||
<div style="width: 100%;">
|
||||
|
||||
@@ -839,6 +839,10 @@ Partial Class Compras_eFacturas
|
||||
|
||||
InicializaDTProrrateoGasolina()
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
VinculacionAutomaticaRNC()
|
||||
End If
|
||||
|
||||
End If
|
||||
removeasincevent()
|
||||
End Sub
|
||||
@@ -6075,9 +6079,7 @@ Partial Class Compras_eFacturas
|
||||
|
||||
|
||||
|
||||
Protected Sub LnkRegistroRNC_Click(sender As Object, e As EventArgs)
|
||||
VinculacionAutomaticaRNC()
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub VinculacionAutomaticaRNC()
|
||||
|
||||
@@ -6098,7 +6100,7 @@ Partial Class Compras_eFacturas
|
||||
|
||||
Dim CFDIXmlPath As String = $"{UsuarioActual.Empresa.Ruta}Compras\{GvRow.DataKey("RFCDe")}\{GvRow.DataKey("XML")}"
|
||||
If Not File.Exists(CFDIXmlPath) Then
|
||||
ErrorProceso = True
|
||||
'ErrorProceso = True
|
||||
Continue For
|
||||
End If
|
||||
|
||||
@@ -6146,7 +6148,7 @@ Partial Class Compras_eFacturas
|
||||
DTProrrateo:=New DataTable, DTPagosDeudores:=New DataTable, TipoComprobante:="E") Then
|
||||
|
||||
If CompraActual.AddCompra(Objcompras.IniciaTransacSQL()) Then
|
||||
Contador = Contador + 1
|
||||
'
|
||||
Else
|
||||
ErrorProceso = True
|
||||
ErrorProcesoStr = CompraActual.MensajeError
|
||||
@@ -6167,11 +6169,11 @@ Partial Class Compras_eFacturas
|
||||
Dim Concepto As String = GvRow.DataKey("SerieFolio")
|
||||
Dim TipoCambio As Decimal = GlobalTipoCambio(GvRow.DataKey("FechaFactura").ToDate).ToDecimal
|
||||
|
||||
For Each drRNC As GridViewRow In DT_RNC.Rows
|
||||
For Each drRNC As DataRow In DT_RNC.Rows
|
||||
|
||||
|
||||
Dim ImporteRNCSaldar As Decimal = drRNC.DataKey("Saldo").ToDecimal
|
||||
Dim CveCompraRNC As Integer = drRNC.DataKey("CveCompra").ToEntero
|
||||
Dim ImporteRNCSaldar As Decimal = drRNC("Saldo").ToString.ToDecimal
|
||||
Dim CveCompraRNC As Integer = drRNC("CveCompra").ToString.ToEntero
|
||||
If ImporteRNCSaldar > TotalSaldo Then ImporteRNCSaldar = TotalSaldo
|
||||
|
||||
If Not ErrorProceso Then
|
||||
@@ -6194,6 +6196,7 @@ Partial Class Compras_eFacturas
|
||||
|
||||
If Not ErrorProceso Then
|
||||
TotalSaldo = TotalSaldo - ImporteRNCSaldar
|
||||
Contador = Contador + 1
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -6204,52 +6207,6 @@ Partial Class Compras_eFacturas
|
||||
End If
|
||||
|
||||
|
||||
|
||||
'If RBLContado.SelectedValue.ToEntero = 4 Then 'Deudores
|
||||
' Dim CompraActualPagar = New Compra
|
||||
' If Objcompras.GetCompras(CompraActual.CveCompra, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then
|
||||
' If Objcompras.DtResultados IsNot Nothing AndAlso Objcompras.DtResultados.Rows.Count > 0 Then
|
||||
' Dim dr As DataRow = Objcompras.DtResultados.Rows(0)
|
||||
|
||||
|
||||
' CompraActualPagar.CveCompra = CompraActual.CveCompra
|
||||
' CompraActualPagar.CveTipoConceptoProveedor = dr("CveTipoConcepto").ToString.ToEntero
|
||||
' CompraActualPagar.CveProveedor = dr("CveProveedor").ToString.ToEntero
|
||||
' CompraActualPagar.CveMoneda = dr("CveMoneda").ToString.ToEntero
|
||||
' CompraActualPagar.Fecha = dr("Fecha").ToString.ToDate
|
||||
' CompraActualPagar.SerieFolio = dr("SerieFolio").ToString
|
||||
' 'CompraActualPagar.ProveedorNombre = TxtPagueseA.Text
|
||||
' CompraActualPagar.TC = dr("TipoCambio").ToString.ToDecimal
|
||||
' CompraActualPagar.Total = dr("Total").ToString.ToDecimal
|
||||
' CompraActualPagar.IVA = dr("IVA").ToString.ToDecimal
|
||||
' CompraActualPagar.IVADeducible = dr("IVADeducible").ToString.ToDecimal.RoundSQL
|
||||
' CompraActualPagar.IVANoDeducible = dr("IVANoDeducible").ToString.ToDecimal.RoundSQL
|
||||
' CompraActualPagar.IEPS = dr("IEPS").ToString.ToDecimal
|
||||
' CompraActualPagar.RetIVA = dr("RetIVA").ToString.ToDecimal
|
||||
' CompraActualPagar.RetISR = dr("RetISR").ToString.ToDecimal
|
||||
' CompraActualPagar.CveConceptoRetIVA = dr("CveRetIVAConcepto").ToString.ToEntero
|
||||
' CompraActualPagar.CveConceptoRetISR = dr("CveRetISRConcepto").ToString.ToEntero
|
||||
' CompraActualPagar.PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal
|
||||
' CompraActualPagar.UsuarioActual = UsuarioActual
|
||||
' CompraActualPagar.CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero
|
||||
' CompraActualPagar.EsImportacion = CBool(dr("EsImportacion"))
|
||||
' CompraActualPagar.CompraNoDeducible = dr("NoDeducible").ToString.ToEntero
|
||||
|
||||
|
||||
|
||||
' Else
|
||||
' ErrorProceso = True
|
||||
' End If
|
||||
' Else
|
||||
' ErrorProceso = True
|
||||
' End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'End If
|
||||
|
||||
End If
|
||||
If ErrorProceso Then
|
||||
Exit For
|
||||
@@ -6258,14 +6215,14 @@ Partial Class Compras_eFacturas
|
||||
|
||||
If ErrorProceso Then
|
||||
Objcompras.RollBack()
|
||||
Alert($"Se registraron {Contador} Compras. error {ErrorProcesoStr}", TipoMensaje.MsgAdvertencia)
|
||||
Alert($"Se preento un error al reigistrar las notas de crédito", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
Objcompras.Commit()
|
||||
CargaDatos(NowADS())
|
||||
CambieDeudor()
|
||||
CargaDatos(NowADS())
|
||||
If Contador > 0 Then
|
||||
Alert($"Se registraron {Contador} Compras")
|
||||
GuardaLog($"Se registraron {Contador} notas de crédito")
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -8276,7 +8233,14 @@ Public Class ClsCompraManager
|
||||
If respuesta Then
|
||||
importeMovimiento = Me.Total
|
||||
importeMN = (importeMovimiento * Me.TipoCambio).RoundSQL
|
||||
Dim ConPreP As ConceptosTipoSaldo = ObtenerCveConceptoPrePoliza(1, Me.CveMoneda, False, Me.CveTipoConceptoProveedor)
|
||||
|
||||
Dim TipoSaldo As Integer = 1
|
||||
|
||||
If TipoComprobante = "E" Then
|
||||
TipoSaldo = 15
|
||||
End If
|
||||
|
||||
Dim ConPreP As ConceptosTipoSaldo = ObtenerCveConceptoPrePoliza(TipoSaldo, Me.CveMoneda, False, Me.CveTipoConceptoProveedor)
|
||||
Dim ImporteME As Decimal = importeMovimiento
|
||||
Dim UsaComplementaria As Boolean = True
|
||||
If Me.CveMoneda > 1 Then ImporteME = importeMovimiento
|
||||
|
||||
@@ -110,11 +110,11 @@ Partial Class Inventarios_PrestamosdeProveedor
|
||||
If e.Row.DataKey("AplicaCaducidad").ToString = "True" Then
|
||||
e.Row.FCLiteral("LtlFechaCaducidad").Visible = False
|
||||
e.Row.FCTextBox("TxtFechaCaducidad").Visible = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
e.Row.FCTextBox("TxtCantidad").Visible = True
|
||||
e.Row.FCTextBox("TxtCantidad").Attributes.Add("onkeyup", String.Format("ValidaCantidad(this,{0});", e.Row.DBCampo("Cantidad")))
|
||||
|
||||
|
||||
End If
|
||||
|
||||
''FUNCIONALIDAD PISTOLA DE CODIGOS
|
||||
@@ -303,18 +303,41 @@ Partial Class Inventarios_PrestamosdeProveedor
|
||||
Dim SbFiltros As New StringBuilder()
|
||||
'SbFiltros.AppendFormat("Fecha Inicio: {0} Fecha Fin: {1}|", $"01/01/{DdlEjercicio.SelectedValue}", $"31/12/{DdlEjercicio.SelectedValue}")
|
||||
Dim listFiltros As New List(Of String)
|
||||
|
||||
listFiltros.Add($"SubProyecto : {DdlSubProyecto.SelectedItem.Text}")
|
||||
|
||||
|
||||
If ddlProveedor.txtValue.Value.ToEntero > 0 Then
|
||||
listFiltros.Add($"Proveedor : { ddlProveedor.txtText.Value}")
|
||||
Else
|
||||
listFiltros.Add($"Proveedor : Todos")
|
||||
End If
|
||||
|
||||
If TxtFolioEntrega.Text.Trim.Length > 0 Then listFiltros.Add($"Folio : {TxtFolioEntrega.Text}")
|
||||
If TxtFolioEntrega.Text.Trim.Length > 0 Then
|
||||
listFiltros.Add($"Folio : {TxtFolioEntrega.Text}")
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'SbFiltros.AppendFormat("SubProyecto : {0}|", DdlSubProyecto.SelectedItem.Text)
|
||||
|
||||
'If ddlProveedor.txtValue.Value.ToEntero > 0 Then
|
||||
' SbFiltros.AppendFormat("Proveedor : {0}|", ddlProveedor.txtText.Value)
|
||||
'Else
|
||||
' SbFiltros.AppendFormat("Proveedor : Todos|")
|
||||
'End If
|
||||
|
||||
|
||||
'SbFiltros.AppendFormat("Folio : {0}|", TxtFolioEntrega.Text)
|
||||
'If DdlDivisor.SelectedValue <> "1" Then SbFiltros.AppendFormat("Divisor : {0}|", DdlDivisor.SelectedItem.Text)
|
||||
'SbFiltros.AppendFormat("Ejercicio : {0} Periodo : {1}|", DdlEjercicio.SelectedItem.Text, DdlPeriodo.SelectedItem.Text)
|
||||
|
||||
GvD.Columns(1).Visible = False
|
||||
UppEntrega.Update()
|
||||
GvD.ExportToExcelGembox($"PrestamoProveedores_{NowADS().ToString("yyyy.MM.dd.HHmmss")}", UsuarioActual, $"Préstamos de Proveedores", DatoTituloExtra:="", DatosFiltros:=String.Join(", ", listFiltros))
|
||||
GvD.ExportToExcelGembox($"PrestamosProveedores{NowADS().ToString("yyyyMMddHHmmss")}", UsuarioActual, $"Préstamos de Proveedores", DatoTituloExtra:="", DatosFiltros:=String.Join(", ", listFiltros))
|
||||
GvD.Columns(1).Visible = True
|
||||
UppEntrega.Update()
|
||||
|
||||
|
||||
@@ -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" Visible="false" 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("ISNULL(EfectoComprobante,'I') = 'I' AND CveTipoSolicitud = 3");
|
||||
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,14 +285,12 @@ 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;
|
||||
|
||||
|
||||
var api = new GeneralesAPII();
|
||||
|
||||
|
||||
if (idSolicitud.Length == 0)
|
||||
{
|
||||
JToken ObjApiSolicitud = (JToken)api.GeneraSolicitud(UsuarioActual.CveEmpresa, CveTipoSolicitud, CveSolicitudActual);
|
||||
@@ -369,10 +368,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 +405,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)
|
||||
@@ -548,7 +547,8 @@ public partial class SAT_SolicitudesIngresoSat : ClsPaginas
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
|
||||
|
||||
var UrlDescarga = $"{UsuarioActual.Empresa.Ruta}NomXMLSAT\\Descargas\\{GvRow.DataKey("ArchivoXML")}";
|
||||
var UrlDescarga = $"{UsuarioActual.Empresa.Ruta}DescargasSATXML\\Ingresos\\{GvRow.DataKey("CveSolicitudDetalle")}\\{GvRow.DataKey("ArchivoXML")}";
|
||||
|
||||
|
||||
var Archivo = new System.IO.FileInfo(UrlDescarga);
|
||||
|
||||
@@ -562,23 +562,28 @@ 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)
|
||||
{
|
||||
var UrlDescarga = $"{UsuarioActual.Empresa.Ruta}NomXMLSAT\\Descargas\\{e.Row.DataKey("ArchivoXML")}";
|
||||
var UrlDescarga = $"{UsuarioActual.Empresa.Ruta}DescargasSATXML\\Ingresos\\{e.Row.DataKey("CveSolicitudDetalle")}\\{e.Row.DataKey("ArchivoXML")}";
|
||||
|
||||
if (System.IO.File.Exists(UrlDescarga))
|
||||
{
|
||||
LinkButton LnkDescargaXML = e.Row.FCLinkButton("LnkDescargaXML");
|
||||
ScriptManager.GetCurrent(this).RegisterPostBackControl(LnkDescargaXML);
|
||||
LnkDescargaXML.Visible = true;
|
||||
|
||||
if (UsuarioActual.CveRol == 1)
|
||||
{
|
||||
e.Row.FCLinkButton("LnkReprocesar").Visible = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -598,115 +603,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 +733,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