} elseif ($row["type"] == ST_CUSTPAYMENT && $row['TotalAmount'] <= 0) { /*its a negative receipt */ return ''; } elseif ($row["type"] == ST_SALESINVOICE && $row['TotalAmount'] - $row['Allocated'] > 0) { return pager_link(_("Payment"), "/sales/customer_payments.php?customer_id=" . $row["debtor_no"] . "&SInvoice=" . $row["trans_no"], ICON_MONEY); } } 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) : ''; } //------------------------------------------------------------------------------------------------ $sql = get_sql_for_customer_allocation_inquiry(get_post('TransAfterDate'), get_post('TransToDate'), get_post('customer_id'), get_post('filterType'), check_value('showSettled')); //------------------------------------------------------------------------------------------------ $cols = array(_("Type") => array('fun' => 'systype_name'), _("#") => array('fun' => 'view_link'), _("Reference"), _("Order") => array('fun' => 'order_link', 'ord' => ''), _("Date") => array('name' => 'tran_date', 'type' => 'date', 'ord' => 'asc'), _("Due Date") => array('type' => 'date', 'fun' => 'due_date'), _("Customer") => array('name' => 'name', 'ord' => 'asc'), _("Currency") => array('align' => 'center'), _("Debit") => array('align' => 'right', 'fun' => 'fmt_debit'), _("Credit") => array('align' => 'right', 'insert' => true, 'fun' => 'fmt_credit'), _("Allocated") => 'amount', _("Balance") => array('type' => 'amount', 'insert' => true, 'fun' => 'fmt_balance'), array('insert' => true, 'fun' => 'alloc_link')); if ($_POST['customer_id'] != ALL_TEXT) { $cols[_("Customer")] = 'skip'; $cols[_("Currency")] = 'skip'; } $table =& new_db_pager('doc_tbl', $sql, $cols); $table->set_marker('check_overdue', _("Marked items are overdue.")); $table->width = "80%"; display_db_pager($table); end_form(); end_page();
} elseif ($row["type"] == ST_CUSTPAYMENT && $row['TotalAmount'] < 0) { /*its a negative receipt */ return ''; } elseif ($row["type"] == ST_SALESINVOICE && $row['TotalAmount'] - $row['Allocated'] > 0) { return pager_link(_("Payment"), "/sales/customer_payments.php?customer_id=" . $row["debtor_no"] . "&SInvoice=" . $row["trans_no"], ICON_MONEY); } } 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) : ''; } //------------------------------------------------------------------------------------------------ $sql = get_sql_for_customer_allocation_inquiry(); //------------------------------------------------------------------------------------------------ $cols = array(_("Type") => array('fun' => 'systype_name'), _("#") => array('fun' => 'view_link'), _("Reference"), _("Order") => array('fun' => 'order_link', 'ord' => ''), _("Date") => array('name' => 'tran_date', 'type' => 'date', 'ord' => 'asc'), _("Due Date") => array('type' => 'date', 'fun' => 'due_date'), _("Customer") => array('name' => 'name', 'ord' => 'asc'), _("Currency") => array('align' => 'center'), _("Debit") => array('align' => 'right', 'fun' => 'fmt_debit'), _("Credit") => array('align' => 'right', 'insert' => true, 'fun' => 'fmt_credit'), _("Allocated") => 'amount', _("Balance") => array('type' => 'amount', 'insert' => true, 'fun' => 'fmt_balance'), array('insert' => true, 'fun' => 'alloc_link')); if ($_POST['customer_id'] != ALL_TEXT) { $cols[_("Customer")] = 'skip'; $cols[_("Currency")] = 'skip'; } $table =& new_db_pager('doc_tbl', $sql, $cols); $table->set_marker('check_overdue', _("Marked items are overdue.")); $table->width = "80%"; display_db_pager($table); end_form(); end_page();