function success()
 {
     echo "*ok*";
     function round_up($value, $precision)
     {
         $pow = pow(10, $precision);
         return (ceil($pow * $value) + ceil($pow * $value - ceil($pow * $value))) / $pow;
     }
     $transactionid = $_GET['transaction_hash'];
     $invoiceid = $_GET['invoice'];
     $invoicename = $_GET['invoicename'];
     $usdamount = $_GET['usdamount'];
     $btcamount = $_GET['btcamount'];
     $client = $_GET['client'];
     $amountsentsatoshi = $_GET['value'];
     $amountsent = $amountsentsatoshi / 100000000;
     $client_username = $this->user_profile->get_user_details($client, 'username');
     //get client username
     $client_email = $this->user_profile->get_user_details($client, 'email');
     //get client email
     $ratio = $amountsent / $btcamount;
     $paid = $usdamount * $ratio;
     $paid = round_up($paid, 2);
     $p_info = array('invoice' => $invoiceid, 'paid_by' => $client, 'payment_method' => '1', 'amount' => $paid, 'trans_id' => $transactionid, 'notes' => 'Amount in BTC: ' . $amountsent, 'month_paid' => date('m'), 'year_paid' => date('Y'));
     $this->db->insert('payments', $p_info);
     // insert to payments
     $activity = lang('activity_payment_of') . $this->user_profile->get_invoice_details($invoiceid, 'currency') . ' ' . $paid . lang('activity_payment_recieved_and_applied') . $invoicename;
     if (Applib::calculate('invoice_due', $invoiceid) <= 0.0) {
         Applib::update(Applib::$invoices_table, array('inv_id' => $invoice_id), array('status' => 'Paid'));
     }
     $this->_log_activity($invoiceid, $activity, $icon = 'fa-btc', $client);
     //log activity
     $this->_notifyme($client_email, $client_username, $invoicename);
 }
예제 #2
0
 function dispute_time_left($time, $hrs)
 {
     //echo date('d-m-Y',$time);exit;
     $CI =& get_instance();
     $CI->lang->load('enduser/cancelProject');
     $mod = $CI->load->model('skills_model');
     $today = get_est_time();
     $lastday = $time;
     $difference = $today - $lastday;
     $day = floor($difference / 84600);
     $difference -= 84600 * floor($difference / 84600);
     $hours = floor($difference / 3600);
     $difference -= 3600 * floor($difference / 3600);
     $min = floor($difference / 60);
     $sec = $difference -= 60 * floor($difference / 60);
     //echo $min;
     if ($day == 0 && $hours == 0) {
         $resp_mins = $hrs * 60;
         $rem = $resp_mins - $min + 0.1;
         return "<b>" . round_up($rem / 60, 2) . " " . $CI->lang->line('hours left to respond') . "</b>";
     } elseif ($day == 0 && $hours < $hrs) {
         $rem = $hrs - $hours;
         return "<b>" . round_up($rem, 2) . " " . $CI->lang->line('hours left to respond') . "</b>";
     } else {
         return "<b>" . $CI->lang->line('response time') . ' (' . $hrs . ' hrs) ' . $CI->lang->line('is over') . "</b>";
     }
     //return "$day days $hours hours $min minutes, and $difference seconds ago.";
 }
예제 #3
0
 // Tgl Delivery
 $pdf->Ln($height);
 $pdf->SetFont($font, 'B', $size - 1);
 $pdf->Cell(25, $height, 'PROSES', 1, 0, 'C');
 $pdf->Cell(14, $height, 'Std. Kg.', 1, 0, 'C');
 $pdf->Cell(25, $height, 'No.MESIN', 1, 0, 'C');
 $pdf->Cell(16, $height, 'Tgl. Prod.', 1, 0, 'C');
 $pdf->Cell(16, $height, 'Act. Kg.', 1, 0, 'C');
 $pdf->Cell(16, $height, 'OPR', 1, 0, 'C');
 $pdf->Cell(16, $height, 'PARAF', 1, 0, 'C');
 $pdf->Ln($height);
 foreach ($detail->result() as $proses) {
     $pdf->SetFont($font, '', $size);
     $pdf->Cell(25, $height - 0.5, $proses->m_process_cat_name, 1, 0, 'C');
     // Nama Proses
     $pdf->Cell(14, $height - 0.5, number_format(round_up($proses->m_process_weight * $data->t_prod_qty / 1000, 2), 2, ',', '.'), 1, 0, 'C');
     // Berat Proses
     $pdf->Cell(25, $height - 0.5, '', 1, 0, 'C');
     $pdf->Cell(16, $height - 0.5, '', 1, 0, 'C');
     $pdf->Cell(16, $height - 0.5, '', 1, 0, 'C');
     $pdf->Cell(16, $height - 0.5, '', 1, 0, 'C');
     $pdf->Cell(16, $height - 0.5, '', 1, 0, 'C');
     $pdf->Ln($height - 0.5);
 }
 $pdf->SetY(182);
 $pdf->SetFont($font, 'B', $size);
 $pdf->Cell(32, $height - 2, 'PERHATIAN :', 0, 0, 'L');
 $pdf->Ln($height);
 // $pdf->Image($data->m_marking_path, 13, 181+$height,18,18);
 $pdf->Image($data->m_marking_img, 13, 181 + $height, 18, 18, 'JPEG');
 $pdf->SetXY(42, 182);
                            </td>
                            <td >



                                <b class="offset1">Total Value (UGX):
                                </b> <span style="text-align: right;" class=""> <?php 
echo number_format(array_sum($total_annual_contract_value) - array_sum($total_contract_value));
?>
</span> 
                                <?php 
if (count($total_contract_value)) {
    ?>
                                    <span style="text-align: right;" class="offset1"><b>PERCENTAGE: </b><?php 
    echo 100 - round_up(array_sum($total_contract_value) / array_sum($total_annual_contract_value) * 100);
    ?>
</span>%
                                <?php 
}
?>


                            </td>
                            <?php 
if ($this->session->userdata('isadmin') == 'Y') {
    ?>
                                <td>
                                    <b >PDES:</b> <span class="number"><?php 
    echo count($total_pdes_above_contract_value);
    ?>
    echo count($contracts) . ' <small>Contracts</small>  <b class="offset1">' . count($results) > 0 ? round_up(count($contracts) / count($results) * 100) : '' . '%</b> <span class="offset1">Value: <small>UGX</small> ' . array_sum($cont_value) . '</span> <b style="text-align:right;" class="pull-right" >' . round_up(array_sum($cont_value) / array_sum($total_contract_value) * 100) . '%</b>';
    ?>


                                </td>
                                <td>Average lead time:
                                    <?php 
    $lead_times = array();
    $contracts = array();
    foreach ($results as $row) {
        if ($row['procurement_method'] == $value) {
            $contracts[] = $row['id'];
            $lead_times[] = seconds_to_days(strtotime($row['dateofconfirmationoffunds']) - strtotime($row['contract_award_date']));
        }
    }
    echo '<b class="offset1">' . round_up(array_sum($lead_times) / count($contracts)) . ' </b> Days';
    ?>
                                </td>

                            </tr>
                        <?php 
}
?>




                    </table>

                </div>
                <p>
                            <td >

                                <span class="number"><?php 
echo $total_results;
?>
</span>
                                <?php 
//to prevent division by zero
if (count($all_contracts_in_this_year)) {
    ?>
                                    <span style="margin-left: 20px;" class="pull-right"><b>Total Value (UGX): </b><span style="text-align: right;"><?php 
    echo number_format(array_sum($total_contract_value));
    ?>
</span>  </span>
                                    <span class="pull-right"><span  ><b>PERCENTAGE:</b> <?php 
    echo round_up(count($results) / count($all_contracts_in_this_year) * 100);
    ?>
</span>%</span>
                                <?php 
}
?>

                            </td>
                        </tr>






                        <?php 
예제 #7
0
파일: rep.php 프로젝트: asad345100/mis-pos
function selectAll($sale_code, $start_date, $end_date)
{
    global $thead, $connect, $tableD;
    $selSql1 = "select `reg_date` from toto_pay where `sale_code` = '" . $sale_code . "' and `reg_date` between '" . $start_date . "' and '" . $end_date . "' order by reg_date asc";
    $result = mysql_query($selSql1, $connect);
    $total1 = mysql_num_rows($result);
    // 총 레코드 수
    $num = $total1;
    // 병원이름 출력 2011-03-31
    $docSql = "select * from toto_doctor order by `no` asc";
    $docRes = mysql_query($docSql, $connect);
    $docTot = mysql_num_rows($docRes);
    // 총 레코드 수
    $docNum = $docTot;
    $docRow = mysql_fetch_row($docRes);
    $hosp_name = $docRow[3];
    if ($total1) {
        while ($total1--) {
            $row = mysql_fetch_row($result);
            if ($row[0] == $cur_date) {
            } else {
                $reg_date = substr($row[14], 0, 4);
                $reg_date = $reg_date . "-" . substr($row[14], 4, 2);
                $reg_date = $reg_date . "-" . substr($row[14], 6, 2);
                $reged_date = $reged_date . "|" . $row[0];
                //입력된 reg_date 구하기
            }
            $cur_date = $row[0];
        }
        $reg_arr = explode("|", $reged_date);
        $arr_size = count($reg_arr);
        $num = 0;
        for ($ac = $start_date; $ac <= $end_date; $ac++) {
            //피부과 자료 정리
            $numOfList++;
            $selSql = "select sum(cash_mony+cscd_mony+card_mony+yet__mony), sum(card_mony), sum(cash_mony+cscd_mony) from toto_pay where `sale_code` = '" . $sale_code . "' and rmdy_doct = '" . $docRow[1] . "' and `reg_date` = '" . $ac . "' order by reg_date asc";
            $result = mysql_query($selSql, $connect);
            $total = mysql_num_rows($result);
            // 총 레코드 수
            $num = $total;
            while ($total--) {
                $row = mysql_fetch_row($result);
                $income = $row[0];
                $card_in = $row[1];
                //카드 총합
                $income_sum = $income_sum + $row[0];
                //총합
                $card_income = $card_income + $row[1];
                //카드 총합
                $cash_income = $cash_income + $row[2];
                //현금 총합
            }
            if ($sale_code == 1001) {
                //병원 합계 일 때 만 지출 계산
                $selSql2 = "select `cash_mony` from toto_exp where `exps_code` = '4000' and `reg_date` = '" . $ac . "' order by reg_date asc";
                $result2 = mysql_query($selSql2, $connect);
                $total2 = mysql_num_rows($result2);
                // 총 레코드 수
                $outcome_today = 0;
                while ($total2--) {
                    $row2 = mysql_fetch_row($result2);
                    $outcome_today = $outcome_today + $row2[0];
                    $outcome = $outcome + $row2[0];
                }
            }
        }
        $updated = $updated . '<tr>
				<td class="tdStyle">' . $hosp_name . '</td>';
        $updated = $updated . '<td class="tdStyle">' . comma($income) . '</td>';
        if ($sale_code == 1001) {
            //병원 합계 일 때 만 지출 계산
            $updated = $updated . '<td class="tdStyle">' . comma($outcome_today) . '</td>';
        }
        $updated = $updated . '<td class="tdStyle">' . comma($income_sum) . '</td>';
        if ($sale_code == 1001) {
            //병원 합계 일 때 만 지출 계산
            $updated = $updated . '<td class="tdStyle">' . comma($outcome) . '</td>';
        }
        $updated = $updated . '<td class="tdStyle">' . comma($cash_income) . '</td>';
        if ($income == 0) {
            //당일 매출이 없을 경우 2011-08-30
            $ccrate = "-";
        } else {
            $ccrate = round_up($card_income / $income, 3);
        }
        $updated = $updated . '<td class="tdStyle">' . $ccrate . '</td></tr>';
        $updated = $updated . '<tr>
				<td class="tdStyle">합계</td>';
        $updated = $updated . '<td class="tdStyle">' . comma($income) . '</td>';
        if ($sale_code == 1001) {
            //병원 합계 일 때 만 지출 계산
            $updated = $updated . '<td class="tdStyle">' . comma($outcome_today) . '</td>';
        }
        $updated = $updated . '<td class="tdStyle">' . comma($income_sum) . '</td>';
        if ($sale_code == 1001) {
            //병원 합계 일 때 만 지출 계산
            $updated = $updated . '<td class="tdStyle">' . comma($outcome) . '</td>';
        }
        $updated = $updated . '<td class="tdStyle">' . comma($cash_income) . '</td>';
        $updated = $updated . '<td class="tdStyle">' . $ccrate . '</td></tr>';
        $updated = $updated;
    } else {
        $updated = '자료가 없습니다';
    }
    return $updated;
}
예제 #8
0
	
	// Add extra text if uploading new file
	if ($_GET['id'] == "") 
	{
		print "<p style='padding-bottom:10px;'>{$lang['docs_33']} \"$upload_button_text\" {$lang['docs_34']}</p>";
	}
	// Get data for this existing file
	else
	{
		$sql = "select docs_id, docs_comment, docs_date, docs_name, docs_size, docs_type from redcap_docs where docs_id = " . $_GET['id'];
		$q = db_query($sql);
		foreach (db_fetch_assoc($q) as $field=>$value) {
			if ($field == "docs_date") {
				$value = format_date($value);
			} elseif ($field == "docs_size") {
				$value = round_up($value/1024/1024);
			}
			$element_data[$field] = $value;
		}
	}
	
	print "<div style='padding-left:40px;'>";
	
	//Render form
	form_renderer($elements,$element_data);
	
	print "</div>";
}
	
	
// Show either USER FILES or DATA EXPORT FILES
/**
 * Updates database prices from the supplied file
 * @param $filename string fully qualified filepath and name
 * @param $options  array of options; see declaration for details
 */
function updatePrices($dbc, $filename, array $options = array())
{
    $result = array('updated' => array(), 'failed' => array(), 'not_found' => array(), 'warning' => array(), 'disabled' => array(), 'modified' => array());
    $updated = array();
    // store product_id => array of product codes matched for it
    $stmts = getPreparedStatements($dbc, $options);
    $labels = $options['header_labels'];
    try {
        $importer = new CsvImporter($filename, true, $labels, ",");
        $select_only = $options['dry_run'] || $options['disable_only'];
        while ($data = $importer->get(2000)) {
            foreach ($data as $entry) {
                $manufacturer = trim(empty($entry[$labels['manufacturer']['label']]) ? $options['manufacturer'] : $entry[$labels['manufacturer']['label']]);
                $product_code = trim($entry[$labels['product_code']['label']]);
                $upc = !$options['upc_update'] || empty($entry[$labels['upc']['label']]) ? null : $entry[$labels['upc']['label']];
                $list_price = round_up(getAmount($entry[$labels['list_price']['label']]), 2);
                $cost_price = isset($entry[$labels['cost_price']['label']]) ? round_up(getAmount($entry[$labels['cost_price']['label']]), 2) : null;
                $sale_price = round_up(getAmount($entry[$labels['sale_price']['label']]), 2);
                if ($sale_price >= $list_price) {
                    $list_price = $options['allow_upsell'] ? $sale_price : $list_price;
                    $sale_price = null;
                }
                $changed = false;
                // flag indicating product (or matrix) prices changed
                if (!$stmts['select_product']->bind_param('ss', $product_code, $manufacturer) || !$stmts['select_product']->execute()) {
                    throw new \RuntimeException("Query failed for manufacturer {$manufacturer} and product code {$product_code}: {$stmts['select_product']->errno} - {$stmts['select_product']->error}");
                }
                $main_product_id = fetch_assoc_stmt($stmts['select_product']);
                $product_id = false;
                if ($select_only) {
                    if (is_int($main_product_id)) {
                        $result['updated'][] = "Product prices updated; Manufacturer: {$manufacturer} | Product Code: {$product_code} | List Price: \$" . sprintf('%.2f', $list_price) . " | Cost Price: \$" . sprintf('%.2f', $cost_price) . " | Sale Price: \$" . sprintf('%.2f', $sale_price);
                        $changed = true;
                    } elseif (!$options['ignore_missing']) {
                        $result['not_found'][$product_code] = "Product was either not found or prices did not change; Manufacturer: {$manufacturer} | Product Code: {$product_code}";
                    }
                    if ($options['update_matrix']) {
                        if (!$stmts['select_matrix']->bind_param('ss', $product_code, $manufacturer) || !$stmts['select_matrix']->execute()) {
                            throw new \RuntimeException("Query failed for manufacturer {$manufacturer} and product code {$product_code}: {$stmts['select_matrix']->errno} - {$stmts['select_matrix']->error}");
                        } elseif (!empty($product_id = fetch_assoc_stmt($stmts['select_matrix']))) {
                            $result['updated'][] = "Matrix prices updated; Manufacturer: {$manufacturer} | Product Code: {$product_code} | List Price: \$" . sprintf('%.2f', $list_price) . " | Sale Price: \$" . sprintf('%.2f', $sale_price);
                            $changed = true;
                            $updated[$product_id][] = $product_code;
                            // wasn't found as a product, but found as a matrix entry
                            if (array_key_exists($product_code, $result['not_found'])) {
                                unset($result['not_found'][$product_code]);
                            }
                        } elseif (array_key_exists($product_code, $result['not_found'])) {
                            $result['not_found'][$product_code] = "Neither product nor matrix entry not found; Manufacturer: {$manufacturer} | Product Code: {$product_code}";
                        }
                    }
                } else {
                    if (!$stmts['update_product']->bind_param('dddsi', $list_price, $cost_price, $sale_price, $upc, $main_product_id) || !$stmts['update_product']->execute()) {
                        throw new \RuntimeException("Query failed for manufacturer {$manufacturer} and product code {$product_code}: {$stmts['update_product']->errno} - {$stmts['update_product']->error}");
                    } elseif ($stmts['update_product']->affected_rows > 0) {
                        $result['updated'][] = "Product prices updated; Manufacturer: {$manufacturer} | Product Code: {$product_code} | List Price: \$" . sprintf('%.2f', $list_price) . " | Cost Price: \$" . sprintf('%.2f', $cost_price) . " | Sale Price: \$" . sprintf('%.2f', $sale_price);
                        $changed = true;
                    } elseif (!$options['ignore_missing']) {
                        $result['not_found'][$product_code] = "Product was either not found or prices did not change; Manufacturer: {$manufacturer} | Product Code: {$product_code}";
                    }
                    if ($options['update_matrix']) {
                        if (!$stmts['update_matrix']->bind_param('ddsss', $list_price, $sale_price, $upc, $product_code, $manufacturer) || !$stmts['update_matrix']->execute()) {
                            throw new \RuntimeException("Query failed for manufacturer {$manufacturer} and product code {$product_code}: {$stmts['update_matrix']->errno} - {$stmts['update_matrix']->error}");
                        } elseif ($stmts['update_matrix']->affected_rows > 0) {
                            if (!$stmts['select_matrix']->bind_param('ss', $product_code, $manufacturer) || !$stmts['select_matrix']->execute()) {
                                throw new \RuntimeException("Query to select product id from matrix table failed for manufacturer {$manufacturer} and product code {$product_code}: {$stmts['select_matrix']->errno} - {$stmts['select_matrix']->error}");
                            } elseif (empty($product_id = fetch_assoc_stmt($stmts['select_matrix']))) {
                                $result['failed'][] = "Matrix entry not found after updating! Manufacturer: {$manufacturer} | Product Code: {$product_code}";
                            } else {
                                $result['updated'][] = "Matrix prices updated; Manufacturer: {$manufacturer} | Product Code: {$product_code} | List Price: \$" . sprintf('%.2f', $list_price) . " | Sale Price: \$" . sprintf('%.2f', $sale_price);
                                $changed = true;
                                $updated[$product_id][] = $product_code;
                                // wasn't found as a product, but found as a matrix entry
                                if (array_key_exists($product_code, $result['not_found'])) {
                                    unset($result['not_found'][$product_code]);
                                }
                            }
                        } elseif (array_key_exists($product_code, $result['not_found'])) {
                            $result['not_found'][$product_code] = "Neither product nor matrix entry was found or updated; Manufacturer: {$manufacturer} | Product Code: {$product_code}";
                        }
                    }
                }
                // Product was found and updated - update 'date updated' field
                $id = $main_product_id ? $main_product_id : $product_id;
                if ($id && empty($result['modified'][$id]) && ($options['update_date_all'] || $changed && $options['update_date'])) {
                    if ($select_only) {
                        $result['modified'][$id] = "Date modified updated for product id {$id}: triggered by {$manufacturer} product {$product_code}";
                    } elseif (!$stmts['update_date']->bind_param('i', $id) || !$stmts['update_date']->execute()) {
                        throw new \RuntimeException("Update date query failed for manufacturer {$manufacturer} and product code {$product_code}: {$stmts['update_date']->errno} - {$stmts['update_date']->error}");
                    } else {
                        $result['modified'][$id] = "Date modified updated for product id {$id}: triggered by {$manufacturer} product {$product_code}";
                    }
                }
            }
        }
        // TODO option to disable warnings (including display thereof)
        // Array only contains entries when updating matrix codes, i.e. option_matrix table has been modified accordingly
        foreach ($updated as $product_id => $product_codes) {
            // select all product / matrix codes from database for this product
            if (!$stmts['select_product_codes']->bind_param('ii', $product_id, $product_id) || !$stmts['select_product_codes']->execute()) {
                throw new \RuntimeException("Query to select product codes while checking for warnings failed for product id {$product_id}: {$stmts['select_product_codes']->errno} - {$stmts['select_product_codes']->error}");
            }
            // disable / warn for any that were not found on the price list
            $codes = fetch_assoc_stmt($stmts['select_product_codes']);
            $diff = array_diff(is_array($codes) ? $codes : array($codes), $product_codes);
            if ($options['disable_products']) {
                if ($options['dry_run']) {
                    $result['disabled'][$product_id] = $diff;
                } else {
                    // Disable matrix entries first
                    foreach ($diff as $product_code) {
                        if (!$stmts['disable_matrix']->bind_param('is', $product_id, $product_code) || !$stmts['disable_matrix']->execute()) {
                            throw new \RuntimeException("Failed to disable matrix entry for product {$product_id} - {$product_code}: {$stmts['disable_matrix']->errno} - {$stmts['disable_matrix']->error}");
                        } elseif ($stmts['disable_matrix']->affected_rows > 0) {
                            $result['disabled'][$product_id][] = $product_code;
                        } else {
                            $result['warning'][$product_id][] = "Matrix entry for product {$product_id} - {$product_code} could not be disabled: it may already be disabled, but you should double-check";
                        }
                    }
                    // Then disable products that no longer have any enabled matrix options
                    if (!$stmts['disable_product']->bind_param('iii', $product_id, $product_id, $product_id) || !$stmts['disable_product']->execute()) {
                        throw new \RuntimeException("Failed to disable product id {$product_id}: {$stmts['disable_product']->errno} - {$stmts['disable_product']->error}");
                    } elseif ($stmts['disable_product']->affected_rows > 0) {
                        $result['disabled'][$product_id][] = "Product {$product_id} disabled";
                    } else {
                        $result['warning'][$product_id][] = "Product {$product_id} was not be disabled: it may either not need to be or already is disabled; you should double-check";
                    }
                }
            } elseif (!empty($diff)) {
                $result['warning'][$product_id] = $diff;
            }
            // Update main product price with the lowest (non-zero) of its enabled matrix options
            if ($options['update_main_price']) {
                if (!$stmts['lowest_price']->bind_param('i', $product_id) || !$stmts['lowest_price']->execute()) {
                    throw new \RuntimeException("Failed to fetch lowest matrix price for product {$product_id}: {$stmts['lowest_price']->errno} - {$stmts['lowest_price']->error}");
                }
                $prices = fetch_assoc_stmt($stmts['lowest_price']);
                if (!empty($prices)) {
                    extract($prices);
                    if (!$stmts['update_main_price']->bind_param('ddi', $price, $sale_price, $product_id) || !$stmts['update_main_price']->execute()) {
                        throw new \RuntimeException("Failed to update main prices for product {$product_id}: {$stmts['update_main_price']->errno} - {$stmts['update_main_price']->error}");
                    } elseif ($stmts['update_main_price']->affected_rows > 0) {
                        $result['updated'][] = "Main prices for product id {$product_id} set to lowest found in matrix: List Price=\${$price}, Sale Price=\$" . ($sale_price ? $sale_price : '0.00');
                    } else {
                        $result['warning'][$product_id][] = "Failed to update prices to \${$price} (sale: \$" . ($sale_price ? $sale_price : '0.00') . ") - prices may already be up-to-date";
                    }
                }
            }
        }
    } catch (\Exception $e) {
        $result['error'] = $e->getMessage();
    } finally {
        foreach ($stmts as $stmt) {
            $stmt->close();
        }
    }
    // Sort results by key
    foreach ($result as &$array) {
        ksort($array);
    }
    unset($array);
    // save puppies
    return $result;
}
                        <tr>
                            <td>
                                <?php 
        // Get Student Subject Info ::
        $weask = get_student_subject_info($this, $registration_data['class'], $exm_info, $subject['id'], $mark);
        //  echo $weask;
        ?>
                            </td>
                        </tr>

                        </tr>
                        <tr><td>Average Total </td>
                            <td colspan="4">

                                <?php 
        echo round_up($total_mark, 2);
        ?>
 </td>
                            <td colspan="4"> Class Position :

                                <?php 
        // Class Performace this term
        // Class Performace this term
        $clas_performance = get_all_student_performance_termly($this, $termid);
        //var_dump($arranged);
        $position = position_finder2($total_mark, $exam_counts, $arranged);
        echo $position;
        ?>

                            </td>
                        </tr>
    $lead_days = array();
    foreach ($completed_contracts as $row) {
        if ($row['procurement_method'] == $method) {
            $lead_days[] = seconds_to_days(strtotime($row['date_signed']) - strtotime($row['dateofconfirmationoffunds']));
            //echo seconds_to_days(strtotime($row['dateofconfirmationoffunds']) - strtotime($row['contract_award_date'])).'<br>';
            // print_array($lead_days);
        }
    }
    echo count($lead_days) . '<small> contracts</small>';
    ?>


                                </td>
                                <td>Average lead time:
                                    <?php 
    echo count($lead_days) > 0 ? round_up(array_sum($lead_days) / count($lead_days), 2) . ' <small>days</small>' : '';
    ?>

                                </td>

                            </tr>
                            <?php 
}
?>


                    </table>

                </div>
                <p>
예제 #12
0
</td>
                    <td><?php 
echo count($all_contracts) ? round_up(array_sum($market_prices) / array_sum($all_market_prices) * 100) . '%' : '-';
?>
</td>

                </tr>

                <tr>
                    <th>PDES</th>
                    <td><?php 
echo count($pdes);
?>
</td>
                    <td><?php 
echo count($all_contracts) ? round_up(count($pdes) / count($all_pdes) * 100) . '%' : '-';
?>
</td>
                    <td>-</td>
                    <td>-</td>

                </tr>


            </table>


        </div>


        <p>
예제 #13
0
파일: iterator.php 프로젝트: Vitosh/PHP
        return $this->counter;
    }
    public function next()
    {
        $this->counter++;
    }
    public function rewind()
    {
        $this->counter = 1;
    }
    public function valid()
    {
        return isset($this->game_collection[$this->counter]);
    }
}
$my_games = new TopGames();
$my_games->price = 100;
$my_games->game_collection = array("WC3 TFT", "AOE2", "Collin McRea Rally 2", "Soldier of Fortune", "Fifa 2001", "Zanzarah - the hidden portal Demo");
$my_str = "<table border = 7  >";
$my_str .= "<tr><td>#</td><td>Price</td><td>Name</td></tr>";
foreach ($my_games as $pc_game => $interesting_game) {
    $my_str .= "<tr><td bgcolor = #ABCCAA>{$pc_game} </font></td><td bgcolor = #FAFACC>" . round_up($my_games->price, 3) . " &euro;</td><td bgcolor = #AACACE>{$interesting_game}</td></tr>";
    $my_games->price *= 1.35;
}
function round_up($number, $precision = 2)
{
    $fig = (int) str_pad('1', $precision, '0');
    return ceil($number * $fig) / $fig;
}
$my_str .= "</table>";
echo $my_str;
예제 #14
0
파일: rep2.php 프로젝트: asad345100/mis-pos
function selectAll($sale_code, $start_date, $end_date)
{
    global $thead, $connect, $tableD;
    $selSql = "select `reg_date` from toto_pay where `sale_code` = '" . $sale_code . "' and `reg_date` between '" . $start_date . "' and '" . $end_date . "' order by reg_date asc";
    $result = mysql_query($selSql, $connect);
    $total = mysql_num_rows($result);
    // 총 레코드 수
    $num = $total;
    //코스 메틱 내역이 있는지 확인
    $docSql = "select * from t_doctor order by `no` asc";
    $docRes = mysql_query($docSql, $connect);
    $docTot = mysql_num_rows($docRes);
    // 총 레코드 수
    $docNum = $docTot;
    if ($total) {
        //코스메틱
        if ($sale_code == 1002) {
            $docRow = mysql_fetch_row($docRes);
            $hosp_name = $docRow[3];
            while ($total--) {
                $row = mysql_fetch_row($result);
                if ($row[0] == $cur_date) {
                } else {
                    $reg_date = substr($row[14], 0, 4);
                    $reg_date = $reg_date . "-" . substr($row[14], 4, 2);
                    $reg_date = $reg_date . "-" . substr($row[14], 6, 2);
                    $reged_date = $reged_date . "|" . $row[0];
                    //입력된 reg_date 구하기
                }
                $cur_date = $row[0];
            }
            $reg_arr = explode("|", $reged_date);
            $arr_size = count($reg_arr);
            $num = 0;
            for ($ac = $start_date; $ac <= $end_date; $ac++) {
                //피부과 자료 정리
                $numOfList++;
                $selSql = "select sum(cash_mony+cscd_mony+card_mony+yet__mony) from toto_pay where `sale_code` = '" . $sale_code . "' and `reg_date` = '" . $ac . "' order by reg_date asc";
                $result = mysql_query($selSql, $connect);
                $total = mysql_num_rows($result);
                // 총 레코드 수
                $num = $total;
                while ($total--) {
                    $row = mysql_fetch_row($result);
                    $income = $row[0];
                    $income_sum = $income_sum + $row[0];
                    //총합
                }
            }
            $updated = $updated . '<tr>
					<td class="tdStyle">' . $hosp_name . '</td>';
            $updated = $updated . '<td class="tdStyle">' . comma($income) . '</td>';
            if ($sale_code == 1001) {
                //병원 합계 일 때 만 지출 계산
                $updated = $updated . '<td class="tdStyle">' . comma($outcome) . '</td>';
            }
            $updated = $updated . '<td class="tdStyle">' . comma($income_sum) . '</td>';
            if ($sale_code == 1001) {
                //병원 합계 일 때 만 지출 계산
                $updated = $updated . '<td class="tdStyle">' . comma($outcome) . '</td>';
            }
            $updated = $updated . '<td class="tdStyle">' . comma($cash_income + $cscd_income) . '</td>';
            if ($income == 0) {
                //2012-03-11 income이 0이면 erorr 수정
                $updated = $updated . '<td class="tdStyle">-</td></tr>';
            } else {
                $updated = $updated . '<td class="tdStyle">' . round_up($card_income / $income, 3) . '</td></tr>';
            }
            $updated = $updated . '<tr>
					<td class="tdStyle">합계</td>';
            $updated = $updated . '<td class="tdStyle">' . comma($income) . '</td>';
            if ($sale_code == 1001) {
                //병원 합계 일 때 만 지출 계산
                $updated = $updated . '<td class="tdStyle">' . comma($outcome) . '</td>';
            }
            $updated = $updated . '<td class="tdStyle">' . comma($income_sum) . '</td>';
            if ($sale_code == 1001) {
                //병원 합계 일 때 만 지출 계산
                $updated = $updated . '<td class="tdStyle">' . comma($outcome) . '</td>';
            }
            $updated = $updated . '<td class="tdStyle">' . comma($cash_income + $cscd_income) . '</td>';
            if ($income == 0) {
                //2012-03-11 income이 0이면 erorr 수정
                $updated = $updated . '<td class="tdStyle">-</td></tr>';
            } else {
                $updated = $updated . '<td class="tdStyle">' . round_up($card_income / $income, 3) . '</td></tr>';
            }
            $updated = $updated . '</table>';
        } else {
            //피부과
            while ($docTot--) {
                $docNo++;
                $docRow = mysql_fetch_row($docRes);
                $income_sum = 0;
                $insu_sum = 0;
                $gner_sum = 0;
                $selSql = "select `reg_date` from toto_pay where `sale_code` = '" . $sale_code . "' and `slit_code`='2001' and rmdy_doct = '" . $docRow[1] . "' and `reg_date` between '" . $start_date . "' and '" . $end_date . "' order by reg_date asc";
                $result = mysql_query($selSql, $connect);
                $total = mysql_num_rows($result);
                // 총 레코드 수
                $num = $total;
                while ($total--) {
                    $row = mysql_fetch_row($result);
                    if ($row[0] == $cur_date) {
                    } else {
                        $reg_date = substr($row[14], 0, 4);
                        $reg_date = $reg_date . "-" . substr($row[14], 4, 2);
                        $reg_date = $reg_date . "-" . substr($row[14], 6, 2);
                        $reged_date = $reged_date . "|" . $row[0];
                        //입력된 reg_date 구하기
                    }
                    $cur_date = $row[0];
                }
                $reg_arr = explode("|", $reged_date);
                $arr_size = count($reg_arr);
                $num = 0;
                for ($ac = $start_date; $ac <= $end_date; $ac++) {
                    //피부과 자료 정리
                    $numOfList++;
                    $selSql = "select sum(cash_mony+cscd_mony+card_mony+yet__mony) from toto_pay where `sale_code` = '" . $sale_code . "' and rmdy_doct = '" . $docRow[1] . "' and `reg_date` = '" . $ac . "' order by reg_date asc";
                    $result = mysql_query($selSql, $connect);
                    $total = mysql_num_rows($result);
                    // 총 레코드 수
                    $num = $total;
                    while ($total--) {
                        $row = mysql_fetch_row($result);
                        $income = $row[0];
                        $income_sum = $income_sum + $row[0];
                        //총합
                    }
                    $selSql2 = "select count(*) from toto_pay where `sale_code` = '" . $sale_code . "' and `reg_date` = '" . $ac . "' and rmdy_doct = '" . $docRow[1] . "' and insu_code='0101'";
                    $result2 = mysql_query($selSql2, $connect);
                    $row2 = mysql_fetch_row($result2);
                    $insu_num = $row2[0];
                    // 보험 고객수
                    $insu_sum = $insu_sum + $row2[0];
                    $selSql2 = "select count(*) from toto_pay where `sale_code` = '" . $sale_code . "' and `reg_date` = '" . $ac . "' and rmdy_doct = '" . $docRow[1] . "' and insu_code='0102'";
                    $result2 = mysql_query($selSql2, $connect);
                    $row2 = mysql_fetch_row($result2);
                    $gner_num = $row2[0];
                    // 일반 고객수
                    $gner_sum = $gner_sum + $row2[0];
                    $reg_date = substr($ac, 0, 4);
                    $reg_date = $reg_date . "-" . substr($ac, 4, 2);
                    $reg_date = $reg_date . "-" . substr($ac, 6, 2);
                    $reged_date = $reged_date . "|" . $row[0];
                    //입력된 reg_date 구하기
                    if ($numOfList % 5) {
                        $ts = "tdStyle";
                    } else {
                        $ts = "tdStyle";
                    }
                }
                $updated = $updated . '<tr>
						<td class="' . $ts . '">' . $docRow[2] . '</td>';
                $updated = $updated . '<td class="' . $ts . '">' . comma($income) . '</td>';
                $updated = $updated . '<td class="' . $ts . '">' . comma($income_sum) . '</td>';
                $updated = $updated . '<td class="' . $ts . '">' . comma($gner_num) . '</td>';
                $updated = $updated . '<td class="' . $ts . '">' . comma($gner_sum) . '</td>';
                $updated = $updated . '<td class="' . $ts . '">' . comma($insu_num) . '</td>';
                $updated = $updated . '<td class="' . $ts . '">' . comma($insu_sum) . '</td>';
                $updated = $updated . '</tr>';
                //합계를 위한 계산 2011-04-11
                $t_income = $income + $t_income;
                $t_income_sum = $income_sum + $t_income_sum;
                $t_gner_num = $gner_num + $t_gner_num;
                $t_gner_sum = $gner_sum + $t_gner_sum;
                $t_insu_num = $insu_num + $t_insu_num;
                $t_insu_sum = $insu_sum + $t_insu_sum;
            }
            //진료실 개별 출력 끝
            $summation = $summation . '<tr><td class="summ">합계</td>';
            $summation = $summation . '<td class="summ">' . comma($t_income) . '</td>';
            $summation = $summation . '<td class="summ">' . comma($t_income_sum) . '</td>';
            $summation = $summation . '<td class="summ">' . comma($t_gner_num) . '</td>';
            $summation = $summation . '<td class="summ">' . comma($t_gner_sum) . '</td>';
            $summation = $summation . '<td class="summ">' . comma($t_insu_num) . '</td>';
            $summation = $summation . '<td class="summ">' . comma($t_insu_sum) . '</td></tr>';
            $summation = $summation . '<tr><td class="summ">평균</td>';
            $summation = $summation . '<td class="summ">' . comma(ceil($t_income / $docNum)) . '</td>';
            $summation = $summation . '<td class="summ">' . comma(ceil($t_income_sum / $docNum)) . '</td>';
            $summation = $summation . '<td class="summ">' . comma(ceil($t_gner_num / $docNum)) . '</td>';
            $summation = $summation . '<td class="summ">' . comma(ceil($t_gner_sum / $docNum)) . '</td>';
            $summation = $summation . '<td class="summ">' . comma(ceil($t_insu_num / $docNum)) . '</td>';
            $summation = $summation . '<td class="summ">' . comma(ceil($t_insu_sum / $docNum)) . '</td></tr>';
        }
    } else {
        $updated = "자료가 없습니다.";
    }
    return $summation . $updated . $summation;
}
예제 #15
0
 function generateScheduleTable($ud, $ld, $displyall = 0, $disburseRate = 0)
 {
     global $database;
     $path = getEditablePath('loanstatn.php');
     include FULL_PATH . "editables/" . $path;
     $schedule = $database->getSchedulefromDB($ud, $ld);
     $actualSchedule = $database->getRepaySchedulefromDB($ud, $ld);
     $gracePeriod = $database->gerGracePeriod($ld);
     $UserCurrency = $database->getUserCurrency($ud);
     if (!empty($disburseRate)) {
         $CurrencyRate = $disburseRate;
     } else {
         $CurrencyRate = $database->getCurrentRate($ud);
     }
     $rtnArray = array();
     if (empty($schedule)) {
         $rtnArray['schedule'] = '';
         $rtnArray['due'] = 0;
         $rtnArray['amtPaidTillShow'] = 0;
     } else {
         if ($displyall) {
             $tmpcurr = $UserCurrency;
         } else {
             $tmpcurr = 'USD';
         }
         $text = "<table width = 100% class='zebra-striped'>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>" . $lang['loanstatn']['date'] . "</th>\r\n\t\t\t\t<th>" . $lang['loanstatn']['due_amount'] . "</th>\r\n\t\t\t\t<th>" . $lang['loanstatn']['datepaid'] . "</th>\r\n\t\t\t\t<th>" . $lang['loanstatn']['paid_amount'] . " <a style='cursor:pointer' class='tt'><img src='library/tooltips/help.png' style='border-style:none;' /><span class='tooltip'><span class='top'></span><span class='middle'>" . $lang['loanstatn']['paidAmt_tooltip'] . "</span><span class='bottom'></span></span></a></th>\r\n\t\t\t</tr>";
         $printSchedule = array();
         $paidBalance = 0;
         $totalDueAmt = 0;
         $totalDueAmtUsd = 0;
         $totalPaidAmt = 0;
         $totalPaidAmtUsd = 0;
         $amtDueTill = 0;
         $amtPaidTill = 0;
         $amtDueTillUsd = 0;
         for ($i = 0, $j = 0; $i < count($schedule); $i++) {
             $totalDueAmt += $schedule[$i]['amount'];
             $printSchedule[$i]['dueAmt'] = $schedule[$i]['amount'];
             $printSchedule[$i]['dueDate'] = $schedule[$i]['duedate'];
             if ($schedule[$i]['duedate'] < time()) {
                 $amtDueTill += $schedule[$i]['amount'];
             }
             $inst = 0;
             $inst = $schedule[$i]['amount'];
             while ($paidBalance > 0) {
                 if ($inst > 0) {
                     if ($inst <= $paidBalance) {
                         $printSchedule[$i]['sub'][][$actualSchedule[$j - 1]['paiddate']] = $inst;
                         $paidBalance = number_format($paidBalance - $inst, 6, '.', '');
                         $inst = 0;
                         break;
                     } else {
                         $printSchedule[$i]['sub'][][$actualSchedule[$j - 1]['paiddate']] = $paidBalance;
                         $inst = number_format($inst - $paidBalance, 6, '.', '');
                         $paidBalance = 0;
                     }
                 } else {
                     break;
                 }
             }
             if ($paidBalance == 0) {
                 for ($k = 0; $j < count($actualSchedule); $j++) {
                     if ($inst > 0) {
                         if ($inst <= $actualSchedule[$j]['paidamt']) {
                             $printSchedule[$i]['sub'][][$actualSchedule[$j]['paiddate']] = $inst;
                             /*Pranjal Change 26 Jan When there are 2 small payments on the same date the schedule does not show correct data Example loain id 206*/
                             //$printSchedule[$i]['sub'][$actualSchedule[$j]['paiddate']]+=$inst;
                             $paidBalance = number_format($actualSchedule[$j]['paidamt'] - $inst, 6, '.', '');
                             $j++;
                             break;
                         } else {
                             $printSchedule[$i]['sub'][][$actualSchedule[$j]['paiddate']] = $actualSchedule[$j]['paidamt'];
                             $inst = number_format($inst - $actualSchedule[$j]['paidamt'], 6, '.', '');
                         }
                     } else {
                         break;
                     }
                 }
             }
             if ($i == count($schedule) - 1 && $paidBalance > 0) {
                 if (isset($printSchedule[$i]['sub'])) {
                     $pos = count($printSchedule[$i]['sub']) - 1;
                     $printSchedule[$i]['sub'][$pos][$actualSchedule[count($actualSchedule) - 1]['paiddate']] += $paidBalance;
                 } else {
                     $printSchedule[$i]['sub'][0][$actualSchedule[count($actualSchedule) - 1]['paiddate']] = $paidBalance;
                 }
             }
         }
         $totalDueAmtUsd += convertToDollar($totalDueAmt, $CurrencyRate);
         $amtDueTillUsd += convertToDollar($amtDueTill, $CurrencyRate);
         for ($i = 0; $i < count($printSchedule); $i++) {
             if ($i < $gracePeriod) {
                 continue;
             }
             $text = $text . "<tr> ";
             $text = $text . "<td style='text-align:left; width:20%'>" . date('M d, Y', $printSchedule[$i]['dueDate']) . "</td>";
             if ($displyall) {
                 $text = $text . "<td style='text-align:left; width:20%'>" . number_format(round_local($printSchedule[$i]['dueAmt']), 0, '.', ',') . "</td>";
             } else {
                 $text = $text . "<td style='text-align:left; width:20%'>" . number_format(convertToDollar($printSchedule[$i]['dueAmt'], $CurrencyRate), 2, '.', ',') . "</td>";
             }
             if (isset($printSchedule[$i]['sub'])) {
                 $j = 0;
                 foreach ($printSchedule[$i]['sub'] as $sub) {
                     foreach ($sub as $key => $value) {
                         $totalPaidAmt += $value;
                         if ($key < time()) {
                             $amtPaidTill += $value;
                         }
                         if ($j > 0) {
                             $text = $text . "<tr> ";
                             $text = $text . "<td style='text-align:left; width:20%'>&nbsp;</td>";
                             $text = $text . "<td style='text-align:left; width:20%'>&nbsp;</td>";
                         }
                         $text = $text . "<td style='text-align:left; width:20%'>" . date('M d, Y', $key) . "</td>";
                         if ($displyall) {
                             $amtPaidShow = number_format(round_local($value), 0, '.', ',');
                             $text = $text . "<td style='text-align:left; width:20%'>" . $amtPaidShow . "</td>";
                         } else {
                             $amtPaidShow = convertToDollar($value, $CurrencyRate);
                         }
                         if (count($printSchedule[$i]['sub']) > 1) {
                             if ($j % 2 == 0) {
                                 $amtPaidShow = round_up($amtPaidShow, 2);
                             } else {
                                 $amtPaidShow = round_down($amtPaidShow, 2);
                             }
                         }
                         if (!$displyall) {
                             $text = $text . "<td style='text-align:left; width:20%'>" . number_format($amtPaidShow, 2, '.', ',') . "</td>";
                         }
                         $text = $text . " </tr>";
                         if ($j > 0) {
                             $text = $text . "</tr> ";
                         }
                         $j++;
                     }
                 }
             } else {
                 $text = $text . "<td style='text-align:left; width:20%'>&nbsp;</td>";
                 $text = $text . "<td style='text-align:left; width:20%'>&nbsp;</td>";
                 $text = $text . " </tr>";
             }
         }
         $totalPaidAmtUsd = convertToDollar($totalPaidAmt, $CurrencyRate);
         $amtPaidTillUsd = convertToDollar($amtPaidTill, $CurrencyRate);
         $text = $text . "<tfoot>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t<th>" . $lang['loanstatn']['tot_amount'] . "</th>";
         if ($displyall) {
             $text = $text . "<th>" . number_format(round_local($totalDueAmt), 0, '.', ',') . "</th>";
         } else {
             $text = $text . "<th>" . number_format($totalDueAmtUsd, 2, '.', ',') . "</th>";
         }
         $text = $text . "<th>" . $lang['loanstatn']['tot_paid_amount'] . "</th>";
         if ($displyall) {
             $text = $text . "<th>" . number_format($totalPaidAmt, 0, '.', ',') . "</th>";
             // round_local($totalPaidAmt)
         } else {
             $text = $text . "<th>" . number_format($totalPaidAmtUsd, 2, '.', ',') . "</th>";
         }
         $text = $text . "</tr></tfoot>";
         $text = $text . "</table>";
         $rtnArray['schedule'] = $text;
         if ($displyall) {
             $due = $amtDueTill - $amtPaidTill;
             $amtPaidTillShow = $amtPaidTill;
             $amtRemaining = $totalDueAmt - $totalPaidAmt;
         } else {
             $due = $amtDueTillUsd - $amtPaidTillUsd;
             $amtPaidTillShow = $amtPaidTillUsd;
             $amtRemaining = $totalDueAmtUsd - $totalPaidAmtUsd;
         }
         if ($due < 0) {
             $due = 0;
         }
         if ($amtRemaining < 0) {
             $amtRemaining = 0;
         }
         $rtnArray['amtPaidTillShow'] = $amtPaidTillShow;
         $rtnArray['amtRemaining'] = $amtRemaining;
         $rtnArray['due'] = $due;
     }
     return $rtnArray;
 }
예제 #16
0
파일: get_results.php 프로젝트: rwishva/SLS
     echo "<a class='keywords' style='color: #545454'>Tags :<span class='label label-info'>" . strtolower(implode('</span> <span class="label label-info">', $r['_source']['keywords'])) . "</span></a>";
     if (isset($r['_source']['typeoflink'])) {
         if ($r['_source']['typeoflink'] == 'video') {
             echo "<a class='keywords' href='video.php?video=" . $youtubelink[1] . "'' style='color: #545454'> <span class='label label-danger'>video</span></a>";
         }
     }
     if (isset($r['_source']['views'])) {
         echo "<a class='keywords' style='color: #545454'> <span class='label heat'>views : " . $r['_source']['views'] . "</span></a>";
     }
     // echo "<a class='keywords' style='color: #545454'> <span class='label label-success'>".$r['_id']."</span></a>";
     echo "<br>";
     echo "<br>";
 }
 // echo '<pre>', print_r($response), '</pre>';
 $paginationcount = $response['hits']['total'] / 10;
 $roundedup = round_up($paginationcount, 0);
 // $roundedup = 100;
 echo "<nav>\n                            <ul class='pagination pagination-sm'>\n                              <li>\n                                <a href='#' aria-label='Previous'>\n                                  <span aria-hidden='true'>&laquo;</span>\n                                </a>\n                              </li>";
 for ($i = 0; $i < $roundedup; $i++) {
     if (isset($_GET['q'])) {
         if (isset($_GET['start'])) {
             if ($_GET['start'] == $i * 10) {
                 echo "<li class='active'><a href='/SLS/?q=" . $_GET['q'] . "&start=" . $i * 10 . "'>" . ($i + 1) . "</a></li>";
             } else {
                 echo "<li><a href='/SLS/?q=" . $_GET['q'] . "&start=" . $i * 10 . "'>" . ($i + 1) . "</a></li>";
             }
         } else {
             echo "<li><a href='/SLS/?q=" . $_GET['q'] . "&start=" . $i * 10 . "'>" . ($i + 1) . "</a></li>";
         }
     } else {
         echo "<li><a href='/SLS/?start=" . $i * 10 . "'>" . ($i + 1) . "</a></li>";
예제 #17
0
function get_eu_markup($eu, $summary = 0)
{
    $tbl_struct = array(array("label" => "&nbsp;", "align" => "left", "bold" => 1), array("label" => "Today", "align" => "right"), array("label" => "Yesterday", "align" => "right"), array("label" => "Last week", "align" => "right"));
    global $reportData;
    global $keyMap;
    $data = array();
    $keys = $keyMap[$eu];
    for ($i = 0; $i < sizeof($keys); $i++) {
        $tbl_data[$i] = array();
        $tbl_data[$i][0] = $keys[$i]["label"];
        $key = $keys[$i]["key"];
        $j = 1;
        foreach ($reportData[$eu] as $day => $data) {
            if ($summary == 1) {
                $tbl_data[$i][$j] = round_up($data["avg"][$key]);
            } else {
                $tbl_struct[$j]["minmax"] = 1;
                if ($eu == "web_eu") {
                    $avg = round_up($data["avg"][$key] * 100);
                    $min = round_up($data["min"][$key] * 100);
                    $max = round_up($data["max"][$key] * 100);
                } else {
                    $avg = round_up($data["avg"][$key]);
                    $min = round_up($data["min"][$key]);
                    $max = round_up($data["max"][$key]);
                }
                $tbl_data[$i][$j] = array("avg" => $avg, "min" => $min, "max" => $max);
            }
            $j++;
        }
    }
    return ReportTableMarkup::get_table_markup($tbl_struct, $tbl_data);
}