isLoggedIn())
{
header ("location: ../login.php");
exit();
}
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
$display->displayTitle("$lang->manageItems");
$f1=new form('manage_items.php','POST','items','400',$cfg_theme,$lang);
$f1->createInputField("$lang->searchForItemBy",'text','search','','24','150');
$option_values2=array('item_name','item_number','id','quantity','supplier_catalogue_number');
$option_titles2=array("$lang->itemName","$lang->itemNumber",'ID',"$lang->quantityStock","$lang->supplierCatalogue");
$f1->createSelectField("$lang->searchBy",'searching_by',$option_values2,$option_titles2,100);
$f1->endForm();
echo "$lang->showOutOfStock
";
echo "$lang->showReorder";
$tableheaders=array("$lang->rowID","$lang->itemName","$lang->itemNumber","$lang->description","$lang->brand","$lang->category","$lang->supplier","$lang->buyingPrice","$lang->sellingPrice","$lang->tax $lang->percent","$lang->finalSellingPricePerUnit","$lang->quantityStock","$lang->reorderLevel","$lang->supplierCatalogue","$lang->updateItem","$lang->deleteItem");
$tablefields=array('id','item_name','item_number','description','brand_id','category_id','supplier_id','buy_price','unit_price','tax_percent','total_cost','quantity','reorder_level','supplier_catalogue_number');
if(isset($_POST['search']))
{
$search=$_POST['search'];
$searching_by =$_POST['searching_by'];
echo "$lang->searchedForItem: $search $lang->searchBy $searching_by";
$display->displayManageTable("$cfg_tableprefix",'items',$tableheaders,$tablefields,"$searching_by","$search",'id');
}
elseif(isset($_GET['outofstock']))
{
echo "$lang->outOfStock";
$display->displayManageTable("$cfg_tableprefix",'items',$tableheaders,$tablefields,'quantity',"outofstock",'id');
}
elseif(isset($_GET['reorder']))
{
echo "$lang->reorder";
$display->displayManageTable("$cfg_tableprefix",'items',$tableheaders,$tablefields,'quantity',"reorder",'id');
}
else
{
$display->displayManageTable("$cfg_tableprefix",'items',$tableheaders,$tablefields,'','','id');
}
$dbf->closeDBlink();
?>