コード例 #1
0
ファイル: Accounts.php プロジェクト: bluebeans-systems/nephos
 private function createNewAccount($array)
 {
     // Create New Account if not exists
     $account = new Accounts();
     $accountno = $account->where('subscription', $array['subscription'])->max('accountno') + 1;
     $account->subscription = $array['subscription'];
     $account->accountno = $accountno;
     $account->accountclass = $array['accountclass'];
     $account->accounttype = $array['accounttype'];
     $account->client = $array['id'];
     $account->user = $array['user'];
     $account->save();
     return $accountno;
 }
コード例 #2
0
ファイル: Nephos.php プロジェクト: bluebeans-systems/nephos
 /**
  * Post Account Transaction
  * @param $data
  */
 public function postAccountTransaction($data)
 {
     DB::beginTransaction();
     try {
         for ($i = 0; $i < count($data['client']); $i++) {
             // Check for existing account
             $accountno = $this->accounts->checkAccount($data['subscription'][0], $data['accountclass'][$i], $data['accounttype'][$i], $data['client'][$i]);
             // Create new account summary
             $this->accountSummary->create(['subscription' => $data['subscription'][0], 'controlno' => $data['controlno'][0], 'client' => $data['client'][$i], 'accountclass' => $data['accountclass'][$i], 'accounttype' => $data['accounttype'][$i], 'accountentry' => $data['accountentry'][$i], 'accountno' => $accountno, 'user' => $data['user'][0]]);
             // reversal only
             $transamount = $data['status'][0] == "4" ? $data['transamount'][$i] > 0 ? $data['transamount'][$i] * -1 : $data['transamount'][$i] * 1 : $data['transamount'][$i];
             // Create account details
             $this->accountDetails->create(['subscription' => $data['subscription'][0], 'controlno' => $data['controlno'][0], 'client' => $data['client'][$i], 'accountclass' => $data['accountclass'][$i], 'accounttype' => $data['accounttype'][$i], 'accountentry' => $data['accountentry'][$i], 'accountno' => $accountno, 'amount' => $transamount]);
         }
     } catch (\Exception $e) {
         DB::rollBack();
     }
     DB::commit();
 }