public function postBeginningBalance(Request $request)
 {
     $values = $request->input('value');
     $value = $request->input('name') == 'debit' ? $values : -$values;
     $journalHistory = JournalHistory::find($request->input('pk'));
     $journalHistory->beginning_balance = $value;
     $journalHistory->save();
     return response('{"success":"true"}', 200);
 }
Example #2
0
 public function beginningBalance()
 {
     $exist = $this->journalHistory()->count();
     if ($exist) {
         return $this->fulljournalHistory();
     }
     $accounts = Account::where('company_id', $this->company->id)->get();
     foreach ($accounts as $account) {
         JournalHistory::create(['company_id' => $this->company->id, 'account_id' => $account->id, 'month' => $this->company->month_period, 'year' => $this->company->year_period]);
     }
     return $this->fulljournalHistory();
 }