public function actionEntrySheetMain()
 {
     if (isset($_POST['EntrySheetBulk'])) {
         foreach ($_POST['EntrySheetBulk'] as $i => $item) {
             $model = new EntrySheetBulk();
             $model->attributes = $_POST['EntrySheetBulk'][$i];
             if ($model->selected && $model->quantity > 0) {
                 CVarDumper::dump($_POST['EntrySheetBulk'][0]['date'], 10, true);
                 $model->date = date("Y-m-d", strtotime($_POST['EntrySheetBulk'][0]['date']));
                 $modelEntrySheet = new EntrySheet();
                 $entrySheet = new EntrySheet();
                 $entrySheet->customer_id = $_POST['customer_id'];
                 $entrySheet->product_id = $model->product_id;
                 $entrySheet->quantity = $model->quantity;
                 $entrySheet->price = $model->price;
                 $entrySheet->added_on = $model->date;
                 $entrySheet->save();
             }
             if (isset($_POST['EntrySheetPaidAmount'])) {
                 $entrySheetAmountPaid = new EntrySheetPaidAmount();
                 $entrySheetAmountPaid->attributes = $_POST['EntrySheetPaidAmount'];
                 $entrySheetAmountPaid->customer_id = $_POST['customer_id'];
                 $entrySheetAmountPaid->added_on = $model->date;
                 $entrySheetAmountPaid->save();
             }
         }
         $this->redirect(array('entrySheet/admin'));
     }
     $this->render('entrySheetMain');
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return EntrySheetPaidAmount the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = EntrySheetPaidAmount::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }