Skip to content

Commit

Permalink
Include item codes on invoices
Browse files Browse the repository at this point in the history
  • Loading branch information
jimwins committed Nov 14, 2016
1 parent 8bdfdf5 commit 8d673f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/txn.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ function txn_load_items($db, $id) {
END), '') discount,
ordered * IF(txn.type = 'customer', -1, 1) AS quantity,
allocated * IF(txn.type = 'customer', -1, 1) AS allocated,
(SELECT SUM(allocated) FROM txn_line WHERE item = item.id) AS stock
(SELECT SUM(allocated) FROM txn_line WHERE item = item.id) AS stock,
purchase_quantity
FROM txn
LEFT JOIN txn_line ON (txn.id = txn_line.txn)
JOIN item ON (txn_line.item = item.id)
Expand Down
4 changes: 2 additions & 2 deletions print/invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<thead>
<tr>
<th class="right">#</th>
<?=($details['type'] == 'vendor' ? '<th class="left">Code</th>' : '')?>
<th class="left">Code</th>
<th class="left">Name</th>
<th class="right">Price</th>
<th class="right">Total</th>
Expand All @@ -92,7 +92,7 @@
foreach ($items as $item) {
echo '<tr valign="top">',
'<td class="right">', $item['quantity'], '</td>',
($details['type'] == 'vendor' ? '<td class="left">' . $item['code'] . '</td>' : ''),
(($details['type'] == 'vendor' || $item['purchase_quantity']) ? '<td class="left">' . $item['code'] . '</td>' : '<td></td>'),
'<td class="left">', $item['name'],
($item['discount'] ? ('<div class="description">' . $item['discount'] . '</div>') : ''),
'</td>',
Expand Down

0 comments on commit 8d673f5

Please sign in to comment.