- $rep->AmountCol(3, 4, $trans['quantity_received'], $qdec);
- $rep->AmountCol(4, 5, $trans['unit_price'], $dec);
- $rep->AmountCol(5, 6, $trans['act_price'], $dec);
- $amt = round2($trans['quantity_received'] * $trans['act_price'], $dec);
- $rep->AmountCol(6, 7, $amt, $dec);
- $total += $amt;
- $qtotal += $trans['quantity_received'];
- $grandtotal += $amt;
+ $rep->TextCol(3, 4, $trans['batch_no']);
+
+ if ($trans['quantity_inv'])
+ {
+ $suppinv = getSuppInvDetails($trans['grn_item_id']);
+ while ($inv=db_fetch($suppinv))
+ {
+ $inv['inv_price'] *= $inv['rate'];
+ $rep->TextCol(4, 5, $inv['inv_no']);
+ $rep->AmountCol(5, 6, $inv['inv_qty'], $qdec);
+ $rep->AmountCol(6, 7, $inv['inv_price'], $dec);
+ $rep->AmountCol(7, 8, $trans['std_cost_unit'], $dec);
+ $amt = round2($inv['inv_qty'] * $inv['inv_price'], $dec);
+ $rep->AmountCol(8, 9, $amt, $dec);
+ $rep->NewLine();
+ $total += $amt;
+ $qtotal += $inv['inv_qty'];
+ $grandtotal += $amt;
+ }
+ }
+
+ if ($trans['qty_recd'] - $trans['quantity_inv'] !=0 )
+ {
+ $curr = get_supplier_currency($trans['supplier_id']);
+ $rate = get_exchange_rate_from_home_currency($curr, sql2date($trans['delivery_date']));
+ $trans['unit_price'] *= $rate;
+ $rep->TextCol(4, 5, "--");
+ $rep->AmountCol(5, 6, $trans['qty_recd'] - $trans['quantity_inv'], $qdec);
+ $rep->AmountCol(7, 8, $trans['unit_price'], $dec);
+ $amt = round2(($trans['qty_recd'] - $trans['quantity_inv']) * $trans['unit_price'], $dec);
+ $rep->AmountCol(8, 9, $amt, $dec);
+ $total += $amt;
+ $qtotal += $trans['qty_recd'] - $trans['quantity_inv'];
+ $grandtotal += $amt;
+ }
+ else
+ $rep->NewLine(-1);