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


PHP datediff函数代码示例

本文整理汇总了PHP中datediff函数的典型用法代码示例。如果您正苦于以下问题:PHP datediff函数的具体用法?PHP datediff怎么用?PHP datediff使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: Thaiza

function Thaiza($Header, $Birth_Date, $Image_1, $Image_2)
{
    $Now = date("j F Y");
    $Total_Day = datediff('d', $Now, $Birth_Date, false);
    if ($Total_Day <= 0) {
        $Week = 0;
        $Day = 0;
    } else {
        $Week = floor($Total_Day / 7);
        $Day = $Total_Day % 7;
    }
    $px_w = (40 - $Week) * 10;
    if ($px_w >= 360) {
        $px_w = 360;
    }
    if ($px_w <= 40) {
        $px_w = 40;
    }
    $String_2 = "{$Week} weeks and {$Day} days pregnant. Only {$Total_Day} days to go.";
    $image_1 = imagecreate(400, 100);
    $background_color = imagecolorallocate($image_1, 255, 255, 255);
    $image_2 = imagecreatefromjpeg($Image_1);
    $image_3 = imagecreatefromjpeg($Image_2);
    imagecopy($image_1, $image_2, 0, 20, 0, 0, 400, 60);
    imagecopymergegray($image_1, $image_3, $px_w, 20, 0, 0, 40, 60, 70);
    $Color = imagecolorallocate($image_1, 0, 0, 0);
    $px_1 = (imagesx($image_1) - 7.5 * strlen($Header)) / 2;
    $py_1 = imagesy($image_1) - 90;
    imagestring($image_1, 3, $px_1, $py_1, $Header, $Color);
    $px_2 = (imagesx($image_1) - 7.5 * strlen($String_2)) / 2;
    $py_2 = imagesy($image_1) - 20;
    imagestring($image_1, 3, $px_2, $py_2, $String_2, $Color);
    Header("Content-type: image/jpeg");
    imagepng($image_1);
    imagedestroy($image_1);
}
开发者ID:joaosigno,项目名称:is20-2,代码行数:36,代码来源:test_image.php

示例2: message_die

    }
} else {
    $auction_offer_move_link = "";
}
// End if
// UPDATE OFFER-VIEWS
$sql = "UPDATE " . AUCTION_OFFER_TABLE . "\r\n             SET auction_offer_views =  auction_offer_views + 1\r\n             WHERE PK_auction_offer_id = " . $auction_offer_id . "";
if (!($result = $db->sql_query($sql))) {
    message_die(GENERAL_ERROR, 'Could not update offer views', '', __LINE__, __FILE__, $sql);
}
$auction_offer_time_start = create_date($board_config['default_dateformat'], $auction_offer_row['auction_offer_time_start'], $board_config['board_timezone']);
$auction_offer_time_stop = create_date($board_config['default_dateformat'], $auction_offer_row['auction_offer_time_stop'], $board_config['board_timezone']);
if ($auction_offer_row['auction_offer_time_stop'] < time()) {
    $auction_time_remaining = '-';
} else {
    $auction_time_remaining = datediff(time(), $auction_offer_row['auction_offer_time_stop']);
}
// create auction-offer-message (not started, active, or over)
if ($auction_offer_row['auction_offer_time_start'] > time()) {
    $auction_offer_time_message = "<font color=\"red\">" . $lang['auction_offer_not_started'] . "</font>";
} elseif ($auction_offer_row['auction_offer_time_stop'] < time()) {
    $auction_offer_time_message = "<font color=\"red\">" . $lang['auction_offer_over'] . "</font>";
} else {
    $auction_offer_time_message = "<font color=\"red\">" . $lang['auction_offer_status_active'] . "</font>";
}
// getting seller-info
$sql = "SELECT u.username,\r\n                    u.user_id,\r\n                    u.user_posts,\r\n                    u.user_from,\r\n                    u.user_website,\r\n                    u.user_email,\r\n                    u.user_icq,\r\n                    u.user_aim,\r\n                    u.user_yim,\r\n                    u.user_regdate,\r\n                    u.user_msnm,\r\n                    u.user_viewemail,\r\n                    u.user_rank,\r\n                    u.user_sig,\r\n                    u.user_sig_bbcode_uid,\r\n                    u.user_avatar,\r\n                    u.user_avatar_type,\r\n                    u.user_allowavatar,\r\n                    u.user_allowsmile\r\n            FROM " . USERS_TABLE . " u\r\n            WHERE  u.user_id = " . $auction_offer_row['user_id'] . "";
if (!($result = $db->sql_query($sql))) {
    message_die(GENERAL_ERROR, "Could not obtain post/user information.", '', __LINE__, __FILE__, $sql);
}
$sellerrow = array();
开发者ID:wrtcoder,项目名称:mini_isp,代码行数:31,代码来源:auction_offer_view.php

示例3: get_kunjungan

	function get_kunjungan($val) {
		unset($_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk]);
		$tgl_start = @date("Y-m-d", @mktime(1,1,1,$val[tgl_periksa_bln_start], $val[tgl_periksa_tgl_start], $val[tgl_periksa_thn_start]));
		$tgl_end = @date("Y-m-d", @mktime(1,1,1,$val[tgl_periksa_bln_end], $val[tgl_periksa_tgl_end], $val[tgl_periksa_thn_end]));
		$title = "Statistik Kunjungan Radiologi Berdasar Cara Masuk";
		
		if($val[tampilkan] == "hari") {
			$selisih = datediff('d', $tgl_start, $tgl_end);
			$tanggal_awal = tanggalIndo($tgl_start, "j F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "j F Y");
		} elseif($val[tampilkan] == "bulan") {
			$selisih = datediff('m', $tgl_start, $tgl_end);
			$tanggal_awal = tanggalIndo($tgl_start, "F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "F Y");
		} else {
			$selisih = datediff('y', $tgl_start, $tgl_end);
			$tanggal_awal = tanggalIndo($tgl_start, "Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "Y");
		}

		$title .= "\nPeriode " . $tanggal_awal . " s.d. " . $tanggal_akhir;

		$arr_tgl_start = explode("-",$tgl_start);
		$tgl_start_tgl = $arr_tgl_start[2];
		$tgl_start_bln = $arr_tgl_start[1];
		$tgl_start_thn = $arr_tgl_start[0];

		$arr_tgl_end = explode("-",$tgl_end);
		$tgl_end_tgl = $arr_tgl_end[2];
		$tgl_end_bln = $arr_tgl_end[1];
		$tgl_end_thn = $arr_tgl_end[0];

		$objResponse = new xajaxResponse();
		$kon = new Konek;

		for($i=0;$i<=$selisih;$i++) {
			if($val[tampilkan] == "hari") {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, $tgl_start_bln, ($i+$tgl_start_tgl), $tgl_start_thn));
				$tgl_periksa[$i] = tanggalIndo($tgl[$i], "j M\nY");
				$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][radioel_tick][$i] = @date("j", @mktime(1, 1, 1,$tgl_start_bln, ($tgl_start_tgl+$i), $tgl_start_thn));
				$radioel_x[$i] = @date("M Y", @mktime(1, 1, 1, $tgl_start_bln, ($tgl_start_tgl+$i), $tgl_start_thn));
				$where = " AND DATE(lk.tgl_periksa) = '" . $tgl[$i] . "' ";
			} elseif($val[tampilkan] == "bulan") {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$tgl_periksa[$i] = tanggalIndo($tgl[$i], "M\nY");
				$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][radioel_tick][$i] = @date("M y", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$radioel_x[$i] = @date("Y", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$where = " AND EXTRACT(YEAR_MONTH FROM lk.tgl_periksa) = EXTRACT(YEAR_MONTH FROM '" . $tgl[$i] . "') ";
			} else {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, 1, 1, ($tgl_start_thn + $i)));
				$tgl_periksa[$i] = tanggalIndo($tgl[$i], "Y");
				$_SESSION[rekmed][statistik_kunjungan_radio_semua_cara_masuk][radioel_tick][$i] = @date("Y", @mktime(1, 1, 1, 1, 1, ($tgl_start_thn+$i)));
				$radioel_x[$i] = "Tahun";
				$where = " AND YEAR(lk.tgl_periksa) = YEAR('" . $tgl[$i] . "') ";
			}
			//dari IRD
			$kon->sql = "
				SELECT
					COUNT(lk.id) as jml_igd
				FROM
					radio_kunjungan lk 
					JOIN pasien p ON (p.id = lk.pasien_id)
				WHERE
					lk.cara_masuk = 'IGD'
					$where
			";
			$kon->execute();
			$igd[$i] = $kon->getOne();
			if(!$igd[$i][jml_igd]) $igd[$i][jml_igd] = "-";


			//dari RAWAT JALAN
			$kon->sql = "
				SELECT
					COUNT(lk.id) as jml_rajal
				FROM
					radio_kunjungan lk 
					JOIN pasien p ON (p.id = lk.pasien_id)
				WHERE
					lk.cara_masuk = 'RAWAT JALAN'
					$where
			";
			$kon->execute();
			$rajal[$i] = $kon->getOne();
			if(!$rajal[$i][jml_rajal]) $rajal[$i][jml_rajal] = "-";


			//dari RAWAT INAP
			$kon->sql = "
				SELECT
					COUNT(lk.id) as jml_ranap
				FROM
					radio_kunjungan lk 
					JOIN pasien p ON (p.id = lk.pasien_id)
				WHERE
					lk.cara_masuk = 'RAWAT INAP'
					$where
			";
			$kon->execute();
			$ranap[$i] = $kon->getOne();
//.........这里部分代码省略.........
开发者ID:reekoheek,项目名称:srmis,代码行数:101,代码来源:statistik_kunjungan_radio_semua_cara_masuk.php

示例4: generate_cashflow_array


//.........这里部分代码省略.........
            $temp_value = "<nobr>" . format_dolla($data["value"]) . "</nobr> <small><a href='#' class='btnsmall xedit' id='payment_value_edit_" . $data["id"] . "' data-name='payment_value' data-type='text' data-pk='" . $data["id"] . "' data-url='/forecast/post.php' data-title='Enter Payment Value' data-value='" . $data["value"] . "'>edit</a></small>";
            if ($data["value"] <= 0) {
                $cashflow_row["value"] = array($temp_value, "class='payment_cell'");
            } else {
                $cashflow_row["value"] = array($temp_value, "bgcolor='" . $green . "' class='payment_cell'");
            }
            if (!$paymentisactive) {
                //if payment is not active, don't include values in main table
                for ($date = 0; $date <= $numdata_cols; $date++) {
                    $cashflow_row[] = array(0, "class='payment_cell'");
                }
                $cashflow_array[] = $cashflow_row;
            } else {
                switch ($data["type"]) {
                    //column of payment types
                    case 1:
                        // Weekly =			Day of Week: 0 = Sun, 1 = Mon etc
                        for ($date = 0; $date <= $numdata_cols; $date++) {
                            //calculate if this payment applies to each date column
                            $col_date = date("w", strtotime("+" . $date . " day", strtotime($date_today)));
                            if ($col_date == $data["dayofweek"]) {
                                $cashflow_row[] = array($data["value"], "class='payment_cell'");
                            } else {
                                $cashflow_row[] = array(0, "class='payment_cell'");
                            }
                        }
                        break;
                    case 2:
                        // 2. Fortnightly = Start date: 21 Feb 2016
                        for ($date = 0; $date <= $numdata_cols; $date++) {
                            //calculate if this payment applies to each date column
                            $col_day = $daysoffortnight[date("w", strtotime("+" . $date . " day", strtotime($date_today)))];
                            $col_date = date("j F Y", strtotime("+" . $date . " day", strtotime($date_today)));
                            if (datediff('ww', '3 January 2016', $col_date, false) & 1) {
                                $iswk2 = "";
                            } else {
                                $iswk2 = "-wk2";
                            }
                            if ($col_day . $iswk2 == $daysoffortnight[$data["dayoffortnight"]]) {
                                $cashflow_row[] = array($data["value"], "class='payment_cell'");
                            } else {
                                $cashflow_row[] = array(0, "class='payment_cell'");
                            }
                        }
                        break;
                    case 3:
                        // Monthly = 	Day of Month: 21 (up to 28 to avoid Feb issues)
                        for ($date = 0; $date <= $numdata_cols; $date++) {
                            //calculate if this payment applies to each date column
                            $col_date = date("j", strtotime("+" . $date . " day", strtotime($date_today)));
                            if ($col_date == $data["dayofmonth"]) {
                                $cashflow_row[] = array($data["value"], "class='payment_cell'");
                            } else {
                                $cashflow_row[] = array(0, "class='payment_cell'");
                            }
                        }
                        break;
                    case 4:
                        // 4. Quarterly =	Start Date: 21 Feb 2016
                        $quart_date = date("d M Y", strtotime($data["startdate"]));
                        for ($date = 0; $date <= $numdata_cols; $date++) {
                            //calculate if this payment applies to each date column
                            $col_date = date("d M Y", strtotime("+" . $date . " day", strtotime($date_today)));
                            $col_date2 = date("d M Y", strtotime("+90 day", strtotime($date_today)));
                            $col_date3 = date("d M Y", strtotime("+180 day", strtotime($date_today)));
                            $col_date4 = date("d M Y", strtotime("+270 day", strtotime($date_today)));
开发者ID:Swiftaff,项目名称:forecast,代码行数:67,代码来源:functions.php

示例5: includeAuctionSpecialBlock

function includeAuctionSpecialBlock()
{
    global $template, $lang, $db, $board_config, $userdata, $phpEx, $images;
    $auction_config_data = init_auction_config();
    // Just display if switched on via ACP
    if ($auction_config_data['auction_block_display_specials'] == 1) {
        $sql = "SELECT PK_auction_offer_id,\r\n                                    auction_offer_title,\r\n                                    auction_offer_picture,\r\n                                    auction_offer_time_stop\r\n                             FROM " . AUCTION_OFFER_TABLE . "\r\n                             WHERE auction_offer_state=0 AND\r\n                                   auction_offer_special=1 AND\r\n                                   auction_offer_paid=1 AND\r\n                                   auction_offer_time_start < " . time() . " AND\r\n                                   auction_offer_time_stop > " . time() . "\r\n                             ORDER BY auction_offer_time_stop DESC\r\n                             LIMIT 0, " . $auction_config_data['auction_block_specials_limit'] . "";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not query news', '', __LINE__, __FILE__, $sql);
        }
        // End if
        $specials_count = 0;
        $specials_row = array();
        while ($row = $db->sql_fetchrow($result)) {
            $specials_row[] = $row;
            $specials_count++;
        }
        // End while
        $template->assign_block_vars('special_block', array('L_AUCTION_SPECIAL_OFFERS_TITLE' => $lang['auction_special_offers']));
        for ($i = 0; $i < $specials_count; $i++) {
            $auction_offer_id = $specials_row[$i]['PK_auction_offer_id'];
            // BEGIN include auction-pic-config information
            $auction_config_pic = init_auction_config_pic();
            // END include auction-pic-config information
            // get info for admin and mod. Admin and mod see the offer-pic even if it has not been validated yet
            // this is only valid if validation is active
            if ($auction_config_pic['auction_offer_pic_approval_admin'] == 1) {
                if ($userdata['user_level'] == ADMIN or $userdata['user_level'] == MOD) {
                    $x_sql = "";
                } else {
                    $x_sql = "AND pic_approval = 0 AND pic_lock = 0 ";
                }
            } else {
                if ($userdata['user_level'] == ADMIN or $userdata['user_level'] == MOD) {
                    $x_sql = "";
                } else {
                    $x_sql = "AND pic_lock = 0 ";
                }
            }
            // specials pictures
            $sql = "SELECT pic_id, crop_id\r\n\t\t\t\tFROM " . AUCTION_IMAGE_TABLE . "\r\n\t\t\t\tWHERE pic_auction_id = '{$auction_offer_id}' AND\r\n                                      pic_main = 1 {$x_sql}";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not get pic  special-offer information  for auction id: ' . $auction_offer_id, '', __LINE__, __FILE__, $sql);
            }
            $pic_row = $db->sql_fetchrow($result);
            $mini_pic_id = $pic_row['pic_id'];
            $mini_crop_id = $pic_row['crop_id'];
            if ($mini_pic_id > 0) {
                $pic_yes = 1;
                $image_url = append_sid('auction_thumbnail.' . $phpEx . '?pic_type=3&crop=' . $mini_crop_id . '&pic_id=' . $mini_pic_id);
                $pic_width = $auction_config_pic['auction_offer_mini_size'];
                $pic_height = $auction_config_pic['auction_offer_mini_size'];
            } else {
                $pic_yes = 0;
            }
            // special pictures end
            $template->assign_block_vars('special_block.special_offer_block', array('AUCTION_SPECIAL_TITLE' => subStr($specials_row[$i]['auction_offer_title'], 0, 20), 'U_AUCTION_SPECIAL_TITLE' => append_sid("auction_offer_view.php?" . POST_AUCTION_OFFER_URL . "=" . $specials_row[$i]['PK_auction_offer_id']), 'AUCTION_SPECIAL_END' => datediff(time(), $specials_row[$i]['auction_offer_time_stop']), 'AUCTION_SPECIAL_IMAGE' => $pic_yes == 0 ? '<a href="' . append_sid("auction_offer_view.php?" . POST_AUCTION_OFFER_URL . "=" . $specials_row[$i]['PK_auction_offer_id']) . '"><img src="' . $images['icon_auction_no_pic'] . '" alt="' . $lang['auction_user_rating_view_offer'] . '" title="' . $lang['auction_user_rating_view_offer'] . '" border="0" /></a>' : '<a href="' . append_sid("auction_offer_view.php?" . POST_AUCTION_OFFER_URL . "=" . $specials_row[$i]['PK_auction_offer_id']) . '"><img src="' . $image_url . '" width="' . $pic_width . '" height="' . $pic_height . '" alt="' . $lang['auction_user_rating_view_offer'] . '" title="' . $lang['auction_user_rating_view_offer'] . '" border="0" /></a>'));
        }
        // End for
    }
    // End if
}
开发者ID:wrtcoder,项目名称:mini_isp,代码行数:62,代码来源:functions_blocks.php

示例6: get_kunjungan

	function get_kunjungan($val) {
		unset($_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar]);
		$tgl_start = @date("Y-m-d", @mktime(1,1,1,$val[tgl_periksa_bln_start], $val[tgl_periksa_tgl_start], $val[tgl_periksa_thn_start]));
		$tgl_end = @date("Y-m-d", @mktime(1,1,1,$val[tgl_periksa_bln_end], $val[tgl_periksa_tgl_end], $val[tgl_periksa_thn_end]));
		$title = "Rekapitulasi Jumlah Cara Pembayaran di Unit Rawat Jalan";
		
		if($val[tampilkan] == "hari") {
			$selisih = datediff('d', $tgl_start, $tgl_end);
		} elseif($val[tampilkan] == "bulan") {
			$selisih = datediff('m', $tgl_start, $tgl_end);
		} else {
			$selisih = datediff('y', $tgl_start, $tgl_end);
		}
		if($val[tampilkan] == "hari") {
			$tanggal_awal = tanggalIndo($tgl_start, "j F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "j F Y");
		} elseif($val[tampilkan] == "bulan") {
			$tanggal_awal = tanggalIndo($tgl_start, "F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "F Y");
		} else {
			$tanggal_awal = tanggalIndo($tgl_start, "Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "Y");
		}

		$title .= "\nPeriode " . $tanggal_awal . " s.d. " . $tanggal_akhir;

		$arr_tgl_start = explode("-",$tgl_start);
		$tgl_start_tgl = $arr_tgl_start[2];
		$tgl_start_bln = $arr_tgl_start[1];
		$tgl_start_thn = $arr_tgl_start[0];

		$arr_tgl_end = explode("-",$tgl_end);
		$tgl_end_tgl = $arr_tgl_end[2];
		$tgl_end_bln = $arr_tgl_end[1];
		$tgl_end_thn = $arr_tgl_end[0];

		$objResponse = new xajaxResponse();
		$kon = new Konek;
	
		for($i=0;$i<=$selisih;$i++) {
			if($val[tampilkan] == "hari") {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, $tgl_start_bln, ($i+$tgl_start_tgl), $tgl_start_thn));
				$data[$i][tgl_periksa] = tanggalIndo($tgl[$i], "j M Y");
				$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][label_tick][$i] = @date("j", @mktime(1, 1, 1,$tgl_start_bln, ($tgl_start_tgl+$i), $tgl_start_thn));
				$label_x[$i] = @date("M Y", @mktime(1, 1, 1, $tgl_start_bln, ($tgl_start_tgl+$i), $tgl_start_thn));
				$where = " AND DATE(kk.tgl_periksa) = '" . $tgl[$i] . "'";
			} elseif($val[tampilkan] == "bulan") {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$data[$i][tgl_periksa] = tanggalIndo($tgl[$i], "M Y");
				$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][label_tick][$i] = @date("M y", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$label_x[$i] = @date("Y", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$where = " AND EXTRACT(YEAR_MONTH FROM kk.tgl_periksa) = EXTRACT(YEAR_MONTH FROM '" . $tgl[$i] . "')";
			} else {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, 1, 1, ($tgl_start_thn + $i)));
				$data[$i][tgl_periksa] = tanggalIndo($tgl[$i], "Y");
				$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][label_tick][$i] = @date("Y", @mktime(1, 1, 1, 1, 1, ($tgl_start_thn+$i)));
				$label_x[$i] = "Tahun";
				$where = " AND YEAR(kk.tgl_periksa) = YEAR('" . $tgl[$i] . "')";
			}
			$sql = "
				SELECT
					kk.cara_bayar as nama, 
					COUNT(kk.id) as jml
				FROM
					kunjungan_kamar kk 
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				WHERE
					pel.jenis = 'RAWAT JALAN'
					$where
				GROUP BY
					kk.cara_bayar
				ORDER BY
					kk.cara_bayar
				";
			$kon->sql = $sql;
			$kon->execute();
			$baru[$i] = $kon->getAll();
		}
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][title] = $title . "\nPeriode " . tanggalIndo($tgl_start, "j F Y") . " s.d. " . tanggalIndo($tgl_end, "j F Y");
		$labelx = @array_unique($label_x);
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][label_x] = @implode(", ",$labelx);
		
		$new = array();
		for($i=0;$i<sizeof($baru);$i++) {
			for($s=0;$s<sizeof($baru[$i]);$s++) {
				$new[jml][$baru[$i][$s][nama]][$i] = $baru[$i][$s][jml];
			}
		}
		$table = new Table;
		$table->scroll = false;
		$table->addExtraTh("style=\"width:300px;\"");
		$table->Th[0][] = "Cara Pembayaran/ Periode";
		$table->Th[1][] = "1";
		for($i=0;$i<=$selisih;$i++) {
			$table->Th[0][] = $data[$i][tgl_periksa];
			$table->Th[1][] = ($i+2);
		}
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][th_0] = $table->Th[0];
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][th_1] = $table->Th[1];
//.........这里部分代码省略.........
开发者ID:reekoheek,项目名称:srmis,代码行数:101,代码来源:rekap_kunjungan_rajal_per_cara_bayar.php

示例7: floor

            // Number of full hours
            $datediff = floor($difference / 3600);
            break;
        case "n":
            // Number of full minutes
            $datediff = floor($difference / 60);
            break;
        default:
            // Number of full seconds (default)
            $datediff = $difference;
            break;
    }
    return $datediff;
}
// getting Date difference in SECONDS
$diff = datediff("s", $count_from, $countdown_to);
?>
// Here's where the Javascript starts
countdown = <?php 
echo $diff;
?>
;

// Converting date difference from seconds to actual time
function convert_to_time(secs)
{
	secs = parseInt(secs);	
	hh = secs / 3600;	
	hh = parseInt(hh);	
	mmt = secs - (hh * 3600);	
	mm = mmt / 60;	
开发者ID:nevergivein111,项目名称:taxi420,代码行数:31,代码来源:countdown.php

示例8: get_kunjungan

	function get_kunjungan($val) {
		unset($_SESSION[ranap][statistik_kunjungan_ranap]);
		$tgl_start = @date("Y-m-d", @mktime(1,1,1,$val[tgl_periksa_bln_start], $val[tgl_periksa_tgl_start], $val[tgl_periksa_thn_start]));
		$tgl_end = @date("Y-m-d", @mktime(1,1,1,$val[tgl_periksa_bln_end], $val[tgl_periksa_tgl_end], $val[tgl_periksa_thn_end]));
		$title = "Statistik Kunjungan Rawat Inap";
		$objResponse = new xajaxResponse();
		$kon = new Konek;
		if($_SESSION[pelayanan_id]) {
			$kon->sql = "SELECT nama FROM pelayanan WHERE id = '".$_SESSION[pelayanan_id]."'";
			$kon->execute();
			$poli = $kon->getOne();
			$title .= "\nBangsal " . $poli[nama];
			$q = "AND pel.id = '".$_SESSION[pelayanan_id]."'";
		}
		if($val[tampilkan] == "hari") {
			$selisih = datediff('d', $tgl_start, $tgl_end);
			$tanggal_awal = tanggalIndo($tgl_start, "j F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "j F Y");
		} elseif($val[tampilkan] == "bulan") {
			$selisih = datediff('m', $tgl_start, $tgl_end);
			$tanggal_awal = tanggalIndo($tgl_start, "F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "F Y");
		} else {
			$selisih = datediff('y', $tgl_start, $tgl_end);
			$tanggal_awal = tanggalIndo($tgl_start, "Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "Y");
		}

		$title .= "\nPeriode " . $tanggal_awal . " s.d. " . $tanggal_akhir;

		$arr_tgl_start = explode("-",$tgl_start);
		$tgl_start_tgl = $arr_tgl_start[2];
		$tgl_start_bln = $arr_tgl_start[1];
		$tgl_start_thn = $arr_tgl_start[0];

		$arr_tgl_end = explode("-",$tgl_end);
		$tgl_end_tgl = $arr_tgl_end[2];
		$tgl_end_bln = $arr_tgl_end[1];
		$tgl_end_thn = $arr_tgl_end[0];

		
		for($i=0;$i<=$selisih;$i++) {
			if($val[tampilkan] == "hari") {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, $tgl_start_bln, ($i+$tgl_start_tgl), $tgl_start_thn));
				$tgl_periksa[$i] = tanggalIndo($tgl[$i], "j M\nY");
				$_SESSION[ranap][statistik_kunjungan_ranap][label_tick][$i] = @date("j", @mktime(1, 1, 1,$tgl_start_bln, ($tgl_start_tgl+$i), $tgl_start_thn));
				$label_x[$i] = @date("M Y", @mktime(1, 1, 1, $tgl_start_bln, ($tgl_start_tgl+$i), $tgl_start_thn));
				$where = " AND DATE(kk.tgl_periksa) = '" . $tgl[$i] . "' ";
				$where_keluar = " AND DATE(kk.tgl_keluar) = '" . $tgl[$i] . "' ";
			} elseif($val[tampilkan] == "bulan") {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$tgl_periksa[$i] = tanggalIndo($tgl[$i], "M\nY");
				$_SESSION[ranap][statistik_kunjungan_ranap][label_tick][$i] = @date("M y", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$label_x[$i] = @date("Y", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$where = " AND EXTRACT(YEAR_MONTH FROM kk.tgl_periksa) = EXTRACT(YEAR_MONTH FROM '" . $tgl[$i] . "') ";
				$where_keluar = " AND EXTRACT(YEAR_MONTH FROM kk.tgl_keluar) = EXTRACT(YEAR_MONTH FROM '" . $tgl[$i] . "') ";
			} else {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, 1, 1, ($tgl_start_thn + $i)));
				$tgl_periksa[$i] = tanggalIndo($tgl[$i], "Y");
				$_SESSION[ranap][statistik_kunjungan_ranap][label_tick][$i] = @date("Y", @mktime(1, 1, 1, 1, 1, ($tgl_start_thn+$i)));
				$label_x[$i] = "Tahun";
				$where = " AND YEAR(kk.tgl_periksa) = YEAR('" . $tgl[$i] . "') ";
				$where_keluar = " AND YEAR(kk.tgl_keluar) = YEAR('" . $tgl[$i] . "') ";
			}
			
			$sql = "
				SELECT
					COUNT(kk.id) as jml
				FROM
					kunjungan_kamar kk 
					JOIN kunjungan k ON (k.id = kk.kunjungan_id)
					JOIN pasien p ON (p.id = k.pasien_id)
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				WHERE
					pel.jenis = 'RAWAT INAP'
					$q
					$where
				";
			$kon->sql = $sql;
			$kon->execute();
			$masuk[$i] = $kon->getOne();
			if(!$masuk[$i][jml]) $masuk[$i][jml] = 0;

			$_SESSION[ranap][statistik_kunjungan_ranap][jml_masuk][$i] = $masuk[$i][jml];
			$_SESSION[ranap][statistik_kunjungan_ranap][tgl_periksa][$i] = $tgl_periksa[$i];
			

			//GET DATA PX KELUAR
			$sql2 = "
				SELECT
					COUNT(kk.id) as jml
				FROM
					kunjungan_kamar kk 
					JOIN kunjungan k ON (k.id = kk.kunjungan_id)
					JOIN pasien p ON (p.id = k.pasien_id)
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				WHERE
					pel.jenis = 'RAWAT INAP'
//.........这里部分代码省略.........
开发者ID:reekoheek,项目名称:srmis,代码行数:101,代码来源:statistik_kunjungan_ranap.php

示例9: get_month_name

echo get_month_name($ref_date) . " " . get_year($ref_date) . "</div>";
if ($type == "PF") {
    $loan_table = "PF_LOAN";
} else {
    if ($type == "CUF") {
        $loan_table = "CUF_LOAN";
    } else {
        die("Loantype unspecified !");
    }
}
$result = mysql_query("select * from {$loan_table}", $db);
checkMySQLError();
beginPrettyTable("4", "{$loan_table}");
printRow(array("Emp_ID3", "Emp. Name", "LoanStart", "LoanEnd", "Loan-Amt", "Instalment", "Tot_Amt", "Due", "Balance"));
while ($row = mysql_fetch_array($result)) {
    $name = $personal_array[$row["EMP_ID3"]];
    $rest_inst_no = datediff("m", $ref_date, $row["LOAN_END"]);
    $rest_amount = $rest_inst_no * $row["INT_RATE"];
    if ($rest_inst_no < 0) {
        continue;
    }
    $inst_sum += $rest_inst_no;
    $rest_amount_sum += $rest_amount;
    $loan_amount_sum += $row["LOAN_AMT"];
    printRow(array($row["EMP_ID3"], $name, conv_to_hrd($row["LOAN_START"]), conv_to_hrd($row["LOAN_END"]), $row["LOAN_AMT"], $row["INT_RATE"], $row["TOT_AMT"], $rest_inst_no, $rest_amount), "fluct");
}
printRow(array("", "", "Loan-Amt-Sum: ", $loan_amount_sum), "", "3,2");
printRow(array("", "", "Inst-Sum: ", "", $inst_sum), "", "3,2");
printRow(array("", "", "Balance-Sum: ", "", "", "", "", $rest_amount_sum), "", "3,2");
endPrettyTable();
endDocument();
开发者ID:k9ert,项目名称:ac4ngos,代码行数:31,代码来源:list_loan.php

示例10: Subcription

 public function Subcription($frequency, $start, $end, $due)
 {
     //helper function
     function datediff($interval, $datefrom, $dateto, $using_timestamps = false)
     {
         /*
         $interval can be:
         yyyy - Number of full years
         q - Number of full quarters
         m - Number of full months
         y - Difference between day numbers
             (eg 1st Jan 2004 is "1", the first day. 2nd Feb 2003 is "33". The datediff is "-32".)
         d - Number of full days
         w - Number of full weekdays
         ww - Number of full weeks
         h - Number of full hours
         n - Number of full minutes
         s - Number of full seconds (default)
         */
         if (!$using_timestamps) {
             $datefrom = strtotime($datefrom, 0);
             $dateto = strtotime($dateto, 0);
         }
         $difference = $dateto - $datefrom;
         // Difference in seconds
         switch ($interval) {
             case 'yyyy':
                 // Number of full years
                 $years_difference = floor($difference / 31536000);
                 if (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom), date("j", $datefrom), date("Y", $datefrom) + $years_difference) > $dateto) {
                     $years_difference--;
                 }
                 if (mktime(date("H", $dateto), date("i", $dateto), date("s", $dateto), date("n", $dateto), date("j", $dateto), date("Y", $dateto) - ($years_difference + 1)) > $datefrom) {
                     $years_difference++;
                 }
                 $datediff = $years_difference;
                 break;
             case "q":
                 // Number of full quarters
                 $quarters_difference = floor($difference / 8035200);
                 while (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom) + $quarters_difference * 3, date("j", $dateto), date("Y", $datefrom)) < $dateto) {
                     $months_difference++;
                 }
                 $quarters_difference--;
                 $datediff = $quarters_difference;
                 break;
             case "m":
                 // Number of full months
                 $months_difference = floor($difference / 2678400);
                 while (mktime(date("H", $datefrom), date("i", $datefrom), date("s", $datefrom), date("n", $datefrom) + $months_difference, date("j", $dateto), date("Y", $datefrom)) < $dateto) {
                     $months_difference++;
                 }
                 $months_difference--;
                 $datediff = $months_difference;
                 break;
             case 'y':
                 // Difference between day numbers
                 $datediff = date("z", $dateto) - date("z", $datefrom);
                 break;
             case "d":
                 // Number of full days
                 $datediff = floor($difference / 86400);
                 break;
             case "w":
                 // Number of full weekdays
                 $days_difference = floor($difference / 86400);
                 $weeks_difference = floor($days_difference / 7);
                 // Complete weeks
                 $first_day = date("w", $datefrom);
                 $days_remainder = floor($days_difference % 7);
                 $odd_days = $first_day + $days_remainder;
                 // Do we have a Saturday or Sunday in the remainder?
                 if ($odd_days > 7) {
                     // Sunday
                     $days_remainder--;
                 }
                 if ($odd_days > 6) {
                     // Saturday
                     $days_remainder--;
                 }
                 $datediff = $weeks_difference * 5 + $days_remainder;
                 break;
             case "ww":
                 // Number of full weeks
                 $datediff = floor($difference / 604800);
                 break;
             case "h":
                 // Number of full hours
                 $datediff = floor($difference / 3600);
                 break;
             case "n":
                 // Number of full minutes
                 $datediff = floor($difference / 60);
                 break;
             default:
                 // Number of full seconds (default)
                 $datediff = $difference;
                 break;
         }
         return $datediff;
//.........这里部分代码省略.........
开发者ID:illuminate3,项目名称:league-production,代码行数:101,代码来源:Plan.php

示例11: mysqli_fetch_assoc

<?php 
$r1 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT count(id) as cnt from " . $tablename . " where vote=1  and date(contactdate) ='" . $date2 . "' and userid !=0"));
$r2 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT count(id) as cnt from " . $tablename . " where vote=0 and date(contactdate) ='" . $date2 . "' and userid !=0 and iscalled=1"));
$r3 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT count(id) as cnt from " . $tablename . " where vote=2 and date(contactdate) ='" . $date2 . "' and userid !=0"));
$r4 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT count(id) as cnt from " . $tablename . " where iscalled=2 and date(contactdate) ='" . $date2 . "'"));
$r5 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT count(id) as cnt from " . $tablename . " where iscalled=3 and date(contactdate) ='" . $date2 . "'"));
$r6 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT count(id) as cnt from " . $tablename . " where iscalled=4 and date(contactdate) ='" . $date2 . "'"));
$r7 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT count(id) as cnt from " . $tablename . " where iscalled=5 and date(contactdate) ='" . $date2 . "'"));
?>
</td>
  </tr>
</table>
   
<br />
 <?php 
$datediffno = datediff($date2, $date1);
if ($datediffno <= 0) {
    ?>
                  <p class="norecords">No Contacts <?php 
    if ($action == "show") {
        echo ' with this filter.';
    }
    ?>
</p>

<?php 
} else {
    ?>
<table class="table table-hover  table_vam table-black" width="400">
    	<thead>
        <tr>
开发者ID:AamAadmiParty,项目名称:emc3,代码行数:31,代码来源:daily-reports.php

示例12: date_default_timezone_set

date_default_timezone_set("America/Santiago");
$today = date("Y-m-d H:i:s");
//pendiente: cambiar a unix
//echo "<p style=\"position:absolute\">system date is $today</p>";
include "common_funcs_php.php";
$extraclass = "";
worDB();
$sql = "SELECT tid, content, context, user, deadline, importance, submission_date, status\n\t\tFROM taskstack\n\t\tWHERE context='lectura' OR context='peliculas' OR context='entretencion' OR context='BDE'";
mysql_select_db($db);
$retval = mysql_query($sql, $conn);
$printarray = array();
if (!$retval) {
    die('Could not get data: ' . mysql_error());
} else {
    while ($row = mysql_fetch_array($retval, MYSQL_ASSOC)) {
        $ddiff = floatval(datediff($today, $row["deadline"], "\$d"));
        //$ddiff+=1;
        $extraclass = "";
        if ($today . "" === $row['deadline']) {
            $extraclass = " today";
        }
        if ($tomorrow . "" === $row['deadline']) {
            $extraclass = " tomorrow";
        }
        if ("ready" === $row['status']) {
            $extraclass .= " ready";
        }
        $extraclass .= " im" . $row['importance'];
        $printarray[$row['importance'] . "x" . $row['deadline'] . "x" . $row['tid']] = '<div data-datediff="' . $ddiff . '" data-tid="' . $row['tid'] . '" data-context="' . $row['context'] . '" class="item ' . $extraclass . '">' . "<b>{$row['context']}</b><BR>" . "{$row['content']}<br><a class=\"ajax\" href=\"{$_SERVER['self']}input.php?actionload=true&tid={$row['tid']}\">edit</a>";
        if ($row['status'] === "ready") {
            $printarray[$row['importance'] . "x" . $row['deadline'] . "x" . $row['tid']] .= "" . " | <a class=\"ajax\" href=\"{$_SERVER['self']}postExec.php?action=remove&tid={$row['tid']}\">remove</a>";
开发者ID:autotel,项目名称:taskstack,代码行数:31,代码来源:fun.php

示例13: exit

if ($thn[0] != $thn2[0]) {
    exit("Error:Tahun tidak boleh beda");
}
//echo $sistemGaji;
$tanggal1 = $tgl1 . "-01";
$tanggal2 = $tgl2 . "-01";
function datediff($tgl1, $tgl2)
{
    $tgl1 = strtotime($tgl1);
    $tgl2 = strtotime($tgl2);
    $diff_secs = abs($tgl1 - $tgl2);
    $base_year = min(date("Y", $tgl1), date("Y", $tgl2));
    $diff = mktime(0, 0, $diff_secs, 1, 1, $base_year);
    return array("years" => date("Y", $diff) - $base_year, "months_total" => (date("Y", $diff) - $base_year) * 12 + date("n", $diff) - 1, "months" => date("n", $diff) - 1, "days_total" => floor($diff_secs / (3600 * 24)), "days" => date("j", $diff) - 1, "hours_total" => floor($diff_secs / 3600), "hours" => date("G", $diff), "minutes_total" => floor($diff_secs / 60), "minutes" => (int) date("i", $diff), "seconds_total" => $diff_secs, "seconds" => (int) date("s", $diff));
}
$totBln = datediff($tanggal1, $tanggal2);
//exit("error".$totBln[months_total]);
for ($ard = 1; $ard <= $totBln['months_total']; $ard++) {
    if (strlen($ard) < 2) {
        $bar = "0" . $ard;
    }
    $test[] = $thn1[0] . "-" . $bar;
}
//ambil query untuk data karyawan
if ($kdOrg != '') {
    $kodeOrg = $kdOrg;
    if ($_SESSION['empl']['tipelokasitugas'] == 'HOLDING') {
        $where = "  lokasitugas in ('" . $kodeOrg . "')";
    } else {
        if (strlen($kdOrg) > 4) {
            $where = "  subbagian='" . $kdOrg . "'";
开发者ID:halimc17,项目名称:magsys,代码行数:31,代码来源:sdm_slave_2rekapabsen_thn.php

示例14: datediff

        $resptime = $row_01['responding'];
        $resp_list[$row_01['id']] = datediff($resptime, $disptime);
    }
}
//	Average time Dispatched to On Scene
$query = "SELECT *, `{$GLOBALS['mysql_prefix']}ticket`.`id` AS `tick_id`\n\t\tFROM `{$GLOBALS['mysql_prefix']}ticket` \n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}allocates` \n\t\t\tON `{$GLOBALS['mysql_prefix']}ticket`.`id`=`{$GLOBALS['mysql_prefix']}allocates`.`resource_id`\n\t\tWHERE (`status` = 2 or `status` = 3) {$where2} {$where2} AND `{$GLOBALS['mysql_prefix']}allocates`.`type` = 1 GROUP BY `tick_id`";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
$num_tick3 = mysql_num_rows($result);
while ($row = mysql_fetch_assoc($result)) {
    $tick_id = $row['tick_id'];
    $query_01 = "SELECT *,\n\t\t\t\tUNIX_TIMESTAMP(`{$GLOBALS['mysql_prefix']}assigns`.`dispatched`) as `dispatched`,\n\t\t\t\tUNIX_TIMESTAMP(`{$GLOBALS['mysql_prefix']}assigns`.`responding`) as `responding`,\t\t\t\t\n\t\t\t\tUNIX_TIMESTAMP(`{$GLOBALS['mysql_prefix']}assigns`.`on_scene`) as `on_scene`\t\t\t\t\n\t\t\t\tFROM `{$GLOBALS['mysql_prefix']}assigns` \n\t\t\t\tWHERE `ticket_id` = {$tick_id} AND (`on_scene` IS NOT NULL OR DATE_FORMAT(`on_scene`,'%y') != '00')";
    $result_01 = mysql_query($query_01) or do_error($query_01, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
    while ($row_01 = mysql_fetch_assoc($result_01)) {
        $disptime = $row_01['dispatched'];
        $ostime = $row_01['on_scene'];
        $os_list[$row_01['id']] = datediff($ostime, $disptime);
    }
}
// Number of responders not assigned and Available
$x = 0;
$where2 = "WHERE (";
foreach ($al_groups as $grp) {
    $where3 = count($al_groups) > $x + 1 ? " OR " : ")";
    $where2 .= "`{$GLOBALS['mysql_prefix']}allocates`.`group` = '{$grp}'";
    $where2 .= $where3;
    $x++;
}
$query = "SELECT *,\t`{$GLOBALS['mysql_prefix']}responder`.`id` AS `resp_id`,\n\t\t(SELECT  COUNT(*) as numfound FROM `{$GLOBALS['mysql_prefix']}assigns` \n\t\t\tWHERE `{$GLOBALS['mysql_prefix']}assigns`.`responder_id` = `{$GLOBALS['mysql_prefix']}responder`.`id`  \n\t\t\tAND `clear` IS NULL OR DATE_FORMAT(`clear`,'%y') = '00' ) \n\t\t\tAS `num_assignments`\n\t\tFROM `{$GLOBALS['mysql_prefix']}responder`\t\t\t\n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}allocates` \n\t\t\tON `{$GLOBALS['mysql_prefix']}responder`.id=`{$GLOBALS['mysql_prefix']}allocates`.`resource_id`\t\n\t\t {$where2} AND `{$GLOBALS['mysql_prefix']}allocates`.`type` = 2 GROUP BY `{$GLOBALS['mysql_prefix']}responder`.`id`";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
while ($row = mysql_fetch_assoc($result)) {
    if ($row['num_assignments'] == 0) {
开发者ID:sharedgeo,项目名称:TicketsCAD-SharedGeo-Dev,代码行数:31,代码来源:statistics.php

示例15: icon_new

function icon_new($orm)
{
    if (datediff($orm->start_date) >= -5) {
        return '<img src="themes/gcdnew/images/new_icon.png" style="float:none; padding:0; border:none;" alt="บทความใหม่" />';
    }
}
开发者ID:unisexx,项目名称:thaigcd2015,代码行数:6,代码来源:MY_html_helper.php


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