Exemplo n.º 1
0
 /**
  * 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)
 {
     try {
         $model = $this->loadModel($id);
         $model->scenario = 'update';
         $model->aModelDetail = $model->rDetail;
         if (!FiInvoice::CanUpdate($model)) {
             $this->redirect(array('index'));
         }
         if (isset($_POST['FiInvoice'])) {
             $model->attributes = $_POST['FiInvoice'];
             if ($model->save()) {
                 FiInvoiceDetail::deleteDetail($model);
                 FiInvoiceDetail::fnUpdateInvoiceId($_POST['FiInvoiceDetail']['id'], $model->id);
                 FiInvoiceDetail::fnUpdateAmount($model);
                 FiInvoice::fnUpdateTotalAmount($model);
                 $this->redirect(array('view', 'id' => $model->id));
                 //                    $this->redirect(array('update','id'=>$model->id));
             }
         }
         $this->render('update', array('model' => $model, 'actions' => $this->listActionsCanAccess));
     } catch (Exception $e) {
         Yii::log("Exception " . print_r($e, true), 'error');
         throw new CHttpException("Exception " . print_r($e, true));
     }
 }
Exemplo n.º 2
0
    $total_amount_due = 0;
    ?>
            <?php 
    foreach ($model->aModelDetail as $key => $mDetail) {
        ?>
            <tr class="materials_row ">
                <td class="item_c order_no row_class_id<?php 
        echo $mDetail->id;
        ?>
"><?php 
        echo $key + 1;
        ?>
</td>
                <td class="l_padding_10 ">
                    <span class="description"><?php 
        echo FiInvoiceDetail::fnBuildDescription($mDetail);
        ?>
</span>
                    <?php 
        $display_none = 'display_none';
        $total_amount_due += $mDetail->amount;
        if ($key) {
            $display_none = '';
        }
        $next = Yii::app()->createAbsoluteUrl('admin/fiInvoice/create', array('row_number' => $key + 1));
        ?>
                </td>
                <td class="l_padding_10 w-150 item_r">
                    <?php 
        echo MyFormat::formatPrice($mDetail->amount);
        ?>
Exemplo n.º 3
0
 public function formatSumReportCommissionPayabletoSalesperson($model)
 {
     // init ProTransactionsSaveCommission::ReportGetAllClientComm(); line 173
     if (isset($_SESSION['DATA_COMM_REPORT']['AmountAtGross'][$model->id])) {
         $cmsFormater = new CmsFormatter();
         return $cmsFormater->formatPrice($_SESSION['DATA_COMM_REPORT']['AmountAtGross'][$model->id]);
     }
     return '';
 }
 // ANH DUNG Sep 20, 2014
 public function formatSumReport1stTierName($model)
Exemplo n.º 4
0
 protected function beforeSave()
 {
     $this->description = FiInvoiceDetail::fnBuildDescription($this);
     return parent::beforeSave();
 }
Exemplo n.º 5
0
 protected function beforeDelete()
 {
     FiInvoiceDetail::DeleteByInvoiceId($this->id);
     FiInvoiceReceipt::DeleteByInvoiceId($this->id);
     return parent::beforeDelete();
 }
Exemplo n.º 6
0
 $arrayType = array('H' => array('id' => 18, 'title' => 'HDB Apartment'), 'K' => array('id' => 0, 'title' => 'Block'), 'A' => array('id' => 1, 'title' => 'Apartment/Condo'), 'C' => array('id' => 3, 'title' => 'Condominium'), 'S' => array('id' => 0, 'title' => 'Standard'), 'G' => array('id' => 0, 'title' => 'Godown'), 'P' => array('id' => 0, 'title' => 'PO Box, My Mail Box or My SingPost'), 'B' => array('id' => 0, 'title' => 'Locked Bag'), 'W' => array('id' => 0, 'title' => 'Window Delivery'), 'U' => array('id' => 5, 'title' => 'Walk-up'));
 $criteria = new CDbCriteria();
 foreach ($data as $v) {
     $criteria->compare('t.postal_code', trim($v), true, 'OR');
 }
 $dataTmp = ApiPostcode::model()->findAll($criteria);
 if ($dataTmp) {
     $tmp = array();
     $building = array();
     $buildingTmp = array();
     //search postal code
     foreach ($dataTmp as $v) {
         $code = substr($v->postal_code, 0, 6);
         $type = substr($v->postal_code, 6, 1);
         $keyBuilding = substr($v->postal_code, strlen($v->postal_code) - 6, strlen($v->postal_code));
         $building[$code] = $keyBuilding;