Inicio PS por caducar y RSCO Por Vencer, Avance descarga Ingresos

This commit is contained in:
rakcsle
2022-07-20 17:00:22 -07:00
parent dba2eb55e3
commit 679463df72
14 changed files with 1472 additions and 114 deletions

View File

@@ -5963,7 +5963,7 @@ Public Class ClsInventarios
Public Function RepCompuestosVigencia(CveCompuesto As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date, VigenciaIndeterminada As Boolean, CveEmpresa As Integer) As Boolean
Public Function RepCompuestosVigencia(CveCompuesto As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date, VigenciaIndeterminada As Boolean, CveEmpresa As Integer, Optional ConCaducidad As Boolean = False) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_CompuestosVigenciaRep")
@@ -5976,6 +5976,8 @@ Public Class ClsInventarios
.Add("@FechaF", SqlDbType.Date).Value = FechaF
.Add("@VigenciaIndeterminada", SqlDbType.Int).Value = VigenciaIndeterminada
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@ConCaducidad", SqlDbType.Bit).Value = ConCaducidad
End With
Try

View File

@@ -5393,7 +5393,9 @@ Public Class ClsPaginas
PaginaDict.Add("/RH/MiPerfil.aspx".ToUpper(), -1) ' se dejará libre el módulo para que cualquier que tenga cvepersonal, pueda acceder
PaginaDict.Add("/RH/CatChecadores.aspx".ToUpper(), 694)
PaginaDict.Add("/RH/CatRegistroPatronal.aspx".ToUpper(), 1324)
PaginaDict.Add("/SAT/SolicitudesNominaSat.aspx".ToUpper(), 545)
PaginaDict.Add("/SAT/SolicitudesIngresoSat.aspx".ToUpper(), -1)
#End Region
#Region "Sistema"
'Cargo las páginas que deben tener restricción

View File

@@ -852,6 +852,11 @@ Partial Class Compras_ReembolsosComprobaciones
ConceptoContableRetIVAAcreditable = 249
CveFunc = 313
CveFuncAcreditable = 314
Case 5
ConceptoContableRetIVAXAcreditar = 285
ConceptoContableRetIVAAcreditable = 286
CveFunc = 578
CveFuncAcreditable = 578
End Select
If UsuarioActual.Empresa.TipoContabilidad = 2 Then

View File

@@ -59,10 +59,10 @@
<li>
<asp:LinkButton ID="LnkCFDiMasivo" runat="server" ToolTip="Validación Masiva de CFDi"><i class="fa fa-list-ul"></i> Validación Masiva</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="lbDescargar" runat="server"><%--<img src="/Metronic/assets/global/img/portlet-reload-icon.png" />--%><i class="fa fa-download"></i>
<%-- <li>
<asp:LinkButton ID="lbDescargar" runat="server"><i class="fa fa-download"></i>
Descarga Facturas SAT</asp:LinkButton>
</li>
</li>--%>
<li>
<asp:LinkButton ID="LnkShowSolicitudes" OnClick="LnkShowSolicitudes_Click" runat="server">Solicitudes SAT</asp:LinkButton>
</li>

View File

@@ -6,6 +6,10 @@ Imports System.Diagnostics
Imports System.Globalization
Imports System.IO
Imports System.IO.Compression
Imports System.Net.Http
Imports System.Net.Http.Headers
Imports System.Threading
Imports System.Threading.Tasks
Imports System.Xml
Imports ADSistemaLibrary.SatXml
Imports ADSistemaLibrary.SatXml.XmlSatCFDI
@@ -760,7 +764,7 @@ Partial Class Compras_eFacturas
If UsuarioActual.Sesion("eFact-Proveedor").ToString <> "" Then TxtProveedor.Text = UsuarioActual.Sesion("eFact-Proveedor").ToString.Trim
If UsuarioActual.Sesion("eFact-FI").ToString <> "" Then txtFechaI.Text = UsuarioActual.Sesion("eFact-FI").ToString.Trim
If UsuarioActual.Sesion("eFact-FF").ToString <> "" Then txtFechaF.Text = UsuarioActual.Sesion("eFact-FF").ToString.Trim
If UsuarioActual.CveUsuario = 100 Then lbDescargar.Visible = True
'If UsuarioActual.CveUsuario = 100 Then lbDescargar.Visible = True
'If UsuarioActual.TienePermisoProceso(81) Then GvD.Columns(11).Visible = True : GvD.Columns(12).Visible = True
'If UsuarioActual.TienePermisoProceso(206) Then GvD.Columns(10).Visible = False
@@ -2575,9 +2579,9 @@ Partial Class Compras_eFacturas
Using nom As ClsNominas = New ClsNominas()
Continuar = nom.SolicitudesAdd(idSolicitudCFDI, idSolicitudMetadata, estatus, observaciones, fechaInicio, fechaFin, cveUsuarioIng, cveEmpresa, 2)
'Dim api = New GeneralesAPI()
'api.GeneraSolicitud()
'api.VerificaSolicitudesNominas()
Dim api = New GeneralesAPIeFacturas()
api.GeneraSolicitud()
api.VerificaSolicitudesNominas()
End Using
If Continuar Then
@@ -2590,99 +2594,71 @@ Partial Class Compras_eFacturas
End Sub
Protected Sub LnkverificarSolicitudes_Click(ByVal sender As Object, ByVal e As EventArgs)
'Dim api = New GeneralesAPI()
'api.GeneraSolicitud()
'api.VerificaSolicitudesNominas()
Dim api = New GeneralesAPIeFacturas()
api.GeneraSolicitud()
api.VerificaSolicitudesNominas()
cargasolicitudes()
End Sub
#End Region
#Region "D E S C A R G A R - F A C T U R A "
Protected Sub lbDescargar_Click(sender As Object, e As EventArgs) Handles lbDescargar.Click
'Protected Sub lbDescargar_Click(sender As Object, e As EventArgs) Handles lbDescargar.Click
Dim Retorno As Boolean = False
' Dim Retorno As Boolean = False
Dim ObjProcess As Process = Nothing
Dim Mensajes As String = ""
Dim error1 As Boolean = False
Dim CountProcesados As Integer = 0
' Dim ObjProcess As Process = Nothing
' Dim Mensajes As String = ""
' Dim error1 As Boolean = False
' Dim CountProcesados As Integer = 0
Try
ObjProcess = New Process()
ObjProcess.StartInfo.RedirectStandardOutput = True
ObjProcess.StartInfo.FileName = Ejecutable
ObjProcess.StartInfo.Arguments = $"--mod dsat2 --cveemp {UsuarioActual.CveEmpresa} --rfc {UsuarioActual.Empresa.RFC} --ciec {UsuarioActual.Empresa.CIEC} --razon {UsuarioActual.Empresa.Empresa} --fi {txtFechaI.Text} --ff {txtFechaF.Text}"
ObjProcess.StartInfo.UseShellExecute = False
ObjProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
ObjProcess.Start()
' Try
' ObjProcess = New Process()
' ObjProcess.StartInfo.RedirectStandardOutput = True
' ObjProcess.StartInfo.FileName = Ejecutable
' ObjProcess.StartInfo.Arguments = $"--mod dsat2 --cveemp {UsuarioActual.CveEmpresa} --rfc {UsuarioActual.Empresa.RFC} --ciec {UsuarioActual.Empresa.CIEC} --razon {UsuarioActual.Empresa.Empresa} --fi {txtFechaI.Text} --ff {txtFechaF.Text}"
' ObjProcess.StartInfo.UseShellExecute = False
' ObjProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
' ObjProcess.Start()
Dim myStreamReader As StreamReader = ObjProcess.StandardOutput
' Dim myStreamReader As StreamReader = ObjProcess.StandardOutput
'Read the standard output of the spawned process.
Mensajes = myStreamReader.ReadLine()
If Mensajes.Length > 0 Then
' 'Read the standard output of the spawned process.
' Mensajes = myStreamReader.ReadLine()
' If Mensajes.Length > 0 Then
Dim msgs As String() = Mensajes.Split("|"c)
Dim NFacturas As Integer = 0
' Dim msgs As String() = Mensajes.Split("|"c)
' Dim NFacturas As Integer = 0
If msgs.Length >= 2 Then
Try
NFacturas = msgs(0).ToEntero
CountProcesados = msgs(0).ToEntero
Mensajes = $"La actualización se realizó correctamente. <br> Facturas agregadas: { NFacturas }"
Catch ex As Exception
NFacturas = 0
Mensajes = "La actualización se realizó correctamente"
End Try
Else
Mensajes = "La descarga se realizó correctamente"
End If
End If
ObjProcess.WaitForExit()
ObjProcess.Close()
Retorno = True
Catch ex As Exception
error1 = True
OnError("Ocurrió un error al ejecutar el actualizador.", ex)
End Try
' If msgs.Length >= 2 Then
' Try
' NFacturas = msgs(0).ToEntero
' CountProcesados = msgs(0).ToEntero
' Mensajes = $"La actualización se realizó correctamente. <br> Facturas agregadas: { NFacturas }"
' Catch ex As Exception
' NFacturas = 0
' Mensajes = "La actualización se realizó correctamente"
' End Try
' Else
' Mensajes = "La descarga se realizó correctamente"
' End If
' End If
' ObjProcess.WaitForExit()
' ObjProcess.Close()
' Retorno = True
' Catch ex As Exception
' error1 = True
' OnError("Ocurrió un error al ejecutar el actualizador.", ex)
' End Try
If Retorno Then CargaDatos()
' If Retorno Then CargaDatos()
'Dim Retorno As Boolean = False
''Codigo anterior no borrar puede hacer el paro
'Dim ObjProcess As Process = Nothing
'Dim Mensajes As String = ""
'Dim EjecutableUtilerias = Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Utilerias\UtileriasAD.exe")
'Dim Folder = Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas\")
'Dim error1 As Boolean = False
'Dim en As New CultureInfo("en-US")
'Dim fechai = txtFechaI.Text.Trim.ToDate.ToString("d", en)
'Dim fechaf = txtFechaF.Text.Trim.ToDate.ToString("d", en)
'Try
' ObjProcess = New Process()
' ObjProcess.StartInfo.RedirectStandardOutput = True
' ObjProcess.StartInfo.FileName = EjecutableUtilerias
' ObjProcess.StartInfo.Verb = "runas"
' ObjProcess.StartInfo.Arguments = $"{UsuarioActual.CveEmpresa} {Folder} 1 {fechai} {fechaf}"
' ObjProcess.StartInfo.UseShellExecute = False
' ObjProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
' ObjProcess.Start()
' ObjProcess.WaitForExit()
' ObjProcess.Close()
'Catch ex As Exception
' error1 = True
' OnError("Ocurrió un error al ejecutar el actualizador.", ex)
'End Try
'' ProcesaBuzon()
End Sub
'End Sub
'Private Sub ProcesaBuzon()
@@ -4626,18 +4602,123 @@ End Class
Public Class GeneralesAPI
Inherits ADSNetLibrary.Helpers.Conexiones.SIGAPI.BaseSIGAPI
Public Class GeneralesAPIeFacturas
Inherits ADSNetLibraryzdE.HelpersE.ConexionesE.SIGAPIE.BaseSIGAPIeFacturas
Public Sub New(ByVal Optional domainApi As String = "http://localhost:4001/", ByVal Optional token As String = "")
MyBase.New(domainApi, token)
End Sub
Public Function GeneraSolicitud() As Object
Return getData(Of Object)("GeneraSolicitud", Nothing, ADSNetLibrary.Helpers.Conexiones.SIGAPI.requestMethod.[GET], False)
Return getData(Of Object)("GeneraSolicitud", Nothing, ADSNetLibraryzdE.HelpersE.ConexionesE.SIGAPIE.requestMethod.[GET], False)
End Function
Public Function VerificaSolicitudesNominas() As Object
Return getData(Of Object)("VerificaSolicitudesNominas", Nothing, ADSNetLibrary.Helpers.Conexiones.SIGAPI.requestMethod.[GET], False)
Return getData(Of Object)("VerificaSolicitudesNominas", Nothing, ADSNetLibraryzdE.HelpersE.ConexionesE.SIGAPIE.requestMethod.[GET], False)
End Function
End Class
Namespace ADSNetLibraryzdE.HelpersE.ConexionesE.SIGAPIE
Public Enum requestMethod
POST = 1
[GET] = 2
End Enum
Public Class BaseSIGAPIeFacturas
Private Const tituloLog As String = "ADSNetLibrary.Helpers.Conexiones.SIGAPI"
Public domainApi As String
Public authorization As String
Protected RouteController As String = ""
Protected FullRoute As String = ""
Public Function GetRoutbyclass() As String
Dim classname As String = Me.[GetType]().Name
Return classname.Substring(0, classname.Length - 12)
End Function
Public Function GetRoute(ByVal path As String) As String
If String.IsNullOrEmpty(FullRoute) Then
Return String.Format("api/{0}/{1}", (If(String.IsNullOrEmpty(RouteController), GetRoutbyclass(), RouteController)), path)
Else
Return String.Format("{0}{1}", FullRoute, path)
End If
End Function
Public Sub New(ByVal domainApi As String, ByVal Optional authorization As String = Nothing, ByVal Optional fullRoute As String = Nothing)
If String.IsNullOrEmpty(domainApi) Then
domainApi = "http://localhost:4001/"
End If
Me.authorization = authorization
Me.domainApi = domainApi
Me.FullRoute = fullRoute
End Sub
Public Async Function getDataAsync(Of T As {Class, New})(ByVal path As String, ByVal requestobject As Object, ByVal Optional reqmet As requestMethod = requestMethod.POST, ByVal Optional needauthorization As Boolean = True, ByVal Optional isfullpath As Boolean = False) As Task(Of T)
Dim objreturn As T = Nothing
Using client As HttpClient = New HttpClient()
client.BaseAddress = New Uri(domainApi)
client.DefaultRequestHeaders.Accept.Add(New MediaTypeWithQualityHeaderValue("application/json"))
If needauthorization Then
client.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue("Bearer", authorization)
End If
client.Timeout = TimeSpan.FromMinutes(15)
Dim response As HttpResponseMessage = New HttpResponseMessage()
Dim strjsonreq = Newtonsoft.Json.JsonConvert.SerializeObject(requestobject)
Dim content As StringContent = New StringContent(strjsonreq, Encoding.UTF8, "application/json")
Dim route As String = If(isfullpath, path, GetRoute(path))
Try
Select Case reqmet
Case requestMethod.POST
response = Await client.PostAsync(route, content)
Case requestMethod.[GET]
response = Await client.GetAsync(route)
End Select
If response.IsSuccessStatusCode Then
Dim jsondata As String = Await response.Content.ReadAsStringAsync()
Dim settings As Newtonsoft.Json.JsonSerializerSettings = New Newtonsoft.Json.JsonSerializerSettings With {
.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
.MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore
}
objreturn = Newtonsoft.Json.JsonConvert.DeserializeObject(Of T)(jsondata, settings)
Else
End If
Catch e As Exception
End Try
End Using
Return objreturn
End Function
Public Function getData(Of T As {Class, New})(ByVal path As String, ByVal requestobject As Object, ByVal Optional reqmet As requestMethod = requestMethod.POST, ByVal Optional needauthorization As Boolean = True, ByVal Optional isfullpath As Boolean = False) As T
Return AsyncHelper.RunSync(Of T)(Function() getDataAsync(Of T)(path, requestobject, reqmet, needauthorization, isfullpath))
End Function
End Class
Friend Module AsyncHelper
Private ReadOnly _myTaskFactory As TaskFactory = New TaskFactory(CancellationToken.None, TaskCreationOptions.None, TaskContinuationOptions.None, TaskScheduler.[Default])
Function RunSync(Of TResult)(ByVal func As Func(Of Task(Of TResult))) As TResult
'Return AsyncHelper._myTaskFactory.StartNew(Of Task(Of TResult))(func).Unwrap(Of TResult)().GetAwaiter().GetResult()
Return AsyncHelper._myTaskFactory.StartNew(Of Task(Of TResult))(func).Unwrap().GetAwaiter().GetResult()
End Function
Sub RunSync(ByVal func As Func(Of Task))
AsyncHelper._myTaskFactory.StartNew(Of Task)(func).Unwrap().GetAwaiter().GetResult()
End Sub
End Module
End Namespace

View File

@@ -331,12 +331,14 @@
<div class="row">
<div class="col-md-6" runat="server" id="DVCartera" visible="false">
<asp:GridView ID="GvCartera" runat="server" AutoGenerateColumns="False" Width="100%" EmptyDataText="No se encontraron datos" ToolTip="Listado de Ventas" CssClass="ScrollAD table table-striped table-hover Widthall" GridLines="None">
<asp:GridView ID="GvCartera" runat="server" AutoGenerateColumns="False" Width="460px" EmptyDataText="No se encontraron datos" ToolTip="Listado de Ventas" CssClass=" table table-striped table-hover Widthall"
DataKeyNames="Rango"
GridLines="None">
<Columns>
<asp:BoundField HeaderText="Rango Días" DataField="Rango" />
<asp:BoundField HeaderText="Importe" DataField="Saldo" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="%" DataField="Porcentaje" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Objetivo" DataField="Objetivo" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Rango Días" DataField="Rango" ItemStyle-Width="80px" />
<asp:BoundField HeaderText="Importe" DataField="Saldo" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:BoundField HeaderText="%" DataField="Porcentaje" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="80px" />
<asp:BoundField HeaderText="Objetivo" DataField="Objetivo" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="80px" />
</Columns>
</asp:GridView>
</div>

View File

@@ -236,7 +236,7 @@ Partial Class RepCxCDetalle
CargaAsignarCobranza()
TxtFechaCobranza.Text = Now.ToShortDateString
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso UsuarioActual.CveRol = 1 Then
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
DVCartera.Visible = True
End If
@@ -1068,9 +1068,17 @@ Partial Class RepCxCDetalle
DdlClientesWS.DataBind()
DdlClientesWS.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
End If
End Sub
End Sub
Private Sub GvCartera_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvCartera.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DataKey("Rango") = "Total" Then
e.Row.Font.Bold = True
End If
End If
End Sub
#End Region
End Class

View File

@@ -1966,7 +1966,7 @@ Lugar de expedición: 83220 Hermosillo</Value>
<DataSetName>DsOC</DataSetName>
<Top>9.86624cm</Top>
<Left>0.15979cm</Left>
<Height>1.71208cm</Height>
<Height>1.71209cm</Height>
<Width>19.89025cm</Width>
<ZIndex>3</ZIndex>
<Style>
@@ -2858,7 +2858,7 @@ Lugar de expedición: 83220 Hermosillo</Value>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Versión del comprobante: 3.3</Value>
<Value>Versión del comprobante: 4.0</Value>
<Style>
<FontFamily>calibri</FontFamily>
<FontSize>9pt</FontSize>
@@ -2929,7 +2929,7 @@ Lugar de expedición: 83220 Hermosillo</Value>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Usos del CFDI "P01"(Por definir)</Value>
<Value>Usos del CFDI "CN01" Nómina</Value>
<Style>
<FontFamily>calibri</FontFamily>
<FontSize>9pt</FontSize>
@@ -4462,7 +4462,7 @@ Lugar de expedición: 83220 Hermosillo</Value>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Parameters!MetodoPago.Value</Value>
<Value>PUE</Value>
<Style>
<FontFamily>Calibri</FontFamily>
<FontSize>7pt</FontSize>
@@ -4641,14 +4641,14 @@ Lugar de expedición: 83220 Hermosillo</Value>
<TablixCell />
<TablixCell>
<CellContents>
<Textbox Name="Textbox144">
<Textbox Name="Textbox5">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Forma de Pago</Value>
<Value />
<Style>
<FontFamily>arial</FontFamily>
<FontSize>7pt</FontSize>
@@ -4659,7 +4659,7 @@ Lugar de expedición: 83220 Hermosillo</Value>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox119</rd:DefaultName>
<rd:DefaultName>Textbox5</rd:DefaultName>
<Style>
<Border>
<Style>None</Style>
@@ -4674,14 +4674,14 @@ Lugar de expedición: 83220 Hermosillo</Value>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox145">
<Textbox Name="Textbox7">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Parameters!FormaPago.Value</Value>
<Value />
<Style>
<FontFamily>Calibri</FontFamily>
<FontSize>7pt</FontSize>
@@ -4692,7 +4692,7 @@ Lugar de expedición: 83220 Hermosillo</Value>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox121</rd:DefaultName>
<rd:DefaultName>Textbox7</rd:DefaultName>
<Style>
<Border>
<Style>None</Style>
@@ -4704,6 +4704,7 @@ Lugar de expedición: 83220 Hermosillo</Value>
</Style>
</Textbox>
<ColSpan>2</ColSpan>
<rd:Selected>true</rd:Selected>
</CellContents>
</TablixCell>
<TablixCell />
@@ -5285,7 +5286,7 @@ Lugar de expedición: 83220 Hermosillo</Value>
<Top>2.51578cm</Top>
<Left>0.15979cm</Left>
<Height>5.0304cm</Height>
<Width>19.84967cm</Width>
<Width>19.84968cm</Width>
<ZIndex>9</ZIndex>
<Style>
<Border>

View File

@@ -1480,6 +1480,141 @@
</asp:UpdatePanel>
</div>
</div>
<div id="DVModalPSPorCaducar" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" style="width: 900px;">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Productos Proximos a caducar</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12" style="text-align: right">
<input type="text" id="TxtBusquedaPsCaducar" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaPsCaducar','{0}')", GvModalPSPorCaducar.ClientID) %>" style="display: inline-block; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaPsCaducar','{0}')", GvModalPSPorCaducar.ClientID) %>" style="margin-top: -3px; margin-left: -13px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvModalPSPorCaducar" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Registros" ToolTip="Reporte de productos caducidad " CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" GridLines="None">
<Columns>
<asp:BoundField HeaderText="Almacén" DataField="Almacen" ItemStyle-Width="160px" />
<asp:BoundField HeaderText="Cantidad" DataField="Cantidad" DataFormatString="{0:#,###.##}" ItemStyle-Width="80px" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Producto" DataField="CodigoPS" />
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-Width="150px" />
<asp:BoundField HeaderText="Fecha Caducidad" DataField="FechaCaducidad" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-Width="90px" />
<asp:TemplateField ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Right" HeaderText="Días de Cad." Visible="false">
<ItemTemplate>
<asp:Label ID="LblTiempoCaducidad" runat="server" Text='<%# Eval("TiempoCaducidad", "{0:N0}")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
</div>
<div id="DVModalRSCOPorCaducar" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" style="width: 900px;">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Productos RSCO Proximos a Vencer</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="col-md-12" style="text-align: right">
<input type="text" id="TxtBusquedaRSCOCaducar" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaRSCOCaducar','{0}')", GvModalRSCOPorCaducar.ClientID) %>" style="display: inline-block; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaRSCOCaducar','{0}')", GvModalRSCOPorCaducar.ClientID) %>" style="margin-top: -3px; margin-left: -13px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvModalRSCOPorCaducar" runat="server" AutoGenerateColumns="False"
DataKeyNames="CvePS,CveCompuesto,CveProveedorCompra,RegistroRSCO,FechaVigenciaRSCOStr,VigenciaIndeterminadaRSCO,CveUsuario"
EmptyDataText="No se Encontraron Registros" ToolTip="Listado de Unidades" CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" Style="width: 100%" GridLines="None">
<Columns>
<asp:BoundField HeaderText="Proveedor" DataField="NombreComercial" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Producto" DataField="CodigoPS" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Compuesto" DataField="Compuesto" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Registro RSCO" DataField="RegistroRSCO" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Fecha. Vigencia" ItemStyle-HorizontalAlign="Center" DataField="FechaVigenciaRSCOStr" ItemStyle-Width="5%" />
</Columns>
</asp:GridView>
</div>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="JS" runat="Server">

View File

@@ -205,6 +205,11 @@ Partial Class Inicio
If UsuarioActual.TienePermisoProceso(271) Then MuestraVentasPUE()
If UsuarioActual.TienePermisoProceso(270) Then MuestraComprasPUE()
If UsuarioActual.TienePermisoProceso(343) Then MuestraPsProximosAVencer()
If UsuarioActual.TienePermisoProceso(344) Then MuestraRSCOProximosAVencer()
Dim EsDEV = Not UsuarioActual.Empresa.FacturaProduccion
If Not EsDEV Then
If UsuarioActual.CveUsuario.Contiene(93, 1425, 2, 1606, 1472, 100, 1918) Then MuestraInconsistencias() '100
@@ -329,6 +334,58 @@ Partial Class Inicio
GvVentasEmail.DataBind()
End Sub
Private Sub MuestraPsProximosAVencer()
Dim ObjInventarios = New ClsInventarios
If ObjInventarios.GetProductosCaducidad(-1, Now, Now.AddDays(30), -1, -1, -1, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Opcion:=2, CveCompuesto:=-1) Then
If ObjInventarios.DtResultados.Rows.Count > 0 Then
GvModalPSPorCaducar.DataSource = ObjInventarios.DtResultados
RegistraScript("$('#DVModalPSPorCaducar').modal('show');")
Else
GvModalPSPorCaducar.DataSource = Nothing
End If
Else
GvModalPSPorCaducar.DataSource = Nothing
End If
ObjInventarios.Dispose()
GvModalPSPorCaducar.DataBind()
End Sub
Private Sub MuestraRSCOProximosAVencer()
Dim ObjInventarios As New ClsInventarios
If ObjInventarios.RepCompuestosVigencia(-1, -1, Now, Now.AddDays(30), 1, UsuarioActual.CveEmpresa, True) Then
If ObjInventarios.DtResultados.Rows.Count > 0 Then
GvModalRSCOPorCaducar.DataSource = ObjInventarios.DtResultados
RegistraScript("$('#DVModalRSCOPorCaducar').modal('show');")
Else
GvModalRSCOPorCaducar.DataSource = Nothing
End If
Else
GvModalRSCOPorCaducar.DataSource = Nothing
End If
ObjInventarios.Dispose()
GvModalRSCOPorCaducar.DataBind()
End Sub
Private Sub CargaSubProyectos()
DdlSubproyectos.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
DdlSubproyectos.DataBind()

View File

@@ -82,7 +82,8 @@
</div>
<label class="col-md-1">Almacen</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlAlmacen" runat="server" CssClass="form-control input-sm select2me" DataTextField="Almacen" DataValueField="CveAlmacen"></asp:DropDownList>
<%--<asp:DropDownList ID="DdlAlmacen" runat="server" CssClass="form-control input-sm select2me" DataTextField="Almacen" DataValueField="CveAlmacen"></asp:DropDownList>--%>
<asp:ListBox ID="DdlAlmacen" SelectionMode="Multiple" CssClass="form-control ddlFiltros input-sm select2me Widthall" DataTextField="Almacen" DataValueField="CveAlmacen" Style="width: 100%;" runat="server"></asp:ListBox>
</div>
<label class="col-md-1">Moneda:</label>
<div class="col-md-2">

View File

@@ -125,19 +125,32 @@ Partial Class Inventarios_RepExistenciasCostos
DdlProductows.Visible = False
End If
DdlAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1"))
'DdlAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1)
'DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1)
'DdlAlmacen.DataBind()
'DdlAlmacen.Items.Insert(0, New ListItem("Todos", "-1"))
'DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen)
'If Not IsNothing(Request("CveAlmacen")) Then
' If DdlAlmacen.Items.FindByValue(Request("CveAlmacen").ToString) Is Nothing Then
' Dim CveAlmacen = Request("CveAlmacen").ToString
' Dim Almacen As String = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($"CveAlmacen = {Request("CveAlmacen").ToString}").Rows(0)("Almacen").ToString
' DdlAlmacen.Items.Insert(0, New ListItem(Almacen, CveAlmacen))
' End If
'End If
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("") 'GlobalDTAlmacen(UsuarioActual.CveEmpresa)
DdlAlmacen.DataBind()
DdlAlmacen.Items.Insert(0, New ListItem("Todos", "-1"))
DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen)
If Not IsNothing(Request("CveAlmacen")) Then
If DdlAlmacen.Items.FindByValue(Request("CveAlmacen").ToString) Is Nothing Then
Dim CveAlmacen = Request("CveAlmacen").ToString
Dim Almacen As String = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($"CveAlmacen = {Request("CveAlmacen").ToString}").Rows(0)("Almacen").ToString
Dim Almacen As String = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Almacen", $"CveAlmacen = {Request("CveAlmacen").ToString}")
DdlAlmacen.Items.Insert(0, New ListItem(Almacen, CveAlmacen))
End If
Else
DdlAlmacen.SelectedValuesIfExistM("-1")
End If
ddlProducto.Items.Insert(0, New ListItem("----", "-1"))
@@ -169,21 +182,23 @@ Partial Class Inventarios_RepExistenciasCostos
Dim CveMoneda As Integer = DdlMoneda.SelectedValue.ToEntero
Dim CveConcepto As Integer = DdlTipoMovimiento.SelectedValue.ToEntero
Dim CvePS As Integer = If(HFProducto.Value.ToEntero > 0, HFProducto.Value.ToEntero, -1)
Dim CveAlmacen As Integer = DdlAlmacen.SelectedValue.ToEntero
'Dim CveAlmacen As Integer = DdlAlmacen.SelectedValue.ToEntero
Dim CveClasificacion As Integer = DdlClasificacion.SelectedValue.ToEntero
Dim CveAlmacen As String = If(DdlAlmacen.GetSelectedValuesM = "", "-1", DdlAlmacen.GetSelectedValuesM)
Dim fechaI As Date = If(TxtFechaI.Text <> "", TxtFechaI.Text.ToDateTime, MinFecha)
Dim fechaF As Date = If(TxtFechaF.Text <> "", TxtFechaF.Text.ToDateTime, MaxFecha)
CargaDatos(CvePS, CveProveedor, CveMoneda, CveConcepto, fechaI, fechaF, CveAlmacen, CveClasificacion, DdlPersonal.SelectedValue.ToEntero, DdlMovs.SelectedValue.ToEntero)
End Sub
Protected Sub CargaDatos(CvePS As Integer, CveProveedor As Integer, CveMoneda As Integer, CveConcepto As Integer, FechaI As Date, FechaF As Date, CveAlmacen As String, CveClasificacion As Integer, CvePersonal As Integer, Tipo As Integer)
If CvePS > 0 Then
LnkKardex.Visible = True
LnkKardex.NavigateUrl = String.Format("/Inventarios/Kardex.aspx?CvePS={0}", CvePS)
End If
Dim ObjInventarios As New ClsInventarios
If ObjInventarios.RepExistenciasCostos(FechaI, FechaF, CveMoneda, CveProveedor, CveConcepto, CvePS, UsuarioActual.CveEmpresa, CveAlmacen, UsuarioActual.CveUsuario, CveClasificacion, CvePersonal, Tipo) Then
DtData = ObjInventarios.DtResultados

View File

@@ -0,0 +1,515 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="SolicitudesIngresoSat.aspx.cs" Inherits="SAT_SolicitudesIngresoSat" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
.dashboard-stat .visual > i {
font-size: 90px;
}
.dashboard-stat .visual > i {
opacity: 0.1;
filter: alpha(opacity=10);
}
.dashboard-stat.SigData {
color: #FFFFFF;
background-color: #3598dc;
}
.dashboard-stat.XMLData {
color: #FFFFFF;
background-color: #900;
}
.dashboard-stat.SigData .more,
.dashboard-stat.XMLData .more {
color: #FFFFFF;
background-color: rgb(0,0,0,0.4);
}
.ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) {
color: #333333;
background-color: #DDD;
font-weight: bold;
}
.reporte1 .GVSolicitudTimbreNominaGral tr td:nth-child(n+2),
.reporte1 .GVSolicitudTimbreNominaGral tr th:nth-child(n+2) {
text-align: right !important;
white-space: nowrap;
}
.reporte1 .GVSolicitudTimbreNominaGral tr th:nth-child(2)
/*,.reporte1 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(2) */ {
background-color: #900;
color: #FFF;
}
.reporte1 .GVSolicitudTimbreNominaGral tr th:nth-child(3),
.reporte1 .GVSolicitudTimbreNominaGral tr th:nth-child(4),
.reporte1 .GVSolicitudTimbreNominaGral tr th:nth-child(5) /*,
.reporte1 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(3),
.reporte1 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(4),
.reporte1 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(5)*/ {
background-color: #3598dc;
color: #FFF;
}
.reporte2 .GVSolicitudTimbreNominaGral tr td:nth-child(n+2),
.reporte2 .GVSolicitudTimbreNominaGral tr th:nth-child(n+2) {
text-align: right !important;
white-space: nowrap;
}
.reporte2 .GVSolicitudTimbreNominaGral tr th:nth-child(2) /*,
.reporte2 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(2)*/ {
background-color: #900;
color: #FFF;
}
.reporte2 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3):not(:nth-child(7)) /*,
.reporte2 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(n+3):not(:nth-child(7))*/ {
background-color: #3598dc;
color: #FFF;
}
.reporte3 .GVSolicitudTimbreNominaGral tr td:nth-child(n+3) {
white-space: nowrap;
}
.reporte3 .GVSolicitudTimbreNominaGral tr td:nth-child(4),
.reporte3 .GVSolicitudTimbreNominaGral tr td:nth-child(8),
.reporte3 .GVSolicitudTimbreNominaGral tr td:nth-child(9),
.reporte3 .GVSolicitudTimbreNominaGral tr td:nth-child(n+13):not(:nth-child(n+19)),
.reporte3 .GVSolicitudTimbreNominaGral tr td:nth-child(24),
.reporte3 .GVSolicitudTimbreNominaGral tr td:nth-child(n+28):not(:nth-child(n+33)) {
text-align: right !important;
}
.reporte3 .GVSolicitudTimbreNominaGral tr th:nth-child(2),
.reporte3 .GVSolicitudTimbreNominaGral tr th:nth-child(n+20) /*,
.reporte3 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(2),
.reporte3 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(n+20)*/ {
background-color: #900;
color: #FFF;
}
.reporte3 .GVSolicitudTimbreNominaGral tr th:nth-child(1),
.reporte3 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3):not(:nth-child(n+20)) /*,
.reporte3 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(1),
.reporte3 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(n+3):not(:nth-child(n+20))*/ {
background-color: #3598dc;
color: #FFF;
}
.reporte4 .GVSolicitudTimbreNominaGral tr td:nth-child(n+2),
.reporte4 .GVSolicitudTimbreNominaGral tr th:nth-child(n+2) {
text-align: right !important;
white-space: nowrap;
}
.reporte4 .GVSolicitudTimbreNominaGral tr th:nth-child(2) /*,
.reporte4 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(2)*/ {
background-color: #900;
color: #FFF;
}
.reporte4 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3):not(:nth-child(n+6)) /*,
.reporte4 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(n+3)*/ {
background-color: #3598dc;
color: #FFF;
}
.reporte5 .GVSolicitudTimbreNominaGral tr th:nth-child(2) /*,
.reporte5 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(2)*/ {
background-color: #900;
color: #FFF;
}
.reporte5 .GVSolicitudTimbreNominaGral tr th:nth-child(3) /*,
.reporte5 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(3)*/ {
background-color: #3598dc;
color: #FFF;
}
.reporte6 .GVSolicitudTimbreNominaGral tr td:nth-child(n) {
white-space: nowrap;
}
.reporte6 .GVSolicitudTimbreNominaGral tr td:nth-child(n+4),
.reporte6 .GVSolicitudTimbreNominaGral tr th:nth-child(n+4) {
text-align: right !important;
}
.reporte6 .GVSolicitudTimbreNominaGral tr th:nth-child(n+4):not(:nth-child(n+7)) {
background-color: #900;
color: #FFF;
}
.reporte6 .GVSolicitudTimbreNominaGral tr th:nth-child(n+7):not(:nth-child(n+10)) {
background-color: #3598dc;
color: #FFF;
}
.reporte7 .GVSolicitudTimbreNominaGral tr td:nth-child(n+3),
.reporte7 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3) {
text-align: right !important;
}
.reporte7 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3):not(:nth-child(n+6)) {
background-color: #900;
color: #FFF;
}
.reporte7 .GVSolicitudTimbreNominaGral tr th:nth-child(n+6):not(:nth-child(n+9)) {
background-color: #3598dc;
color: #FFF;
}
.reporte8 .GVSolicitudTimbreNominaGral tr td:nth-child(n+6),
.reporte8 .GVSolicitudTimbreNominaGral tr th:nth-child(n+6) {
text-align: right !important;
}
.reporte8 .GVSolicitudTimbreNominaGral tr th:nth-child(n+6):not(:nth-child(n+9)) {
background-color: #900;
color: #FFF;
}
.reporte8 .GVSolicitudTimbreNominaGral tr th:nth-child(n+9):not(:nth-child(n+12)) {
background-color: #3598dc;
color: #FFF;
}
.reporte9 .GVSolicitudTimbreNominaGral tr td:nth-child(1),
.reporte9 .GVSolicitudTimbreNominaGral tr td:nth-child(4) {
white-space: nowrap;
}
.reporte9 .GVSolicitudTimbreNominaGral tr td:nth-child(2),
.reporte9 .GVSolicitudTimbreNominaGral tr td:nth-child(3),
.reporte9 .GVSolicitudTimbreNominaGral tr td:nth-child(n+40) {
text-align: right !important;
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
Visor solicitudes Ingreso
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<li>
<asp:LinkButton ID="LnkDownloadExcel" OnClick="LnkDownloadExcel_Click" runat="server"><i class="fa fa-download"></i>Descargar</asp:LinkButton>
</li>
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional">
<contenttemplate>
<li>
<asp:LinkButton ID="LnkShowSolicitudes" OnClick="LnkShowSolicitudes_Click" runat="server">Solicitudes</asp:LinkButton>
</li>
</contenttemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="upDatosChec" runat="server" UpdateMode="Conditional">
<contenttemplate>
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle">
<div class="titlefiltros caption">
<div class="row">
<label class="col-md-1">Agrupador: </label>
<div class="col-md-2">
<asp:DropDownList ID="DdlReporte" runat="server" Style="width: 100% !important;" CssClass="select2me" DataValueField="CveUsuario" DataTextField="Nombre">
<asp:ListItem Value="1" Text="Por Mes"></asp:ListItem>
<asp:ListItem Value="2" Text="Por Comprobante"></asp:ListItem>
</asp:DropDownList>
</div>
<label class="col-md-1 mediocol">Fecha inicio:</label>
<div class="col-md-2">
<%--<asp:TextBox ID="TxtPeriodoInicio" Text="0" CssClass="form-control" runat="server"></asp:TextBox>--%>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 138px !important; padding: 0px; margin-bottom: -10px;">
<asp:TextBox ID="TxtRpdFechaInicio" CssClass="form-control input-sm ADSMaskDate" Style="width: 80px" runat="server"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkRpdFechaInicio" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:maskededitextender id="MaskedEditExtender3" runat="server" targetcontrolid="TxtRpdFechaInicio" mask="99/99/9999" masktype="Date" displaymoney="Left" acceptnegative="Left"></ajax:maskededitextender>
<ajax:calendarextender runat="server" id="CalendarExtender3" targetcontrolid="TxtRpdFechaInicio" popupbuttonid="LnkRpdFechaInicio" popupposition="BottomRight" enabled="True" format="dd/MM/yyyy"></ajax:calendarextender>
<asp:RequiredFieldValidator ID="rfvRpdFechaInicio" runat="server" ControlToValidate="TxtRpdFechaInicio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Inicio''</b> es necesario, por favor ingréselo." ValidationGroup="VGReporterepperde"></asp:RequiredFieldValidator>
<ajax:validatorcalloutextender id="ValidatorCalloutExtender1" runat="server" highlightcssclass="vco" targetcontrolid="rfvRpdFechaInicio"></ajax:validatorcalloutextender>
</div>
</div>
<label class="col-md-1 mediocol">Fecha fin:</label>
<div class="col-md-2">
<%--<asp:TextBox ID="TxtPeriodoFin" Text="99" CssClass="form-control" runat="server"></asp:TextBox>--%>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 138px !important; padding: 0px; margin-bottom: -10px;">
<asp:TextBox ID="TxtRpdFechaFin" CssClass="form-control input-sm ADSMaskDate" Style="width: 80px" runat="server"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkFechaFin" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:maskededitextender id="MaskedEditExtender5" runat="server" targetcontrolid="TxtRpdFechaFin" mask="99/99/9999" masktype="Date" displaymoney="Left" acceptnegative="Left"></ajax:maskededitextender>
<ajax:calendarextender runat="server" id="CalendarExtender4" targetcontrolid="TxtRpdFechaFin" popupbuttonid="LnkFechaFin" popupposition="BottomRight" enabled="True" format="dd/MM/yyyy"></ajax:calendarextender>
<asp:RequiredFieldValidator ID="rfvRpdFechaFin" runat="server" ControlToValidate="TxtRpdFechaFin" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Fin''</b> es necesario, por favor ingréselo." ValidationGroup="VGReporterepperde"></asp:RequiredFieldValidator>
<ajax:validatorcalloutextender id="ValidatorCalloutExtender2" runat="server" highlightcssclass="vco" targetcontrolid="rfvRpdFechaFin"></ajax:validatorcalloutextender>
</div>
</div>
<div class="col-md-2" style="text-align:right">
<asp:LinkButton ID="LnkConsultar" OnClick="LnkConsultar_Click" runat="server" Text="Consultar" Visible="true" class="btn btn-primary" />
</div>
</div>
</div>
<div class="tools">
<a href="javascript:;" class="expand" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body" style="display: none">
</div>
</div>
<div class="portlet light xspadding bordered " id="pnldl">
<div class="portlet-title">
<div class="caption ">
<i class="fa fa-bookmark font-blue"></i>
<span class="caption-subject font-blue bold uppercase">Información timbre fiscal </span>
</div>
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>
</div>
<div style="float: right;">
<asp:TextBox CssClass="TxtBusqueda form-control input-sm" runat="server" onkeyup="FiltrarTablaV2('.TxtBusqueda','.ADScroller-body .GVSolicitudTimbreNominaGral')" Style="display: inline-block; margin-right: -20px; width: 150px;"></asp:TextBox>
<a href="javascript:;" onclick="FiltrarTablaV2('.TxtBusqueda','.ADScroller-body .GVSolicitudTimbreNominaGral')" style="margin-top: -3px;" class="btn btn-circle btn-sm font-bold blue"><i class="icon-magnifier" style="font-weight: bold;"></i></a>
</div>
</div>
<div class='portlet-body nomarginleftright form-horizontal form-row-sepe formnombottom <%= clasegrid %>'>
<asp:GridView ID="GvSolicitudesIngreso" runat="server" GridLines="None" CssClass="table table-hover table-striped ScrollAD Widthall GVSolicitudTimbreNominaGral" AutoGenerateColumns="true">
<columns></columns>
</asp:GridView>
</div>
</div>
</contenttemplate>
</asp:UpdatePanel>
<div id="ModalViewSolicitudes" class="modal ADS fade" role="dialog">
<asp:UpdatePanel ID="UPModalViewSolicitudes" class="modal-dialog rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<contenttemplate>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Solicitudes CFDI</h4>
</div>
<div class="modal-body">
<br />
<div class="portlet light xspadding bordered " id="PnlAgregar">
<div class="portlet-title">
<div class="caption ">
<i class="fa fa-bookmark font-blue"></i>
<span class="caption-subject font-blue bold uppercase">Solicitar información al sat</span>
</div>
<div class="tools">
<a href="javascript:;" class="expand" data-original-title="" title=""></a>
<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body nomarginleftright form-horizontal form-row-sepe formnombottom " style="display: none">
<div class="row">
<div class="col-md-4">
<asp:Label runat="server" Text="Fecha Inicio" AssociatedControlID="txtFechaIAdd"></asp:Label>
</div>
<div class="col-md-4">
<asp:Label runat="server" Text="Fecha Fin" AssociatedControlID="txtFechaFAdd"></asp:Label>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 138px !important; padding: 0px; margin-bottom: -10px;">
<asp:TextBox ID="txtFechaIAdd" CssClass="form-control input-sm ADSMaskDate" Style="" runat="server"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkFechaIAdd" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:maskededitextender id="MEEFechaIAdd" runat="server" targetcontrolid="txtFechaIAdd" mask="99/99/9999" masktype="Date" displaymoney="Left" acceptnegative="Left"></ajax:maskededitextender>
<ajax:calendarextender runat="server" id="CalendarExtender1" targetcontrolid="txtFechaIAdd" popupbuttonid="LnkFechaIAdd" popupposition="BottomRight" enabled="True"></ajax:calendarextender>
<asp:RequiredFieldValidator ID="rfvFechaIAdd" runat="server" ControlToValidate="txtFechaIAdd" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="VGAdd"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaIAdd" runat="server" ControlToValidate="txtFechaIAdd" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:validatorcalloutextender id="ValidatorCalloutExtender3" runat="server" highlightcssclass="vco" targetcontrolid="rfvFechaIAdd" width="350px"></ajax:validatorcalloutextender>
<ajax:validatorcalloutextender id="ValidatorCalloutExtender4" runat="server" highlightcssclass="vco" targetcontrolid="cvFechaIAdd" width="350px"></ajax:validatorcalloutextender>
</div>
</div>
<div class="col-md-4">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 138px !important; padding: 0px; margin-bottom: -10px;">
<asp:TextBox ID="txtFechaFAdd" CssClass="form-control input-sm ADSMaskDate" Style="" runat="server"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkFechaFAdd" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:maskededitextender id="MEEFechaFAdd" runat="server" targetcontrolid="txtFechaFAdd" mask="99/99/9999" masktype="Date" displaymoney="Left" acceptnegative="Left"></ajax:maskededitextender>
<ajax:calendarextender runat="server" id="CalendarExtender2" targetcontrolid="txtFechaFAdd" popupbuttonid="LnkFechaFAdd" popupposition="BottomRight" enabled="True"></ajax:calendarextender>
<asp:RequiredFieldValidator ID="rfvFechaFAdd" runat="server" ControlToValidate="txtFechaFAdd" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="VGAdd"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaFAdd" runat="server" ControlToValidate="txtFechaFAdd" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:validatorcalloutextender id="ValidatorCalloutExtender5" runat="server" highlightcssclass="vco" targetcontrolid="rfvFechaFAdd" width="350px"></ajax:validatorcalloutextender>
<ajax:validatorcalloutextender id="ValidatorCalloutExtender6" runat="server" highlightcssclass="vco" targetcontrolid="cvFechaFAdd" width="350px"></ajax:validatorcalloutextender>
</div>
</div>
<div class="col-md-4">
<div class="text-right">
<asp:LinkButton ID="LnkSolicitarSat" CssClass="btn btn-primary" OnClick="LnkSolicitarSat_Click" runat="server">Solicitar</asp:LinkButton>
</div>
</div>
</div>
</div>
</div>
<div class="portlet light xspadding bordered " id="PnlPendientes">
<div class="portlet-title">
<div class="caption ">
<i class="fa fa-bookmark font-blue"></i>
<span class="caption-subject font-blue bold uppercase">Solicitudes pendientes de respuesta del SAT </span>
</div>
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body nomarginleftright form-horizontal form-row-sepe formnombottom ">
<asp:GridView ID="GVSolicitudesPendientes" runat="server" GridLines="None" CssClass="table table-hover table-striped ScrollAD Widthall" AutoGenerateColumns="False"
ShowHeaderWhenEmpty="true" EmptyDataText="No se encontraron registros"
DataKeyNames="CveSolicitud,CveSolicitudCFDI,CveSolicitudMetadata,Estatus,Observaciones,FechaInicio,FechaFin,FechaIng,CveUsuarioIng,CveEmpresa">
<columns>
<asp:TemplateField HeaderText="Folio">
<itemtemplate>
<asp:Label runat="server" Text='<%# Eval("CveSolicitud")%>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Inicio">
<itemtemplate>
<asp:Label ID="lblfechaInicio" runat="server" Text='<%# Eval("FechaInicio","{0:dd/MM/yyyy}")%>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Fin">
<itemtemplate>
<asp:Label ID="lblfechaFin" runat="server" Text='<%# Eval("FechaFin","{0:dd/MM/yyyy}")%>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Estatus">
<itemtemplate>
<asp:Label ID="lblestatus" runat="server" Text='<%# Eval("EstatusText")%>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Observaciones">
<itemtemplate>
<asp:Label ID="lblobservaciones" runat="server" Text='<%# Eval("Observaciones")%>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha solicitud">
<itemtemplate>
<asp:Label runat="server" Text='<%# Eval("FechaIng","{0:dd/MM/yyyy HH:mm}")%>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Solicitó">
<itemtemplate>
<asp:Label runat="server" Text='<%# Eval("UsuarioIng")%>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
</columns>
</asp:GridView>
</div>
</div>
<div class="portlet light xspadding bordered " id="PnlTerminads">
<div class="portlet-title">
<div class="caption ">
<i class="fa fa-bookmark font-blue"></i>
<span class="caption-subject font-blue bold uppercase">solicitudes respondidas por el sat</span>
</div>
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body nomarginleftright form-horizontal form-row-sepe formnombottom ">
<asp:GridView ID="GVSolicitudesNominas" runat="server" GridLines="None" CssClass="table table-hover table-striped ScrollAD Widthall" AutoGenerateColumns="False"
ShowHeaderWhenEmpty="true" EmptyDataText="No se encontraron registros"
DataKeyNames="CveSolicitud,idSolicitudCFDI,idSolicitudMetadata,Estatus,Observaciones,FechaInicio,FechaFin,FechaIng,CveUsuarioIng,CveEmpresa">
<columns>
<asp:TemplateField HeaderText="Folio">
<itemtemplate>
<asp:Label runat="server" Text='<%# Eval("CveSolicitud")%>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Inicio">
<itemtemplate>
<asp:Label ID="lblfechaInicio" runat="server" Text='<%# Eval("FechaInicio","{0:dd/MM/yyyy}")%>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Fin">
<itemtemplate>
<asp:Label ID="lblfechaFin" runat="server" Text='<%# Eval("FechaFin","{0:dd/MM/yyyy}")%>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="No CFDI">
<itemtemplate>
<asp:Label ID="lblobservaciones" runat="server" Text='<%# Eval("numeroCFDIs")%>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Observaciones">
<itemtemplate>
<asp:Label ID="lblobservaciones" runat="server" Text='<%# Eval("Observaciones")%>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha solicitud">
<itemtemplate>
<asp:Label runat="server" Text='<%# Eval("FechaIng","{0:dd/MM/yyyy HH:mm}")%>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Solicitó">
<itemtemplate>
<asp:Label runat="server" Text='<%# Eval("UsuarioIng")%>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
</columns>
</asp:GridView>
</div>
</div>
</div>
<div class="modal-footer">
<asp:LinkButton ID="LnkverificarSolicitudes" CssClass="btn btn-primary" OnClick="LnkverificarSolicitudes_Click" runat="server">Verificar pendientes</asp:LinkButton>
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</div>
</contenttemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>

View File

@@ -0,0 +1,534 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Extensiones;
using Newtonsoft.Json.Linq;
public partial class SAT_SolicitudesIngresoSat : ClsPaginas
{
#region Propiedades
public string clasegrid
{
get
{
if (ViewState["clasegrid"] == null) { return ""; }
else { return ViewState["clasegrid"].ToString(); }
}
set { ViewState["clasegrid"] = value; }
}
public string fechaInicio
{
get
{
if (ViewState["fechaInicio"] == null) { return ""; }
else { return ViewState["fechaInicio"].ToString(); }
}
set { ViewState["fechaInicio"] = value; }
}
public string fechaFin
{
get
{
if (ViewState["fechaFin"] == null) { return ""; }
else { return ViewState["fechaFin"].ToString(); }
}
set { ViewState["fechaFin"] = value; }
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
TxtRpdFechaInicio.Text = string.Format("01/{0:MM/yyyy}", DateTime.Now.AddMonths(-1));
TxtRpdFechaFin.Text = string.Format("{0:dd/MM/yyyy}", DateTime.Now.AddMonths(-1).LastDayOfMonth());
//LnkConsultar_Click(null, null);
}
}
protected void LnkDownloadExcel_Click(object sender, EventArgs e)
{
using (ClsNominas nom = new ClsNominas())
{
nom.SATSolicitudTimbreNominaGral(DdlReporte.SelectedValue.ToString().ToEntero(), UsuarioActual.CveEmpresa, fechaInicio, fechaFin);
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
var libro = wb.AddWorksheet(nom.DtResultados , "Nomina");
libro.ColumnsUsed().AdjustToContents();
libro.Range(1, 1, 1, nom.DtResultados.Columns.Count).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 153, 153));
switch (DdlReporte.SelectedValue.ToString().ToEntero())
{
case 1:
libro.Range(1, 2, 1, 2).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153,0,0));
libro.Range(1, 3, 1, 5).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 2:
libro.Range(1, 2, 1, 2).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 3, 1, 6).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
libro.Range(1, 8, 1, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 3:
libro.Range(1, 1, 1, 10).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
libro.Range(1, 11, 1, nom.DtResultados.Columns.Count).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
break;
case 4:
libro.Range(1, 2, 1, 2).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 3, 1, 5).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 5:
libro.Range(1, 2, 1, 2).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 3, 1, 3).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 6:
libro.Range(1, 4, 1, 6).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 7, 1, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 7:
libro.Range(1, 3, 1, 5).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 6, 1, 8).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 8:
libro.Range(1, 6, 1, 8).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 9, 1, 12).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 9:
break;
default:
break;
}
libro.Row(1).InsertRowsAbove(4);
libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa;
libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de {DdlReporte.SelectedItem.Text }";
libro.Range(3, 2, 3, 6).Merge().Value = $"del {fechaInicio.ToDateTime():dd/MM/yyyy} al {fechaFin.ToDateTime():dd/MM/yyyy}";
libro.Range(2, 7, 2, 9).Merge().Value = $"Fecha:{DateTime.Now:dd/MM/yyyy}";
libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now:HH:mm}";
System.IO.Stream fs = new System.IO.MemoryStream();
wb.SaveAs(fs);
fs.Position = 0;
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
using (System.IO.Stream input = fs)
{
input.CopyTo(memoryStream);
}
memoryStream.Position = 0;
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.xlsx", $"Visor nómina ( Reporte :{DdlReporte.SelectedValue}) "));
Response.BinaryWrite(memoryStream.ToArray());
Response.End();
}
}
protected void LnkConsultar_Click(object sender, EventArgs e)
{
using (ClsNominas nom = new ClsNominas())
{
fechaInicio = TxtRpdFechaInicio.Text.ToDateTime().ToString("yyyy/MM/dd");
fechaFin = TxtRpdFechaFin.Text.ToDateTime().ToString("yyyy/MM/dd");
nom.SATSolicitudTimbreNominaGral(0, UsuarioActual.CveEmpresa, fechaInicio, fechaFin);
if (nom.DtResultados.Rows.Count > 0)
{
DataRow drow = nom.DtResultados.Rows[0];
//LtlTimbreFiscalTotal.Text = string.Format("{0:N0}", drow["NOXml"]);
//LtlTimbreFiscalActivos.Text = string.Format("{0:N0}", drow["NOXmlActivos"]);
//LtlTimbreFiscalCancelados.Text = string.Format("{0:N0}", drow["NOXml"].ToString().ToEntero() - drow["NOXmlActivos"].ToString().ToEntero());
//LtlSobrerecibosTotal.Text = string.Format("{0:N0}", drow["NOXmlSig"]);
//LtlSobrerecibosTimbrados.Text = string.Format("{0:N0}", drow["Timbrados"]);
//LtlSobrerecibosSintimbrar.Text = string.Format("{0:N0}", drow["SinTimbrar"]);
}
nom.SATSolicitudTimbreNominaGral(DdlReporte.SelectedValue.ToString().ToEntero(), UsuarioActual.CveEmpresa, fechaInicio, fechaFin);
//GvSolicitudesIngreso.DataSource = nom.DtResultados;
//GvSolicitudesIngreso.DataBind();
clasegrid = string.Format("reporte{0}", DdlReporte.SelectedValue);
}
upDatosChec.Update();
//SATSolicitudTimbreNominaGral
}
private void cargasolicitudes()
{
using (ClsNominas nom = new ClsNominas())
{
if (nom.SolicitudesGet(-1, UsuarioActual.CveEmpresa,CveTipoSolicitud:3))
{
GVSolicitudesPendientes.DataSource = nom.DtResultados.FiltraParametros("Estatus =0");
GVSolicitudesPendientes.DataBind();
GVSolicitudesNominas.DataSource = nom.DtResultados.FiltraParametros("Estatus =1");
GVSolicitudesNominas.DataBind();
}
}
UPModalViewSolicitudes.Update();
}
protected void LnkShowSolicitudes_Click(object sender, EventArgs e)
{
cargasolicitudes();
this.RegistraScript("$('#ModalViewSolicitudes').modal();");
}
protected void LnkSolicitarSat_Click(object sender, EventArgs e)
{
int idSolicitudCFDI = 0;
int idSolicitudMetadata = 0;
int estatus = 0;
string observaciones = "";
DateTime fechaInicio = txtFechaIAdd.Text.ToDateTime();
DateTime fechaFin = txtFechaFAdd.Text.ToDateTime();
int cveUsuarioIng = UsuarioActual.CveUsuario;
int cveEmpresa = UsuarioActual.CveEmpresa;
bool Continuar = false;
using (ClsNominas nom = new ClsNominas())
{
Continuar = nom.SolicitudesAdd(idSolicitudCFDI, idSolicitudMetadata, estatus, observaciones, fechaInicio, fechaFin, cveUsuarioIng, cveEmpresa, CveTipoSolicitud:3);
}
if (Continuar)
{
StringBuilder sbResultado = new StringBuilder();
var api = new GeneralesAPI();
JToken ObjApiSolicitud = (JToken) api.GeneraSolicitud(UsuarioActual.CveEmpresa, 3);
List<string> resultSolicitud = ObjApiSolicitud.Select(token => token.Values().Aggregate((i, j) => $"{i}|{j}").Value<string>()).ToList();
List<string> resultVerificacion = new List<string>();
var ResultadoSolicitudOK = bool.Parse(resultSolicitud[0]);
var ResultadoVerificaionOK = false;
var SeVerifico = false;
if (ResultadoSolicitudOK)
{
JToken ObjApiVerificacion = (JToken) api.VerificaSolicitudesNominas(UsuarioActual.CveEmpresa, 3);
resultVerificacion = ObjApiVerificacion.Select(token => token.Values().Aggregate((i, j) => $"{i}|{j}").Value<string>()).ToList();
ResultadoVerificaionOK = bool.Parse(resultVerificacion[0]);
SeVerifico = true;
}
if (resultSolicitud.Count == 4)
{
if (ResultadoSolicitudOK)
{
sbResultado.Append($"Solicitud Generada Correctamente <br/> {resultSolicitud[2]}");
}
else
{
sbResultado.Append($"Se presento un error al generar la solicitud <br/> {resultSolicitud[2]}");
}
}
else
{
sbResultado.AppendLine("Se presento un error al generar la solicitud (API) <br/>");
}
if (SeVerifico && resultVerificacion.Count == 4)
{
if (ResultadoVerificaionOK)
{
sbResultado.Append($"Verificación ejecutada correctamente <br/> {resultSolicitud[2]}");
}
else
{
sbResultado.Append($"Se presento un error al verificar las solicitudes <br/> {resultSolicitud[2]}");
}
}
else
{
sbResultado.AppendLine("Se presento un error al verificar las solicitudes (API) <br/>");
}
Alert(sbResultado.ToString());
}
if (Continuar)
{
txtFechaIAdd.Text = "";
txtFechaFAdd.Text = "";
this.RegistraScript("$('#DModalSolicitudesNominas').modal('hide');");
cargasolicitudes();
this.Alert("se a envia la solicitud al sat, le enviaremos un correo en cuanto tengamos una respuesta", ModExtensiones.TipoMensaje.ToastInformacion);
}
}
protected void LnkverificarSolicitudes_Click(object sender, EventArgs e)
{
//var api = new GeneralesAPI();
//api.GeneraSolicitud();
//api.VerificaSolicitudesNominas();
StringBuilder sbResultado = new StringBuilder();
var api = new GeneralesAPI();
JToken ObjApiSolicitud = (JToken)api.GeneraSolicitud(UsuarioActual.CveEmpresa, 3);
List<string> resultSolicitud = ObjApiSolicitud.Select(token => token.Values().Aggregate((i, j) => $"{i}|{j}").Value<string>()).ToList();
List<string> resultVerificacion = new List<string>();
var ResultadoSolicitudOK = bool.Parse(resultSolicitud[0]);
var ResultadoVerificaionOK = false;
var SeVerifico = false;
if (ResultadoSolicitudOK)
{
JToken ObjApiVerificacion = (JToken)api.VerificaSolicitudesNominas(UsuarioActual.CveEmpresa, 3);
resultVerificacion = ObjApiVerificacion.Select(token => token.Values().Aggregate((i, j) => $"{i}|{j}").Value<string>()).ToList();
ResultadoVerificaionOK = bool.Parse(resultVerificacion[0]);
SeVerifico = true;
}
if (resultSolicitud.Count == 4)
{
if (ResultadoSolicitudOK)
{
sbResultado.Append($"Solicitud Generada Correctamente <br/> {resultSolicitud[2]}");
}
else
{
sbResultado.Append($"Se presento un error al generar la solicitud <br/> {resultSolicitud[2]}");
}
}
else
{
sbResultado.AppendLine("Se presento un error al generar la solicitud (API) <br/>");
}
if (SeVerifico && resultVerificacion.Count == 4)
{
if (ResultadoVerificaionOK)
{
sbResultado.Append($"Verificación ejecutada correctamente <br/> {resultSolicitud[2]}");
}
else
{
sbResultado.Append($"Se presento un error al verificar las solicitudes <br/> {resultSolicitud[2]}");
}
}
else
{
sbResultado.AppendLine("Se presento un error al verificar las solicitudes (API) <br/>");
}
Alert(sbResultado.ToString());
cargasolicitudes();
}
}
public class GeneralesAPI : ADSNetLibraryzI.HelpersI.ConexionesI.SIGAPII.BaseSIGAPII
{
public GeneralesAPI(string domainApi = "http://localhost:4001/", string token = "") : base(domainApi, token) { }
public object GeneraSolicitud(int CveEmpresa, int CveTipoSolicitud)
{
return getData<object>($"GeneraSolicitud/{CveEmpresa}/{CveTipoSolicitud}", null, ADSNetLibraryzI.HelpersI.ConexionesI.SIGAPII.requestMethod.GET,false);
}
public object VerificaSolicitudesNominas(int CveEmpresa, int CveTipoSolicitud)
{
return getData<object>($"VerificaSolicitudesNominas/{CveEmpresa}/{CveTipoSolicitud}", null, ADSNetLibraryzI.HelpersI.ConexionesI.SIGAPII.requestMethod.GET, false);
}
}
namespace ADSNetLibraryzI.HelpersI.ConexionesI.SIGAPII
{
public enum requestMethod
{
POST = 1,
GET = 2
}
public class BaseSIGAPII
{
private const string tituloLog = "ADSNetLibrary.Helpers.Conexiones.SIGAPI";
public string domainApi;
public string authorization;
protected string RouteController = "";
protected string FullRoute = "";
public string GetRoutbyclass() {
string classname = this.GetType().Name;
return classname.Substring(0, classname.Length - 3);
}
public string GetRoute(string path)
{
if (string.IsNullOrEmpty(FullRoute))
{
return string.Format("api/{0}/{1}", (string.IsNullOrEmpty(RouteController) ? GetRoutbyclass() : RouteController), path);
}
else
{
return string.Format("{0}{1}", FullRoute, path);
}
}
/// <summary>
/// nueva instancia de conexion para una api
/// </summary>
/// <param name="domainApi"> url de la api</param>
/// <param name="authorization"> llenar si se tiene si se desea obtner usuar campos usuario y pasword</param>
public BaseSIGAPII(string domainApi, string authorization = null, string fullRoute = null)
{
if (string.IsNullOrEmpty(domainApi))
{
domainApi = "http://localhost:4001/";//"http://jam.adssistemas.mx:4001/";//Helpers.ModVars.UrlApi;
}
this.authorization = authorization;
this.domainApi = domainApi;
this.FullRoute = fullRoute;
}
/// <summary>
/// Obtiene datos de la api asincrono.
/// </summary>
/// <typeparam name="T">Clase genérica en donde se obtiene la información del SqlDataReader.</typeparam>
/// <param name="path">ruta sin domino ejemplo "/api/usuarios/login".</param>
/// <param name="requestobject">request object.</param>
/// <returns>Lista de objetos.</returns>
public async Task<T> getDataAsync<T>(string path, object requestobject, requestMethod reqmet = requestMethod.POST, bool needauthorization = true, bool isfullpath = false) where T : class, new()
{
T objreturn = null;
using (
HttpClient client = new HttpClient())
{
// Setting Base address.
client.BaseAddress = new Uri(domainApi);
// Setting content type.
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Setting Authorization.
if (needauthorization) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authorization); }
client.Timeout = TimeSpan.FromMinutes(15);
HttpResponseMessage response = new HttpResponseMessage();
var strjsonreq = Newtonsoft.Json.JsonConvert.SerializeObject(requestobject);
StringContent content = new StringContent(strjsonreq, Encoding.UTF8, "application/json");
string route = isfullpath ? path : GetRoute(path);
try
{
switch (reqmet)
{
case requestMethod.POST:
response = await client.PostAsync(route, content);
break;
case requestMethod.GET:
response = await client.GetAsync(route);
break;
}
if (response.IsSuccessStatusCode)
{
string jsondata = await response.Content.ReadAsStringAsync();
Newtonsoft.Json.JsonSerializerSettings settings = new Newtonsoft.Json.JsonSerializerSettings
{
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore
};
objreturn = Newtonsoft.Json.JsonConvert.DeserializeObject<T>(jsondata, settings);
}
else {
//ModExtensiones.GuardaLog(string.Format("{0}{1}{2}{1}StatusCode:{3}{1}{4}{1}{5}{1}", tituloLog, ModVars.NewLine, route, response.StatusCode, response.RequestMessage, strjsonreq), ModVars.ADSNetLibraryLog);
}
}
catch (Exception e) {
//ModExtensiones.GuardaLog(string.Format("{0}{1}{2}{1}{3}{1}{4}{1}", tituloLog, ModVars.NewLine, route, e, strjsonreq), ModVars.ADSNetLibraryLog);
}
}
return objreturn;
}
/// <summary>
/// Obtiene datos de la api.
/// </summary>
/// <typeparam name="T">Clase genérica en donde se obtiene la información del SqlDataReader.</typeparam>
/// <param name="path">ruta sin domino ejemplo "/api/usuarios/login".</param>
/// <param name="requestobject">request object.</param>
/// <returns>Lista de objetos.</returns>
//public T getData<T> (string path, object requestobject, requestMethod reqmet = requestMethod.POST, bool needauthorization = true, bool isfullpath = false) where T : class, new()
public T getData<T>(string path, object requestobject, requestMethod reqmet = requestMethod.POST, bool needauthorization = true, bool isfullpath = false) where T : class, new()
{
return AsyncHelper.RunSync<T>(() => getDataAsync<T>(path, requestobject, reqmet, needauthorization, isfullpath));
}
}
internal static class AsyncHelper
{
private static readonly TaskFactory _myTaskFactory = new
TaskFactory(CancellationToken.None,
TaskCreationOptions.None,
TaskContinuationOptions.None,
TaskScheduler.Default);
public static TResult RunSync<TResult>(Func<Task<TResult>> func)
{
return AsyncHelper._myTaskFactory
.StartNew<Task<TResult>>(func)
.Unwrap<TResult>()
.GetAwaiter()
.GetResult();
}
public static void RunSync(Func<Task> func)
{
AsyncHelper._myTaskFactory
.StartNew<Task>(func)
.Unwrap()
.GetAwaiter()
.GetResult();
}
}
}