+function systype_name($dummy, $type)
+{
+ global $systypes_array;
+
+ return $systypes_array[$type];
+}
+
+function order_view($row)
+{
+ return $row['order_']>0 ?
+ get_customer_trans_view_str(ST_SALESORDER, $row['order_'])
+ : "";
+}
+
+function trans_view($trans)
+{
+ return get_trans_view_str($trans["type"], $trans["trans_no"]);
+}
+
+function due_date($row)
+{
+ return $row["type"] == ST_SALESINVOICE ? $row["due_date"] : '';
+}
+
+function gl_view($row)
+{
+ return get_gl_view_str($row["type"], $row["trans_no"]);
+}
+
+function fmt_debit($row)
+{
+ $value =
+ $row['type']==ST_CUSTCREDIT || $row['type']==ST_CUSTPAYMENT || $row['type']==ST_BANKDEPOSIT ?
+ -$row["TotalAmount"] : $row["TotalAmount"];
+ return $value>=0 ? price_format($value) : '';
+
+}
+
+function fmt_credit($row)
+{
+ $value =
+ !($row['type']==ST_CUSTCREDIT || $row['type']==ST_CUSTPAYMENT || $row['type']==ST_BANKDEPOSIT) ?
+ -$row["TotalAmount"] : $row["TotalAmount"];
+ return $value>0 ? price_format($value) : '';
+}
+
+function credit_link($row)
+{
+ return $row['type'] == ST_SALESINVOICE && $row["TotalAmount"] - $row["Allocated"] > 0 ?
+ pager_link(_("Credit This"),
+ "/sales/customer_credit_invoice.php?InvoiceNumber=".
+ $row['trans_no'], ICON_CREDIT)
+ : '';
+}
+
+function edit_link($row)
+{
+ $str = '';
+
+ switch($row['type']) {
+ case ST_SALESINVOICE:
+ if (get_voided_entry(ST_SALESINVOICE, $row["trans_no"]) === false && $row['Allocated'] == 0)
+ $str = "/sales/customer_invoice.php?ModifyInvoice=".$row['trans_no'];
+ break;
+ case ST_CUSTCREDIT:
+ if (get_voided_entry(ST_CUSTCREDIT, $row["trans_no"]) === false && $row['Allocated'] == 0) // 2008-11-19 Joe Hunt
+ {
+ if ($row['order_']==0) // free-hand credit note
+ $str = "/sales/credit_note_entry.php?ModifyCredit=".$row['trans_no'];
+ else // credit invoice
+ $str = "/sales/customer_credit_invoice.php?ModifyCredit=".$row['trans_no'];
+ }
+ break;
+ case ST_CUSTDELIVERY:
+ if (get_voided_entry(ST_CUSTDELIVERY, $row["trans_no"]) === false)
+ $str = "/sales/customer_delivery.php?ModifyDelivery=".$row['trans_no'];
+ break;
+ }
+ if ($str != "" && !is_closed_trans($row['type'], $row["trans_no"]))
+ return pager_link(_('Edit'), $str, ICON_EDIT);
+ return '';
+}
+
+function prt_link($row)
+{
+ if ($row['type'] != ST_CUSTPAYMENT && $row['type'] != ST_BANKDEPOSIT) // customer payment or bank deposit printout not defined yet.
+ return print_document_link($row['trans_no'], _("Print"), true, $row['type'], ICON_PRINT);
+}
+
+function check_overdue($row)