Example #1
0
 public function addAction()
 {
     if (!$this->_hasParam('id')) {
         return $this->_redirect('/analysis/index/page/1');
     }
     $convert = new Application_Model_Letras();
     $model = new Application_Model_Payments();
     $datos = new Application_Model_Analysis();
     $row = $datos->getRow($this->_getParam('id'));
     if ($row) {
         $data = $row->toArray();
         $contact = new Application_Model_Contacts();
         $customer = $contact->getRow($data['applicant_id'])->toArray();
         $paciente = $customer['first_name'] . ' ' . $customer['last_name'];
         $exa = $datos->BySpecialties($this->_getParam('id'));
         $monto = 0;
         foreach ($exa as $key) {
             $monto = $monto + $key['amount'];
         }
         $datos->actualiza_total($this->_getParam('id'), $monto);
         $this->view->paginator = $exa;
         $this->view->letras = $convert->num2letras($monto);
         $this->view->paciente = $paciente;
         $this->view->data = $data;
         $this->view->monto = $monto;
     }
 }
 public function contactAction()
 {
     $contacts = new Application_Model_Contacts();
     $request = $this->getRequest();
     $contactForm = new Application_Form_Contact();
     if ($request->isPost() && $contactForm->isValid($request->getPost())) {
         $contacts = new Application_Model_Contacts();
         $data = $request->getPost();
         if ($contacts->insert($data['name'], $data['email'], $data['website'], $data['body'])) {
             $this->view->success = " Your Message has been sent successfully.";
         } else {
             $this->view->error = " Internal Error ";
         }
     }
     $this->view->form = $contactForm;
 }
Example #3
0
 public function init()
 {
     $this->setAttrib('id', 'contact-form');
     $this->addElement('text', 'first_name', array('label' => 'Nombre', 'required' => true));
     $this->addElement('text', 'last_name', array('label' => 'Apellidos', 'required' => true));
     $this->addElement('text', 'email', array('label' => 'email'));
     $this->addElement('text', 'phone_home', array('label' => 'Telefono de casa'));
     $this->addElement('text', 'birthdate', array('label' => 'Fecha de Nacimiento', 'required' => true));
     // Add the comment element
     $this->addElement('select', 'title', array('label' => 'Tipo', 'required' => true, 'multiOptions' => array('' => '', 'Administrador' => 'Administrador', 'Paciente' => 'Paciente', 'Medico' => 'Medico')));
     $this->addElement('select', 'gender', array('label' => 'Seleccion el Genero', 'required' => true, 'multiOptions' => array('M' => 'Masculino', 'F' => 'Femenino')));
     $this->addElement('select', 'reports_to_id', array('label' => 'Asignado a'));
     $asignado = new Application_Model_Contacts();
     $this->reports_to_id->addMultiOptions($asignado->getAsKeyValue());
     $this->addElement('submit', 'Guardar', array());
 }
Example #4
0
 public function init()
 {
     $this->setAttrib('enctype', 'multipart/form-data');
     $this->addElement('text', 'id', array('label' => 'No Analsis', 'required' => true));
     $this->addElement('select', 'applicant_id', array('label' => 'Solicitante'));
     $solicitante = new Application_Model_Contacts();
     $this->applicant_id->addMultiOptions($solicitante->getAsKeyValue());
     $this->addElement('select', 'medic_id', array('label' => 'Medico'));
     $medico = new Application_Model_Contacts();
     $this->medic_id->addMultiOptions($medico->getAsKeyValue());
     $this->addElement('select', 'status', array('label' => 'Status', 'required' => true, 'multiOptions' => array('Pendiente' => 'Pendiente', 'Liberado' => 'Liberado')));
     $this->addElement('textarea', 'note', array('label' => 'Nota:', 'rows' => '5', 'validators' => array(array('validator' => 'StringLength', 'options' => array(0, 100)))));
     $this->addElement('file', 'archivo', array('class' => 'sf'));
     $this->archivo->addValidator('Extension', false, 'pdf');
     $this->archivo->addValidator('Size', false, '10024000');
     $this->archivo->setDestination(APPLICATION_PATH . '/../public/files/')->setValueDisabled(true);
     $this->addElement('text', 'discount', array('label' => 'Descuento', 'required' => false));
     $this->addElement('checkbox', 'name', array('label' => 'Pdf sin encabezado', 'required' => false));
     $this->addElement('submit', 'Guardar', array());
 }
 public function indexAction()
 {
     $contacts = new Application_Model_Contacts();
     $data = $contacts->fetchAll();
     $this->view->messages = $data;
 }
Example #6
0
 public function pdfAction()
 {
     require_once '/Zend/Pdf.php';
     require_once '/PS/utils.php';
     if (!$this->_hasParam('id')) {
         return $this->_redirect('/analysis/index/page/1');
     }
     $datos = new Application_Model_Analysis();
     $row = $datos->getRow($this->_getParam('id'));
     if ($row) {
         $data = $row->toArray();
         $contact = new Application_Model_Contacts();
         $results = new Application_Model_Results();
         $exa = $datos->BySpecialties($this->_getParam('id'));
         $customer = $contact->getRow($data['applicant_id'])->toArray();
         $medico = $contact->getRow($data['medic_id'])->toArray();
         $this->_helper->layout->disableLayout();
         $this->_helper->viewRenderer->setNoRender();
         //$pdf = new Zend_Pdf();
         if ($data['name'] == 1) {
             $pdf = Zend_Pdf::load('img/2.pdf');
         } else {
             $pdf = Zend_Pdf::load('img/1.pdf');
         }
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
         //$pdf->pages[] = $page;
         $page = $pdf->pages[0];
         /*
         //specify color
         $color = new Zend_Pdf_Color_HTML("navy");
         $page->setFillColor($color);
         */
         $fontT = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
         $page->drawText($customer['first_name'] . ' ' . $customer['last_name'], 125, 712);
         $page->drawText(date('Y-m-d', strtotime($data['date_entered'])), 455, 712);
         $page->drawText(birthday($customer['birthdate']), 125, 700);
         $page->drawText($customer['gender'], 455, 700);
         $page->drawText($medico['first_name'] . ' ' . $medico['last_name'], 125, 685);
         $posY = 670;
         foreach ($exa as $key) {
             $posY -= 50;
             $page->setLineWidth(0.5);
             $page->drawLine(50, $posY + 15, 530, $posY + 15);
             $page->setLineWidth(0.5);
             $page->drawLine(50, $posY - 10, 530, $posY - 10);
             $page->drawText('Examen', 50, $posY);
             $page->drawText('Resultado', 280, $posY);
             $page->drawText('U.M.', 360, $posY);
             $page->drawText('Valores de Referencia', 400, $posY);
             $page->drawText($key['name'], 50, $posY - 25);
             $res = $results->getBy(array('analysis_id =?' => $key['analysis_id'], 'test_id =?' => $key['itest_id']))->toArray();
             $posY -= 38.4;
             foreach ($res as $keyd) {
                 $page->drawText($keyd['item_name'], 60, $posY);
                 $page->drawText($keyd['result'], 280, $posY);
                 $page->drawText($keyd['ref_val_unit'], 350, $posY);
                 $page->drawText($keyd['ref_val_value'], 420, $posY);
                 $posY -= 14.2;
             }
             $posY -= 20.2;
             $page->drawText('MUESTRA:', 280, $posY);
             $page->drawText('METODO DE PROCESO:', 280, $posY - 14);
         }
         if ($posY < 400) {
             $page2 = new Zend_Pdf_Page($page);
             $pdf->pages[] = $page2;
         }
         $page->drawText('OBSERVACIONES:', 50, 170);
         $page->drawText($data['note'], 50, 155);
         $this->getResponse()->setHeader('Content-Disposition', 'attachment; filename=result.pdf')->setHeader('Content-type', 'application/x-pdf');
         echo $pdf->render();
     }
 }
 public function contactAction()
 {
     $request = new Zend_Controller_Request_Http();
     $user_id = $request->getCookie('user_id');
     if (!isset($user_id) || !$user_id || empty($user_id)) {
         $this->_redirect('user/login');
     }
     $form = new Application_Form_Contacts();
     $this->view->form = $form;
     $modelConfig = new Application_Model_Configs();
     $tutorConfig = $modelConfig->getConfigDetail("dang-ky-tim-gia-su");
     $urlRedirect = '/news/detail/id/' . $tutorConfig['ConfigValue'];
     $this->view->urlRedirect = $urlRedirect;
     $getMail = false;
     /* Proccess data post*/
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             $data = $_POST;
             $data['UserId'] = $user_id;
             if (isset($data['ContactId'])) {
                 unset($data['ContactId']);
             }
             $contactModel = new Application_Model_Contacts();
             if ($contactModel->add($data)) {
                 $this->_redirect($urlRedirect);
             }
         } else {
             $msgVN = array("is required and can't be empty" => 'Không được để trống', 'is no valid email address in the basic format local-part@hostname' => 'Email không hợp lệ');
             $messageStatus = 'danger/Có lỗi xảy ra. Chú ý thông tin những ô sau đây:';
             $messages = array();
             foreach ($form->getMessages() as $fieldName => $message) {
                 $message = end($message);
                 $key = substr(strstr($message, " "), 1);
                 if (in_array($key, array_keys($msgVN))) {
                     $message = $msgVN[$key];
                 }
                 $messages[$fieldName] = $message;
             }
             $this->view->messages = $messages;
             $this->view->messageStatus = $messageStatus;
         }
     }
 }
Example #8
0
 public function listJsonAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout->disableLayout();
     $contacsModel = new Application_Model_Contacts();
     $wheres = array();
     $orWheres = array();
     foreach ($_GET as $key => $value) {
         if ($key === 'url') {
             continue;
         }
         $campoComparacion = explode("__", $key);
         $comparacion = count($campoComparacion) > 1 ? $campoComparacion[1] : "=";
         if (count($campoComparacion) === 3) {
             if ($campoComparacion[2] === "or") {
                 $orWheres[$campoComparacion[0] . " " . $comparacion . " ?"] = $value;
             }
         } else {
             $wheres[$campoComparacion[0] . " " . $comparacion . " ?"] = $value;
         }
     }
     //echo print_r($wheres, true);
     $contacts = $contacsModel->getBy($wheres, $orWheres);
     $json = array("result" => $contacts->toArray());
     $this->getResponse()->setHeader('Content-Type', 'application/json')->setBody(json_encode($json));
 }