Browse Source

NEW Weighing Scale compatibility with TakePOS connector

jove@bisquerra.com 4 years ago
parent
commit
e55c16c039
3 changed files with 28 additions and 1 deletions
  1. 2 1
      htdocs/langs/en_US/cashdesk.lang
  2. 8 0
      htdocs/takepos/admin/receipt.php
  3. 18 0
      htdocs/takepos/index.php

+ 2 - 1
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
+PrintPaymentMethodOnReceipts=Print payment method on tickets|receipts
+WeighingScale=Weighing scale

+ 8 - 0
htdocs/takepos/admin/receipt.php

@@ -233,6 +233,14 @@ print '<td colspan="2">';
 print $form->selectyesno("TAKEPOS_AUTO_PRINT_TICKETS", $conf->global->TAKEPOS_AUTO_PRINT_TICKETS, 1);
 print "</td></tr>\n";
 
+if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
+	print '<tr class="oddeven"><td>';
+	print $langs->trans('WeighingScale');
+	print '<td colspan="2">';
+	print ajax_constantonoff("TAKEPOS_WEIGHING_SCALE", array(), $conf->entity, 0, 0, 1, 0);
+	print "</td></tr>\n";
+}
+
 print '</table>';
 print '</div>';
 

+ 18 - 0
htdocs/takepos/index.php

@@ -747,6 +747,19 @@ function FullScreen() {
 	document.documentElement.requestFullscreen();
 }
 
+function WeighingScale(){
+	console.log("Weighing Scale");
+    $.ajax({
+        type: "POST",
+        url: '<?php print $conf->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'=>'<span class="fa fa-sign-out-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("Logout").'</div>', 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php\';');
 }
 
+if ($conf->global->TAKEPOS_WEIGHING_SCALE)
+{
+	$menus[$r++] = array('title'=>'<span class="fa fa-balance-scale paddingrightonly"></span><div class="trunc">'.$langs->trans("WeighingScale").'</div>', 'action'=>'WeighingScale();');
+}
+
 ?>
 		<!-- Show buttons -->
 		<div class="div3">