function generate_bill_data_for_patient_and_date_range($patient_id, $first_date, $second_date, $labsection = 0) { //echo "Lab Section ".$labsection; $saved_db = DbUtil::switchToLabConfig($_SESSION['lab_config_id']); $test_info = get_all_tests_for_patient_and_date_range($patient_id, $first_date, $second_date, $labsection); DbUtil::switchRestore($saved_db); $test_ids = array(); $test_dates = array(); foreach ($test_info as $test) { $test_ids[] = $test['test_id']; $test_dates[] = date("Y-m-d", strtotime($test['ts'])); } $saved_db = DbUtil::switchToLabConfig($_SESSION['lab_config_id']); $names_and_costs = get_test_names_and_costs_from_ids($test_ids); DbUtil::switchRestore($saved_db); $bill_total = array_sum($names_and_costs['costs']); $bill_fields = array(); $bill_fields['total'] = $bill_total; $bill_fields['names'] = $names_and_costs['names']; $bill_fields['costs'] = $names_and_costs['costs']; $bill_fields['dates'] = $test_dates; return $bill_fields; }
window.location = url + "?bill_id=" + data; } }); }); </script> <?php include "../includes/styles.php"; ?> </head> <body> <form name='bill_generator_form' id='bill_generator_form' action='create_new_bill.php'> <input type='hidden' name='patient_id' value='<?php echo $_SESSION['pid']; ?> '><?php $tests = get_all_tests_for_patient_and_date_range($_SESSION['pid'], "January 1, 1969", "today"); if (!empty($tests)) { ?> <table class='tablesorter' id='billing_popup_table' style="border-collapse: separate; width: 700px;"> <thead> <tr valign='top'> <th id='billing_popup_date' style='width: 75px;'>Test Date</th> <th id='billing_popup_name'>Test Name</th> <th id='billing_popup_specimen_type'>Specimen Type</th> <th id='billing_popup_cost'>Test Cost</th> <th id='billing_popup_select' style='width: 110px;'>Select for Billing</th> </tr> </thead><?php foreach ($tests as $test) { $test = Test::getById($test['test_id']); // We only loaded an id and timestamp, and we want more information.
function generate_bill_data_for_patient_and_date_range($patient_id, $first_date, $second_date) { $test_info = get_all_tests_for_patient_and_date_range($patient_id, $first_date, $second_date); $test_ids = array(); $test_dates = array(); foreach ($test_info as $test) { $test_ids[] = $test['test_id']; $test_dates[] = date("Y-m-d", strtotime($test['ts'])); } $names_and_costs = get_test_names_and_costs_from_ids($test_ids); $bill_total = array_sum($names_and_costs['costs']); $bill_fields = array(); $bill_fields['total'] = $bill_total; $bill_fields['names'] = $names_and_costs['names']; $bill_fields['costs'] = $names_and_costs['costs']; $bill_fields['dates'] = $test_dates; return $bill_fields; }