Add support for more cases + units, more vendor fields, for new purchase batches
This commit is contained in:
parent
1f9a27a7ae
commit
11b4cf9616
3 changed files with 97 additions and 17 deletions
|
@ -15,17 +15,19 @@
|
|||
}
|
||||
if (event.which == 13) {
|
||||
var input = $(this);
|
||||
var row = input.parents('tr:first');
|
||||
var row = $(this).parents('tr:first');
|
||||
var data = {
|
||||
product_uuid: row.data('uuid'),
|
||||
cases_ordered: input.val() || '0'
|
||||
cases_ordered: row.find('input[name^="cases_ordered_"]').val() || '0',
|
||||
units_ordered: row.find('input[name^="units_ordered_"]').val() || '0'
|
||||
};
|
||||
$.post('${url('purchases.batch.order_form_update', uuid=batch.uuid)}', data, function(data) {
|
||||
if (data.error) {
|
||||
alert(data.error);
|
||||
} else {
|
||||
input.val(data.row_cases_ordered);
|
||||
row.find('td:eq(14)').html(data.row_po_total);
|
||||
row.find('input[name^="cases_ordered_"]').val(data.row_cases_ordered);
|
||||
row.find('input[name^="units_ordered_"]').val(data.row_units_ordered);
|
||||
row.find('td:eq(15)').html(data.row_po_total);
|
||||
$('.po-total .field').html(data.batch_po_total);
|
||||
}
|
||||
});
|
||||
|
@ -98,9 +100,31 @@
|
|||
|
||||
<div class="field-wrapper">
|
||||
<label>Vendor</label>
|
||||
<div class="field">${vendor}</div>
|
||||
<div class="field">${h.link_to(vendor, url('vendors.view', uuid=vendor.uuid))}</div>
|
||||
</div>
|
||||
|
||||
<div class="field-wrapper">
|
||||
<label>Vendor Email</label>
|
||||
<div class="field">${vendor.email or ''}</div>
|
||||
</div>
|
||||
|
||||
<div class="field-wrapper">
|
||||
<label>Vendor Fax</label>
|
||||
<div class="field">${vendor.fax_number or ''}</div>
|
||||
</div>
|
||||
|
||||
<div class="field-wrapper">
|
||||
<label>Vendor Contact</label>
|
||||
<div class="field">${vendor.contact or ''}</div>
|
||||
</div>
|
||||
|
||||
<div class="field-wrapper">
|
||||
<label>Vendor Phone</label>
|
||||
<div class="field">${vendor.phone or ''}</div>
|
||||
</div>
|
||||
|
||||
${self.extra_vendor_fields()}
|
||||
|
||||
<div class="field-wrapper po-total">
|
||||
<label>PO Total</label>
|
||||
<div class="field">$${'{:0,.2f}'.format(batch.po_total or 0)}</div>
|
||||
|
@ -111,7 +135,7 @@
|
|||
|
||||
<div class="newgrid">
|
||||
<table class="order-form">
|
||||
<% column_count = 15 + int(capture(self.extra_count)) %>
|
||||
<% column_count = 16 + int(capture(self.extra_count)) %>
|
||||
% for department in sorted(departments.itervalues(), key=lambda d: d.name if d else ''):
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -132,7 +156,14 @@
|
|||
% 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>
|
||||
${batch.date_ordered.strftime('%m/%d')}<br />
|
||||
Cases
|
||||
</th>
|
||||
<th>
|
||||
${batch.date_ordered.strftime('%m/%d')}<br />
|
||||
Units
|
||||
</th>
|
||||
<th>PO Total</th>
|
||||
${self.extra_th()}
|
||||
</tr>
|
||||
|
@ -150,13 +181,17 @@
|
|||
% 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 ''}
|
||||
${'{} / {}'.format(int(data['items'][cost.product_uuid].cases_ordered or 0), int(data['items'][cost.product_uuid].units_ordered or 0))}
|
||||
## ${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="current-order">
|
||||
${h.text('units_ordered_{}'.format(cost.uuid), value=int(cost._batchrow.units_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>
|
||||
|
@ -168,6 +203,8 @@
|
|||
</div>
|
||||
|
||||
|
||||
<%def name="extra_vendor_fields()"></%def>
|
||||
|
||||
<%def name="extra_count()">0</%def>
|
||||
|
||||
<%def name="extra_th()"></%def>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue