本文整理汇总了PHP中mkdate函数的典型用法代码示例。如果您正苦于以下问题:PHP mkdate函数的具体用法?PHP mkdate怎么用?PHP mkdate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mkdate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_report
function show_report($_POST)
{
extract($_POST);
if (!isset($employee) or strlen($employee) < 1) {
return "Invalid use of module.";
}
db_connect();
$get_employee = "SELECT * FROM employees WHERE empnum = '{$employee}' LIMIT 1";
$run_employee = db_exec($get_employee) or errDie("Unable to get employees information.");
if (pg_numrows($run_employee) < 1) {
return "Invalid Employee Selected.";
} else {
$earr = pg_fetch_array($run_employee);
//extract($earr);
}
$finstartdate = mkdate(getYearOfFinPrd(1) - 1, $PRDMON[1], 1);
$finenddate = mkldate(getYearOfFinPrd(12) - 1, $PRDMON[12]);
db_connect();
#get all leave for this employee
$get_leave = "SELECT * FROM empleave WHERE empnum = '{$earr['empnum']}' AND startdate > '{$finstartdate}' AND enddate < '{$finenddate}'";
$run_leave = db_exec($get_leave) or errDie("Unable to get employee leave information.");
if (pg_numrows($run_leave) < 1) {
$listing = "Employee did not apply for leave during the previous financial year.";
} else {
$total_leave_days = 0;
$listing = "\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Leave Start Date</th>\n\t\t\t\t\t<th>Leave End Date</th>\n\t\t\t\t\t<th>Approved By</th>\n\t\t\t\t\t<th>Working Days</th>\n\t\t\t\t\t<th>Non Working Days</th>\n\t\t\t\t\t<th>Leave Type</th>\n\t\t\t\t</tr>\n\t\t\t";
while ($larr = pg_fetch_array($run_leave)) {
$total_leave_days = $total_leave_days + $larr['workingdays'];
$listing .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>{$larr['startdate']}</td>\n\t\t\t\t\t\t<td>{$larr['enddate']}</td>\n\t\t\t\t\t\t<td>{$larr['approvedby']}</td>\n\t\t\t\t\t\t<td>{$larr['workingdays']}</td>\n\t\t\t\t\t\t<td>{$larr['nonworking']}</td>\n\t\t\t\t\t\t<td>{$larr['type']}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t";
}
$total_cost = $earr['basic_sal_annum'] / (52 * 5) * $total_leave_days;
}
$display = "\n\t\t\t<h2>Calculate Value Of Employee Leave</h2>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t\t<input type='hidden' name='key' value='xls'>\n\t\t\t\t<input type='hidden' name='employee' value='{$employee}'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan='2'>Details</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Employee:</td>\n\t\t\t\t\t<td>{$earr['fnames']} {$earr['sname']}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Amount Of Annual Leave Days:</td>\n\t\t\t\t\t<td>{$earr['stdlea']}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Total Days Leave Taken</td>\n\t\t\t\t\t<td>{$total_leave_days}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Total Cost Of Employee Leave</td>\n\t\t\t\t\t<td>" . CUR . " {$total_cost}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t{$listing}\n\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan='4'><input type='submit' name='xls' value='Export to spreadsheet'></td>\n\t\t\t\t</tr>\n\t\t\t</form>\n\t\t\t</table>\n\t\t";
return $display;
}
示例2: write
function write($frm)
{
extract($_REQUEST);
if ($frm->validate("write")) {
return confirm($frm);
}
pglib_transaction("BEGIN");
db_conn('cubit');
$user = USER_NAME;
$Sql = "SELECT * FROM assets WHERE (dep_month='yes' AND remaction IS NULL)";
$Rslt = db_exec($Sql) or errDie("Unable to access database.");
$cc = "";
$todate = mkdate($date_year, $date_month, $date_day);
$ttime = mktimefd($todate);
$refnum = getrefnum($todate);
while ($led = pg_fetch_array($Rslt)) {
if (empty($led["autodepr_date"])) {
$led["autodepr_date"] = $led["date"];
}
explodeDate($led["autodepr_date"], $date_year, $date_month, $date_day);
$ftime = mktime(0, 0, 0, $date_month, $date_day, $date_year);
$depmonths = 0;
while ($ftime < $ttime) {
++$depmonths;
$ftime = mktime(0, 0, 0, $date_month + $depmonths, $date_day, $date_year);
}
if ($depmonths == 0) {
continue;
}
$depperc = $led["dep_perc"];
$ml_perc = $depperc * ($depmonths % 12 / 12);
$years = ($depmonths - $depmonths % 12) / 12;
$baseamt = $led["amount"] - $led["accdep"];
$depamt = 0;
/* yearly depreciations */
for ($i = 1; $i <= $years; ++$i) {
$depamt += ($baseamt - $depamt) * ($depperc / 100);
}
/* monthly depreciation */
$depamt += ($baseamt - $depamt) * ($ml_perc / 100);
$sql = "SELECT * FROM assetgrp WHERE grpid = '{$led['grpid']}' AND div = '" . USER_DIV . "'";
$grpRslt = db_exec($sql);
$grp = pg_fetch_array($grpRslt);
writetrans($grp['depacc'], $grp['accdacc'], $todate, $refnum, $depamt, "{$led['des']} Depreciation");
db_connect();
$sql = "UPDATE assets SET accdep = (accdep + '{$depamt}'), autodepr_date='{$todate}'\r\n\t\t\t\tWHERE (id='{$led['id']}' AND div = '" . USER_DIV . "')";
db_exec($sql) or errdie("Could not update assets table.");
$snetval = $baseamt - $depamt;
$sdate = date("Y-m-d");
$sql = "INSERT INTO assetledger(assetid, asset, date, depamt, netval, div) \r\n\t\t\t\tVALUES ('{$led['id']}', '{$led['des']}', '{$todate}', '{$depamt}', '{$snetval}', '" . USER_DIV . "')";
db_exec($sql) or errdie("Could not write to asset ledger.");
$cc .= "CostCenter('ct', 'Asset Depreciation', '{$todate}', '{$led['des']} Depreciation', '{$depamt}', '');";
}
pglib_transaction("COMMIT");
$write = "\r\n\t<script> \r\n\t{$cc}\r\n\t</script>\r\n\t<table " . TMPL_tblDflts . " width='50%'>\r\n\t\t<tr>\r\n\t\t\t<th>Auto Asset Depreciation</th>\r\n\t\t</tr>\r\n\t\t<tr class='datacell'>\r\n\t\t\t<td>Asset Depreciation has calculated and recorded.</td>\r\n\t\t</tr>\r\n\t</table>";
return $write;
}
示例3: getWvListe
function getWvListe()
{
$ret = array();
$mailcnt = 0;
//Mails holen
$mail = holeMailHeader($_SESSION["loginCRM"], $_SESSION['MailFlag']);
if ($mail) {
foreach ($mail as $col) {
$ret[] = array('Type' => "M", 'Status' => $col["Gelesen"], 'cause' => $col["Betreff"], 'Initdate' => $col["Datum"], 'ID' => $col["Nr"], 'IniUser' => htmlspecialchars($col["Abs"]), 'Art' => "E", 'End' => 0);
$mailcnt++;
}
}
//Termine holen
$termine = getTermin(date("d"), date("m"), date("Y"), "T", $_SESSION["loginCRM"]);
//Wiedervorlagen holen
$wvl = getWvl($_SESSION["loginCRM"]);
if ($termine && $wvl) {
$wvl = array_merge($termine, $wvl);
} else {
if ($termine) {
$wvl = $termine;
}
}
$nunD = date("Y-m-d 00:00:00");
$nunT = date("Y-m-d H:i");
if ($wvl) {
foreach ($wvl as $col) {
if ($col["finishdate"] || $col["stoptag"]) {
if ($col["finishdate"] != "" && $col["finishdate"] < $nunD || $col["stoptag"] != "" && $col["stoptag"] . " " . $col["stopzeit"] < $nunT) {
$end = 3;
} else {
$end = 2;
}
$datum = mkdate($col["finishdate"] ? $col["finishdate"] : $col["stoptag"] . " " . $col["stopzeit"] . ":00");
} else {
if ($col["trans_module"]) {
$datum = mkdate($col["initdate"] . " 00:00:00");
} else {
$datum = mkdate($col["initdate"] ? $col["initdate"] : $col["starttag"] . " " . $col["startzeit"] . ":00");
}
$end = 1;
}
if ($col["status"] == "F") {
$Art = "F";
} else {
if ($col["starttag"]) {
$Art = "T";
} else {
$Art = "D";
}
}
$ret[] = array('Type' => $col["kontakt"] ? $col["kontakt"] : "X", 'Status' => $col["status"] ? $col["status"] : "-", 'cause' => $col["cause"], 'Initdate' => $datum, 'ID' => $col["id"], 'IniUser' => $col["ename"] ? $col["ename"] : $col["employee"], 'Art' => $Art, 'End' => $end);
}
}
echo json_encode($ret);
}
示例4: show_notes
function show_notes($_POST)
{
extract($_POST);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($from_day, "num", 1, 2, "Invalid Invoice From Date day.");
$v->isOk($from_month, "num", 1, 2, "Invalid Invoice From Date month.");
$v->isOk($from_year, "num", 1, 5, "Invalid Invoice From Date year.");
$v->isOk($to_day, "num", 1, 2, "Invalid Invoice To Date day.");
$v->isOk($to_month, "num", 1, 2, "Invalid Invoice To Date month.");
$v->isOk($to_year, "num", 1, 5, "Invalid Invoice To Date year.");
$fromdate = mkdate($from_year, $from_month, $from_day);
$todate = mkdate($to_year, $to_month, $to_day);
$v->isOk($fromdate, "date", 1, 1, "Invalid From Date.");
$v->isOk($todate, "date", 1, 1, "Invalid To Date.");
# display errors, if any
if ($v->isError()) {
$err = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$err .= "<li class='err'>" . $e["msg"] . "</li>";
}
return get_filter($_POST, $err);
}
$listing = "\n\t\t<tr>\n\t\t\t<th>Customer</th>\n\t\t\t<th>Credit Note No.</th>\n\t\t\t<th>Ref.</th>\n\t\t\t<th>Date</th>\n\t\t\t<th>Amount</th>\n\t\t\t<th>Stock Returned</th>\n\t\t\t<th>Options</th>\n\t\t</tr>";
db_connect();
$get_sql = "SELECT * FROM credit_notes WHERE tdate >= '{$fromdate}' AND tdate <= '{$todate}'";
$run_get = db_exec($get_sql) or errDie("Unable to get credit note information.");
if (pg_numrows($run_get) < 1) {
$listing .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='7'>No Credit Notes Found.</td>\n\t\t\t</tr>";
} else {
while ($carr = pg_fetch_array($run_get)) {
$get_cust = "SELECT surname FROM customers WHERE cusnum = '{$carr['cusnum']}'";
$run_cust = db_exec($get_cust) or errDie("Unable to get customer information.");
if (pg_numrows($run_cust) < 1) {
$cusname = "";
} else {
$cusname = pg_fetch_result($run_cust, 0, 0);
}
if (isset($carr['used_stock']) and $carr['used_stock'] == "1") {
$showstockused = "Yes";
} else {
$showstockused = "No";
}
$listing .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>{$cusname}</td>\n\t\t\t\t\t<td>g{$carr['creditnote_num']}</td>\n\t\t\t\t\t<td>{$carr['refnum']}</td>\n\t\t\t\t\t<td>{$carr['tdate']}</td>\n\t\t\t\t\t<td>" . CUR . " {$carr['totamt']}</td>\n\t\t\t\t\t<td>{$showstockused}</td>\n\t\t\t\t\t<td><a href='credit-note-print.php?id={$carr['id']}'>Print</a></td>\n\t\t\t\t</tr>";
}
}
$display = "\n\t\t<h2>Listing Of Credit Notes</h2>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t{$listing}\n\t\t</table>";
return $display;
}
示例5: get_period
function get_period()
{
global $PRDMON;
$finstartdate = mkdate(getYearOfFinPrd(1), $PRDMON[1], 1);
$finenddate = mkldate(getYearOfFinPrd(12), $PRDMON[12]);
db_connect();
#get vat period setting
$get_set = "SELECT * FROM settings WHERE label = 'VAT Period' LIMIT 1";
$run_set = db_exec($get_set) or errDie("Unable to get vat period information.");
if (pg_numrows($run_set) < 1) {
return "\n\t\t\t<li class='err'>Please Set VAT Period Setting Before Continuing.</li>\n\t\t\t<p>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='../vat_period_setting.php'>Set VAT Period</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t</table>";
} else {
$sarr = pg_fetch_array($run_set);
$periodlength = $sarr['value'];
$b = 1;
$period_drop = "<select name='period'>";
for ($x = 1; $b < 12; $x = $x + $periodlength) {
$b = $b + $periodlength;
#make sure we dont cross the 12 period limit
if ($b > 12) {
#set period to the last
$dob = $b - 12;
$b = 12;
#make sure we get the last month (the -1 makes us lose 1)
// $PRDMON[$b] = $PRDMON[$b] +1;
} else {
$dob = $b;
}
$start = date("Y-m-d", mktime(0, 0, 0, $PRDMON[$x], 1, getYearOfFinPrd($x)));
$end = date("Y-m-d", mktime(0, 0, 0, $PRDMON[$dob], 0, getYearOfFinPrd($b)));
$period_drop .= "<option value='{$start}|{$end}'>{$start} - {$end}</option>";
}
$period_drop .= "</select>";
}
#generate the periods dropdown based on vat period setting.
$display = "\n\t\t<h2>Select VAT Period For Report</h2>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='confirm'>\n\t\t\t<tr>\n\t\t\t\t<td><li class='err'>NOTE: Pre Generated Values Are The Cubit Recommened Values. </li></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td><li class='err'>However these values may be changed at will.</li></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th>Period</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$period_drop}</td>\n\t\t\t</tr>\n\t\t\t<tr><td></td></tr>\n\t\t\t<tr>\n\t\t\t\t<th>Name For Report</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><input type='text' name='returnname' value='" . date("Y-m-d") . " Report'></td>\n\t\t\t</tr>\n\t\t\t<tr><td></td></tr>\n\t\t\t<tr>\n\t\t\t\t<td align='right'><input type='submit' value='Next'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>";
return $display;
}
示例6: eval
$number++;
$startnow += $config[forum_show_postspp];
} else {
$started++;
$number = "1";
$startnow = "0";
}
$threadid = $thread[id];
eval("\$inc[showpp] .= \"" . gettemplate("forum.showpp.posts.num") . "\";");
}
}
unset($started, $number, $startnow, $countposts);
if ($thread[last_posttime]) {
$lastdate = mkdate($thread[last_posttime]);
} else {
$lastdate = mkdate($thread[settime]);
}
if ($thread[last_posttime] <= $login[last_forum_read]) {
if ($threadcolor % 2 == "0") {
$csstyle = "2";
} else {
$csstyle = "1";
}
} else {
if ($threadcolor % 2 == "0") {
$csstyle = "4";
} else {
$csstyle = "3";
}
}
eval("\$incf[threadbit] .= \"" . gettemplate("forum.board.thread.bit") . "\";");
示例7: show
//.........这里部分代码省略.........
} else {
$_REQUEST['searchid'] = '';
}
}
//Sektionen auflisten
$seclist = '';
if (is_array($apx->sections) && count($apx->sections)) {
foreach ($apx->sections as $res) {
$seclist .= '<option value="' . $res['id'] . '"' . iif($_REQUEST['secid'] == $res['id'], ' selected="selected"') . '>' . replace($res['title']) . '</option>';
}
}
//Kategorien auflisten
$catlist = '';
$data = $set['content']['groups'];
if (count($data)) {
foreach ($data as $id => $title) {
$catlist .= '<option value="' . $id . '"' . iif($_REQUEST['catid'] == $id, ' selected="selected"') . '>' . replace($title) . '</option>';
}
}
//Benutzer auflisten
$userlist = '';
$data = $db->fetch("SELECT b.userid,b.username FROM " . PRE . "_content AS a LEFT JOIN " . PRE . "_user AS b USING (userid) WHERE a.userid!=0 GROUP BY userid ORDER BY username ASC");
if (count($data)) {
foreach ($data as $res) {
$userlist .= '<option value="' . $res['userid'] . '"' . iif($_REQUEST['userid'] == $res['userid'], ' selected="selected"') . '>' . replace($res['username']) . '</option>';
}
}
$apx->tmpl->assign('ITEM', compatible_hsc($_REQUEST['item']));
$apx->tmpl->assign('STITLE', (int) $_REQUEST['title']);
$apx->tmpl->assign('STEXT', (int) $_REQUEST['text']);
$apx->tmpl->assign('SECLIST', $seclist);
$apx->tmpl->assign('CATLIST', $catlist);
$apx->tmpl->assign('USERLIST', $userlist);
$apx->tmpl->assign('EXTENDED', $searchRes);
$apx->tmpl->parse('search');
list($count) = $db->first("SELECT count(id) FROM " . PRE . "_content AS a WHERE 1 " . $resultFilter . section_filter());
pages('action.php?action=content.show&sortby=' . $_REQUEST['sortby'] . iif($_REQUEST['searchid'], '&searchid=' . $_REQUEST['searchid']), $count);
$data = $db->fetch("SELECT a.id,a.secid,a.title,a.lastchange,a.allowcoms,a.allowrating,a.active,a.hits,b.userid,b.username FROM " . PRE . "_content AS a LEFT JOIN " . PRE . "_user AS b USING(userid) WHERE 1 " . $resultFilter . section_filter(true, 'a.secid') . " " . getorder($orderdef) . getlimit());
if (count($data)) {
foreach ($data as $res) {
++$i;
if ($res['active']) {
$tabledata[$i]['COL1'] = '<img src="design/greendot.gif" alt="' . $apx->lang->get('CORE_ACTIVE') . '" title="' . $apx->lang->get('CORE_ACTIVE') . '" />';
} else {
$tabledata[$i]['COL1'] = '<img src="design/reddot.gif" alt="' . $apx->lang->get('CORE_INACTIVE') . '" title="' . $apx->lang->get('CORE_INACTIVE') . '" />';
}
$title = $res['title'];
$title = strip_tags($title);
//$title=str_replace('=>','»',$title);
$title = str_replace('->', '»', $title);
$title = shorttext($title, 40);
$title = replace($title);
$temp = explode('->', $res['title']);
$tmp = unserialize_section($res['secid']);
$link = mklink('content.php?id=' . $res['id'], 'content,' . $res['id'] . urlformat(array_pop($temp)) . '.html', iif($set['main']['forcesection'], iif(unserialize_section($res['secid']) == array('all'), $apx->section_default, array_shift($tmp)), 0));
$tabledata[$i]['COL2'] = '<a href="' . $link . '" target="_blank">' . $title . '</a>';
$tabledata[$i]['COL3'] = replace($res['username']);
$tabledata[$i]['COL4'] = mkdate($res['lastchange'], '<br />');
$tabledata[$i]['COL5'] = $res['hits'];
//Optionen
if ($apx->user->has_right('content.edit') && ($res['userid'] == $apx->user->info['userid'] || $apx->user->has_spright('content.edit'))) {
$tabledata[$i]['OPTIONS'] .= optionHTML('edit.gif', 'content.edit', 'id=' . $res['id'], $apx->lang->get('CORE_EDIT'));
}
if ($apx->user->has_right('content.del') && ($res['userid'] == $apx->user->info['userid'] || $apx->user->has_spright('content.del'))) {
$tabledata[$i]['OPTIONS'] .= optionHTMLOverlay('del.gif', 'content.del', 'id=' . $res['id'], $apx->lang->get('CORE_DEL'));
}
if ($res['active'] && $apx->user->has_right('content.disable') && ($res['userid'] == $apx->user->info['userid'] || $apx->user->has_spright('content.disable'))) {
$tabledata[$i]['OPTIONS'] .= optionHTML('disable.gif', 'content.disable', 'id=' . $res['id'] . '§oken=' . $apx->session->get('sectoken'), $apx->lang->get('CORE_DISABLE'));
} elseif (!$res['active'] && $apx->user->has_right('content.enable') && ($res['userid'] == $apx->user->info['userid'] || $apx->user->has_spright('content.enable'))) {
$tabledata[$i]['OPTIONS'] .= optionHTML('enable.gif', 'content.enable', 'id=' . $res['id'] . '§oken=' . $apx->session->get('sectoken'), $apx->lang->get('CORE_ENABLE'));
} else {
$tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
}
//Kommentare + Bewertungen
if ($apx->is_module('comments') || $apx->is_module('ratings')) {
$tabledata[$i]['OPTIONS'] .= ' ';
}
if ($apx->is_module('comments')) {
list($comments) = $db->first("SELECT count(id) FROM " . PRE . "_comments WHERE ( module='content' AND mid='" . $res['id'] . "' )");
if ($comments && ($apx->is_module('comments') && $set['content']['coms']) && $res['allowcoms'] && $apx->user->has_right('comments.show')) {
$tabledata[$i]['OPTIONS'] .= optionHTML('comments.gif', 'comments.show', 'module=content&mid=' . $res['id'], $apx->lang->get('COMMENTS') . ' (' . $comments . ')');
} else {
$tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
}
}
if ($apx->is_module('ratings')) {
list($ratings) = $db->first("SELECT count(id) FROM " . PRE . "_ratings WHERE ( module='content' AND mid='" . $res['id'] . "' )");
if ($ratings && ($apx->is_module('ratings') && $set['content']['ratings']) && $res['allowrating'] && $apx->user->has_right('ratings.show')) {
$tabledata[$i]['OPTIONS'] .= optionHTML('ratings.gif', 'ratings.show', 'module=content&mid=' . $res['id'], $apx->lang->get('RATINGS') . ' (' . $ratings . ')');
} else {
$tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
}
}
}
}
$apx->tmpl->assign('TABLE', $tabledata);
$html->table($col);
orderstr($orderdef, 'action.php?action=content.show' . iif($_REQUEST['searchid'], '&searchid=' . $_REQUEST['searchid']));
save_index($_SERVER['REQUEST_URI']);
}
示例8: stdmsg
if (!($last = mkdate($last))) {
stdmsg("Error", "Invalid date.");
stdfoot();
die;
}
$q .= ($q ? "&" : "") . "ls={$last}";
$lasttype = $_GET['lst'];
$q .= ($q ? "&" : "") . "lst={$lasttype}";
if ($lasttype == "0") {
// For mySQL 4.1.1 or above use instead
// $where_is .= (isset($where_is)?" AND ":"")."DATE(added) = DATE('$date')";
$where_is .= (isset($where_is) ? " AND " : "") . "(UNIX_TIMESTAMP(last_access) - UNIX_TIMESTAMP('{$last}')) BETWEEN 0 and 86400";
} else {
$where_is .= (isset($where_is) ? " AND " : "") . "u.last_access ";
if ($lasttype == "3") {
$last2 = mkdate(trim($_GET['ls2']));
if ($last2) {
$where_is .= " BETWEEN '{$last}' and '{$last2}'";
$q .= ($q ? "&" : "") . "ls2={$last2}";
} else {
stdmsg("Error", "The second date is not valid.");
stdfoot();
die;
}
} elseif ($lasttype == "1") {
$where_is .= "< '{$last}'";
} elseif ($lasttype == "2") {
$where_is .= "> '{$last}'";
}
}
}
示例9: recvpayment
function recvpayment()
{
extract($_POST);
$v = new validate();
$v->isOk($cusnum, "num", 1, 10, "Invalid customer id.");
$v->isOk($invid, "num", 1, 10, "Invalid invoice id.");
$v->isOk($pcc, "float", 1, 40, "Invalid credit card amount.");
$v->isOk($pcash, "float", 1, 40, "Invalid cash amount.");
$v->isOk($pcheque, "float", 1, 40, "Invalid cheque amount.");
$date = mkdate($pinv_year, $pinv_month, $pinv_day);
$v->isOk($date, "date", 1, 1, "Invalid invoice date.");
if ($v->isError()) {
return details($_POST, $v->genErrors());
}
$amt = sprint($pcc + $pcash + $pcheque);
$cus = qryCustomer($cusnum);
$bank_acc = qryAccountsName("Cash on Hand");
$OUT = "\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<th colspan='2'>Payment Details</th>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Account</td>\n\t\t<td>{$bank_acc['topacc']}/{$bank_acc['accnum']} {$bank_acc['accname']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Date</td>\n\t\t<td valign='center'>{$date}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Received from</td>\n\t\t<td valign='center'>{$cus['cusname']} {$cus['surname']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Description</td>\n\t\t<td valign='center'>POS Payment Received</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Amount</td>\n\t\t<td valign='center'>" . CUR . " {$amt}</td>\n\t</tr>\n\t</table>\n\n\t<form method='post' action='" . SELF . "'>\n\t<input type='hidden' name='key' value='recvpayment_write' />\n\t<input type='hidden' name='bank_acc' value='{$bank_acc['accid']}' />\n\t<input type='hidden' name='invid' value='{$invid}' />\n\t<input type='hidden' name='pcc' value='{$pcc}' />\n\t<input type='hidden' name='pcash' value='{$pcash}' />\n\t<input type='hidden' name='pcheque' value='{$pcheque}' />\n\t<input type='hidden' name='amt' value='{$amt}' />\n\t<input type='hidden' name='date' value='{$date}' />\n\t<input type='hidden' name='cusnum' value='{$cusnum}' />\n\t<input type='hidden' name='descript' value='POS Payment Received' />\n\n\t<input type='hidden' name='stkerr' value='{$stkerr}' />\n\t<input type='hidden' name='prev_cusnum' value='{$prev_cusnum}' />\n\t<input type='hidden' name='deptid' value='{$deptid}' />\n\t<input type='hidden' name='telno' value='{$telno}' />\n\t<input type='hidden' name='cordno' value='{$cordno}' />\n\t<input type='hidden' name='bar' value='{$bar}' />\n\t<input type='hidden' name='des' value='{$des}' />\n\t<input type='hidden' name='sel_frm' value='{$sel_frm}' />\n\t<input type='hidden' name='ordno' value='{$ordno}' />\n\t<input type='hidden' name='pinv_day' value='{$pinv_day}' />\n\t<input type='hidden' name='pinv_month' value='{$pinv_month}' />\n\t<input type='hidden' name='pinv_year' value='{$pinv_year}' />\n\t<input type='hidden' name='chrgvat' value='{$chrgvat}' />\n\t<input type='hidden' name='salespn' value='{$salespn}' />\n\t<input type='hidden' name='traddisc' value='{$traddisc}' />\n\t<input type='hidden' name='delchrg' value='{$delchrg}' />\n\t<input type='hidden' name='delvat' value='{$delvat}' />\n\t<input type='hidden' name='user' value='{$user}' />\n\t<input type='hidden' name='SUBTOT' value='{$subtot}' />\n\t<input type='hidden' name='comm' value='{$comm}' />\n\n\t<table " . TMPL_tblDflts . ">";
// Connect to database
db_connect();
$sql = "SELECT invnum,invid,balance,terms,odate FROM invoices\n\t\t\tWHERE cusnum = '{$cusnum}' AND printed = 'y' AND balance>0\n\t\t\t\tAND div = '" . USER_DIV . "'\n\t\t\tORDER BY odate ASC";
$prnInvRslt = db_exec($sql);
$i = 0;
while (($inv = pg_fetch_array($prnInvRslt)) && $amt > 0) {
if ($i == 0) {
$OUT .= "\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'> </td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><h3>Outstanding Invoices</h3></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th>Invoice</th>\n\t\t\t\t<th>Outstanding Amount</th>\n\t\t\t\t<th>Terms</th>\n\t\t\t\t<th>Date</th>\n\t\t\t\t<th>Amount</th>\n\t\t\t</tr>";
}
$invid = $inv['invid'];
$val = allocamt($amt, $inv["balance"]);
$OUT .= "\n\t\t<input type='hidden' name='paidamt[{$invid}]' size=10 value='{$val}'>\n\t\t<input type='hidden' size=20 name=invids[{$invid}] value='{$inv['invid']}'>\n\t\t<tr bgcolor='" . bgcolor($i) . "'>\n\t\t\t<td>{$inv['invnum']}</td>\n\t\t\t<td>" . CUR . " {$inv['balance']}</td>\n\t\t\t<td>{$inv['terms']} days</td>\n\t\t\t<td>{$inv['odate']}</td>\n\t\t\t<td>" . CUR . " {$val}</td>\n\t\t</tr>";
}
$sql = "SELECT invnum,invid,balance,sdate as odate FROM nons_invoices\n\t\t\tWHERE cusid='{$cusnum}' AND done='y' AND balance>0\n\t\t\t\tAND div='" . USER_DIV . "'\n\t\t\tORDER BY odate ASC";
$prnInvRslt = db_exec($sql);
while (($inv = pg_fetch_array($prnInvRslt)) && $amt > 0) {
if ($i == 0) {
$OUT .= "\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'> </td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><h3>Outstanding Non-Stock Invoices</h3></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th>Invoice</th>\n\t\t\t\t<th>Outstanding Amount</th>\n\t\t\t\t<th></th>\n\t\t\t\t<th>Date</th>\n\t\t\t\t<th>Amount</th>\n\t\t\t</tr>";
}
$invid = $inv['invid'];
$val = allocamt($amt, $inv["balance"]);
$OUT .= "\n\t\t\t\t<input type='hidden' name='paidamt[{$invid}]' value='{$val}'>\n\t\t\t\t<input type='hidden' name='itype[{$invid}]' value='Yes'>\n\t\t\t\t<tr bgcolor='" . bgcolor($i) . "'>\n\t\t\t\t\t<td><input type='hidden' size='20' name='invids[{$invid}]' value='{$inv['invid']}'>{$inv['invnum']}</td>\n\t\t\t\t\t<td>" . CUR . " {$inv['balance']}</td>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td>{$inv['odate']}</td>\n\t\t\t\t\t<td>" . CUR . " {$val}</td>\n\t\t\t\t</tr>";
}
$amt = sprint($amt);
/* pos invoices */
$sqls = array();
for ($i = 1; $i <= 12; ++$i) {
$sqls[] = "SELECT invnum,invid,balance,odate FROM \"{$i}\".pinvoices\n\t\t\t\t\tWHERE cusnum='{$cusnum}' AND done='y' AND balance>0\n\t\t\t\t\t\tAND div='" . USER_DIV . "'";
}
$sql = implode(" UNION ", $sqls);
$prnInvRslt = db_exec($sql);
if (pg_numrows($prnInvRslt) > 0) {
$OUT .= "\n\t\t<tr>\n\t\t\t<td colspan='2'><br></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan='2'><h3>Outstanding POS Invoices</h3></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<th>Invoice</th>\n\t\t\t<th>Outstanding Amount</th>\n\t\t\t<th></th>\n\t\t\t<th>Date</th>\n\t\t\t<th>Amount</th>\n\t\t</tr>";
$i = 0;
while ($inv = pg_fetch_array($prnInvRslt)) {
$invid = $inv['invid'];
$val = allocamt($amt, $inv["balance"]);
$OUT .= "\n\t\t\t<input type='hidden' size='20' name='invids[{$invid}]' value='{$inv['invid']}'>\n\t\t\t<input type='hidden' name='paidamt[{$invid}]' size=10 value='{$val}'>\n\t\t\t<input type='hidden' name='ptype[{$invid}]' value='YnYn'>\n\t\t\t<tr bgcolor='" . bgcolor($i) . "'>\n\t\t\t\t<td>{$inv['invnum']}</td>\n\t\t\t\t<td>" . CUR . " {$inv['balance']}</td>\n\t\t\t\t<td></td>\n\t\t\t\t<td>{$inv['odate']}</td>\n\t\t\t\t<td>" . CUR . " {$val}</td>\n\t\t\t</tr>";
}
}
if ($amt > 0) {
/* START OPEN ITEMS */
$ox = "";
$sql = "SELECT * FROM cubit.open_stmnt WHERE balance>0 AND cusnum='{$cusnum}'\n\t\t\t\t\tAND type!='Invoice' AND type!='Non-Stock Invoice'\n\t\t\t\t\tAND type!='Interest on Outstanding balance'\n\t\t\t\tORDER BY date";
$rslt = db_exec($sql) or errDie("Unable to get open items.");
$open_out = $amt;
$i = 0;
while ($od = pg_fetch_array($rslt)) {
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 .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<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>\n\t\t\t\t\t<td>{$od['date']}</td>\n\t\t\t\t\t<td><input type='hidden' name='open_amount[{$oid}]' value='{$open_amount[$oid]}'>" . CUR . " {$open_amount[$oid]}</td>\n\t\t\t\t</tr>";
} elseif ($open_out < $od['balance']) {
$open_amount[$oid] = $open_out;
$open_out = 0;
$ox .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<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>\n\t\t\t\t\t<td>{$od['date']}</td>\n\t\t\t\t\t<td><input type='hidden' name='open_amount[{$oid}]' value='{$open_amount[$oid]}'>" . CUR . " {$open_amount[$oid]}</td>\n\t\t\t\t</tr>";
}
$i++;
}
if (open()) {
$OUT .= "\n\t\t\t" . TBL_BR . "\n\t\t\t<input type='hidden' name='bout' value='{$amt}'>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><h3>Outstanding Transactions</h3></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th>Description</th>\n\t\t\t\t<th>Outstanding Amount</th>\n\t\t\t\t<th>Date</th>\n\t\t\t\t<th>Amount</th>\n\t\t\t</tr>";
$OUT .= $ox;
$bout = $amt;
$amt = $open_out;
if ($amt > 0) {
$OUT .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td colspan='4'><b>A general transaction will credit the client's account with " . CUR . " {$amt}</b></td>\n\t\t\t\t</tr>";
}
//$amt=$bout;
} else {
$OUT .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='4'><b>A general transaction will credit the client's account with " . CUR . " {$amt} </b></td>\n\t\t\t</tr>";
}
}
$OUT .= "\n\t<input type='hidden' name='out' value='{$amt}' />\n\t<tr>\n\t\t<td colspan='5' align='right'>\n\t\t\t<input type='submit' name='btn_back' value='« Correction' />\n\t\t\t<input type='submit' value='Record Payment' />\n\t\t</td>\n\t</table>";
return $OUT;
}
示例10: profile
function profile()
{
global $set, $apx, $tmpl, $db, $user;
if (!$_REQUEST['id']) {
die('missing ID!');
}
$res = $db->first("SELECT a.userid,a.username,a.email,a.reg_time,a.reg_email,a.lastactive,b.name FROM " . PRE . "_user AS a LEFT JOIN " . PRE . "_user_groups AS b USING(groupid) WHERE a.userid='" . $_REQUEST['id'] . "'");
$apx->tmpl->assign('USERID', $res['userid']);
$apx->tmpl->assign('USERNAME', replace($res['username']));
$apx->tmpl->assign('REGDATE', mkdate($res['reg_time']));
$apx->tmpl->assign('REGEMAIL', replace($res['reg_email']));
$apx->tmpl->assign('EMAIL', replace($res['email']));
$apx->tmpl->assign('LASTACTIVE', mkdate($res['lastactive']));
$apx->tmpl->assign('GROUPNAME', replace($res['name']));
$apx->tmpl->parse('profile');
}
示例11: write
function write($_POST)
{
# Get vars
extract($_POST);
if (isset($noduty)) {
$_POST["noduty"] = "yes";
} else {
$exd = "";
}
# Validate input
require_lib("validate");
$v = new validate();
$v->isOk($letters, "string", 0, 5, "Invalid First 3 Letters.");
$v->isOk($supid, "num", 1, 20, "Please Select Supplier.");
$v->isOk($terms, "num", 1, 5, "Invalid terms days.");
$v->isOk($ipur_day, "num", 1, 2, "Invalid Date day.");
$v->isOk($ipur_month, "num", 1, 2, "Invalid Date month.");
$v->isOk($ipur_year, "num", 1, 5, "Invalid Date year.");
$v->isOk($del_day, "num", 1, 2, "Invalid Delivery Date day.");
$v->isOk($del_month, "num", 1, 2, "Invalid Delivery Date month.");
$v->isOk($del_year, "num", 1, 5, "Invalid Delivery Date year.");
//$v->isOk ($curr, "string", 1, 20, "Invalid Foreign currency.");
$v->isOk($xrate, "float", 1, 20, "Invalid Exchange Rate.");
$v->isOk($tax, "float", 0, 20, "Invalid Tax.");
$v->isOk($shipchrg, "float", 0, 20, "Invalid Shipping Charges.");
$v->isOk($remarks, "string", 0, 255, "Invalid Remarks.");
$pdate = mkdate($ipur_year, $ipur_month, $ipur_day);
$v->isOk($pdate, "date", 1, 1, "Invalid purchase date.");
$ddate = mkdate($del_year, $del_month, $del_day);
$v->isOk($ddate, "date", 1, 1, "Invalid delivery date.");
# Used to generate errors
$error = "asa@";
# Check quantities
if (isset($qtys)) {
foreach ($qtys as $keys => $qty) {
$v->isOk($qty, "float", 1, 15, "Invalid Quantity for product number : <b>" . ($keys + 1) . "</b>");
$v->isOk($unitcost[$keys], "float", 0, 20, "Invalid Unit Price for product number : <b>" . ($keys + 1) . "</b>.");
$v->isOk($cunitcost[$keys], "float", 0, 20, "Invalid Foreign currency Unit Price for product number : <b>" . ($keys + 1) . "</b>.");
$v->isOk($duty[$keys], "float", 0, 20, "Invalid Duty Charges for product number : <b>" . ($keys + 1) . "</b>.");
$v->isOk($dutyp[$keys], "float", 0, 20, "Invalid Duty Charges Percentage for product number : <b>" . ($keys + 1) . "</b>.");
if ($qty < 1) {
$v->isOk($qty, "num", 0, 0, "Error : Item Quantity must be at least one. Product number : <b>" . ($keys + 1) . "</b>");
}
# Nasty Zeros
$unitcost[$keys] += 0;
$cunitcost[$keys] += 0;
$duty[$keys] += 0;
$dutyp[$keys] += 0;
}
}
# Check whids
if (isset($whids)) {
foreach ($whids as $keys => $whid) {
$v->isOk($whid, "num", 1, 10, "Invalid Store number, please enter all details.");
}
}
# Check stkids
if (isset($stkids)) {
foreach ($stkids as $keys => $stkid) {
$v->isOk($stkid, "num", 1, 10, "Invalid Stock number, please enter all details.");
}
}
# Check amt
if (isset($amt)) {
foreach ($amt as $keys => $amount) {
$v->isOk($amount, "float", 1, 20, "Invalid Amount, please enter all details.");
}
}
# Display errors, if any
$err = "";
if ($v->isError()) {
$errors = $v->getErrors();
foreach ($errors as $e) {
$err .= "<li class='err'>" . $e["msg"] . "</li>";
}
$_POST['done'] = "";
return details($_POST, $err);
}
# Get Order info
db_connect();
$sql = "SELECT * FROM purch_int WHERE purid = '{$purid}' AND div = '" . USER_DIV . "'";
$purRslt = db_exec($sql) or errDie("Unable to get Order information");
if (pg_numrows($purRslt) < 1) {
return "<li>- Order Not Found</li>";
}
$pur = pg_fetch_array($purRslt);
# check if Order has been printed
if ($pur['received'] == "y") {
$error = "<li class='err'> Error : Order number <b>{$purid}</b> has already been received.</li>";
$error .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $error;
}
# Get selected customer info
db_connect();
$sql = "SELECT * FROM suppliers WHERE supid = '{$supid}' AND div = '" . USER_DIV . "'";
$supRslt = db_exec($sql) or errDie("Unable to get customer information");
if (pg_numrows($supRslt) < 1) {
// code here
} else {
$sup = pg_fetch_array($supRslt);
//.........这里部分代码省略.........
示例12: update
function update($_POST)
{
extract($_POST);
$collect_ar = array();
if (!empty($client_collect)) {
$collect_ar[] = "Client Collect";
}
if (!empty($collect)) {
$collect_ar[] = "Collect";
}
if (!empty($deliver)) {
$collect_ar[] = "Deliver";
}
$collection = implode(", ", $collect_ar);
// if ((in_array("Collect", $collect_ar) && in_array("Client Collect", $collect_ar))
// || (count($collect_ar) == 3)) {
// return "<li class='err'>Invalid collection options selected.</li>";
// }
if (count($collect_ar) > 1 && in_array("Client Collect", $collect_ar)) {
return "<li class='err'>Invalid collection options selected.</li>";
}
$temp_assets = explode(",", $temp_assets);
pglib_transaction("BEGIN");
if (isset($nhalf_day) && $nhalf_day == "checked") {
$nhalf_day = 1;
} else {
$nhalf_day = 0;
}
if (isset($nweekends) && $nweekends == "checked") {
$nweekends = 1;
} else {
$nweekends = 0;
}
$sql = "UPDATE hire.hire_invoices SET comm='{$comm}' WHERE invid='{$invid}'";
$comm_rslt = db_exec($sql) or errDie("Unable to retrieve invoice.");
foreach ($temp_assets as $key => $value) {
$sql = "SELECT * FROM cubit.assets WHERE id='{$key}'";
$asset_rslt = db_exec($sql) or errDie("Unable to retrieve asset.");
$asset_data = pg_fetch_array($asset_rslt);
}
if (isset($amount)) {
foreach ($amount as $key => $value) {
// if (empty($monthly)) {
// $amount[$key] = "";
// }
if (!user_is_admin(USER_ID)) {
$amount[$key] = "";
}
if (!isset($half_day[$key]) || empty($half_day[$key])) {
$half_day[$key] = 0;
}
if (!isset($weekends[$key]) || empty($weekends[$key])) {
$weekends[$key] = 0;
} else {
$weekends[$key] = 1;
}
if (empty($amount[$key]) && $amount != "0") {
if ($basis[$key] == "per_day") {
$hifrm = "{$mfrm_year[$key]}-{$mfrm_month[$key]}-{$mfrm_day[$key]}";
$hito = "{$mto_year[$key]}-{$mto_month[$key]}-{$mto_day[$key]}";
$hours = "0";
/* calculate amount */
$ftime = getDTEpoch("{$hifrm} 0:00:00");
$ttime = getDTEpoch("{$hito} 0:00:00");
$days = 0;
$weeks = 0;
while ($ftime <= $ttime) {
if (date("w", $ftime) == 0 && isset($weekends[$key]) && $weekends[$key]) {
$days += 0.6;
} else {
++$days;
}
$ftime += 24 * 60 * 60;
}
if (is_numeric($rain_days[$key])) {
$days -= $rain_days[$key];
}
$timeunits = $days;
} else {
if ($basis[$key] == "per_hour") {
$hifrm = $hito = mkdate($pinv_year, $pinv_month, $pinv_day);
$timeunits = $hours;
$weeks = 0;
if (empty($hours) || !is_numeric($hours)) {
return "\r\n\t\t\t\t\t\t\t<li class='err'>\r\n\t\t\t\t\t\t\t\t<b>ERROR</b>: Invalid amount of hours.\r\n\t\t\t\t\t\t\t</li>";
}
} else {
if ($nbasis == "per_week") {
$nhifrm = $nhito = mkdate($pinv_year, $pinv_month, $pinv_day);
$timeunits = $weeks;
$hours = 0;
if (empty($weeks) || !is_numeric($weeks)) {
return "\r\n\t\t\t\t\t\t\t<li class='err'>\r\n\t\t\t\t\t\t\t\t<b>ERROR</b>: Invalid amount of weeks.\r\n\t\t\t\t\t\t\t</li>";
}
}
}
}
if ($half_day[$key]) {
$amount[$key] = $qty[$key] * $timeunits * (basisPrice($cusnum, $asset_id[$key], $basis[$key]) * $qty[$key]) - basisPrice($cusnum, $asset_id[$key], $basis[$key]) * $qty[$key] + basisPrice($cusnum, $asset_id[$key], $basis[$key]) * $qty[$key] / 2;
} else {
//.........这里部分代码省略.........
示例13: die
<?php
if (!preg_match("/index.php/", $REQUEST_URI)) {
die("Direct Open not allowed.");
}
if ($login[id]) {
$lastvisit = mkdate($login[last_avtiv]);
if ($tab[forum_post]) {
list($newforum) = $db->query("SELECT COUNT(id) FROM {$tab['forum_post']} WHERE settime>='{$login['last_forum_read']}' AND aut_id<>'{$login['id']}'");
} else {
$newforum = "N/A";
}
if ($tab[pm]) {
list($unreadpms) = $db->query("SELECT COUNT(id) FROM {$tab['pm']} WHERE inbox='1' AND toid='{$login['id']}' AND view='0'");
} else {
$unreadpms = "N/A";
}
if ($login[rate_count]) {
$rating = mkstatus($login[rate_points], $login[rate_count]);
$rount_number = round($login[rate_points] / $login[rate_count], 4);
}
if (!$login[upload_allow]) {
$upload_paths = "---";
} else {
$ftpq = $db->query_str("SELECT * FROM {$tab['upload_access']} WHERE userid='{$login['id']}'");
while ($set = $db->fetch_array($ftpq)) {
$upload_path[] = $set[path];
}
if (is_array($upload_path)) {
$upload_paths = implode("<br>", $upload_path);
}
示例14: write
function write($_POST)
{
# get vars
extract($_POST);
// prevent from updating
if (isset($cusnum) && customer_overdue($cusnum)) {
return details($_POST);
}
db_conn('cubit');
if (isset($printsales)) {
$Sl = "SELECT * FROM settings WHERE constant='SALES'";
$Ri = db_exec($Sl) or errDie("Unable to get settings.");
if (pg_num_rows($Ri) < 1) {
$Sl = "INSERT INTO settings (constant,value,div) VALUES ('SALES','Yes','" . USER_DIV . "')";
$Ri = db_exec($Sl);
} else {
$Sl = "UPDATE settings SET value='Yes' WHERE constant='SALES' AND div='" . USER_DIV . "'";
$Ri = db_exec($Sl);
}
} else {
$Sl = "UPDATE settings SET value='No' WHERE constant='SALES' AND div='" . USER_DIV . "'";
$Ri = db_exec($Sl);
}
if (!isset($bodydata)) {
$bodydata = "";
}
if (!isset($counter)) {
$counter = "";
}
$bodydata = str_replace("'", "", $bodydata);
$bodydata = str_replace(" ", " ", $bodydata);
$bodydata = str_replace(" ", " ", $bodydata);
$bodydata = str_replace(" ", " ", $bodydata);
$bodydata = str_replace(" ", " ", $bodydata);
$des[$counter] = $bodydata;
# validate input
require_lib("validate");
$v = new validate();
if (empty($ninv_year)) {
list($ninv_year, $ninv_month, $ninv_day) = date("Y-m-d");
}
$odate = mkdate($ninv_year, $ninv_month, $ninv_day);
$v->isOk($odate, "date", 1, 1, "Invalid Date.");
# used to generate errors
$error = "asa@";
// check the invoice details
$v->isOK($cusname, "string", 1, 100, "Invalid customer name");
$v->isOK($cusaddr, "string", 0, 400, "Invalid customer address");
$v->isOK($cusvatno, "string", 0, 50, "Invalid customer vat number");
$v->isOK($docref, "string", 0, 20, "Invalid Document Reference No.");
$v->isOK($cordno, "string", 0, 20, "Invalid Customer Order Number.");
if ($chrgvat != "yes" && $chrgvat != "no" && $chrgvat != "none") {
$v->addError($chrgvat, "Invalid vat option");
}
# check quantities
if (isset($qtys)) {
foreach ($qtys as $keys => $qty) {
$v->isOk($qty, "float", 1, 10, "Invalid Quantity for product number : <b>" . ($keys + 1) . "</b>");
$v->isOk($unitcost[$keys], "float", 1, 20, "Invalid Unit Price for product number : <b>" . ($keys + 1) . "</b>.");
// $v->isOk ($des[$keys], "url", 1, 255, "Invalid Description.");
if ($qty <= 0) {
$v->isOk($qty, "num", 0, 0, "Error : Item Quantity can't be zero or less. Product number: <b>" . ($keys + 1) . "</b>");
}
}
}
# check amt
if (isset($amt)) {
foreach ($amt as $keys => $amount) {
$v->isOk($amount, "float", 1, 16, "Invalid Amount, please enter all details.");
}
}
# display errors, if any
$err = "";
if ($v->isError()) {
$errors = $v->getErrors();
foreach ($errors as $e) {
$err .= "<li class='err'>" . $e["msg"] . "</li>";
}
$_POST['done'] = "";
return details($_POST, $err);
}
# Get purchase info
db_connect();
$sql = "SELECT * FROM nons_invoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
$invRslt = db_exec($sql) or errDie("Unable to get purchase information");
if (pg_numrows($invRslt) < 1) {
return "<li>- Invoice Not Found</li>";
}
$inv = pg_fetch_array($invRslt);
$inv['chrgvat'] = $chrgvat;
# check if purchase has been printed
if ($inv['done'] == "y") {
$error = "<li class='err'> Error : Invoice number <b>{$invid}</b> has already been printed.";
$error .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $error;
}
$vatamount = 0;
$showvat = TRUE;
# insert purchase to DB
db_conn("cubit");
//.........这里部分代码省略.........
示例15: confirm
function confirm($_POST)
{
extract($_POST);
if (isset($back)) {
return view();
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($bankid, "num", 1, 20, "Invalid Bank ID.");
foreach ($amount as $key => $value) {
// if($amount[$key] > 0){
# check all vars
$v->isOk($to[$key], "string", 0, 255, "Invalid receipient/depositor.");
$v->isOk($trantype[$key], "string", 1, 20, "Invalid transaction type.");
$v->isOk($descript[$key], "string", 0, 255, "Invalid description.");
$v->isOk($ref[$key], "string", 0, 255, "Invalid reference <b>[{$key}]</b>.");
$v->isOk($cheqnum[$key], "num", 0, 20, "Invalid cheque number <b>[{$key}]</b>.");
$v->isOk($amount[$key], "float", 0, 8, "Invalid amount <b>[{$key}]</b>.");
$v->isOk($chrgvat[$key], "string", 1, 4, "Invalid VAT option.");
$v->isOk($accinv[$key], "num", 1, 20, "Invalid account involved <b>[{$key}]</b>.");
if (empty($amount[$key])) {
unset($amount[$key]);
}
# put date together and check
$date[$key] = mkdate($o_year[$key], $o_month[$key], $o_day[$key]);
$v->isOk($date[$key], "date", 1, 1, "Invalid date <b>[{$key}]</b>.");
// }
}
# 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='« Correct submission'>";
return $confirm;
}
# Get bank acc details
$bankRslt = get("cubit", "*", "bankacct", "bankid", $bankid);
$bank = pg_fetch_array($bankRslt);
# Layout
$confirm = "\n\t\t<center>\n\t\t<h3>Type in Bank Statement</h3>\n\t\t<h4>Confirm entry</h4>\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='number' value='{$number}'>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td align='center' colspan='4'>Bank Account : <b>({$bank['accnum']}) {$bank['accname']}</b></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th>Date</th>\n\t\t\t\t<th>Paid to/Received from</th>\n\t\t\t\t<th>Transaction type</th>\n\t\t\t\t<th>Transaction Description</th>\n\t\t\t\t<th>Reference</th>\n\t\t\t\t<th>Cheque Number</th>\n\t\t\t\t<th>Transaction Amount</th>\n\t\t\t\t<th>VAT</th>\n\t\t\t\t<th>VAT Code</th>\n\t\t\t\t<th>Contra Account</th>\n\t\t\t</tr>";
# Display the trans
$trans = "";
foreach ($amount as $key => $value) {
if ($amount[$key] > 0) {
# get account name
$accRslt = get("core", "accname,topacc,accnum", "accounts", "accid", $accinv[$key]);
$acc = pg_fetch_array($accRslt);
$vd = qryVatcode($vatcode[$key]);
if ($vd["zero"] == "Yes") {
$chrgvat[$key] = "no";
}
$vatp = $vd["vat_amount"];
$totamt = $amount[$key];
if ($chrgvat[$key] == "exc") {
$vat = sprint($vatp / 100 * $amount[$key]);
$totamt += $vat;
$vatin = CUR . " <input type='text' size='6' name='vat[{$key}]' value='{$vat}' />";
} elseif ($chrgvat[$key] == "inc") {
$vat = sprint($amount[$key] / (100 + $vatp) * $vatp);
$vatin = CUR . " <input type='text' size='6' name='vat[{$key}]' value='{$vat}' />";
} else {
$vat = "No VAT";
$vatd = "{$vat}";
$vatin = "No VAT";
}
# alternate bgcolor
$bgColor = bgcolorc($key);
vsprint($totamt);
$trans .= "\n\t\t\t\t<input type='hidden' size='2' name='date[{$key}]' value='{$date[$key]}' />\n\t\t\t\t<input type='hidden' name='to[{$key}]' value='{$to[$key]}' />\n\t\t\t\t<input type='hidden' name='trantype[{$key}]' value='{$trantype[$key]}' />\n\t\t\t\t<input type='hidden' name='descript[{$key}]' value='{$descript[$key]}' />\n\t\t\t\t<input type='hidden' name='ref[{$key}]' value='{$ref[$key]}' />\n\t\t\t\t<input type='hidden' name='cheqnum[{$key}]' value='{$cheqnum[$key]}' />\n\t\t\t\t<input type='hidden' name='amount[{$key}]' value='{$amount[$key]}' />\n\t\t\t\t<input type='hidden' name='chrgvat[{$key}]' value='{$chrgvat[$key]}' />\n\t\t\t\t<input type='hidden' name='vatcode[{$key}]' value='{$vatcode[$key]}' />\n\t\t\t\t<input type='hidden' name='accinv[{$key}]' value='{$accinv[$key]}' />\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td align='center'>{$date[$key]}</td>\n\t\t\t\t\t<td align='center'>{$to[$key]}</td>\n\t\t\t\t\t<td align='center'>{$trantype[$key]}</td>\n\t\t\t\t\t<td align='center'>{$descript[$key]}</td>\n\t\t\t\t\t<td align='center'>{$ref[$key]}</td>\n\t\t\t\t\t<td align='center'>{$cheqnum[$key]}</td>\n\t\t\t\t\t<td align='center' nowrap='t'>" . CUR . " {$totamt}</td></td>\n\t\t\t\t\t<td align='center' nowrap='t'>{$vatin}</td>\n\t\t\t\t\t<td align='center'>{$vd['code']}</td>\n\t\t\t\t\t<td align='center'>{$acc['topacc']}/{$acc['accnum']} - {$acc['accname']}</td></td>\n\t\t\t\t</tr>";
}
}
if (strlen($trans) < 5) {
$err = "<li class='err'> - Please enter full transaction details";
return enter($_POST, $err);
}
$confirm .= "\n\t\t\t{$trans}\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td align='right'><input type='submit' name='batch' value='Add to Batch »'></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><input type='submit' name='back' value='« Correction'></td>\n\t\t\t\t<td align='right' colspan='4'><input type='submit' value='Write »'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>" . mkQuickLinks();
return $confirm;
}