Exemple #1
0
*	 GPL v2 or above
*
* Website:
* 	http://www.simpleinvoices.org
*/
checkLogin();
$smarty->display("../templates/default/menu.tpl");
$smarty->display("../templates/default/main.tpl");
echo <<<EOD
\t<div>
\t<form action="index.php?module=customers&view=search" method="post">
\t<input type="text" name="name" />
\t<input type="submit" value="Search">
\t</form>
EOD;
$customers = searchCustomers($_POST['name']);
echo "<table> <br />";
foreach ($customers as $customer) {
    echo <<<EOD
\t\t
\t\t<tr>
\t\t\t<td>{$customer['name']}&nbsp;&nbsp;</td>
\t\t\t<td><a href="index.php?module=invoices&view=itemised&customer_id={$customer['id']}">Itemised</a> |</td> 
\t\t\t<td><a href="index.php?module=invoices&view=consulting&customer_id={$customer['id']}">&nbsp;Consulting</a> |</td> 
\t\t\t<td><a href="index.php?module=invoices&view=total&customer_id={$customer['id']}">&nbsp;Total</a></td> 
\t\t</tr>
EOD;
}
echo "</table></div>";
//getMenuStructure();
exit;
Exemple #2
0
function printlistofCustomers($Terms, $AID)
{
    $array = searchCustomers($Terms);
    $arrayN = count($array);
    $Viewable = getPermittedIndexV($AID);
    $Editable = getPermittedIndexE($AID);
    $EN = count($Editable);
    $VN = count($Viewable);
    echo "<div class='SearchResults'>";
    echo "<table><tr>";
    for ($v = 0; $v < $VN; $v++) {
        $v++;
        echo "<td>{$Viewable[$v]}</td>";
    }
    for ($x = 0; $x < $arrayN; $x++) {
        $CusID = $array[$x];
        $sql = "SELECT * FROM cusfields INNER JOIN cusindex ON cusfields.IndexID=cusindex.IDKey WHERE cusfields.CusID='{$array[$x]}'";
        $result = mysqli_query($conn, $sql);
        while ($row = $result->fetch_assoc()) {
            $indexID = $row["IndexID"];
            $view = 0;
            for ($x = 0; $x < $EN; $x++) {
                if ($indexID = $Editable[$x]) {
                    $view = 2;
                    $x = $EN;
                }
            }
            if ($view == 0) {
                for ($x = 0; $x < $VN; $x++) {
                    if ($indexID = $Viewable[$x]) {
                        $view = 1;
                        $x = $VN;
                    }
                }
            }
            if ($view > 0) {
            }
        }
    }
    echo "</div>";
}