Merge pull request #10258 from andreubisquerra/master
Temporary ticket improvement in TakePOS
This commit is contained in:
commit
d928274c74
@ -42,4 +42,5 @@ Place=Place
|
|||||||
TakeposConnectorNecesary='TakePOS Connector' required
|
TakeposConnectorNecesary='TakePOS Connector' required
|
||||||
OrderPrinters=Order printers
|
OrderPrinters=Order printers
|
||||||
SearchProduct=Search product
|
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)
|
||||||
|
|||||||
@ -42,3 +42,4 @@ Place=Lugar
|
|||||||
TakeposConnectorNecesary='Conector TakePOS' requerido
|
TakeposConnectorNecesary='Conector TakePOS' requerido
|
||||||
OrderPrinters=Impresoras de pedidos
|
OrderPrinters=Impresoras de pedidos
|
||||||
SearchProduct=Buscar producto
|
SearchProduct=Buscar producto
|
||||||
|
Receipt=Comprobante
|
||||||
|
|||||||
@ -42,3 +42,4 @@ Place=Marché
|
|||||||
TakeposConnectorNecesary='Connecteur TakePOS' requis
|
TakeposConnectorNecesary='Connecteur TakePOS' requis
|
||||||
OrderPrinters=Commande imprimantes
|
OrderPrinters=Commande imprimantes
|
||||||
SearchProduct=Rechercher un produit
|
SearchProduct=Rechercher un produit
|
||||||
|
Receipt=Le reçu
|
||||||
|
|||||||
@ -208,69 +208,6 @@ if ($action == "order" and $placeid != 0) {
|
|||||||
$invoice->fetch($placeid);
|
$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>
|
<style>
|
||||||
.selected {
|
.selected {
|
||||||
@ -283,6 +220,7 @@ if ($action == "temp" and $placeid != 0) {
|
|||||||
<script language="javascript">
|
<script language="javascript">
|
||||||
var selectedline=0;
|
var selectedline=0;
|
||||||
var selectedtext="";
|
var selectedtext="";
|
||||||
|
var placeid=<?php echo $placeid;?>;
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('table tbody tr').click(function(){
|
$('table tbody tr').click(function(){
|
||||||
$('table tbody tr').removeClass("selected");
|
$('table tbody tr').removeClass("selected");
|
||||||
|
|||||||
@ -66,6 +66,7 @@ var categories = JSON.parse( '<?php echo json_encode($categories);?>' );
|
|||||||
var currentcat;
|
var currentcat;
|
||||||
var pageproducts=0;
|
var pageproducts=0;
|
||||||
var pagecategories=0;
|
var pagecategories=0;
|
||||||
|
var pageactions=0;
|
||||||
var place="<?php echo $place;?>";
|
var place="<?php echo $place;?>";
|
||||||
var editaction="qty";
|
var editaction="qty";
|
||||||
var editnumber="";
|
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() {
|
$( document ).ready(function() {
|
||||||
PrintCategories(0);
|
PrintCategories(0);
|
||||||
LoadProducts(0);
|
LoadProducts(0);
|
||||||
@ -367,9 +385,9 @@ if($conf->global->TAKEPOS_BAR_RESTAURANT){
|
|||||||
'action'=>'TakeposPrintingOrder();');
|
'action'=>'TakeposPrintingOrder();');
|
||||||
}
|
}
|
||||||
//add temp ticket button
|
//add temp ticket button
|
||||||
if ($conf->global->TAKEPOS_ORDER_PRINTERS){
|
if ($conf->global->TAKEPOS_BAR_RESTAURANT){
|
||||||
$menus[$r++]=array('title'=>$langs->trans("Temporary ticket"),
|
if ($conf->global->TAKEPOSCONNECTOR) $menus[$r++]=array('title'=>$langs->trans("Receipt"),'action'=>'TakeposPrinting(placeid);');
|
||||||
'action'=>'TakeposPrintingTemp();');
|
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%;">
|
<div style="position:absolute; top:1%; left:65.5%; height:37%; width:32.5%;">
|
||||||
<?php
|
<?php
|
||||||
|
$i = 0;
|
||||||
foreach($menus as $menu) {
|
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>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user