コード例 #1
0
ファイル: index.php プロジェクト: phpsmith/IS4C
<p><i>Provided tax rates are used to create database views. As such,
descriptions should be DB-legal syntax (e.g., no spaces). A rate of
0% with ID 0 is automatically included. Enter exact values - e.g.,
0.05 to represent 5%.</i></p></td></tr>
<tr><td colspan=2>
<?php 
$rates = array();
if ($gotDBs == 2) {
    $sql = new \COREPOS\pos\lib\SQLManager(CoreLocal::get('localhost'), CoreLocal::get('DBMS'), CoreLocal::get('tDatabase'), CoreLocal::get('localUser'), CoreLocal::get('localPass'));
    if (CoreLocal::get('laneno') == 0 && CoreLocal::get('laneno') !== '') {
        // server-side rate table is in op database
        $sql = new \COREPOS\pos\lib\SQLManager(CoreLocal::get('localhost'), CoreLocal::get('DBMS'), CoreLocal::get('pDatabase'), CoreLocal::get('localUser'), CoreLocal::get('localPass'));
    }
    if ($sql->table_exists('taxrates')) {
        $ratesR = $sql->query("SELECT id,rate,description FROM taxrates ORDER BY id");
        while ($row = $sql->fetch_row($ratesR)) {
            $rates[] = array($row[0], $row[1], $row[2]);
        }
    }
}
echo "<table><tr><th>ID</th><th>Rate</th><th>Description</th></tr>";
foreach ($rates as $rate) {
    printf("<tr><td>%d</td><td><input type=text name=TAX_RATE[] value=\"%f\" /></td>\n        <td><input type=text name=TAX_DESC[] value=\"%s\" /></td></tr>", $rate[0], $rate[1], $rate[2]);
}
printf("<tr><td>(Add)</td><td><input type=text name=TAX_RATE[] value=\"\" /></td>\n    <td><input type=text name=TAX_DESC[] value=\"\" /></td></tr></table>");
?>
</td></tr><tr><td colspan=2 class="submitBtn">
<input type=submit value="Save &amp; Re-run installation checks" />
</form>
</td></tr>
</table>