Formatting data is the final step in building a receipt. Modules implementing DefaultReceiptFormat take a single record of data and return a formatted string to print on the receipt. Format modules are not configured directly; they're loaded based on tags so classes should always be named [tag value]ReceiptFormat (e.g., ItemReceiptFormat, TenderReceiptFormat, etc). Subclasses must implement the method format which takes an array of data and returns a string. Modules may also adjust the class property is_bold. The default is false. If you switch it to true, that line will be printed in bold.
Example:
class CustomBananasReceiptFormat extends DefaultReceiptFormat { function format($row){ $line = str_pad($row['description'],30,' ',STR_PAD_RIGHT); $line .= str_pad('MONKEY CHOW',14,' ',STR_PAD_RIGHT); $price = sprintf('%.2f',$row['total']); $line .= str_pad($price,8,' ',STR_PAD_LEFT); $this->is_bold = True; return $line; } }
Change Log: 10Apr13 Andy Theuninck - Created document