diff --git a/Contabilidad/RegPrePoliza.aspx.vb b/Contabilidad/RegPrePoliza.aspx.vb
index 740cf4ada..a92d266e1 100644
--- a/Contabilidad/RegPrePoliza.aspx.vb
+++ b/Contabilidad/RegPrePoliza.aspx.vb
@@ -180,6 +180,15 @@ Partial Class ContabilidadC_RegPrePoliza
End Set
End Property
+ Public Property CveIE As Integer
+ Get
+ Return CType(ViewState("CveIE"), Integer)
+ End Get
+ Set(value As Integer)
+ ViewState("CveIE") = value
+ End Set
+ End Property
+
#End Region
@@ -525,7 +534,12 @@ Partial Class ContabilidadC_RegPrePoliza
If CveConceptoContable.Contiene(68) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}", e.Row.DBCampo("CveMovimientoAlmacen"))
If CveConceptoContable.Contiene(30, 204) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE"))
- If CveConceptoContable.Contiene(30) Then LnkImprimirPDF.Visible = True
+ If CveConceptoContable.Contiene(30) AndAlso UsuarioActual.CveRol = 1 Then
+ LnkImprimirPDF.Visible = True
+ LnkComprobante.Visible = True
+ CveIE = e.Row.DBCampo("CveIE").ToString.ToEntero
+
+ End If
'e.Row.FCHyperLink("HlReferencia").NavigateUrl = CveConceptoContable
@@ -1770,7 +1784,21 @@ Partial Class ContabilidadC_RegPrePoliza
If ObjIE.DtResultados.Rows.Count > 0 Then
Path = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString)
If File.Exists(Path) Then
- Pathpdf.Add(Path)
+ Dim formato As String = System.IO.Path.GetExtension(Path)
+ If formato.ToLower.Contiene(".jpg", ".png", ".jpeg") Then
+ Dim ComprobantePDF As String = String.Format("{0}\{1}\comprobante.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick)
+ Using crea_archivo = New iTextSharp.text.Document
+ PdfWriter.GetInstance(crea_archivo, New FileStream(ComprobantePDF, FileMode.Create))
+ crea_archivo.Open()
+ Dim image As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(Path)
+ crea_archivo.Add(image)
+ End Using
+ Pathpdf.Add(ComprobantePDF)
+
+ Else
+ Pathpdf.Add(Path)
+ End If
+
End If
End If
End If
@@ -1784,6 +1812,7 @@ Partial Class ContabilidadC_RegPrePoliza
Dim CveFactura As String = dr("CveFactura").ToString
Path = String.Format("{0}Compras\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, RFC, CveFactura)
If File.Exists(Path) Then
+
Pathpdf.Add(Path)
End If
End If
@@ -1892,7 +1921,7 @@ Partial Class ContabilidadC_RegPrePoliza
Try
pdfCount = pdfFiles.Length
- If pdfCount > 1 Then
+ If pdfCount > 0 Then
fileName = pdfFiles(f)
reader = New iTextSharp.text.pdf.PdfReader(fileName)
pageCount = reader.NumberOfPages
@@ -2243,5 +2272,41 @@ Partial Class ContabilidadC_RegPrePoliza
Return dataTable
End Function
+
+ Protected Sub BtnGuardarArchivo_Click(sender As Object, e As EventArgs) Handles BtnGuardarArchivo.Click
+ Dim ObjIE As New ClsBancos
+ Dim Comprobante As String = ""
+
+ Dim Filesgral As List(Of Archivo) = TxtCargarArchivo.getfiles().Archivos
+ If Filesgral.Count > 0 Then
+ Dim fileItem As Archivo = Filesgral(0)
+ Dim Path As String = HttpContext.Current.Request.ApplicationPath
+ Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
+
+ Path = Extensiones.DirectorioBaseEmpresas
+ Path += String.Format("Empresas/{0}/IE", UsuarioActual.CveEmpresa)
+
+
+
+ If Not Directory.Exists(Path) Then
+ Directory.CreateDirectory(Path)
+ End If
+ Path += $"/{CveIE}.{Comprobante}"
+ If File.Exists(Path) Then
+ File.Delete(Path)
+ End If
+ My.Computer.FileSystem.MoveFile(fileItem.FileUrl, Path)
+ End If
+ TxtCargarArchivo.Text = ""
+ RegistraScript("$('#ModalUpload').modal('hide')", "hidemodal1")
+
+ If ObjIE.UpdateComprobanteIE(Comprobante.Replace("."c, ""), CveIE) Then
+ Alert("El Comprobante se guardo exitosamente.", TipoMensaje.MsgInformacion)
+ End If
+
+ ObjIE.Dispose()
+
+ End Sub
+
End Class