Added Brand and Size fields to the Ordering Worksheet.

Also tweaked the template styles slightly, and added the ability to
override the template via config.
This commit is contained in:
Lance Edgar 2013-02-11 18:55:21 -08:00
parent d14b388b4b
commit 80eb558783
2 changed files with 22 additions and 6 deletions

View file

@ -5,6 +5,10 @@
<title>Ordering Worksheet : ${vendor.name}</title>
<style type="text/css">
body {
font-family: sans-serif;
}
h1 {
font-size: 24px;
margin: 10px 0px;
@ -57,6 +61,11 @@
text-align: center;
}
td.code {
font-family: monospace;
font-size: 120%;
}
td.scratch_pad {
width: 20px;
}
@ -79,24 +88,28 @@
<table>
% for dept in sorted(costs, key=lambda x: x.name):
<tr>
<th class="department" colspan="19">Department:&nbsp; ${dept.name} (${dept.number})</th>
<th class="department" colspan="21">Department:&nbsp; ${dept.name} (${dept.number})</th>
</tr>
% for subdept in sorted(costs[dept], key=lambda x: x.name):
<tr>
<th class="subdepartment" colspan="19">Subdepartment:&nbsp; ${subdept.name} (${subdept.number})</th>
<th class="subdepartment" colspan="21">Subdepartment:&nbsp; ${subdept.name} (${subdept.number})</th>
</tr>
<tr>
<th>UPC</th>
<th>Brand</th>
<th>Description</th>
<th>Case Qty.</th>
<th>Size</th>
<th>Case</th>
<th>Vend. Code</th>
<th>Preferred</th>
<th>Pref.</th>
<th colspan="14">Order Scratch Pad</th>
</tr>
% for cost in sorted(costs[dept][subdept], key=lambda x: x.product.description):
<tr>
<td class="upc">${get_upc(cost.product)}</td>
<td class="brand">${cost.product.brand or ''}</td>
<td class="desc">${cost.product.description}</td>
<td class="size">${cost.product.size or ''}</td>
<td class="case-qty">${cost.case_size} ${rattail.UNIT_OF_MEASURE.get(cost.product.unit_of_measure, '')}</td>
<td class="code">${cost.code or ''}</td>
<td class="preferred">${'X' if cost.preference == 1 else ''}</td>
@ -106,7 +119,7 @@
</tr>
% endfor
<tr>
<td class="spacer" colspan="19">
<td class="spacer" colspan="21">
</tr>
% endfor
% endfor

View file

@ -14,6 +14,7 @@ from pyramid.response import Response
import edbob
from edbob.pyramid import Session
from edbob.files import resource_path
import rattail
@ -83,7 +84,9 @@ def write_ordering_worksheet(vendor, departments):
rattail=rattail,
)
report = os.path.join(os.path.dirname(__file__), os.pardir, 'reports', 'ordering_worksheet.mako')
report = resource_path('rattail.pyramid:reports/ordering_worksheet.mako')
report = edbob.config.get('rattail.pyramid', 'report.ordering_worksheet',
default=report)
report = os.path.abspath(report)
template = Template(filename=report, disable_unicode=True)
return template.render(**data)