Cancelacion de RNC de bonificacion automaticamente, descarga de PDF de stimulsoft
This commit is contained in:
@@ -1079,7 +1079,9 @@ Partial Class PopUpVerFactura
|
||||
Dim AplicaPagare As String = If(UrlParametros("PAG") IsNot Nothing AndAlso UrlParametros("PAG").ToString <> "", UrlParametros("PAG").ToString, "0")
|
||||
Dim Guardar As Boolean = UrlParametros("GUARDAR") IsNot Nothing AndAlso UrlParametros("GUARDAR").ToString() = "1"
|
||||
Dim RegenerarPDF As Boolean = UrlParametros("REGENERAR") IsNot Nothing AndAlso UrlParametros("REGENERAR").ToString() = "1"
|
||||
imprimirFacturaVenta(UrlParametros("CVEVENTA").ToString.ToEntero, AplicaPagare, GuardarPDF:=Guardar, RegenerarPDF:=RegenerarPDF)
|
||||
Dim STIMULSOFT As Boolean = UrlParametros("STIMULSOFT") IsNot Nothing AndAlso UrlParametros("STIMULSOFT").ToString() = "1"
|
||||
|
||||
imprimirFacturaVenta(UrlParametros("CVEVENTA").ToString.ToEntero, AplicaPagare, GuardarPDF:=Guardar, RegenerarPDF:=RegenerarPDF, UsarStimulsoft:=STIMULSOFT)
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -2694,7 +2696,7 @@ Partial Class PopUpVerFactura
|
||||
Archivo = Nothing
|
||||
End If
|
||||
End Sub
|
||||
Public Sub imprimirFacturaVenta(CveVenta As Integer, AplicaPagare As String, Optional GuardarPDF As Boolean = False, Optional RegenerarPDF As Boolean = False)
|
||||
Public Sub imprimirFacturaVenta(CveVenta As Integer, AplicaPagare As String, Optional GuardarPDF As Boolean = False, Optional RegenerarPDF As Boolean = False, Optional UsarStimulsoft As Boolean = False)
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Dim Vta As Modelos.Factura = Nothing
|
||||
|
||||
@@ -2723,7 +2725,7 @@ Partial Class PopUpVerFactura
|
||||
Dim Archivo As New System.IO.FileInfo(PathArchivo)
|
||||
|
||||
'SI EL ARCHIVO NO EXISTE O SE VA REGENERA EL PDF, SE DEBEN LLENAR LOS DATOS
|
||||
If Not Archivo.Exists OrElse RegenerarPDF Then
|
||||
If Not Archivo.Exists OrElse RegenerarPDF OrElse UsarStimulsoft Then
|
||||
Vta.MonedaAbreviatura = dtVentas(0)("Abreviatura").ToString
|
||||
'se rellena la sucursal
|
||||
'Vta.Subproyecto = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.SucursalModel)
|
||||
@@ -3028,7 +3030,7 @@ Partial Class PopUpVerFactura
|
||||
Dim CveTimbreCartaPorteVenta As Integer = -1
|
||||
Dim CartaPorte As Modelos.MSubReportData = Nothing
|
||||
'SI EL ARCHIVO NO EXISTE O SE VA REGENERA EL PDF, SE DEBEN LLENAR LOS DATOS
|
||||
If Not Archivo.Exists OrElse RegenerarPDF Then
|
||||
If Not Archivo.Exists OrElse RegenerarPDF OrElse UsarStimulsoft Then
|
||||
If UsuarioActual.CveEmpresa = 13 AndAlso Vta.TipoDocto = "Ing" Then
|
||||
Using ObjGral As New ClsGenerales
|
||||
If ObjGral.GetGralTimbre(-1, "Ing", MinFecha, MaxFecha, 0, UsuarioActual.CveEmpresa, -1, CveVenta:=CveVenta) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then
|
||||
@@ -3046,37 +3048,42 @@ Partial Class PopUpVerFactura
|
||||
End If
|
||||
End If
|
||||
|
||||
If Archivo.Exists Then
|
||||
If RegenerarPDF Then
|
||||
Archivo.Delete()
|
||||
If UsarStimulsoft Then
|
||||
ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=True, SubReportData:=CartaPorte, UsarStimulsoft:=UsarStimulsoft), Vta.SerieFolio, "PDF")
|
||||
Else
|
||||
If Archivo.Exists Then
|
||||
If RegenerarPDF Then
|
||||
Archivo.Delete()
|
||||
If UsuarioActual.Empresa.CvePlataforma = 2 Then
|
||||
GeneraPDFVtaPyMe(Vta, "PDF")
|
||||
Else
|
||||
ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=True, SubReportData:=CartaPorte), Vta.SerieFolio, "PDF")
|
||||
Vta = Nothing
|
||||
End If
|
||||
Else
|
||||
HttpContext.Current.Response.Clear()
|
||||
HttpContext.Current.Response.ClearContent()
|
||||
HttpContext.Current.Response.ContentType = If(IO.Path.GetExtension(Archivo.Name) = ".txt", "text/plain", "application/pdf")
|
||||
HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" & Archivo.Name)
|
||||
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
||||
HttpContext.Current.Response.TransmitFile(PathArchivo)
|
||||
'HttpContext.Current.Response.Flush()
|
||||
HttpContext.Current.Response.End()
|
||||
Archivo = Nothing
|
||||
End If
|
||||
Else
|
||||
|
||||
'04/05/2018 - Se agrega seccion pruebas para generar factura venta .mrt para PyME
|
||||
If UsuarioActual.Empresa.CvePlataforma = 2 Then
|
||||
GeneraPDFVtaPyMe(Vta, "PDF")
|
||||
Else
|
||||
ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=True, SubReportData:=CartaPorte), Vta.SerieFolio, "PDF")
|
||||
ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=Guardar, SubReportData:=CartaPorte), Vta.SerieFolio, "PDF")
|
||||
Vta = Nothing
|
||||
End If
|
||||
Else
|
||||
HttpContext.Current.Response.Clear()
|
||||
HttpContext.Current.Response.ClearContent()
|
||||
HttpContext.Current.Response.ContentType = If(IO.Path.GetExtension(Archivo.Name) = ".txt", "text/plain", "application/pdf")
|
||||
HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" & Archivo.Name)
|
||||
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
||||
HttpContext.Current.Response.TransmitFile(PathArchivo)
|
||||
'HttpContext.Current.Response.Flush()
|
||||
HttpContext.Current.Response.End()
|
||||
Archivo = Nothing
|
||||
End If
|
||||
Else
|
||||
|
||||
'04/05/2018 - Se agrega seccion pruebas para generar factura venta .mrt para PyME
|
||||
If UsuarioActual.Empresa.CvePlataforma = 2 Then
|
||||
GeneraPDFVtaPyMe(Vta, "PDF")
|
||||
Else
|
||||
ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=Guardar, SubReportData:=CartaPorte), Vta.SerieFolio, "PDF")
|
||||
Vta = Nothing
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user