-- mejoras en impresión directa de PDF (libreria de PrintJS).
-- correción de errores. -- ashx para visualizacion de documentos pdf. -- cambios de popUpVerFacturas a ClsPaginas para generacion de pdf de ventas.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
49
Ashx/SIGDesc.ashx
Normal file
49
Ashx/SIGDesc.ashx
Normal file
@@ -0,0 +1,49 @@
|
||||
<%@ WebHandler Language="VB" Class="SIGDesc" %>
|
||||
|
||||
Option Strict Off
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports Newtonsoft.Json
|
||||
|
||||
Public Class SIGDesc : Implements IHttpHandler, IRequiresSessionState
|
||||
|
||||
ReadOnly Property UsuarioActual(ByVal context As HttpContext) As Usuario
|
||||
Get
|
||||
UsuarioActual = DirectCast(context.Session("UsuarioSIG"), Usuario)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||
If context.Request("metodo") IsNot Nothing AndAlso context.Request("metodo").ToString() = "descargarPDFVenta" Then
|
||||
Dim CveVenta As Integer = context.Request("CveVenta").ToEntero()
|
||||
DescargarPDFVenta(context, CveVenta)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub DescargarPDFVenta(ByVal context As HttpContext, CveVenta As Integer)
|
||||
Dim usuario As Usuario = UsuarioActual(context)
|
||||
If Not IsNothing(usuario) Then
|
||||
Dim ObjFactura As New Modelos.Factura(usuario, CveVenta, usuario.CveEmpresa, CargaDTDetalle:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False)
|
||||
|
||||
Dim ArchivoPDF = String.Format("{0}Empresas\{1}\PDF\{2}\{3}.pdf", ModExtensiones.DirectorioBaseEmpresas, usuario.CveEmpresa, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
|
||||
Dim FileInfo As FileInfo = New FileInfo(ArchivoPDF)
|
||||
If FileInfo.Exists Then
|
||||
context.Response.ContentType = "application/pdf"
|
||||
context.Response.Flush()
|
||||
context.Response.WriteFile(FileInfo.FullName)
|
||||
context.Response.End()
|
||||
End If
|
||||
FileInfo = Nothing
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
|
||||
Get
|
||||
Return False
|
||||
End Get
|
||||
End Property
|
||||
|
||||
End Class
|
||||
File diff suppressed because it is too large
Load Diff
1
Scripts/PrintJS/print.min.css
vendored
Normal file
1
Scripts/PrintJS/print.min.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.printModal{font-family:sans-serif;display:flex;text-align:center;font-weight:300;font-size:30px;left:0;top:0;position:absolute;color:#045fb4;width:100%;height:100%;background-color:hsla(0,0%,100%,.9)}.printClose{position:absolute;right:10px;top:10px}.printClose:before{content:"\00D7";font-family:Helvetica Neue,sans-serif;font-weight:100;line-height:1px;padding-top:.5em;display:block;font-size:2em;text-indent:1px;overflow:hidden;height:1.25em;width:1.25em;text-align:center;cursor:pointer}.printSpinner{margin-top:3px;margin-left:-40px;position:absolute;display:inline-block;width:25px;height:25px;border:2px solid #045fb4;border-radius:50%;animation:spin .75s linear infinite}.printSpinner:after,.printSpinner:before{left:-2px;top:-2px;display:none;position:absolute;content:"";width:inherit;height:inherit;border:inherit;border-radius:inherit}.printSpinner,.printSpinner:after,.printSpinner:before{display:inline-block;border-color:#045fb4 transparent transparent;animation-duration:1.2s}.printSpinner:before{transform:rotate(120deg)}.printSpinner:after{transform:rotate(240deg)}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
|
||||
1
Scripts/PrintJS/print.min.js
vendored
Normal file
1
Scripts/PrintJS/print.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -25,6 +25,7 @@
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css" />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700;800" rel="stylesheet"/>
|
||||
<link href="/Metronic/fontawesome6/css/all.min.css" rel="stylesheet" type="text/css" />
|
||||
<link rel="stylesheet" type="text/css" href="/Scripts/PrintJS/print.min.css"/>
|
||||
<%-- <link href="/Metronic/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/Metronic/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/Metronic/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />--%>
|
||||
|
||||
@@ -200,6 +200,9 @@
|
||||
<li>
|
||||
<asp:HyperLink ID="HplDownPDF" Target="_blank" runat="server" Visible="false"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Imprimir PDF</asp:HyperLink>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkDescargaDirecta" runat="server" Visible="false" OnClick="LnkDescargaDirecta_Click"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Impresión directa</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:HyperLink ID="HplRenerarPDF" Target="_blank" runat="server" Visible="false"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Regenerar PDF</asp:HyperLink>
|
||||
</li>
|
||||
@@ -449,7 +452,7 @@
|
||||
<div class="col-md-12">
|
||||
<asp:DropDownList ID="DdlSucursalCliente" runat="server" Width="100%" AutoPostBack="true" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="SucursalCliente" DataValueField="CveClienteSucursal">
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td align="left">
|
||||
@@ -592,7 +595,7 @@
|
||||
<b>Fecha de Cirugia:</b>
|
||||
</td>
|
||||
<td runat="server" id="TdFechaOS2" visible="true">
|
||||
<asp:TextBox ID="TxtFechaOS" type="datetime-local" runat="server" CssClass="make-switchsd" CausesValidation="true" Style="width: 130px" ></asp:TextBox>
|
||||
<asp:TextBox ID="TxtFechaOS" type="datetime-local" runat="server" CssClass="make-switchsd" CausesValidation="true" Style="width: 130px"></asp:TextBox>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -1979,10 +1982,10 @@
|
||||
<asp:CompareValidator ID="CVFechaEje" runat="server" ControlToValidate="TxtFechaEjecucion" Display="None" ErrorMessage="El campo <b>''Fecha Ejecución''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpEmitirImprimir"></asp:CompareValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VcoRFVFechaEje" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaEje" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
|
||||
|
||||
<ajax:CalendarExtender runat="server" ID="CEFechaEje" TargetControlID="TxtFechaEjecucion" PopupButtonID="ImgCalendarFechaEje" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||
<asp:RequiredFieldValidator ID="RFVFechaEje" runat="server" ControlToValidate="TxtFechaEjecucion" Display="None" ErrorMessage="El campo <b>''Fecha de Ejecución''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="GrpEmitirImprimir"></asp:RequiredFieldValidator>
|
||||
|
||||
|
||||
<ajax:ValidatorCalloutExtender ID="VcoCVFechaEje" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaEje" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
|
||||
</td>
|
||||
@@ -4116,8 +4119,6 @@
|
||||
</asp:DropDownList>
|
||||
</td>
|
||||
</tr>--%>
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
@@ -4204,7 +4205,8 @@
|
||||
<asp:Button ID="BtnEditar" runat="server" Text="Editar" CssClass="btn myventasbutton btn-primary" Visible="false" />
|
||||
|
||||
<asp:LinkButton ID="BtnAdjuntar" runat="server" Visible="false" Text="<i class='fa-upload fa' style=' color: white;'></i> Adjuntar" data-toggle="modal" data-target="#ModalAdjuntar" CssClass="btn myventasbutton btn-primary" />
|
||||
<br /><asp:LinkButton ID="BtnArchivoAdjunto" runat="server" Visible="false" Text="" Font-Size="14px" />
|
||||
<br />
|
||||
<asp:LinkButton ID="BtnArchivoAdjunto" runat="server" Visible="false" Text="" Font-Size="14px" />
|
||||
<asp:LinkButton ID="BtnEliminarAdjunto" runat="server" Visible="false" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" />
|
||||
|
||||
</td>
|
||||
@@ -8420,21 +8422,21 @@
|
||||
<%--Cliente Sucursales --%>
|
||||
<div runat="server" visible="False" id="DvModalTipoVentaPasoCliente">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-12 form-md-line-input input-iconright ">
|
||||
<div class="form-group col-md-12 form-md-line-input input-iconright ">
|
||||
<asp:DropDownList ID="DdlClienteSucursal" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" DataTextField="Nombre" DataValueField="Clave" CausesValidation="true"
|
||||
AutoPostBack="true" OnSelectedIndexChanged="DdlClienteSucursal_SelectedIndexChanged">
|
||||
AutoPostBack="true" OnSelectedIndexChanged="DdlClienteSucursal_SelectedIndexChanged">
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RfvDdlClienteSucursal" runat="server" CssClass="" Display="None" InitialValue="-1"
|
||||
ControlToValidate="DdlClienteSucursal" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Hospital''</b> es necesario, por favor ingréselo." ValidationGroup="GrpModalVentaMedica"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VceRfvDdlClienteSucursal" runat="server" HighlightCssClass="vco" TargetControlID="RfvDdlClienteSucursal" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
<asp:Label runat="server" Style="width: 90%; color: #888888;" AssociatedControlID="DdlClienteSucursal">Hospital:</asp:Label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<%--Cliente--%>
|
||||
<%-- <div runat="server" visible="False" id="DvModalTipoVentaPasoClienteEliminar">
|
||||
<%-- <div runat="server" visible="False" id="DvModalTipoVentaPasoClienteEliminar">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-12 form-md-line-input input-iconright ">
|
||||
<asp:Label runat="server" Style="width: 90%; color: #888888;" AssociatedControlID="DdlClientesWS">Hospital:</asp:Label>
|
||||
@@ -8456,7 +8458,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>--%>
|
||||
|
||||
|
||||
|
||||
<%--Medico Procedimiento--%>
|
||||
<div runat="server" visible="False" id="DvModalTipoVentaPasoMedicoProcedimiento">
|
||||
@@ -8495,7 +8497,7 @@
|
||||
</div>
|
||||
<div class="form-group col-md-6 form-md-line-input input-iconright " runat="server" id="DvModalRequiereOSFecha" visible="false">
|
||||
<asp:Label runat="server" Style="width: 90%; color: #888888;" AssociatedControlID="TxtFechaModal">Fecha de Cirugia:</asp:Label>
|
||||
<asp:TextBox ID="TxtFechaModal" type="datetime-local" runat="server" CssClass="form-control" CausesValidation="true" Style="width: 100%" ></asp:TextBox>
|
||||
<asp:TextBox ID="TxtFechaModal" type="datetime-local" runat="server" CssClass="form-control" CausesValidation="true" Style="width: 100%"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -8539,45 +8541,20 @@
|
||||
</asp:UpdatePanel>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script src="/Metronic/assets/global/scripts/jquery-sortable.js"></script>
|
||||
<script src="/Scripts/PrintJS/print.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function impresionDirecta(url){
|
||||
var frame = document.createElement('iframe');
|
||||
frame.setAttribute('src', url);
|
||||
//must be in the DOM to work in Firefox/IE
|
||||
document.body.appendChild(frame);
|
||||
//since it's in the DOM we need to hide it (lest we ruin our page layout)
|
||||
//can't use 'display:none' or 'visibility:hidden' because you can't get focus (needed for IE)
|
||||
//'z-index:-1' & 'opacity:0' wont help if there is no background in the elements above it and someone clicks through to it
|
||||
frame.style.position = 'absolute';
|
||||
frame.style.left = '-9999px';
|
||||
//when it is loaded, print it
|
||||
function printFrame() {
|
||||
//have to get focus in IE
|
||||
frame.contentWindow.focus();
|
||||
//print!
|
||||
frame.contentWindow.print();
|
||||
/* cant remove the element because print() is non-blocking in FF
|
||||
* (I.e. it would remove the frame before it was printed!)
|
||||
//cleanup
|
||||
//document.body.removeChild(frame);*/
|
||||
};
|
||||
//if it was cached, it may already be done (onload wont fire, IE8)
|
||||
if (frame.contentWindow && frame.contentDocument.readyState == 'complete')
|
||||
printFrame();
|
||||
else {
|
||||
if (frame.addEventListener)
|
||||
//W3C
|
||||
frame.addEventListener('load', printFrame, false);
|
||||
else
|
||||
//IE<9
|
||||
frame.attachEvent('onload', printFrame);
|
||||
}
|
||||
function impresionDirecta(urlPDF) {
|
||||
printJS({printable:urlPDF, type:'pdf', showModal:true});
|
||||
}
|
||||
|
||||
function abrirDdlPS(){
|
||||
$(document).ready(function() {
|
||||
$('#C_Tab_TabGenerales_DdlPS > select').select2('open').next().find(':input.select2-search__field').focus();
|
||||
});
|
||||
}
|
||||
|
||||
function pageLoad()
|
||||
|
||||
@@ -3467,14 +3467,15 @@ Partial Class Ventas
|
||||
GvPS.Columns(ColumnaSubProyecto).Visible = False
|
||||
ThProyecto.Visible = False
|
||||
ThProyecto2.Visible = False
|
||||
|
||||
TxtCantidad.Text = "1"
|
||||
TxtCantidad.Focus()
|
||||
TrDescripcionVenta.Visible = False
|
||||
|
||||
If CveVenta <= 0 Then
|
||||
TxtCantidad.Text = "1"
|
||||
TxtCantidad.Focus()
|
||||
RegistraScript("abrirDdlPS();", "A1")
|
||||
End If
|
||||
UpPS.Update()
|
||||
|
||||
RegistraScript("$('#TxtCantidad').focus();", "A1")
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -9538,9 +9539,12 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveRol = 1 Then
|
||||
LnkDescargaDirecta.Visible = True
|
||||
|
||||
HplImprimirPDFStimulsoft.Visible = True
|
||||
HplImprimirPDFStimulsoft.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=0&STIMULSOFT=1", CveVenta)))
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
'NO DEBE IMPRIMIR PDF DE COTIZACION
|
||||
@@ -10366,7 +10370,6 @@ Partial Class Ventas
|
||||
If File.Exists(ArchivoXML) Then
|
||||
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", ObjFactura.SerieFolio, ObjFactura.TipoDocto)))
|
||||
End If
|
||||
|
||||
Try
|
||||
'MANDA CORREO
|
||||
Dim strURLHOST As String = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
@@ -10376,8 +10379,22 @@ Partial Class Ventas
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al enviar el PDF", ex)
|
||||
End Try
|
||||
Else
|
||||
'PARA PRUEBAS, GENERAR PDF AUNQUE NO ESTE TIMBRADA
|
||||
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||
Try
|
||||
'MANDA CORREO
|
||||
Dim strURLHOST As String = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
Dim Factura As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False, CargaDTDetalle:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False)
|
||||
Dim Hilo As New System.Threading.Thread(Sub() GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, strURLHOST))
|
||||
Hilo.Start()
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al enviar el PDF", ex)
|
||||
End Try
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'DESCARGA PDF
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant", "Egs", "Dev", "Ped") Then
|
||||
'If Not ImprimeAlert Then
|
||||
@@ -10578,7 +10595,7 @@ Partial Class Ventas
|
||||
End Try
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||
RegistraScript($"impresionDirecta('/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", CveVenta))}');", "Imprimir")
|
||||
ImpresionDirectaPDF()
|
||||
End If
|
||||
|
||||
Else
|
||||
@@ -15538,7 +15555,7 @@ Partial Class Ventas
|
||||
|
||||
'TIMBRADO NUEVO
|
||||
Try
|
||||
DescargarFactura(Factura.CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Regenerar:=True, strURLHOST:=strURLHOST)
|
||||
GenerarPDFVenta(Factura.CveVenta, AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False)
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al generar el PDF", ex)
|
||||
End Try
|
||||
@@ -22038,11 +22055,12 @@ Partial Class Ventas
|
||||
'REGENERAR EL PDF
|
||||
If Not OcurrioError Then
|
||||
Try
|
||||
Dim CveEmpresaPDF As Integer = UsuarioActual.CveEmpresa
|
||||
Dim CveUsuarioPDF As Integer = UsuarioActual.CveUsuario
|
||||
GenerarPDFVenta(CveVenta, AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False)
|
||||
'Dim CveEmpresaPDF As Integer = UsuarioActual.CveEmpresa
|
||||
'Dim CveUsuarioPDF As Integer = UsuarioActual.CveUsuario
|
||||
|
||||
Dim strURLHOST As String = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
RegenerarPDF(CveVenta, CveEmpresaPDF, CveUsuarioPDF, strURLHOST)
|
||||
'Dim strURLHOST As String = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
'RegenerarPDF(CveVenta, CveEmpresaPDF, CveUsuarioPDF, strURLHOST)
|
||||
'
|
||||
'Dim Hilo As New System.Threading.Thread(Sub() )
|
||||
'Hilo.Start()
|
||||
@@ -22051,14 +22069,6 @@ Partial Class Ventas
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub RegenerarPDF(CveVenta As Integer, CveEmpresa As Integer, CveUsuario As Integer, strURLHOST As String)
|
||||
Try
|
||||
DescargarFactura(CveVenta, CveEmpresa, CveUsuario, Regenerar:=True, strURLHOST:=strURLHOST)
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al regenerar el PDF", ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub BtnActualizarCuentaTerminal_Click(sender As Object, e As EventArgs) Handles BtnActualizarCuentaTerminal.Click
|
||||
Dim ObjVentas As New ClsVentas
|
||||
ObjVentas.IniciaTransacSQL()
|
||||
@@ -23993,7 +24003,7 @@ Partial Class Ventas
|
||||
Dim File As Byte() = Nothing
|
||||
Try
|
||||
Using httpClient = New HttpClient()
|
||||
httpClient.Timeout = New TimeSpan(0, 15, 0)
|
||||
httpClient.Timeout = New TimeSpan(0, 1, 0)
|
||||
Using request = New HttpRequestMessage(HttpMethod.Get, Url)
|
||||
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO={2}", UsuarioActual.CveEmpresa, DateTime.UtcNow.Ticks, UsuarioActual.CveUsuario)))
|
||||
Dim response = httpClient.SendAsync(request).Result
|
||||
@@ -33615,7 +33625,6 @@ Partial Class Ventas
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub TxtFecha_TextChanged(sender As Object, e As EventArgs)
|
||||
'SI USUARIO USA AMORTIZACIÓN CONTABLE, se carga las tablas para usarlas mas adelante
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.CveEmpresa = 48 AndAlso UsuarioActual.Empresa.UsaAC Then
|
||||
@@ -33644,33 +33653,6 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer, Optional GetBytes As Boolean = True, Optional Regenerar As Boolean = False, Optional strURLHOST As String = "") As Byte()
|
||||
|
||||
If String.IsNullOrEmpty(strURLHOST) Then
|
||||
strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
End If
|
||||
|
||||
Dim Url As New Uri(String.Format("{0}/Compras/PopUpVerFactura.aspx?P={1}", strURLHOST, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1®ENERAR={1}", CveVenta, If(Regenerar, "1", "0")))))
|
||||
Dim File As Byte() = Nothing
|
||||
Try
|
||||
Using httpClient As New HttpClient()
|
||||
httpClient.Timeout = New TimeSpan(0, 2, 0)
|
||||
Using request As New HttpRequestMessage(HttpMethod.Get, Url)
|
||||
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CveUsuario={2}", CveEmpresa, DateTime.UtcNow.Ticks, CveUsuarioCreo)))
|
||||
Dim response = httpClient.SendAsync(request).Result
|
||||
If GetBytes AndAlso response.StatusCode = Net.HttpStatusCode.OK Then
|
||||
File = response.Content.ReadAsByteArrayAsync().Result
|
||||
End If
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
File = Nothing
|
||||
OnError("Ocurrió un error al descargar la factura", ex)
|
||||
End Try
|
||||
|
||||
Return File
|
||||
End Function
|
||||
Protected Sub LnkGenerarOC_Click(sender As Object, e As EventArgs)
|
||||
Response.Redirect($"~/OC/OC.aspx?CveCotizacion={Me.CveVenta}&Tipo=OC")
|
||||
End Sub
|
||||
@@ -33811,11 +33793,12 @@ Partial Class Ventas
|
||||
ObjVentas.Dispose()
|
||||
'REGENERAR EL PDF
|
||||
Try
|
||||
Dim CveEmpresaPDF As Integer = UsuarioActual.CveEmpresa
|
||||
Dim CveUsuarioPDF As Integer = UsuarioActual.CveUsuario
|
||||
GenerarPDFVenta(CveVenta, AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False)
|
||||
'Dim CveEmpresaPDF As Integer = UsuarioActual.CveEmpresa
|
||||
'Dim CveUsuarioPDF As Integer = UsuarioActual.CveUsuario
|
||||
|
||||
Dim strURLHOST As String = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
RegenerarPDF(CveVenta, CveEmpresaPDF, CveUsuarioPDF, strURLHOST)
|
||||
'Dim strURLHOST As String = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
'RegenerarPDF(CveVenta, CveEmpresaPDF, CveUsuarioPDF, strURLHOST)
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al regenerar el PDF", ex)
|
||||
End Try
|
||||
@@ -36578,7 +36561,37 @@ Partial Class Ventas
|
||||
CargarSaldoAuxiliar(CveCliente)
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkDescargaDirecta_Click(sender As Object, e As EventArgs)
|
||||
ImpresionDirectaPDF()
|
||||
End Sub
|
||||
|
||||
Private Sub ImpresionDirectaPDF()
|
||||
Dim ObjFactura As New Modelos.Factura(UsuarioActual, Me.CveVenta, UsuarioActual.CveEmpresa, CargaDTDetalle:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False)
|
||||
|
||||
Dim ExistePDF As Boolean = False
|
||||
Dim ArchivoPDF As String = String.Format("{0}/PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
|
||||
|
||||
If File.Exists(ArchivoPDF) Then
|
||||
ExistePDF = True
|
||||
Else
|
||||
'REGENERAR EL PDF
|
||||
Try
|
||||
GenerarPDFVenta(CveVenta, AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False)
|
||||
If File.Exists(ArchivoPDF) Then
|
||||
ExistePDF = True
|
||||
End If
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al regenerar el PDF", ex)
|
||||
End Try
|
||||
End If
|
||||
|
||||
If ExistePDF Then
|
||||
Dim urlPDF As String = $"/Ashx/SIGDesc.ashx?metodo=descargarPDFVenta&CveVenta={CveVenta}"
|
||||
RegistraScript($"impresionDirecta('{urlPDF}');", "Imprimir")
|
||||
Else
|
||||
Alert("No se pudo imprimir el pdf directamente. favor de descargar manualmente el pdf.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user