public function indexAction() { $form = new MedicineForm(); $form->addElementsForm(); $form->setDecorators(array('FormElements', 'Form')); $form->removeDecorator('form'); $this->view->medicine = $form; $formStockControl = new MedicineForm(); $formStockControl->addElementsStockControl(); $formStockControl->setDecorators(array('FormElements', 'Form')); $formStockControl->removeDecorator('form'); $this->view->medicinestockcontrol = $formStockControl; $formExistantStock = new MedicineForm(); $formExistantStock->addElementsExistantStock(); $formExistantStock->setDecorators(array('FormElements', 'Form')); $formExistantStock->removeDecorator('form'); $this->view->medicineexistantstock = $formExistantStock; //options dos campos select $measurementunitModel = new MeasurementunitModel(); $selectMeasurementunit = $measurementunitModel->fetchAll(); $supplyModel = new SupplyModel(); $selectSupply = $supplyModel->fetchAll($supplyModel->getSupplyNotInMedicine()); $supplycentreModel = new SupplycentreModel(); $selectSupplycentre = $supplycentreModel->fetchAll(); $supplierModel = new SupplierModel(); $selectSupplier = $supplierModel->fetchAll(); $this->view->selectMeasurementunit = $selectMeasurementunit; $this->view->selectSupply = $selectSupply; $this->view->selectSupplycentre = $selectSupplycentre; $this->view->selectSupplier = $selectSupplier; }
protected function createComponentSupplierTabella($name) { $datasource = SupplierModel::getFluent()->toDatasource()->orderBy('name'); $grid = new Tabella($datasource, array('id_table' => 'id_product_supplier', 'sorting' => 'id_product_supplier', 'order' => 'id_product_supplier', 'truncate' => 0, "onSubmit" => function ($post) { SupplierModel::save($post, $post['id_product_supplier']); })); $grid->addColumn("Názov", "name", array("width" => 300, "editable" => true)); $grid->addColumn("Počet produktov", "product_count", array("width" => 80, "editable" => false)); $grid->addColumn("", "action", array("width" => 100, 'type' => Tabella::SELECT, "filter" => false, "options" => false, "editable" => true, "renderer" => function ($row) { $el = NHtml::el("td"); /* * link na zmazanie produktu */ $el->add(NHtml::el('a')->href(NEnvironment::getApplication()->getPresenter()->link('delete!', array('id' => $row->id_product_supplier)))->addClass('deleteIcon')); /* * link na editaciu produktu */ // $el->add( // NHtml::el( 'a' )->href( // NEnvironment::getApplication()->getPresenter()->link( 'Product:edit' , array('id'=>$row->id_product_supplier)) // )->addClass( 'editIcon' ) // ); /* * ikona aktivan polozka, neaktivan polozka */ return $el; })); $this->addComponent($grid, $name); }
public function deactivatesupplierAction() { try { $arrayUpdateSupplier = array("fgactive" => '2'); $cdsupplier = $this->_request->getParam("cdsupplier"); $modelSupplier = new SupplierModel(); $modelSupplier->update($arrayUpdateSupplier, 'cdsupplier =' . $cdsupplier); $this->addMessage("Registro alterado com sucesso."); } catch (Exception $e) { $this->_model->getAdapter()->rollBack(); $this->addMessage("Erro na alteração do cadastro."); $this->addMessage($e->getMessage()); $url = '/message/error'; $this->_redirect($url); } $this->_redirect("/message/success/param_module/stock/param_controller/supply/param_action/index"); }
public function __construct() { parent::__construct(); $supplyModel = new SupplycentreModel(); //fetchaAll eesta buscando as informações no $suplyModel e enviando para o vetor $supplyDadosArray = $supplyModel->fetchAll(); $supplyCentreModel = new SupplierModel(); $supplyCentreDadosArray = $supplyCentreModel->fetchAll(); $suppliesModel = new SupplyModel(); $suppliesDadosArray = $suppliesModel->fetchAll(); /////////////// $suppliesMUModel = new MeasurementUnitModel(); $suppliesMUDadosArray = $suppliesMUModel->fetchAll(); /* >>> Nº Protocolo */ $this->_cdsupplyentryprotocol = new Zend_Form_Element_Text('cdsupplyentryprotocol'); $this->_cdsupplyentryprotocol->setDecorators($this->_decoratorsDefault); $this->_cdsupplyentryprotocol->setLabel("N° Protocolo"); $this->_cdsupplyentryprotocol->setAttrib("id", "supplyentry_cdsupplyentryprotocol"); $this->_cdsupplyentryprotocol->setAttrib("disabled", "disabled"); /* <<< */ /* >>> Código */ $this->_rowId = new Zend_Form_Element_Hidden('rowId'); $this->_rowId->setDecorators($this->_decoratorsDefault); $this->_rowId->setAttrib("id", "rowId"); /* <<< */ /* >>> Campo Oculto RowId */ $this->_cdsupplyentrycode = new Zend_Form_Element_Hidden('cdsupplyentrycode'); $this->_cdsupplyentrycode->setDecorators($this->_decoratorsDefault); $this->_cdsupplyentrycode->setAttrib("id", "supplyentry_cdsupplyentrycode"); /* <<< */ /* >>> Fornecedor * */ $this->_cdsupplyentrysupplier = new Zend_Form_Element_Select('cdsupplyentrysupplier'); ///////////////////////////// $this->_cdsupplyentrysupplier->addMultiOption("", "Selecione"); //$this->_cdsupplyentrysupplier->setRequired(true); foreach ($supplyCentreDadosArray as $supplyCentreDado) { $this->_cdsupplyentrysupplier->addMultiOption($supplyCentreDado->cdsupplier, $supplyCentreDado->nmsupplier); } $this->_cdsupplyentrysupplier->setDecorators($this->_decoratorsDefault); $this->_cdsupplyentrysupplier->setLabel("Fornecedor"); $this->_cdsupplyentrysupplier->setAttrib("id", "supply_flow_cdsupplycentreto"); ////////////////////////// $this->_cdsupplyentrysupplier->setAttrib("class", "search_combobox"); /* <<< */ /* >>> Lote * */ $this->_cdsupplyinvoice = new Zend_Form_Element_Text('cdsupplyinvoice'); $this->_cdsupplyinvoice->setDecorators($this->_decoratorsDefault); $this->_cdsupplyinvoice->setLabel("Nota Fiscal"); $this->_cdsupplyinvoice->setAttrib("id", "supplyentry_cdsupplyinvoice"); $this->_cdsupplyinvoice->setAttrib("size", "10"); /* <<< */ /* >>> Centro de Estocagem ou Consumo * */ $this->_cdsupplycentrefrom = new Zend_Form_Element_Select('cdsupplycentrefrom'); //$this->_cdsupplycentrefrom->setRequired(true); $this->_cdsupplycentrefrom->addMultiOption("", "Selecione"); foreach ($supplyDadosArray as $supplyCentreDado) { $this->_cdsupplycentrefrom->addMultiOption($supplyCentreDado->cdsupplycentre, $supplyCentreDado->idsupplycentre); } $this->_cdsupplycentrefrom->setDecorators($this->_decoratorsDefault); $this->_cdsupplycentrefrom->setLabel("Centro de Estocagem ou Consumo"); $this->_cdsupplycentrefrom->setAttrib("id", "supply_flow_cdsupplycentrefrom"); $this->_cdsupplycentrefrom->setAttrib("class", "search_combobox"); /* <<< */ /* >>> Data de Recebimento */ $this->_dtcheckout = new Zend_Form_Element_Text('dtcheckout'); $this->_dtcheckout->setLabel("Data de Recebimento"); $this->_dtcheckout->setDecorators($this->_decoratorsDefault); $this->_dtcheckout->setAttrib("id", "supply_flow_dtcheckout"); $this->_dtcheckout->setAttrib("class", "mask_date"); $this->_dtcheckout->setAttrib("class", "datepicker"); $this->_dtcheckout->setAttrib("size", "10"); /* <<< */ /* >>> Horário */ $this->_hrcheckin = new Zend_Form_Element_Text('hrcheckin'); $this->_hrcheckin->setLabel("Horário"); $this->_hrcheckin->setDecorators($this->_decoratorsDefault); $this->_hrcheckin->setAttrib("id", "supply_flow_hrcheckin"); $this->_hrcheckin->setAttrib("class", "mask_time"); $this->_hrcheckin->setAttrib("size", "10"); /* <<< */ /* >>> Item */ $this->_cdsupply = new Zend_Form_Element_Select('cdsupply'); $this->_cdsupply->addMultiOption("", "Selecione"); foreach ($suppliesDadosArray as $supplyCentreDado) { $this->_cdsupply->addMultiOption($supplyCentreDado->cdsupply, $supplyCentreDado->nmsupply); } $this->_cdsupply->setDecorators($this->_decoratorsDefault); $this->_cdsupply->setLabel("Item"); $this->_cdsupply->setAttrib("id", "supply_flow_cdsupply"); $this->_cdsupply->setAttrib("class", "search_combobox"); /* <<< */ /* >>> Quantidade */ $this->_cdsupplyqty = new Zend_Form_Element_Text('cdsupplyqty'); $this->_cdsupplyqty->setDecorators($this->_decoratorsDefault); $this->_cdsupplyqty->setLabel("Quantidade"); $this->_cdsupplyqty->setAttrib("id", "supplyentry_cdsupplyqty"); $this->_cdsupplyqty->setAttrib("size", "10"); $this->_cdsupplyqty->setAttrib("class", "mask_price_db"); /* <<< */ /* >>> Unidade Medida */ $this->_cdsupplyunit = new Zend_Form_Element_Text('cdsupplyunit'); $this->_cdsupplyunit->setDecorators($this->_decoratorsDefault); $this->_cdsupplyunit->setLabel("Unidade Medida"); $this->_cdsupplyunit->setAttrib("id", "supply_flow_cdsupplyunit"); $this->_cdsupplyunit->setAttrib("size", "10"); $this->_cdsupplyunit->setAttrib("disabled", "disabled"); /* <<< */ /* >>> Valor Unitário */ $this->_cdsupplyvalue = new Zend_Form_Element_Text('cdsupplyvalue'); $this->_cdsupplyvalue->setDecorators($this->_decoratorsDefault); $this->_cdsupplyvalue->setLabel("Valor Unit. (R\$)"); $this->_cdsupplyvalue->setAttrib("id", "supplyentry_cdsupplyvalue"); $this->_cdsupplyvalue->setAttrib("size", "10"); $this->_cdsupplyvalue->setAttrib("class", "mask_price_db"); /* <<< */ /* >>> Lote */ $this->_cdsupplylot = new Zend_Form_Element_Text('cdsupplylot'); $this->_cdsupplylot->setDecorators($this->_decoratorsDefault); $this->_cdsupplylot->setLabel("Lote"); $this->_cdsupplylot->setAttrib("id", "supplyentry_cdsupplylot"); $this->_cdsupplylot->setAttrib("size", "10"); /* <<< */ /* >>> Validade */ $this->_dtvalidity = new Zend_Form_Element_Text('dtvalidity'); $this->_dtvalidity->setLabel("Validade"); $this->_dtvalidity->setDecorators($this->_decoratorsDefault); $this->_dtvalidity->setAttrib("id", "supply_flow_dtvalidity"); $this->_dtvalidity->setAttrib("class", "mask_date"); $this->_dtvalidity->setAttrib("class", "datepicker"); /* <<< */ $this->_btadd = new Zend_Form_Element_Button('btadd'); $this->_btadd->setLabel("Adicionar"); $this->_btadd->setDecorators(array(array('ViewHelper'), array('HtmlTag', array('tag' => 'li')))); $this->_btadd->setAttrib("class", "submit_button"); }
public function dadosservicesAction() { $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"); $cdequipment = $this->_request->getParam("cdequipment"); $servicesModel = new ServiceModel(); $supplierModel = new SupplierModel(); /* DADOS DOS PARÂMETROS */ $servicesEquip = $servicesModel->getServices($cdequipment); $count = count($servicesEquip); if ($count > 0 && $limit != 0) { $total_pages = ceil($count / $limit); } else { $total_pages = 0; } if ($page > $total_pages) { $page = $total_pages; } $response = new stdClass(); $response->page = $page; $response->total = $total_pages; $response->records = $count; $i = 0; foreach ($servicesEquip as $row) { if ($row->fgservicetype == '1') { $nmservicetype = "Calibração"; } else { $nmservicetype = "Manutenção"; } $value = new Zend_Date($row->dtservice, 'YYYY-MM-dd HH:mm:ss'); $value = $value->toString('dd-MM-YYYY'); /* DADOS DOS FORNECEDORES */ $servicesSupplier = $supplierModel->getSupplierByCd($row->cdsupplier); $response->rows[$i]['cell'] = array($row->cdservice, $row->cdsupplier, $row->fgservicetype, $servicesSupplier->nmsupplier, $nmservicetype, $value); $i++; } $this->view->dadosservices = $response; }
public function dadosAction() { $modelsupplierModel = new SupplierModel(); $getAllSupplierData = $modelSupplierModel->fetchAll($modelSupplierModel->getAllSupplierGrid()); $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"); $supplyModel = new SupplierModel(); $supplysuplierModel = new SupplysupplierModel(); $supplysuplier = $supplysuplierModel->fetchAll(); if (isset($supplyModel) && $supplyModel != '') { $supply = $supplyModel->fetchAll(); $count = count($supply); if ($count > 0) { $total_pages = $count; } else { $total_pages = 0; } $responce = new stdClass(); $responce->page = $page; $responce->records = $count; } else { $agenda = $agendaModel->fetchAll(); $count = count($agenda); if ($count > 0 && $limit > 0) { $total_pages = ceil($count / $limit); } else { $total_pages = 0; } if ($page > $total_pages) { $page = $total_pages; } $supply = $supplyModel->fetchAll(); $responce = new stdClass(); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; } $i = 0; $itens = 0; foreach ($supply as $row) { foreach ($supplysuplier as $line) { if ($line['cdsupplier'] == $row->cdsupplier) { $itens++; } } if ($row->fgactive == 1) { $fgactive = 'Ativo'; } else { if ($row->fgactive == 2) { $fgactive = 'Inativo'; } } $responce->rows[$i]['id'] = $row->cdsupplier; $responce->rows[$i]['cell'] = array($row->nmfantasyname, $row->nmsupplier, $row->idcnpj, $row->idcity, $row->idstate, $row->nrdddphone . $row->nrphone, $itens, $fgactive); $i++; $itens = 0; } $this->view->dados = $responce; }
public function autosearchsupplierAction() { $supply = $_POST["queryString"]; $supplierModel = new SupplierModel(); $supplierData = $supplierModel->fetchAll('nmsupplier like "%' . $supply . '%"'); echo "<ul id='sug2'>"; foreach ($supplierData as $row) { echo '<li onClick="fill2(\'' . $row->cdsupplier . '\', \'' . $row->nmsupplier . '\');"><a href="javascript:void(0);">' . $row->nmsupplier . '</a></li>'; } echo "</ul>"; }
public function __construct() { parent::__construct(); $measurementunitModel = new MeasurementunitModel(); $measurementunitDadosArray = $measurementunitModel->fetchAll(); $supplycentreModel = new SupplycentreModel(); $supplycentreDadosArray = $supplycentreModel->fetchAll(); $supplierModel = new SupplierModel(); $supplierDadosArray = $supplierModel->fetchAll(); $supplyModel = new SupplyModel(); $supplyDados = $supplyModel->fetchAll($supplyModel->getSupplyNotInMedicine()); //Cód. medicamento $this->_idmedicine = new Zend_Form_Element_Text('idmedicine'); $this->_idmedicine->setLabel("Cód. Medicamento"); $this->_idmedicine->setDecorators($this->_decoratorsRequired); $this->_idmedicine->setAttrib("size", "11"); $this->_idmedicine->setRequired(true); //Nome/Descrição do Medicamento $this->_nmmedicine = new Zend_Form_Element_Text('nmmedicine'); $this->_nmmedicine->setLabel("Nome/Descrição do Medicamento"); $this->_nmmedicine->setDecorators($this->_decoratorsRequired); $this->_nmmedicine->setAttrib("id", "nmcenter"); $this->_nmmedicine->setAttrib("size", "35"); $this->_nmmedicine->setRequired(true); //Princípio Ativo $this->_nmactive = new Zend_Form_Element_text('nmactive'); $this->_nmactive->setLabel("Princípio Ativo"); $this->_nmactive->setDecorators($this->_decoratorsDefault); $this->_nmactive->setAttrib("size", "35"); //Unidade de Medida $this->_cdmeasurementunit = new Zend_Form_Element_select('cdmeasurementunit'); $this->_cdmeasurementunit->addMultiOption("", "Selecione"); foreach ($measurementunitDadosArray as $measurementunitDado) { $this->_cdmeasurementunit->addMultiOption($measurementunitDado->cdmeasurementunit, $measurementunitDado->idnotation); } $this->_cdmeasurementunit->setLabel("Unidade de Medida"); $this->_cdmeasurementunit->setDecorators($this->_decoratorsRequired); $this->_cdmeasurementunit->setAttrib("class", "search_combobox"); $this->_cdmeasurementunit->setRequired(true); //Item do Estoque $this->_cdsupplymedicine = new Zend_Form_Element_select('cdsupply'); $this->_cdsupplymedicine->addMultiOption("", "Selecione"); foreach ($supplyDados as $supply) { $this->_cdsupplymedicine->addMultiOption($supply->cdsupply, $supply->nmsupply); } $this->_cdsupplymedicine->setLabel("Item"); $this->_cdsupplymedicine->setDecorators($this->_decoratorsDefault); $this->_cdsupplymedicine->setAttrib("id", "cdsupplymedicine"); $this->_cdsupplymedicine->setAttrib("class", "search_combobox"); //Quantidade do Item $this->_nrsupplyquantity = new Zend_Form_Element_text('nrsupplyquantity'); $this->_nrsupplyquantity->setLabel("Quantidade"); $this->_nrsupplyquantity->setDecorators($this->_decoratorsDefault); $this->_nrsupplyquantity->setAttrib("size", "10"); $this->_nrsupplyquantity->setAttrib("disabled", "disabled"); $this->_nrsupplyquantity->setAttrib("class", "numeric"); //Valor da unidade $this->_vlsupplyunit = new Zend_Form_Element_text('vlsupplyunit'); $this->_vlsupplyunit->setLabel("Valor Unit."); $this->_vlsupplyunit->setDecorators($this->_decoratorsDefault); $this->_vlsupplyunit->setAttrib("size", "10"); $this->_vlsupplyunit->setAttrib("disabled", "disabled"); $this->_vlsupplyunit->setAttrib("class", "mask_price"); $this->_cdsupplycentre = new Zend_Form_Element_select('cdsupplycentre'); $this->_cdsupplycentre->addMultiOption("", "Selecione"); foreach ($supplycentreDadosArray as $supplycentre) { $this->_cdsupplycentre->addMultiOption($supplycentre->cdsupplycentre, $supplycentre->idsupplycentre); } $this->_cdsupplycentre->setLabel("Centro"); $this->_cdsupplycentre->setDecorators($this->_decoratorsRequired); $this->_cdsupplycentre->setAttrib("class", "search_combobox"); $this->_cdsupplier = new Zend_Form_Element_select('cdsupplier'); $this->_cdsupplier->addMultiOption("", "Selecione"); foreach ($supplierDadosArray as $supplier) { $this->_cdsupplier->addMultiOption($supplier->cdsupplier, $supplier->nmsupplier); } $this->_cdsupplier->setLabel("Fornecedor"); $this->_cdsupplier->setDecorators($this->_decoratorsRequired); $this->_cdsupplier->setAttrib("class", "search_combobox"); }