public function setCvalue($key,$value) { $this->name=$key; $model=$this->find("name='".$key."'"); if($model===null) { $model= new Mainoptions; $model->setAttribute('name',$key); $model->setAttribute('value',$value); $model->save(); } else { $model->setAttribute('value',$value); $model->save(); } }
public function Footer() { // Position at 15 mm from bottom $this->SetY(-2.5); // Set font $this->SetFont('helvetica', 'I', 9); // Page number /* $str ='<table style="color:#66A3BC; width:100%;"><tbody><tr>' . '<td><div>Cherrytours GmbH<br>Mittelstr. 30<br>10117 Berlin</div></td>' . '<td><div>Geschäftsleitung:<br>Marina Kuranova,<br>Christian Zeitsch</div></td>' . '<td><div>HRB Nr: 183404<br>USt-IDNr: DE304401873<br>SteuerNr: 1130/251/50018</div></td>' . '<td><div>Commerzbank<br>IBAN DE59 8204 0000 0815 1367 00<br>BIC COBADEFFXXX</div></td>' . '</tr></tbody></table>'; */ $str = '<table style="color:#983157; width:100%;"><tbody><tr>' . '<td><div>' . Mainoptions::model()->getCvalue('Firma') . '<br>' . Mainoptions::model()->getCvalue('address street') . '<br>' . Mainoptions::model()->getCvalue('address city') . '</div></td>' . '<td><div>' . Mainoptions::model()->getCvalue('Geschäftsleitung') . '<br>' . Mainoptions::model()->getCvalue('NameMarina') . ',<br>' . Mainoptions::model()->getCvalue('NameChristian') . '</div></td>' . '<td><div>' . Mainoptions::model()->getCvalue('Tax4') . '<br>' . Mainoptions::model()->getCvalue('TAX5') . '<br>' . Mainoptions::model()->getCvalue('Tax6') . '</div></td>' . '<td><div>' . Mainoptions::model()->getCvalue('Bank1') . '<br>' . Mainoptions::model()->getCvalue('Bank3') . '<br>' . Mainoptions::model()->getCvalue('Bank2') . '</div></td>' . '</tr></tbody></table>'; $this->writeHTMLCell(0, 0, '', '', $str, 0, 1, 0, true, '', true); }
public function loadMO($id) { $model=Mainoptions::model()->findByPk($id); if($model===null) throw new CHttpException(404,'The requested page does not exist.'); return $model; }
public function actionAjaxInfo() { if (!Yii::app()->request->isAjaxRequest) { echo CJSON::encode(array( 'status'=>'failure', 'div'=>'No Request')); // 'div'=>$this->renderPartial('_form', array('model'=>$model), true))); exit; } $id_sched = $_POST['id_sched']; $date = $_POST['date']; $time = $_POST['time']; $sched = SegScheduledTours::model()->findByPk($id_sched); $id_control = $sched->guide1_id; $guide = User::model()->with('guide_ob')->findByPk($id_control); $role_control = $guide->id_usergroups; //sched //tour $tour = SegTourroutes::model()->findByPk($sched->tourroute_id); //tourroutes $criteria_tourroutes = new CDbCriteria; $criteria_tourroutes->condition = 'usersid=:usersid AND tourroutes_id=:tourroutes_id'; $criteria_tourroutes->params = array(':usersid'=>$sched->user_ob->id,'tourroutes_id'=>$tour->id_tour_categories); $gonorar_tour = SegGuidesTourroutes::model()->find($criteria_tourroutes); //mainoption $criteria_vat = new CDbCriteria; $criteria_vat->condition = 'name=:name '; $criteria_vat->params = array(':name'=>'Vat'); $vat = Mainoptions::model()->find($criteria_vat)->value; $command=Yii::app()->db->createCommand(); $command->select('SUM(cashIncome) AS sumk'); $command->from('seg_guidestourinvoices'); $command->where('id_sched=:id_sched', array(':id_sched'=>$sched->idseg_scheduled_tours)); $cashincome= $command->queryScalar(); //segguidestourinvoicescustomers $invoicecustomer=SegGuidestourinvoicescustomers::model()->with('tourinvoice')->count("id_sched=".$sched->idseg_scheduled_tours." AND isPaid=1"); $tot_cust=1; $cifra = $invoicecustomer - $gonorar_tour->guest_variable; if($cifra<=0){$cifra=0;}//turists > $gonorar = $gonorar_tour->base_provision+$cifra*$gonorar_tour->guestsMinforVariable;//summa gonorar $gonorar_vat = $gonorar*(1-1/($vat/100+1)); $gonorar_vat = number_format($gonorar_vat, 2, '.', ' '); $result=$this->renderPartial('info',array( 'gonorar_tour'=>$gonorar_tour, 'cifra'=>$cifra, 'gonorar'=>$gonorar, 'gonorar_vat'=>$gonorar_vat, 'vat'=>$vat, 'vattype'=>$guide->guide_ob['paysUSt'], 'cash'=>$this->cashsum, 'cashincome'=>$cashincome, 'id_sched'=>$id_sched, 'date'=>$date, 'time'=>$time, 'ajax'=>true, ),true); echo CJSON::encode(array( 'status'=>'failure', 'div'=>$result)); }