$name = $_SESSION['name']; $id = $_SESSION['id']; $current_page = $_SERVER["PHP_SELF"] . '?id=' . $idc_id; $query = "SELECT * FROM tbl_idc WHERE id = '{$idc_id}'"; $results = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_assoc($results)) { $contractor = $row['contractor']; $year = $row['year']; $quarter = $row['quarter']; $idc_type = $row['idc_type']; $scope = $row['scope_of_work']; $award = $row['award_amount']; $sum = $row['sum_all_dos']; $contract = $row['contract_balance']; $current = $award - get_do_totals($idc_id); $total_reimbursed = get_do_totals($idc_id) + get_do_reimbursements($idc_id); $commencement = $row['commencement']; $expiration = $row['expiration']; } $title = "Agency Users"; $subtitle = "IDC Reporting"; // Probably will not needed. //$docfunc = "/home/httpd/html/PS/ps-docmanV2-func.php"; //include($docfunc); $header = "/home/httpd/html/PS/ps-header.php"; $footer = "/home/httpd/html/PS/ps-footer.php"; $links = "/home/httpd/html/PS/ps-links.php"; ?> <link rel="stylesheet" type="text/css" media="all" href="js/datechooser/datechooser.css"> <script type="text/javascript" src="js/datechooser/datechooser.js"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<?php echo $msg; ?> <?php while ($row = mysql_fetch_assoc($results)) { $idc_id = $row['id']; $contractor = $row['contractor']; $year = $row['year']; $quarter = $row['quarter']; $idc_type = $row['idc_type']; $scope = $row['scope_of_work']; $award = $row['award_Amount']; $sum = $row['sum_all_dos']; $contract = $row['contract_balance']; $totals = get_do_totals($idc_id); $current = $award - $totals; $total_reimbursed = get_do_reimbursements($idc_id); $commencement = $row['commencement']; $expiration = $row['expiration']; ?> <table id="idc_table"> <tr> <td>Contractor:</td> <td><?php echo $contractor; ?> </td> </tr>
function get_do_totals($idc) { $query2 = "SELECT * FROM tbl_dos WHERE idc_id = '{$idc}'"; $results2 = mysql_query($query2) or die(mysql_error()); #$array = mysql_fetch_array($results2, MYSQL_NUM); $counter = 0; $counter2 = 0; while ($row2 = mysql_fetch_assoc($results2)) { $counter += $row2['basic']; $counter += $row2['additional']; // echo $row2['basic']; //echo $row2['additional']; } return $counter; } function get_do_reimbursements($idc) { $query2 = "SELECT * FROM tbl_dos WHERE idc_id = '{$idc}'"; $results2 = mysql_query($query2) or die(mysql_error()); #$array = mysql_fetch_array($results2, MYSQL_NUM); $counter = 0; $counter2 = 0; while ($row2 = mysql_fetch_assoc($results2)) { $counter += $row2['reimbursed']; // echo $row2['basic']; //echo $row2['additional']; } return $counter; } echo get_do_totals(12); echo get_do_reimbursements(12);