• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP grp函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: write

function write(&$frm)
{
    if (isset($_REQUEST["btn_back"])) {
        return enter($frm);
    }
    if ($frm->validate("write")) {
        return confirm($frm);
    }
    $upd = new dbUpdate("suppstock", "cubit");
    $del = new dbDelete("suppstock", "cubit");
    foreach ($_REQUEST["stkcod"] as $suppid => $stkcod) {
        if (empty($stkcod)) {
            $del->setOpt("suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'");
            $del->run();
            continue;
        }
        $cols = grp(m("suppid", $suppid), m("stkid", $_REQUEST["id"]), m("stkcod", $stkcod));
        $upd->setOpt($cols, "suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'");
        $upd->run(DB_REPLACE);
    }
    foreach ($_REQUEST["stkdes"] as $suppid => $stkdes) {
        if (empty($stkcod)) {
            $del->setOpt("suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'");
            $del->run();
            continue;
        }
        $cols = grp(m("suppid", $suppid), m("stkid", $_REQUEST["id"]), m("stkdes", $stkdes));
        $upd->setOpt($cols, "suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'");
        $upd->run(DB_REPLACE);
    }
    $OUT = "<script>window.close();</script>";
    return $OUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:33,代码来源:supp_stkcod.php


示例2: printLea

function printLea($_POST)
{
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($f_day, "num", 1, 2, "Invalid from Date day.");
    $v->isOk($f_month, "num", 1, 2, "Invalid from Date month.");
    $v->isOk($f_year, "num", 1, 4, "Invalid from Date Year.");
    $v->isOk($to_day, "num", 1, 2, "Invalid to Date day.");
    $v->isOk($to_month, "num", 1, 2, "Invalid to Date month.");
    $v->isOk($to_year, "num", 1, 4, "Invalid to Date Year.");
    # mix dates
    $fromdate = $f_year . "-" . $f_month . "-" . $f_day;
    $todate = $to_year . "-" . $to_month . "-" . $to_day;
    $v->isOk($fromdate, "date", 1, 1, "Invalid from date.");
    $v->isOk($todate, "date", 1, 1, "Invalid to date.");
    if ($v->isError()) {
        $err = $v->genErrors();
        return $err;
    }
    if (isset($empnum)) {
        $OUTPUT = genslip($empnum, $fromdate, $todate);
    } else {
        $OUTPUT = "";
        $qry = new dbSelect("employees", "cubit", grp(m("cols", "empnum"), m("where", "div='" . USER_DIV . "'")));
        $qry->run();
        while ($row = $qry->fetch_array()) {
            $OUTPUT .= paged(genslip($row["empnum"], $fromdate, $todate));
        }
    }
    require "../tmpl-print.php";
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:34,代码来源:irp5-data.php


示例3: bal

function bal($id)
{
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($id, "num", 1, 20, "Invalid Cash Flow Statement number.");
    # display errors, if any
    if ($v->isError()) {
        $theseErrors = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $theseErrors .= "<li class=err>" . $e["msg"];
        }
        $theseErrors .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $theseErrors;
    }
    # connect to core DB
    core_connect();
    # get the Trial Balance
    $cf = new dbSelect("save_cashflow", "core", grp(m("cols", "output, date_trunc('day', gentime) as gentime"), m("where", "id='{$id}'")));
    $cf->run();
    if ($cf->num_rows() < 1) {
        return "<center><li> Invalid Cash Flow Statement Number.</li></center>";
    }
    $stmnt = $cf->fetch_array();
    $OUTPUT = base64_decode($stmnt['output']);
    if (isset($_GET["xls"])) {
        $cftime = preg_replace("/ 00:00.*/", "", $stmnt["gentime"]);
        require_lib("xls");
        Stream("cashflow-{$cftime}", $OUTPUT);
    } else {
        require "../tmpl-print.php";
    }
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:34,代码来源:cash-flow-print.php


示例4: write

function write(&$frm)
{
    if ($frm->validate("write")) {
        return edit($frm);
    }
    $cols = grp(m("value", $_POST["print_dialog"]));
    $qry = new dbUpdate("settings", "cubit", $cols, "constant='PRINT_DIALOG'");
    $qry->run(DB_UPDATE);
    $OUT = "\n\t<h3>Printing Options</h3>\n\tSuccessfully saved printing options.";
    return $OUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:11,代码来源:printing.php


示例5: write

function write()
{
    extract($_GET);
    if (!isset($id)) {
        $id = 0;
    }
    $cols = grp(m("name", $name), m("in_republic", $in_republic), m("meals", $meals), m("accid", $accid), m("div", USER_DIV));
    $subs = new dbUpdate("subsistence", "cubit", $cols, "id='{$id}'");
    $subs->run(DB_REPLACE);
    $OUT = "\n\t<h3>Define Subsistence Allowance</h3>\n\tSuccessfully created/updated subsistence allowance.";
    return $OUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:12,代码来源:subsistence-edit.php


示例6: locateSupplier

/**
 * locates a supplier by name, if not found creates and returns id
 *
 * @param string $name company name
 * @return int
 */
function locateSupplier($name)
{
    $qry = new dbSelect("suppliers", "cubit", grp(m("cols", "supid"), m("where", "lower(supname)=lower('{$name}')")));
    $qry->run();
    if ($qry->num_rows() > 0) {
        $id = $qry->fetch_result();
    } else {
        // insert into new supps
        $id = -1;
    }
    $qry->free();
    return $id;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:19,代码来源:daemon.inc.php


示例7: write

function write($frm)
{
    /* @var $frm cForm */
    if ($frm->validate("confirm")) {
        return edit($frm);
    }
    /* point of sale message at the bottom of the slip */
    $cols = grp(m("value", $_POST["posmsg"]));
    $upd = new dbUpdate("settings", "cubit", $cols, "constant='POSMSG'");
    $upd->run(DB_UPDATE);
    $OUT = "\n\t<h3>Point of Sale Settings</h3>\n\t\n\tSuccessfully updated.<br />";
    return $OUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:13,代码来源:pos-options.php


示例8: check_messages

function check_messages()
{
    $qry = new dbSelect("req", "cubit", grp(m("cols", "1"), m("where", "recipient='" . USER_NAME . "' AND alerted IS NULL")));
    $qry->run();
    if ($qry->num_rows() == 0) {
        return "NO MESSAGES";
    } else {
        $cols = grp(m("alerted", "1"));
        $upd = new dbUpdate("req", "cubit", $cols, "recipient='" . USER_NAME . "'");
        $upd->run(DB_UPDATE);
        $qry->setOpt(grp(m("where", "recipient='" . USER_NAME . "' AND viewed='0'")));
        $qry->run();
        return "MSGS: " . $qry->num_rows();
    }
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:15,代码来源:checkmsgs.php


示例9: writesal

function writesal($frm)
{
    if ($frm->validate("writesal")) {
        return entersal($frm);
    }
    extract($_POST);
    $upd = new dbUpdate("salpaid", "cubit", false);
    foreach ($sal as $payid => $salrate) {
        $cols = grp(m("salrate", $salrate), isset($hrs[$payid]) ? m("hours", $hrs[$payid]) : false);
        $upd->setOpt($cols, "id='{$payid}'");
        $upd->run(DB_UPDATE);
    }
    $OUT = "\n\t<h3>Previous Employee Salary Information</h3>\n\tSuccessfully updated employee payslip information.";
    return $OUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:15,代码来源:prevemp-salrate.php


示例10: write

function write($frm)
{
    if (isset($_REQUEST["btn_back"])) {
        return select($frm);
    }
    /* @var $frm cForm */
    if ($frm->validate("confirm")) {
        return confirm($frm);
    }
    $cols = grp(m("value", $_REQUEST["emp_year"]));
    $upd = new dbUpdate("settings", "cubit", $cols, "constant='EMP_TAXYEAR'");
    $upd->run(DB_UPDATE);
    $OUT = "\n\t<h3>Active Tax Year</h3>\n\tSuccessfully updated active Tax Year to {$_REQUEST['emp_year']}";
    return $OUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:15,代码来源:empyear.php


示例11: buildlist

function buildlist(&$frm)
{
    if (!isset($_GET["cusnum"])) {
        invalid_use();
    }
    $cust = qryCustomer($_GET["cusnum"]);
    $qry = new dbSelect("plist_prices", "exten", grp(m("where", "listid='{$cust['pricelist']}' AND div='" . USER_DIV . "'")));
    $qry->run();
    $pli = array();
    $pli_noshow = array();
    while ($row = $qry->fetch_array()) {
        if ($row["show"] == "Yes") {
            $pli[$row["stkid"]] = $row["price"];
        } else {
            $pli_noshow[$row["stkid"]] = $row["price"];
        }
    }
    $qry = new dbSelect("stock", "cubit", grp(m("where", "div='" . USER_DIV . "'")));
    $qry->run();
    $plist = "";
    while ($row = $qry->fetch_array()) {
        if (isset($pli_noshow[$row["stkid"]])) {
            continue;
        }
        if (isset($pli[$row["stkid"]])) {
            $price = $pli[$row["stkid"]];
        } else {
            $price = $row["selamt"];
        }
        $desc = preg_replace("/,/", "", $row["stkdes"]);
        $plist .= "{$row['stkcod']},{$price},{$desc}\n";
    }
    /* @var $frm cForm */
    $frm->setFormParm("post", "../emailsave_page.php");
    $frm->setkey("sendmails");
    $frm->add_hidden("emailsavepage_key", "sendmails", "string");
    $frm->add_hidden("emailsavepage_action", "email", "string");
    $frm->add_hidden("emailsavepage_content", base64_encode($plist), "string");
    $frm->add_hidden("emailsavepage_mime", "text/plain", "string");
    $frm->add_hidden("emailsavepage_subject", "Pricelist from " . COMP_NAME, "string");
    $frm->add_hidden("emailsavepage_name", "pricelist.csv", "string");
    $frm->add_heading("Sending Pricelist to Customer");
    $frm->add_layout("\n\t\t<tr %bgc>\n\t\t\t<td>Customer:</td>\n\t\t\t<td>{$cust['surname']}</td>\n\t\t</tr>\n\t\t<tr %bgc>\n\t\t\t<td>%disp[0]</td>\n\t\t\t<td>%fld[0]</td>\n\t\t</tr>");
    $frm->add_hidden("surnames[{$cust['cusnum']}]", $cust["surname"], "string");
    $frm->add_text("E-mail", "emailcust[{$cust['cusnum']}]", $cust["email"], "string", "1:255");
    return $frm->getfrm_input();
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:47,代码来源:pricelist_send.php


示例12: write

function write()
{
    extract($_POST);
    $qry = new dbSelect("config", "trh", grp(m("where", "readonly='f'")));
    $qry->run();
    $upd = new dbUpdate("config", "trh");
    while ($row = $qry->fetch_array()) {
        if (isset(${$row["name"]})) {
            $cols = grp(m("value", ${$row["name"]}["value"]));
            $upd->setOpt($cols, "name='{$row['name']}'");
            $upd->run(DB_UPDATE);
        }
    }
    r2sListRestore("trh_comminit");
    $OUT = "\n\t<h3>Transactioning Configuration</h3>\n\tSuccessfully updated configuration.";
    return $OUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:17,代码来源:configuration.php


示例13: printComp

function printComp()
{
    $OUT = "\n    <h3>View Companies</h3>\n    <table " . TMPL_tblDflts . ">\n    <tr>\n    \t<th>Company Code</th>\n    \t<th>Company Name</th>\n    \t<th>Status</th>\n    \t<th>Options</th>\n    </tr>";
    $qry = new dbSelect("companies", DB_MCUBIT, grp(m("order", "name ASC")));
    $qry->run();
    $i = 0;
    while ($comp = $qry->fetch_array()) {
        $bgcolor = bgcolor($i);
        $status = ucfirst($comp["status"]);
        $OUT .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>{$comp['code']}</td>\n\t\t\t<td>{$comp['name']}</td>\n\t\t\t<td>{$status}</td>";
        if ($comp["status"] == "removed") {
            $OUT .= "\n\t\t\t<td><a href='company-rem.php?key=recover&code={$comp['code']}'>Recover</a></td>";
        }
        $OUT .= "\n\t\t\t<td><a href='company-rem.php?key=confirm&perm=t&code={$comp['code']}'>" . ($comp["status"] == "removed" ? "Remove Permanently (CAN NOT BE RECOVERED)" : "Remove") . "</a></td>\n\t\t</tr>";
    }
    $OUT .= "\n\t</table>" . mkQuickLinks(ql("company-new.php", "Add New Company"));
    return $OUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:18,代码来源:company-view.php


示例14: write

function write()
{
    extract($_POST);
    require_lib("validate");
    $v = new validate();
    $v->isOk($salespno, "num", 1, 10, "Invalid Sales Person number.");
    $v->isOk($salesp, "string", 1, 255, "Invalid Sales Person name.");
    if ($v->isError()) {
        return $v->genErrors();
    }
    $cols = grp(m("salespno", $salespno), m("salesp", $salesp), m("com", $com), m("div", USER_DIV));
    $qry = new dbUpdate("salespeople", "exten", $cols);
    $qry->run(DB_INSERT);
    if ($qry->affected() < 1) {
        return "<li class=err>Unable to add sales person to Cubit.";
    }
    $write = "\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<th>Sales Person added to system</th>\n\t</tr>\n\t<tr class='text'><td>New Sales Person <b>{$salesp}</b>, has been\n\t\tsuccessfully added to the system.</td>\n\t</tr>\n\t</table>";
    return $write;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:19,代码来源:salesp-add.php


示例15: view

function view()
{
    // Connect to database
    core_Connect();
    // Query server
    $cf = new dbSelect("save_cashflow", "core", grp(m("where", "div='" . USER_DIV . "'")));
    $cf->run();
    if ($cf->num_rows() < 1) {
        $OUTPUT = "<li> There are no saved Cash Flow Statements.";
    } else {
        // Set up table to display in
        $OUTPUT = "\n\t\t<h3>View Saved Cash Flow Statements</h3>\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=300>\n\t\t<tr>\n\t\t\t<th>Statement No.</th>\n\t\t\t<th>Generated</th>\n\t\t\t<th colspan=2>Options</th>\n\t\t</tr>";
        // display all statements
        while ($stmnt = $cf->fetch_array()) {
            $OUTPUT .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$stmnt['id']}({$stmnt['des']})</td>\n\t\t\t\t<td>{$stmnt['gentime']}</td>\n\t\t\t\t<td><a target='_blank' href='cash-flow-print.php?id={$stmnt['id']}'>Print</a></td>\n\t\t\t\t<td><a href='cash-flow-print.php?id={$stmnt['id']}&xls=t'>Spreadsheet</a></td>\n\t\t\t</tr>";
        }
        $OUTPUT .= "</table>";
    }
    $OUTPUT .= "\n\t<p>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<tr><th>Quick Links</th></tr>\n\t<tr class=datacell><td><a href='index-reports.php'>Financials</a></td></tr>\n\t<tr class=datacell><td><a href='index-reports-stmnt.php'>Current Year Financial Statements</a></td></tr>\n\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\n\t</table>";
    // call template to display the info and die
    return $OUTPUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:22,代码来源:cash-flow-view.php


示例16: add_tbdata

function add_tbdata(&$oc, $schema, $yearsback = 0)
{
    global $MONPRD, $PRDMON;
    /* fetch prev year trial bal data */
    $tb = new dbSelect("trial_bal_actual", $schema, grp(m("where", "period!='0'"), m("order", "period, acctype, topacc, accnum")));
    $tb->run();
    $cprd = false;
    $cprd_name = false;
    while ($row = $tb->fetch_array()) {
        /* the period in the table data changed */
        if ($cprd != $row["period"]) {
            $cprd = $row["period"];
            $year = getYearOfFinMon($PRDMON[$cprd]) - $yearsback;
            $mon = getMonthNameS($PRDMON[$cprd]);
            $cprd_name = "{$mon} {$year}";
            $oc[$cprd_name] = array();
        }
        if ($row["period"] == 1 && $row["acctype"] != "B") {
            $hcode = new dbSelect("trial_bal", $schema, grp(m("where", "period='1' AND accid='{$row['accid']}'"), m("limit", 1)));
            $hcode->run();
            $row = $hcode->fetch_array();
        } else {
            if ($row["period"] == 1 && $row["topacc"] == "5200" && $row["accnum"] == "000") {
                /* calculate previous year profit/loss */
                $sql = "SELECT SUM(tb.credit) AS credit, SUM(tb.debit) AS debit\n\t\t\t\t\tFROM core.accounts acc LEFT JOIN {$schema}.trial_bal tb\n\t\t\t\t\t\tON acc.accid=tb.accid AND acc.div=tb.div\n\t\t\t\t\tWHERE (acc.acctype='I' OR acc.acctype='E') AND acc.div='" . USER_DIV . "'\n\t\t\t\t\t\tAND tb.period='0'";
                $qry = new dbSql($sql);
                $qry->run();
                /* then deduct from debit/credit of retained income/accumulated loss */
                $qry->fetch_array();
                $row["debit"] -= $qry->d["debit"];
                $row["credit"] -= $qry->d["credit"];
            }
        }
        /* store data */
        $oc[$cprd_name]["{$row['topacc']}/{$row['accnum']} {$row['accname']}"] = array("debit" => $row["debit"], "credit" => $row["credit"]);
    }
    #sort array to make some sense
    $oc = natksort($oc);
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:39,代码来源:ledger_export.php


示例17: request

function request($frm)
{
    if (isset($_POST["btn_back"])) {
        return enter($frm);
    }
    if ($frm->validate("request")) {
        return confirm($frm);
    }
    $newkey = genkey();
    if (isset($_REQUEST["suppid"])) {
        $suppid = $_REQUEST["suppid"];
        $custid = "0";
    } else {
        $custid = $_REQUEST["custid"];
        $suppid = "0";
    }
    $cols = grp(m("introtime", raw("CURRENT_TIMESTAMP")), m("introip", "0.0.0.0"), m("email", $_REQUEST["email"]), m("custid", $custid), m("suppid", $suppid), m("key", dbrow("0.0.0.0/0", "", $newkey)), m("userid", USER_ID));
    $upd = new dbUpdate("keys", "trh", $cols);
    $upd->run(DB_INSERT);
    if ($upd->affected() > 0) {
        if (isset($_REQUEST["suppid"])) {
            if (($r = send_trhmsg("supp", $_REQUEST["suppid"], $_REQUEST["email"], "reqkey", $newkey)) === true) {
                $OUT = "Sent request for communication to supplier. On response you will be notified.";
            } else {
                $OUT = "Error sending request for communication: {$r}";
            }
        } else {
            if (($r = send_trhmsg("cust", $_REQUEST["custid"], $_REQUEST["email"], "reqkey", $newkey)) === true) {
                $OUT = "Sent request for communication to customer. On response you will be notified.";
            } else {
                $OUT = "Error sending request for communication: {$r}";
            }
        }
    } else {
        $OUT = "Error sending request for communication: Error updating database.";
    }
    return $OUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:38,代码来源:comm_init.php


示例18: details


//.........这里部分代码省略.........
            $last = 0;
            foreach ($js_totannuals as $fid) {
                ++$last;
                $js_funcs_mon .= "\n\t\t\t\t\tobj = getObject('{$fid}');\n\t\t\t\t\tval = parseFloat(obj.value);\n\t\t\t\t\tobj.value = val.toFixed(2)\n\t\t\t\t\ttot_annual[{$ccid}] += val;";
                $js_funcs_tot .= "\n\t\t\t\t\tobj = getObject('{$fid}');";
                if ($last != $months_cnt) {
                    $js_funcs_tot .= "\n\t\t\t\t\t\tobj.value = (Math.round(100*mthval)/100).toFixed(2);\n\t\t\t\t\t\tsf += Math.round(100*mthval)/100;";
                } else {
                    $js_funcs_tot .= "\n\t\t\t\t\t\tobj.value = (parseFloat(totobj.value) - sf).toFixed(2);";
                }
            }
            $js_funcs_mon .= "\n\t\t\t\t//getObject('annual{$ccid}').innerHTML = '" . CUR . " ' + tot_annual[{$ccid}].toFixed(2);\n\t\t\t\tgetObject('annual_{$ccid}').value = tot_annual[{$ccid}].toFixed(2);\n\t\t\t}\n\n\t\t\ttot_annual[{$ccid}] = {$tot_annual};\n";
            $js_funcs_tot .= "\n\t\t\t}\n";
            $tot_annual = sprint($tot_annual);
            //$list .= "<td nowrap><div id='annual$ccid'>".CUR." $tot_annual</div></td>";
            $list .= "\n\t\t\t<td nowrap>" . CUR . "\n\t\t\t\t<input tabindex='{$rowcnt}' type=text size=7 onchange='changedTot{$ccid}(this);' id='annual_{$accid}' name='annual[{$ccid}]' value='" . $tot_annual . "' />\n\t\t\t</td>";
        }
    } elseif ($budfor == 'acc') {
        # budget type
        if ($budtype == 'exp') {
            $acctype = "E";
        } elseif ($budtype == 'inc') {
            $acctype = "I";
        } else {
            $acctype = "B";
        }
        # accounts
        core_connect();
        $sql = "SELECT * FROM accounts WHERE acctype = '{$acctype}' AND div = '" . USER_DIV . "' ORDER BY accname ASC";
        $accRslt = db_exec($sql);
        if (pg_numrows($accRslt) < 1) {
            return "<li>There are No accounts in Cubit.";
        }
        $tbval = new dbSelect("trial_bal_actual", PYR_DB, grp(m("cols", "acctype, debit, credit")));
        $numacc = pg_num_rows($accRslt);
        $cellcnt += $numacc * 3;
        while ($acc = pg_fetch_array($accRslt)) {
            if ($acc["accname"] == "Retained Income / Accumulated Loss") {
                continue;
            }
            if ($rowcnt++ % 9 == 0) {
                $list .= $head;
            }
            $accid = $acc["accid"];
            /* create default values */
            for ($i = 1; $i <= 12; ++$i) {
                if (!isset($amts[$accid][$i])) {
                    if (isset($import)) {
                        $tbval->setOpt(grp(m("where", "accid='{$accid}' AND month='{$i}'")));
                        $tbval->run();
                        $tbd = $tbval->fetch_array();
                        switch ($tbd["acctype"]) {
                            case "I":
                                $bal = $tbval->d["credit"] - $tbval->d["debit"];
                                break;
                            case "E":
                            case "B":
                                $bal = $tbval->d["debit"] - $tbval->d["credit"];
                                break;
                        }
                        $amts[$accid][$i] = sprint($bal + $bal * $incperc / 100);
                    } else {
                        $amts[$accid][$i] = 0;
                    }
                }
            }
开发者ID:kumarsivarajan,项目名称:accounting-123,代码行数:67,代码来源:budget-new.php


示例19: recvpayment_write


//.........这里部分代码省略.........
                    $payRslt = db_exec($sql) or errDie("Unable to update Invoice information in Cubit.", SELF);
                    $sql = "UPDATE cubit.open_stmnt\n\t\t\t\t\t\tSET balance = (balance - {$paidamt[$key]}::numeric(13,2))\n\t\t\t\t\t\tWHERE invid = '{$inv['invnum']}' AND div = '" . USER_DIV . "'";
                    $payRslt = db_exec($sql) or errDie("Unable to update Invoice information in Cubit.", SELF);
                    # record the payment on the statement
                    $sql = "\n\t\t\t\t\tINSERT INTO cubit.stmnt \n\t\t\t\t\t\t(cusnum, invid, amount, date, type, div, allocation_date) \n\t\t\t\t\tVALUES \n\t\t\t\t\t\t('{$cus['cusnum']}','{$inv['invnum']}', '" . ($paidamt[$key] - $paidamt[$key] * 2) . "','{$sdate}', 'Payment for Non Stock Invoice No. {$inv['invnum']} - {$inv['descrip']}', '" . USER_DIV . "', '{$inv['odate']}')";
                    $stmntRslt = db_exec($sql) or errDie("Unable to insert statement record in Cubit.", SELF);
                    custledger($cus['cusnum'], $bank_acc, $sdate, $inv['invnum'], "Payment for Non Stock Invoice No. {$inv['invnum']} - {$inv['descrip']}", $paidamt[$key], "c");
                    recordCT($paidamt[$key], $cus['cusnum'], $inv['age'], $sdate);
                    $rinvids .= "|{$invids[$key]}";
                    $amounts .= "|{$paidamt[$key]}";
                    $invprds .= "|0";
                    $rages .= "|{$inv['age']}";
                    $invidsers .= " - {$inv['invnum']}";
                } else {
                    /* pos invoices */
                    $sql = "SELECT * FROM cubit.prd_pinvoices\n\t\t\t\t\t\tWHERE invid='{$invids[$key]}' AND div='" . USER_DIV . "'";
                    $invRslt = db_exec($sql) or errDie("Unable to retrieve invoice details from database.");
                    if (pg_numrows($invRslt) < 1) {
                        return "<li class='err'>Invalid Invoice Number.</li>";
                    }
                    $inv = pg_fetch_array($invRslt);
                    // reduce the invoice balance
                    $sql = "UPDATE \"{$inv['iprd']}\".pinvoices\n\t\t\t\t\t\tSET balance = (balance - {$paidamt[$key]}::numeric(13,2))\n\t\t\t\t\t\tWHERE invid = '{$invids[$key]}' AND div = '" . USER_DIV . "'";
                    $payRslt = db_exec($sql) or errDie("Unable to update Invoice information in Cubit.", SELF);
                    $sql = "UPDATE cubit.open_stmnt\n\t\t\t\t\t\tSET balance = (balance - {$paidamt[$key]}::numeric(13,2))\n\t\t\t\t\t\tWHERE invid = '{$inv['invnum']}' AND div = '" . USER_DIV . "'";
                    $payRslt = db_exec($sql) or errDie("Unable to update Invoice information in Cubit.", SELF);
                    # record the payment on the statement
                    $sql = "\n\t\t\t\t\tINSERT INTO cubit.stmnt\n\t\t\t\t\t\t(cusnum, invid, amount, date, type, div, allocation_date) \n\t\t\t\t\tVALUES \n\t\t\t\t\t\t('{$cus['cusnum']}','{$inv['invnum']}', '" . ($paidamt[$key] - $paidamt[$key] * 2) . "','{$sdate}', 'Payment for Non Stock Invoice No. {$inv['invnum']}', '" . USER_DIV . "', '{$inv['odate']}')";
                    $stmntRslt = db_exec($sql) or errDie("Unable to insert statement record in Cubit.", SELF);
                    custledger($cus['cusnum'], $bank_acc, $sdate, $inv['invnum'], "Payment for Non Stock Invoice No. {$inv['invnum']}", $paidamt[$key], "c");
                    recordCT($paidamt[$key], $cus['cusnum'], 0, $sdate);
                    $rinvids .= "|{$invids[$key]}";
                    $amounts .= "|{$paidamt[$key]}";
                    $invprds .= "|{$inv['prd']}";
                    //$rages .= "|$inv[age]";
                    $invidsers .= " - {$inv['invnum']}";
                }
            }
        }
    }
    writetrans($bank_acc, $dept['debtacc'], $sdate, $refnum, $amt, "Payment for Invoices {$invidsers} from customer {$cus['cusname']} {$cus['surname']}");
    db_conn('cubit');
    if ($out > 0) {
        /* START OPEN ITEMS */
        $openstmnt = new dbSelect("open_stmnt", "cubit", grp(m("where", "balance>0 AND cusnum='{$cusnum}'"), m("order", "date")));
        $openstmnt->run();
        $open_out = $out;
        $i = 0;
        $ox = "";
        while ($od = $openstmnt->fetch_array()) {
            if ($open_out == 0) {
                continue;
            }
            $oid = $od['id'];
            if ($open_out >= $od['balance']) {
                $open_amount[$oid] = $od['balance'];
                $open_out = sprint($open_out - $od['balance']);
                $ox .= "<tr class='" . bg_class() . "'><td><input type=hidden size=20 name=open[{$oid}] value='{$oid}'>{$od['type']}</td>\n\t\t\t\t\t<td>" . CUR . " {$od['balance']}</td><td>{$od['date']}</td><td><input type=hidden name='open_amount[{$oid}]' value='{$open_amount[$oid]}'>\n\t\t\t\t\t" . CUR . " {$open_amount[$oid]}</td></tr>";
                $Sl = "UPDATE cubit.open_stmnt SET balance=balance-'{$open_amount[$oid]}' WHERE id='{$oid}'";
                $Ri = db_exec($Sl) or errDie("Unable to update statement.");
            } elseif ($open_out < $od['balance']) {
                $open_amount[$oid] = $open_out;
                $open_out = 0;
                $ox .= "<tr class='" . bg_class() . "'><td><input type=hidden size=20 name=open[{$oid}] value='{$od['id']}'>{$od['type']}</td>\n\t\t\t\t\t<td>" . CUR . " {$od['balance']}</td><td>{$od['date']}</td><td><input type=hidden name='open_amount[{$oid}]' value='{$open_amount[$oid]}'>\n\t\t\t\t\t" . CUR . " {$open_amount[$oid]}</td></tr>";
                $Sl = "UPDATE cubit.open_stmnt SET balance=balance-'{$open_amount[$oid]}' WHERE id='{$oid}'";
                $Ri = db_exec($Sl) or errDie("Unable to update statement.");
            }
            $i++;
        }
        if (open()) {
            $bout = $out;
            $out = $open_out;
            if ($out > 0) {
                $sql = "INSERT INTO cubit.open_stmnt(cusnum, invid, amount, balance, date, type, st, div) VALUES('{$cus['cusnum']}', '0', '-{$out}', '-{$out}', '{$sdate}', 'Payment Received', 'n', '" . USER_DIV . "')";
                $stmntRslt = db_exec($sql) or errDie("Unable to Insert statement record in Cubit.", SELF);
                //$confirm .="<tr class='bg-even'><td colspan=4><b>A general transaction will credit the client's account with ".CUR." $out </b></td></tr>";
            }
            $out = $bout;
        } else {
            //$confirm .="<tr class='bg-even'><td colspan=4><b>A general transaction will credit the client's account with ".CUR." $out </b></td></tr>";}
        }
    }
    if ($out > 0) {
        recordCT($out, $cus['cusnum'], 0, $sdate);
        $cols = grp(m("cusnum", $cus["cusnum"]), m("invid", 0), m("amount", -$out), m("date", $sdate), m("type", "Payment Received"), m("div", USER_DIV), m("allocation_date", $sdate));
        $dbobj = new dbUpdate("stmnt", "cubit", $cols);
        $dbobj->run(DB_INSERT);
        $dbobj->free();
        custledger($cus['cusnum'], $bank_acc, $sdate, "PAYMENT", "Payment received.", $out, "c");
    }
    $sql = "INSERT INTO cubit.payrec(date,by,multiinv,amount,method,prd,note)\n\t\t\tVALUES('{$sdate}','" . USER_NAME . "', '{$invidsers}', '{$pcash}','Cash','" . PRD_DB . "','0')";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.payrec(date,by,multiinv,amount,method,prd,note)\n\t\t\tVALUES('{$sdate}','" . USER_NAME . "', '{$invidsers}', '{$pcc}','Credit Card','" . PRD_DB . "','0')";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.payrec(date,by,multiinv,amount,method,prd,note)\n\t\t\tVALUES('{$sdate}','" . USER_NAME . "', '{$invidsers}', '{$pcheque}','Cheque','" . PRD_DB . "','0')";
    db_exec($sql) or errDie("Unable to insert data.");
    pglib_transaction("COMMIT");
    $_POST["pcc"] = $_POST["pcheque"] = $_POST["pcash"] = "0.00";
    return details($_POST, "<li class='err'>Payment received successfully</li>");
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:pos-invoice-new-no-neg.php


示例20: write

function write($_POST)
{
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($classcode, "string", 1, 255, "Invalid Classification code.");
    $v->isOk($classname, "string", 1, 255, "Invalid Classification name.");
    # display errors, if any
    if ($v->isError()) {
        $confirmCust = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirmCust .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirmCust .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirmCust;
    }
    # check stock code
    db_connect();
    $sql = "SELECT classcode FROM stockclass WHERE lower(classcode) = lower('{$classcode}') AND div = '" . USER_DIV . "'";
    $cRslt = db_exec($sql);
    if (pg_numrows($cRslt) > 0) {
        $error = "<li class='err'> A Classification with code : <b>{$classcode}</b> already exists.</li>";
        $error .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $error;
    }
    # connect to db
    db_connect();
    # write to db
    $sql = "INSERT INTO stockclass(classcode, classname, div) VALUES ('{$classcode}', '{$classname}', '" . USER_DIV . "')";
    $catRslt = db_exec($sql) or errDie("Unable to add class to system.", SELF);
    if (pg_cmdtuples($catRslt) < 1) {
        return "<li class='err'>Unable to add classname to database.</li>";
    }
    if (frmupdate_passon()) {
        $newlst = new dbSelect("stockclass", "cubit", grp(m("cols", "clasid, classname"), m("where", "div='" . USER_DIV . "'"), m("order", "classname ASC")));
        $newlst->run();
        $a = array();
        if ($newlst->num_rows() > 0) {
            while ($row = $newlst->fetch_array()) {
                $a[$row["clasid"]] = $row["classname"];
            }
        }
        $js = frmupdate_exec(array($a), true);
    } else {
        $js = "";
    }
    $write = "\n\t\t\t\t{$js}\n\t\t\t\t<table " . TMPL_tblDflts . " width='50%'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Classification added to system</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class= 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP grr_htmlSpecialChars函数代码示例发布时间:2022-05-15
下一篇:
PHP grow_dropdown_tree函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap