- db_query($sql, "Can't change sales order type");
- $Ajax->activate('orders_tbl');
+ if ($row['ord_payments'] > 0) {
+ $pmts = get_payments_for($row['order_no'], $row['trans_type'], $row['debtor_no']);
+
+ foreach($pmts as $pmt)
+ {
+ $list[] = get_trans_view_str($pmt['trans_type_from'], $pmt['trans_no_from'], get_reference($pmt['trans_type_from'], $pmt['trans_no_from']));
+ }
+ return implode(',', $list);
+ } else
+ return '';
+}
+
+function invoice_prep_link($row)
+{
+ // invoicing should be available only for partially allocated orders
+ return
+ $row['inv_payments'] < $row['total'] ?
+ pager_link($row['ord_payments'] ? _("Prepayment Invoice") : _("Final Invoice"),
+ "/sales/customer_invoice.php?InvoicePrepayments=" .$row['order_no'], ICON_DOC) : '';