can print from takepos
This commit is contained in:
parent
5a3347104f
commit
b048a2b408
@ -82,6 +82,8 @@ if (GETPOST('action', 'alpha') == 'set')
|
|||||||
$res = dolibarr_set_const($db, "CASHDESK_ID_WAREHOUSE".$terminaltouse, (GETPOST('CASHDESK_ID_WAREHOUSE'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "CASHDESK_ID_WAREHOUSE".$terminaltouse, (GETPOST('CASHDESK_ID_WAREHOUSE'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
|
||||||
$res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminaltouse, GETPOST('CASHDESK_NO_DECREASE_STOCK'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminaltouse, GETPOST('CASHDESK_NO_DECREASE_STOCK'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
$res = dolibarr_set_const($db, "TAKEPOS_PRINTER_TO_USE".$terminaltouse, GETPOST('TAKEPOS_PRINTER_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "TAKEPOS_PRINTER_TO_USE".$terminaltouse, GETPOST('TAKEPOS_PRINTER_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
$res = dolibarr_set_const($db, "TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES".$terminaltouse, GETPOST('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
$res = dolibarr_set_const($db, "TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS".$terminaltouse, GETPOST('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
|
dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
|
||||||
|
|
||||||
@ -201,12 +203,25 @@ if (! empty($conf->stock->enabled))
|
|||||||
$printer->listprinters();
|
$printer->listprinters();
|
||||||
$printers = array();
|
$printers = array();
|
||||||
foreach ($printer->listprinters as $key => $value) {
|
foreach ($printer->listprinters as $key => $value) {
|
||||||
$printers[$key] = $value['name'];
|
$printers[$value['rowid']] = $value['name'];
|
||||||
}
|
}
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("TakeposTerminalPrinterToUse").'</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("TakeposTerminalPrinterToUse").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->selectarray('TAKEPOS_PRINTER_TO_USE'.$terminal, $printers, (empty($conf->global->{'TAKEPOS_PRINTER_TO_USE'.$terminal})?'0':$conf->global->{'TAKEPOS_PRINTER_TO_USE'.$terminal}), 1);
|
print $form->selectarray('TAKEPOS_PRINTER_TO_USE'.$terminal, $printers, (empty($conf->global->{'TAKEPOS_PRINTER_TO_USE'.$terminal})?'0':$conf->global->{'TAKEPOS_PRINTER_TO_USE'.$terminal}), 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
$printer->listPrintersTemplates();
|
||||||
|
$templates = array();
|
||||||
|
foreach ($printer->listprinterstemplates as $key => $value) {
|
||||||
|
$templates[$value['rowid']] = $value['name'];
|
||||||
|
}
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("TakeposTerminalTemplateToUseForInvoicesTicket").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal, $templates, (empty($conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal})?'0':$conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal}), 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("TakeposTerminalTemplateToUseForOrdersTicket").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal, $templates, (empty($conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal})?'0':$conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal}), 1);
|
||||||
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
||||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
||||||
@ -36,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
|||||||
$category = GETPOST('category', 'alpha');
|
$category = GETPOST('category', 'alpha');
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$term = GETPOST('term', 'alpha');
|
$term = GETPOST('term', 'alpha');
|
||||||
|
$id = GETPOST('id', 'int');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -81,4 +82,24 @@ elseif ($action=="search" && $term != '') {
|
|||||||
else {
|
else {
|
||||||
echo 'Failed to search product : '.$db->lasterror();
|
echo 'Failed to search product : '.$db->lasterror();
|
||||||
}
|
}
|
||||||
|
} elseif ($action == "opendrawer" && $term != '') {
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
|
||||||
|
$printer = new dolReceiptPrinter($db);
|
||||||
|
// chek printer for terminal
|
||||||
|
if ($conf->global->{'TAKEPOS_PRINTER_TO_USE'.$term} > 0) {
|
||||||
|
$printer->initPrinter($conf->global->{'TAKEPOS_PRINTER_TO_USE'.$term});
|
||||||
|
// open cashdrawer
|
||||||
|
$printer->pulse();
|
||||||
|
$printer->close();
|
||||||
|
}
|
||||||
|
} elseif ($action == "printinvoiceticket" && $term != '' && $id > 0) {
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
|
$printer = new dolReceiptPrinter($db);
|
||||||
|
// check printer for terminal
|
||||||
|
if ($conf->global->{'TAKEPOS_PRINTER_TO_USE'.$term} > 0 && $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$term} > 0) {
|
||||||
|
$object = new Facture($db);
|
||||||
|
$object->fetch($id);
|
||||||
|
$ret = $printer->sendToPrinter($object, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$term}, $conf->global->{'TAKEPOS_PRINTER_TO_USE'.$term});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -554,16 +554,11 @@ function TakeposPrinting(id){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function DolibarrTakeposPrinting(id) {
|
function DolibarrTakeposPrinting(id) {
|
||||||
console.log('Printing ticket ' + id)
|
console.log('Printing invoice ticket ' + id)
|
||||||
var receipt;
|
$.ajax({
|
||||||
// $.get("receipt.php?facid="+id, function(data, status) {
|
type: "GET",
|
||||||
// receipt=data.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '');
|
url: "<?php print dol_buildpath('/takepos/ajax/ajax.php', 1).'?action=printinvoiceticket&term='.$_SESSION["takeposterminal"].'&id='; ?>" + id,
|
||||||
// $.ajax({
|
});
|
||||||
// type: "POST",
|
|
||||||
// url: 'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print',
|
|
||||||
// data: receipt
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -539,19 +539,18 @@ function TakeposPrintingTemp(){
|
|||||||
function OpenDrawer(){
|
function OpenDrawer(){
|
||||||
console.log("OpenDrawer");
|
console.log("OpenDrawer");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: 'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER;?>:8111/print',
|
url: 'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER;?>:8111/print',
|
||||||
data: "opendrawer"
|
data: "opendrawer"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function DolibarrOpenDrawer(){
|
function DolibarrOpenDrawer() {
|
||||||
console.log("DolibarrOpenDrawer");
|
console.log("DolibarrOpenDrawer");
|
||||||
// $.ajax({
|
$.ajax({
|
||||||
// type: "POST",
|
type: "GET",
|
||||||
// url: 'http://',
|
url: "<?php print dol_buildpath('/takepos/ajax/ajax.php', 1).'?action=opendrawer&term='.$_SESSION["takeposterminal"]; ?>",
|
||||||
// data: "opendrawer"
|
});
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function MoreActions(totalactions){
|
function MoreActions(totalactions){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user