Example #1
0
 public static function submit($data)
 {
     //$charges = Input::get('charge');
     $loanproduct = new Loanproduct();
     $loanproduct->name = array_get($data, 'name');
     $loanproduct->short_name = array_get($data, 'short_name');
     $loanproduct->interest_rate = array_get($data, 'interest_rate');
     $loanproduct->formula = array_get($data, 'formula');
     $loanproduct->amortization = array_get($data, 'amortization');
     $loanproduct->currency = array_get($data, 'currency');
     $loanproduct->save();
     Audit::logAudit(date('Y-m-d'), Confide::user()->username, 'loan product creation', 'Loans', '0');
     $loan_id = $loanproduct->id;
     Loanposting::submit($loan_id, $data);
     /*
     		foreach($charges as $charge){
     	$loanproduct->charges()->attach($charge);
     		}
     */
 }
 /**
  * Remove the specified loanposting from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Loanposting::destroy($id);
     return Redirect::route('loanpostings.index');
 }
Example #3
0
 public static function topupLoan($loanaccount, $amount, $date)
 {
     $transaction = new Loantransaction();
     $transaction->loanaccount()->associate($loanaccount);
     $transaction->date = $date;
     $transaction->description = 'loan top up';
     $transaction->amount = $amount;
     $transaction->type = 'debit';
     $transaction->save();
     $account = Loanposting::getPostingAccount($loanaccount->loanproduct, 'disbursal');
     $data = array('credit_account' => $account['credit'], 'debit_account' => $account['debit'], 'date' => $date, 'amount' => $loanaccount->top_up_amount, 'initiated_by' => 'system', 'description' => 'loan top up');
     $journal = new Journal();
     $journal->journal_entry($data);
     Audit::logAudit($date, Confide::user()->username, 'loan to up', 'Loans', $amount);
 }
Example #4
0
 public function overpayment_refund($loanproduct, $data)
 {
     $posting = new Loanposting();
     $posting->loanproduct()->associate($loanproduct);
     $posting->transaction = 'overpayment_refund';
     $posting->debit_account = array_get($data, 'loan_overpayment');
     $posting->credit_account = array_get($data, 'cash_account');
     $posting->save();
 }
Example #5
0
 public static function payInterest($loanaccount, $date, $interest_due)
 {
     $repayment = new Loanrepayment();
     $repayment->loanaccount()->associate($loanaccount);
     $repayment->date = $date;
     $repayment->interest_paid = $interest_due;
     $repayment->save();
     $account = Loanposting::getPostingAccount($loanaccount->loanproduct, 'interest_repayment');
     $data = array('credit_account' => $account['credit'], 'debit_account' => $account['debit'], 'date' => $date, 'amount' => $interest_due, 'initiated_by' => 'system', 'description' => 'interest repayment');
     $journal = new Journal();
     $journal->journal_entry($data);
 }