Added printing notes

This commit is contained in:
Marc Ole Bulling 2021-01-15 13:40:25 +01:00
parent f007b92911
commit a8142fed05
No known key found for this signature in database
GPG Key ID: C126AFC2A47B06FF
2 changed files with 17 additions and 9 deletions

View File

@ -97,15 +97,17 @@ Setting('DEFAULT_PERMISSIONS', ['ADMIN']);
// When using a thermal printer (thermal printers are receipt printers, not regular printers)
// The printer must support the ESC/POS protocol, see https://github.com/mike42/escpos-php
Setting('TPRINTER_IS_NETWORK_PRINTER', false); // Set to true if it is a network printer
Setting('TPRINTER_PRINT_QUANTITY_NAME', true); // Set to true if you want to print the quantity name as well
Setting('TPRINTER_IS_NETWORK_PRINTER', false); // Set to true if it is a network printer
Setting('TPRINTER_PRINT_QUANTITY_NAME', true); // Set to false if you do not want to print the quantity names
Setting('TPRINTER_PRINT_NOTES', true); // Set to false if you do not want to print notes
//Configuration below for network printers. If you are using a USB/serial printer, skip to next section
Setting('TPRINTER_IP', '127.0.0.1'); // IP of the network printer
Setting('TPRINTER_PORT', 9100); // Port of printer, eg. 9100
Setting('TPRINTER_IP', '127.0.0.1'); // IP of the network printer
Setting('TPRINTER_PORT', 9100); // Port of printer, eg. 9100
//Configuration below if you are using a USB or serial printer
Setting('TPRINTER_CONNECTOR', '/dev/usb/lp0'); // Location of printer. For USB on Linux this is often '/dev/usb/lp0',
// for serial printers it could be similar to '/dev/ttyS0'
// Make sure that the user that runs the webserver has permissions to write to the printer!
Setting('TPRINTER_CONNECTOR', '/dev/usb/lp0'); // Location of printer. For USB on Linux this is often '/dev/usb/lp0',
// for serial printers it could be similar to '/dev/ttyS0'
// Make sure that the user that runs the webserver has permissions to write to the printer!
// Default user settings

View File

@ -949,14 +949,20 @@ class StockService extends BaseService
$result = array();
$rowsShoppingListProducts = $this->getDatabase()->uihelper_shopping_list()->where('shopping_list_id = :1', $listId)->fetchAll();
foreach ($rowsShoppingListProducts as $row) {
$note = "";
if (GROCY_TPRINTER_PRINT_NOTES) {
if (isset($row["note"])) {
$note = ' (' . $row["note"] . ')';
}
}
if (GROCY_TPRINTER_PRINT_QUANTITY_NAME) {
$quantityname = $row["qu_name"];
if ($row["amount"] > 1) {
$quantityname = $row["qu_name_plural"];
}
array_push($result, $row["amount"] . ' ' . $quantityname . ' ' . $row["product_name"]);
array_push($result, $row["amount"] . ' ' . $quantityname . ' ' . $row["product_name"] . $note);
} else {
array_push($result, $row["amount"] . ' ' . $row["product_name"]);
array_push($result, $row["amount"] . ' ' . $row["product_name"] . $note);
}
}
return $result;