Exemple #1
0
                            	<option value="<?php 
            echo $d->id;
            ?>
"><?php 
            echo $d->nametype;
            ?>
</option>
                            <?php 
        }
        ?>
                        </select>
                        
                    </td>
                    <td>
                        <?php 
        $pay = Payoptions::model()->findAll();
        ?>
                    	<!--<php $list_pay = CHtml::listData($pay, 'idpayoptions', 'displayname');  ?>
                        <php echo $form->dropDownList($item,'payoption["displayname"]',$list_pay,array('empty'=>'--')); ?>
                    	<php echo $form->error($item,'payoption["displayname"]');?>-->
                        <select name="payoption<?php 
        echo $k;
        ?>
">
                        	<option>--</option>
                            <?php 
        foreach ($pay as $p) {
            ?>
                            	<option value="<?php 
            echo $p->idpayoptions;
            ?>
Exemple #2
0
	public function actionCurrent($id_sched,$id=null){
  		$id_control = Yii::app()->user->id;
                $guide = User::model()->findByPk($id_control);
		$sched = SegScheduledTours::model()->with(array('guidestourinvoices'=>array('guidestourinvoicescustomers','contact')))->findByPk($id_sched);
		if(is_null($sched)) 	throw new CHttpException(404,'The requested tour does not exist.');

            $json=$this->PaymentLand();
            $jcode['result']="none";
            $jcode['message']="";
            if($json!='nodata')
            {
                $jarr=  json_decode($json);
//                var_dump($jarr);
//                return;
                if(isset($jarr->result->code))
                {
                    

                    if(preg_match("/^(000\.000\.|000\.100\.1|000\.[36])/",$jarr->result->code))
                    {
                            $jcode['result']="success";	
                            $rec=  new Creditcard();
                            $rec->trans_id=$jarr->id;
                            $rec->card_type=$jarr->paymentBrand;
                            $rec->amount=(float)$jarr->amount;
                            $rec->result_code=$jarr->result->code;
                            $rec->trans_date=$jarr->timestamp;
                            $rec->text=$jarr->result->description;
                            if($rec->save())
                            {
                                if(Yii::app()->user->hasState("payers"))
                                {
                                        $postdata= json_decode(Yii::app()->user->getState("payers"));
                                        $jcode['message']=  "Payment was done. Sum:".$rec->amount." &euro;";
                                        $post=array();
                                         Yii::app()->user->setState('payers', null);
                                         foreach ($postdata as $value) {
                                             $post['customersName'.$value[0]]=$value[1];
                                             $post['discounttype_id'.$value[0]]=  strlen($value[2])>0 ? (int) $value[2] : null;
                                             $post['price'.$value[0]]=  strlen($value[3])>0 ? (float) $value[3] : null;
                                             $post['payoption'.$value[0]]=3;
                                             $post['option'.$value[0]]=0;
                                         }
                                         $this->saveGIC($sched, $post,$rec->id);
                                }
                            }
                    }  else {
                            $jcode['result']="error";					

                    }
                 }
            }
                            Yii::app()->user->setState('payers', null);
 	
		if($sched->additional_info2) $this->redirect(array('schedule'));
 			$date_format = strtotime($sched->date);
			$date_bd = date('Y-m-d',$date_format);
			$dt =$date_bd.' '.$sched->starttime;
	
			//mainoption

			$criteria_vat = new CDbCriteria;
			$criteria_vat->condition = 'name=:name ';
			$criteria_vat->params = array(':name'=>'Vat');
			$vat_nds = Mainoptions::model()->find($criteria_vat)->value;
			$criteria = new CDbCriteria;
                        $criteria->addCondition("idpayoptions in (1,2,3,4)");
			$pay = Payoptions::model()->findAll($criteria);
			$invoiceoptions_array = Invoiceoptions::model()->findAll(array('order'=>'id ASC')); 
			$dis = Bonus::model()->findAll(array('order'=>'sort ASC')); 
				if(!empty($_POST))
				{
                                   $pdf=$_POST['pdf'];
                                    $this->saveGIC($sched,$_POST);
 
 				if($pdf){
					if(!$this->createpdf($sched)) return;
//					$this->redirect(Yii::app()->createUrl("/filespdf/".$sched->additional_info2.".pdf"));
					return;
				}
			}
	$test=array('guide'=>$this->loadGuide(),'tours'=>$this->loadTours(),'todo'=>$this->loadUnreported());

	$this->render('current',array(
//					'model'=>$model,
		'guide'=>$guide,
		'sched'=>$sched,
		'id_sched'=>$id_sched,
		'vat_nds'=>$vat_nds,
		'pay'=>$pay,
		'jcode'=>$jcode,
		'dis'=>$dis,
		'invoiceoptions_array'=>$invoiceoptions_array,
		'info'=>$test,
	));

        }