本文整理匯總了PHP中DateDiff函數的典型用法代碼示例。如果您正苦於以下問題:PHP DateDiff函數的具體用法?PHP DateDiff怎麽用?PHP DateDiff使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DateDiff函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ParseLDAP
function ParseLDAP()
{
$ldap = new cronldap();
$today = date('Y-m-d');
$connect = $ldap->ldap_connection;
$_GET["suffix"] = $ldap->suffix;
$pattern = "(&(objectClass=UserArticaClass)(FinalDateToLive=*)(!(FinalDateToLive=0)))";
$attr = array("uid", "FinalDateToLive", "dn");
$sr = ldap_search($connect, $_GET["suffix"], $pattern, $attr);
if ($sr) {
$hash = ldap_get_entries($connect, $sr);
if ($hash["count"] > 0) {
for ($i = 0; $i < $hash["count"]; $i++) {
$uid = $hash[$i]["uid"][0];
$dn = $hash[$i]["dn"];
$FinalDateToLive = $hash[$i][strtolower("FinalDateToLive")][0];
$diff = DateDiff($today, $FinalDateToLive);
echo "Analyze {$dn}: {$uid} :{$FinalDateToLive} ({$diff} day(s))\n";
if ($diff < 0) {
echo "This user must be deleted...\n";
delete_ldap($dn, $connect, true);
DeleteMBX($uid);
}
}
}
}
@ldap_unbind($connect);
unset($GLOBALS["LDAP_BIN_ID"]);
unset($GLOBALS["LDAP_CONNECT_ID"]);
echo "\n";
}
示例2: updatecar
public function updatecar($reg = '')
{
include "../connect.php";
$sql = "SELECT * FROM checkcar WHERE registration='{$reg}'";
$res = mysqli_query($conn, $sql);
$i = 0;
while ($row = mysqli_fetch_assoc($res)) {
$ar[$i] = $row['date_'];
if ($i > 0) {
$d = (int) DateDiff($ar[$i], $ar[$i - 1]);
$a = $ar[$i];
if ($d < 0) {
$d = $d * -1;
}
// echo $d;
mysqli_query($conn, "UPDATE checkcar SET countday='{$d}' WHERE registration='{$reg}' AND date_='{$a}'");
}
$i++;
}
}
示例3: DateDiff
$_SESSION['countdate'] = DateDiff($_SESSION['date2'], $_SESSION['date3']);
$data = array("mild" => $_POST['mild'], "date" => $_POST['date'], "regis" => $_POST["regis"], "countdate" => $_SESSION['countdate']);
$_SESSION["datelate"] = $_POST['date'];
/*
$sql = "INSERT INTO checkcar.check_id, Car.registration
FROM checkcar
INNER JOIN Car
ON checkcar.check_id=Car.car_id";
*/
$sql = "INSERT INTO checkcar (registration, date_,mile_late)\n VALUES (?,?,?) ";
$qr = $conn->prepare($sql);
if ($qr === false) {
trigger_error("Wrong SQL" . $sql . "Error :" . $conn->error, E_USER_ERROR);
}
$qr->bind_param("ssi", $data["regis"], $data["date"], $data["mild"]);
$qr->execute();
$reg = $data["regis"];
$result = mysql_query($conn, "SELECT * FROM checkcar WHERE registration={$reg}");
$i = 0;
while ($row = mysql_fetch_assoc($result)) {
$ar[$i] = $row['date_'];
if ($i % 2 == 1) {
echo DateDiff($ar[$i], $ar[$i - 1]);
}
}
$qr->close();
?>
<script language="javascript">
window.location = "../layout/page.php";
</script>
示例4: filter_number_format
/*Tax being entered manually accept the taxamount entered as is*/
$_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount = filter_number_format($_POST['TaxAmount' . $Tax->TaxCalculationOrder]);
}
$TaxTotal += $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount;
}
$InputError = False;
if ($TaxTotal + $_SESSION['SuppTrans']->OvAmount <= 0) {
$InputError = True;
prnMsg(_('The credit note as entered cannot be processed because the total amount of the credit note is less than or equal to 0') . '. ' . _('Credit notes are expected to be entered as positive amounts to credit'), 'warn');
} elseif (mb_strlen($_SESSION['SuppTrans']->SuppReference) < 1) {
$InputError = True;
prnMsg(_('The credit note as entered cannot be processed because the there is no suppliers credit note number or reference entered') . '. ' . _('The supplier credit note number must be entered'), 'error');
} elseif (!Is_Date($_SESSION['SuppTrans']->TranDate)) {
$InputError = True;
prnMsg(_('The credit note as entered cannot be processed because the date entered is not in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error');
} elseif (DateDiff(Date($_SESSION['DefaultDateFormat']), $_SESSION['SuppTrans']->TranDate, 'd') < 0) {
$InputError = True;
prnMsg(_('The credit note as entered cannot be processed because the date is after today') . '. ' . _('Purchase credit notes are expected to have a date prior to or today'), 'error');
} elseif ($_SESSION['SuppTrans']->ExRate <= 0) {
$InputError = True;
prnMsg(_('The credit note as entered cannot be processed because the exchange rate for the credit note has been entered as a negative or zero number') . '. ' . _('The exchange rate is expected to show how many of the suppliers currency there are in 1 of the local currency'), 'warn');
} elseif ($_SESSION['SuppTrans']->OvAmount < round($TotalShiptValue + $TotalGLValue + $TotalAssetValue + $TotalGRNValue, $_SESSION['SuppTrans']->CurrDecimalPlaces)) {
prnMsg(_('The credit note total as entered is less than the sum of the shipment charges') . ', ' . _('the general ledger entries (if any) and the charges for goods received') . '. ' . _('There must be a mistake somewhere') . ', ' . _('the credit note as entered will not be processed'), 'error');
$InputError = True;
} else {
/* SQL to process the postings for purchase credit note */
/*Start an SQL transaction */
DB_Txn_Begin($db);
/*Get the next transaction number for internal purposes and the period to post GL transactions in based on the credit note date*/
$CreditNoteNo = GetNextTransNo(21, $db);
$PeriodNo = GetPeriod($_SESSION['SuppTrans']->TranDate, $db);
示例5: LevelNetting
function LevelNetting(&$db, $part, $eoq, $PanSize, $ShrinkFactor, $LeadTime)
{
// Create an array of mrprequirements and an array of mrpsupplies, then read through
// them seeing if all requirements are covered by supplies. Create a planned order
// for any unmet requirements. Change dates if necessary for the supplies.
//echo '<br />Part is ' . "$part" . '<br />';
// Get decimal places from stockmaster for rounding of shrinkage factor
$sql = "SELECT decimalplaces FROM stockmaster WHERE stockid = '" . $part . "'";
$result = DB_query($sql, $db);
$myrow = DB_fetch_row($result);
$DecimalPlaces = $myrow[0];
// Load mrprequirements into $Requirements array
$sql = "SELECT * FROM mrprequirements WHERE part = '" . $part . "' ORDER BY daterequired";
$result = DB_query($sql, $db);
$Requirements = array();
$i = 0;
while ($myrow = DB_fetch_array($result)) {
array_push($Requirements, $myrow);
$i++;
}
//end of while loop
// Load mrpsupplies into $Supplies array
$sql = "SELECT * FROM mrpsupplies WHERE part = '" . $part . "' ORDER BY duedate";
$result = DB_query($sql, $db);
$Supplies = array();
$i = 0;
while ($myrow = DB_fetch_array($result)) {
array_push($Supplies, $myrow);
$i++;
}
//end of while loop
// Go through all requirements and check if have supplies to cover them
$RequirementCount = count($Requirements);
$SupplyCount = count($Supplies);
$reqi = 0;
//Index for requirements
$supi = 0;
// index for supplies
$TotalRequirement = 0;
$TotalSupply = 0;
if ($RequirementCount > 0 && $SupplyCount > 0) {
$TotalRequirement += $Requirements[$reqi]['quantity'];
$TotalSupply += $Supplies[$supi]['supplyquantity'];
while ($TotalRequirement > 0 && $TotalSupply > 0) {
$Supplies[$supi]['updateflag'] = 1;
// ******** Put leeway calculation in here ********
$DueDate = ConvertSQLDate($Supplies[$supi]['duedate']);
$ReqDate = ConvertSQLDate($Requirements[$reqi]['daterequired']);
$DateDiff = DateDiff($DueDate, $ReqDate, 'd');
//if ($Supplies[$supi]['duedate'] > $Requirements[$reqi]['daterequired']) {
if ($DateDiff > abs(filter_number_format($_POST['Leeway']))) {
$sql = "UPDATE mrpsupplies SET mrpdate = '" . $Requirements[$reqi]['daterequired'] . "' WHERE id = '" . $Supplies[$supi]['id'] . "' AND duedate = mrpdate";
$result = DB_query($sql, $db);
}
if ($TotalRequirement > $TotalSupply) {
$TotalRequirement -= $TotalSupply;
$Requirements[$reqi]['quantity'] -= $TotalSupply;
$TotalSupply = 0;
$Supplies[$supi]['supplyquantity'] = 0;
$supi++;
if ($SupplyCount > $supi) {
$TotalSupply += $Supplies[$supi]['supplyquantity'];
}
} elseif ($TotalRequirement < $TotalSupply) {
$TotalSupply -= $TotalRequirement;
$Supplies[$supi]['supplyquantity'] -= $TotalRequirement;
$TotalRequirement = 0;
$Requirements[$reqi]['quantity'] = 0;
$reqi++;
if ($RequirementCount > $reqi) {
$TotalRequirement += $Requirements[$reqi]['quantity'];
}
} else {
$TotalSupply -= $TotalRequirement;
$Supplies[$supi]['supplyquantity'] -= $TotalRequirement;
$TotalRequirement = 0;
$Requirements[$reqi]['quantity'] = 0;
$reqi++;
if ($RequirementCount > $reqi) {
$TotalRequirement += $Requirements[$reqi]['quantity'];
}
$TotalRequirement -= $TotalSupply;
$Requirements[$reqi]['quantity'] -= $TotalSupply;
$TotalSupply = 0;
$Supplies[$supi]['supplyquantity'] = 0;
$supi++;
if ($SupplyCount > $supi) {
$TotalSupply += $Supplies[$supi]['supplyquantity'];
}
}
// End of if $TotalRequirement > $TotalSupply
}
// End of while
}
// End of if
// When get to this part of code, have gone through all requirements, If there is any
// unmet requirements, create an mrpplannedorder to cover it. Also call the
// CreateLowerLevelRequirement() function to create gross requirements for lower level parts.
// There is an excess quantity if the eoq is higher than the actual required amount.
// If there is a subsuquent requirement, the excess quantity is subtracted from that
//.........這裏部分代碼省略.........
示例6: while
$db->Query("DELETE FROM ad_exits WHERE id='{$id_ad}' AND affid='{$affid}' LIMIT 1");
}
}
}
}
}
}
$db->Query("DELETE FROM ad_purchased WHERE id='{$id}' AND affid='{$affid}' LIMIT 1");
echo "affid={$affid} deleted purchased ad id={$id} type={$type}\n";
}
}
// delete unverified signups after 3 days
$db->Query("SELECT affid, username, pass, fname, lname, email, datesignedup FROM users WHERE verified='0'");
$result = $db->result;
while (list($affid, $username, $pass, $fname, $lname, $email, $datesignedup) = mysqli_fetch_row($result)) {
$num_days = DateDiff(mysql_datetime_to_timestamp($datesignedup), time(), 'd');
$num_days = round($num_days);
if ($num_days > 3) {
$db->Query("DELETE FROM users WHERE affid='{$affid}' LIMIT 1");
} else {
$hash = substr(md5(strrev(sha1($affid))), 0, 5);
$val_url = "http://freeadplanet.com/?c=validatesignup&affid={$affid}&h={$hash}";
@mail($email, 'Free AD Planet - Validate Account Notice', "Hello {$fname} {$lname},\n\nVisit the URL below to Validate your Account.\n\n{$val_url}\n\nUsername: {$username}\nPassword: {$pass}\n\nRegards,\nhttp://freeadplanet.com Staff", $headers);
//@mail('elitescripts2000@yahoo.com', 'Free AD Planet - Validate Account Notice', "Hello $fname $lname,\n\nVisit the URL below to Validate your Account.\n\n$val_url\n\nUsername: $username\nPassword: $pass\n\nRegards,\nhttp://freeadplanet.com Staff", $headers);
}
}
// calculate new Quota Week
if ($dayOfWeek == 'Mon') {
echo "\n** dayOfWeek={$dayOfWeek} which is new quota week\n";
$db->Query("SELECT affid, status, weekadcount, weekadmissed FROM users WHERE verified != '0' ORDER BY affid");
$result = $db->result;
示例7: date
$opvboost1 = date("l, dS of F, Y", $opvboost1);
}
if ($today > $opvboost2) {
$opvboost2 = date("l, dS of F, Y", $opvboost2);
$opvboost2 = "<font color=#FF0000>{$opvboost2}</font>";
} else {
$opvboost2 = date("l, dS of F, Y", $opvboost2);
}
if ($today > $dtboost) {
$dtboost = date("l, dS of F, Y", $dtboost);
$dtboost = "<font color=#FF0000>{$dtboost}</font>";
} else {
$dtboost = date("l, dS of F, Y", $dtboost);
}
// Calculate the child's age in days
$childAgeInDays = DateDiff("d", $dobdate, $today);
// Calculate the child's age in months
$childAgeInMonths = $childAgeInDays / 30;
// Calculate the child's age in years
$childAgeInYears = floor($childAgeInMonths / 12);
if ($childAgeInYears < 1) {
$childAgeInMs = floor($childAgeInDays / 30);
$childAgeInDs = $childAgeInDays % 30;
}
if ($childAgeInYears >= 1) {
$childAgeInMs = floor($childAgeInDays / 30);
$childAgeInMs = $childAgeInMs - $childAgeInYears * 12;
}
// Format the DOB in a presentable form
$dobdate = date("l, dS of F, Y", $dobdate);
?>
示例8: prnMsg
}
if (!is_numeric(filter_number_format($_POST['Quantity']))) {
$InputError = 1;
prnMsg(_('The quantity entered must be numeric'), 'error');
$Errors[$i] = 'Quantity';
$i++;
}
if (filter_number_format($_POST['Quantity']) == 0) {
$InputError = 1;
prnMsg(_('The quantity entered cannot be zero'), 'error');
$Errors[$i] = 'Quantity';
$i++;
}
if (!Date1GreaterThanDate2($_POST['EffectiveTo'], $_POST['EffectiveAfter'])) {
$InputError = 1;
prnMsg(_('The effective to date must be a date after the effective after date') . '<br />' . _('The effective to date is') . ' ' . DateDiff($_POST['EffectiveTo'], $_POST['EffectiveAfter'], 'd') . ' ' . _('days before the effective after date') . '! ' . _('No updates have been performed') . '.<br />' . _('Effective after was') . ': ' . $_POST['EffectiveAfter'] . ' ' . _('and effective to was') . ': ' . $_POST['EffectiveTo'], 'error');
$Errors[$i] = 'EffectiveAfter';
$i++;
$Errors[$i] = 'EffectiveTo';
$i++;
}
if ($_POST['AutoIssue'] == 1 and isset($_POST['Component'])) {
$sql = "SELECT controlled FROM stockmaster WHERE stockid='" . $_POST['Component'] . "'";
$CheckControlledResult = DB_query($sql, $db);
$CheckControlledRow = DB_fetch_row($CheckControlledResult);
if ($CheckControlledRow[0] == 1) {
prnMsg(_('Only non-serialised or non-lot controlled items can be set to auto issue. These items require the lot/serial numbers of items issued to the works orders to be specified so autoissue is not an option. Auto issue has been automatically set to off for this component'), 'warn');
$_POST['AutoIssue'] = 0;
}
}
if (!in_array('EffectiveAfter', $Errors)) {
示例9: DB_query
$assetarray[$i]['bsdepnaccount'] = $bsnamerow['accountname'];
$plnamesql = 'SELECT accountname FROM chartmaster WHERE accountcode="' . $assetarray[$i]['pldepn'] . '"';
$plnameresult = DB_query($plnamesql, $db);
$plnamerow = DB_fetch_array($plnameresult);
$assetarray[$i]['pldepnaccount'] = $plnamerow['accountname'];
/* Need a method to correctly enter the journal date,
* and for it to be available to the depn calculation - Tim
*/
if (isset($_POST['JournalProcessDate'])) {
$_SESSION['JournalDetail']->JnlDate = $_POST['JournalProcessDate'];
}
if (!Is_Date($_SESSION['JournalDetail']->JnlDate)) {
// Default the date to the last day of the previous month
$_SESSION['JournalDetail']->JnlDate = Date($_SESSION['DefaultDateFormat'], mktime(0, 0, 0, date('m'), 0, date('Y')));
}
$NoOfMonths = DateDiff($_SESSION['JournalDetail']->JnlDate, ConvertSQLDate($assetarray[$i]['datepurchased']), 'm');
if ($assetarray[$i]['DepreciationType'] == _('Straight Line')) {
$TotalDepnAmount = round($NoOfMonths / 12 * ($assetarray[$i]['DepreciationRate'] / 100) * $assetarray[$i]['cost'], 2);
} else {
$TotalDepnAmount = round($NoOfMonths / 12 * ($assetarray[$i]['DepreciationRate'] / 100) * ($assetarray[$i]['cost'] - $assetarray[$i]['depn']), 2);
}
if ($TotalDepnAmount + $assetarray[$i]['disposalvalue'] > $assetarray[$i]['cost']) {
$TotalDepnAmount = $assetarray[$i]['cost'] - $assetarray[$i]['disposalvalue'];
}
$assetarray[$i]['narrative'] = 'Depreciation Journal - ' . $assetarray[$i]['stockid'] . ' - ' . $assetarray[$i]['serialno'] . ' - ' . $assetarray[$i]['locationdescription'];
$_SESSION['JournalDetail']->Add_To_GLAnalysis(-($TotalDepnAmount - $assetarray[$i]['depn']), $assetarray[$i]['narrative'], $assetarray[$i]['bsdepn'], $assetarray[$i]['bsdepnaccount'], 0, $assetarray[$i]['id']);
$_SESSION['JournalDetail']->Add_To_GLAnalysis($TotalDepnAmount - $assetarray[$i]['depn'], $assetarray[$i]['narrative'], $assetarray[$i]['pldepn'], $assetarray[$i]['pldepnaccount'], 0, $assetarray[$i]['id']);
$i++;
}
}
if (isset($_POST['JournalProcessDate'])) {
示例10: _
<th>' . _('Order Total') . ' ' . _('in') . ' ' . $_SESSION['CompanyRecord']['currencydefault'] . '</th>
</tr>';
$SQL = "SELECT salesorders.orderno,\n\t\t\t\t\t\tdebtorsmaster.name,\n\t\t\t\t\t\tcustbranch.brname,\n\t\t\t\t\t\tsalesorders.customerref,\n\t\t\t\t\t\tsalesorders.orddate,\n\t\t\t\t\t\tsalesorders.deliverto,\n\t\t\t\t\t\tsalesorders.deliverydate,\n\t\t\t\t\t\tsalesorders.printedpackingslip,\n\t\t\t\t\t\tsalesorders.poplaced,\n\t\t\t\t\t\tSUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)/currencies.rate) AS ordervalue\n\t\t\t\t\tFROM salesorders INNER JOIN salesorderdetails\n\t\t\t\t\t\tON salesorders.orderno = salesorderdetails.orderno\n\t\t\t\t\t\tINNER JOIN debtorsmaster\n\t\t\t\t\t\tON salesorders.debtorno = debtorsmaster.debtorno\n\t\t\t\t\t\tINNER JOIN custbranch\n\t\t\t\t\t\tON debtorsmaster.debtorno = custbranch.debtorno\n\t\t\t\t\t\tAND salesorders.branchcode = custbranch.branchcode\n\t\t\t\t\t\tINNER JOIN currencies\n\t\t\t\t\t\tON debtorsmaster.currcode = currencies.currabrev\n\t\t\t\t\tWHERE salesorderdetails.completed=0\n\t\t\t\t\tAND salesorders.quotation =0\n\t\t\t\t\tGROUP BY salesorders.orderno,\n\t\t\t\t\t\tdebtorsmaster.name,\n\t\t\t\t\t\tcustbranch.brname,\n\t\t\t\t\t\tsalesorders.customerref,\n\t\t\t\t\t\tsalesorders.orddate,\n\t\t\t\t\t\tsalesorders.deliverto,\n\t\t\t\t\t\tsalesorders.deliverydate,\n\t\t\t\t\t\tsalesorders.printedpackingslip\n\t\t\t\t\tORDER BY salesorders.orddate DESC, salesorders.orderno";
$ErrMsg = _('No orders or quotations were returned by the SQL because');
$SalesOrdersResult = DB_query($SQL, $ErrMsg);
/*show a table of the orders returned by the SQL */
if (DB_num_rows($SalesOrdersResult) > 0) {
$k = 0;
//row colour counter
$OrdersTotal = 0;
$FontColor = '';
while ($myrow = DB_fetch_array($SalesOrdersResult)) {
$OrderDate = ConvertSQLDate($myrow['orddate']);
$FormatedDelDate = ConvertSQLDate($myrow['deliverydate']);
$FormatedOrderValue = locale_number_format($myrow['ordervalue'], $_SESSION['CompanyRecord']['decimalplaces']);
if (DateDiff(Date($_SESSION['DefaultDateFormat']), $OrderDate, 'd') > 5) {
$FontColor = ' style="color:green; font-weight:bold"';
}
if ($k == 1) {
echo '<tr class="EvenTableRows">';
$k = 0;
} else {
echo '<tr class="OddTableRows">';
$k++;
}
printf('<td><a href="%s" target="_blank">' . $myrow['orderno'] . '</a></td>
<td' . $FontColor . '>%s</td>
<td' . $FontColor . '>%s</td>
<td' . $FontColor . '>%s</td>
<td' . $FontColor . '>%s</td>
<td' . $FontColor . '>%s</td>
示例11: htmlspecialchars
}
}
} else {
$STATUS_COLOR = "#00AA00";
$CAL_TITLE .= "狀態:已完成";
}
if ($MANAGER_ID != "") {
$query = "SELECT USER_NAME from USER where USER_ID='" . $MANAGER_ID . "'";
$rs = $db->Execute($query);
$rs_b = $rs->GetArray();
if (sizeof($rs_b) > 0) {
$CAL_TITLE .= "\n安排人:" . $rs_b[0]['USER_NAME'];
}
}
$CONTENT = htmlspecialchars($CONTENT);
$days = DateDiff("d", $CAL_TIME, $END_TIME);
$showBeginDate = substr($CAL_TIME, 11, 5);
$showEndDate = substr($END_TIME, 11, 5);
if ($days > 0) {
$showBeginDate = date("d日H:i", strtotime($CAL_TIME));
$showEndDate = date("d日H:i", strtotime($END_TIME));
}
$CONTENT = "<div id=\"cal_" . $CAL_ID . "\" title='" . $CAL_TITLE . "'>" . $showBeginDate . "-" . $showEndDate . ("<br><a href='javascript:my_note(" . $CAL_ID . ");' style='color:") . $STATUS_COLOR . ";'>" . $CONTENT . "</a>";
$CONTENT .= "<br><span id=\"cal_" . $CAL_ID . "_op\" style=\"display:none;\">";
if ($user_id == $_SESSION['LOGIN_USER_ID']) {
if ($OVER_STATUS == "0") {
$CONTENT .= "<a href=\"../calendar_newai.php?action=finish&id=" . $CAL_ID . "&OVER_STATUS=1&YEAR={$YEAR}&MONTH={$MONTH}&DAY={$DAY}\"> 完成</a>";
} else {
if ($OVER_STATUS == "" || $OVER_STATUS == "1") {
$CONTENT .= "<a href=\"../calendar_newai.php?action=finish&id=" . $CAL_ID . "&OVER_STATUS=0&YEAR={$YEAR}&MONTH={$MONTH}&DAY={$DAY}\"> 未完成</a>";
}
示例12: _
<th>' . _('Depn Type') . '</th>
<th>' . _('Depn Rate') . '</th>
<th>' . _('New Depn') . '</th>
</tr>';
echo $Heading;
$AssetCategoryDescription = '0';
$TotalCost = 0;
$TotalAccumDepn = 0;
$TotalDepn = 0;
$RowCounter = 0;
$TotalCategoryCost = 0;
$TotalCategoryAccumDepn = 0;
$TotalCategoryDepn = 0;
$k = 0;
while ($AssetRow = DB_fetch_array($AssetsResult)) {
$MonthsOwned = DateDiff($_POST['ProcessDate'], ConvertSQLDate($AssetRow['datepurchased']), 'm');
if ($AssetCategoryDescription != $AssetRow['categorydescription'] or $AssetCategoryDescription == '0') {
if ($AssetCategoryDescription != '0') {
//then print totals
echo '<tr><th colspan="3" align="right">' . _('Total for') . ' ' . $AssetCategoryDescription . ' </th>
<th class="number">' . locale_money_format($TotalCategoryCost, $_SESSION['CompanyRecord']['currencydefault']) . '</th>
<th class="number">' . locale_money_format($TotalCategoryAccumDepn, $_SESSION['CompanyRecord']['currencydefault']) . '</th>
<th class="number">' . locale_money_format($TotalCategoryCost - $TotalCategoryAccumDepn, $_SESSION['CompanyRecord']['currencydefault']) . '</th>
<th colspan="2"></th>
<th class="number">' . locale_money_format($TotalCategoryDepn, $_SESSION['CompanyRecord']['currencydefault']) . '</th>
</tr>';
}
echo '<tr><th colspan="9" align="left">' . $AssetRow['categorydescription'] . '</th></tr>';
$AssetCategoryDescription = $AssetRow['categorydescription'];
$TotalCategoryCost = 0;
$TotalCategoryAccumDepn = 0;
示例13: userLogin
//.........這裏部分代碼省略.........
$_SESSION['PDFLanguage'] = '0';
//default to latin western languages
}
if ($myrow['displayrecordsmax'] > 0) {
$_SESSION['DisplayRecordsMax'] = $myrow['displayrecordsmax'];
} else {
$_SESSION['DisplayRecordsMax'] = $_SESSION['DefaultDisplayRecordsMax'];
// default comes from config.php
}
$sql = "UPDATE www_users SET lastvisitdate='" . date('Y-m-d H:i:s') . "'\n\t\t\t\t\t\t\tWHERE www_users.userid='" . $Name . "'";
$Auth_Result = DB_query($sql);
/*get the security tokens that the user has access to */
$sql = "SELECT tokenid\n\t\t\t\t\tFROM securitygroups\n\t\t\t\t\tWHERE secroleid = '" . $_SESSION['AccessLevel'] . "'";
$Sec_Result = DB_query($sql);
$_SESSION['AllowedPageSecurityTokens'] = array();
if (DB_num_rows($Sec_Result) == 0) {
return UL_CONFIGERR;
} else {
$i = 0;
$UserIsSysAdmin = FALSE;
while ($myrow = DB_fetch_row($Sec_Result)) {
if ($myrow[0] == 15) {
$UserIsSysAdmin = TRUE;
}
$_SESSION['AllowedPageSecurityTokens'][$i] = $myrow[0];
$i++;
}
}
/*User is logged in so get configuration parameters - save in session*/
include $PathPrefix . 'includes/GetConfig.php';
if (isset($_SESSION['DB_Maintenance'])) {
if ($_SESSION['DB_Maintenance'] > 0) {
//run the DB maintenance script
if (DateDiff(Date($_SESSION['DefaultDateFormat']), ConvertSQLDate($_SESSION['DB_Maintenance_LastRun']), 'd') >= $_SESSION['DB_Maintenance']) {
/*Do the DB maintenance routing for the DB_type selected */
DB_Maintenance();
$_SESSION['DB_Maintenance_LastRun'] = Date('Y-m-d');
/* Audit trail purge only runs if DB_Maintenance is enabled */
if (isset($_SESSION['MonthsAuditTrail'])) {
$sql = "DELETE FROM audittrail\n\t\t\t\t\t\t\t\t\tWHERE transactiondate <= '" . Date('Y-m-d', mktime(0, 0, 0, Date('m') - $_SESSION['MonthsAuditTrail'])) . "'";
$ErrMsg = _('There was a problem deleting expired audit-trail history');
$result = DB_query($sql);
}
}
}
}
/*Check to see if currency rates need to be updated */
if (isset($_SESSION['UpdateCurrencyRatesDaily'])) {
if ($_SESSION['UpdateCurrencyRatesDaily'] != 0) {
/* Only run the update to currency rates if today is after the last update i.e. only runs once a day */
if (DateDiff(Date($_SESSION['DefaultDateFormat']), ConvertSQLDate($_SESSION['UpdateCurrencyRatesDaily']), 'd') > 0) {
if ($_SESSION['ExchangeRateFeed'] == 'ECB') {
$CurrencyRates = GetECBCurrencyRates();
// gets rates from ECB see includes/MiscFunctions.php
/*Loop around the defined currencies and get the rate from ECB */
if ($CurrencyRates != false) {
$CurrenciesResult = DB_query("SELECT currabrev FROM currencies");
while ($CurrencyRow = DB_fetch_row($CurrenciesResult)) {
if ($CurrencyRow[0] != $_SESSION['CompanyRecord']['currencydefault']) {
$UpdateCurrRateResult = DB_query("UPDATE currencies SET rate='" . GetCurrencyRate($CurrencyRow[0], $CurrencyRates) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE currabrev='" . $CurrencyRow[0] . "'", $db);
}
}
}
} else {
$CurrenciesResult = DB_query("SELECT currabrev FROM currencies");
while ($CurrencyRow = DB_fetch_row($CurrenciesResult)) {
示例14: T_
: <?php
echo $ratio;
?>
<br />
<?php
echo T_("AVG_DAILY_DL");
?>
: <?php
echo mksize($user["downloaded"] / (DateDiff($user["added"], time()) / 86400));
?>
<br />
<?php
echo T_("AVG_DAILY_UL");
?>
: <?php
echo mksize($user["uploaded"] / (DateDiff($user["added"], time()) / 86400));
?>
<br />
<?php
echo T_("TORRENTS_POSTED");
?>
: <?php
echo number_format($numtorrents);
?>
<br />
<?php
echo T_("COMMENTS_POSTED");
?>
: <?php
echo number_format($numcomments);
?>
示例15: DrawLine
function DrawLine($ACEC)
{
$vBranchInfo = GetBranchInfo();
$vHeight = $this->FontSize * 1.5;
$vRowData = array();
$vCECDate = ExtractWord($ACEC['date'], ' ', 0);
$vCaseID = $ACEC['case_id'];
$vNumCECesBefore = GetNumCECes($vCaseID, $vCECDate, $ACEC['id']);
$vCECNumber = $ACEC['cec_number'];
if ($vCECNumber == 0) {
$vCECNumber = '';
}
$vRowData[] = $vCECNumber . "\n(" . ($vNumCECesBefore + 1) . ')';
// 'Дата',
$vRowData[] = Date2Readable($vCECDate);
// 'Врач',
$vRowData[] = FormatUserName($ACEC['user_id']);
// 'Ф.И.О. больного' & 'Дата рождения'
// $vRowData[] = FormatName($ACEC['last_name'], $ACEC['first_name'],$ACEC['patr_name'])
$vRowData[] = FormatNameEx($ACEC) . "\n" . FormatBornDateAndAge($vCECDate, $ACEC['born_date']) . "\nи.б. " . $vCaseID;
// $vRowData[] = FormatSex($ACase['is_male']);
// 'Адрес',
$vRowData[] = FormatAddress($ACEC['addr_reg_street'], $ACEC['addr_reg_num'], $ACEC['addr_reg_subnum'], $ACEC['addr_reg_apartment']);
// $vRowData[] = $ACase['phone'];
// 'Место работы' & 'Профессия'
$vTmpList = array();
$vTmp = FormatWorkableAge($vCECDate, $ACEC['born_date'], $ACEC['is_male']);
if (!empty($vTmp)) {
$vTmpList[] = $vTmp;
}
$vTmp = FormatCategory($ACEC['employment_category_id']);
if (!empty($vTmp)) {
$vTmpList[] = $vTmp;
}
$vTmp = $ACEC['employment_place'];
if (!empty($vTmp)) {
$vTmpList[] = $vTmp;
}
$vTmp = $ACEC['profession'];
if (!empty($vTmp)) {
$vTmpList[] = $vTmp;
}
$vRowData[] = implode(",\n", $vTmpList);
// 'Диагноз',
$vRowData[] = $ACEC['diagnosis'];
// '№ листка нетрудоспособности',
$vTmp = $ACEC['ill_doc'];
if (!empty($vTmp)) {
$vTmp .= "\n" . Date2Readable($ACEC['disability_from_date']);
$vTmp .= "\n" . Date2Readable($vCECDate);
$vTmp .= "\n(" . (DateDiff($vCECDate, $ACEC['disability_from_date']) + 1) . ')';
}
$vRowData[] = $vTmp;
// 'Заключение комиссии'
$vRowData[] = "лечение продлено\nс " . Date2Readable(DateAddDay($vCECDate)) . "\nпо " . Date2Readable($ACEC['cec_cureup_date']) . "\n(" . DateDiff($ACEC['cec_cureup_date'], $vCECDate) . ')';
// 'Подписи членов комиссии'
$vTmp = $ACEC['cec_members'];
if (empty($vTmp)) {
$vTmp = $vBranchInfo['cec_members'];
}
$vRowData[] = $vTmp;
foreach ($vRowData as &$v) {
$v = iconv('utf-8', 'cp1251', $v);
}
$this->OutTableRow($vHeight, $vRowData);
}