コード例 #1
0
ファイル: IncomesController.php プロジェクト: wanyos2005/hsbf
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Incomes();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Incomes'])) {
         $model->attributes = $_POST['Incomes'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $this->pageTitle = 'Income and Expenditure';
     $id = Yii::app()->user->id;
     $income = new Incomes();
     $expenditure = new Expenditures();
     $this->performAjaxValidation(array($income, $expenditure));
     if (isset($_POST['Expenditures'])) {
         $income->attributes = $_POST['Expenditures'];
         if ($income->save()) {
             $this->refresh();
         }
     }
     $this->render('application.modules.users.views.default.default', array('model' => null, 'others' => array(Voteheads::INCOME => $income, Voteheads::EXPENSE => $expenditure), 'user_model' => Users::model()->loadModel($id), 'person_model' => Person::model()->loadModel($id), 'title' => 'Cash Withdrawals', 'render' => 'application.views.expenditures.create'));
 }
コード例 #3
0
ファイル: Incomes.php プロジェクト: wanyos2005/hsbf
 /**
  * 
  * @param Expenditures $expense model
  */
 public function withdrawalFromBankIsIncome($expense)
 {
     $income = $this->find('trans_channes=:chnl && associated_id=:id', array(':chnl' => $className = get_class($expense), ':id' => $expense->primaryKey));
     $nextReceiptNo = false;
     if (empty($income)) {
         $income = new Incomes();
         $income->votehead = $expense->votehead;
         $income->trans_channes = $className;
         $income->associated_id = $expense->id;
         $income->receipt_no = NextReceiptNo::model()->receiptNo();
         $income->member = $expense->member;
         $income->description = $expense->description;
         $income->cask_or_bank = ContributionsByMembers::PAYMENT_BY_BANK;
         $income->logged_in = Yii::app()->user->id;
         $income->date = $expense->date;
         $nextReceiptNo = true;
     }
     $income->amount = $expense->amount;
     if ($income->save(false) && $nextReceiptNo) {
         NextReceiptNo::model()->updateNextReceiptNo($income->receipt_no);
     }
 }