Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b790334fd | ||
|
|
2b2ebc55c0 |
@@ -294,7 +294,7 @@ class StatementEntry extends AppModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->prReturn(array('entries' => $resultset,
|
return $this->prReturn(array('entries' => $resultset,
|
||||||
'summary' => $this->stats(null, $query)));
|
'summary' => $this->stats(null, $query)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -483,14 +483,14 @@ class StatementEntry extends AppModel {
|
|||||||
|
|
||||||
// Set the disbursement amount to the maximum amount
|
// Set the disbursement amount to the maximum amount
|
||||||
// possible without exceeding the charge or credit balance
|
// possible without exceeding the charge or credit balance
|
||||||
$disbursement_amount = min($charge['balance'], $credit['balance']);
|
$disbursement_amount = round(min($charge['balance'], $credit['balance']), 2);
|
||||||
if (!isset($credit['applied']))
|
if (!isset($credit['applied']))
|
||||||
$credit['applied'] = 0;
|
$credit['applied'] = 0;
|
||||||
|
|
||||||
$credit['applied'] += $disbursement_amount;
|
$credit['applied'] = round($credit['applied'] + $disbursement_amount, 2);
|
||||||
$credit['balance'] -= $disbursement_amount;
|
$credit['balance'] = round($credit['balance'] - $disbursement_amount, 2);
|
||||||
|
|
||||||
$this->pr(20, compact('credit'),
|
$this->pr(20, compact('credit', 'disbursement_amount'),
|
||||||
($credit['balance'] > 0 ? 'Utilized' : 'Exhausted') .
|
($credit['balance'] > 0 ? 'Utilized' : 'Exhausted') .
|
||||||
(empty($credit['receipt']) ? ' Credit' : ' Receipt'));
|
(empty($credit['receipt']) ? ' Credit' : ' Receipt'));
|
||||||
|
|
||||||
@@ -555,12 +555,12 @@ class StatementEntry extends AppModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Adjust the charge balance to reflect the new disbursement
|
// Adjust the charge balance to reflect the new disbursement
|
||||||
$charge['balance'] -= $disbursement_amount;
|
$charge['balance'] = round($charge['balance'] - $disbursement_amount, 2);
|
||||||
|
$this->pr(20, compact('charge', 'disbursement_amount'),
|
||||||
|
($charge['balance'] > 0 ? 'Unfinished' : 'Fully Paid') . ' Charge');
|
||||||
|
|
||||||
if ($charge['balance'] < 0)
|
if ($charge['balance'] < 0)
|
||||||
die("HOW DID WE GET A NEGATIVE CHARGE AMOUNT?");
|
die("HOW DID WE GET A NEGATIVE CHARGE AMOUNT?");
|
||||||
|
|
||||||
if ($charge['balance'] <= 0)
|
|
||||||
$this->pr(20, 'Fully Paid Charge');
|
|
||||||
}
|
}
|
||||||
// Break the $credit reference to avoid future problems
|
// Break the $credit reference to avoid future problems
|
||||||
unset($credit);
|
unset($credit);
|
||||||
|
|||||||
Reference in New Issue
Block a user