Example #1
0
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;
}
Example #2
0
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;
}