Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach ($saft->transactions as $transaction) {
- $month = intval(date('m', strtotime($transaction->transactionDate)));
- foreach ($transaction->debitLines as $debitLine) {
- $accountID = $debitLine->accountID;
- if (!array_key_exists($accountID, $saft->preProcessed)) {
- for ($i = 0; $i < 12; $i++) {
- $saft->preProcessed[$accountID][$i] = (object) [
- 'debit' => 0,
- 'credit' => 0
- ];
- }
- }
- $saft->preProcessed[$accountID][$month - 1]->debit += $debitLine->debitAmount;
- }
- foreach ($transaction->creditLines as $creditLine) {
- $accountID = $creditLine->accountID;
- if (!array_key_exists($accountID, $saft->preProcessed)) {
- for ($i = 0; $i < 12; $i++) {
- $saft->preProcessed[$accountID][$i] = (object) [
- 'debit' => 0,
- 'credit' => 0
- ];
- }
- }
- $saft->preProcessed[$accountID][$month - 1]->credit += $creditLine->creditAmount;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement