Exemple #1
0
 private static function start()
 {
     $control = control(CONTROL);
     if (!$control) {
         if (IS_GROUP and !is_dir(GROUP_PATH . GROUP_NAME)) {
             _404('应用组' . GROUP_PATH . GROUP_NAME . '不存在');
         }
         if (!is_dir(APP_PATH)) {
             _404('应用' . APP . '不存在');
         }
         $control = Control("Empty");
         if (!$control) {
             _404('模块' . CONTROL . C("CONTROL_FIX") . '不存在');
         }
     }
     try {
         $method = new ReflectionMethod($control, METHOD);
         if ($method->isPublic()) {
             $method->invoke($control);
         } else {
             throw new ReflectionException();
         }
     } catch (ReflectionException $e) {
         $method = new ReflectionMethod($control, '__call');
         $method->invokeArgs($control, array(METHOD, ''));
     }
 }
Exemple #2
0
 /**
  * 运行应用
  * @access private
  */
 private static function start()
 {
     //控制器实例
     $control = control(CONTROL);
     //控制器不存在
     if (!$control) {
         //空控制器
         $control = Control("Empty");
         if (!$control) {
             _404('模块' . CONTROL . '不存在');
         }
     }
     //执行动作
     try {
         $method = new ReflectionMethod($control, METHOD);
         if ($method->isPublic()) {
             $method->invoke($control);
         } else {
             throw new ReflectionException();
         }
     } catch (ReflectionException $e) {
         $method = new ReflectionMethod($control, '__call');
         $method->invokeArgs($control, array(METHOD, ''));
     }
 }
Exemple #3
0
 /**
  * 运行项目
  */
 public static function apprun()
 {
     if (function_exists("date_default_timezone_set")) {
         //设置时区
         date_default_timezone_set(C("default_time_zone"));
     }
     if (!is_dir(PATH_APP)) {
         error(APP . L("application_apprun4") . ' <a href="' . dirname(__HDPHP__) . '/setup/index.php?m=delcache&temp=D:/wamp/www/hdcms/temp">' . L("application_apprun_createapp") . '</a>', FALSE);
     }
     $controlFile = rtrim(PATH_APP, '/') . '/control/' . CONTROL;
     $control = Control($controlFile);
     //执行动作
     $method = strtolower(METHOD);
     //模块方法
     if (!method_exists($control, $method)) {
         if ($method == 'ueditorupload') {
             //ueditor
             include PATH_HD . '/org/ueditor/hd_upload.php';
         } elseif ($method == 'keditorupload') {
             //kingeditor
             include PATH_HD . '/org/kindeditor/hd_upload.php';
         } elseif ($method == 'swfupload') {
             //swfupload上传处理
             include PATH_HD . '/org/swfupload250/hd_upload.php';
         } elseif ($method == 'swfuploaddel') {
             //swfupload删除文件处理
             include PATH_HD . '/org/swfupload250/hd_delfile.php';
         } else {
             error(L("application_apprun1") . $controlFile . C("CONTROL_FIX") . '.php' . L("application_apprun2") . $method . L("application_apprun3"), false);
         }
     }
     call_user_func(array(&$control, $method));
 }
function details2($_POST)
{
    // Sanity Checking
    # Get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($refnum, "num", 1, 10, "Invalid Reference number.");
    $v->isOk($day, "num", 1, 2, "Invalid to Date day.");
    $v->isOk($mon, "num", 1, 2, "Invalid to Date month.");
    $v->isOk($year, "num", 1, 4, "Invalid to Date Year.");
    $date = $day . "-" . $mon . "-" . $year;
    if (!checkdate($mon, $day, $year)) {
        $v->isOk($date, "num", 1, 1, "Invalid date.");
    }
    $v->isOk($dtaccnum, "string", 1, 50, "Invalid Account number  to be Debited.");
    $v->isOk($ctaccnum, "string", 1, 50, "Invalid Account number to be Credited.");
    # 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;
    }
    $dtaccnum = explode("/", rtrim($dtaccnum));
    $ctaccnum = explode("/", rtrim($ctaccnum));
    if (count($dtaccnum) < 2) {
        // account numbers
        $dtaccRs = get("core", "*", "accounts", "topacc", $dtaccnum[0] . "' AND accnum = '000");
        if (pg_numrows($dtaccRs) < 1) {
            return "<li> Accounts number : {$dtaccnum['0']} does not exist";
        }
        $dtacc = pg_fetch_array($dtaccRs);
    } else {
        // account numbers
        $dtaccRs = get("core", "*", "accounts", "topacc", "{$dtaccnum['0']}' AND accnum = '{$dtaccnum['1']}");
        if (pg_numrows($dtaccRs) < 1) {
            return "<li> Accounts number : {$dtaccnum['0']}/{$dtaccnum['1']} does not exist";
        }
        $dtacc = pg_fetch_array($dtaccRs);
    }
    if (count($ctaccnum) < 2) {
        # get top level account
        $ctaccRs = get("core", "*", "accounts", "topacc", $ctaccnum[0] . "' AND accnum = '000");
        if (pg_numrows($ctaccRs) < 1) {
            return "<li> Accounts number : {$ctaccnum['0']} does not exist";
        }
        $ctacc = pg_fetch_array($ctaccRs);
    } else {
        # get low level account
        $ctaccRs = get("core", "*", "accounts", "topacc", "{$ctaccnum['0']}' AND accnum = '{$ctaccnum['1']}");
        if (pg_numrows($ctaccRs) < 1) {
            return "<li> Accounts number : {$ctaccnum['0']}/{$ctaccnum['1']} does not exist";
        }
        $ctacc = pg_fetch_array($ctaccRs);
    }
    # Check for Creditors and Debtors Control
    if (Control($dtacc['accid'], $ctacc['accid'])) {
        return Control($dtacc['accid'], $ctacc['accid']);
    }
    // Details
    $details = "\n        <h3> Journal transaction details</h3>\n        <form action='" . SELF . "' method=post name=form>\n        <input type=hidden name=key value=confirm>\n        <input type=hidden name='date' value='{$date}'>\n        <input type=hidden name='ctaccid' value='{$ctacc['accid']}'>\n        <input type=hidden name='dtaccid' value='{$dtacc['accid']}'>\n        <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=500>\n        <tr><td width=50%><h3>Debit</h3></td><td width=50%><h3>Credit</h3></td></tr>\n        <tr class='bg-odd'><td>{$dtacc['topacc']}/{$dtacc['accnum']} - {$dtacc['accname']}</td><td>{$ctacc['topacc']}/{$ctacc['accnum']} - {$ctacc['accname']}</td></tr>\n        <tr><td><br></td></tr>\n        <tr><td><br></td></tr>\n        <tr class='bg-odd'><td>Date</td><td valign=center>{$date}</td></tr>\n        <tr class='bg-even'><td>Reference No.</td><td valign=center><input type=text size=20 name=refnum value='{$refnum}'></td></tr>\n        <tr class='bg-odd'><td>Amount</td><td valign=center>" . CUR . "<input type=text size=20 name=amount></td></tr>\n\t\t<tr class='bg-even'><td>Charge VAT </td><td><input type=radio name=chrgvat value=yes>Yes &nbsp;&nbsp; <input type=radio name=chrgvat value=no checked=yes>No</td>\n        <tr class='bg-odd'><td>Transaction Details</td><td valign=center><textarea cols=20 rows=5 name=details></textarea></td></tr>\n        <tr class='bg-even'><td>Person Authorising</td><td valign=center><input type=hidden size=20 name=author value=" . USER_NAME . ">" . USER_NAME . "</td></tr>\n\t\t<tr><td><br></td></tr>\n\t\t<tr><td><input type=button value=Back OnClick='javascript:history.back()'></td><td valign=center><input type=submit value='Record Transaction'></td></tr>\n        </form>\n        </table>\n\t\t<table border=0 cellpadding='2' cellspacing='1' width=15%>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr><th>Quick Links</th></tr>\n\t\t\t<tr class=datacell><td align=center><a href='trans-new.php'>Journal Transactions</td></tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t<tr class=datacell><td align=center><a href='../main.php'>Main Menu</td></tr>\n        </table>";
    return $details;
}
function details2($_POST, $err = "")
{
    extract($_POST);
    require_lib("validate");
    $v = new validate();
    $v->isOk($refnum, "num", 1, 10, "Invalid Reference number.");
    $v->isOk($jr_day, "num", 1, 2, "Invalid to Date day.");
    $v->isOk($jr_month, "num", 1, 2, "Invalid to Date month.");
    $v->isOk($jr_year, "num", 1, 4, "Invalid to Date Year.");
    $date = mkdate($jr_year, $jr_month, $jr_day);
    $v->isOk($date, "date", 1, 1, "Invalid date.");
    $v->isOk($dtaccnum, "string", 1, 50, "Invalid Account number  to be Debited.");
    $v->isOk($ctaccnum, "string", 1, 50, "Invalid Account number to be Credited.");
    if ($v->isError()) {
        $err = $v->genErrors();
        return slctacc($err);
    }
    $dtaccnum = explode("/", rtrim($dtaccnum));
    $ctaccnum = explode("/", rtrim($ctaccnum));
    if (count($dtaccnum) < 2) {
        $dtacc = qryAccountsNum($dtaccnum[0], "000");
    } else {
        $dtacc = qryAccountsNum($dtaccnum[0], $dtaccnum[1]);
    }
    if (count($ctaccnum) < 2) {
        $ctacc = qryAccountsNum($ctaccnum[0], "000");
    } else {
        $ctacc = qryAccountsNum($ctaccnum[0], $ctaccnum[1]);
    }
    if (Control($dtacc['accid'], $ctacc['accid'], $refnum, $jr_day, $jr_month, $jr_year)) {
        return Control($dtacc['accid'], $ctacc['accid'], $refnum, $jr_day, $jr_month, $jr_year);
    }
    if (!isset($amount)) {
        $amount = "";
        $details = "";
        $chrgvat = "";
    }
    if ($chrgvat == "yes") {
        $c1 = "checked=yes";
        $c2 = "";
    } else {
        $c1 = "";
        $c2 = "checked=yes";
    }
    $OUT = "\n\t\t\t\t<h3>Journal transaction details</h3>\n\t\t\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t\t\t<input type='hidden' name='key' value='confirm' />\n\t\t\t\t\t<input type='hidden' name='date' value='{$date}' />\n\t\t\t\t\t<input type='hidden' name='ctaccid' value='{$ctacc['accid']}' />\n\t\t\t\t\t<input type='hidden' name='dtaccid' value='{$dtacc['accid']}' />\n\t\t\t\t\t<input type='hidden' name='jr_day' value='{$jr_day}' />\n\t\t\t\t\t<input type='hidden' name='jr_month' value='{$jr_month}' />\n\t\t\t\t\t<input type='hidden' name='jr_year' value='{$jr_year}' />\n\t\t\t\t<table " . TMPL_tblDflts . " width='500'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width='50%'><h3>Debit</h3></td>\n\t\t\t\t\t\t<td width='50%'><h3>Credit</h3></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>{$dtacc['topacc']}/{$dtacc['accnum']} - {$dtacc['accname']}</td>\n\t\t\t\t\t\t<td>{$ctacc['topacc']}/{$ctacc['accnum']} - {$ctacc['accname']}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t" . TBL_BR . "\n\t\t\t\t\t" . TBL_BR . "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Date</td>\n\t\t\t\t\t\t<td valign='center'>{$date}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Reference No.</td>\n\t\t\t\t\t\t<td valign='center'><input type='text' size='20' name='refnum' value='{$refnum}'></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Amount</td>\n\t\t\t\t\t\t<td valign='center'>" . CUR . "<input type='text' size='20' name='amount' value='{$amount}'></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Charge VAT </td>\n\t\t\t\t\t\t<td><input type='radio' name='chrgvat' value='yes' {$c1}>Yes &nbsp;&nbsp; <input type='radio' name='chrgvat' value='no' {$c2}>No</td>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Transaction Details</td>\n\t\t\t\t\t\t<td valign='center'><textarea cols='20' rows='5' name='details'>{$details}</textarea></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Person Authorising</td>\n\t\t\t\t\t\t<td valign='center'><input type='hidden' size='20' name='author' value=" . USER_NAME . ">" . USER_NAME . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t" . TBL_BR . "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><input type='submit' name='back' value='&laquo; Correction'></td>\n\t\t\t\t\t\t<td valign='center'><input type='submit' value='Confirm &raquo;'></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</form>\n\t\t\t\t</table>" . mkQuickLinks(ql("../reporting/index-reports.php", "Financials"), ql("../core/trans-new.php", "Journal Transactions"));
    return $OUT;
}