public function viewAction($cliente_id)
 {
     if ($this->request->isPost()) {
         $resul = Clientes::findFirstById($this->request->getPost('cliente_id'));
         $resul->razon_social = $this->request->getPost('razon_social');
         $resul->nit = $this->request->getPost('nit');
         $resul->telefono = $this->request->getPost('telefono');
         $resul->celular = $this->request->getPost('celular');
         $resul->correo = $this->request->getPost('correo');
         $resul->direccion = $this->request->getPost('direccion');
         $resul->representante_legal = $this->request->getPost('representante_legal');
         $resul->ci_representante_legal = $this->request->getPost('ci_representante_legal');
         $resul->celular_representante_legal = $this->request->getPost('celular_representante_legal');
         $resul->correo_representante_legal = $this->request->getPost('correo_representante_legal');
         $resul->nombre_ref = $this->request->getPost('nombre_ref');
         $resul->ci_ref = $this->request->getPost('ci_ref');
         $resul->celular_ref = $this->request->getPost('celular_ref');
         $resul->correo_ref = $this->request->getPost('correo_ref');
         if ($resul->save()) {
             $this->flashSession->success('<b>Exito!</b> Se guardo correctamente');
         } else {
             $this->flashSession->error('<b>Error!</b> No se a actualizado');
         }
     }
     $this->assets->addCss('/jqwidgets/styles/jqx.base.css')->addCss('/jqwidgets/styles/jqx.custom.css')->addCss('/js/fileinput/css/fileinput.min.css');
     $this->assets->addJs('/jqwidgets/jqxcore.js')->addJs('/jqwidgets/jqxmenu.js')->addJs('/jqwidgets/jqxdropdownlist.js')->addJs('/jqwidgets/jqxlistbox.js')->addJs('/jqwidgets/jqxcheckbox.js')->addJs('/jqwidgets/jqxscrollbar.js')->addJs('/jqwidgets/jqxgrid.js')->addJs('/jqwidgets/jqxdata.js')->addJs('/jqwidgets/jqxgrid.sort.js')->addJs('/jqwidgets/jqxgrid.pager.js')->addJs('/jqwidgets/jqxgrid.filter.js')->addJs('/jqwidgets/jqxgrid.selection.js')->addJs('/jqwidgets/jqxgrid.grouping.js')->addJs('/jqwidgets/jqxgrid.columnsreorder.js')->addJs('/jqwidgets/jqxgrid.columnsresize.js')->addJs('/jqwidgets/jqxdatetimeinput.js')->addJs('/jqwidgets/jqxcalendar.js')->addJs('/jqwidgets/jqxbuttons.js')->addJs('/jqwidgets/jqxdata.export.js')->addJs('/jqwidgets/jqxgrid.export.js')->addJs('/jqwidgets/globalization/globalize.js')->addJs('/jqwidgets/jqxgrid.aggregates.js')->addJs('/media/plugins/bootbox/bootbox.min.js')->addJs('/media/plugins/form-validation/jquery.validate.min.js')->addJs('/media/plugins/form-stepy/jquery.stepy.js')->addJs('/media/demo/demo-formwizard.js')->addJs('/scripts/clientes/view.js')->addJs('/assets/js/plugins.js')->addJs('/assets/js/pages/formsValidation.js')->addJs('/js/fileinput/js/fileinput.min.js')->addJs('/js/fileinput/js/fileinput_locale_es.js');
     $model = new Contratos();
     $activos = $model->activos($cliente_id);
     $proceso = $model->proceso($cliente_id);
     $concluido = $model->concluido($cliente_id);
     $this->view->setVar('contratos_activos', count($activos));
     $this->view->setVar('contratos_proceso', count($proceso));
     $this->view->setVar('contratos_concluido', count($concluido));
     $contrato_total = $model->totalContrato($cliente_id);
     $deposito_total = $model->depositoTotal($cliente_id);
     $mora_total = $model->moraTotal($cliente_id);
     $this->view->setVar('contratoTotal', $contrato_total[0]->total);
     $this->view->setVar('depositoTotal', $deposito_total[0]->deposito);
     $this->view->setVar('moraTotal', $mora_total[0]->mora);
     $resul = Clientes::findFirstById($cliente_id);
     $this->view->setVar('cliente', $resul);
     $imagen = Archivos::findFirst("baja_logica = 1 and tabla=2 and producto_id ='{$cliente_id}'");
     $logo['imagen'] = '/file/clientes/logo_comodin.png';
     $logo['archivo_id'] = 0;
     if ($imagen != false) {
         $logo['imagen'] = $this->foto($imagen->carpeta, $imagen->nombre_archivo);
         $logo['archivo_id'] = $imagen->id;
     }
     $this->view->setVar('logo', $logo);
 }