Compras mensaje IEPS, Personal descarga de documentos, efacturas correciones verificar solicitudes SAT

This commit is contained in:
rakcsle
2024-10-26 11:18:08 -07:00
parent c4b1b86110
commit 88c592c9a1
8 changed files with 135 additions and 66 deletions

View File

@@ -1428,7 +1428,7 @@ Partial Class Compras_Compras
End If End If
Next Next
If HayDifIEPS Then Alert("El porcentaje de IEPS del producto no coincide con el especificado.", TipoMensaje.MsgAdvertencia) 'If HayDifIEPS Then Alert("El porcentaje de IEPS del producto no coincide con el especificado.", TipoMensaje.MsgAdvertencia)
If UsuarioActual.Empresa.Funcionalidad(562).ToEntero > 0 Then CargaGastosServicios(UsuarioActual.Empresa.Funcionalidad(562).ToEntero) If UsuarioActual.Empresa.Funcionalidad(562).ToEntero > 0 Then CargaGastosServicios(UsuarioActual.Empresa.Funcionalidad(562).ToEntero)
@@ -1986,13 +1986,14 @@ Partial Class Compras_Compras
End If End If
End If End If
Next Next
If EmisorRegimenFiscal = "626" AndAlso Not RetISRResico AndAlso EmisorRFC.Length = 13 Then 'solo para personas físicas
If EmisorRegimenFiscal = "626" AndAlso Not RetISRResico AndAlso EmisorRFC.Length = 13 AndAlso UsuarioActual.CveEmpresa.Contiene(119, 158) Then 'solo para personas físicas
SbValRet.Append(" La factura no tiene especificado una retención de ISR, ya que el proveedor es Resico. <br/>") SbValRet.Append(" La factura no tiene especificado una retención de ISR, ya que el proveedor es Resico. <br/>")
BtnGuardar.Enabled = False BtnGuardar.Enabled = False
End If End If
If SbValRet.ToString.Trim.Length > 0 Then If SbValRet.ToString.Trim.Length > 0 Then
Alert(SbValRet.ToString, TipoMensaje.MsgAdvertencia) Alert("El porcentaje de IEPS del producto no coincide con el especificado.<br/><br/>" & SbValRet.ToString, TipoMensaje.MsgAdvertencia)
End If End If
Else Else
@@ -8055,10 +8056,10 @@ Partial Class Compras_Compras
If (TmpDT.Rows(IndiceUltimo)("IVA").ToString.ToDecimal + DiferenciaIVas) < 0 Then If (TmpDT.Rows(IndiceUltimo)("IVA").ToString.ToDecimal + DiferenciaIVas) < 0 Then
Dim AjusteteDividido As Decimal = Math.Abs(DiferenciaIVas) / CantidadRegistroConIVA Dim AjusteteDividido As Decimal = DiferenciaIVas / CantidadRegistroConIVA
For Each dRow As DataRow In TmpDT.Rows For Each dRow As DataRow In TmpDT.Rows
dRow("IVA") = dRow("IVA").ToString.ToDecimal - AjusteteDividido dRow("IVA") = dRow("IVA").ToString.ToDecimal + AjusteteDividido
Next Next
Else Else

View File

@@ -1584,58 +1584,73 @@ Partial Class Compras_eFacturas
Dim FiInfo As New FileInfo(comprmido) Dim FiInfo As New FileInfo(comprmido)
Using stream As Stream = System.IO.File.OpenRead(FiInfo.FullName) Try
Try Using stream As Stream = System.IO.File.OpenRead(FiInfo.FullName)
Dim reader = ReaderFactory.Open(stream) Try
Dim reader = ReaderFactory.Open(stream)
Dim Multiparte As Boolean = False Dim Multiparte As Boolean = False
If Path.GetExtension(FiInfo.FullName.ToUpper()) = ".RAR" And FiInfo.FullName.ToUpper().Contains(".PART") Then If Path.GetExtension(FiInfo.FullName.ToUpper()) = ".RAR" And FiInfo.FullName.ToUpper().Contains(".PART") Then
'SI ES .RAR, PUEDE SER MULTI PART Y PUEDE TRONAR 'SI ES .RAR, PUEDE SER MULTI PART Y PUEDE TRONAR
Using archive As RarArchive = RarArchive.Open(FiInfo.FullName) Using archive As RarArchive = RarArchive.Open(FiInfo.FullName)
If archive.IsMultipartVolume() Then If archive.IsMultipartVolume() Then
Multiparte = True Multiparte = True
End If
End Using
End If
Dim PdfList As New List(Of String)
If Not Multiparte Then
'puede tronar si el archivo es multiparte
While reader.MoveToNextEntry()
If Not reader.Entry.IsDirectory Then
'Si es un archivo XML, lo leo y lo guardo
Dim nombreArchivo As String = ""
If reader.Entry.FilePath.Contains("/") Then
nombreArchivo = reader.Entry.FilePath.Substring(reader.Entry.FilePath.LastIndexOf("/") + 1)
Else
nombreArchivo = reader.Entry.FilePath
End If End If
End Using
End If
If Path.GetExtension(reader.Entry.FilePath.ToUpper()) = ".XML" Then Dim PdfList As New List(Of String)
reader.WriteEntryToDirectory(String.Format("{0}Temp\Facturas", UsuarioActual.Empresa.Ruta), ExtractOptions.None Or ExtractOptions.Overwrite) If Not Multiparte Then
ListXML.Add(String.Format("{0}Temp\Facturas\{1}", UsuarioActual.Empresa.Ruta, nombreArchivo)) 'puede tronar si el archivo es multiparte
While reader.MoveToNextEntry()
If Not reader.Entry.IsDirectory Then
'Si es un archivo XML, lo leo y lo guardo
Dim nombreArchivo As String = ""
If reader.Entry.FilePath.Contains("/") Then
nombreArchivo = reader.Entry.FilePath.Substring(reader.Entry.FilePath.LastIndexOf("/") + 1)
Else
nombreArchivo = reader.Entry.FilePath
End If
If Path.GetExtension(reader.Entry.FilePath.ToUpper()) = ".XML" Then
reader.WriteEntryToDirectory(String.Format("{0}Temp\Facturas", UsuarioActual.Empresa.Ruta), ExtractOptions.None Or ExtractOptions.Overwrite)
ListXML.Add(String.Format("{0}Temp\Facturas\{1}", UsuarioActual.Empresa.Ruta, nombreArchivo))
End If
If Path.GetExtension(reader.Entry.FilePath.ToUpper()) = ".PDF" Then
'este sale de un error al leer el pdf, como lo estoy recorriendo de una vez lo guardo y lo vinculo, si la coincidencia es por nombre o número de folio
'string RFCEmisor = BuscaFactura(System.IO.Path.GetFileNameWithoutExtension(reader.Entry.FilePath).ToUpper(), Arreglo, True);
'if (!string.IsNullOrEmpty(RFCEmisor))
' {
'If Not Directory.Exists(String.Format("{0}{1}", Temporal, RFCEmisor)) Then Directory.CreateDirectory(String.Format("{0}{1}", Temporal, RFCEmisor))
'reader.WriteEntryToDirectory(String.Format("{0}{1}", Temporal, ""), ExtractOptions.None Or ExtractOptions.Overwrite)
reader.WriteEntryToDirectory(String.Format("{0}{1}", String.Format("{0}Temp\Facturas", UsuarioActual.Empresa.Ruta), ""), ExtractOptions.None Or ExtractOptions.Overwrite)
ListPDF.Add(String.Format("{0}Temp\Facturas\{1}", UsuarioActual.Empresa.Ruta, nombreArchivo))
End If
End If End If
If Path.GetExtension(reader.Entry.FilePath.ToUpper()) = ".PDF" Then End While
'este sale de un error al leer el pdf, como lo estoy recorriendo de una vez lo guardo y lo vinculo, si la coincidencia es por nombre o número de folio End If
'string RFCEmisor = BuscaFactura(System.IO.Path.GetFileNameWithoutExtension(reader.Entry.FilePath).ToUpper(), Arreglo, True); Catch ex As Exception
'if (!string.IsNullOrEmpty(RFCEmisor)) GuardaLogAD("'ERROR :" & ex.Message, eFacturasLog)
' { End Try
'If Not Directory.Exists(String.Format("{0}{1}", Temporal, RFCEmisor)) Then Directory.CreateDirectory(String.Format("{0}{1}", Temporal, RFCEmisor)) End Using
Catch ex As Exception
If UsuarioActual.CveRol = 1 Then
Alert($"Error al procesar archivo: {FiInfo.FullName} Error:{ex.Message} stackTrace: {ex.StackTrace}", TipoMensaje.MsgAdvertencia)
GuardaLogAD($"Error al procesar archivo: {FiInfo.FullName} Error:{ex.Message} stackTrace: {ex.StackTrace}")
Else
Alert("Se presento un error al procesar las solcictudes. comuniquese con soporte tecnico.", TipoMensaje.MsgAdvertencia)
GuardaLogAD($"Error al procesar archivo: {FiInfo.FullName} Error:{ex.Message} stackTrace: {ex.StackTrace}")
End If
Exit Sub
End Try
'reader.WriteEntryToDirectory(String.Format("{0}{1}", Temporal, ""), ExtractOptions.None Or ExtractOptions.Overwrite)
reader.WriteEntryToDirectory(String.Format("{0}{1}", String.Format("{0}Temp\Facturas", UsuarioActual.Empresa.Ruta), ""), ExtractOptions.None Or ExtractOptions.Overwrite)
ListPDF.Add(String.Format("{0}Temp\Facturas\{1}", UsuarioActual.Empresa.Ruta, nombreArchivo))
End If
End If
End While
End If
Catch ex As Exception
GuardaLogAD("'ERROR :" & ex.Message, eFacturasLog)
End Try
End Using
Next Next
@@ -1726,6 +1741,7 @@ Partial Class Compras_eFacturas
For Each s As String In ListComprimidos For Each s As String In ListComprimidos
Try Try
File.Delete(s) File.Delete(s)
GuardaLogAD("")
Catch ex As Exception Catch ex As Exception
End Try End Try
Next Next
@@ -2853,11 +2869,14 @@ Partial Class Compras_eFacturas
Dim TipoMensaje As ModExtensiones.TipoMensaje = ModExtensiones.TipoMensaje.MsgInformacion Dim TipoMensaje As ModExtensiones.TipoMensaje = ModExtensiones.TipoMensaje.MsgInformacion
Dim ListComprimidos As New List(Of String)
Dim ListXML As New List(Of String)
Dim ListPDF As New List(Of String)
For Each GvRow As GridViewRow In GVSolicitudesPendientes.Rows For Each GvRow As GridViewRow In GVSolicitudesPendientes.Rows
Dim ListComprimidos As New List(Of String)
Dim ListXML As New List(Of String)
Dim ListPDF As New List(Of String)
Dim CveSolicitudActual As Integer = GvRow.DataKey("CveSolicitud").ToEntero() Dim CveSolicitudActual As Integer = GvRow.DataKey("CveSolicitud").ToEntero()
Dim idSolicitud As String = GvRow.DataKey("idSolicitud").Trim() Dim idSolicitud As String = GvRow.DataKey("idSolicitud").Trim()
Dim CveTipoSolicitud As Integer = GvRow.DataKey("CveTipoSolicitud").ToEntero() Dim CveTipoSolicitud As Integer = GvRow.DataKey("CveTipoSolicitud").ToEntero()
@@ -2872,6 +2891,7 @@ Partial Class Compras_eFacturas
Dim ResultadoSolicitudOK As Boolean = False Dim ResultadoSolicitudOK As Boolean = False
Dim api As New GeneralesAPIeFacturas(If(EsProduccion, "http://localhost:4001/", "http://localhost:60281/")) Dim api As New GeneralesAPIeFacturas(If(EsProduccion, "http://localhost:4001/", "http://localhost:60281/"))
Dim Verificar As Boolean = True Dim Verificar As Boolean = True
If idSolicitud.Length = 0 Then If idSolicitud.Length = 0 Then
@@ -2938,6 +2958,7 @@ Partial Class Compras_eFacturas
If File.Exists(destFile) Then If File.Exists(destFile) Then
ListComprimidos.Add(destFile) ListComprimidos.Add(destFile)
'GuardaLogAD($"eFacturas Solicitudes SAT Archivo copiado a {destFile}")
Else Else
sbArchivosFaltantes.AppendFormat("<br/> Folio: {0} Archivo: {1}", Folio, fileName) sbArchivosFaltantes.AppendFormat("<br/> Folio: {0} Archivo: {1}", Folio, fileName)
End If End If

View File

@@ -3533,6 +3533,8 @@
</ReportParameter> </ReportParameter>
<ReportParameter Name="RegimenFiscalCodigo"> <ReportParameter Name="RegimenFiscalCodigo">
<DataType>String</DataType> <DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>ReportParameter1</Prompt> <Prompt>ReportParameter1</Prompt>
</ReportParameter> </ReportParameter>
</ReportParameters> </ReportParameters>

View File

@@ -738,7 +738,7 @@ CIUDAD DE MEXICO</Value>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox6</rd:DefaultName> <rd:DefaultName>Textbox6</rd:DefaultName>
<Top>0.93835cm</Top> <Top>0.93835cm</Top>
<Left>4.49034cm</Left> <Left>4.52562cm</Left>
<Height>1.56146cm</Height> <Height>1.56146cm</Height>
<Width>10.79062cm</Width> <Width>10.79062cm</Width>
<ZIndex>1</ZIndex> <ZIndex>1</ZIndex>

View File

@@ -807,9 +807,10 @@ Partial Class Inventarios_Kardex
Protected Sub ddlProducto2_selectedindexchange(sender As Object, e As EventArgs) Protected Sub ddlProducto2_selectedindexchange(sender As Object, e As EventArgs)
LnkKPIVerComportamiento.Visible = False LnkKPIVerComportamiento.Visible = False
If ddlProducto2.SelectedValue.ToEntero > 0 Then If ddlProducto2.SelectedValue.ToEntero > 0 And UsuarioActual.CveRol = 1 Then
LnkKPIVerComportamiento.Visible = True LnkKPIVerComportamiento.Visible = True
End If End If
UpAcciones.Update() UpAcciones.Update()
End Sub End Sub
End Class End Class

View File

@@ -1016,13 +1016,12 @@ Partial Class OC_OC
LblPrioridad.Text = "Sucursal" LblPrioridad.Text = "Sucursal"
DdlPrioridad.Visible = False DdlPrioridad.Visible = False
DdlSubProyectoGral.Visible = True DdlSubProyectoGral.Visible = True
End If
If UsuarioActual.CveRol = 1 Then
TrDescuentoEscalonado.Visible = True TrDescuentoEscalonado.Visible = True
TrDescuentoProntoPago.Visible = True TrDescuentoProntoPago.Visible = True
End If End If
If UsuarioActual.Empresa.CveEmpresa = 189 AndAlso CveOrdenCompra <> Nothing AndAlso CveOrdenCompra > 0 Then If UsuarioActual.Empresa.CveEmpresa = 189 AndAlso CveOrdenCompra <> Nothing AndAlso CveOrdenCompra > 0 Then
BtnEdicionMasiva.Visible = True BtnEdicionMasiva.Visible = True
End If End If

View File

@@ -4079,8 +4079,12 @@
<asp:UpdatePanel ID="UPGvDocumentosFirma" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPGvDocumentosFirma" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<asp:UpdatePanel ID="UpGvDocumentosFirma2" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UpGvDocumentosFirma2" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div class="col-md-12">
<asp:GridView ID="GvDocumentosFirma" runat="server" AutoGenerateColumns="False" DataKeyNames="CveDocumentacion,Documentacion,Orden,CveDocumentacionElectronica,Adjunto,Estatus,Observacion,Fecha,FechaIng,Usuario,FechaLimite,DocumentacionFormato,FechaVigencia,DiasLimite,AplicaDiasLimite,AplicaFechaVencimiento" <asp:GridView ID="GvDocumentosFirma" runat="server" AutoGenerateColumns="False" DataKeyNames="CveDocumentacion,Documentacion,Orden,CveDocumentacionElectronica,Adjunto,Estatus,Observacion,Fecha,FechaIng,Usuario,FechaLimite,DocumentacionFormato,FechaVigencia,DiasLimite,AplicaDiasLimite,AplicaFechaVencimiento"
EmptyDataText="No se encontraron registros de documentos" CssClass="table table-hover table-advance Widthall" GridLines="None"> EmptyDataText="No se encontraron registros de documentos" CssClass="table table-hover table-advance Widthall" GridLines="None">
<Columns> <Columns>
@@ -4149,7 +4153,9 @@
<asp:TemplateField ItemStyle-HorizontalAlign="Right" ItemStyle-Width="50px"> <asp:TemplateField ItemStyle-HorizontalAlign="Right" ItemStyle-Width="50px">
<ItemTemplate> <ItemTemplate>
<asp:Literal ID="ImgDownLoad" runat="server"></asp:Literal> <%--<asp:Literal ID="ImgDownLoad" runat="server" ></asp:Literal>--%>
<asp:LinkButton ID="ImgDownLoad" CssClass="btn btn-circle btn-sm blue" OnClick="ImgDownLoad_Click" runat="server"
Text="<i class='fa fa-download' style='color:white' title='Descargar formato'></i>" CausesValidation="False" />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
@@ -4161,6 +4167,7 @@
</asp:TemplateField>--%> </asp:TemplateField>--%>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</div>
<asp:UpdatePanel ID="UpImprimir" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UpImprimir" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<table runat="server" visible="false" class="table table-hover table-advance Widthall"> <table runat="server" visible="false" class="table table-hover table-advance Widthall">

View File

@@ -7,6 +7,7 @@ Imports System.Data
Imports Microsoft.Reporting.WebForms Imports Microsoft.Reporting.WebForms
Imports System.Globalization Imports System.Globalization
Imports System.Data.SqlTypes Imports System.Data.SqlTypes
Imports DocumentFormat.OpenXml.Drawing.Diagrams
Partial Class RH_Personal Partial Class RH_Personal
Inherits ClsPaginas Inherits ClsPaginas
@@ -4357,6 +4358,7 @@ Partial Class RH_Personal
objRH.Dispose() objRH.Dispose()
End Sub End Sub
Protected Sub GvDocumentosFirma_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDocumentosFirma.RowDataBound Protected Sub GvDocumentosFirma_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDocumentosFirma.RowDataBound
@@ -4364,7 +4366,8 @@ Partial Class RH_Personal
Dim Adjunto As String = e.Row.DBCampo("Adjunto").ToString() Dim Adjunto As String = e.Row.DBCampo("Adjunto").ToString()
Dim ImgDownLoadFormato As LinkButton = e.Row.FCLinkButton("ImgDownLoadFormato") Dim ImgDownLoadFormato As LinkButton = e.Row.FCLinkButton("ImgDownLoadFormato")
Dim ImgDownLoad As Literal = e.Row.FCLiteral("ImgDownLoad")
Dim ImgDownLoad As LinkButton = e.Row.FCLinkButton("ImgDownLoad")
Dim ImgRequired As Literal = e.Row.FCLiteral("ImgRequired") Dim ImgRequired As Literal = e.Row.FCLiteral("ImgRequired")
Dim txtFechaLimite As TextBox = e.Row.FCTextBox("TxtFechaLimite") Dim txtFechaLimite As TextBox = e.Row.FCTextBox("TxtFechaLimite")
Dim requerido As Boolean = If(e.Row.DBCampo("Requerido").ToUpper = "TRUE", True, False) Dim requerido As Boolean = If(e.Row.DBCampo("Requerido").ToUpper = "TRUE", True, False)
@@ -4417,14 +4420,18 @@ Partial Class RH_Personal
If File.Exists(linkDescargaArchivo) Then If File.Exists(linkDescargaArchivo) Then
ImgDownLoad.Visible = True ImgDownLoad.Visible = True
If extencion.Length > 0 Then ScriptManager.GetCurrent(Me).RegisterPostBackControl(ImgDownLoad)
ImgDownLoad.Text = String.Format(" <a class='btn btn-circle btn-sm blue' href='{0}' target='_black' download='{1}'><i class='fa fa-download' title='Descargar documento'></i></a>", linkDescarga, CvePersonal & Documentacion & "." & extencion)
Else 'If extencion.Length > 0 Then
ImgDownLoad.Text = String.Format(" <a class='btn btn-circle btn-sm blue' href='{0}' target='_black' download='{1}'><i class='fa fa-download' title='Descargar documento'></i></a>", linkDescarga, CvePersonal & Documentacion) ' ImgDownLoad.Text = String.Format(" <a class='btn btn-circle btn-sm blue' href='{0}' target='_black' download='{1}'><i class='fa fa-download' title='Descargar documento'></i></a>", linkDescarga, CvePersonal & Documentacion & "." & extencion)
End If 'Else
' ImgDownLoad.Text = String.Format(" <a class='btn btn-circle btn-sm blue' href='{0}' target='_black' download='{1}'><i class='fa fa-download' title='Descargar documento'></i></a>", linkDescarga, CvePersonal & Documentacion)
'End If
Else Else
ImgDownLoad.Visible = False ImgDownLoad.Visible = False
End If End If
Else Else
ImgDownLoad.Visible = False ImgDownLoad.Visible = False
End If End If
@@ -4438,6 +4445,35 @@ Partial Class RH_Personal
End If End If
End Sub End Sub
Protected Sub ImgDownLoad_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim Adjunto As String = GvRow.DataKey("Adjunto").ToString()
Dim ArchivoPath As String = UsuarioActual.Empresa.Ruta & "Personal/" & CvePersonal & "/" & Adjunto
DescargarArchivo(ArchivoPath)
End Sub
Protected Sub DescargarArchivo(rutaArchivo As String)
If System.IO.File.Exists(rutaArchivo) Then
Dim nombreArchivo As String = System.IO.Path.GetFileName(rutaArchivo)
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", "attachment; filename=" & nombreArchivo)
Response.AddHeader("Content-Length", New System.IO.FileInfo(rutaArchivo).Length.ToString())
Response.WriteFile(rutaArchivo)
Response.End()
Else
End If
End Sub
Public Sub DownLoadFormato_ClickDocumentacion(sender As Object, e As EventArgs) Public Sub DownLoadFormato_ClickDocumentacion(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
@@ -8160,5 +8196,7 @@ Partial Class RH_Personal
args.IsValid = retorno args.IsValid = retorno
End Sub End Sub
End Class End Class