Merge pull request #10258 from andreubisquerra/master

Temporary ticket improvement in TakePOS
This commit is contained in:
Laurent Destailleur 2018-12-22 18:24:30 +01:00 committed by GitHub
commit d928274c74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 68 deletions

View File

@ -42,4 +42,5 @@ Place=Place
TakeposConnectorNecesary='TakePOS Connector' required
OrderPrinters=Order printers
SearchProduct=Search product
AmountAtEndOfPeriod=Amount at end of period (day, month or year)
Receipt=Receipt
AmountAtEndOfPeriod=Amount at end of period (day, month or year)

View File

@ -42,3 +42,4 @@ Place=Lugar
TakeposConnectorNecesary='Conector TakePOS' requerido
OrderPrinters=Impresoras de pedidos
SearchProduct=Buscar producto
Receipt=Comprobante

View File

@ -42,3 +42,4 @@ Place=Marché
TakeposConnectorNecesary='Connecteur TakePOS' requis
OrderPrinters=Commande imprimantes
SearchProduct=Rechercher un produit
Receipt=Le reçu

View File

@ -208,69 +208,6 @@ if ($action == "order" and $placeid != 0) {
$invoice->fetch($placeid);
}
// temporary ticket feature
if ($action == "temp" and $placeid != 0) {
include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
// issues with special characters with jPosBoxprinting ->javascript, stringCleanCharts() temporarily fix them until to find a more elegant solution.
function stringCleanCharts($text)
{
$utf8 = array(
'/[áàâãªä]/u' => 'a',
'/[ÁÀÂÃÄ]/u' => 'A',
'/[ÍÌÎÏ]/u' => 'I',
'/[íìîï]/u' => 'i',
'/[éèêë]/u' => 'e',
'/[ÉÈÊË]/u' => 'E',
'/[óòôõºö]/u' => 'o',
'/[ÓÒÔÕÖ]/u' => 'O',
'/[úùûü]/u' => 'u',
'/[ÚÙÛÜ]/u' => 'U',
'/ç/' => 'c',
'/Ç/' => 'C',
'/ñ/' => 'n',
'/Ñ/' => 'N',
'//' => '-',
'/[\']/u' => ' ',
'/[“”«»„]/u' => ' ',
'/ /' => ' ',
);
return preg_replace(array_keys($utf8), array_values($utf8), $text);
}
$mysocname = stringCleanCharts($mysoc->name);
$mysocaddress = stringCleanCharts($mysoc->address);
$mysoctown = stringCleanCharts($mysoc->town);
$mysoczip = stringCleanCharts($mysoc->zip);
$mysocphone = stringCleanCharts($mysoc->phone);
$mysocurl = stringCleanCharts($mysoc->url);
$header_soc = '<html><center><font size="4"><b>' . $mysocname . '</b><br>' . $mysocaddress . '<br>' . $mysoczip . ' ' . $mysoctown . '</font></center><br>' . $langs->trans("Phone") . ': ' . $mysocphone . '<br>' . $mysocurl;
$header_ticket = '<br><br>' . $langs->trans("Temporary ticket") . '<br>' . $langs->trans("date") . ':<br>' . dol_print_date(dol_now(), 'dayhour') . '<br>' . $langs->trans('Place') . ' ' . $place . '<br><br><br><div width="100%" style="border-top-style: double;"></div>';
$body_ticket = '<table width="100%"><thead><tr><th align="left">' . $langs->trans("Label") . '</th><th align="left">' . $langs->trans("Qty") . '</th><th align="left">' . $langs->trans("Price") . '</th><th align="left">' . $langs->trans("TotalTTC") . '</th></tr></thead>';
$footer_ticket = '<br><br>' . $langs->trans("Cashier") . ': ' . $user->firstname . '<br><center>' . $langs->trans("Thanks for your coming !") . '</center></html>';
$ticket_printer1 = "";
$catsprinter1 = explode(';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_1);
foreach($invoice->lines as $line)
{
if ($line->special_code == "3") { continue;
}
$c = new Categorie($db);
$existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT, 'id');
$result = array_intersect($catsprinter1, $existing);
$count = count($result);
if ($count > 0) {
$sql = "UPDATE " . MAIN_DB_PREFIX . "facturedet set special_code='3' where rowid=$line->rowid";
$db->query($sql);
$ticket_printer1.= '<tbody><tr><td align="left">' . $line->product_label . '</td><td align="left">' . $line->qty . '</td><td align="left">' . $line->total_ttc / $line->qty . '</td><td align="left">' . $line->total_ttc . '</td></tr></tbody>';
$ticket_total = '</table><div width="100%" style="border-top-style: double;"></div><table align="right"><tr><th>' . $langs->trans("TotalHT") . ': ' . price($invoice->total_ht, 1, '', 1, -1, -1, $conf->currency) . '</th></tr><tr><th>' . $langs->trans("TotalVAT") . ': ' . price($invoice->total_tva, 1, '', 1, -1, -1, $conf->currency) . '</th></tr><tr><th>' . $langs->trans("TotalTTC") . ': ' . price($invoice->total_ttc, 1, '', 1, -1, -1, $conf->currency) . '</th></tr></tbody></table>';
}
}
$invoice->fetch($placeid);
}
?>
<style>
.selected {
@ -283,6 +220,7 @@ if ($action == "temp" and $placeid != 0) {
<script language="javascript">
var selectedline=0;
var selectedtext="";
var placeid=<?php echo $placeid;?>;
$(document).ready(function(){
$('table tbody tr').click(function(){
$('table tbody tr').removeClass("selected");

View File

@ -66,6 +66,7 @@ var categories = JSON.parse( '<?php echo json_encode($categories);?>' );
var currentcat;
var pageproducts=0;
var pagecategories=0;
var pageactions=0;
var place="<?php echo $place;?>";
var editaction="qty";
var editnumber="";
@ -310,6 +311,23 @@ function OpenDrawer(){
});
}
function MoreActions(totalactions){
if (pageactions==0){
pageactions=1;
for (i = 0; i <= totalactions; i++){
if (i<9) $("#action"+i).hide();
else $("#action"+i).show();
}
}
else if (pageactions==1){
pageactions=0;
for (i = 0; i <= totalactions; i++){
if (i<9) $("#action"+i).show();
else $("#action"+i).hide();
}
}
}
$( document ).ready(function() {
PrintCategories(0);
LoadProducts(0);
@ -367,9 +385,9 @@ if($conf->global->TAKEPOS_BAR_RESTAURANT){
'action'=>'TakeposPrintingOrder();');
}
//add temp ticket button
if ($conf->global->TAKEPOS_ORDER_PRINTERS){
$menus[$r++]=array('title'=>$langs->trans("Temporary ticket"),
'action'=>'TakeposPrintingTemp();');
if ($conf->global->TAKEPOS_BAR_RESTAURANT){
if ($conf->global->TAKEPOSCONNECTOR) $menus[$r++]=array('title'=>$langs->trans("Receipt"),'action'=>'TakeposPrinting(placeid);');
else $menus[$r++]=array('title'=>$langs->trans("Receipt"),'action'=>'Print(placeid);');
}
}
@ -380,8 +398,16 @@ if ($conf->global->TAKEPOSCONNECTOR){
?>
<div style="position:absolute; top:1%; left:65.5%; height:37%; width:32.5%;">
<?php
$i = 0;
foreach($menus as $menu) {
echo '<button type="button" class="actionbutton" onclick="'.$menu['action'].'">'.$menu['title'].'</button>';
$i++;
if (count($menus)>9 and $i==9)
{
echo '<button type="button" id="actionnext" class="actionbutton" onclick="MoreActions('.count($menus).');">'.$langs->trans("Next").'</button>';
echo '<button style="display: none;" type="button" id="action'.$i.'" class="actionbutton" onclick="'.$menu['action'].'">'.$menu['title'].'</button>';
}
else if ($i>9) echo '<button style="display: none;" type="button" id="action'.$i.'" class="actionbutton" onclick="'.$menu['action'].'">'.$menu['title'].'</button>';
else echo '<button type="button" id="action'.$i.'" class="actionbutton" onclick="'.$menu['action'].'">'.$menu['title'].'</button>';
}
?>
</div>