| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?php
- include("session_check.php");
- include("header.php");
- include("menu.php");
- require_once("util.php");
- require_once("DataBase/Product.php");
- require_once("DataBase/Customer.php");
- require_once("DataBase/Price.php");
- require_once("DataBase/Priceset.php");
- /* TODO: check if valid $priceset_id and what if no $customer_data found? */
- $customer = new Customer();
- $customer_data = $customer->get($_SESSION["username"]);
- $priceset_id = 0;
- if(count($customer_data) > 0)
- $priceset_id = $customer_data[0][11];
- $priceset = new Priceset();
- $product= new Product();
- $price = new Price();
- $tmp_priceset = $priceset->get($priceset_id);
- $netto = 0;
- if(count($tmp_priceset) > 0)
- $netto = $tmp_priceset[0][2];
- ?>
- <div width="100%" align="center">
- <?php
- // prepare search/filter params
- $search_product = var_get_post("search_product", "");
- $search_category = var_get_post("search_category", "");
- $item_offset = var_get_post("item_offset", 0);
- $item_count = var_get_post("item_count", 40);
- if($search_category != "")
- {
- require_once("DataBase/Category.php");
- $category= new Category();
- $tmp = $category->get($search_category);
- if(count($tmp) > 0)
- {
- echo "<small>Kategorie:</small> ".$tmp[0][1]."";
- }
- }
- ?>
- <table border="0" width="80%">
- <tr class="table_header">
- <td>ProduktNr.</td>
- <td>Bezeichnung</td>
- <td>Anmerkung</td>
- <td>Preis</td>
- </tr>
- <?php
- $list = $product->getByFilter($search_product, $search_category, $item_offset, $item_count, True /* available */);
- $count = $product->getCountByFilter($search_product, $search_category);
- for($i = 0; $i < count($list); $i++)
- {
- if($list[$i][0] == "")
- continue;
- echo "\t<tr class=\"list_normal\" onclick=\"javascript: window.location.href = 'product_details.php?product_id=".$list[$i][0]."';\" onmouseover=\"javascript: this.className='list_hover';\" onmouseout=\"javascript: this.className='list_normal';\">\n";
- echo "\t\t<td>".$list[$i][0]."</td>\n";
- echo "\t\t<td>".$list[$i][1]."</td>\n";
- echo "\t\t<td>".$list[$i][2]."</td>\n";
- echo "\t\t<td align=\"right\">".number_format($price->getPriceTax($priceset_id, $list[$i][0], $netto, $list[$i][4]), 2)."</td>\n";
- echo "\t</tr></a>\n";
- }
- ?>
- </table>
- </div>
- <div width="90%" align="right">
- <?php
- if($item_offset != 0)
- echo "<a href=\"product_list.php?search_product=".$search_product."&search_category=".$search_category."&item_offset=".($item_offset-$item_count)."&item_count=".$item_count."\">zurück</a> ";
- $page_count = $count[0][0]/$item_count;
- $start = ($item_offset/$item_count) - 2;
- if($start < 0)
- $start = 0;
- for($i = $start; $i < $start+5; $i++)
- {
- if($i * $item_count > $count[0][0])
- break;
- if($item_offset == $i * $item_count)
- echo " ".$i;
- else
- echo " <a href=\"product_list.php?search_product=".$search_product."&search_category=".$search_category."&item_offset=".($i*$item_count)."&item_count=".$item_count."\">".$i."</a>";
- }
- if($item_offset < $count[0][0]-$item_count)
- echo " <a href=\"product_list.php?search_product=".$search_product."&search_category=".$search_category."&item_offset=".($item_offset+$item_count)."&item_count=".$item_count."\">vor</a>";
- ?>
- </div>
- <?php
- include("footer.php");
- ?>
|