function draw() { global $display; $arrVar = array(); $this->beginForm(1); $options = ""; EClassApi::getCats(); $where = ''; $group_id = Url::get('group_id', ''); $group_name = Url::get('group_name', ''); if ($group_id) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " id = '{$group_id}' "; $arrVar['group_id'] = $group_id; } if ($group_name) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " name = '{$group_name}' "; $arrVar['group_name'] = $group_name; } $item_per_page = 50; $limit = ''; $sql_count = "SELECT COUNT(*) AS total FROM products_extra_fields_group {$where}"; $total = DB::fetch($sql_count, 'total', 0); if ($total) { require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Nhóm trường', 'Trang'); $re = DB::query("SELECT * FROM products_extra_fields_group {$where} order by id desc {$limit}"); if ($re) { while ($row = mysql_fetch_assoc($re)) { $products_extra_fields_group[$row['id']] = $row; } } } $categories = eb_memcache::do_get('categories_new'); if (!is_array($categories)) { //if($total){ require_once ROOT_PATH . 'core/ECPagging.php'; $re = DB::query("SELECT * FROM products_category order by orders"); if ($re) { while ($row = mysql_fetch_assoc($re)) { $categories[$row['parent_id']][$row['id']] = $row; } } eb_memcache::do_put('categories_new', $categories); } print_category($categories, 0, $options); //} $arrVar['options'] = $options; $arrVar['zones'] = CGlobal::$allZones; $arrVar['paging'] = $paging; $arrVar['products_extra_fields_group'] = $products_extra_fields_group; $display->templateAdvance = TRUE; $display->setTemplate('ManageFilterAdd', $arrVar); $this->endForm(); }
function print_category($iteration, $parent, $i) { $i++; global $rowxls, $objPHPExcel; echo 'row xls ' . $rowxls . '<br/>'; if ($iteration != null) { if (is_array($iteration[$parent])) { foreach ($iteration[$parent] as $iteration_) { print_r($iteration_); $sales_detail = find_sales($iteration_['id']); //print_r($sales_detail); if ($sales_detail['quantity'] > 0) { $rowxls++; $objPHPExcel->getActiveSheet()->SetCellValue('A' . $rowxls, ''); $objPHPExcel->getActiveSheet()->SetCellValue('B' . $rowxls, ucfirst($iteration_['name'])); $objPHPExcel->getActiveSheet()->SetCellValue('C' . $rowxls, $sales_detail['quantity']); $objPHPExcel->getActiveSheet()->SetCellValue('D' . $rowxls, ''); $objPHPExcel->getActiveSheet()->SetCellValue('E' . $rowxls, number_format($sales_detail['subtotal'], 0, ',', '.')); if ($iteration[$iteration_['id']] == null) { $sales_items = find_sales_items($iteration_['id']); $row = 1; foreach ($sales_items as $sales_item) { $rowxls++; $objPHPExcel->getActiveSheet()->SetCellValue('A' . $rowxls, $sales_item['type_code']); $objPHPExcel->getActiveSheet()->SetCellValue('B' . $rowxls, $sales_item['product_name'] . ' / ' . $sales_item["type_name"] . ' / ' . $sales_item["stock_name"]); $objPHPExcel->getActiveSheet()->SetCellValue('C' . $rowxls, $sales_item['quantity']); $objPHPExcel->getActiveSheet()->SetCellValue('D' . $rowxls, number_format($sales_item['type_price'], 0, ',', '.')); $objPHPExcel->getActiveSheet()->SetCellValue('E' . $rowxls, number_format($sales_item['subtotal'], 0, ',', '.')); $row++; } } } print_category($iteration, $iteration_['id'], $i); } } //isarray } else { $sales_items = find_sales_items($parent); $row = 1; foreach ($sales_items as $sales_item) { $rowxls++; $objPHPExcel->getActiveSheet()->SetCellValue('A' . $rowxls, $sales_item['type_code']); $objPHPExcel->getActiveSheet()->SetCellValue('B' . $rowxls, $sales_item['product_name'] . ' / ' . $sales_item["type_name"] . ' / ' . $sales_item["stock_name"]); $objPHPExcel->getActiveSheet()->SetCellValue('C' . $rowxls, $sales_item['quantity']); $objPHPExcel->getActiveSheet()->SetCellValue('D' . $rowxls, number_format($sales_item['type_price'], 0, ',', '.')); $objPHPExcel->getActiveSheet()->SetCellValue('E' . $rowxls, number_format($sales_item['subtotal'], 0, ',', '.')); $row++; } } }
function print_category(&$categories, $parent_id, &$options, &$zone_id, &$cate_id) { $sub_categories = ""; if (isset($categories[$parent_id])) { $sub_categories = $categories[$parent_id]; } if (is_array($sub_categories)) { foreach ($sub_categories as $key => $val) { if ($val['published'] == 1) { $options .= "<option value='{$key}'"; if ($key == $cate_id) { $options .= "selected='selected'"; } $options .= ">"; for ($i = 1; $i < $val['level']; $i++) { $options .= '-- '; } $options .= "{$val['name']}</option>"; //print_r($sub_categories); exit; print_category($categories, $val['id'], $options, $zone_id, $cate_id); } } } }
foreach (savings_operations($logged_user) as $o) { ?> <tr> <td style="text-align:center;"><?php echo date("d-m-Y", strtotime($o['when_created'])); ?> </td> <td style="text-align:right; padding-right:20px;"> <?php echo '<span class="red">-' . number_format($o["amount"], $decimals = 2, $dec_point = ".", $thousands_sep = "") . ' PLN</span>'; ?> </td> <td style="padding-left:20px;"> <?php if ($o['category_id']) { echo print_category($o['category_id']); } else { echo "<em>?</em>"; } ?> </td> <td style="text-align:center;"> <a class="confirm" href="user_panel/delete_savings_operation.php?id=<?php echo $o['id']; ?> "> <img src="images/delete-icon.png" /> </a> </td> </tr> <?php
function recursive($elems, $tree, $data, $level) { foreach ($elems as $item) { if (isset($tree[$item])) { $elem = split(",", $tree[$item]); for ($i=$level; $i>0; $i--) echo '<blockquote>'; print_category($item, $data[$item]->category_parent, $data[$item]->category_name, $data[$item]->category_feed, $data[$item]->tags); for ($i=$level; $i>0; $i--) echo '</blockquote>'; recursive($elem, $tree, $data, $level+1) . "\n"; } else { for ($i=$level; $i>0; $i--) echo '<blockquote>'; print_category($item, $data[$item]->category_parent, $data[$item]->category_name, $data[$item]->category_feed, $data[$item]->tags); for ($i=$level; $i>0; $i--) echo '</blockquote>'; } } }
function draw() { global $display; $arrVar = array(); $this->beginForm(); EClassApi::getCats(); $where = ''; $filter_id = Url::get('filter_id', ''); $filter_name = Url::get('filter_name', ''); $cat_product_id = Url::get('cat_product_id', ''); $zone_id = Url::get('zone_id', ''); $arrVar['zone_id'] = $zone_id; $arrVar['cat_product_id'] = $cat_product_id; if ($filter_id) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " id = '{$filter_id}' "; $arrVar['filter_id'] = $filter_id; } if ($filter_name) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " filter_name = '{$filter_name}' "; $arrVar['filter_name'] = $filter_name; } if ($cat_product_id) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " cat_product_id = '{$cat_product_id}' "; } else { if ($zone_id) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " zone_id = '{$zone_id}' "; } } $item_per_page = 50; $limit = ''; $item_vips = array(); $sql_count = "SELECT COUNT(*) AS total FROM products_filter {$where} "; $total = DB::fetch($sql_count, 'total', 0); $paging = ''; $filters = array(); if ($total) { require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 20, 'page_no', true); $re = DB::query("SELECT * FROM products_filter {$where} order by orders {$limit}"); if ($re) { while ($row = mysql_fetch_assoc($re)) { $filters[$row['id']] = $row; } } } $categories = eb_memcache::do_get('categories_new'); if (!is_array($categories)) { //if($total){ require_once ROOT_PATH . 'core/ECPagging.php'; $re = DB::query("SELECT * FROM products_category order by orders"); if ($re) { while ($row = mysql_fetch_assoc($re)) { $categories[$row['parent_id']][$row['id']] = $row; } } eb_memcache::do_put('categories_new', $categories); } print_category($categories, 0, $options, $zone_id, $cat_product_id); $arrVar['options'] = $options; $arrVar['zones'] = CGlobal::$allZones; $arrVar['filters'] = $filters; $arrVar['paging'] = $paging; $display->templateAdvance = TRUE; $display->setTemplate('ManageFilter', $arrVar); $this->endForm(); }
} else { bill_reset_confirm(); } break; case 'print_orders': $err = print_orders($_SESSION['sourceid']); status_report('ORDERS_PRINT', $err); if (!$err) { orders_list(); } else { printing_choose(); } break; case 'print_category': $category = (int) $start_data['category']; $err = print_category($category); status_report('CATEGORY_PRINT', $err); if (!$err) { orders_list(); } else { printing_choose(); } break; case 'printing_choose': printing_choose(); break; case 'reopen_confirm': table_reopen_confirm(); break; case 'reopen': $err = table_reopen($_SESSION['sourceid']);
function draw() { global $display; $arrVar = array(); $this->beginForm(1); $arrVar['id'] = Url::get('id', 0); $options = ""; if ($arrVar['id'] == 0) { Url::redirect_current(); } EClassApi::getCats(); $where = ''; $filter = DB::fetch_all_array("select * from products_filter where id={$arrVar['id']}"); $filte_value = json_decode($filter[0]['filter_value']); $arrVar['filter'] = $filter[0]; $arrVar['filter_value'] = $filte_value; $item_per_page = 50; $limit = ''; $sql_count = "SELECT COUNT(*) AS total FROM products_extra_fields_group {$where}"; $total = DB::fetch($sql_count, 'total', 0); if ($total) { require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Nhóm trường', 'Trang'); $re = DB::query("SELECT * FROM products_extra_fields_group {$where} order by id desc {$limit}"); if ($re) { while ($row = mysql_fetch_assoc($re)) { $products_extra_fields_group[$row['id']] = $row; } } } $filter_count = 0; foreach ($filte_value as $key => $val) { if ($filter_count < $val->order) { $filter_count = $val->order; } } if (count($filte_value) > $filter_count) { $filter_count = count($filte_value); } $categories = eb_memcache::do_get('categories_new'); if (!is_array($categories)) { //if($total){ require_once ROOT_PATH . 'core/ECPagging.php'; $re = DB::query("SELECT * FROM products_category order by orders"); if ($re) { while ($row = mysql_fetch_assoc($re)) { $categories[$row['parent_id']][$row['id']] = $row; } } eb_memcache::do_put('categories_new', $categories); } print_category($categories, 0, $options, $filter[0]['zone_id'], $filter[0]['cat_product_id']); $arrVar['options'] = $options; $arrVar['filter_count'] = $filter_count; $arrVar['zones'] = CGlobal::$allZones; $arrVar['paging'] = $paging; $arrVar['products_extra_fields_group'] = $products_extra_fields_group; $display->templateAdvance = TRUE; $display->setTemplate('ManageFilterEdit', $arrVar); $this->endForm(); }