Tweak order form view for new purchase batches

This commit is contained in:
Lance Edgar 2016-11-08 13:06:56 -06:00
parent 7454e611c5
commit c51d0db42d
3 changed files with 8 additions and 5 deletions

View file

@ -74,6 +74,7 @@
width: 3em; width: 3em;
} }
.order-form td.unit-cost,
.order-form td.po-total { .order-form td.po-total {
text-align: right; text-align: right;
} }
@ -127,10 +128,10 @@
<th>UPC</th> <th>UPC</th>
<th>Brand</th> <th>Brand</th>
<th>Description</th> <th>Description</th>
<th>Size</th>
<th>Case</th> <th>Case</th>
<th>Vend. Code</th> <th>Vend. Code</th>
<th>Pref.</th> <th>Pref.</th>
<th>Unit Cost</th>
<th colspan="7">&nbsp;</th> <th colspan="7">&nbsp;</th>
<th>PO Total</th> <th>PO Total</th>
</tr> </tr>
@ -140,11 +141,11 @@
<tr data-uuid="${cost.product_uuid}"> <tr data-uuid="${cost.product_uuid}">
<td class="upc">${get_upc(cost.product)}</td> <td class="upc">${get_upc(cost.product)}</td>
<td class="brand">${cost.product.brand or ''}</td> <td class="brand">${cost.product.brand or ''}</td>
<td class="desc">${cost.product.description}</td> <td class="desc">${cost.product.description} ${cost.product.size or ''}</td>
<td class="size">${cost.product.size or ''}</td>
<td class="case-qty">${cost.case_size} ${"LB" if cost.product.weighed else "EA"}</td> <td class="case-qty">${cost.case_size} ${"LB" if cost.product.weighed else "EA"}</td>
<td class="code">${cost.code or ''}</td> <td class="code">${cost.code or ''}</td>
<td class="preferred">${'X' if cost.preference == 1 else ''}</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): % for i in range(6):
<td class="scratch_pad">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td> <td class="scratch_pad">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
% endfor % endfor

View file

@ -7,7 +7,7 @@
$(function() { $(function() {
$('#order-form').click(function() { $('#order-form').click(function() {
% if vendor_cost_count > 199: % if vendor_cost_count > vendor_cost_threshold:
if (! confirm("This vendor has ${'{:,d}'.format(vendor_cost_count)} cost records.\n\n" + if (! confirm("This vendor has ${'{:,d}'.format(vendor_cost_count)} cost records.\n\n" +
"It is not recommended to use Order Form mode for such a large catalog.\n\n" + "It is not recommended to use Order Form mode for such a large catalog.\n\n" +
"Are you sure you wish to do it anyway?")) { "Are you sure you wish to do it anyway?")) {

View file

@ -139,6 +139,8 @@ class PurchaseBatchView(BatchMasterView):
kwargs['vendor_cost_count'] = Session.query(model.ProductCost)\ kwargs['vendor_cost_count'] = Session.query(model.ProductCost)\
.filter(model.ProductCost.vendor == vendor)\ .filter(model.ProductCost.vendor == vendor)\
.count() .count()
kwargs['vendor_cost_threshold'] = self.rattail_config.getint(
'tailbone', 'purchases.order_form.vendor_cost_warning_threshold', default=699)
return kwargs return kwargs
def _preconfigure_row_grid(self, g): def _preconfigure_row_grid(self, g):
@ -325,7 +327,7 @@ class PurchaseBatchView(BatchMasterView):
'index_url': self.get_action_url('view', batch), 'index_url': self.get_action_url('view', batch),
'vendor': vendor, 'vendor': vendor,
'departments': departments, 'departments': departments,
'get_upc': lambda p: p.upc, 'get_upc': lambda p: p.upc.pretty() if p.upc else '',
}) })
def order_form_update(self): def order_form_update(self):