public function printAction() { // desabilitando layout $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); if ($this->getRequest()->isPost()) { $arrDigitais = $this->getRequest()->getParam('nuEtiquetas', array()); $arrDigitaisPrint = array(); $arrDigitaisValidate = array(); $withNUP = false; foreach ($arrDigitais as $key => $value) { $aux1 = explode(' - ', $value); $arrDigitaisValidate[$key] = trim($aux1[0]); if (count($aux1) > 1) { if ($withNUP === false) { $withNUP = true; } $arrDigitaisPrint[$key] = array('nuEtiqueta' => $arrDigitaisValidate[$key], 'nuNupSiorg' => preg_replace('/\\D+/', '', $aux1[1])); } else { $arrDigitaisPrint[$key]['nuEtiqueta'] = $arrDigitaisValidate[$key]; } } if ($this->getService()->isValidNuEtiqueta($arrDigitaisValidate)) { $etiquetaPdf = new Sgdoce_EtiquetaPdf(); $textoEtiquetaKey = 'textoEtiqueta'; if ($withNUP) { $textoEtiquetaKey = 'textoEtiquetaComNup'; } $textoEtiqueta = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption($textoEtiquetaKey); $etiquetaPdf->setTextoEtiqueta($textoEtiqueta)->setDigitais($arrDigitaisPrint)->setEtiquetaComNUP($withNUP)->generate(); } } echo "Número da digital inválida."; }
public function printAction() { // desabilitando layout $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $etiquetaPdf = new Sgdoce_EtiquetaPdf(); $sqLoteEtiqueta = $this->getRequest()->getPost('lote'); $dto = Core_Dto::factoryFromData(array('sqLoteEtiqueta' => $sqLoteEtiqueta), 'search'); $entityLote = $this->getService('LoteEtiqueta')->find($sqLoteEtiqueta); $arrDigitais = $this->getService()->listEtiquetaImprimir($dto); $textoEtiquetaKey = 'textoEtiqueta'; $etiquetaPdf->setEtiquetaComNUP($entityLote->getInLoteComNupSiorg()); if ($entityLote->getInLoteComNupSiorg()) { $textoEtiquetaKey = 'textoEtiquetaComNup'; } $textoEtiqueta = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption($textoEtiquetaKey); if ($arrDigitais) { $this->getService('LoteEtiqueta')->saveUserPrintedDigital($sqLoteEtiqueta, \Core_Integration_Sica_User::getUserId()); } $etiquetaPdf->setTextoEtiqueta($textoEtiqueta)->setDigitais($arrDigitais)->generate(); }