31 |
|
|
32 |
from gnue.common.events.EventAware import EventAware |
from gnue.common.events.EventAware import EventAware |
33 |
|
|
34 |
|
LEFT_ALIGN=0 |
35 |
|
CENTER_ALIGN=0 |
36 |
|
RIGHT_ALIGN=2 |
37 |
|
|
38 |
dollarFormat = '$%.02f' |
dollarFormat = '$%.02f' |
39 |
|
|
40 |
class Driver(EventAware): |
class Driver(EventAware): |
56 |
self.instance = instance |
self.instance = instance |
57 |
self.__dict__.update(params) |
self.__dict__.update(params) |
58 |
self.output = None |
self.output = None |
59 |
|
self.width = hasattr(self,'width') and self.width or 40 |
60 |
|
|
61 |
self.totalFields = ( ('subtotal',_('Subtotal')), |
self.totalFields = ( ('subtotal',_('Subtotal')), |
62 |
('mstax','MS Sales Tax (7%)'), |
('mstax','MS Sales Tax (7%)'), |
63 |
('total',_('Total')) ) |
('total',_('Total')) ) |
64 |
|
|
65 |
self.receiptColumns = ( ('department',_('Dept'), '%s', 0), |
self.receiptColumns = ( |
66 |
('sku',_('Code'), '%s', 0), |
('sku',_('Code'), '%s', 0), |
67 |
('quantity',_('Units'), '%s', 0), |
('quantity',_('Units'), '%s', 0), |
68 |
('description',_('Description'), '%s', 0), |
('description',_('Description'), '%s', 0), |
86 |
self.output = open(self.port,'w') |
self.output = open(self.port,'w') |
87 |
self.totals = {} |
self.totals = {} |
88 |
self.output.write(""" |
self.output.write(""" |
|
------------------------------ |
|
|
Company Header |
|
|
123 N Main St |
|
|
Yourtown, TN 38011 |
|
|
(662) 555-1234 |
|
|
------------------------------ |
|
89 |
|
|
90 |
Receipt # %s |
Old Towne Market |
91 |
|
9120 Pigeon Roost Rd |
92 |
|
Olive Branch, MS 38654 |
93 |
|
(662) 893-5669 |
94 |
|
|
95 |
|
|
96 |
|
Transaction # %s |
97 |
%s %s %s |
%s %s %s |
98 |
|
|
99 |
""" % (event.serial, '06/23/03','12:13pm','Jason')) |
""" % (event.serial, '06/23/03','12:13pm','Jason')) |
136 |
def _UpdateTotal(self, event): |
def _UpdateTotal(self, event): |
137 |
self.totals[event.field] = event.amount |
self.totals[event.field] = event.amount |
138 |
|
|
139 |
|
|
140 |
|
def write(self, text, double=0, color=0, alignment=0): |
141 |
|
pass |