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


PHP validate::chkDate方法代码示例

本文整理汇总了PHP中validate::chkDate方法的典型用法代码示例。如果您正苦于以下问题:PHP validate::chkDate方法的具体用法?PHP validate::chkDate怎么用?PHP validate::chkDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在validate的用法示例。


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

示例1: confirm

function confirm($_POST)
{
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($type, "string", 1, 255, "Invalid Transaction type switch.");
    $v->isOk($typename, "string", 1, 255, "Invalid Transaction type.");
    $edate = $v->chkDate($e_day, $e_month, $e_year, "Invalid date.");
    $v->isOk($amount, "float", 1, 13, "Invalid Amount.");
    $v->isOk($descrip, "string", 0, 255, "Invalid description.");
    if (isset($ccids)) {
        foreach ($ccids as $key => $value) {
            $v->isOk($ccperc[$key], "float", 1, 20, "Invalid Cost center percentage.");
        }
        if (array_sum($ccperc) != 100) {
            return enter($_POST, "<li class='err'> The total percentage must be exaclly 100%, check percentages.</li>");
        }
    } else {
        return enter($_POST, "<li class='err'> There are no Cost centers found.</li>");
    }
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        return enter($_POST, $confirm);
        $confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    db_connect();
    # Query server
    $ccenters = "";
    foreach ($ccids as $key => $value) {
        if ($ccperc[$key] < 1) {
            continue;
        }
        $sql = "SELECT * FROM costcenters_links WHERE id = '{$ccids[$key]}'";
        $ccRslt = db_exec($sql) or errDie("Unable to retrieve Cost centers from database.");
        $cc = pg_fetch_array($ccRslt);
        $ccamts[$key] = sprint($amount * ($ccperc[$key] / 100));
        $get_cname = "SELECT centercode,centername FROM costcenters WHERE ccid = '{$cc['ccid']}' LIMIT 1";
        $run_cname = db_exec($get_cname) or errDie("Unable to get cost center information.");
        if (pg_numrows($run_cname) == 1) {
            $varr = pg_fetch_array($run_cname);
            $ccode = $varr['centercode'];
            $cname = $varr['centername'];
        } else {
            $ccode = "";
            $cname = "";
        }
        $ccenters .= "\n\t\t\t\t<input type='hidden' name='ccidpro[]' value='{$ccidpro[$key]}'>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><input type='hidden' name='ccids[]' value='{$cc['id']}'>{$cname} ({$ccode}) </td>\n\t\t\t\t\t<td align='right'><input type='hidden' name='ccperc[]' size='8' value='{$ccperc[$key]}'>{$ccperc[$key]} %</td>\n\t\t\t\t\t<td align='right'>" . CUR . " {$ccamts[$key]}</td>\n\t\t\t\t</tr>";
    }
    $confirm = "\n\t\t\t<center>\n\t\t\t<h3>Allocate amount to Cost Centers</h3>\n\t\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t\t<input type='hidden' name='key' value='write'>\n\t\t\t\t<input type='hidden' name='type' value='{$type}'>\n\t\t\t\t<input type='hidden' name='typename' value='{$typename}'>\n\t\t\t\t<input type='hidden' name='edate' value='{$edate}'>\n\t\t\t\t<input type='hidden' name='amount' value='{$amount}'>\n\t\t\t\t<input type='hidden' name='descrip' value='{$descrip}'>\n\t\t\t\t<input type='hidden' name='e_year' value='{$e_year}'>\n\t\t\t\t<input type='hidden' name='e_month' value='{$e_month}'>\n\t\t\t\t<input type='hidden' name='e_day' value='{$e_day}'>\n\t\t\t\t<input type='hidden' name='writeid' value='{$writeid}'>\n\t\t\t<table " . TMPL_tblDflts . " width='300'>\n\t\t\t\t<tr><th>Field</th><th>Value</th></tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Type</td>\n\t\t\t\t\t<td>{$typename}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Date</td>\n\t\t\t\t\t<td>{$edate}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Total Amount</td>\n\t\t\t\t\t<td>{$amount}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Description</td>\n\t\t\t\t\t<td>{$descrip}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan='2'>\n\t\t\t\t\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t\t\t\t\t<tr><th>Cost Center</th><th>%</th><th>Amount</th></tr>\n\t\t\t\t\t\t\t{$ccenters}\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan='3' align='center'><input type='submit' value='Confirm &raquo;'></td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</form>";
    return $confirm;
}
开发者ID:kumarsivarajan,项目名称:accounting-123,代码行数:59,代码来源:ccpopup.php

示例2: confirm

function confirm($_POST)
{
    # Get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($bankid, "num", 1, 30, "Invalid Bank Account.");
    $v->isOk($fbankid, "num", 1, 30, "Invalid Foreign Bank Account.");
    $date = $v->chkDate($date_day, $date_month, $date_year, "Invalid date.");
    $v->isOk($descript, "string", 0, 255, "Invalid Description.");
    $v->isOk($reference, "string", 0, 50, "Invalid Reference Name/Number.");
    $v->isOk($cheqnum, "num", 0, 30, "Invalid Cheque number.");
    $v->isOk($amount, "float", 1, 10, "Invalid amount.");
    $v->isOk($rate, "float", 1, 10, "Invalid exchange rate.");
    $v->isOk($ttype, "string", 1, 4, "Invalid Transfer type option.");
    # 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 bank account name
    db_connect();
    $sql = "SELECT * FROM bankacct WHERE bankid = '{$bankid}' AND div = '" . USER_DIV . "'";
    $bankRslt = db_exec($sql);
    $bank = pg_fetch_array($bankRslt);
    $sql = "SELECT * FROM bankacct WHERE bankid = '{$fbankid}' AND div = '" . USER_DIV . "'";
    $fbankRslt = db_exec($sql);
    $fbank = pg_fetch_array($fbankRslt);
    $curr = getsymbol($fbank['fcid']);
    # ttype array
    $ttypearr = array("loc" => "From Local To Foreign", "int" => "From Foreign To Local");
    $scurr = $ttype == 'loc' ? CUR : $curr['symbol'];
    # Layout
    $confirm = "\n\t\t<center>\n\t\t<h3>Bank Transfer</h3>\n\t\t<h4>Confirm entry (Please check the details)</h4>\n\t\t<table " . TMPL_tblDflts . " width='60%'>\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='write'>\n\t\t\t<input type='hidden' name='bankid' value='{$bankid}'>\n\t\t\t<input type='hidden' name='fbankid' value='{$fbankid}'>\n\t\t\t<input type='hidden' name='date' value='{$date}'>\n\t\t\t<input type='hidden' name='descript' value='{$descript}'>\n\t\t\t<input type='hidden' name='reference' value='{$reference}'>\n\t\t\t<input type='hidden' name='cheqnum' value='{$cheqnum}'>\n\t\t\t<input type='hidden' name='amount' value='{$amount}'>\n\t\t\t<input type='hidden' name='rate' value='{$rate}'>\n\t\t\t<input type='hidden' name='ttype' value='{$ttype}'>\n\t\t\t<tr>\n\t\t\t\t<th>Field</th>\n\t\t\t\t<th>Value</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Local Bank Account</td>\n\t\t\t\t<td valign='center'>{$bank['accname']} - {$bank['bankname']}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Foreign Bank Account</td>\n\t\t\t\t<td valign='center'>{$fbank['accname']} - {$fbank['bankname']}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Date</td>\n\t\t\t\t<td valign='center'>{$date}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Description</td>\n\t\t\t\t<td valign='center'>{$descript}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Reference</td>\n\t\t\t\t<td valign='center'>{$reference}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Cheque Number</td>\n\t\t\t\t<td valign='center'>{$cheqnum}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Amount</td>\n\t\t\t\t<td valign='center'>{$scurr} {$amount}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Exchange Rate</td>\n\t\t\t\t<td valign='center'>" . CUR . "/{$curr['symbol']} {$rate}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Tranfer Type</td>\n\t\t\t\t<td valign='center'>{$ttypearr[$ttype]}</td>\n\t\t\t</tr>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<td align='right'><input type='button' value='&laquo Back' onClick='javascript:history.back()'></td>\n\t\t\t\t<td align='right'><input type='submit' value='Write &raquo'></td>\n\t\t\t</tr>\n\t\t</form>\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\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>";
    return $confirm;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:42,代码来源:bank-trans-int.php


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