printLabelsLocator = ServiceContainer::getService(\KupShop\AdminBundle\AdminRegister\ProductsPrintLabelsLocator::class); $pageVars['now'] = getVal('now'); $pageVars['type'] = getVal('type', null, 'order'); $pageVars['IDo'] = getVal('IDo'); $pageVars['ID'] = getVal('ID', null, 0); $pageVars['IDv'] = getVal('IDv', null, 0); $pageVars['barcode_by_select'] = [ 'ean' => 'EANu, když není tak kódu', 'code' => 'kódu, když není tak EANu', 'id_product' => 'ID produktu', ]; $pageVars['set'] = getVal('set', null, ''); $pageVars['ID_text'] = getVal('ID_text', null, ''); $pageVars['template_type'] = getVal('template_type', null, getVal('print_label_default', $_COOKIE, 'Etiketa 45x45mm')); if ($pageVars['template_type'] == 'zebra') { $pageVars['template_type'] = findModule(Modules::CHECK_APP, Modules::SUB_ZEBRA_TEMPLATE_TYPE, 'Etiketa 45x45mm'); } elseif ($pageVars['template_type'] == 'serialNumber') { $pageVars['template_type'] = 'Sériové číslo'; } elseif ($pageVars['template_type'] == 'zebra_positions') { $pageVars['template_type'] = 'Etiketa 68x38mm'; } setCookies('print_label_default', $pageVars['template_type']); $pageVars['by'] = getVal('by', null, 'ean'); $pageVars['pcs'] = getVal('pcs', null, 1); $pageVars['change_start'] = getVal('change_start', null, 0); $pageVars['barcode_by'] = getVal('barcode_by', null, getVal('by', null, 'ean')); $pageVars['show_text_barcode'] = getVal('show_text_barcode'); $pageVars['json'] = getVal('json', null, getVal('JSON_IDs')); switch ($pageVars['type']) { case 'order': case 'orderPicking': $order = new Order($pageVars['ID']); $order->createFromDB($pageVars['ID']); $vars['order'] = $order; break; case 'orders': if (getVal('orders')) { $orderList = ServiceContainer::getService(\KupShop\OrderingBundle\OrderList\OrderList::class); $orderList->andSpec(function ($qb) { $qb->andWhere(\Query\Operator::inIntArray(getVal('orders'), 'o.id')); })->fetchItems(); $pageVars['orders'] = $orderList->getOrders(); } break; case 'product': break; case 'warehouse_positions': $vars['warehouse_positions'] = ['location' => getVal('location'), 'positions' => getVal('positions')]; $pageVars['template_type'] = getVal('template_type', default: 'WarehousePositions'); $pageVars['arrows'] = getVal('arrows'); $pageVars['barcode_position'] = getVal('barcode_position'); $this->printLabelsLocator = ServiceContainer::getService(\KupShop\AdminBundle\AdminRegister\WarehousePositionsPrintLabelsLocator::class); break; default: throw new Exception('Type is not defined!'); } $this->pageVars = $pageVars; $vars['body'] = $pageVars; return $vars; } public static function prepisSlovne($number) { $word[0] = ''; $word[1] = 'jedna'; $word[2] = 'dva'; $word[3] = 'tři'; $word[4] = 'čtyři'; $word[5] = 'pět'; $word[6] = 'šest'; $word[7] = 'sedm'; $word[8] = 'osm'; $word[9] = 'devět'; $word[10] = 'deset'; $word[11] = 'jedenáct'; $word[12] = 'dvanáct'; $word[13] = 'třináct'; $word[14] = 'čtrnáct'; $word[15] = 'patnáct'; $word[16] = 'šestnáct'; $word[17] = 'sedmnáct'; $word[18] = 'osmnáct'; $word[19] = 'devatenáct'; $word[20] = 'dvacet'; $word[30] = 'třicet'; $word[40] = 'čtyřicet'; $word[50] = 'padesát'; $word[60] = 'šedesát'; $word[70] = 'sedmdesát'; $word[80] = 'osmdesát'; $word[90] = 'devadesát'; $word[100] = 'sto'; $word[200] = 'dvěstě'; $word[300] = 'třista'; $word[400] = 'čtyřista'; $word[500] = 'pětset'; $word[600] = 'šestset'; $word[700] = 'sedmset'; $word[800] = 'osmset'; $word[900] = 'devětset'; $word[1000] = 'jedentisíc'; $word[2000] = 'dvatisíce'; $word[3000] = 'třitisíce'; $word[4000] = 'čtyřitisíce'; $number = substr('0000000000'.$number, -10); // spravne rozdelit cislo na casti $part['stotisice'] = (intval(substr($number, -6, 1)) * 100); $part['desetitisice'] = (intval(substr($number, -5, 1)) * 10); $part['tisice'] = (intval(substr($number, -4, 1)) * 1); $part['stovky'] = (intval(substr($number, -3, 1)) * 100); $part['desitky'] = (intval(substr($number, -2, 1)) * 10); $part['jednotky'] = intval(substr($number, -1, 1)); // -------------------------------------------------------------- // spojeni do slov $join = []; // echo "\t\t\tdesetitisice - ".$part['desetitisice'] . "\n"; // stovky tisic if ($part['stotisice'] > 0) { $join[] = $word[$part['stotisice']]; } // desetitisice if ($part['desetitisice'] == 10) { if ($part['tisice'] >= 1 && $part['tisice'] <= 9) { $join[] = $word[$part['desetitisice'] + $part['tisice']]; } else { $join[] = $word[$part['desetitisice']]; } $join[] = 'tisíc'; } else { if ($part['desetitisice'] > 0) { $join[] = $word[$part['desetitisice']]; if ($part['tisice'] == 0) { $join[] = 'tisíc'; } } if ($part['tisice'] > 0) { if (isset($word[$part['tisice'].'000'])) { $join[] = $word[$part['tisice'].'000']; } else { $join[] = $word[$part['tisice']]; $join[] = 'tisíc'; } } } // stovky if ($part['stovky'] > 0) { $join[] = $word[$part['stovky']]; } // posledni 2 cisla if ($part['desitky'] == 10 && $part['jednotky'] >= 1 && $part['jednotky'] <= 9) { $join[] = $word[$part['desitky'] + $part['jednotky']]; } else { if ($part['desitky'] > 0) { $join[] = $word[$part['desitky']]; } if ($part['jednotky'] > 0) { $join[] = $word[$part['jednotky']]; } } $str = implode('', $join); // print_r($join); return $str; } public function getPrint() { global $cfg; $type = $TYPE = getVal('type', null, 'order'); // U produktu staci jen type, tak aby se to propsalo i do set a vse fungovalo dal $set = $SET = getVal('set', null, $type); $ID = $ID_ITEM = getVal('ID', null, 0); $orderPrintAllowed = findRight('ORDER') || ($set === 'POS' && findRight('POS')); if ($type === 'order' && !$orderPrintAllowed) { redirect('launch.php?s=error.php&id=1'); } // Directly send output to allow streaming while (ob_get_level()) { ob_end_flush(); } if ($ID_ITEM) { $items[] = $ID_ITEM; } switch ($type) { case 'product': include 'printCenter/printCenter.Product.php'; (new PrintCenterProducts($this->pageVars))->run(); break; case 'orders': include 'printCenter/printCenter.Orders.php'; (new printCenterOrders($this->pageVars))->run(); break; case 'warehouse_positions': include 'printCenter/printCenter.warehouse_positions.php'; (new PrintCenterWarehousePositions($this->pageVars))->run(); break; case 'order':// html invoices $items = getVal('orders', null, getVal('IDs', null, [getVal('ID')])); foreach ($items as $ID_ITEM) { include 'printCenter/printCenter.'.$SET.'.php'; } break; case 'orderPicking': global $ctrl; $ctrl_admin = $ctrl['admin']; $ctrl['admin'] = false; $pickingTemplate = true; $items = getVal('orders', null, getVal('IDs', null, [getVal('ID')])); foreach ($items as $ID_ITEM) { include 'printCenter/printCenter.'.$SET.'.php'; } $ctrl['admin'] = $ctrl_admin; break; default: include 'printCenter/printCenter.'.$set.'.php'; } } }