Ejemplo n.º 1
0
 public function initialize()
 {
     $this->add(new Select('idCiuu', Ciuu::find(), array('using' => array('idCiuu', 'description'), 'class' => 'select2 select')));
     $this->add(new Select('idFirebird', Firebird::find(), array('using' => array('idFirebird', 'version'), 'class' => 'select2 select')));
     $this->add(new Check('status', array('type' => 'checkbox', 'class' => 'bootstrap-switch')));
     $this->add(new Check('astatus', array('type' => 'checkbox', 'class' => 'bootstrap-switch')));
     $this->add(new Text('name', array('maxlength' => 200, 'type' => 'text', 'required' => 'required', 'class' => 'form-control')));
     $this->add(new Text('aname', array('maxlength' => 200, 'type' => 'text', 'required' => 'required', 'class' => 'form-control')));
     $this->add(new Text('nit', array('maxlength' => 50, 'type' => 'text', 'required' => 'required', 'class' => 'form-control', 'autofocus' => 'autofocus')));
     $this->add(new Text('companyName', array('maxlength' => 200, 'type' => 'text', 'required' => 'required', 'class' => 'form-control')));
     $this->add(new Text('city', array('maxlength' => 200, 'type' => 'text', 'required' => 'required', 'class' => 'form-control')));
     $this->add(new Text('address', array('maxlength' => 200, 'type' => 'text', 'required' => 'required', 'class' => 'form-control')));
     $this->add(new Text('city', array('maxlength' => 200, 'type' => 'text', 'required' => 'required', 'class' => 'form-control')));
     $this->add(new Text('phone', array('maxlength' => 45, 'type' => 'text', 'required' => 'required', 'class' => 'form-control')));
     $this->add(new Text('fax', array('maxlength' => 45, 'type' => 'text', 'class' => 'form-control')));
     $this->add(new Text('email', array('maxlength' => 100, 'type' => 'text', 'required' => 'required', 'class' => 'form-control')));
     $this->add(new Select('paymentplans[]', Paymentplan::find(), array('using' => array('idPaymentplan', 'name'), 'multiple' => 'multiple', 'class' => 'select2 select')));
     $this->add(new Select("database", array('firebird' => 'firebird')));
 }
 public function getpaymentsplanAction()
 {
     $payments = array();
     try {
         $result = Paymentplan::find(array('conditions' => 'status = ?1', 'bind' => array(1 => 1)));
         if (count($result) > 0) {
             foreach ($result as $value) {
                 $obj = new stdClass();
                 $obj->id = $value->idPaymentplan;
                 $obj->name = $value->name;
                 $payments[] = $obj;
             }
         }
         return $this->setJsonResponse($payments, 200);
     } catch (Exception $ex) {
         $this->logger->log("Exception... {$ex}");
         return $this->setJsonResponse(array('message' => 'Error interno, por favor contacte al administrador'), 500);
     }
 }