Example #1
0
 public function detalleproveedorAction()
 {
     //Conectamos con BBDD
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     //Instancias
     $prv = new ProveedorTable($this->dbAdapter);
     $tps = new TipoServicioTable($this->dbAdapter);
     $vpr = new VProveedorTable($this->dbAdapter);
     //Obtenemos id de Proveedor
     $data = $this->getRequest()->getPost();
     //Consultamos Proveedor y sus servicios en BBDD
     $prov = $prv->getProveedoresId($data['id']);
     $serv = $tps->getServicioId($prov[0]['id_servicio']);
     $vpro = $vpr->getProveedoresId($prov[0]['id']);
     $prov[0]['servicio'] = $serv[0]['nombre'];
     $prov[0]['categoria'] = $serv[0]['categoria'];
     $prov['0']['rut'] = number_format($prov['0']['rut'], -3, "", ".") . "-" . ucfirst($prov['0']['dv']);
     $prov['0']['monto'] = $vpro[0]['monto'];
     $prov['0']['fecha'] = date("d-m-Y", strtotime($vpro[0]['ultimopago']));
     $result = new JsonModel($prov);
     return $result;
 }
Example #2
0
 public function nuevoaseguradorAction()
 {
     //Conectamos con BBDD
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     //Instancias
     $form = new ProveedorForm("form");
     $ban = new ListaBancoTable($this->dbAdapter);
     $srv = new TipoServicioTable($this->dbAdapter);
     //Obtenemos Datos y cargamos Formulario
     $tipos = $srv->getComboAseguradora($this->dbAdapter);
     $servi = $srv->getComboServAseguradora($this->dbAdapter);
     $bancos = $ban->getDatos();
     //Cargamos combos
     $form->get('categoria')->setAttribute('options', $tipos);
     $form->get('categoria')->setAttribute('disabled', 'disabled');
     $form->get('servicio')->setAttribute('options', $servi);
     $form->get('servicio')->setAttribute('disabled', 'disabled');
     $form->get('id_banco')->setAttribute('options', $bancos);
     //Retornamos a la vista
     $result = new ViewModel(array('form' => $form));
     $result->setTerminal(true);
     return $result;
 }