Add historical amounts to new purchase Order Form, allow extra columns etc.

This commit is contained in:
Lance Edgar 2016-11-08 22:45:58 -06:00
parent bf5808d517
commit da5c040aeb
2 changed files with 65 additions and 21 deletions

View file

@ -61,7 +61,8 @@
.order-form td.upc,
.order-form td.case-qty,
.order-form td.code,
.order-form td.preferred {
.order-form td.preferred,
.order-form td.scratch_pad {
text-align: center;
}
@ -100,11 +101,6 @@
<div class="field">${vendor}</div>
</div>
<div class="field-wrapper">
<label>Order Date</label>
<div class="field">${batch.date_ordered}</div>
</div>
<div class="field-wrapper po-total">
<label>PO Total</label>
<div class="field">$${'{:0,.2f}'.format(batch.po_total or 0)}</div>
@ -115,14 +111,15 @@
<div class="newgrid">
<table class="order-form">
<% column_count = 22 + int(capture(self.extra_count)) %>
% for department in sorted(departments.itervalues(), key=lambda d: d.name if d else ''):
<thead>
<tr>
<th class="department" colspan="22">Department:&nbsp; ${department.number} ${department.name}</th>
<th class="department" colspan="${column_count}">Department ${department.number} ${department.name}</th>
</tr>
% for subdepartment in sorted(department._order_subdepartments.itervalues(), key=lambda s: s.name if s else ''):
<tr>
<th class="subdepartment" colspan="22">Subdepartment:&nbsp; ${subdepartment.number} ${subdepartment.name}</th>
<th class="subdepartment" colspan="${column_count}">Subdepartment ${subdepartment.number} ${subdepartment.name}</th>
</tr>
<tr>
<th>UPC</th>
@ -132,8 +129,12 @@
<th>Vend. Code</th>
<th>Pref.</th>
<th>Unit Cost</th>
<th colspan="7">&nbsp;</th>
% for data in history.itervalues():
<th>${data['purchase'].date_ordered.strftime('%m/%d') if data else ''}</th>
% endfor
<th>${batch.date_ordered.strftime('%m/%d')}</th>
<th>PO Total</th>
${self.extra_th()}
</tr>
</thead>
<tbody>
@ -146,13 +147,18 @@
<td class="code">${cost.code or ''}</td>
<td class="preferred">${'X' if cost.preference == 1 else ''}</td>
<td class="unit-cost">$${'{:0.2f}'.format(cost.unit_cost)}</td>
% for i in range(6):
<td class="scratch_pad">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
% for data in history.itervalues():
<td class="scratch_pad">
% if data and cost.product_uuid in data['items']:
${int(data['items'][cost.product_uuid].cases_ordered or 0) or ''}
% endif
</td>
% endfor
<td class="current-order">
${h.text('cases_ordered_{}'.format(cost.uuid), value=int(cost._batchrow.cases_ordered) if cost._batchrow else None)}
</td>
<td class="po-total">${'${:0,.2f}'.format(cost._batchrow.po_total) if cost._batchrow else ''}</td>
${self.extra_td(cost)}
</tr>
% endfor
</tbody>
@ -160,3 +166,10 @@
% endfor
</table>
</div>
<%def name="extra_count()">0</%def>
<%def name="extra_th()"></%def>
<%def name="extra_td(cost)"></%def>