Пример #1
0
	public function showme($data,$row)
	{	
		$pSum=Exp::model()->with('paySum')->findByPk($data->exp_id)->paySum;
		return Yii::app()->numberFormatter->formatCurrency($pSum, '');
	}
Пример #2
0
 private function updatedocs($docs, &$info)
 {
     /* 
      * отбор загруженных на этапе считывания документов из tmp_doc
      */
     $sql = "SELECT a.* ," . " c.id AS c_id, d.id AS d_id, t.id AS t_id, m.id AS m_id, b.id AS b_id, bb.id AS bb_id " . " FROM ((((((tmp_doc a LEFT JOIN  client_id c ON a.ccli=c.ckey AND c.db=1)" . " LEFT JOIN  department_id d ON a.cfir=d.ckey AND c.db=1)" . " LEFT JOIN  client_id t ON a.transport=t.ckey AND c.db=1)" . " LEFT JOIN  bank b ON a.dbank=b.longname)" . " LEFT JOIN  bank bb ON a.cbank=bb.longname)" . " LEFT JOIN  account m ON a.man=m.id)" . " WHERE a.user="******"bid:".$value['b_id']."bbid:".$value['bb_id']."re:".$rr."<hr>";
                     if ($rr) {
                         if ($id > 0) {
                             $jj++;
                             $resdoc[] = array('t' => 0, 's' => 0, 'n' => $group->id);
                         } else {
                             $resdoc[] = array('t' => 0, 's' => 1, 'n' => $group->id);
                             $j++;
                         }
                         $this->updatedocstr($value['id'], $group->id, 0);
                         $this->updatecomment($value['id'], $group->id);
                     }
                 }
             } else {
                 $oid = (int) $value['expid'];
                 $iid = (int) $value['docid'];
                 $fid = $docs[$value['id']];
                 if ($fid === null) {
                     $oid = 0;
                     $iid = 0;
                 } else {
                     $iid = $fid[1];
                     $oid = $fid[0];
                 }
                 $group = NULL;
                 if ($iid > 0) {
                     $group = Inv::model()->findByPk($iid);
                     if ($group == null) {
                         continue;
                     }
                     Invd::model()->deleteAll('inv=' . $iid);
                 }
                 if ($group === null) {
                     if ($oid > 0) {
                         $group = new Inv();
                     } else {
                         continue;
                     }
                 }
                 $group->name = $value['tnum'];
                 $group->amount = $value['bsum'];
                 $group->date = $value['ddat'];
                 $group->client_id = $value['t_id'];
                 $group->exp_id = $oid;
                 if ($group->save()) {
                     if ($iid > 0) {
                         $ii++;
                         $resdoc[] = array('t' => 1, 's' => 0, 'n' => $group->id);
                     } else {
                         $resdoc[] = array('t' => 1, 's' => 1, 'n' => $group->id);
                         $i++;
                     }
                     $this->updatedocstr($value['id'], $group->id, 1);
                 }
             }
         }
     }
     $info[] = 'Создано новых счетов:' . $j;
     $info[] = 'Создано новых накладных:' . $i;
     $info[] = 'Отредактикровано счетов:' . $jj;
     $info[] = 'Отредактикровано накладных:' . $ii;
     //                            $info['doc']=$resdoc;
 }
Пример #3
0
 public function loadModel($id)
 {
     $model = Exp::model()->with(array('department' => array('departmentProps'), 'client' => array('clientProps'), 'account', 'expd' => array('product0' => array('it0'))))->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #4
0
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     $model = $this->loadModel($id);
     $expid = $model->exp_id;
     $model->delete();
     Exp::model()->findByPk($expid)->doPay();
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
     }
 }