<?php $categories = Category::selection(array('@order' => 'name', 'category_id:!=' => 0)); ?> <h1>Prislista</h1> <? foreach($categories as $category): ?> <? if($category->Product == array()) continue; ?> <h3><?php echo $category->name; ?> </h3> <table> <thead> <tr> <th>Namn</th> <th>Pris</th> </tr> </thead> <? if(($products = $category->Product(array('count:>' => 0, '@order' => 'name'))) != array()): ?> <tbody> <? foreach($products as $product): ?> <tr> <td><?php echo $product->name; ?> </td> <td><?php echo $product->price; ?> </td> </tr>
<?php if (empty($_SESSION['login'])) { kick('login?kickback=' . htmlspecialchars(kickback_url())); } $categories = Category::selection(array('category_id:!=' => 0)); $products = Product::selection(array('category_id:!=' => 0)); $old_values = ClientData::session('_POST'); unset($_SESSION['_POST']); ?> <script type="text/javascript"> <!-- function addLine() { var hidden=document.getElementById("template"); var element = hidden.previousSibling; while(!String(element).match('HTMLTableRowElement')) { element = element.previousSibling; } var last_element_inputs = element.getElementsByTagName('input'); for(i=0; i<last_element_inputs.length; i++) { if(last_element_inputs[i].value != '') { var new_line=hidden.cloneNode(true); new_line.removeAttribute('style'); new_line.removeAttribute('id'); hidden.parentNode.insertBefore(new_line, hidden); return; } } } var products = new Array(); <? foreach($products as $product): ?>
<th class="sales_value"><a href="#" onclick="sort.sort(<?php echo $i++; ?> );return false">sålt 30 dag</a></th> <th class="sales_revenue"><a href="#" onclick="sort.sort(<?php echo $i++; ?> );return false">vinst 30 dag</a></th> <th class="revenue_p"><a href="#" onclick="sort.sort(<?php echo $i++; ?> );return false">vinst %</a></th> </tr> </thead> <tbody> <? foreach(Category::selection(array('@order' => 'name')) as $category): ?> <tr> <td><a href="/edit_category/<?php echo $category->id; ?> "><img src="/gfx/edit.png" alt="edit" /></a></td> <td class="name_column"><a href="/category/<?php echo $category->id; ?> "><?php echo $category->name; ?> </a></td> <td class="numeric total_value_column"><?php echo number(Product::sum(array('value', '*', 'count'), array('category_id' => $category->id))); ?>
<p class="error"><?php echo $error; ?> </p> <? endforeach ?> <ul class="menu"> <li><a href="/retail">Handla</a></li> <li><a href="/price_list">Prislista</a></li> <? if(!empty($_SESSION['login'])): ?> <li class="dir"> <a href="/stock">Lager</a> <ul> <li class="dir"> <a href="/list_categories">Kategorier</a> <ul> <? foreach(Category::selection() as $category): ?> <li><a href="/category/<?php echo $category->id; ?> "><?php echo $category; ?> </a></li> <? endforeach ?> </ul> </li> <li><a href="/delivery">Ny leverans</a></li> <li><a href="/list_deliveries">Leveranser</a></li> <li><a href="/correct_product">Inventering</a></li> </ul> </li>
<?php if (empty($_SESSION['login'])) { kick('login?kickback=' . htmlspecialchars(kickback_url())); } $product = Product::from_id(array_shift($request)); if (!$product) { die('unknown product'); } $categories = Category::selection(); $packages = ProductPackage::selection(array('package' => $product->id)); ?> <form action="/scripts/edit_product.php" method="post"> <table> <tr> <th>Namn<input type="hidden" name="product" value="<?php echo $product->id; ?> " /></th> <td><input type="text" name="name" value="<?php echo $product->name; ?> " /></td> </tr> <tr> <th>Status</th> <td> <select name="active"> <option value="0" <?php echo $product->active ? '' : 'selected="selected"'; ?>