Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.31 KB | None | 0 0
  1.         foreach ($saft->transactions as $transaction) {
  2.  
  3.             $month = intval(date('m', strtotime($transaction->transactionDate)));
  4.  
  5.             foreach ($transaction->debitLines as $debitLine) {
  6.  
  7.                 $accountID = $debitLine->accountID;
  8.  
  9.                 if (!array_key_exists($accountID, $saft->preProcessed)) {
  10.                     for ($i = 0; $i < 12; $i++) {
  11.                         $saft->preProcessed[$accountID][$i] = (object) [
  12.                             'debit' => 0,
  13.                             'credit' => 0
  14.                         ];
  15.                     }
  16.                 }
  17.  
  18.                 $saft->preProcessed[$accountID][$month - 1]->debit += $debitLine->debitAmount;
  19.             }
  20.  
  21.             foreach ($transaction->creditLines as $creditLine) {
  22.  
  23.                 $accountID = $creditLine->accountID;
  24.  
  25.                 if (!array_key_exists($accountID, $saft->preProcessed)) {
  26.                     for ($i = 0; $i < 12; $i++) {
  27.                         $saft->preProcessed[$accountID][$i] = (object) [
  28.                             'debit' => 0,
  29.                             'credit' => 0
  30.                         ];
  31.                     }
  32.                 }
  33.  
  34.                 $saft->preProcessed[$accountID][$month - 1]->credit += $creditLine->creditAmount;
  35.             }
  36.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement