本文整理汇总了PHP中Today函数的典型用法代码示例。如果您正苦于以下问题:PHP Today函数的具体用法?PHP Today怎么用?PHP Today使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Today函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render($id, $title)
{
global $path_to_root;
include_once $path_to_root . "/includes/ui.inc";
$today = date2sql(Today());
$sql = "SELECT bank_act, bank_account_name, SUM(amount) balance FROM " . TB_PREF . "bank_trans bt" . " INNER JOIN " . TB_PREF . "bank_accounts ba ON bt.bank_act = ba.id" . " WHERE trans_date < '{$today}'" . " AND inactive <> 1";
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= " GROUP BY bank_act, bank_account_name" . " ORDER BY bank_account_name";
$result = db_query($sql);
br();
$th = array(_("Account"), _("Balance"));
start_table(TABLESTYLE, "width=98%");
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
alt_table_row_color($k);
label_cell($myrow["bank_account_name"]);
amount_cell($myrow['balance']);
end_row();
}
end_table(1);
}
示例2: get_transactions
function get_transactions()
{
$data_after = date2sql($_POST['TransAfterDate']);
$date_to = date2sql($_POST['TransToDate']);
$sql = "SELECT debtor_trans.*,\n\t\tdebtors_master.name AS CustName, debtors_master.curr_code AS CustCurrCode,\n \t(debtor_trans.ov_amount + debtor_trans.ov_gst + " . "debtor_trans.ov_freight + debtor_trans.ov_freight_tax + debtor_trans.ov_discount)\n\t\tAS TotalAmount,\n\t\tdebtor_trans.alloc AS Allocated,\n\t\t((debtor_trans.type = 10)\n\t\tAND debtor_trans.due_date < '" . date2sql(Today()) . "') AS OverDue\n \tFROM debtor_trans, debtors_master\n \tWHERE debtors_master.debtor_no = debtor_trans.debtor_no\n\t\t\tAND (debtor_trans.ov_amount + debtor_trans.ov_gst + " . "debtor_trans.ov_freight + debtor_trans.ov_freight_tax + debtor_trans.ov_discount != 0)\n \t\tAND debtor_trans.tran_date >= '{$data_after}'\n \t\tAND debtor_trans.tran_date <= '{$date_to}'";
if ($_POST['customer_id'] != reserved_words::get_all()) {
$sql .= " AND debtor_trans.debtor_no = '" . $_POST['customer_id'] . "'";
}
if (isset($_POST['filterType']) && $_POST['filterType'] != reserved_words::get_all()) {
if ($_POST['filterType'] == '1' || $_POST['filterType'] == '2') {
$sql .= " AND debtor_trans.type = 10 ";
} elseif ($_POST['filterType'] == '3') {
$sql .= " AND debtor_trans.type = " . systypes::cust_payment();
} elseif ($_POST['filterType'] == '4') {
$sql .= " AND debtor_trans.type = 11 ";
}
if ($_POST['filterType'] == '2') {
$today = date2sql(Today());
$sql .= " AND debtor_trans.due_date < '{$today}'\n\t\t\t\tAND (round(abs(debtor_trans.ov_amount + " . "debtor_trans.ov_gst + debtor_trans.ov_freight + " . "debtor_trans.ov_freight_tax + debtor_trans.ov_discount) - debtor_trans.alloc,6) > 0) ";
}
} else {
$sql .= " AND debtor_trans.type != 13 ";
}
if (!check_value('showSettled')) {
$sql .= " AND (round(abs(debtor_trans.ov_amount + debtor_trans.ov_gst + " . "debtor_trans.ov_freight + debtor_trans.ov_freight_tax + " . "debtor_trans.ov_discount) - debtor_trans.alloc,6) != 0) ";
}
$sql .= " ORDER BY debtor_trans.tran_date";
return db_query($sql, "No transactions were returned");
}
示例3: get_transactions
function get_transactions()
{
$date_after = date2sql($_POST['TransAfterDate']);
$date_to = date2sql($_POST['TransToDate']);
$sql = "SELECT debtor_trans.*,debtors_master.name AS CustName," . "debtors_master.curr_code AS CustCurrCode," . "(debtor_trans.ov_amount + debtor_trans.ov_gst + " . "debtor_trans.ov_freight + debtor_trans.ov_freight_tax + " . "debtor_trans.ov_discount) AS " . "TotalAmount, debtor_trans.alloc AS Allocated, " . "((debtor_trans.type = 10) " . "AND debtor_trans.due_date < '" . date2sql(Today()) . "') AS OverDue " . "FROM debtor_trans, debtors_master " . "WHERE debtors_master.debtor_no = debtor_trans.debtor_no " . "AND debtor_trans.tran_date >= '{$date_after}' " . "AND debtor_trans.tran_date <= '{$date_to}'";
if ($_POST['customer_id'] != reserved_words::get_all()) {
$sql .= " AND debtor_trans.debtor_no = '" . $_POST['customer_id'] . "'";
}
if ($_POST['filterType'] != reserved_words::get_all()) {
if ($_POST['filterType'] == '1') {
$sql .= " AND (debtor_trans.type = 10 OR debtor_trans.type = 1) ";
} elseif ($_POST['filterType'] == '2') {
$sql .= " AND (debtor_trans.type = 10) ";
} elseif ($_POST['filterType'] == '3') {
$sql .= " AND (debtor_trans.type = " . systypes::cust_payment() . " OR debtor_trans.type = 2) ";
} elseif ($_POST['filterType'] == '4') {
$sql .= " AND debtor_trans.type = 11 ";
} elseif ($_POST['filterType'] == '5') {
$sql .= " AND debtor_trans.type = 13 ";
}
if ($_POST['filterType'] == '2') {
$today = date2sql(Today());
$sql .= " AND debtor_trans.due_date < '{$today}' " . "AND (debtor_trans.ov_amount + debtor_trans.ov_gst + " . "debtor_trans.ov_freight_tax + debtor_trans.ov_freight + " . "debtor_trans.ov_discount - debtor_trans.alloc > 0) ";
}
}
$sql .= " ORDER BY debtor_trans.tran_date DESC,debtor_trans.type," . "debtor_trans.trans_no ";
return db_query($sql, "No transactions were returned");
}
示例4: get_transactions
function get_transactions()
{
global $db;
$date_after = date2sql($_POST['TransAfterDate']);
$date_to = date2sql($_POST['TransToDate']);
// Sherifoz 22.06.03 Also get the description
$sql = "SELECT supp_trans.type, supp_trans.trans_no,\n \tsupp_trans.tran_date, supp_trans.reference, supp_trans.supp_reference,\n \t(supp_trans.ov_amount + supp_trans.ov_gst + supp_trans.ov_discount) AS TotalAmount, supp_trans.alloc AS Allocated,\n\t\t((supp_trans.type = 20 OR supp_trans.type = 21) AND supp_trans.due_date < '" . date2sql(Today()) . "') AS OverDue,\n \t(ABS(supp_trans.ov_amount + supp_trans.ov_gst + supp_trans.ov_discount - supp_trans.alloc) <= 0.005) AS Settled,\n\t\tsuppliers.curr_code, suppliers.supp_name, supp_trans.due_date\n \tFROM supp_trans, suppliers\n \tWHERE suppliers.supplier_id = supp_trans.supplier_id\n \tAND supp_trans.tran_date >= '{$date_after}'\n \tAND supp_trans.tran_date <= '{$date_to}'";
if ($_POST['supplier_id'] != reserved_words::get_all()) {
$sql .= " AND supp_trans.supplier_id = '" . $_POST['supplier_id'] . "'";
}
if (isset($_POST['filterType']) && $_POST['filterType'] != reserved_words::get_all()) {
if ($_POST['filterType'] == '1') {
$sql .= " AND (supp_trans.type = 20 OR supp_trans.type = 2)";
} elseif ($_POST['filterType'] == '2') {
$sql .= " AND supp_trans.type = 20 ";
} elseif ($_POST['filterType'] == '3') {
$sql .= " AND (supp_trans.type = 22 OR supp_trans.type = 1) ";
} elseif ($_POST['filterType'] == '4' || $_POST['filterType'] == '5') {
$sql .= " AND supp_trans.type = 21 ";
}
if ($_POST['filterType'] == '2' || $_POST['filterType'] == '5') {
$today = date2sql(Today());
$sql .= " AND supp_trans.due_date < '{$today}' ";
}
}
$sql .= " ORDER BY supp_trans.tran_date";
return db_query($sql, "No supplier transactions were returned");
}
示例5: getAverageCost
function getAverageCost($stock_id, $to_date)
{
if ($to_date == null) {
$to_date = Today();
}
$to_date = date2sql($to_date);
$sql = "SELECT standard_cost, price, tran_date, type, trans_no, qty, person_id FROM " . TB_PREF . "stock_moves\n\t\tWHERE stock_id=" . db_escape($stock_id) . "\n\t\tAND tran_date <= '{$to_date}' AND standard_cost > 0.001 AND qty <> 0 AND type <> " . ST_LOCTRANSFER;
$sql .= " ORDER BY tran_date";
$result = db_query($sql, "No standard cost transactions were returned");
if ($result == false) {
return 0;
}
$qty = $old_qty = $count = $old_std_cost = $tot_cost = 0;
while ($row = db_fetch($result)) {
$qty += $row['qty'];
$price = get_domestic_price($row, $stock_id, $qty, $old_std_cost, $old_qty);
$old_std_cost = $row['standard_cost'];
$tot_cost += $price;
$count++;
$old_qty = $qty;
}
if ($count == 0) {
return 0;
}
return $tot_cost / $count;
}
示例6: render
function render($id, $title)
{
global $path_to_root, $systypes_array;
include_once $path_to_root . "/includes/ui.inc";
$start_date = add_days(Today(), -$this->days_past);
$end_date = add_days(Today(), $this->days_future);
$result = get_bank_trans_for_bank_account($this->bank_act, $start_date, $end_date);
start_table(TABLESTYLE, 'width=98%');
$th = array(_("#"), _("Date"), _("Receipt"), _("Payment"), _("Balance"), _("Person/Item"), _("Memo"), "");
table_header($th);
$bfw = get_balance_before_for_bank_account($this->bank_act, $start_date);
$credit = $debit = 0;
start_row("class='inquirybg' style='font-weight:bold'");
label_cell(_("Opening Balance") . " - " . $start_date, "colspan=4");
display_debit_or_credit_cells($bfw);
label_cell("");
label_cell("", "colspan=2");
end_row();
$running_total = $bfw;
if ($bfw > 0) {
$debit += $bfw;
} else {
$credit += $bfw;
}
$j = 1;
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
alt_table_row_color($k);
$running_total += $myrow["amount"];
label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"]));
$trandate = sql2date($myrow["trans_date"]);
label_cell($trandate);
display_debit_or_credit_cells($myrow["amount"]);
amount_cell($running_total);
label_cell(payment_person_name($myrow["person_type_id"], $myrow["person_id"]));
label_cell(get_comments_string($myrow["type"], $myrow["trans_no"]));
label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"]));
end_row();
if ($myrow["amount"] > 0) {
$debit += $myrow["amount"];
} else {
$credit += $myrow["amount"];
}
if ($j == 12) {
$j = 1;
table_header($th);
}
$j++;
}
//end of while loop
start_row("class='inquirybg' style='font-weight:bold'");
label_cell(_("Ending Balance") . " - " . $end_date, "colspan=4");
amount_cell($debit + $credit);
label_cell("");
label_cell("", "colspan=2");
end_row();
end_table(2);
}
示例7: check_overdue
function check_overdue($row)
{
global $trans_type;
if ($trans_type == ST_SALESQUOTE) {
return date1_greater_date2(Today(), sql2date($row['delivery_date']));
} else {
return $row['type'] == 0 && date1_greater_date2(Today(), sql2date($row['ord_date'])) && $row['TotDelivered'] < $row['TotQuantity'];
}
}
示例8: render
function render($id, $title)
{
global $path_to_root;
include_once $path_to_root . "/includes/ui.inc";
include_once $path_to_root . "/reporting/includes/class.graphic.inc";
if (!defined('FLOAT_COMP_DELTA')) {
define('FLOAT_COMP_DELTA', 0.004);
}
if (!isset($this->top)) {
$this->top = 10;
}
$begin = begin_fiscalyear();
$today = Today();
$begin1 = date2sql($begin);
$today1 = date2sql($today);
$sql = "SELECT SUM((trans.ov_amount + trans.ov_discount) * rate) AS total, s.supplier_id, s.supp_name FROM\n " . TB_PREF . "supp_trans AS trans, " . TB_PREF . "suppliers AS s WHERE trans.supplier_id=s.supplier_id\n AND (trans.type = " . ST_SUPPINVOICE . " OR trans.type = " . ST_SUPPCREDIT . ")\n AND tran_date >= '{$begin1}' AND tran_date <= '{$today1}' ";
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= "GROUP by s.supplier_id ORDER BY total DESC, s.supplier_id " . " LIMIT " . $this->top;
$result = db_query($sql);
if ($this->graph_type == 'Table') {
$th = array(_("Supplier"), _("Amount"));
start_table(TABLESTYLE, "width=98%");
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
alt_table_row_color($k);
$name = $myrow["supplier_id"] . " " . $myrow["supp_name"];
label_cell($name);
amount_cell($myrow['total']);
end_row();
}
end_table(1);
} else {
$pg = new graph();
$i = 0;
while ($myrow = db_fetch($result)) {
$name = $myrow["supplier_id"] . " " . $myrow["supp_name"];
$pg->x[$i] = $name;
$pg->y[$i] = $myrow['total'];
$i++;
}
$pg->title = $title;
$pg->axis_x = _("Supplier");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $today;
$pg->type = 2;
$pg->skin = 1;
$pg->built_in = false;
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
}
}
示例9: menu_footer
function menu_footer($no_menu, $is_index)
{
global $version, $allow_demo_mode, $app_title, $power_url, $power_by, $path_to_root, $Pagehelp, $Ajax;
include_once $path_to_root . "/includes/date_functions.inc";
$context = array('isIndex' => $is_index, 'date' => Today(), 'time' => Now());
if ($no_menu == false) {
$footer = ThemeBootstrap::get()->renderBlock('page.twig.html', 'footer', $context);
echo $footer;
}
}
示例10: render
function render($id, $title)
{
global $path_to_root;
if (!isset($this->top)) {
$this->top = 10;
}
global $path_to_root;
$pg = new graph();
$begin = begin_fiscalyear();
$today = Today();
$begin1 = date2sql($begin);
$today1 = date2sql($today);
$sql = "SELECT SUM(-t.amount) AS total, d.reference, d.name FROM\n " . TB_PREF . "gl_trans AS t," . TB_PREF . "dimensions AS d WHERE\n (t.dimension_id = d.id OR t.dimension2_id = d.id) AND\n t.tran_date >= '{$begin1}' AND t.tran_date <= '{$today1}' ";
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= "GROUP BY d.id ORDER BY total DESC LIMIT " . $this->top;
$result = db_query($sql, "Transactions could not be calculated");
if ($this->graph_type == 'Table') {
$title = _("Top 10 Dimensions in fiscal year");
br(2);
display_heading($title);
br();
$th = array(_("Dimension"), _("Amount"));
start_table(TABLESTYLE, "width=98%");
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
alt_table_row_color($k);
label_cell($myrow['reference'] . " " . $myrow["name"]);
amount_cell($myrow['total']);
end_row();
}
end_table(2);
} else {
$pg = new graph();
$i = 0;
while ($myrow = db_fetch($result)) {
$pg->x[$i] = $myrow['reference'] . " " . $myrow["name"];
$pg->y[$i] = abs($myrow['total']);
$i++;
}
$pg->title = $title;
$pg->axis_x = _("Dimension");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $today;
$pg->type = 5;
$pg->skin = 1;
$pg->built_in = false;
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
}
}
示例11: render
function render($id, $title)
{
global $path_to_root;
include_once $path_to_root . "/reporting/includes/class.graphic.inc";
if (!defined('FLOAT_COMP_DELTA')) {
define('FLOAT_COMP_DELTA', 0.004);
}
if (!isset($this->top)) {
$this->top = 10;
}
$begin = begin_fiscalyear();
$today = Today();
$begin1 = date2sql($begin);
$today1 = date2sql($today);
$sql = "SELECT SUM((ov_amount + ov_discount) * rate * IF(trans.type = " . ST_CUSTCREDIT . ", -1, 1)) AS total,d.debtor_no, d.name" . " FROM " . TB_PREF . "debtor_trans AS trans, " . TB_PREF . "debtors_master AS d" . " WHERE trans.debtor_no=d.debtor_no" . " AND (trans.type = " . ST_SALESINVOICE . " OR trans.type = " . ST_CUSTCREDIT . ")" . " AND tran_date >= '{$begin1}' AND tran_date <= '{$today1}'";
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= " GROUP by d.debtor_no ORDER BY total DESC, d.debtor_no " . " LIMIT " . $this->top;
$result = db_query($sql);
if ($this->graph_type == 'Table') {
$th = array(null, _("Customer"), _("Amount"));
start_table(TABLESTYLE, "width=98%");
table_header($th);
$k = 0;
//row colour counter
$i = 0;
while ($myrow = db_fetch($result)) {
alt_table_row_color($k);
label_cell(viewer_link($myrow["debtor_no"], 'sales/inquiry/customer_inquiry.php?customer_id=' . $myrow["debtor_no"]));
label_cell(viewer_link($myrow["name"], 'sales/inquiry/customer_inquiry.php?customer_id=' . $myrow["debtor_no"]));
amount_cell($myrow['total']);
end_row();
}
end_table(1);
} else {
$pg = new graph();
$i = 0;
while ($myrow = db_fetch($result)) {
$pg->x[$i] = $myrow["debtor_no"] . " " . $myrow["name"];
$pg->y[$i] = $myrow['total'];
$i++;
}
$pg->title = $title;
$pg->axis_x = _("Customer");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $today;
$pg->type = 2;
$pg->skin = 1;
$pg->built_in = false;
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
}
}
示例12: render
function render($id, $title)
{
global $path_to_root;
include_once $path_to_root . "/reporting/includes/class.graphic.inc";
$begin = begin_fiscalyear();
$today = Today();
$begin1 = date2sql($begin);
$today1 = date2sql($today);
$sql = "SELECT SUM(amount) AS total, c.class_name, c.ctype FROM\n " . TB_PREF . "gl_trans," . TB_PREF . "chart_master AS a, " . TB_PREF . "chart_types AS t,\n " . TB_PREF . "chart_class AS c WHERE\n account = a.account_code AND a.account_type = t.id AND t.class_id = c.cid\n AND IF(c.ctype > 3, tran_date >= '{$begin1}', tran_date >= '0000-00-00')\n AND tran_date <= '{$today1}' ";
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= " GROUP BY c.cid ORDER BY c.cid";
$result = db_query($sql, "Transactions could not be calculated");
$calculated = _("Calculated Return");
if ($this->graph_type == 'Table') {
start_table(TABLESTYLE2, "width=98%");
$total = 0;
while ($myrow = db_fetch($result)) {
if ($myrow['ctype'] > 3) {
$total += $myrow['total'];
$myrow['total'] = -$myrow['total'];
}
label_row($myrow['class_name'], number_format2($myrow['total'], user_price_dec()), "class='label' style='font-weight:bold;'", "style='font-weight:bold;' align=right");
}
label_row(" ", "");
label_row($calculated, number_format2(-$total, user_price_dec()), "class='label' style='font-weight:bold;'", "style='font-weight:bold;' align=right");
end_table(1);
} else {
$pg = new graph();
$i = 0;
$total = 0;
while ($myrow = db_fetch($result)) {
if ($myrow['ctype'] > 3) {
$total += $myrow['total'];
$myrow['total'] = -$myrow['total'];
$pg->x[$i] = $myrow['class_name'];
$pg->y[$i] = abs($myrow['total']);
$i++;
}
}
$pg->x[$i] = $calculated;
$pg->y[$i] = -$total;
$pg->title = $title;
$pg->axis_x = _("Class");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $today;
$pg->type = 5;
$pg->skin = 1;
$pg->built_in = false;
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
}
}
示例13: getLastExchangeRate
public function getLastExchangeRate($rest, $currencyCode)
{
$date = date2sql(Today());
$sql = "SELECT rate_buy, max(date_) as date_ FROM " . TB_PREF . "exchange_rates WHERE curr_code = " . db_escape($id) . " AND date_ <= '{$date}' GROUP BY rate_buy ORDER BY date_ Desc LIMIT 1";
$result = db_query($sql, "could not query exchange rates");
if (db_num_rows($result) == 0) {
// no stored exchange rate, just return 0
api_success_response(json_encode(array('curr_abrev' => $id, 'rate' => 0, 'date' => $date)));
}
$myrow = db_fetch_row($result);
api_success_response(json_encode(array('curr_abrev' => $id, 'rate' => $myrow[0], 'date' => $myrow[1])));
}
示例14: update
public function update()
{
$this->load->model('modgenerador');
$this->modgenerador->getFromInput();
$statusActual = $this->input->post("frm_generador_activo_current");
if ($this->modgenerador->getActivo() != $statusActual) {
$this->modgenerador->setFechaactivo(Today());
}
$this->modgenerador->updateToDatabase();
echo $this->modgenerador->getIdgenerador();
$this->modsesion->addLog("actualizar", $this->modgenerador->getIdgenerador(), $this->modgenerador->getRazonsocial(), "generador", "relrutgen");
}
示例15: handle_new_order
function handle_new_order()
{
if (isset($_SESSION['transfer_items'])) {
$_SESSION['transfer_items']->clear_items();
unset($_SESSION['transfer_items']);
}
session_register("transfer_items");
$_SESSION['transfer_items'] = new items_cart();
$_POST['AdjDate'] = Today();
if (!is_date_in_fiscalyear($_POST['AdjDate'])) {
$_POST['AdjDate'] = end_fiscalyear();
}
$_SESSION['transfer_items']->tran_date = $_POST['AdjDate'];
}