ON p.id = i.parts_id
LEFT JOIN oe
- ON (oe.ordnumber = ${arap}.ordnumber AND NOT ${arap}.ordnumber = '')
+ ON (oe.ordnumber = ${arap}.ordnumber AND NOT ${arap}.ordnumber = ''
+ AND ". ($arap eq 'ar' ? 'oe.customer_id IS NOT NULL' : 'oe_vendor_id IS NOT NULL') ." )
${where}
ORDER BY ${arap}.transdate DESC LIMIT 15";
<tr class="listrow[% loop.count % 2 %]">
<td>[% HTML.escape(row.shiptoname) UNLESS loop.prev.shiptoname == row.shiptoname %] </td>
<td>[% IF row.id %]<a href='[% row.script %].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=[% IF is_customer %]sales_order[% ELSE %]purchase_order[% END %]&vc=customer&id=[% HTML.escape(row.oe_id) %]'>[% END %][% HTML.escape(row.ordnumber) || ' ' %][% IF row.oe_id %]</a>[% END %]</td>
+ <td>[% IF row.oe_id %]<a href='oe.pl?action=edit&type=[% IF SELF.is_customer %]sales_order[% ELSE %]purchase_order[% END %]&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>