当前位置: 首页>>代码示例>>PHP>>正文


PHP db_Connect函数代码示例

本文整理汇总了PHP中db_Connect函数的典型用法代码示例。如果您正苦于以下问题:PHP db_Connect函数的具体用法?PHP db_Connect怎么用?PHP db_Connect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了db_Connect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

function update($_POST)
{
    # Get Vars ( banked[] )
    extract($_POST);
    # check if anything is selected
    if (!isset($banked)) {
        $err = "<li class='err'> Please Select at least one entry to update.";
        return cashbook($_POST, $err);
    }
    /* - Start Hooks - */
    $vatacc = gethook("accnum", "salesacc", "name", "VAT");
    /* - End Hooks - */
    $refnum = getrefnum();
    /*refnum*/
    db_conn('core');
    $rid = pglib_lastid("save_bank_recon", "id");
    $rid++;
    # Record all trans
    foreach ($banked as $key => $cashid) {
        # Connect to database
        db_Connect();
        $sql = "SELECT * FROM cashbook WHERE cashid='{$cashid}' AND div = '" . USER_DIV . "'";
        $cashRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve details from database.", SELF);
        $cash = pg_fetch_array($cashRslt);
        # Set record as banked
        db_connect();
        $sql = "UPDATE cashbook SET banked = 'yes',rid='{$rid}' WHERE cashid='{$cashid}' AND div = '" . USER_DIV . "'";
        $Rslt = db_exec($sql) or errDie("Unable to set bank deposit as banked in Cubit.", SELF);
    }
    // Connect to database
    db_connect();
    $sql = "SELECT * FROM cashbook WHERE bankid = '{$bankid}' AND banked = 'no' AND div = '" . USER_DIV . "' ORDER BY date DESC";
    $cashRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve bank transactions from database.", SELF);
    $sql = "SELECT * FROM bankacct WHERE bankid= '{$bankid}' AND div = '" . USER_DIV . "'";
    $bankRslt = db_exec($sql);
    $bank = pg_fetch_array($bankRslt);
    $cur = CUR;
    $amtd = "amount";
    if ($bank['btype'] == 'int') {
        $currs = getSymbol($bank['fcid']);
        $cur = $currs['symbol'];
        $amtd = "famount";
    }
    $tot = 0;
    $totr = 0;
    $totp = 0;
    $recpts = "";
    $paymnts = "";
    while ($cash = pg_fetch_array($cashRslt)) {
        if ($cash['trantype'] == "deposit") {
            $recpts .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{$cash['date']}</td>\n\t\t\t\t\t<td>{$cash['descript']}</td>\n\t\t\t\t\t<td align='right'>{$cur} {$cash[$amtd]}</td>\n\t\t\t\t</tr>";
            $totr += $cash[$amtd];
        } else {
            $paymnts .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{$cash['date']}</td>\n\t\t\t\t\t<td>{$cash['descript']}</td>\n\t\t\t\t\t<td align='right'>{$cur} {$cash[$amtd]}</td>\n\t\t\t\t</tr>";
            $totp += $cash[$amtd];
        }
        $tot += $cash[$amtd];
    }
    $reconbal = sprint($cbal + ($totr - $totp));
    # get hook account number
    core_connect();
    $sql = "SELECT * FROM bankacc WHERE accid = '{$bankid}' AND div = '" . USER_DIV . "'";
    $rslt = db_exec($sql) or errDie("Unable to retrieve bank account link from Cubit", SELF);
    # check if link exists
    if (pg_numrows($rslt) < 1) {
        return "<li class='err'> ERROR : The bank account that you selected doesn't appear to have an account linked to it.";
    }
    $banklnk = pg_fetch_array($rslt);
    # Get bank balance
    $sql = "SELECT (debit - credit) as bal FROM trial_bal WHERE period='12' AND accid = '{$banklnk['accnum']}' AND div = '" . USER_DIV . "'";
    $brslt = db_exec($sql) or errDie("Unable to retrieve bank account link from Cubit", SELF);
    $bal = pg_fetch_array($brslt);
    if ($bank['btype'] == 'int') {
        $bal['bal'] = $bank['fbalance'];
    }
    $diff = sprint($reconbal - $bal['bal']);
    $derr = "";
    if ($diff != 0) {
        $derr = "\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><b class='err'>Bank statement and computer balance not balancing by</b></td>\n\t\t\t\t<td align='right'>{$cur} {$diff}</td>\n\t\t\t</tr>";
    }
    $totp = sprint($totp);
    // Layout
    $update = "\n\t\t<center>\n\t\t<h3>Bank Reconciliation Output</h3>\n\t\t<form action='" . SELF . "' method='POST' name='form1'>\n\t\t\t<input type='hidden' name='key' value='save'>\n\t\t\t<input type='hidden' name='bankid' value='{$bankid}'>\n\t\t<table cellpadding='2' cellspacing='0' border=0 bordercolor='#000000' width='80%'>\n\t\t\t<tr>\n\t\t\t\t<td colspan='10'>\n\t\t\t\t\t<table cellpadding='2' cellspacing='0' border=0 bordercolor='#000000' width=100%>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><b>Bank Account : </b>{$bank['accname']}</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td align='right'><b>Prepared By : </b>" . USER_NAME . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><b>Closing Balance As per Bank Statement : </b>{$cur} {$cbal}</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr><td><br><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<td><b>Plus Outstanding Receipts :</b></td>\n\t\t\t</tr>\n\t\t\t<!--<tr><th>Date</th><th>Reference</th><th>Amount</th></tr>-->\n\t\t\t{$recpts}\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><br></td>\n\t\t\t\t<td align='right'>____________</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' align='right'><b>Sub Total</b></td>\n\t\t\t\t<td align='right'>{$cur} {$totr}</td>\n\t\t\t</tr>\n\t\t\t<tr><td><br><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<td><b>Less Outstanding Payments :</b></td>\n\t\t\t</tr>\n\t\t\t<!--<tr><th>Date</th><th>Reference</th><th>Amount</th></tr>-->\n\t\t\t{$paymnts}\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><br></td>\n\t\t\t\t<td align='right'>____________</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' align='right'><b>Sub Total</b></td>\n\t\t\t\t<td align='right'>{$cur} {$totp}</td>\n\t\t\t</tr>\n\t\t\t<tr><td><br><td></tr>\n\t\t\t{$derr}\n\t\t\t<tr><td><br><td></tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><br></td>\n\t\t\t\t<td align='right'>____________</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><b>Reconciled Bank Balance</b></td>\n\t\t\t\t<td align='right'>{$cur} {$reconbal}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><b>Computer Bank Balance</b></td>\n\t\t\t\t<td align='right'>{$cur} {$bal['bal']}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><br></td>\n\t\t\t\t<td align='right'>____________</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><b>Diff</b></td>\n\t\t\t\t<td align='right'>{$cur} {$diff}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><br></td>\n\t\t\t\t<td align='right'>____________</td>\n\t\t\t</tr>";
    $upcode = base64_encode($update);
    $button = "</table></form>";
    core_connect();
    $gendate = date("Y-m-d");
    $sql = "\n\t\tINSERT INTO save_bank_recon (\n\t\t\tbankid, gendate, recon, div\n\t\t) VALUES (\n\t\t\t'{$bankid}', '{$gendate}', '{$upcode}', '" . USER_DIV . "'\n\t\t)";
    $saveRslt = db_exec($sql) or errDie("Unable to save bank recon to database", SELF);
    $update .= $button;
    $OUTPUT = $update;
    require "../tmpl-print.php";
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:93,代码来源:bank-recon.php

示例2: printcheq

function printcheq()
{
    // Set up table to display in
    $OUTPUT = "<h3>View Cheque Records</h3>\r\n        <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n        <form action='../bank/bank-bankall.php' method=post>\r\n        <tr><th>Bank Name</th><th>Account Name</th><th>Date</th><th>Paid to/Received from</th><th>Description</th><th>Transaction Type</th><th>Amount</th><th>Account paid<br>/received from</th></tr>";
    // Connect to database
    db_Connect();
    $sql = "SELECT * FROM cashbook WHERE cheqnum > 0 and banked='no' AND div = '" . USER_DIV . "' ORDER BY date DESC";
    $accntRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve bank cheqque transaction details from database.", SELF);
    $numrows = pg_numrows($accntRslt);
    if ($numrows < 1) {
        $OUTPUT = "<li class=err> There are no outstanding bank cheque Records yet in Cubit.";
        require "../template.php";
    }
    # display all bank cheques
    for ($i = 0; $i < $numrows; $i++) {
        $accnt = pg_fetch_array($accntRslt, $i);
        # get account name for account involved
        $accRslt = get("core", "accname", "accounts", "accid", $accnt['accinv']);
        $acc = pg_fetch_array($accRslt);
        # get account name for bank account
        db_connect();
        $sql = "SELECT accname,bankname  FROM bankacct WHERE bankid= '{$accnt['bankid']}' AND div = '" . USER_DIV . "'";
        $bankRslt = db_exec($sql);
        $bank = pg_fetch_array($bankRslt);
        $OUTPUT .= "<tr class='" . bg_class() . "'><td>{$bank['bankname']}</td><td align=center>{$bank['accname']}</td><td align=center>{$accnt['date']}</td><td align=center>{$accnt['name']}</td><td>{$accnt['descript']}</td><td align=center>{$accnt['trantype']}</td><td align=center>" . CUR . " {$accnt['amount']}<td align=center>{$acc['accname']}</td></td>";
        if ($accnt['banked'] == "no") {
            $OUTPUT .= "<td><input type=checkbox name='bank[]' value='{$accnt['cashid']}'>&nbsp;<a href='../bank/bank-bank.php?cashid={$accnt['cashid']}'>Bank</td><td><a href='../bank/cheq-cancel.php?cashid={$accnt['cashid']}'>Cancel</td></tr>";
        } else {
            $OUTPUT .= "</tr>";
        }
    }
    $OUTPUT .= "<tr><td colspan=8><br></td><td colspan=2><input type=submit value='Bank all selected'></td></tr></form></table>";
    // all template to display the info and die
    require "../template.php";
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:35,代码来源:out-cheq.php

示例3: theme_AddMyIdeaWithLimit

function theme_AddMyIdeaWithLimit($idea, $node, $user, $limit)
{
    db_Connect();
    // Only because we're doing native DB ops, call connect //
    global $db;
    $db->begin_transaction();
    $count = 0;
    try {
        $count = theme_CountMyIdeas($node, $user, " FOR UPDATE");
        if ($count === false) {
            throw new Exception();
        }
        if ($count >= $limit) {
            throw new Exception();
        }
        $result = db_DoInsert("INSERT INTO " . CMW_TABLE_THEME_IDEA . " (\n\t\t\t\ttheme, node, user, `timestamp`\n\t\t\t)\n\t\t\tVALUES ( \n\t\t\t\t?, ?, ?, NOW()\n\t\t\t)", $idea, $node, $user);
        if (empty($result)) {
            throw new Exception();
        }
        $count = theme_CountMyIdeas($node, $user);
        if ($count === false) {
            throw new Exception();
        }
        if ($count > $limit) {
            throw new Exception();
        }
        // We're good! Commit! We're finished //
        $db->commit();
        return ["id" => $result, "count" => $count];
    } catch (Exception $ex) {
        // Bad! Do a rollback! //
        $db->rollback();
        return ["id" => 0, "count" => $count];
    }
}
开发者ID:LastResortGames,项目名称:ludumdare,代码行数:35,代码来源:theme.php

示例4: confirm

function confirm($cashid)
{
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($cashid, "num", 1, 20, "Invalid Reference number.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class=err>" . $e["msg"];
        }
        $confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    # Connect to database
    db_Connect();
    $sql = "SELECT * FROM pettycashbook WHERE cashid = '{$cashid}' AND div = '" . USER_DIV . "'";
    $cashRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve cashbook entry details from database.", SELF);
    if (pg_numrows($cashRslt) < 1) {
        $OUTPUT = "<li clss=err>Requisistion not found in Cubit.";
        return $OUTPUT;
    }
    $cash = pg_fetch_array($cashRslt);
    # Get account name for the account involved
    $accRslt = get("core", "accname,accnum,topacc", "accounts", "accid", $cash['accid']);
    $acc = pg_fetch_array($accRslt);
    // Layout
    $confirm = "<h3>Cancel Requisistion</h3>\r\n\t<h4>Confirm entry</h4>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<form action='" . SELF . "' method=post>\r\n\t<input type=hidden name=key value=cancel>\r\n\t<input type=hidden name=cashid value='{$cash['cashid']}'>\r\n\t<tr><th>Field</th><th>Value</th></tr>\r\n\t<tr class='bg-odd'><td>Date</td><td>{$cash['date']}</td></tr>\r\n\t<tr class='bg-even'><td>Paid to</td><td>{$cash['name']}</td></tr>\r\n\t<tr class='bg-odd'><td>Details</td><td><pre>{$cash['det']}</pre></td></tr>\r\n\t<tr class='bg-even'><td>Amount</td><td>" . CUR . " {$cash['amount']}</td></tr>\r\n\t<tr class='bg-odd'><td>Account</td><td>{$acc['topacc']}/{$acc['accnum']} - {$acc['accname']}</td></tr>\r\n\t<tr><td><br></td></tr>\r\n\t<tr><td\t><input type=button value='&laquo Back' onClick='javascript:history.back()'></td><td align=right><input type=submit value='Cancel &raquo'></td></tr>\r\n\t</table></form>\r\n\t<p>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=15%>\r\n\t\t<tr><th>Quick Links</th></tr>\r\n\t\t<tr class='bg-odd'><td><a href='pettycashbook-view.php'>View Petty Cash Requisitions</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t</table>";
    return $confirm;
}
开发者ID:kumarsivarajan,项目名称:accounting-123,代码行数:32,代码来源:petty-req-can.php

示例5: _config_Load

function _config_Load()
{
    $ret = cache_Fetch(_CONFIG_CACHE_KEY);
    if ($ret === null) {
        db_Connect();
        $ret = db_DoFetchPair("SELECT `key`,`value` FROM " . CMW_TABLE_CONFIG . "\n\t\t\tWHERE id IN (\n\t\t\t\tSELECT MAX(id) FROM " . CMW_TABLE_CONFIG . " GROUP BY `key`\n\t\t\t);");
        cache_Store(_CONFIG_CACHE_KEY, $ret, _CONFIG_CACHE_TTL);
    }
    return $ret;
}
开发者ID:LastResortGames,项目名称:ludumdare,代码行数:10,代码来源:config.php

示例6: confirm

function confirm($_POST)
{
    # Get Vars ( banked[] )
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    # check if anything is selected
    if (!isset($bank)) {
        return "<li class=err> Please Select at least one entry to proccess.";
    }
    $OUTPUT = "<h3>Process Multiple Entries</h3>\r\n        <h4>Confirm Selection</h4>\r\n        <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n        <form action='" . SELF . "' method=post>\r\n        <input type=hidden name=key value=bank>\r\n        <tr><th>Bank Name</th><th>Account Name</th><th>Date</th><th>Reference No</th><th>Paid to/Received from<th>Description</th><th>Transaction Type</th><th>Amount</th><th>Account paid/received from</th></tr>";
    $refnum = getrefnum();
    /*refnum*/
    # get ifo for each deposit
    $tot = 0;
    foreach ($bank as $key => $cashid) {
        // Connect to database
        db_Connect();
        $sql = "SELECT * FROM cashbook WHERE cashid='{$cashid}'";
        $cashRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve details from database.", SELF);
        $numrows = pg_numrows($cashRslt);
        # display all bank Deposits
        for ($i = 0; $i < $numrows; $i++) {
            $cash = pg_fetch_array($cashRslt, $i);
            # Get account name for account involved
            $accRslt = get("core", "accname", "accounts", "accid", $cash['accinv']);
            $acc = pg_fetch_array($accRslt);
            # get account name for bank account
            db_connect();
            $sql = "SELECT accname, bankname FROM bankacct WHERE bankid = '{$cash['bankid']}'";
            $bankRslt = db_exec($sql);
            $bank = pg_fetch_array($bankRslt);
            $OUTPUT .= "<input type=hidden name=bank[] value='{$cashid}'><tr class='" . bg_class() . "'><td>{$bank['bankname']}</td><td align=center>{$bank['accname']}</td>\r\n                        <td align=center><input type=text size=2 name=day[] maxlength=2 value='" . date("d") . "'>-<input type=text size=2 name=mon[] maxlength=2 value='" . date("m") . "'>-<input type=text size=4 name=year[] maxlength=4 value='" . date("Y") . "'></td>\r\n                        <td align=center><input type=text size=7 name=refnum[] value='" . $refnum++ . "'></td><td align=center>{$cash['name']}</td><td align=center>{$cash['descript']}</td><td align=center>{$cash['trantype']}</td>\r\n                        <td align=right>" . CUR . " {$cash['amount']}</td><td align=center>{$acc['accname']}</td></tr>";
            $tot = $cash['amount'];
        }
    }
    $OUTPUT .= "<tr class='bg-even'><td colspan=7><b>Total Outstanding</b></td><td colspan=2><b>" . CUR . " {$tot}</b></td></tr>\r\n        \t\t\t<tr><td colspan=8><br></td><td><input type=submit value='Confirm'></td></tr></form></table>";
    return $OUTPUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:39,代码来源:bank-bankall.php

示例7: bank

function bank($_POST)
{
    # Get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($cashid, "num", 1, 4, "Invalid Reference number.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    # Get cash book record
    Db_Connect();
    $sql = "SELECT * FROM cashbook WHERE cashid = '{$cashid}' AND div = '" . USER_DIV . "'";
    $accntRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve cashbook entry details from database11.", SELF);
    if (pg_numrows($accntRslt) < 1) {
        $OUTPUT = "<li clss='err'>The entry with reference number, <b>{$cashid}</b> was not found in Cubit.</li>";
        return $OUTPUT;
    }
    $accnt = pg_fetch_array($accntRslt);
    # get hook account number
    core_connect();
    $sql = "SELECT * FROM bankacc WHERE accid = '{$accnt['bankid']}' AND div = '" . USER_DIV . "'";
    $rslt = db_exec($sql) or errDie("Unable to retrieve bank account link from Cubit", SELF);
    # check if link exists
    if (pg_numrows($rslt) < 1) {
        return "<li class='err'> ERROR : The bank account that you selected doesn't appear to have an account linked to it.</li>";
    }
    $bank = pg_fetch_array($rslt);
    # Date
    $sdate = date("Y-m-d");
    # If tis customer payment
    if ($accnt['cusnum'] > 0) {
        db_connect();
        # Get invoice Ids and Amounts
        $invids = explode("|", $accnt['rinvids']);
        $amounts = explode("|", $accnt['amounts']);
        $invprds = explode("|", $accnt['invprds']);
        $rages = explode("|", $accnt['rages']);
        # Return the amount that was surppose to be paid to invoices
        foreach ($invids as $key => $invid) {
            db_connect();
            # Skip all nulls and check existance
            if ($invids[$key] > 0 && ext_ex("invoices", "invid", $invids[$key]) && $invprds[$key] != 0) {
                db_connect();
                $sql = "UPDATE invoices SET balance = (balance + '{$amounts[$key]}'::numeric(13,2)) WHERE invid = '{$invids[$key]}' AND div = '" . USER_DIV . "'";
                $payRslt = db_exec($sql) or errDie("Unable to update Invoice information in Cubit.", SELF);
            } elseif ($invids[$key] > 0 && ext_ex("nons_invoices", "invid", $invids[$key]) && $invprds[$key] == 0) {
                db_connect();
                $sql = "UPDATE nons_invoices SET balance = (balance + '{$amounts[$key]}'::numeric(13,2)) WHERE invid = '{$invids[$key]}' AND div = '" . USER_DIV . "'";
                $payRslt = db_exec($sql) or errDie("Unable to update Invoice information in Cubit.", SELF);
                custDTA($amounts[$key], $accnt['cusnum'], $rages[$key]);
            } elseif ($invids[$key] > 0) {
                db_conn($invprds[$key]);
                # check if invoice exitsts on prd
                if (ext_ex("invoices", "invid", $invids[$key])) {
                    # if found, Move the invoice back
                    if (moveback($invids[$key], $invprds[$key], $amounts[$key])) {
                    }
                }
            }
        }
        # Begin updates
        pglib_transaction("BEGIN") or errDie("Unable to start a database transaction.", SELF);
        db_connect();
        # Update the customer (make balance more)
        $sql = "UPDATE customers SET balance = (balance + '{$accnt['amount']}'::numeric(13,2)) WHERE cusnum = '{$accnt['cusnum']}' AND div = '" . USER_DIV . "'";
        $rslt = db_exec($sql) or errDie("Unable to update invoice in Cubit1.", SELF);
        # Record the transaction on the statement
        $sql = "\n\t\t\t\tINSERT INTO stmnt \n\t\t\t\t\t(cusnum, invid, amount, date, type, div, allocation_date) \n\t\t\t\tVALUES('{$accnt['cusnum']}', '0', '{$accnt['amount']}','{$sdate}', 'Cheque/Payment for Invoices Cancelled.', '" . USER_DIV . "', '{$accnt['date']}')";
        $stmntRslt = db_exec($sql) or errDie("Unable to insert statement record in Cubit.", SELF);
        # Delete cashbook ID
        $sql = "DELETE FROM cashbook WHERE cashid='{$cashid}' AND div = '" . USER_DIV . "'";
        $Rslt = db_exec($sql) or errDie("Unable to cancel cheque.", SELF);
        if ($accnt['lcashid'] > 0) {
            // Connect to database
            db_Connect();
            $sql = "SELECT * FROM cashbook WHERE cashid = '{$accnt['lcashid']}' AND div = '" . USER_DIV . "'";
            $laccntRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve cashbook entry details from database.2", SELF);
            $laccnt = pg_fetch_array($laccntRslt);
            $sql = "UPDATE bankacct SET fbalance = (fbalance + '{$laccnt['famount']}'::numeric(13,2)), balance = (balance + '{$laccnt['amount']}'::numeric(13,2)) WHERE bankid = '{$laccnt['bankid']}'";
            $rslt = db_exec($sql) or errDie("Unable to update invoice in Cubit2.", SELF);
            # Delete cashbook ID
            $sql = "DELETE FROM cashbook WHERE cashid = '{$accnt['lcashid']}' AND div = '" . USER_DIV . "'";
            $Rslt = db_exec($sql) or errDie("Unable to cancel cheque.", SELF);
        }
        # Commit updates
        pglib_transaction("COMMIT") or errDie("Unable to commit a database transaction.", SELF);
        # Make ledge record
        custledger($accnt['cusnum'], $bank['accnum'], $sdate, "cancel", "Payment for Invoices Cancelled.", $accnt['amount'], "d");
        $descript = $accnt['descript'] . " Cancelled";
        $refnum = getrefnum();
        $date = date("Y-m-d");
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:cheq-cancel.php

示例8: printaccnt

function printaccnt()
{
    // Set up table to display in
    $OUTPUT = "\n\t\t<center>\n\t\t<h3>View Bank Accounts</h3></td>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Account Type</th>\n\t\t\t\t<th>Bank Name</th>\n\t\t\t\t<th>Type</th>\n\t\t\t\t<th>Currency</th>\n\t\t\t\t<th>Branch Name</th>\n\t\t\t\t<th>Branch Code</th>\n\t\t\t\t<th>Account Name</th>\n\t\t\t\t<th>Account Number</th>\n\t\t\t\t<th>Foreign Balance</th>\n\t\t\t\t<th>Local Currency</th>\n\t\t\t\t<th>Details</th>\n\t\t\t\t<th colspan='2'>Options</th>\n\t\t\t</tr>";
    # Connect to database
    db_Connect();
    $sql = "SELECT * FROM bankacct WHERE div = '" . USER_DIV . "' ORDER BY bankname,branchname";
    $bankRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve bank account details from database.", SELF);
    $numrows = pg_numrows($bankRslt);
    if ($numrows < 1) {
        $OUTPUT = "No Bank Accounts.";
        require "../template.php";
    }
    # Locations drop down
    $locs = array("loc" => "Local", "int" => "International");
    # display all orders
    for ($i = 0; $i < $numrows; $i++) {
        $bankacc = pg_fetch_array($bankRslt, $i);
        if ($bankacc['fcid'] != 0) {
            $curr = getSymbol($bankacc['fcid']);
        } else {
            $curr = 0;
            $locs[$bankacc['btype']] = "Local";
        }
        $type = $locs[$bankacc['btype']];
        # Get hook account number
        core_connect();
        $sql = "SELECT * FROM bankacc WHERE accid = '{$bankacc['bankid']}' AND div = '" . USER_DIV . "'";
        $rslt = db_exec($sql) or errDie("Unable to retrieve bank account link from Cubit", SELF);
        # Check if link exists
        if (pg_numrows($rslt) < 1) {
            return "<li class='err'>ERROR : The bank account that you selected doesn't appear to have an account linked to it.";
        }
        $banklnk = pg_fetch_array($rslt);
        # Get bank balance
        $sql = "SELECT (debit - credit) as bal FROM core.trial_bal\n\t\t\t\tWHERE accid = '{$banklnk['accnum']}' AND period='12' AND div = '" . USER_DIV . "'";
        $brslt = db_exec($sql) or errDie("Unable to retrieve bank account link from Cubit", SELF);
        $bal = pg_fetch_array($brslt);
        $fbal = $bankacc['btype'] == 'int' ? "{$curr['symbol']} {$bankacc['fbalance']}" : "<center> - </center>";
        $lbal = $bankacc['btype'] == 'int' ? CUR . " {$bankacc['balance']}" : CUR . " " . sprint($bal['bal']);
        # alternate bgcolor
        $bgColor = bgcolorc($i);
        $OUTPUT .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$bankacc['acctype']}</td>\n\t\t\t\t<td>{$bankacc['bankname']}</td>\n\t\t\t\t<td>{$type}</td>\n\t\t\t\t<td>{$curr['symbol']} - {$curr['name']}</td>\n\t\t\t\t<td>{$bankacc['branchname']}</td>\n\t\t\t\t<td>{$bankacc['branchcode']}</td>\n\t\t\t\t<td>{$bankacc['accname']}</td>\n\t\t\t\t<td align='right'>{$bankacc['accnum']}</td>\n\t\t\t\t<td align='right'>{$fbal}</td>\n\t\t\t\t<td align='right'>{$lbal}</td>\n\t\t\t\t<td>{$bankacc['details']}</td>";
        if ($bankacc['type'] == 'cr') {
            $OUTPUT .= "<td><a href='creditcard-edit.php?bankid={$bankacc['bankid']}'>Edit</a></td>";
        } elseif ($bankacc['type'] == 'ptrl') {
            $OUTPUT .= "<td><a href='petrolcard-edit.php?bankid={$bankacc['bankid']}'>Edit</a></td>";
        } else {
            $OUTPUT .= "<td><a href='bankacct-edit.php?bankid={$bankacc['bankid']}'>Edit</a></td>";
        }
        db_connect();
        # Check if record can be removed
        $sql = "SELECT * FROM cashbook WHERE banked = 'no' AND bankid='{$bankacc['bankid']}' AND div = '" . USER_DIV . "'";
        $rs = db_exec($sql) or errDie("Unable to get cashbook entries.", SELF);
        if (pg_numrows($rs) > 0) {
            $OUTPUT .= "<td><br></td></tr>";
        } else {
            $OUTPUT .= "<td><a href='bankacct-rem.php?bankid={$bankacc['bankid']}'>Delete</a></td></tr>";
        }
    }
    $OUTPUT .= "\n\t\t</table>\n\t\t<p>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Quick Links</th>\n\t\t\t</tr>\n\t        <tr class='" . bg_class() . "'>\n\t        \t<td><a href='bank-pay-add.php'>Add Bank Payment</a></td>\n\t        </tr>\n\t        <tr class='" . bg_class() . "'>\n\t        \t<td><a href='bank-recpt-add.php'>Add Bank Receipt</a></td>\n\t        </tr>\n\t        <tr class='" . bg_class() . "'>\n\t        \t<td><a href='cashbook-view.php'>View Cash Book</a></td>\n\t        </tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><a href='../main.php'>Main Menu</a></td>\n\t\t\t</tr>\n\t\t</table>";
    require "../template.php";
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:63,代码来源:bankacct-view.php

示例9: write

function write($_POST)
{
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($bankid, "num", 1, 30, "Invalid Bank Account.");
    $v->isOk($from_day, "num", 1, 2, "Invalid Day for the 'From' date.");
    $v->isOk($from_month, "num", 1, 2, "Invalid month for the 'From' date..");
    $v->isOk($from_year, "num", 1, 4, "Invalid year for the 'From' date..");
    $v->isOk($to_day, "num", 1, 2, "Invalid Day for the 'To' date.");
    $v->isOk($to_month, "num", 1, 2, "Invalid month for the 'To' date..");
    $v->isOk($to_year, "num", 1, 4, "Invalid year for the 'To' date..");
    # lets mix the date
    $from = $from_day . "-" . $from_month . "-" . $from_year;
    $to = $to_day . "-" . $to_month . "-" . $to_year;
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    pglib_transaction("BEGIN") or errDie("Unable to start a database transaction.", SELF);
    # Get bank details
    $bankRslt = get("cubit", "accname,bankname,fcid", "bankacct", "bankid", $bankid);
    $bank = pg_fetch_array($bankRslt);
    $Sl = "SELECT * FROM currency WHERE fcid='{$bank['fcid']}'";
    $Ry = db_exec($Sl) or errDie("Unable to get currency");
    if (pg_numrows($Ry) > 0) {
        $curdata = pg_fetch_array($Ry);
        $fc = $curdata['symbol'];
    }
    $s1 = "";
    $s2 = "";
    $s3 = "";
    $s4 = "";
    $s5 = "";
    $order = "order by date desc, cheqnum asc";
    if (isset($order)) {
        if ($order == "order by date desc, cheqnum asc") {
            $s2 = "selected";
        } elseif ($order == "order by date desc, cheqnum desc") {
            $s3 = "selected";
        } elseif ($order == "order by cheqnum asc") {
            $s4 = "selected";
        } elseif ($order == "order by cheqnum desc") {
            $s5 = "selected";
        } else {
            $s1 = "selected";
        }
    } else {
        $s1 = "selected";
    }
    // Set up table to display in
    # Receipts
    $OUTPUT = "\n\t<center>\n\t<h3>Batch Cash Book Entries<br><br>Account : {$bank['accname']} - {$bank['bankname']}<br>Period : {$from} to {$to}</h3>\n\t<table " . TMPL_tblDflts . ">\n\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t<input type='hidden' name='key' value='viewcash'>\n\t\t<input type='hidden' name='bankid' value='{$bankid}'>\n\t\t<input type='hidden' name='from_day' value='{$from_day}'>\n\t\t<input type='hidden' name='from_month' value='{$from_month}'>\n\t\t<input type='hidden' name='from_year' value='{$from_year}'>\n\t\t<input type='hidden' name='to_day' value='{$to_day}'>\n\t\t<input type='hidden' name='to_month' value='{$to_month}'>\n\t\t<input type='hidden' name='to_year' value='{$to_year}'>\n\t</table>\n\t<p>\n\t<table " . TMPL_tblDflts . " width='95%'>\n\t\t<tr>\n\t\t\t<td colspan='7'><h4>Receipts</h4></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<th> Date</th>\n\t\t\t<th>Bank Account Name</th>\n\t\t\t<th>Cheque Number</th>\n\t\t\t<th>Received From : </th>\n\t\t\t<th>Description</th>\n\t\t\t<th>Ledger Account</th>\n\t\t\t<th>Amount</th>\n\t\t</tr>";
    $rtotal = 0;
    // Received total amount
    // Connect to database
    db_Connect();
    # date format
    $from = explode("-", $from);
    $from = $from[2] . "-" . $from[1] . "-" . $from[0];
    $to = explode("-", $to);
    $to = $to[2] . "-" . $to[1] . "-" . $to[0];
    $vatacc = gethook("accnum", "salesacc", "name", "VAT");
    # Get hook account number
    core_connect();
    $sql = "SELECT * FROM bankacc WHERE accid = '{$bankid}' AND div = '" . USER_DIV . "'";
    $rslt = db_exec($sql) or errDie("Unable to retrieve bank account link from Cubit", SELF);
    # Check if link exists
    if (pg_numrows($rslt) < 1) {
        return "<li class='err'> ERROR : The bank account that you selected doesn't appear to have an account linked to it.";
    }
    $banklnk = pg_fetch_array($rslt);
    db_Connect();
    $sql = "SELECT * FROM batch_cashbook WHERE  date >= '{$from}' AND date <= '{$to}' AND trantype='deposit' AND bankid='{$bankid}' AND div = '" . USER_DIV . "' {$order}";
    $accntRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve bank deposits details from database.", SELF);
    $numrows = pg_numrows($accntRslt);
    if ($numrows < 1) {
        //$OUTPUT .= "<tr><td colspan='7' align='center'><li class='err'>There are no batch Payments/cheques received for the selected period.</td></tr>";
    } else {
        for ($i = 0; $i < $numrows; $i++) {
            $accnt = pg_fetch_array($accntRslt, $i);
            if (!isset($pro[$accnt['cashid']])) {
                continue;
            }
            //	if($accnt['bt']=="receipt") {
            $refnum = getrefnum();
            if (strlen($accnt['accids']) > 0) {
                $accids = explode("|", $accnt['accids']);
                $vatcodes = explode("|", $accnt['vatcodes']);
                $amounts = explode("|", $accnt['amounts']);
                $vats = explode("|", $accnt['vats']);
                $chrgvats = explode("|", $accnt['chrgvats']);
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:batch-cashbook-view.php

示例10: printdep

function printdep($bankid)
{
    // Set up table to display in
    $OUTPUT = "\n\t\t\t<h3>Outstanding Payments</h3>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<form action='../bank/bank-bankall.php' method='POST'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Bank Name</th>\n\t\t\t\t\t<th>Account Name</th>\n\t\t\t\t\t<th>Date</th>\n\t\t\t\t\t<th>Paid to</th>\n\t\t\t\t\t<th>Description</th>\n\t\t\t\t\t<th>Transaction Type</th>\n\t\t\t\t\t<th>Amount</th>\n\t\t\t\t\t<th>Account</th>\n\t\t\t\t</tr>";
    // Connect to database
    db_Connect();
    $sql = "SELECT * FROM cashbook WHERE bankid = '{$bankid}' AND trantype = 'withdrawal' AND banked='no' AND div = '" . USER_DIV . "' ORDER BY date DESC";
    $accntRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve bank deposits details from database.", SELF);
    $numrows = pg_numrows($accntRslt);
    if ($numrows < 1) {
        $OUTPUT = "<li class='err'> There are no outstanding Bank Payment entries.</li>";
        return $OUTPUT;
    }
    # display all bank Deposits
    $tot = 0;
    for ($i = 0; $i < $numrows; $i++) {
        $accnt = pg_fetch_array($accntRslt, $i);
        if (strlen($accnt['accids']) > 0) {
            $acc['accname'] = "Multiple Accounts";
            $acc['accnum'] = "";
            $acc['topacc'] = "";
        } else {
            # get account name for the account involved
            $AccRslt = get("core", "accname", "accounts", "accid", $accnt['accinv']);
            $acc = pg_fetch_array($AccRslt);
        }
        /*
        # get account name for account involved
        $accRslt = get("core", "accname", "accounts", "accid", $accnt['accinv']);
        $acc = pg_fetch_array($accRslt);
        */
        # get account name for bank account
        db_connect();
        $sql = "SELECT accname,bankname FROM bankacct WHERE bankid= '{$accnt['bankid']}' AND div = '" . USER_DIV . "'";
        $bankRslt = db_exec($sql);
        $bank = pg_fetch_array($bankRslt);
        $accnt['amount'] = sprint($accnt['amount']);
        $OUTPUT .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>{$bank['bankname']}</td>\n\t\t\t\t\t\t<td align='center'>{$bank['accname']}</td>\n\t\t\t\t\t\t<td align='center'>{$accnt['date']}</td>\n\t\t\t\t\t\t<td align='center'>{$accnt['name']}</td>\n\t\t\t\t\t\t<td align='center'>{$accnt['descript']}</td>\n\t\t\t\t\t\t<td align='center'>{$accnt['trantype']}</td>\n\t\t\t\t\t\t<td align='right'>" . CUR . " {$accnt['amount']}</td>\n\t\t\t\t\t\t<td align='center'>{$acc['accname']}</td>";
        if ($accnt['banked'] == "no" && $accnt['opt'] != 'n') {
            $OUTPUT .= "\n\t\t\t\t\t\t<td><a href='../bank/cheq-return.php?cashid={$accnt['cashid']}'>Returned/Unpaid</td>";
            // $OUTPUT .= "<td><a href='../bank/cheq-cancel.php?cashid=$accnt[cashid]'>Cancel</td>";
        }
        $OUTPUT .= "</tr>";
        $tot += $accnt['amount'];
    }
    $tot = sprint($tot);
    $OUTPUT .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td colspan='6'><b>Total Outstanding</b></td>\n\t\t\t\t\t<td colspan='3'><b>" . CUR . " {$tot}</b></td>\n\t\t\t\t</tr>\n\t\t\t</form>\n\t\t\t</table>";
    // return OUTPUT
    return $OUTPUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:50,代码来源:not-banked.php

示例11: db_Connect

<?php

include_once './lib/db/db_connect.php.inc';
if (!isset($_GET['validacion'])) {
    echo "Error en el enlace de validación. Inténtelo de nuevo. Disculpe las molestias.";
} else {
    $db = db_Connect();
    $md5 = $_GET['validacion'];
    //Busca el md5 recibido en la base de datos
    $md5_valido = mysqli_query($db, "select * from ValidaReserva where MD5 like '" . $md5 . "'");
    //Recoge el resultado de la búsqueda y lo guarda en una array
    if (!($resultado = mysqli_fetch_array($md5_valido))) {
        echo "No se ha encontrado la reserva en la base de datos";
    } else {
        //Almacena los campos IDVisitante e IDEvento de la tabla ListaVisitantes en sendas variables
        $visitanteID = $resultado[0];
        $eventoID = $resultado[1];
        //Busca el ID en la tabla ListaVisitantes que coincide con el IDVisitante y el IDEvento de la tabla ListaVisitantes
        $savedID = mysqli_query($db, "select IDVisitante,IDEvento from ListaVisitantes where IDVisitante='" . $visitanteID . "' and IDEvento='" . $eventoID . "'");
        if (!($resultado = mysqli_fetch_array($savedID))) {
            echo "No se encuentra la reserva registrada en esta base de datos";
        } else {
            //Elimina el registro de la tabla ValidarReserva, ya que se ha encontrado y se procede la validación
            if (mysqli_query($db, "delete from ValidaReserva where MD5 like '" . $md5 . "';")) {
                if (mysqli_query($db, "update ListaVisitantes set Activo='1' where IDVisitante='" . $visitanteID . "' and IDEvento='" . $eventoID . "'")) {
                    echo "¡Reserva validada correctamente!";
                } else {
                    echo "No se pudo activar la reserva";
                }
            } else {
                echo "Ya se realizó la reserva con este código de activación: " . $md5;
开发者ID:Venturi,项目名称:proyectodai,代码行数:31,代码来源:validacion.php

示例12: editAccnt

function editAccnt($bankid)
{
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($bankid, "num", 1, 4, "Invalid Bank Account ID.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class=err>" . $e["msg"];
        }
        $confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    // Connect to database
    db_Connect();
    $sql = "SELECT * FROM bankacct WHERE bankid='{$bankid}' AND div = '" . USER_DIV . "'";
    $bankRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve bank account details from database.", SELF);
    $numrows = pg_numrows($bankRslt);
    if ($numrows < 1) {
        $OUTPUT = "<li> - Invalid Bank account ID.";
        return $OUTPUT;
    }
    $accnt = pg_fetch_array($bankRslt);
    if (strlen($accnt['accname']) < 20) {
        $size = 20;
    } else {
        $size = strlen($accnt['accname']);
    }
    // Get Bank account [the traditional way re: hook of hook]
    core_connect();
    $sql = "SELECT * FROM bankacc WHERE accid = '{$bankid}' AND div = '" . USER_DIV . "'";
    $Rslt = db_exec($sql) or errDie("Unable to retrieve bank account link from Cubit", SELF);
    # check if link exists
    if (pg_numrows($Rslt) < 1) {
        return "<li class=err> ERROR : The bank account that you selected doesn't appear to have an account linked to it.";
    }
    $bank = pg_fetch_array($Rslt);
    $bankaccid = $bank["accnum"];
    # Check account balance
    $sql = "SELECT * FROM trial_bal WHERE period='" . PRD_DB . "' AND accid = '{$bankaccid}' AND debit > 0 OR accid = '{$bankaccid}' AND credit > 0";
    $accRslt = db_exec($sql);
    if (pg_numrows($accRslt) > 0) {
        $acc = pg_fetch_array($accRslt);
        $account = "<input type=hidden name='glacc' value='{$acc['accid']}'>{$acc['accname']}";
    } else {
        core_connect();
        # income accounts ($inc)
        $account = "<select name='glacc'>";
        $sql = "SELECT * FROM accounts WHERE acctype ='B'";
        $accRslt = db_exec($sql);
        $numrows = pg_numrows($accRslt);
        if (empty($numrows)) {
            return "<li> - There are no accounts yet in Cubit. Please set up accounts first.";
        }
        while ($acc = pg_fetch_array($accRslt)) {
            if ($acc['accid'] == $bankaccid) {
                $sal = "selected";
            } else {
                $sal = "";
            }
            $account .= "<option value='{$acc['accid']}' {$sal}>{$acc['accname']}</option>";
        }
        $account .= "</select>";
    }
    $cardname = "";
    $chm = "";
    $chv = "";
    $cho = "";
    if ($accnt['cardtype'] == 'Visa') {
        $chv = "checked=yes";
    } elseif ($accnt['cardtype'] == 'Mastercard') {
        $chm = "checked=yes";
    } else {
        $cho = "checked=yes";
        $cardname = $accnt['cardtype'];
    }
    db_connect();
    # Locations drop down
    $locs = array("loc" => "Local", "int" => "International");
    $locsel = extlib_cpsel("loc", $locs, $accnt['btype']);
    # currency drop down
    $currsel = ext_unddbsel("fcid", "currency", "fcid", "descrip", "There are is no currency found in Cubit, please add currency first.", $accnt['fcid']);
    // Set up table to display in
    $OUTPUT = "\n\t<h3>Edit Bank Account</h3>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<form action='" . SELF . "' method=post name=form>\n\t<input type=hidden name=key value=confirm>\n\t<input type=hidden name=bankid value={$bankid}>\n\t<tr><th>Field</th><th>Value</th></tr>\n\t<tr class='bg-odd'><td>Type of Account</td><td valign=center><input type=hidden size=20 name=acctype value='{$accnt['acctype']}'>{$accnt['acctype']}</td></tr>\n\t<tr class='bg-even'><td>Bank Name</td><td valign=center><input type=text size=20 name=bankname value='{$accnt['bankname']}'></td></tr>\n\t<tr class='bg-odd'><td>Type</td><td>{$locsel}</td></tr>\n\t<tr class='bg-even'><td>Currency</td><td>{$currsel}</td></tr>\n\t<tr class='bg-odd'><td>Branch Name</td><td valign=center><input type=text size=20 name=branchname value='{$accnt['branchname']}'></td></tr>\n\t<tr class='bg-even'><td>Branch Code</td><td valign=center><input type=text size=20 name=branchcode value='{$accnt['branchcode']}'></td></tr>\n\t<tr class='bg-odd'><td>Account Name</td><td valign=center><input type=text size='{$size}' name=accname  value='{$accnt['accname']}'></td></tr>\n\t<tr class='bg-even'><td>Account Number</td><td valign=center><input type=text name=accnum  value='{$accnt['accnum']}'></td></tr>\n\t<tr class='bg-odd'><td>Ledger Account</td><td valign=center>{$account}</td></tr>\n\t<tr class='bg-even'><td>Card Number</td><td ><input type=text size=25 name=cardnum maxlength=16 value='{$accnt['cardnum']}'></td></tr>\n\t<tr class='bg-odd'><td>Expiry Date</td><td><input type=text size=2 name=mon maxlength=2 value='{$accnt['mon']}'>-<input type=text size=4 name=year maxlength=4 value='{$accnt['year']}'>MM-YYYY</td></tr>\n\t<tr class='bg-even'><td>Last 3 Digits at back of Card</td><td ><input type=text size=3 maxlength=3 name=lastdigits value='{$accnt['digits']}'></td></tr>\n\t<tr class='bg-odd'><td>Card Type</td><td><input type=radio name=cardtyp value=Visa {$chv}>Visa &nbsp;&nbsp; <input type=radio name=cardtyp value='Mastercard' {$chm}> Mastercard &nbsp;&nbsp;&nbsp;<input type=radio name=cardtyp value='other' {$cho}>Other: <input type=text name=cardname value='{$cardname}'></td>\n\t<tr class='bg-even'><td>Details</td><td valign=center><textarea cols=20 rows=5 name=details>{$accnt['details']}</textarea></td></tr>\n\t<tr><td><input type=button value='< Cancel' onClick='javascript:history.back();'></td><td valign=center><input type=submit value='Confirm >'></td></tr>\n\t</form>\n\t</table>\n\t<p>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t\t\t<tr><th>Quick Links</th></tr>\n\t\t<tr class='bg-odd'><td><a href='bankacct-view.php'>View Bank Accounts</a></td></tr>\n\t\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\n\t</table>";
    // all template to display the info and die
    require "../template.php";
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:90,代码来源:petrolcard-edit.php

示例13: _db_DoQuery

function _db_DoQuery($query, $args)
{
    db_Connect();
    $st = _db_Prepare($query);
    if ($st && _db_BindExecute($st, $args)) {
        return $st;
    }
    db_LogError();
    return false;
}
开发者ID:LastResortGames,项目名称:ludumdare,代码行数:10,代码来源:db_mysql.php

示例14: edit

function edit($cashid)
{
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($cashid, "num", 1, 4, "Invalid Petty Cash Requisition ID.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class='err'>{$e['msg']}</li>";
        }
        $confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    # Connect to database
    db_Connect();
    $sql = "SELECT * FROM pettycashbook WHERE cashid = '{$cashid}' AND div = '" . USER_DIV . "'";
    $cashRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve cashbook entry details from database.", SELF);
    if (pg_numrows($cashRslt) < 1) {
        $OUTPUT = "<li class='err'>Requisistion not found in Cubit.</li>";
        return $OUTPUT;
    }
    $cash = pg_fetch_array($cashRslt);
    $accnts = mkAccSelect("accid", $cash['accid']);
    // 	core_connect();
    // 	$sql = "SELECT * FROM accounts WHERE div = '".USER_DIV."' ORDER BY accname ASC";
    // 	$accRslt = db_exec($sql);
    // 	if(pg_numrows($accRslt) < 1){
    // 		return "<li> ERROR : There are no accounts in the category selected.</li>";
    // 	}
    // 	$accnts = "<select name='accid'>";
    // 	while($acc = pg_fetch_array($accRslt)){
    // 		# Check Disable
    // 		if(isDisabled($acc['accid']))
    // 			continue;
    //
    // 		$sel = "";
    // 		if($acc['accid'] == $cash['accid'])
    // 			$sel = "selected";
    //
    // 		$accnts .= "<option value='$acc[accid]' $sel>$acc[accname]</option>";
    // 	}
    // 	$accnts .= "</select>";
    # check available funds
    $cashacc = gethook("accnum", "bankacc", "name", "Petty Cash");
    core_connect();
    $sql = "SELECT (debit - credit) as bal FROM trial_bal WHERE accid = '{$cashacc}' AND month='" . (int) date("m") . "' AND div = '" . USER_DIV . "'";
    $accbRslt = db_exec($sql);
    if (pg_numrows($accbRslt) < 1) {
        return "<li class='err'> Petty Cash Account not found.</li>";
    }
    $accb = pg_fetch_array($accbRslt);
    $accb['bal'] = sprint($accb['bal']);
    # mourn if the is no money
    if ($accb['bal'] < 1) {
        return "<li> There are no Petty Cash funds available.</li>";
    }
    list($date_year, $date_month, $date_day) = explode("-", $cash['date']);
    # Keep the charge vat option stable
    if ($cash['chrgvat'] == "inc") {
        $chin = "checked=yes";
        $chex = "";
        $chno = "";
    } elseif ($cash['chrgvat'] == "exc") {
        $chin = "";
        $chex = "checked=yes";
        $chno = "";
    } else {
        $chin = "";
        $chex = "";
        $chno = "checked=yes";
    }
    db_conn('cubit');
    $Sl = "SELECT * FROM vatcodes ORDER BY code";
    $Ri = db_exec($Sl) or errDie("Unable to get vat codes");
    $Vatcodes = "<select name='vatcode'>\r\n\t<option value='0'>Select</option>";
    while ($vd = pg_fetch_array($Ri)) {
        if ($vd['del'] == "Yes" || $cash["vatcode"] == $vd["id"]) {
            $sel = "selected";
        } else {
            $sel = "";
        }
        $Vatcodes .= "<option value='{$vd['id']}' {$sel}>{$vd['code']}</option>";
    }
    $Vatcodes .= "</select>";
    // Layout
    $add = "\r\n\t\t\t\t<h3>Edit Petty Cash Requisistion</h3>\r\n\t\t\t\t<table " . TMPL_tblDflts . " width='300'>\r\n\t\t\t\t<form action='" . SELF . "' method='POST' name='form'>\r\n\t\t\t\t\t<input type='hidden' name='key' value='confirm'>\r\n\t\t\t\t\t<input type='hidden' name='cashid' value='{$cashid}'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>Field</th>\r\n\t\t\t\t\t\t<th>Value</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Date</td>\r\n\t\t\t\t\t\t<td>" . mkDateSelect("date", $date_year, $date_month, $date_day) . "</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Paid to</td>\r\n\t\t\t\t\t\t<td valign='center'><input size='20' name='name' value='{$cash['name']}'></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Details</td>\r\n\t\t\t\t\t\t<td valign='center'><textarea cols='18' rows='2' name='det'>{$cash['det']}</textarea></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Available Funds</td>\r\n\t\t\t\t\t\t<td><input type='hidden' name='bal' value='{$accb['bal']}'>" . CUR . " {$accb['bal']}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Amount</td>\r\n\t\t\t\t\t\t<td valign='center'>" . CUR . " <input type='text' size='10' name='amount' value='{$cash['amount']}'></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>VAT Inclusive</td>\r\n\t\t\t\t\t\t<td valign='center'>\r\n\t\t\t\t\t\t\tYes <input type='radio' size='7' name='chrgvat' value='inc' {$chin}>\r\n\t\t\t\t\t\t\tNo<input type='radio' size='7' name='chrgvat' value='exc' {$chex}>\r\n\t\t\t\t\t\t\tNo VAT<input type='radio' size='7' name='chrgvat' value='nov' {$chno}>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>VAT Code</td>\r\n\t\t\t\t\t\t<td>{$Vatcodes}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Account Paid to</td>\r\n\t\t\t\t\t\t<td>{$accnts}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td><br></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td valign='center' align='right' colspan='2'><input type='submit' value='Confirm &raquo'></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\r\n\t\t\t\t<p>\r\n\t\t\t\t<table " . TMPL_tblDflts . " width='15%'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>Quick Links</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td><a href='pettycashbook-view.php'>View Petty Cash Requisitions</a></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td><a href='../main.php'>Main Menu</a></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>";
    return $add;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:91,代码来源:petty-req-edit.php

示例15: love_Fetch

function love_Fetch(&$user = 0, &$ip = '0.0.0.0', $offset = null, $limit = null)
{
    db_Connect();
    return db_FetchSingle("SELECT `node` FROM `" . CMW_TABLE_NODE_LOVE . "` WHERE " . "`user`=" . $user . " AND " . "`ip`=INET_ATON('" . $ip . "')" . (is_null($limit) ? "" : " LIMIT " . $limit) . (is_null($offset) ? "" : " OFFSET " . $offset) . ";");
}
开发者ID:LastResortGames,项目名称:ludumdare,代码行数:5,代码来源:love.php


注:本文中的db_Connect函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。