Add header and footer to TakePOS receipt

This commit is contained in:
andreubisquerra 2018-12-30 22:20:55 +01:00
parent 2225d0a41e
commit 8dee9de8f5
5 changed files with 61 additions and 6 deletions

View File

@ -44,3 +44,5 @@ OrderPrinters=Order printers
SearchProduct=Search product
Receipt=Receipt
AmountAtEndOfPeriod=Amount at end of period (day, month or year)
Header=Header
Footer=Footer

View File

@ -43,3 +43,5 @@ TakeposConnectorNecesary='Conector TakePOS' requerido
OrderPrinters=Impresoras de pedidos
SearchProduct=Buscar producto
Receipt=Comprobante
Header=Cabecera
Footer=Pie de página

View File

@ -43,3 +43,5 @@ TakeposConnectorNecesary='Connecteur TakePOS' requis
OrderPrinters=Commande imprimantes
SearchProduct=Rechercher un produit
Receipt=Le reçu
Header=Entête
Footer=Bas de page

View File

@ -25,6 +25,7 @@
require '../../main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
// If socid provided by ajax company selector
if (! empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id']))
@ -59,6 +60,8 @@ if (GETPOST('action','alpha') == 'set')
$res = dolibarr_set_const($db,"TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT','alpha'),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER','alpha'),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS','alpha'),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER','alpha'),'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db,"TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER','alpha'),'chaine',0,'',$conf->entity);
dol_syslog("admin/cashdesk: level ".GETPOST('level','alpha'));
@ -140,6 +143,44 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOSCONNECTOR){
print '</td></tr>';
}
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices")." - ".$langs->trans("Header"), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
print '</td><td>';
$variablename='TAKEPOS_HEADER';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
print $doleditor->Create();
}
print "</td></tr>\n";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices")." - ".$langs->trans("Footer"), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
print '</td><td>';
$variablename='TAKEPOS_FOOTER';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
print $doleditor->Create();
}
print "</td></tr>\n";
print '</table>';
print '<br>';

View File

@ -51,9 +51,14 @@ $object->fetch($facid);
</center>
<br>
<p align="left">
<?php print dol_nl2br(dol_format_address($mysoc)).'<br>'.$langs->trans("Phone").': '.$mysoc->phone;
?>
<?php
$substitutionarray=getCommonSubstitutionArray($langs);
if (! empty($conf->global->TAKEPOS_HEADER))
{
$newfreetext=make_substitutions($conf->global->TAKEPOS_HEADER,$substitutionarray);
echo $newfreetext;
}
?>
</p>
<p align="right">
<?php
@ -107,9 +112,12 @@ print $object->ref;
<br>
<br>
<?php
echo $langs->trans("Cashier: ");
echo $user->firstname.'<br>'.$mysoc->url.'<br>';
echo '<center>'.$langs->trans("Thanks for your coming !").'</center>';
$substitutionarray=getCommonSubstitutionArray($langs);
if (! empty($conf->global->TAKEPOS_FOOTER))
{
$newfreetext=make_substitutions($conf->global->TAKEPOS_FOOTER,$substitutionarray);
echo $newfreetext;
}
?>
<script type="text/javascript">