}
my $query =
qq|SELECT s.shiptoname, i.qty, | .
- qq| ${arap}.transdate, ${arap}.invnumber, ${arap}.ordnumber, | .
- qq| i.description, i.unit, i.sellprice | .
+ qq| ${arap}.id, ${arap}.transdate, ${arap}.invnumber, ${arap}.ordnumber, | .
+ qq| i.description, i.unit, i.sellprice, | .
+ qq| oe.id AS oe_id | .
qq|FROM $arap | .
qq|LEFT JOIN shipto s ON | .
($arap eq "ar"
: qq|(ap.id = s.trans_id) |) .
qq|LEFT JOIN invoice i ON (${arap}.id = i.trans_id) | .
qq|LEFT join parts p ON (p.id = i.parts_id) | .
+ qq|LEFT JOIN oe ON (oe.ordnumber = ${arap}.ordnumber AND NOT ${arap}.ordnumber = '') | .
$where .
qq|ORDER BY ${arap}.transdate DESC LIMIT 15|;
[%- FOREACH row = DELIVERY %]
<tr class="listrow[% loop.count % 2 %]">
<td>[% HTML.escape(row.shiptoname) UNLESS loop.prev.shiptoname == row.shiptoname %] </td>
- <td>[% HTML.escape(row.invnumber) %] </td>
- <td>[% HTML.escape(row.ordnumber) %] </td>
- <td>[% HTML.escape(row.transdate) %] </td>
- <td>[% HTML.escape(row.description) %] </td>
- <td>[% HTML.escape(row.qty) %] </td>
- <td>[% HTML.escape(row.unit) %] </td>
- <td>[% LxERP.format_amount(row.sellprice, 2) %] </td>
+ <td>[% IF row.id %]<a href='is.pl?action=edit&id=[% HTML.escape(row.id) %]'>[% END %][% HTML.escape(row.invnumber) || ' ' %][% IF row.id %]</a>[% END %]</td>
+ <td>[% IF row.oe_id %]<a href='oe.pl?action=edit&type=sales_order&vc=customer&id=[% HTML.escape(row.oe_id) %]'>[% END %][% HTML.escape(row.ordnumber) || ' ' %][% IF row.oe_id %]</a>[% END %]</td>
+ <td>[% HTML.escape(row.transdate) || ' ' %]</td>
+ <td>[% HTML.escape(row.description) || ' ' %]</td>
+ <td>[% HTML.escape(row.qty) || ' ' %]</td>
+ <td>[% HTML.escape(row.unit) || ' ' %]</td>
+ <td>[% LxERP.format_amount(row.sellprice, 2) || ' ' %]</td>
</tr>
[%- END %]
[%- FOREACH row = DELIVERY %]
<tr class="listrow[% loop.count % 2 %]">
<td>[% HTML.escape(row.shiptoname) UNLESS loop.prev.shiptoname == row.shiptoname %] </td>
- <td>[% HTML.escape(row.invnumber) %] </td>
- <td>[% HTML.escape(row.ordnumber) %] </td>
- <td>[% HTML.escape(row.transdate) %] </td>
- <td>[% HTML.escape(row.description) %] </td>
- <td>[% HTML.escape(row.qty) %] </td>
- <td>[% HTML.escape(row.unit) %] </td>
- <td>[% LxERP.format_amount(row.sellprice, 2) %] </td>
+ <td>[% IF row.id %]<a href='is.pl?action=edit&id=[% HTML.escape(row.id) %]'>[% END %][% HTML.escape(row.invnumber) || ' ' %][% IF row.id %]</a>[% END %]</td>
+ <td>[% IF row.oe_id %]<a href='oe.pl?action=edit&type=sales_order&vc=customer&id=[% HTML.escape(row.oe_id) %]'>[% END %][% HTML.escape(row.ordnumber) || ' ' %][% IF row.oe_id %]</a>[% END %]</td>
+ <td>[% HTML.escape(row.transdate) || ' ' %]</td>
+ <td>[% HTML.escape(row.description) || ' ' %]</td>
+ <td>[% HTML.escape(row.qty) || ' ' %]</td>
+ <td>[% HTML.escape(row.unit) || ' ' %]</td>
+ <td>[% LxERP.format_amount(row.sellprice, 2) || ' ' %]</td>
</tr>
[%- END %]