Esempio n. 1
0
require "../settings.php";
require_lib("docman");
# decide what to do
if (isset($_POST["key"])) {
    switch ($_POST["key"]) {
        case "confirm":
            $OUTPUT = con_data($_POST);
            break;
        case "write":
            $OUTPUT = write_data($_POST);
            break;
        default:
            $OUTPUT = view_data($_GET);
    }
} else {
    $OUTPUT = view_data($_GET);
}
# check department-level access
# display output
require "../template.php";
# enter new data
function view_data($_GET)
{
    # Get vars
    global $_FILES, $DOCLIB_DOCTYPES;
    foreach ($_GET as $key => $value) {
        ${$key} = $value;
    }
    # Validate input
    require_lib("validate");
    $v = new validate();
    if ($key != 'from_sample_id' && $key != 'to_sample_id') {
        $other_wheree = $other_wheree . ' ' . $key . ' like \'' . $value . '\' and';
    }
}
$other_where = substr($other_wheree, 0, -3);
if (strlen($sample_id_where) > 0 && strlen($other_where) > 0) {
    $search_str = $search_str . ' where ' . $sample_id_where . ' and ' . $other_where;
} elseif (strlen($sample_id_where) > 0 && strlen($other_where) == 0) {
    $search_str = $search_str . ' where ' . $sample_id_where;
} elseif (strlen($sample_id_where) == 0 && strlen($other_where) > 0) {
    $search_str = $search_str . ' where ' . $other_where;
}
$printed = array();
if (isset($_POST['submit']) && substr($search_str, -7) != 'sample ') {
    $link = start_nchsls();
    if (!($search_result = mysql_query($search_str, $link))) {
        echo mysql_error();
    }
    while ($ar = mysql_fetch_assoc($search_result)) {
        if (get_sample_status($ar['sample_id']) == 'verified') {
            print_sample($ar['sample_id'], 'eReport, not signed', 'eReport, not signed');
            echo '<h2 style="page-break-before: always;"></h2>';
        } else {
            echo '<h2 style="page-break-before: always; color:red; ">Sample ID ' . $ar['sample_id'] . ' is not verified(Call the lab)</h2>';
        }
    }
} else {
    echo '<h1>No coditions are given for selecting records</h1>';
}
view_data(15);
function con_data($_POST)
{
    # get vars
    extract($_POST);
    if (isset($back)) {
        return view_data($_POST);
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($id, "num", 0, 100, "Invalid number.");
    $v->isOk($depamt, "float", 0, 14, "Invalid Depreciation Amount.");
    $v->isOk($depmonths, "num", 0, 3, "Invalid auto depreciation period.");
    $v->isOk("{$depmonths}{$depamt}", "float", 1, 14, "Enter one of Depreciation amount or period.");
    if (!empty($depamt) && $netval < $depamt) {
        $v->isOk("###", "float", 1, 1, "Error : Depreciation amount must not be more than the Net Value.");
    } else {
        if (!empty($depmonths) && $depperc <= 0) {
            $v->addError("###", "Depriaction percentage has to be more than 0 if depreciating by period.");
        }
    }
    $v->isOk($date, "date", 1, 14, "Invalid account open date.");
    # display errors, if any
    if ($v->isError()) {
        $confirmCust = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirmCust .= "<li class=err>" . $e["msg"];
        }
        $confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirmCust;
    }
    db_conn('cubit');
    $user = USER_NAME;
    $Sql = "SELECT * FROM assets WHERE (id='{$id}' AND div = '" . USER_DIV . "')";
    $Rslt = db_exec($Sql) or errDie("Unable to access database.");
    if (pg_numrows($Rslt) < 1) {
        return "Asset not Found";
    }
    $led = pg_fetch_array($Rslt);
    # Get group
    $sql = "SELECT * FROM assetgrp WHERE grpid = '{$led['grpid']}' AND div = '" . USER_DIV . "'";
    $grpRslt = db_exec($sql);
    $grp = pg_fetch_array($grpRslt);
    # get last ref number
    $refnum = getrefnum($date);
    if ($led["dep_acc"]) {
        $dep_acc = $led["dep_acc"];
    } else {
        // Maintain backwards compatibiltiy
        $sql = "\r\n\t\tSELECT accid FROM core.accounts\r\n\t\tWHERE topacc='2200' AND accnum='000'";
        $acc_rslt = db_exec($sql) or errDie("Unable to retrieve account.");
        $dep_acc = pg_fetch_result($acc_rslt, 0);
    }
    if ($led["accdep_acc"]) {
        $accdep_acc = $led["accdep_acc"];
    } else {
        // Maintain backwards compatibiltiy
        $accdep_acc = $grp["accdacc"];
    }
    pglib_transaction("BEGIN");
    # dt(depacc) ct(accdep)
    writetrans($dep_acc, $accdep_acc, $date, $refnum, $depamt, "{$led['des']} Depreciation");
    db_connect();
    $sql = "UPDATE assets SET accdep = (accdep + '{$depamt}') WHERE (id='{$id}' AND div = '" . USER_DIV . "')";
    $up = db_exec($sql) or errdie("Could not update assets table.");
    $snetval = $netval - $depamt;
    $sdate = date("Y-m-d");
    $sql = "INSERT INTO assetledger(assetid, asset, date, depamt, netval, div) \r\n\t\t\tVALUES ('{$id}', '{$led['des']}', '{$date}', '{$depamt}', '{$snetval}', '" . USER_DIV . "')";
    $rec = db_exec($sql) or errdie("Could not write to asset ledger.");
    $cc = "<script> CostCenter('ct', 'Asset Depreciation', '{$date}', '{$led['des']} Depreciation', '{$depamt}', ''); </script>";
    pglib_transaction("COMMIT");
    $write = "\r\n\t\t\t\t{$cc}\r\n\t\t\t\t<table " . TMPL_tblDflts . " width='50%'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>Asset Depreciation</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='datacell'>\r\n\t\t\t\t\t\t<td>Asset Depreciation has been recorded</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\r\n\t\t\t\t<p>\r\n\t\t\t\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>Quick Links</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td><a href='asset-new.php'>New Asset</a></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td><a href='asset-view.php'>View Assets</a></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\r\n\t\t\t\t</table>";
    return $write;
}
Esempio n. 4
0
                }
            }
        }
    }
}
//$sql = "SELECT reagent_name,reagent_status,sum(`pack_size`) FROM `reagent`group by reagent_name,reagent_status LIMIT 0, 30 ";
//SELECT reagent_name,reagent_status,sum(`pack_size`) FROM `reagent`group by reagent_name,reagent_status
main_menu();
save_reagent($_POST);
delete_reagent($_POST);
save_inserted($_POST);
group_save($_POST);
if (isset($_POST['submit'])) {
    if ($_POST['submit'] == 'edit') {
        edit_form($_POST['id']);
    }
}
show_reagent($_POST);
echo '<table><tr><td>';
search_form();
echo '</td><td>';
group_edit();
echo '</td><tr><td colspan=2>';
insert_reagent();
echo '</td></tr>';
view_data(17);
/*
echo '<pre>';
print_r($GLOBALS);
echo '</pre>';
*/
Esempio n. 5
0
			$first_data='no';
		}
		foreach($array as $key=>$value)
		{
			if($key=='id')
			{
				echo '<td><input type=submit name=id value=\''.$value.'\'></td>';
			}
			else
			{
				echo '<td>'.$value.'</td>';
			}
		}
		echo '</tr>';

	}
	echo '</table>';
	echo '</form>';
}




echo '<h2 style="page-break-before: always;"></h2>';	
if(isset($_POST['id']))
{
	view_data($_POST['id']);
}
get_sql();
?>
function con_data($_POST)
{
    # get vars
    extract($_POST);
    if (isset($back)) {
        return view_data($_POST);
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($id, "num", 0, 100, "Invalid number.");
    $v->isOk($depamt, "float", 1, 14, "Invalid Depreciation Amount.");
    if ($netval < $depamt) {
        $v->isOk("###", "float", 1, 1, "Error : Depreciation amount must not be more than the Net Value.");
    }
    $v->isOk($date, "date", 1, 14, "Invalid account open date.");
    # display errors, if any
    if ($v->isError()) {
        $confirmCust = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirmCust .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        $confirmCust .= "<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirmCust;
    }
    db_conn('cubit');
    $user = USER_NAME;
    $Sql = "SELECT * FROM assets WHERE (id='{$id}' AND div = '" . USER_DIV . "')";
    $Rslt = db_exec($Sql) or errDie("Unable to access database.");
    if (pg_numrows($Rslt) < 1) {
        return "Asset not Found";
    }
    $led = pg_fetch_array($Rslt);
    # Get group
    $sql = "SELECT * FROM assetgrp WHERE grpid = '{$led['grpid']}' AND div = '" . USER_DIV . "'";
    $grpRslt = db_exec($sql);
    $grp = pg_fetch_array($grpRslt);
    # get last ref number
    $refnum = getrefnum($date);
    if ($led["dep_acc"]) {
        $dep_acc = $led["dep_acc"];
    } else {
        // Maintain backwards compatibiltiy
        $dep_acc = $grp["depacc"];
    }
    if ($led["accdep_acc"]) {
        $accdep_acc = $led["accdep_acc"];
    } else {
        // Maintain backwards compatibiltiy
        $accdep_acc = $grp["accdacc"];
    }
    # dt(depacc) ct(accdep)
    writetrans($accdep_acc, $dep_acc, $date, $refnum, $depamt, "{$led['des']} Appreciation");
    db_connect();
    $sql = "UPDATE assets SET accdep = (accdep - '{$depamt}') WHERE (id='{$id}' AND div = '" . USER_DIV . "')";
    $up = db_exec($sql) or errdie("Could not update assets table.");
    $snetval = $netval + $depamt;
    $sdate = date("Y-m-d");
    $sql = "INSERT INTO assetledger(assetid, asset, date, depamt, netval, div) VALUES ('{$id}', '{$led['des']}', '{$sdate}', '-{$depamt}', '{$snetval}', '" . USER_DIV . "')";
    $rec = db_exec($sql) or errdie("Could not write to asset ledger.");
    #resort date
    $cdarr = explode("-", $date);
    $cyear = $cdarr[2];
    $cmonth = $cdarr[1];
    $cday = $cdarr[0];
    $cdate = "{$cyear}-{$cmonth}-{$cday}";
    $cc = "<script> CostCenter('dt', 'Asset Appreciation', '{$cdate}', '{$led['des']} Appreciation', '{$depamt}', ''); </script>";
    $write = "\r\n\t\t\t\t{$cc}\r\n\t\t\t\t<table " . TMPL_tblDflts . " width='50%'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>Asset Appreciation</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='datacell'>\r\n\t\t\t\t\t\t<td>Asset Appreciation has been recorded</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\r\n\t\t\t\t<p>\r\n\t\t\t\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>Quick Links</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td><a href='asset-new.php'>New Asset</a></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td><a href='asset-view.php'>View Assets</a></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\r\n\t\t\t\t</table>";
    return $write;
}
Esempio n. 7
0
        echo 'layer=mapnik&amp;marker=' . $lat . '%2C' . $lng . '" style="border: 1px solid black"></iframe>';
        echo '<br/><small><a href="http://www.openstreetmap.org/?mlat=' . $lat . '&amp;mlon=' . $lng . '#map=15/' . $lat . '/' . $lng . '" target="_blank">';
        echo '大きな地図を表示</a></small>';
        echo '</div>';
    }
    echo '<div>' . "\n";
    echo '<h2>ENDPOINT : <a href=' . $url . '>' . $url . '</a></h2>' . "\n";
    echo '<h3>[' . $resource . ']が参照しているリソース一覧</h3>' . "\n";
    $data = $json_refer["results"]["bindings"];
    echo '<div>' . "\n";
    view_data($data, 'p', 'Predicate', 'o', 'Object');
    echo '</div>' . "\n";
    echo '<h3>[' . $resource . ']を参照しているリソース一覧</h3>' . "\n";
    $data = $json_referred["results"]["bindings"];
    echo '<div>' . "\n";
    view_data($data, 's', 'Subject', 'p', 'Predicate');
    echo '</div>' . "\n";
    echo '</div>' . "\n";
}
function view_data($data, $c1, $c1n, $c2, $c2n)
{
    if (count($data) == 0) {
        echo 'なし' . "\n";
        return;
    }
    echo '<table class="table">' . "\n";
    echo '<tr><th>' . $c1n . '</th><th>' . $c2n . '</th></tr>' . "\n";
    for ($i = 0; $i < count($data); $i++) {
        echo '<tr>' . "\n";
        if ($data[$i][$c1] != null) {
            echo '<td>';
Esempio n. 8
0
<?php

if (file_exists("../inc/common.inc")) {
    require_once "../inc/common.inc";
} elseif (file_exists("inc/common.inc")) {
    require_once "inc/common.inc";
} elseif (file_exists("common.inc")) {
    require_once "common.inc";
}
$file = $_REQUEST["dat"];
$fthumb = $_REQUEST["fthumb"];
view_data($file, $fthumb);
function view_data($file, $fthumb = null)
{
    if (!$fthumb) {
        $fthumb = 400;
    }
    // Check if this is a continual or sensor network station
    if (preg_match("/conti/i", "substr({$file},0,4)")) {
        $url = UPLOADPATH . "/trigger/continual/";
    } else {
        $url = UPLOADPATH . "/trigger/";
    }
    // Set file name
    $file_orig = $url . $file;
    //echo $file_orig;
    if (!file_exists($file_orig)) {
        echo "Waveform Not Found. Try again later.";
        return;
    }
    // Set base directory:
Esempio n. 9
0
    echo '<td><input type=text name=code ></td>';
    echo '<td>result</td>';
    echo '<td><input type=text name=result ></td>';
    echo '<td>analysis_time</td>';
    echo '<td><input type=text name=analysis_time value=\'' . strftime('%Y-%m-%d %H:%M:%S') . '\' ></td>';
    echo '</tr>';
    echo '<tr><td align=center><button type=submit name=submit>submit</button></td></tr>';
    echo '</form></table>';
}
function insert_repeat($sample_id, $code, $result, $analysis_time)
{
    $link = start_nchsls();
    $all_data = get_all_data_of_examination($code, $sample_id);
    $sql = 'insert into repeat_examination 
		(sample_id,code,analysis_time,result,previous_result,previous_result_analysis_time)
		values(\'' . $sample_id . '\',\'' . $code . '\',\'' . $analysis_time . '\',\'' . $result . '\',\'' . $all_data['result'] . '\',\'' . $all_data['sample_receipt_time'] . '\')';
    //echo $sql;
    if (!mysql_query($sql, $link)) {
        echo mysql_error();
    }
}
if (!login_varify()) {
    exit;
}
main_menu();
if (isset($_POST['submit'])) {
    insert_repeat($_POST['sample_id'], $_POST['code'], $_POST['result'], $_POST['analysis_time']);
}
read_data();
view_data(16);
Esempio n. 10
0
/**
 * Acts as a default (catch-all) exception handler.
 *
 * @param object $objException A thrown exception
 */
function caffeine_exception($objException)
{
    $strMessage = $objException->getMessage();
    switch ($strMessage) {
        case '404':
            view(get_config('404_view'));
            break;
        default:
            write_log('error', $strMessage);
            view_data('strMessage', $strMessage);
            view(get_config('error_view'));
            break;
    }
}