diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang
index 40691eb70e7..549646ab110 100644
--- a/htdocs/langs/en_US/cashdesk.lang
+++ b/htdocs/langs/en_US/cashdesk.lang
@@ -121,4 +121,5 @@ GiftReceiptButton=Add a "Gift receipt" button
GiftReceipt=Gift receipt
ModuleReceiptPrinterMustBeEnabled=Module Receipt printer must have been enabled first
AllowDelayedPayment=Allow delayed payment
-PrintPaymentMethodOnReceipts=Print payment method on tickets|receipts
\ No newline at end of file
+PrintPaymentMethodOnReceipts=Print payment method on tickets|receipts
+WeighingScale=Weighing scale
\ No newline at end of file
diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php
index cff6eabd449..62e08d2084d 100644
--- a/htdocs/takepos/admin/receipt.php
+++ b/htdocs/takepos/admin/receipt.php
@@ -233,6 +233,14 @@ print '
';
print $form->selectyesno("TAKEPOS_AUTO_PRINT_TICKETS", $conf->global->TAKEPOS_AUTO_PRINT_TICKETS, 1);
print " | \n";
+if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
+ print '| ';
+ print $langs->trans('WeighingScale');
+ print ' | ';
+ print ajax_constantonoff("TAKEPOS_WEIGHING_SCALE", array(), $conf->entity, 0, 0, 1, 0);
+ print " |
\n";
+}
+
print '';
print '';
diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php
index 82dec49b7db..390f71491ba 100644
--- a/htdocs/takepos/index.php
+++ b/htdocs/takepos/index.php
@@ -747,6 +747,19 @@ function FullScreen() {
document.documentElement.requestFullscreen();
}
+function WeighingScale(){
+ console.log("Weighing Scale");
+ $.ajax({
+ type: "POST",
+ url: 'global->TAKEPOS_PRINT_SERVER; ?>/scale',
+ })
+ .done(function( editnumber ) {
+ $("#poslines").load("invoice.php?action=updateqty&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
+ editnumber="";
+ });
+ });
+}
+
$( document ).ready(function() {
PrintCategories(0);
LoadProducts(0);
@@ -975,6 +988,11 @@ if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
$menus[$r++] = array('title'=>''.$langs->trans("Logout").'
', 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php\';');
}
+if ($conf->global->TAKEPOS_WEIGHING_SCALE)
+{
+ $menus[$r++] = array('title'=>''.$langs->trans("WeighingScale").'
', 'action'=>'WeighingScale();');
+}
+
?>