var $allocs; /*array of transactions allocated to */
- function allocation($type, $trans_no, $person_id = null, $person_type_id=null)
+ function __construct($type, $trans_no, $person_id = null, $person_type_id=null)
{
$this->allocs = array();
var $current_allocated;
- function allocation_item ($type, $type_no, $date_, $due_date, $amount,
+ function __construct($type, $type_no, $date_, $due_date, $amount,
$amount_allocated, $current_allocated, $ref)
{
global $systypes_array;
- $k = $counter = $total_allocated = 0;
+ $k = $total_allocated = 0;
$cart = $_SESSION['alloc'];
$supp_ref = in_array($cart->type, array(ST_SUPPCREDIT, ST_SUPPAYMENT, ST_BANKPAYMENT));
if (count($cart->allocs))
{
-// if ($cart->currency != $cart->person_curr)
- display_heading(sprintf(_("Allocated amounts in %s:"), $cart->person_curr));
+ display_heading(sprintf(_("Allocated amounts in %s:"), $cart->person_curr));
start_table(TABLESTYLE, "width='60%'");
$th = array(_("Transaction Type"), _("#"), $supp_ref ? _("Supplier Ref"): _("Ref"), _("Date"), _("Due Date"), _("Amount"),
_("Other Allocations"), _("Left to Allocate"), _("This Allocation"),'','');
{
alt_table_row_color($k);
label_cell($systypes_array[$alloc_item->type]);
- label_cell(get_trans_view_str($alloc_item->type, $alloc_item->type_no));
+ label_cell(get_trans_view_str($alloc_item->type, $alloc_item->type_no), "nowrap align='right'");
label_cell($alloc_item->ref);
label_cell($alloc_item->date_, "align=right");
label_cell($alloc_item->due_date, "align=right");
if ($show_totals) {
label_row(_("Total Allocated"), price_format($total_allocated),
"colspan=8 align=right", "align=right id='total_allocated'", 3);
-/*
- $amount = $_SESSION['alloc']->amount;
- if ($_SESSION['alloc']->type == ST_SUPPCREDIT
- || $_SESSION['alloc']->type == ST_SUPPAYMENT
- || $_SESSION['alloc']->type == ST_BANKPAYMENT ||
- ($_SESSION['alloc']->type == ST_JOURNAL && $_SESSION['alloc']->person_type == PT_SUPPLIER))
- $amount = -$amount;
-*/
$amount = abs($cart->amount);
if (floatcmp($amount, $total_allocated) < 0)
$total_allocated += input_num('amount' . $counter);
}
-/*
- $amount = $_SESSION['alloc']->amount;
- if (in_array($_SESSION['alloc']->type, array(ST_BANKPAYMENT, ST_SUPPCREDIT, ST_SUPPAYMENT)) ||
- ($_SESSION['alloc']->type==ST_JOURNAL && $_SESSION['alloc']->person_type == PT_SUPPLIER))
- $amount = -$amount;
-*/
$amount = abs($_SESSION['alloc']->amount);
if ($total_allocated - ($amount + input_num('discount')) > $SysPrefs->allocation_settled_allowance())