/**
     * Updates a particular model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id the ID of the model to be updated
     */
    public function actionUpdate( $id )
    {
        $model = $this->loadModel( $id );
                
        $model->isopedit = false;
        $opmodel = new Orderproduct;
        $opmodel->unsetAttributes();  // clear any default values
        $opmodel->order_id = (empty($model->id)?0:$model->id);
        
        $model->ismsedit = false;
        $model->isotedit = false;
        $milestonemodel = new Milestone;
        $milestonemodel->unsetAttributes();  // clear any default values
        $milestonemodel->order_id = (empty($model->id)?0:$model->id);
        $otmodel = new Ordertask;
        $otmodel->unsetAttributes();  // clear any default values
        $otmodel->order_id = (empty($model->id)?0:$model->id);
        
        $alltasks = $this->getAllTasks();
        $allcontractors = Yii::app()->controller->getPeopleLookup(Helper::CONST_Contractor);
        
        $this->subTitle = ucwords( $this->action->id ) . ' ' . $this->getMenuLabels( ucwords( $this->controllerID ) );
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);

        if ( !empty( $_POST['Order'] ) && !empty($_POST['Person']))
        {
            $rtn = $this->saveOrUpdateTheModel($model);
            if($rtn)
            {
                $this->redirect( array( 'admin' ) );
            }
        }

        $this->render( 'update', array(
            'model' => $model, 
            'opmodel' => $opmodel,
            'allproducts'=>Yii::app()->user->products,
            'milestonemodel'=>$milestonemodel,
            'otmodel' => $otmodel,
            'alltasks' => $alltasks,
            'allcontractors' => $allcontractors,
        ) );
    }
/**
* Manages all models.
*/
public function actionAdmin()
{
$model=new Milestone('search');
$model->unsetAttributes();  // clear any default values
if(isset($_GET['Milestone']))
$model->attributes=$_GET['Milestone'];

$this->render('admin',array(
'model'=>$model,
));
}
 public function renderPCTypeDashboard()
 {
     $ordertask =new Ordertask('search');
     $ordertask->unsetAttributes();  // clear any default values
     
     $milestone =new Milestone('search');
     $milestone->unsetAttributes();  // clear any default values
     
     $orderlistLookup = Yii::app()->controller->getOrdersLookup();
     if(!empty($orderlistLookup))
     {
         $tmp = array_keys($orderlistLookup);
         $ordertask->order_id = $tmp[0];
         $milestone->order_id = $tmp[0];
     }
     if(isset($_GET['Ordertask']))
         $ordertask->attributes=$_GET['Ordertask'];
     
     if(isset($_GET['Milestone']))
         $milestone->attributes=$_GET['Milestone'];
     
     $payinmodel =new Payment('search');
     $payinmodel->unsetAttributes();  // clear any default values
     if(isset($_GET['Payment']))
         $payinmodel->attributes=$_GET['Payment'];
     
     $totalAR = 0;
     $totalAP = 0;
     $totalCash = 0;
     $accountchart = $this->getAccountChart($totalAR, $totalAP, $totalCash);
     $mschart = $this->getMSTaskChart($milestone->order_id);
     $this->render( $this->getView('index','index'),
                     array(
                         'ordertask' => $ordertask,
                         'milestone'=>$milestone,
                         'orderlistLookup' => $orderlistLookup,
                         'accountchart' => $accountchart,
                         'mschart' => $mschart,
                         'payinmodel'=>$payinmodel,
                         'totalAR' => $totalAR,
                         'totalAP' => $totalAP,
                         'totalCash' => $totalCash,
                         )
                 );
 }