Example #1
0
 public function create_post_rules($product, $fee_income_acc, $saving_control_acc, $cash_account)
 {
     //create posting rule for deposit transaction
     $posting = new Savingposting();
     $posting->transaction = 'deposit';
     $posting->debit_account = $cash_account;
     $posting->credit_account = $saving_control_acc;
     $posting->savingproduct()->associate($product);
     $posting->save();
     //create posting rule for withdrawal transaction
     $posting = new Savingposting();
     $posting->transaction = 'withdrawal';
     $posting->debit_account = $saving_control_acc;
     $posting->credit_account = $cash_account;
     $posting->savingproduct()->associate($product);
     $posting->save();
     //create posting rule for charge transaction
     $posting = new Savingposting();
     $posting->transaction = 'charge';
     $posting->debit_account = $cash_account;
     $posting->credit_account = $fee_income_acc;
     $posting->savingproduct()->associate($product);
     $posting->save();
 }
 /**
  * Remove the specified savingposting from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Savingposting::destroy($id);
     return Redirect::route('savingpostings.index');
 }