function move_list_tables($cols = 1)
    {
        global $tpl;
        $query = "SELECT * FROM `sources` WHERE `userid`='0'";
        $query .= " AND `toclose` = '0'";
        $query .= " AND `discount` = '0.00'";
        $query .= " AND `paid` = '0'";
        $query .= " AND `catprinted` = ''";
        $query .= " AND `takeaway` = '0'";
        $query .= " AND `visible` = '1'";
        $res = common_query($query, __FILE__, __LINE__);
        if (!$res) {
            return mysql_errno();
        }
        if (!mysql_num_rows($res)) {
            return 1;
        }
        $output .= ucfirst(phr('ALL_TABLES')) . ':';
        $output .= '
<table cellspacing="2" bgcolor="' . COLOR_TABLE_GENERAL . '" width="100%">
	<tbody>' . "\n";
        while ($arr = mysql_fetch_array($res)) {
            $output .= '
	<tr>' . "\n";
            for ($i = 0; $i < $cols; $i++) {
                if (!($tmp = $this->move_list_cell($arr))) {
                    $i--;
                } else {
                    $output .= $tmp;
                }
                if ($i != $cols - 1) {
                    $arr = mysql_fetch_array($res);
                }
            }
            $output .= '
	</tr>';
        }
        $output .= '
	</tbody>
</table>
';
        $tpl->assign('tables', $output);
        return 0;
    }
function generating_time($inizio)
{
    $output = '';
    if (!CONF_DEBUG_PRINT_GENERATING_TIME && !CONF_DEBUG_DISPLAY_MYSQL_QUERIES) {
        return $output;
    }
    //Timer to tell how much time was needed to generate the page.
    $inizio = explode(" ", $inizio);
    $inizio = (double) $inizio[0] + (double) $inizio[1];
    $fine = microtime();
    $fine = explode(" ", $fine);
    $fine = (double) $fine[0] + (double) $fine[1];
    $intervallo = $fine - $inizio;
    $intervallo = round($intervallo, 5);
    $output = '</center><div align="left">';
    if (CONF_DEBUG_PRINT_GENERATING_TIME && CONF_DEBUG_PRINT_GENERATING_TIME_ONLY_IF_HIGH && $intervallo >= CONF_DEBUG_PRINT_GENERATING_TIME_TRESHOLD) {
        $output .= '<br><font color="#F10404"><b>' . $intervallo . '</b>
			' . ucfirst(phr('SECONDS_TO_GENERATE_THE_PAGE')) . '.</font><br>';
        $msg = 'Generating time over max (' . CONF_DEBUG_PRINT_GENERATING_TIME_TRESHOLD . '): ' . $intervallo . ' secs reached';
        error_msg(__FILE__, __LINE__, $msg);
    } elseif (CONF_DEBUG_PRINT_GENERATING_TIME && CONF_DEBUG_PRINT_GENERATING_TIME_ONLY_IF_HIGH && $intervallo < CONF_DEBUG_PRINT_GENERATING_TIME_TRESHOLD) {
        // do nothing because we're under treshold and only want to see if we're over it
    } elseif (CONF_DEBUG_PRINT_GENERATING_TIME && !CONF_DEBUG_PRINT_GENERATING_TIME_ONLY_IF_HIGH) {
        $output .= '<br><b>' . $intervallo . '</b>
			' . ucfirst(phr('SECONDS_TO_GENERATE_THE_PAGE')) . '.<br>';
        $sql_time = round($GLOBALS['mysql_timer'], 5);
        $sql_percent = $sql_time / $intervallo * 100;
        $sql_percent = round($sql_percent, 1);
        $all_queries = count($GLOBALS['mysql_queries']);
        $dbl_queries = count($GLOBALS['mysql_queries_doubles']);
        $dbl_percent = $dbl_queries / $all_queries * 100;
        $dbl_percent = round($dbl_percent, 1);
        $output .= '<b>' . $sql_time . '</b> (' . $sql_percent . '% of time) spent for <b>' . $all_queries . '</b> Mysql queries (<b>' . $dbl_queries . '</b> doubles - ' . $dbl_percent . '% of queries).<br/>';
        if (isset($GLOBALS['end_require_time'])) {
            $require_time = $GLOBALS['end_require_time'];
            $require_time = explode(" ", $require_time);
            $require_time = (double) $require_time[0] + (double) $require_time[1];
            $require_time = $require_time - $inizio;
            $require_time = round($require_time, 5);
            $require_percent = $require_time / $intervallo * 100;
            $require_percent = round($require_percent, 1);
            $output .= '<b>' . $require_time . '</b> (' . $require_percent . '% of time) spent for initial requires.<br/>';
        }
    }
    if (CONF_DEBUG_DISPLAY_MYSQL_QUERIES) {
        $i = 0;
        foreach (array_unique($GLOBALS['mysql_queries_doubles']) as $query) {
            $GLOBALS['mysql_queries_doubles_ord']['query'][$i] = $query;
            $GLOBALS['mysql_queries_doubles_ord']['times'][$i] = array_count_occurr($GLOBALS['mysql_queries_doubles'], $query);
            $i++;
        }
        arsort($GLOBALS['mysql_queries_doubles_ord']['times']);
        $output .= '<hr><b>' . count($GLOBALS['mysql_queries_doubles']) . ' double queries</b> (most requested first)<br>' . "\n";
        foreach ($GLOBALS['mysql_queries_doubles_ord']['times'] as $index => $times) {
            $query = $GLOBALS['mysql_queries_doubles_ord']['query'][$index];
            $output .= $times . 'x - ' . $query . '<br>' . "\n";
        }
        $output .= '<hr><b>All ' . count($GLOBALS['mysql_queries']) . ' queries</b> (chronological order)<br>' . "\n";
        foreach ($GLOBALS['mysql_queries_list'] as $query) {
            $output .= $query . '<br>' . "\n";
        }
    }
    return $output;
}
    $arr = mysql_fetch_array($res);
    $catprinted_total = $arr['catprinted'];
    $catprinted_total = explode(" ", $catprinted_total);
    for ($i = 1; $i <= 3; $i++) {
        if (in_array("{$i}", $catprinted_total)) {
            $_SESSION['catprinted'][$i] = true;
        } else {
            $_SESSION['catprinted'][$i] = false;
        }
    }
    unset($res);
    unset($arr);
    unset($catprinted_total);
}
header("Content-Language: " . $_SESSION['language']);
header("Content-type: text/html; charset=" . phr('CHARSET'));
$tmp = head_line('Waiters Section');
$tpl->assign("head", $tmp);
if (!isset($dont_redirect_to_menu)) {
    $time_refresh = 1000 * get_conf(__FILE__, __LINE__, 'refresh_automatic_to_menu');
    if ($time_refresh) {
        $tmp = redirect_timed('tables.php', $time_refresh);
        $tpl->append("scripts", $tmp);
    }
}
$scripts = '<script language="javascript" type="text/javascript">
				function loadDish ( pageUrl ) {
						$.ajax( {
							type: "POST",
							url: pageUrl,
							data : \'\',
示例#4
0
                $_SESSION["annul"] = $annul;
                for (reset($annul); list($key, $value) = each($annul);) {
                    $table = 'account_mgmt_main';
                    $res = mysql_db_query($_SESSION['common_db'], "SELECT * FROM {$table} WHERE `id`='{$key}'");
                    $row = mysql_fetch_array($res);
                    mysql_free_result($res);
                    echo "<LI>" . $row['internal_id'] . "</LI>";
                }
                echo "\n\t\t\t\t<table><tr><td>\n\t\t\t\t<form action=\"receipt.php\" method=\"GET\">\n\t\t\t\t<input type=\"hidden\" name=\"command\" value=\"annul\">\n";
                echo "\n\t\t\t\t<input type=\"hidden\" name=\"annulconfirm\" value=\"1\">\n\t\t\t\t<input type=\"submit\" value=\"" . ucfirst(phr('YES')) . "\">\n\t\t\t\t</form></td>\n\t\t\t\t<td><form action=\"index.php\" method=\"GET\">\n\t\t\t\t<input type=\"submit\" value=\"" . ucfirst(phr('NO')) . "\">\n\t\t\t\t</form>\n\t\t\t\t</td></tr></table>\n\t\t\t\t";
            } else {
                echo GLOBALMSG_RECORD_NONE_SELECTED_ERROR . ".<br>";
            }
        }
        break;
    default:
        if (isset($_GET['orderby'])) {
            $orderby = $_GET['orderby'];
        } elseif (isset($_POST['orderby'])) {
            $orderby = $_POST['orderby'];
        }
        echo "<table width=\"100%\"><tr><td align=\"left\">\n";
        // Next is the form to decide the type of data to insert
        echo "</td><td align=\"right\">\n";
        echo "</td></tr></table>\n";
        // next is the general report table creator
        table_receipt($orderby);
        break;
}
echo "\n\t<br>\n\t<form action=\"index.php\" method=\"GET\">\n\t<input type=\"submit\" value=\"" . ucfirst(phr('GO_MAIN_REPORT')) . "\">\n\t</form>\n";
echo generating_time($inizio);
function receipt_insert($accountdb, $type)
{
    // CRYPTO
    // finds the last issued bill or invoice, and increments by one
    // internal invoice/receipt number format is: NNNNNNYYYY
    // where NNNNNN is the incremental number padded with 0s and YYYY is
    // the current 4 digits year.
    $last_internal_id = find_last_receipt($accountdb, $type, date("Y"));
    $internal_id = $last_internal_id + 1;
    $internal_id = sprintf("%06d", $internal_id);
    $internal_id .= date("Y");
    // creates the new receipt voice in management db, to be next filled
    // with actual amount values
    $table = 'account_mgmt_main';
    //mizuko... added $user->data['name'] to have user name
    $user = new user($_SESSION['userid']);
    $query = "INSERT INTO {$table} (`description`,`who`,`internal_id`,`type`,`waiter_income`) VALUES ('" . ucfirst(phr('INCOME')) . ": {$internal_id}','" . $user->data['name'] . "','{$internal_id}','{$type}','1')";
    $res = common_query($query, __FILE__, __LINE__);
    if (!$res) {
        return 0;
    }
    $receipt_id = mysql_insert_id();
    return $receipt_id;
}
示例#6
0
' . $user->html_select(SHOW_WAITER_ONLY) . '
		</center>
	</td></tr>
	<tr><td>
		<center>
		<INPUT TYPE="SUBMIT" value="' . ucfirst(phr('SUBMIT')) . '">
		</center>
	</td></tr>
</table>
</form>
';
    $tpl->assign('waiter_selection', $tmp);
} else {
    $tmp = redirect_waiter('tables.php');
    $tpl->append('scripts', $tmp);
    $tmp = '<font color="green">' . ucfirst(phr('ALREADY_CONNECTED')) . '<br/><a href="tables.php">' . ucfirst(phr('GO_ON')) . '</a></font>' . "\n";
    $tpl->append('messages', $tmp);
}
// prints page generation time
$tmp = generating_time($inizio);
$tpl->assign('generating_time', $tmp);
if ($err = $tpl->parse()) {
    return $err;
}
$tpl->clean();
$output = $tpl->getOutput();
// prints everything to screen
echo $output;
if (CONF_DEBUG_PRINT_PAGE_SIZE) {
    echo $tpl->print_size();
}
function access_denied_admin()
{
    $url = $_SERVER['REQUEST_URI'];
    $link = ROOTDIR . '/admin/connect.php?command=disconnect';
    $link .= '&url=' . urlencode($url);
    $tmp = '<div id="tip">
		    <table width="450" cellpadding="0" cellspacing="12">
		      <tr>
		        <td width="52"><div align="center"><img src="' . IMAGE_ERROR . '" alt="negative" width="18" height="18" /></div></td>
		        <td width="388" >' . ucfirst(phr('ACCESS_DENIED')) . '<br/>' . ucfirst(phr('ACCESS_DENIED_EXPLAIN')) . '</td> 
		      </tr>
		    </table>
		  </div>
		';
    if (!isset($_SESSION['userid']) || !$_SESSION['userid']) {
        $user = new user($_SESSION['userid']);
        $user->disconnect();
        $tmp .= access_connect_form($url);
    } else {
        $tmp = '<div id="tip">
			    <table width="450" cellpadding="0" cellspacing="12">
			      <tr>
			        <td width="52"><div align="center"><img src="' . IMAGE_ERROR . '" alt="negative" width="18" height="18" /></div></td>
			        <td width="388" >' . ucfirst(phr('ACCESS_DENIED')) . '<br/>' . ucfirst(phr('ACCESS_DENIED_EXPLAIN')) . '<br/><a href="' . $link . '">' . ucfirst(phr('CONNECT')) . '</a></td> 
			      </tr>
			    </table>
			  </div>
			';
    }
    return $tmp;
}
示例#8
0
            delete_rows($delete);
        } else {
            if (isset($_GET['delete'])) {
                $delete = $_GET['delete'];
            } elseif (isset($_POST['delete'])) {
                $delete = $_POST['delete'];
            }
            if (is_array($delete)) {
                echo "\n\t\t\t\t" . GLOBALMSG_RECORDS_DELETE_CONFIRM . "<br><br>\n";
                $_SESSION["delete"] = $delete;
                for (reset($delete); list($key, $value) = each($delete);) {
                    $description = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], "account_mgmt_main", "description", $key);
                    echo "<LI>" . $description . "</LI>";
                }
                echo "\n\t\t\t\t<table><tr><td>\n\t\t\t\t<form action=\"db.php\" method=\"GET\">\n\t\t\t\t<input type=\"hidden\" name=\"command\" value=\"delete\">\n";
                echo "\n\t\t\t\t<input type=\"hidden\" name=\"deleteconfirm\" value=\"1\">\n\t\t\t\t<input type=\"submit\" value=\"" . ucfirst(phr('YES')) . "\">\n\t\t\t\t</form></td>\n\t\t\t\t<td><form action=\"index.php\" method=\"GET\">\n\t\t\t\t<input type=\"submit\" value=\"" . ucfirst(phr('NO')) . "\">\n\t\t\t\t</form>\n\t\t\t\t</td></tr></table>\n\t\t\t\t";
            } else {
                echo GLOBALMSG_RECORD_NONE_SELECTED_ERROR . ".<br>";
            }
        }
        break;
}
if ($command != "delete") {
    unset($_SESSION["delete"]);
}
echo "<br><a href=\"#\" onclick=\"javascript:history.go(-1); return false\">" . ucfirst(phr('GO_BACK')) . "</a><br>\n";
echo "<br><a href=\"index.php\">" . ucfirst(phr('GO_MAIN_REPORT')) . "</a><br>";
echo generating_time($inizio);
?>

示例#9
0
    case '601':
    case '602':
    case '603':
        $tmp = access_connect_form_waiter_pos($err);
        $tpl->assign('waiter_selection', $tmp);
        break;
    default:
        $tmp = redirect_waiter('tables.php');
        $tpl->append('scripts', $tmp);
        $tmp = '
		  <div id="positive">
		    <table width="450" cellpadding="0" cellspacing="12">
		      <tr>
		        <td width="52"><div align="center"><img src="' . IMAGE_POSITIVE . '" alt="positive" width="18" height="18" /></div></td>
		        <td width="388">' . ucfirst(phr('ALREADY_CONNECTED')) . '</td> 
		        <td width="388"><a href="tables.php">' . ucfirst(phr('GO_ON')) . '</a></td> 
		      </tr>
		    </table>
		  </div>
		';
        $tpl->append('messages', $tmp);
        break;
}
// prints page generation time
$tmp = generating_time($inizio);
$tpl->assign('generating_time', $tmp);
if ($err = $tpl->parse()) {
    return $err;
}
$tpl->clean();
$output = $tpl->getOutput();
 function table_row_name($arr)
 {
     $dish = new dish($arr['dishid']);
     $dishname = $dish->name($_SESSION['language']);
     $deleted = $arr['deleted'];
     $orderid = $arr['id'];
     if ($arr['dishid'] == MOD_ID) {
         $modingred = $arr['ingredid'];
         $ingr = new ingredient($modingred);
         $moddeddishname = $ingr->name($_SESSION['language']);
         // say if it's added or subtracted
         if ($arr['operation'] == 1) {
             $dishname = "    " . ucfirst(phr('PLUS'));
         } elseif ($arr['operation'] == -1) {
             $dishname = "    " . ucfirst(phr('MINUS'));
         }
         $dishname .= " " . $moddeddishname;
         // and finally consider any optional info (lot/few)
         if ($arr['ingred_qty'] == 1) {
             $dishname .= " " . ucfirst(phr('LOT'));
         } elseif ($arr['ingred_qty'] == -1) {
             $dishname .= " " . ucfirst(phr('FEW'));
         }
         // gets the original ingred price (from ingreds table)
         // if the original price is 0 and the actual price is 0
         // then it means that the ingred has passed through the autocalc system
         // and we let the waiter know this, so he could check the prices.
         $modingredprice = $ingr->get('price');
         //$modingredprice=get_db_data(__FILE__,__LINE__,$_SESSION['common_db'],"ingreds","price",$modingred);
         if ($modingredprice == 0 && $arr['price'] != 0) {
             $dishname .= " (auto)";
         }
     }
     if ($arr['dishid'] == SERVICE_ID) {
         $dishname = ucfirst(phr('SERVICE_FEE'));
     }
     return $dishname;
 }
示例#11
0
         dish_list($list);
         break;
     } elseif ($num == 0) {
         // found none
         $tmp = '<b><font color="Red">' . ucfirst(phr('ERROR_NONE_FOUND')) . "</font></b><br>\n";
         $tpl->append('messages', $tmp);
         orders_list();
         break;
     } else {
         // found one, we directly assume that's the dish the user wanted
         $dishid = $num;
     }
 }
 $dish = new dish($dishid);
 if (!$dish->exists()) {
     $tmp = '<b><font color="Red">' . ucfirst(phr('DISH_DOES_NOT_EXIST')) . "</font></b><br>\n";
     $tpl->append('messages', $tmp);
     orders_list();
     break;
 }
 if ($dishid) {
     $id = orders_create($dishid, $start_data);
 }
 if ($id) {
     $err = 0;
 } else {
     $err = ERR_UNKNOWN;
 }
 status_report('CREATION', $err);
 if (isset($_REQUEST['from_category']) && $_REQUEST['from_category']) {
     if (isset($_REQUEST['back_to_cat']) && $_REQUEST['back_to_cat']) {
function toplist_show()
{
    global $tpl;
    $_SESSION['order_added'] = 0;
    $query = "SELECT * FROM `last_orders`";
    $res = common_query($query, __FILE__, __LINE__);
    if (!$res) {
        return ERR_MYSQL;
    }
    if (!mysql_num_rows($res)) {
        return 1;
    }
    while ($arr = mysql_fetch_array($res)) {
        $dishid = $arr['dishid'];
        if ($dishid == MOD_ID || $dishid == SERVICE_ID) {
            continue;
        }
        if (!isset($toplist[$dishid])) {
            $toplist[$dishid] = 0;
        }
        $toplist[$dishid]++;
    }
    if (!is_array($toplist)) {
        return 0;
    }
    arsort($toplist);
    reset($toplist);
    $chk[1] = "";
    $chk[2] = "";
    $chk[3] = "";
    $tmp = '
	<form action="orders.php" method="POST" name="toplist_form">
	<INPUT TYPE="HIDDEN" NAME="command" VALUE="create">
	<INPUT TYPE="HIDDEN" NAME="dishid" VALUE="0">';
    if (CONF_TOPLIST_HIDE_QUANTITY) {
        $tmp .= '
		<INPUT TYPE="HIDDEN" NAME="data[quantity]" VALUE="1">';
    }
    if (CONF_TOPLIST_HIDE_PRIORITY) {
        $tmp .= '
		' . ucfirst(phr('PRIORITY')) . ':
		<input type="radio" ' . $chk[1] . ' name="data[priority]" value=1>1
		<input type="radio" ' . $chk[2] . ' name="data[priority]" value=2>2
		<input type="radio" ' . $chk[3] . ' name="data[priority]" value=3>3';
    }
    $tmp .= '
	<table bgcolor="' . COLOR_TABLE_GENERAL . '">
	<tbody>
		<tr align="center">
			<td colspan="4">
				<b>' . ucfirst(phr('TOPLIST')) . '(' . ucfirst(phr('LASTS')) . ' ' . CONF_TOPLIST_SAVED_NUMBER . ')</b>
				&nbsp;&nbsp;
				<a href="orders.php?command=set_show_toplist">
				<img src="' . ROOTDIR . '/images/waiter/fileclose.png" border="0" alt="' . ucphr('HIDE_TOPLIST') . '">
				</a>
			</td>
		</tr>
';
    $i = 0;
    while ($i < get_conf(__FILE__, __LINE__, "top_list_show_top")) {
        if (list($key, $value) = each($toplist)) {
            $category = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dishes', 'category', $key);
            $bgcolor = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'categories', 'htmlcolor', $category);
            $tmp .= '
		<tr bgcolor="' . $bgcolor . '">';
            if (table_is_takeaway($_SESSION['sourceid'])) {
                $tmp .= '
			<input type="hidden" name="data[priority]" value=1>';
            } elseif (!$i && !CONF_TOPLIST_HIDE_PRIORITY) {
                $tmp .= '
			<td rowspan="' . (get_conf(__FILE__, __LINE__, "top_list_show_top") + 1) . '" bgcolor="' . COLOR_TABLE_GENERAL . '">
			1<input type="radio" ' . $chk[1] . ' name="data[priority]" value=1><br />
			2<input type="radio" ' . $chk[2] . ' name="data[priority]" value=2><br />
			3<input type="radio" ' . $chk[3] . ' name="data[priority]" value=3><br />
			</td>';
            }
            if (!$i && !CONF_TOPLIST_HIDE_QUANTITY) {
                $qtydata['nolabel'] = 1;
                $tmp .= '
			<td rowspan="' . (get_conf(__FILE__, __LINE__, "top_list_show_top") + 1) . '" bgcolor="' . COLOR_TABLE_GENERAL . '">
			' . quantity_list($qtydata) . '
			</td>';
            }
            $dishobj = new dish($key);
            $dishname = $dishobj->name($_SESSION['language']);
            $tmp .= '
			<td>
				' . $value . '
			</td>';
            $tmp .= '
			<td valign="middle" onclick="order_select(\'' . $key . '\',\'toplist_form\');">
			<a href="#" onclick="JavaScript:order_select(\'' . $key . '\',\'toplist_form\'); return false;">
			' . $dishname . '
			</a>
			</td>';
            $tmp .= '
		</tr>';
        }
        $i++;
    }
    $tmp .= '
	</table>
	</form>';
    $tpl->assign('toplist', $tmp);
    return 0;
}
function tables_list_cell_pos($row)
{
    $output = '';
    $sourceid = $row['id'];
    $tablenum = $row['name'];
    $owneruserid = $row['userid'];
    $tableclosed = $row['toclose'];
    $paid = $row['paid'];
    //RTG: in the master query we get the num of the order associated to this table,
    //if any, so we don't need create a table object just to see if is empty.
    $empty = $row['order'] == null || $row['order'] == 0;
    $user = new user($_SESSION['userid']);
    if ($user->level[USER_BIT_CASHIER] && order_found_generic_not_priced($sourceid)) {
        $msg = ucfirst(phr('GENERIC_NOT_PRICED'));
        $class = COLOR_TABLE_GENERIC_NOT_PRICED;
    } elseif ($tableclosed && $user->level[USER_BIT_CASHIER] && !$paid) {
        $msg = ucfirst(phr('CLOSED'));
        $class = COLOR_TABLE_CLOSED_OPENABLE;
    } elseif ($tableclosed && $user->level[USER_BIT_CASHIER] && $paid) {
        $msg = ucfirst(phr('PAID'));
        $class = COLOR_TABLE_CLOSED_OPENABLE;
    } elseif ($tableclosed && !$user->level[USER_BIT_CASHIER] && !$paid) {
        $msg = ucfirst(phr('CLOSED'));
        $class = COLOR_TABLE_NOT_OPENABLE;
    } elseif ($tableclosed && !$user->level[USER_BIT_CASHIER] && $paid) {
        $msg = ucfirst(phr('PAID'));
        $class = COLOR_TABLE_NOT_OPENABLE;
    } elseif ($_SESSION['userid'] == $owneruserid) {
        $msg = ucfirst(phr('OPEN'));
        $class = COLOR_TABLE_MINE;
        if (categories_orders_present($sourceid, 2) && !categories_printed($sourceid, 2)) {
            $class = COLOR_ORDER_PRIORITY_2;
        }
        if (categories_orders_present($sourceid, 3) && !categories_printed($sourceid, 3)) {
            $class = COLOR_ORDER_PRIORITY_2;
        }
    } elseif (!$empty && $owneruserid == 0) {
        $msg = ucfirst(phr('TO_BE_ASSOCIATED'));
        $class = COLOR_TABLE_CLOSED_OPENABLE;
    } elseif ($owneruserid == 0 && !$tableclosed && $empty) {
        $msg = ucfirst(phr('FREE'));
        $class = COLOR_TABLE_FREE;
    } else {
        $user = new user($owneruserid);
        $ownerusername = $user->data['name'];
        unset($user);
        $msg = $ownerusername;
        $class = COLOR_TABLE_OTHER;
    }
    if ($sourceid) {
        $link = 'orders.php?data[sourceid]=' . $sourceid;
        if (isset($command) && !empty($command)) {
            $link .= '&amp;command=' . $command;
        }
        $msg = strtoupper($msg);
        $output .= '
		<td bgcolor="' . $class . '" onclick="redir(\'' . $link . '\');return(false);">
			<a href="' . $link . '"><img src="' . IMAGE_TABLE . '"><br>
			<strong>' . $tablenum . '
			' . $msg . '</strong></a>
		</td>' . "\n";
    } else {
        $output .= '
		<td bgcolor="' . COLOR_TABLE_FREE . '">
		&nbsp;
		</td>' . "\n";
    }
    return $output;
}
示例#14
0
    function printDailyIncome($user)
    {
        $fillimi = date('Y-m-d') . " 00:00:01";
        $fundi = date('Y-m-d') . " 23:59:00";
        $userName = $user->data['name'];
        $table = 'account_mgmt_main';
        $queryMoney = "SELECT date, who, description, cash_amount ";
        $queryMoney .= "FROM `account_mgmt_main`";
        $queryMoney .= "WHERE who = '" . $userName . "' AND ";
        $queryMoney .= "date > '" . $fillimi . "' AND date < '" . $fundi . "'";
        $resMoney = common_query($queryMoney, __FILE__, __LINE__);
        if (!$resMoney) {
            return '';
        }
        $therearerecordsMoney = mysql_num_rows($resMoney);
        if ($therearerecordsMoney) {
            $output = '
			<span class="style1">Xhiroja Ditore e ' . $userName . '  nga ' . $fillimi . '  ne ' . $fundi . '</span><br><br><br>
			<table>
			<tr>
				<td height="31" width="100"><strong>Data - Ora</strong></td>
				<td width="145"><div align="right"><strong>Nr i fatures</strong></div></td>
				<td width="80"><div align="right"><strong>Vlera lek</strong></div></td>
			</tr>';
            while ($arr = mysql_fetch_array($resMoney)) {
                $output .= '	
			 <tr>
			  	<td width="200"><div align="left">' . $arr['date'] . '</div></td>
			    <td width="145"><div align="right">' . $arr['description'] . '</div></td>
			    <td width="80"><div align="right">' . $arr['cash_amount'] . '</div></td>
			  </tr>';
                $totali += $arr['cash_amount'];
            }
            $output .= '</table>
			<br><br>
			' . ucfirst(phr('CONNECTED_AS')) . ' ' . $userName . '<strong>' . $totali . '  LEK</strong>';
        }
        return $output;
    }
function takeaway_form()
{
    global $tpl;
    $data = takeaway_get_customer_data($_SESSION['sourceid']);
    $tmp = customer_search_form();
    $tmp .= '
	<form action="orders.php" method="post" name="form_takeaway">
		<input type="hidden" name="command" value="set_customer">
		<table>
		<tbody>
		<tr>
		<td>
			' . ucfirst(phr('SURNAME')) . ':
		</td>
		<td valign="center">
		';
    if (get_conf(__FILE__, __LINE__, 'takeaway_allow_unknown_customer')) {
        $tmp .= '
			<input name="data[takeaway_surname]" type="text" value="' . $data['takeaway_surname'] . '" maxlength="255" size="10">';
    } else {
        $tmp .= '
			<input name="data[takeaway_surname]" type="hidden" value="' . $data['takeaway_surname'] . '">
			<b>' . $data['takeaway_surname'] . '</b>';
    }
    if ($data['customer']) {
        $cust_id = $data['customer'];
        $cust = new customer($cust_id);
        $tmp .= '<a href="orders.php?command=customer_edit_form&amp;data[id]=' . $data['customer'] . '"><img src="' . IMAGE_PERSON . '" width="22" height="22" border="0"></a>';
        $tmp .= '
		</td>
		</tr>
		<tr>
		<td>
			' . ucfirst(phr('NAME')) . '
		</td>
		<td>
			' . $cust->data['name'] . '
		</td>
		</tr>	
		<tr>
		<td>
			' . ucfirst(phr('ADDRESS')) . '
		</td>
		<td>
			' . $cust->data['address'] . '
		</td>
		</tr>	
		<tr>
		<td>
			' . ucfirst(phr('CITY')) . '
		</td>
		<td>
			' . $cust->data['city'] . '
		</td>
		</tr>	
		<tr>
		<td>
			' . ucfirst(phr('ZIP')) . '
		</td>
		<td>
			' . $cust->data['zip'] . '
		</td>
		</tr>	
		<tr>
		<td>
			' . ucfirst(phr('PHONE')) . '
		</td>
		<td>
			' . $cust->data['phone'] . '
		</td>
		</tr>	
		<tr>
		<td>
			' . ucfirst(phr('MOBILE')) . '
		</td>
		<td>
			' . $cust->data['mobile'] . '
		</td>
		</tr>
		<tr>
		<td>
			' . ucfirst(phr('EMAIL')) . '
		</td>
		<td>
			' . $cust->data['email'] . '
		</td>
		</tr>	
		<tr>
		<td>
			' . ucfirst(phr('VAT_ACCOUNT')) . '
		</td>
		<td>
			' . $cust->data['vat_account'] . '
		</td>
		</tr>	
		';
    } else {
        $tmp .= '
		</td>
		</tr>';
    }
    $tmp .= '
		<tr>
		<td>
			' . ucfirst(phr('TIME')) . ':
		</td>
		<td>
			<input name="data[takeaway_hour]" type="text" value="' . $data['takeaway_hour'] . '" maxlength="2" size="2">
			:
			<input name="data[takeaway_minute]" type="text" value="' . $data['takeaway_minute'] . '" maxlength="2" size="2">
		</td>
		</tr>
		<tr>
		<td>
			' . ucfirst(phr('DATE')) . ':
		</td>
		<td>
			<input name="data[takeaway_day]" type="text" value="' . $data['takeaway_day'] . '" maxlength="2" size="2">
			/
			<input name="data[takeaway_month]" type="text" value="' . $data['takeaway_month'] . '" maxlength="2" size="2">
			/
			<input name="data[takeaway_year]" type="text" value="' . $data['takeaway_year'] . '" maxlength="4" size="4">
		</td>
		</tr>
		<tr>
		<td colspan="2" align="center">
			<input type="image" src="' . IMAGE_OK . '" alt="' . ucfirst(phr('TAKEAWAY_SUBMIT')) . '" border=0 width="32" height="32">
		</td>
		</tr>
		</tbody>
		</table>
	</form>
	';
    $tpl->assign('takeaway', $tmp);
    return 0;
}
function discount_form_javascript($sourceid)
{
    $output = '';
    if (isset($_SESSION['discount'])) {
        $percent = $_SESSION['discount']['percent'];
        $amount = -1 * $_SESSION['discount']['amount'];
    } else {
        $percent = 0;
        $amount = 0;
    }
    if (!isset($_SESSION['discount']) || !isset($_SESSION['discount']['type'])) {
        $_SESSION['discount']['type'] = '';
    }
    switch ($_SESSION['discount']['type']) {
        case "percent":
            $dis[1] = "";
            $dis[2] = "disabled";
            $chk[0] = "";
            $chk[1] = "checked";
            $chk[2] = "";
            break;
        case "amount":
            $dis[1] = "disabled";
            $dis[2] = "";
            $chk[0] = "";
            $chk[1] = "";
            $chk[2] = "checked";
            break;
        default:
            $dis[1] = "disabled";
            $dis[2] = "disabled";
            $chk[0] = "checked";
            $chk[1] = "";
            $chk[2] = "";
            break;
    }
    // Next is a micro-form to set a discount in percent value
    $output .= '
		<FIELDSET>
			<LEGEND>' . ucfirst(phr('DISCOUNT')) . '</LEGEND>
			<FORM ACTION="orders.php" NAME="form_discount" METHOD="POST">
				<INPUT TYPE="HIDDEN" NAME="command" VALUE="bill_discount">
				<INPUT TYPE="HIDDEN" NAME="keep_separated" VALUE="1">
				<input type="radio" name="discount_type" value="none" onclick="JavaScript:discount_switch();" ' . $chk[0] . '>' . ucfirst(phr('NONE')) . '<br />
				<input type="radio" name="discount_type" value="percent" onclick="JavaScript:discount_switch();" ' . $chk[1] . '>
				' . ucfirst(phr('PERCENTUAL')) . ' <INPUT TYPE="text" name="percent" size="2" maxlength="2" value="' . $percent . '" ' . $dis[1] . '>% <br />
				<input type="radio" name="discount_type" value="amount" onclick="JavaScript:discount_switch();" ' . $chk[2] . '>' . ucfirst(phr('VALUE')) . ' 
				<INPUT TYPE="text" name="amount" size="4" maxlength="4" value="' . $amount . '" ' . $dis[2] . '>' . country_conf_currency(true) . '<br />
				<INPUT TYPE="button" onClick="applyDiscount(\'form_discount\')" value="' . ucfirst(phr('APPLY_DISCOUNT')) . '"><br />
			</FORM>
		</FIELDSET>
	';
    return $output;
}
    function commands_horizontal($class)
    {
        global $tpl;
        if (!get_class($this) == 'search') {
            $records_found = false;
            $query = "SELECT * FROM `" . $this->table . "`";
            if ($this->db == 'common') {
                $res = common_query($query, __FILE__, __LINE__);
            } else {
                $res = accounting_query($query, __FILE__, __LINE__);
            }
            if (!$res) {
                return '';
            }
            if (!mysql_num_rows($res)) {
                $tmp = ucfirst(phr('ERROR_NONE_FOUND')) . ".<br>\n";
                $tpl->assign("search", $tmp);
            } else {
                $records_found = true;
            }
        }
        $allow_new = false;
        $allow_catlist = true;
        if ($class == 'category') {
            $vat = new vat_rate();
            if ($vat->count_records()) {
                $allow_new = true;
            }
        } elseif (!$this->disable_new) {
            $allow_new = true;
        }
        if (!isset($_REQUEST['data']['global_search'])) {
            $local_check = '';
            $glob_check = ' checked';
        } elseif (isset($_REQUEST['data']['global_search']) && $_REQUEST['data']['global_search'] == 1) {
            $local_check = '';
            $glob_check = ' checked';
            $allow_new = false;
            $allow_catlist = false;
        } elseif (isset($_REQUEST['data']['global_search']) && $_REQUEST['data']['global_search'] == 0) {
            $local_check = ' checked';
            $glob_check = '';
        }
        if ($allow_new && method_exists($this, 'form')) {
            $tmp = '
	<a href="' . $this->file . '?command=new&amp;class=' . $class . '">' . ucphr('INSERT_NEW') . '</a> ';
            $tpl->assign("newrecord", $tmp);
        }
        $tmp = '
	<form name="search" action="' . $this->file . '">
	<input type="hidden" name="class" value="' . $class . '">
	<input type="text" onChange="document.search.submit()" name="data[search]" size="10" value="' . $this->search . '">
	<input type="image" src="' . ROOTDIR . '/images/find_small.png" alt="' . ucphr('SEARCH') . '">';
        $tmp .= '
	<input type="hidden" name="data[global_search]" value="1">';
        $tmp .= '
	</form>';
        $tpl->assign("search", $tmp);
        return 0;
    }
function customer_form_data($data)
{
    $msg = '
		<table>
		<tr>
		<td>
			' . ucfirst(phr('SURNAME')) . ':
		</td>
		<td>
			<input name="data[surname]" type="text" value="' . $data['surname'] . '" maxlength="255" size="10">
		</td>
		</tr>
		<tr>
		<td>
			' . ucfirst(phr('NAME')) . ':
		</td>
		<td>
			<input name="data[name]" type="text" value="' . $data['name'] . '" maxlength="255" size="10">
		</td>
		</tr>
		<tr>
		<td>
			' . ucfirst(phr('ADDRESS')) . ':
		</td>
		<td>
			<input name="data[address]" type="text" value="' . $data['address'] . '" maxlength="255" size="10">
		</td>
		</tr>
		<tr>
		<td>
			' . ucfirst(phr('CITY')) . ':
		</td>
		<td>
			<input name="data[city]" type="text" value="' . $data['city'] . '" maxlength="255" size="10">
		</td>
		</tr>
		<tr>
		<td>
			' . ucfirst(phr('ZIP_CODE')) . ':
		</td>
		<td>
			<input name="data[zip]" type="text" value="' . $data['zip'] . '" maxlength="255" size="10">
		</td>
		</tr>
		<tr>
		<td>
			' . ucfirst(phr('VAT_ACCOUNT')) . ':
		</td>
		<td>
			<input name="data[vat_account]" type="text" value="' . $data['vat_account'] . '" maxlength="255" size="10">
		</td>
		</tr>
		<tr>
		<td>
			' . ucfirst(phr('PHONE')) . ':
		</td>
		<td>
			<input name="data[phone]" type="text" value="' . $data['phone'] . '" maxlength="255" size="10">
		</td>
		</tr>
		<tr>
		<td>
			' . ucfirst(phr('MOBILE')) . ':
		</td>
		<td>
			<input name="data[mobile]" type="text" value="' . $data['mobile'] . '" maxlength="255" size="10">
		</td>
		</tr>
		<tr>
		<td>
			' . ucfirst(phr('EMAIL')) . ':
		</td>
		<td>
			<input name="data[email]" type="text" value="' . $data['email'] . '" maxlength="255" size="10">
		</td>
		</tr>
		</table>
	';
    return $msg;
}
function command_bar_table_vertical_pos()
{
    $output = '<span class="rounded">
		<a href="tables.php"><img src="' . IMAGE_MENU . '" alt="' . ucfirst(phr('BACK_TO_TABLES')) . '" border=0 width="64" height="64"></a>
		<a href="orders.php?command=printing_choose"><img src="' . IMAGE_PRINT . '" alt="' . ucfirst(phr('PRINT')) . '" border=0 width="64" height="64"></a>
		<a href="#" onClick="loadModal(\'orders.php?command=close_confirm\')"><img src="' . IMAGE_CLOSE . '" alt="' . ucfirst(phr('CLOSE_TABLE')) . '" border=0 width="64" height="64"></a>
	</span>';
    return $output;
}
function order_extra_msg($extra_care)
{
    if ($extra_care) {
        $extra_msg = ucfirst(phr('EXTRA_CARE_ABBR'));
    } else {
        $extra_msg = "";
    }
    return $extra_msg;
}
示例#21
0
function mods_letter_list_pos($form, $ord)
{
    $char_per_line = 5;
    $i = 0;
    $output = '';
    $i++;
    $letters = mods_letter_array($ord);
    $output .= '<a href="#" onclick="getDishStartingByLetter(\'' . $form . '\',\'ALL\'); return false;">' . ucfirst(phr('ALL')) . '</a><br/>' . "\n";
    foreach ($letters as $char) {
        $output .= '<a href="#" onclick="getDishStartingByLetter(\'' . $form . '\',\'' . $char . '\'); return false;">' . $char . '</a>&nbsp;&nbsp;' . "\n";
        if ($i % $char_per_line == 0) {
            $output .= "<br/>\n";
        }
        $i++;
    }
    return $output;
}
function show_receipt($id)
{
    if (!$id) {
        return 1;
    }
    $table = 'account_mgmt_main';
    $query = "SELECT * FROM {$table} WHERE `id`='{$id}'";
    $res = mysql_db_query($_SESSION['common_db'], $query);
    $row = mysql_fetch_array($res);
    if ($row['annulled']) {
        switch ($row['type']) {
            case 4:
                echo ucphr('RECEIPT_ANNULLED_OK') . ".<br>\n";
                break;
            case 3:
                echo ucphr('INVOICE_ANNULLED_OK') . ".<br>\n";
                break;
            case 5:
                echo ucphr('BILL_ANNULLED_OK') . ".<br>\n";
                break;
        }
        echo GLOBALMSG_RECORD_DELETE_OK_FROM_LOG_MANY_2 . ".<br><br>";
        echo "<form name=\"form1\" action=\"receipt.php\" method=\"post\">\n";
        echo "<input type=\"hidden\" name=\"command\" value=\"delete\">\n";
        echo "<input type=\"hidden\" name=\"delete[" . $id . "]\" value=\"1\">\n";
        echo "<input type=\"submit\" value=\"" . GLOBALMSG_RECORD_DELETE . "\">";
        echo "</form>\n";
        return 0;
    }
    $table = 'account_log';
    $query = "SELECT * FROM {$table} WHERE `payment`='{$id}'";
    $res = mysql_db_query($_SESSION['common_db'], $query);
    if (!mysql_num_rows($res)) {
        return 2;
    }
    echo "<table bgcolor=\"" . color(-1) . "\">\n";
    echo "<thead ><tr>\n\t<td>" . ucfirst(phr('QUANTITY')) . "</a></td>\n\t<td>" . ucfirst(phr('DESCRIPTION')) . "</td>\n\t<td>" . ucfirst(phr('AMOUNT')) . "</td>\n\t</tr></thead>\n\t<tbody>\n";
    $i = 0;
    while ($row = mysql_fetch_array($res)) {
        if ($row['operation'] == 1) {
            $ingred = new ingredient($row['ingredient']);
            $description = "    " . ucphr('PLUS') . " " . $ingred->name($_SESSION['language']);
            unset($ingred);
        } elseif ($row['operation'] == -1) {
            $ingred = new ingredient($row['ingredient']);
            $description = "    " . ucphr('MINUS') . " " . $ingred->name($_SESSION['language']);
            unset($ingred);
        } else {
            $dish = new dish($row['dish']);
            $description = $dish->name($_SESSION['language']);
            unset($dish);
        }
        $total += $row['price'];
        $color = color($i);
        echo '<tr bgcolor="', $color, '">
		<td>', $row['quantity'], '</td>
		<td>', $description, '</td>
		<td align="right">', $row['price'], '</td>
		</tr>
		';
        $i++;
    }
    echo '<tr bgcolor="', color(-1), '">
	<td></td>
	<td>' . ucfirst(phr('TOTAL')) . '</td>
	<td align="right">', sprintf("%0.2f", $total), '</td>
	</tr>
	';
    echo "</tbody></table>";
    echo "<form name=\"form1\" action=\"receipt.php\" method=\"post\">\n";
    echo "<input type=\"hidden\" name=\"command\" value=\"delete\">\n";
    echo "<input type=\"hidden\" name=\"delete[" . $id . "]\" value=\"1\">\n";
    echo "<input type=\"submit\" value=\"" . GLOBALMSG_RECORD_DELETE . "\">";
    echo "</form>\n";
    echo "<form name=\"form1\" action=\"receipt.php\" method=\"post\">\n";
    echo "<input type=\"hidden\" name=\"command\" value=\"annul\">\n";
    echo "<input type=\"hidden\" name=\"annul[" . $id . "]\" value=\"1\">\n";
    echo "<input type=\"submit\" value=\"" . ucphr('ANNULL') . "\">";
    echo "</form>\n";
}
示例#23
0
function bill_reset_confirm_pos()
{
    global $tpl;
    $tpl->set_waiter_template_file('question');
    $tmp = navbar_form_pos('form1', 'orders.php?command=printing_choose');
    $tpl->assign('navbar', $tmp);
    $tmp = ucfirst(phr('RESET_SEPARATED_EXPLAIN')) . '
		<br>
		<br><br>

	<FORM ACTION="orders.php" METHOD=POST name="form1">
	<INPUT TYPE="HIDDEN" NAME="command" VALUE="bill_reset">
	<INPUT TYPE="checkbox" name="reset" value="1">
	' . ucfirst(phr('RESET_SEPARATED')) . '<br><br>
	</FORM>
	';
    $tpl->assign('question', $tmp);
    return 0;
}
function main_header($to_page = "index.php")
{
    require "./mgmt_start.php";
    $start_date_local = get_text_start_date();
    $end_date_local = get_text_end_date();
    $start_hour_local = get_text_start_hour();
    $start_minute_local = get_text_start_minute();
    $end_hour_local = get_text_end_hour();
    $end_minute_local = get_text_end_minute();
    ?>
<center><form action="<?php 
    echo $to_page;
    ?>
" method="GET" name="time_range">
<table>
<tr valign="middle">
<td align="right"><?php 
    echo ucfirst(GLOBALMSG_REPORT_PERIOD);
    ?>
</td>
	<td align="left">
		<input type="hidden" name="formdata" value="true">
		<input type="text" id="f_date_a" name="date_start" value="<?php 
    echo $start_date_local;
    ?>
" size="14" maxlength="10">
		<input type="text" name="hour_start" value="<?php 
    echo $start_hour_local;
    ?>
" size="2" maxlength="2">:<input type="text" name="minute_start" value="<?php 
    echo $start_minute_local;
    ?>
" size="2" maxlength="2">
		<input type="text" id="f_date_b" name="date_end" value="<?php 
    echo $end_date_local;
    ?>
" size="14" maxlength="10">
		<input type="text" name="hour_end" value="<?php 
    echo $end_hour_local;
    ?>
" size="2" maxlength="2">:<input type="text" name="minute_end" value="<?php 
    echo $end_minute_local;
    ?>
" size="2" maxlength="2">
	</td>
	
<script type="text/javascript">
    function catcalc(cal) {
        var date = cal.date;
        var time = date.getTime()
        // use the _other_ field
        var field = document.getElementById("f_date_b");
        if (field == cal.params.inputField) {
            field = document.getElementById("f_date_a");
            time -= Date.DAY; // substract one week
        } else {
            time += Date.DAY; // add one week
        }
        var date2 = new Date(time);
        field.value = date2.print("%d/%m/%Y");
    }
    Calendar.setup({
        inputField     :    "f_date_a",   // id of the input field
        ifFormat       :    "%d/%m/%Y",       // format of the input field
       // showsTime      :    true,
        timeFormat     :    "24",
	weekNumbers : false,
	step:1,
	firstDay : 1
      //  onUpdate       :    catcalc
    });
    Calendar.setup({
        inputField     :    "f_date_b",
        ifFormat       :    "%d/%m/%Y",       // format of the input field
//        ifFormat       :    "%Y-%m-%d %H:%M",
        //showsTime      :    true,
        timeFormat     :    "24",
	weekNumbers : false,
	step:1,
	firstDay : 1
     //   onUpdate       :    catcalc
    });
</script>

	
	<td><?php 
    echo GLOBALMSG_REPORT_ACCOUNT;
    ?>
</td>
	<td align="left">
<?php 
    $checked = "";
    if (mysql_list_tables($arr['db']) && $_SESSION['common_db'] == $arr['db']) {
        $checked = " checked";
    }
    if (mysql_list_tables($arr['db'])) {
        if ($account == $arr['db']) {
            $checked = " checked";
        }
        echo '<input type="radio" onClick="JavaScript:document.time_range.submit();" name="mgmt_db_number" value="' . $arr['db'] . '"' . $checked . '>' . $arr['name'] . ' ' . "\n";
    }
    ?>
	</td>
<td ><input type="submit" value="<?php 
    echo ucfirst(phr('REPORT_GENERATE'));
    ?>
"></td>
</tr>
</table></form></center>

<?php 
}
示例#25
0
     } elseif ($num == 0) {
         // found none
         $tmp = '<b><font color="Red">' . ucfirst(phr('ERROR_NONE_FOUND')) . "</font></b><br>\n";
         $tpl->append('messages', $tmp);
         //orders_list_pos();
         //gjergji : remove it or not ?!
         //orders_list_pos (true);
         break;
     } else {
         // found one, we directly assume that's the dish the user wanted
         $dishid = $num;
     }
 }
 $dish = new dish($dishid);
 if (!$dish->exists()) {
     $tmp = '<script>$.growl("' . ucphr("Information") . '","<b><font color=\\"Red\\">' . ucfirst(phr('DISH_DOES_NOT_EXIST')) . '</font>","' . IMAGE_ERROR . '")</script>';
     $tpl->append('messages', $tmp);
     //orders_list_pos ();
     orders_list_pos(true);
     break;
 }
 //create the order removing the quantity from the stock
 if ($dishid) {
     $id = orders_create($dishid, $start_data);
 }
 if ($id) {
     $err = 0;
 } else {
     $err = ERR_UNKNOWN;
 }
 status_report('CREATION', $err);