Exemple #1
0
function itemTemplate($upc) {
	$resultItem = selectProduct($upc);
	$itemrows = itemRows($resultItem);
	$salesBatch = selectSalesBatch($upc);
	if ($itemrows == 0 && is_numeric($upc)) {
		$upc = str_pad($upc,13,0,STR_PAD_LEFT);
		return array('itemEdit.tpl',$upc);

	} elseif ($itemrows == 1) {
		return array('itemEdit.tpl',mysql_fetch_assoc($resultItem));
	} elseif ($itemrows > 1)  {
		return array('itemMulti.tpl',allResults($resultItem));
	} else {
		return array('itemMaint.tpl','');
	}	

}
Exemple #2
0
}
if ($_POST['submit']) {
    $itemtemplate = itemTemplate($_POST['upc']);
    $item_template = $itemtemplate[0];
    $items = $itemtemplate[1];
    $match = $_POST['upc'];
    switch ($_POST['submit']) {
        case "Search":
            if (is_array($items) && $item_template == 'itemEdit.tpl') {
                //edit
                //setup variables
                $smarty->assign('javascriptonload', "onload='putFocus(0,10);'");
                array2smarty($smarty, item2smartyvarmap(1), $items);
                $subdept = deptDropDowns();
                $smarty->assign('items', $items);
                $salesbatch = selectSalesBatch($match);
                $smarty->assign('salesbatch', $salesbatch);
                $smarty->assign_by_ref('subdept', $subdept);
                $smarty->assign('buttontext', 'Update');
            } elseif ($item_template == 'itemMulti.tpl') {
                //Multi
                $smarty->assign('match', $match);
                $smarty->assign('matches', $items);
            } else {
                //new
                $subdept = deptDropDowns();
                $smarty->assign('items', '');
                $smarty->assign_by_ref('subdept', $subdept);
                $smarty->assign('buttontext', 'Insert');
                $smarty->assign('upc', $items);
            }