Impresión mini-printer directo pdf (ventas)

This commit is contained in:
2024-01-11 18:24:42 -07:00
parent 4b9e175f23
commit 81c93f48ee
2 changed files with 39 additions and 0 deletions

View File

@@ -8547,6 +8547,40 @@
<script src="/Metronic/assets/global/scripts/jquery-sortable.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 pageLoad()
{
//ABRIR EL DROPDOWN DE PS DESPUES DE ASIGNAR CANTIDAD

View File

@@ -10514,6 +10514,10 @@ Partial Class Ventas
OnError("Ocurrió un error al limpiar los datos", ex)
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")
End If
Else
ObjVentas.RollBack()
@@ -16349,6 +16353,7 @@ Partial Class Ventas
Else
MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ")
End If
End If
'IMPRESION