¿Cómo Imprimir tickets para taller de reparación de celulares con OSTicket?

Este codigo lo puedes copiar, personalizar y reemplazar el nuevo código en: include/staff/templates/ticket-print.tmpl.php

Solo sirve para la versión 1.10.1. Descarga directa clic aquí
Fuente: https://github.com/osTicket/osTicket/releases/tag/v1.10.1

 

Recuerda hacer antes un respaldo de tu sitio web.

<html>

<head>
<style type=”text/css”>
@page {
header: html_def;
footer: html_def;
margin: 5mm;
margin-top: 10mm;
margin-bottom: 2mm;
}
.logo {
max-width: 220px;
max-height: 71px;
width: auto;
height: auto;
margin: 0;
}
#ticket_thread .message,
#ticket_thread .response,
#ticket_thread .note {
margin-top:10px;
border:1px solid #ddd;
border-bottom:2px solid #ddd;
}
#ticket_thread .header {
text-align:left;
border-bottom:1px solid #ddd;
padding:3px;
width: 100%;
table-layout: fixed;
}
#ticket_thread .message .header {
background:#C3D9FF;
}
#ticket_thread .response .header {
background:#FFE0B3;
}
#ticket_thread .note .header {
background:#FFE;
}
#ticket_thread .info {
padding:5px;
background: snow;
border-top: 0.3mm solid #ccc;
}

table.meta-data {
width: 100%;
}
table.custom-data {
margin-top: 10px;
}
table.custom-data th {
width: 25%;
}
table.custom-data th,
table.meta-data th {
text-align: right;
background-color: #ddd;
padding: 3px 8px;
}
table.meta-data td {
padding: 3px 8px;
}
.faded {
color:#666;
}
.pull-left {
float: left;
}
.pull-right {
float: right;
}
.flush-right {
text-align: right;
}
.flush-left {
text-align: left;
}
.ltr {
direction: ltr;
unicode-bidi: embed;
}
.headline {
border-bottom: 2px solid black;
font-weight: bold;
}
div.hr {
border-top: 0.1mm solid #eee;
margin: 0.5mm 0;
font-size: 0.0001em;
}
.thread-entry, .thread-body {
page-break-inside: avoid;
}
<?php include ROOT_DIR . ‘css/thread.css’; ?>
</style>
</head>

<body>

<table align=left class=”custom-data” cellspacing=”0″ cellpadding=”0″ width=”33%” border=”0″>
<tr>
<td>
<h3>Revisa esta reparación en internet:</h3>
</td>
</tr>
</table>

<table class=”custom-data” cellspacing=”0″ cellpadding=”4″ border=”1″ width=”33%”>
<tbody>
<tr>
<td><center><?php echo $ticket->getEmail(); ?></center></td>
</tr>
<tr>
<td><center><h1>#<?php echo $ticket->getNumber(); ?></h1></center></td>
</tr>
</tbody>
</table>

<table align=left class=”custom-data” cellspacing=”0″ cellpadding=”1″ width=”33%” border=”0″>
<tr>
<td>
<strong><?php echo __(‘Cliente’); ?></strong>: <?php echo $ticket->getOwner()->getName(); ?>
</td>
</tr>

<tr>
<td>
<strong><?php echo __(‘Teléfono’); ?></strong>: <?php echo $ticket->getPhoneNumber(); ?>
</td>
</tr>
<tr>
<td>
<strong><?php echo __(‘Recibió’); ?></strong>: <?php echo $ticket->getAssigned();?>
</td>
</tr>
<tr>
<td>
<?php echo Format::datetime($ticket->getCreateDate()); ?>
</td>
</tr>
</table>

<table align=left class=”custom-data” cellspacing=”0″ cellpadding=”0″ width=”33%” border=”0″>
<tr>
<td>
<h2><?php echo $ticket->getSubject(); ?></h2>
</td>
</tr>
</table>

<!– Custom Data –>
<?php
foreach (DynamicFormEntry::forTicket($ticket->getId()) as $form) {
// Skip core fields shown earlier in the ticket view
$answers = $form->getAnswers()->exclude(Q::any(array(
‘field__flags__hasbit’ => DynamicFormField::FLAG_EXT_STORED,
‘field__name__in’ => array(‘subject’, ‘priority’)
)));
if (count($answers) == 0)
continue;
?>

<!–<table class=”custom-data” cellspacing=”0″ cellpadding=”1″ width=”100%” border=”1″>
<tr><td colspan=”4″ class=”headline flush-left”><?php echo $form->getTitle(); ?></th></tr>–>
<!–<table class=”custom-data” cellspacing=”0″ cellpadding=”0″ border=”0″>
<tr>
<td colspan=”4″><b><?php echo $form->getTitle(); ?></b><br>
</th>
</tr>
<?php foreach($answers as $a) {
if (!($v = $a->display())) continue; ?>
<tr>
<td align=”left”><?php echo $a->getField()->get(‘label’);?></td>
<td align=”left”> <?php echo $v;?></td>
</tr>
<?php } ?>
</table>–>

<table class=”custom-data” cellspacing=”0″ cellpadding=”0″ border=”0″ width=”33%”>
<tr>
<th align=”left”><?php echo $form->getTitle(); ?></th>
</tr>
<?php foreach($answers as $a) {
if (!($v = $a->display())) continue; ?>
<tr>
<td align=”left”><?php echo $a->getField()->get(‘label’);?>: <strong><?php echo $v;?></strong>
</td>
</tr> <!–
<tr>
<td align=”left”><strong><?php echo $v;?></strong></td>
</tr> –>
<?php } ?>
</table>

<?php
$idx++;
} ?>

<br>
<br>
<table align=left class=”custom-data” cellspacing=”0″ cellpadding=”0″ width=”33%” border=”0″>
<tr>
<td>
<h3>Detalle de la reparación:</h3>
</td>
</tr>
</table>
<hr>
<div width=”33%” id=”ticket_thread”>
<?php
$types = array(‘M’, ‘R’);
if ($this->includenotes)
$types[] = ‘N’;

if ($thread = $ticket->getThreadEntries($types)) {
$threadTypes=array(‘M’=>’message’,’R’=>’response’, ‘N’=>’note’);
foreach ($thread as $entry) { ?>
<div <?php echo $threadTypes[$entry->type]; ?>”>
<table><tr><td>
<span><?php
echo Format::datetime($entry->created);?></span>
<span style=”padding:0 1em” class=”faded title”><?php
echo Format::truncate($entry->title, 100); ?></span>
</td>
<td>
<?php
echo Format::htmlchars($entry->getName()); ?></span>
</td>
</tr></table>
<div>
<div><?php echo $entry->getBody()->display(‘pdf’); ?></div>
<?php
if ($entry->has_attachments
&& ($files = $entry->attachments)) { ?>
<div>
<?php foreach ($files as $A) { ?>
<div>
<span><?php echo Format::htmlchars($A->file->name); ?></span>
<span>(<?php echo Format::file_size($A->file->size); ?>)</span>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
</div>

if ($thread = $ticket->getThreadEntries($types)) {
$threadTypes=array(‘M’=>’message’,’R’=>’response’, ‘N’=>’note’);
foreach ($thread as $entry) { ?>
<div <?php echo $threadTypes[$entry->type]; ?>”>
<br>
<em>
•<?php echo Format::datetime($entry->created);?><br>
<strong><?php echo Format::htmlchars($entry->getName()); ?></strong>
</em>

<div>
<div><?php echo $entry->getBody()->display(‘pdf’); ?>
</div>
<?php
if ($entry->has_attachments
&& ($files = $entry->attachments)) { ?>
<div>
<?php foreach ($files as $A) { ?>
<div>
<span><?php echo Format::htmlchars($A->file->name); ?></span>
<span>(<?php echo Format::file_size($A->file->size); ?>)</span>
</div>
<?php } ?>
</div>
<?php } ?>
</div>

</div>

<?php }
} ?>
</div>

</tbody>
</body>
</html>

0

Déjanos tus comentarios

🇲🇽 🇨🇳 🇺🇸