$total_quantity_pieces[$oid] += $i['approved_by'] == '' ? $row['quantity_request'] : $row['quantity'];
     }
     $total_price[$oid] += $price;
 }
 $ocount = 0;
 foreach ($orders as $oid => $o) {
     $ocount++;
     $rowsepartr = '<tr><td colspan="2">' . str_repeat('-', 50) . '</td></tr>';
     $tabcontent .= '<div id="pogrp-' . $oid . '" style="width:1210px;' . ($ocount > 1 ? 'margin-top:40px;padding-top:20px;border-top:1px dotted #ccc;' : '') . '">';
     $tabcontent .= '<div style="float:right;"><table class="form" border="0" cellpadding="0" cellspacing="0">';
     $tabcontent .= '<tr><td class="label">Supplier Name</td><td class="label">' . $o['suppliers_name'] . '</td></tr>';
     $tabcontent .= '<tr><td class="label">Supplier Address</td><td>' . nl2br($o['suppliers_address']) . '</td></tr>';
     $tabcontent .= '<tr><td class="label">Supplier Contact</td><td>' . $o['suppliers_contact'] . '</td></tr>';
     $tabcontent .= '<tr><td class="label">Supplier Phone</td><td>' . $o['suppliers_number'] . '</td></tr>';
     $tabcontent .= $rowsepartr;
     $suggested_mwr = elements_order::suggestedMinWeightRules();
     $class_tw = '';
     if (array_key_exists($o['suppliers_id'], $suggested_mwr)) {
         $sup_name = $suggested_mwr[$o['suppliers_id']]['name'];
         $sup_rule = $suggested_mwr[$o['suppliers_id']]['weight'];
         $tabcontent .= '<tr><td colspan="2">';
         $tabcontent .= '<strong style="text-decoration:blink;">* ' . $sup_name . ' Suggested Minimum Weight is ' . $sup_rule . ' gram</strong>';
         $tabcontent .= '</td></tr>';
         $class_tw = $total_weight[$oid] >= $sup_rule ? 'green' : 'red';
     }
     $tabcontent .= '<tr class="' . $class_tw . '"><td class="label bold">TOTAL WEIGHT</td><td class="bold"><span id="tw-' . $oid . '">' . $total_weight[$oid] . '</span> gram</td></tr>';
     if ($total_quantity_pieces[$oid] > 0) {
         $tabcontent .= '<tr><td class="label bold">TOTAL PIECES</td><td class="bold"><span id="tq-' . $oid . '">' . $total_quantity_pieces[$oid] . '</span> pieces</td></tr>';
     }
     $tabcontent .= '<tr><td class="label bold">TOTAL PRICE</td><td class="bold"><span id="tp-' . $oid . '">' . displayCurrency($o['currency'], $total_price[$oid]) . '</span></td></tr>';
     $tabcontent .= $rowsepartr;