Skip to content

Instantly share code, notes, and snippets.

@gohanman
Last active July 7, 2016 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gohanman/fa9e763b8e496a59170572484d8f5e50 to your computer and use it in GitHub Desktop.
Save gohanman/fa9e763b8e496a59170572484d8f5e50 to your computer and use it in GitHub Desktop.
ChangePlugin.php
<?php
use COREPOS\pos\lib\ReceiptLib;
use COREPOS\pos\lib\Database;
use COREPOS\pos\plugins\Plugin;
class ChangePlugin extends Plugin
{
public function plugin_transaction_reset()
{
$ref = ReceiptLib::mostRecentReceipt();
list($emp,$reg,$trans) = explode('-', $ref);
$dbc = Database::tDataConnect();
$prep = $dbc->prepare('
SELECT SUM(total)
FROM localtranstoday
WHERE emp_no=?
AND register_no=?
AND trans_no=?
AND trans_type=\'T\'
AND trans_subtype=\'CA\'
AND description=\'Change\'
');
$change = $dbc->getValue($prep, [$emp,$reg,$trans]);
if ($change) {
// dispenser voodoo goes here
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment