public function indexAction() { $covenantModel = new CovenantModel(); $selectCovenant = $covenantModel->fetchAll(); $company = new CompanyModel(); $selectCompany = $company->fetchAll('cdcompanyparent IS NULL'); $_SESSION['cdbilling'] = ''; $departmentModel = new DepartmentModel(); $selectDepartment = $departmentModel->fetchAll(); $clientModel = new ClientModel(); $clientData = $clientModel->fetchAll(); $this->view->selectCovenant = $selectCovenant; $this->view->selectCompany = $selectCompany; $this->view->selectDepartment = $selectDepartment; $this->view->clientData = $clientData; }
public function autocompletedoctorbycdAction() { $term = $this->_request->getParam('term'); $cddoctor = $this->_request->getParam('cddoctor'); $cdpatient = $this->_request->getParam('cdpatient'); $covenantModel = new CovenantModel(); $covenants = $covenantModel->fetchAll($covenantModel->getCovenantByDoctor($cddoctor, $cdpatient, $term)); $json = '['; $first = true; foreach ($covenants as $row) { if (!$first) { $json .= ','; } else { $first = false; } $json .= json_encode(array("id" => $row['cdcovenant'], "value" => $row['nmcovenant'])); } $json .= ']'; echo $json; }
public function __construct() { parent::__construct(); $covenantModel = new CovenantModel(); $selectCovenant = $covenantModel->fetchAll(); $company = new CompanyModel(); $selectCompany = $company->fetchAll('cdcompanyparent IS NULL'); $departmentModel = new DepartmentModel(); $selectDepartment = $departmentModel->fetchAll(); $nmcollectionplaceModel = new CompanyModel(); $selectCompany = $nmcollectionplaceModel->fetchAll(); $clientModel = new ClientModel(); $clientData = $clientModel->fetchAll(); $this->_cdcovenant = new Zend_Form_Element_Select('cdcovenant'); $this->_cdcovenant->setAttrib("id", "covenantbilling_cdcovenant"); $this->_cdcovenant->setAttrib("class", "check_multiple_select"); foreach ($selectCovenant as $value) { //$this->_cdcovenant->addMultiOption($value->cdcovenant, $value->nmcovenant); } $this->_cdcovenant->setLabel("Convênio"); $this->_cdcovenant->setDecorators($this->_decoratorsDefault); $this->_cdcovenant->setRegisterInArrayValidator(false); $this->_cdcovenant->setRequired(false); $this->_cdcompanyparent = new Zend_Form_Element_Select('cdcompanyparent'); $this->_cdcompanyparent->setAttrib("id", "controltbilling_cdcompanyparent"); foreach ($selectCompany as $value) { $this->_cdcompanyparent->addMultiOption($value->cdcompany, $value->nmcompany); } $this->_cdcompanyparent->setLabel("Posto de Coleta"); $this->_cdcompanyparent->setDecorators($this->_decoratorsDefault); $this->_cdcompanyparent->setRegisterInArrayValidator(false); $this->_cdcompanyparent->setRequired(false); $this->_cddepartment = new Zend_Form_Element_Select('cddepartment'); $this->_cddepartment->setAttrib("id", "covenantbilling_ceddepartment"); $this->_cddepartment->setAttrib("class", "check_multiple_select"); foreach ($selectDepartment as $value) { $this->_cddepartment->addMultiOption($value->cddepartment, $value->nmdepartment); } $this->_cddepartment->setLabel("Setor"); $this->_cddepartment->setDecorators($this->_decoratorsDefault); $this->_cddepartment->setRegisterInArrayValidator(false); $this->_cddepartment->setRequired(false); $this->_fgstatus = new Zend_Form_Element_Select('fgstatus'); $this->_fgstatus->setAttrib("id", "covenantbilling_fgstatus"); $this->_fgstatus->setMultiOptions(array("0" => "Selecione", "1" => "Ativo", "2" => "Inativo")); $this->_fgstatus->setLabel("Status"); $this->_fgstatus->setDecorators($this->_decoratorsDefault); $this->_fgstatus->setRegisterInArrayValidator(false); $this->_fgstatus->setRequired(false); //$clientData $this->_cdclient = new Zend_Form_Element_Text('cdclient'); $this->_cdclient->setAttrib("id", "covenantbilling_cdclient"); $this->_cdclient->setAttrib("onkeyup", "lookup(this.value);"); $this->_cdclient->setAttrib("onblur", "fill();"); $this->_cdclient->setAttrib("autocomplete", "off"); $this->_cdclient->setAttrib("size", "50"); // foreach ($clientData as $value) { // $this->_cdclient->addMultiOption($value->cdclient, $value->nmclient); // } $this->_cdclient->setLabel("Paciente"); $this->_cdclient->setDecorators($this->_decoratorsDefault); $this->_cdclient->setRequired(false); $this->_dtstart = new Zend_Form_Element_Text('dtstart'); $this->_dtstart->setAttrib("id", "covenantbilling_dtstart"); $this->_dtstart->setAttrib("class", "datepicker"); $this->_dtstart->setLabel("Data Inicio"); $this->_dtstart->setDecorators($this->_decoratorsDefault); $this->_dtstart->setRequired(false); $this->_hrend = new Zend_Form_Element_Text('dtenddate'); $this->_hrend->setLabel("Hora Início"); $this->_hrend->setDecorators($this->_decoratorsDefault); $this->_hrend->setAttrib("id", "covenantbilling_hrend"); $this->_hrend->setAttrib("class", "mask_time"); $this->_dtend = new Zend_Form_Element_Text('dtend'); $this->_dtend->setAttrib("id", "covenantbilling_dtenddate"); $this->_dtend->setAttrib("class", "datepicker"); $this->_dtend->setLabel("Data Fim"); $this->_dtend->setDecorators($this->_decoratorsDefault); $this->_dtend->setRequired(false); $this->_hrstart = new Zend_Form_Element_Text('hrstart'); $this->_hrstart->setLabel("Hora Fim"); $this->_hrstart->setDecorators($this->_decoratorsDefault); $this->_hrstart->setAttrib("id", "covenantbilling_hrstart"); $this->_hrstart->setAttrib("class", "mask_time"); $this->_nrbatch = new Zend_Form_Element_Text('nrlot'); $this->_nrbatch->setAttrib("id", "covenantbilling_nrbatch"); $this->_nrbatch->setLabel("Número do Lote"); $this->_nrbatch->setDecorators($this->_decoratorsDefault); $this->_nrbatch->setRequired(false); $this->_dtduedate = new Zend_Form_Element_Text('dtduedate'); $this->_dtduedate->setAttrib("id", "covenantbilling_dtduedate"); $this->_dtduedate->setAttrib("class", "datepicker"); $this->_dtduedate->setLabel("Vencimento"); $this->_dtduedate->setDecorators($this->_decoratorsDefault); $this->_dtduedate->setRequired(false); }
public function covenantsearchAction() { $covenant = $_POST["querySt"]; $covenantModel = new CovenantModel(); $covenantData = $covenantModel->fetchAll('nmcovenant like "%' . $covenant . '%"'); echo "<ul id='sug2'>"; foreach ($covenantData as $row) { echo '<li onClick="fill2(\'' . $row->cdcovenant . '\', \'' . $row->nmcovenant . '\');"><a href="javascript:void(0);">' . $row->nmcovenant . '</a></li>'; } echo "</ul>"; }
public function __construct() { parent::__construct(); $arrayPriority = array('1' => 'Normal', '2' => 'Urgente'); $covenantModel = new CovenantModel(); $selectCovenant = $covenantModel->fetchAll(); $arrayCovenant = array(); $arrayCovenant['0'] = "0"; foreach ($selectCovenant as $selCv) { $arrayCovenant[$selCv->cdcovenant] = $selCv->nmcovenant; } $departmentModel = new DepartmentModel(); $selectDepartment = $departmentModel->fetchAll(); $arrayDepartment = array(); $arrayDepartment['0'] = "0"; foreach ($selectDepartment as $selDP) { $arrayDepartment[$selDP->cddepartment] = $selDP->nmdepartment; } $uncollectionModel = new CompanyModel(); $selectCompany = $uncollectionModel->fetchAll("cdcompanyparent IS NOT NULL"); $arrayuncollection = array(); $arrayuncollection['0'] = "0"; foreach ($selectCompany as $cdplace) { $arrayuncollection[$cdplace->cdcompany] = $cdplace->nmfantasyname; } $fgstatusModel = new RequestexaminationModel(); $selectstatus = $fgstatusModel->fetchAll(); $arrayfgstatus = array(); $arrayfgstatus['0'] = "Selecione"; foreach ($selectstatus as $cdstatus) { $arrayfgstatus[$cdstatus->cdrequestexamination] = $cdstatus->fgstatus; } //Novas... $this->_departament = new Zend_Form_Element_Select('departament'); $this->_departament->setAttrib("id", "maps_departament"); $this->_departament->setAttrib("class", "check_multiple_select"); $this->_departament->setMultiOptions($arrayDepartment); $this->_departament->setLabel("Setor"); $this->_departament->setDecorators($this->_decoratorsDefault); $this->_departament->setRegisterInArrayValidator(true); $this->_departament->setRequired(true); $this->_covenant = new Zend_Form_Element_Select('covenant'); $this->_covenant->setAttrib("id", "maps_covenant"); $this->_covenant->setAttrib("class", "check_multiple_select"); $this->_covenant->setMultiOptions($arrayCovenant); $this->_covenant->setLabel("Convênio"); $this->_covenant->setDecorators($this->_decoratorsDefault); $this->_covenant->setRegisterInArrayValidator(true); $this->_covenant->setRequired(true); $this->_uncollection = new Zend_Form_Element_Select('uncollection'); $this->_uncollection->setAttrib("id", "maps_uncollection"); $this->_uncollection->setAttrib("class", "check_multiple_select"); $this->_uncollection->setMultiOptions($arrayuncollection); $this->_uncollection->setLabel("Unidade de Coleta"); $this->_uncollection->setDecorators($this->_decoratorsDefault); $this->_uncollection->setRegisterInArrayValidator(true); $this->_uncollection->setRequired(true); $this->_stsample = new Zend_Form_Element_Select('stsample'); $this->_stsample->setAttrib("id", "maps_stsample"); $this->_stsample->setAttrib("class", "multiple_select"); $this->_stsample->setMultiOptions($arrayfgstatus); $this->_stsample->setLabel("Status Amostra"); $this->_stsample->setDecorators($this->_decoratorsDefault); $this->_stsample->setRegisterInArrayValidator(true); $this->_stsample->setRequired(true); $this->_priority = new Zend_Form_Element_Select('priority'); $this->_priority->setAttrib("id", "maps_priority"); $this->_priority->setAttrib("class", "check_multiple_select"); $this->_priority->setMultiOptions($arrayPriority); $this->_priority->setLabel("Prioridade"); $this->_priority->setDecorators($this->_decoratorsDefault); $this->_priority->setRegisterInArrayValidator(true); $this->_priority->setRequired(true); $this->_dtstart = new Zend_Form_Element_Text('dtstart'); $this->_dtstart->setAttrib("id", "maps_dtstart"); $this->_dtstart->setAttrib("class", "datepicker"); $this->_dtstart->setLabel("Data Inicial"); $this->_dtstart->setDecorators($this->_decoratorsDefault); $this->_dtstart->setRequired(false); $this->_dtend = new Zend_Form_Element_Text('dtend'); $this->_dtend->setAttrib("id", "maps_dtend"); $this->_dtend->setAttrib("class", "datepicker"); $this->_dtend->setLabel("Data Final"); $this->_dtend->setDecorators($this->_decoratorsDefault); $this->_dtend->setRequired(false); }
public function __construct() { parent::__construct(); $covenantModel = new CovenantModel(); $selectCovenant = $covenantModel->fetchAll(); $arrayCovenant = array(); $arrayCovenant['0'] = "Selecione"; foreach ($selectCovenant as $selCVNT) { $arrayCovenant[$selCVNT->cdcovenant] = $selCVNT->nmcovenant; } $responsibleModel = new UserModel(); $selectUser = $responsibleModel->fetchAll(); $arrayResponsible = array(); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $nmcollectionplaceModel = new CompanyModel(); $selectCompany = $nmcollectionplaceModel->fetchAll(); $arraynmcollectionplace = array(); $arraynmcollectionplace['0'] = "Selecione"; foreach ($selectCompany as $cdplace) { $arraynmcollectionplace[$cdplace->cdcompanyparent] = $cdplace->nmfantasyname; } // $departmentModel = new DepartmentModel(); // $selectDepartment = $departmentModel->fetchAll(); // $arrayDepartment = array(); // $arrayDepartment['0'] = "Selecione"; // foreach($selectDepartment as $selDP){ // $arrayDepartment[$selDP->cddepartment] = $selDP->nmdepartment; // } $departmentModel = new DepartmentModel(); $selectDepartment = $departmentModel->fetchAll(); $arrayDepartment = array(); $arrayDepartment['0'] = "Selecione"; foreach ($selectDepartment as $selDP) { $arrayDepartment[$selDP->cddepartment] = $selDP->nmdepartment; } $this->_fgcdcovenant = new Zend_Form_Element_Select('cdcovenant'); $this->_fgcdcovenant->setAttrib("id", "controltbilling_select"); // $this->_fgcdcovenant->setAttrib("class", "check_multiple_select"); $this->_fgcdcovenant->setMultiOptions($arrayCovenant); $this->_fgcdcovenant->setLabel("Convênio"); $this->_fgcdcovenant->setDecorators($this->_decoratorsDefault); $this->_fgcdcovenant->setRegisterInArrayValidator(true); $this->_fgcdcovenant->setRequired(true); // select do convenio para a página biilingdata $this->_fgcdcovenantdata = new Zend_Form_Element_Select('fgcdcovenantdata'); $this->_fgcdcovenantdata->setAttrib("id", "controltbillingdata_fgcdcovenantdata"); $this->_fgcdcovenantdata->setAttrib("class", "nmbillingcss"); $this->_fgcdcovenantdata->setMultiOptions($arrayCovenant); $this->_fgcdcovenantdata->setLabel("Convênios"); $this->_fgcdcovenantdata->setDecorators($this->_decoratorsDefault); $this->_fgcdcovenantdata->setRegisterInArrayValidator(true); $this->_fgcdcovenantdata->setRequired(true); $this->_nmcollectionplace = new Zend_Form_Element_Select('nmcollectionplace'); $this->_nmcollectionplace->setAttrib("id", "controltbilling_select"); // $this->_nmcollectionplace->setMultiOptions($arrayDocumentData); $this->_nmcollectionplace->setMultiOptions($arraynmcollectionplace); $this->_nmcollectionplace->setLabel("Posto de Coleta"); $this->_nmcollectionplace->setDecorators($this->_decoratorsDefault); $this->_nmcollectionplace->setRegisterInArrayValidator(true); $this->_nmcollectionplace->setRequired(true); $this->_nmdepartment = new Zend_Form_Element_Select('nmdepartment'); $this->_nmdepartment->setAttrib("id", "controltbilling_select"); // $this->_nmdepartment->setAttrib("class", "check_multiple_select"); $this->_nmdepartment->setMultiOptions($arrayDepartment); $this->_nmdepartment->setLabel("Setor"); $this->_nmdepartment->setDecorators($this->_decoratorsDefault); $this->_nmdepartment->setRegisterInArrayValidator(true); $this->_nmdepartment->setRequired(true); $this->_fgstatus = new Zend_Form_Element_Select('fgstatus'); $this->_fgstatus->setAttrib("id", "controltbilling_select"); $this->_fgstatus->setMultiOptions(array("0" => "Selecione", "1" => "Ativo", "2" => "Inativo")); $this->_fgstatus->setLabel("Status"); $this->_fgstatus->setDecorators($this->_decoratorsDefault); $this->_fgstatus->setRegisterInArrayValidator(true); $this->_fgstatus->setRequired(true); $this->_nmpacient = new Zend_Form_Element_Text('nmpacient'); $this->_nmpacient->setAttrib("id", "controllbilling_nmpacient"); $this->_nmpacient->setAttrib("onkeyup", "lookup(this.value);"); $this->_nmpacient->setAttrib("onblur", "fill();"); $this->_nmpacient->setAttrib("autocomplete", "off"); $this->_nmpacient->setAttrib("size", "50"); $this->_nmpacient->setLabel("Paciente"); $this->_nmpacient->setDecorators($this->_decoratorsDefault); $this->_nmpacient->setRequired(false); $this->_responsible = new Zend_Form_Element_Select('responsible'); $this->_responsible->setAttrib("id", "controltbilling_select"); $this->_responsible->setAttrib("class", "controlbilling_responsible"); // $this->_fgcdcovenant->setAttrib("class", "check_multiple_select"); $this->_responsible->setLabel("Responsável"); $arrayResponsible['0'] = "Selecione"; foreach ($selectUser as $userLog) { /* if ($userInfo->idusergslab == $userLog->idusergslab) { $arrayResponsible[$userLog->idusergslab] = $userLog->nmusergslab; } */ $arrayResponsible[$userLog->idusergslab] = $userLog->nmusergslab; } $this->_responsible->setMultiOptions($arrayResponsible); $this->_responsible->setValue($userInfo); $this->_responsible->setDecorators($this->_decoratorsDefault); $this->_responsible->setRegisterInArrayValidator(true); $this->_responsible->setRequired(true); $this->_responsibledata = new Zend_Form_Element_Select('responsibledata'); $this->_responsibledata->setAttrib("id", "controltbilling_responsible"); $this->_responsibledata->setAttrib("class", "controlbillingdata_responsibledata"); // $this->_fgcdcovenant->setAttrib("class", "check_multiple_select"); $this->_responsibledata->setMultiOptions($arrayResponsible); $this->_responsibledata->setLabel("Responsável"); $this->_responsibledata->setDecorators($this->_decoratorsDefault); $this->_responsibledata->setRegisterInArrayValidator(true); $this->_responsibledata->setRequired(true); $this->_dtbegindate = new Zend_Form_Element_Text('dtbegindate'); $this->_dtbegindate->setAttrib("id", "controltbilling_dtbegindate"); $this->_dtbegindate->setAttrib("class", "datepicker"); $this->_dtbegindate->setLabel("Data Início"); $this->_dtbegindate->setDecorators($this->_decoratorsDefault); $this->_dtbegindate->setRequired(false); $this->_timebeginhour = new Zend_Form_Element_Text('timebeginhour'); $this->_timebeginhour->setLabel("Horário"); $this->_timebeginhour->setDecorators($this->_decoratorsDefault); $this->_timebeginhour->setAttrib("id", "controltbilling_timebeginhour"); $this->_timebeginhour->setAttrib("class", "mask_time"); $this->_dtenddate = new Zend_Form_Element_Text('dtenddate'); $this->_dtenddate->setAttrib("id", "controltbilling_dtenddate"); $this->_dtenddate->setAttrib("class", "datepicker"); $this->_dtenddate->setLabel("Data Fim"); $this->_dtenddate->setDecorators($this->_decoratorsDefault); $this->_dtenddate->setRequired(false); $this->_timeendhour = new Zend_Form_Element_Text('timeendhour'); $this->_timeendhour->setLabel("Horário"); $this->_timeendhour->setDecorators($this->_decoratorsDefault); $this->_timeendhour->setAttrib("id", "controltbilling_timeendhour"); $this->_timeendhour->setAttrib("class", "mask_time"); ////////////////// $this->_dtbegindatedata = new Zend_Form_Element_Text('dtbegindatedata'); $this->_dtbegindatedata->setAttrib("id", "controltbillingdata_dtbegindatedata"); $this->_dtbegindatedata->setAttrib("class", "datepicker"); $this->_dtbegindatedata->setLabel("Data Início"); $this->_dtbegindatedata->setDecorators($this->_decoratorsDefault); $this->_dtbegindatedata->setRequired(false); $this->_timebeginhourdata = new Zend_Form_Element_Text('timebeginhourdata'); $this->_timebeginhourdata->setAttrib("id", "controltbillingdata_timebeginhourdata"); $this->_timebeginhourdata->setLabel("Hora Início"); $this->_timebeginhourdata->setDecorators($this->_decoratorsDefault); $this->_timebeginhourdata->setRequired(false); $this->_dtenddatedata = new Zend_Form_Element_Text('dtenddatedata'); $this->_dtenddatedata->setAttrib("id", "controltbillingdata_dtenddatedata"); $this->_dtenddatedata->setAttrib("class", "datepicker"); $this->_dtenddatedata->setLabel("Data Fim"); $this->_dtenddatedata->setDecorators($this->_decoratorsDefault); $this->_dtenddatedata->setRequired(false); $this->_timeendhourdata = new Zend_Form_Element_Text('timeendhourdata'); $this->_timeendhourdata->setAttrib("id", "controltbillingdata_timeendhourdata"); $this->_timeendhourdata->setLabel("Hora Fim"); $this->_timeendhourdata->setDecorators($this->_decoratorsDefault); $this->_timeendhourdata->setRequired(false); ////////////// $this->_nrlot = new Zend_Form_Element_Text('nrlot'); $this->_nrlot->setAttrib("id", "controltbilling_nrlot"); $this->_nrlot->setLabel("Número do Lote"); $this->_nrlot->setDecorators($this->_decoratorsDefault); $this->_nrlot->setRequired(false); $this->_statusbilling = new Zend_Form_Element_Text('statusbilling'); $this->_statusbilling->setAttrib("id", "controltbillingdata_statusbilling"); $this->_statusbilling->setLabel("Status Faturamento"); $this->_statusbilling->setDecorators($this->_decoratorsDefault); $this->_statusbilling->setRequired(false); // Numero da fatura $this->_nmbilling = new Zend_Form_Element_Text('nmbilling'); $this->_nmbilling->setAttrib("id", "controltbillingdata_nmbilling"); $this->_nmbilling->setAttrib("class", "nmbillingcss"); $this->_nmbilling->setLabel("# Fatura"); $this->_nmbilling->setDecorators($this->_decoratorsDefault); $this->_nmbilling->setRequired(false); // Numero da Fatura $this->_nmlotbilling = new Zend_Form_Element_Text('nmlotbilling'); $this->_nmlotbilling->setAttrib("id", "controltbilling__nmlotbilling"); $this->_nmlotbilling->setAttrib("class", "nmlotbillingcss"); $this->_nmlotbilling->setLabel("Nº Lote Fatura"); $this->_nmlotbilling->setDecorators($this->_decoratorsDefault); $this->_nmlotbilling->setRequired(false); $this->_dtmaturity = new Zend_Form_Element_Text('dtmaturity'); $this->_dtmaturity->setAttrib("id", "controltbilling_dtmaturity"); $this->_dtmaturity->setAttrib("class", "datepicker"); $this->_dtmaturity->setLabel("Vencimento"); $this->_dtmaturity->setDecorators($this->_decoratorsDefault); $this->_dtmaturity->setRequired(false); $this->_dtmaturitydata = new Zend_Form_Element_Text('dtmaturitydata'); $this->_dtmaturitydata->setAttrib("id", "controltbillingdata_dtmaturitydata"); $this->_dtmaturitydata->setAttrib("class", "datepicker"); $this->_dtmaturitydata->setLabel("Vencimento"); $this->_dtmaturitydata->setDecorators($this->_decoratorsDefault); $this->_dtmaturitydata->setRequired(false); $this->_accountsreceivable = new Zend_Form_Element_MultiCheckbox('accountsreceivable'); $this->_accountsreceivable->addMultiOption('accountsreceivable', ' Enviar para Contas à Receber'); $this->_accountsreceivable->setAttrib("id", "accountsreceivable"); $this->_accountsreceivable->setAttrib("class", "standartchecklabel"); $this->_accountsreceivable->AddDecorator('HtmlTag', array('tag' => 'li', 'openOnly' => true)); $this->_accountsreceivable->setDecorators(array(array('ViewHelper'), array('HtmlTag', array('tag' => 'li')))); }
public function dadosAction() { $this->_helper->layout->disableLayout(); $page = $this->_request->getParam("page", 1); $limit = $this->_request->getParam("rows"); $sidx = $this->_request->getParam("sidx", 1); $sord = $this->_request->getParam("sord"); $filters = $this->_request->getParam("filters"); if ($filters != '') { $data = $this->buildWhereClause($filters); } $covenantModel = new CovenantModel(); if (isset($data['sql']) && $data['sql'] != '') { $covenant = $covenantModel->fetchAll($data['sql']); $count = count($covenant); if ($count > 0 && $limit > 0) { $total_pages = ceil($count / $limit); $covenant = $covenantModel->fetchAll($data['sql'], "{$sidx} {$sord}", $limit, $page * $limit - $limit); } else { $total_pages = 0; } if ($page > $total_pages) { $page = $total_pages; } $responce = new stdClass(); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; } else { $covenant = $covenantModel->fetchAll(); $count = count($covenant); if ($count > 0 && $limit > 0) { $total_pages = ceil($count / $limit); } else { $total_pages = 0; } if ($page > $total_pages) { $page = $total_pages; } $covenant = $covenantModel->fetchAll(null, "{$sidx} {$sord}", $limit, $page * $limit - $limit); $responce = new stdClass(); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; } $i = 0; $idcnpj = ''; $desc_fgcovenanttype = ''; //print_r($covenant); foreach ($covenant as $row) { switch ($row->fgcovenanttype) { case 1: $desc_fgcovenanttype = 'Plano de Saúde'; break; case 2: $desc_fgcovenanttype = 'Convênio'; break; case 3: $desc_fgcovenanttype = 'Sindicato'; break; case 4: $desc_fgcovenanttype = 'Particular'; break; } if ($row->idcnpj != '') { $idcnpj = substr($row->idcnpj, 0, 2) . "." . substr($row->idcnpj, 2, 3) . "." . substr($row->idcnpj, 5, 3) . "/" . substr($row->idcnpj, 8, 4) . "-" . substr($row->idcnpj, 12); } if ($row->idcep != '') { $idcep = substr($row->idcnpj, 0, 5) . "-" . substr($row->idcep, 5); } else { $idcep = ''; } $responce->rows[$i]['cell'] = array($row->cdcovenant, $row->idcovenant, $row->nmcovenant, $idcnpj, $desc_fgcovenanttype, $row->nmstreet, $row->nrnumber, $row->nmneighborhood, $row->idstate, $row->idcity, $idcep, $row->fgcovenanttype, str_replace(".", ",", $row->vlchvalue)); $idcnpj = ''; $desc_fgcovenanttype = ''; $idcep = ''; $i++; } $data = ''; $this->view->dados = $responce; /* $responce[$i]['id'] = $i+1; $responce[$i]['code'] = md5(rand(0, 10000)); $responce[$i]['name'] = 'Jonas'.($i+1); foreach($covenant as $row) { $responce->rows[$i]['id']=$row->code; $responce->rows[$i]['cell']=array( $row->code, $row->name, $row->CNPJ, $row->type ); $i++; } */ }
public function __construct() { parent::__construct(); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $covenantModel = new CovenantModel(); $selectCovenant = $covenantModel->fetchAll(); $arrayCovenant = array(); $arrayCovenant['0'] = "Selecione"; foreach ($selectCovenant as $selCv) { $arrayCovenant[$selCv->cdcovenant] = $selCv->nmcovenant; $arrayCovenantCD[$selCv->cdcovenant] = $selCv->cdcovenant; } //Novas... $this->_covenant = new Zend_Form_Element_Select('covenant'); $this->_covenant->setAttrib("id", "budgetbilling_covenant"); $this->_covenant->setAttrib("class", "check_multiple_select"); $this->_covenant->setMultiOptions($arrayCovenant, $arrayCovenantCD); $this->_covenant->setLabel("Convênios"); $this->_covenant->setDecorators($this->_decoratorsDefault); $this->_covenant->setRegisterInArrayValidator(true); $this->_covenant->setRequired(true); $this->_examination = new Zend_Form_Element_Text('examination'); $this->_examination->setAttrib("id", "budgetbilling_examination"); $this->_examination->setAttrib("onkeyup", "lookup(this.value);"); $this->_examination->setAttrib("onblur", "fill();"); $this->_examination->setAttrib("autocomplete", "off"); $this->_examination->setLabel("Exame/Material"); $this->_examination->setDecorators($this->_decoratorsDefault); $this->_examination->setRequired(false); $this->_idexamination = new Zend_Form_Element_Hidden('idexamination'); $this->_idexamination->setAttrib("id", "budgetbilling_idexamination"); $this->_idexamination->setDecorators($this->_decoratorsDefault); //$this->_idexamination->setRequired(false); $this->_cdexamination = new Zend_Form_Element_Hidden('cdexamination'); $this->_cdexamination->setAttrib("id", "budgetbilling_cdexamination"); $this->_cdexamination->setDecorators($this->_decoratorsDefault); //$this->_cdexamination->setRequired(false); $this->_sizecols = new Zend_Form_Element_Hidden('sizecols'); $this->_sizecols->setAttrib("id", "sizecols"); $this->_sizecols->setDecorators($this->_decoratorsDefault); //$this->_cdexamination->setRequired(false); $this->_cashvalue = new Zend_Form_Element_Text('cashvalue'); $this->_cashvalue->setAttrib("id", "budgetbilling_cashvalue"); $this->_cashvalue->setValue("R\$"); $this->_cashvalue->setAttrib("onfocus", "limpaCampo1();"); $this->_cashvalue->setAttrib("onblur", "returnCampo1();"); $this->_cashvalue->setDecorators($this->_decoratorsDefault); $this->_cashvalue->setRequired(false); $this->_percentagevalue = new Zend_Form_Element_Text('percentagevalue'); $this->_percentagevalue->setAttrib("id", "budgetbilling_percentagevalue"); $this->_percentagevalue->setValue("%"); $this->_percentagevalue->setAttrib("onfocus", "limpaCampo2();"); $this->_percentagevalue->setAttrib("onblur", "returnCampo2();"); $this->_percentagevalue->setDecorators($this->_decoratorsDefault); $this->_percentagevalue->setRequired(false); $this->_cashvalue2 = new Zend_Form_Element_Text('cashvalue2'); $this->_cashvalue2->setAttrib("id", "budgetbilling_cashvalue2"); $this->_cashvalue2->setValue("R\$"); $this->_cashvalue2->setAttrib("onfocus", "limpaCampo3();"); $this->_cashvalue2->setAttrib("onblur", "returnCampo3();"); $this->_cashvalue2->setDecorators($this->_decoratorsDefault); $this->_cashvalue2->setRequired(false); $this->_percentagevalue2 = new Zend_Form_Element_Text('percentagevalue2'); $this->_percentagevalue2->setAttrib("id", "budgetbilling_percentagevalue2"); $this->_percentagevalue2->setValue("%"); $this->_percentagevalue2->setAttrib("onfocus", "limpaCampo4();"); $this->_percentagevalue2->setAttrib("onblur", "returnCampo4();"); $this->_percentagevalue2->setDecorators($this->_decoratorsDefault); $this->_percentagevalue2->setRequired(false); $this->_user = new Zend_Form_Element_Text('user'); $this->_user->setAttrib("id", "budgetbilling_user"); $this->_user->setValue($userInfo->nmusergslab); $this->_user->setDecorators($this->_decoratorsDefault); $this->_user->setRequired(true); $this->_covenant2 = new Zend_Form_Element_Select('covenant'); $this->_covenant2->setAttrib("id", "budgetbilling_covenant"); $this->_covenant2->setAttrib("class", "multiple_select"); $this->_covenant2->setMultiOptions($arrayCovenant); $this->_covenant2->setLabel("Selecione um convênio"); $this->_covenant2->setDecorators($this->_decoratorsDefault); $this->_covenant2->setRegisterInArrayValidator(true); $this->_covenant2->setRequired(true); }