How do I get create a custom table showing the hours remaining for all customers in one page from this transactions page?

Question

[insert_php]
global $wpdb;
$current_user = wp_get_current_user();
$emailAddress = $current_user->user_email;
/$emailAddress = “samplethis@youguessedit.com”;/

[YADDA YADDA YADDA CODE]

“;
/* onclick=”filterTable()” */
echo “

“;
echo “

“;$HoursRemaining = 0;
$results = $wpdb->get_results(“SELECT form_value, form_date FROM wp_db7_forms WHERE (form_post_id = ‘13993’ OR form_post_id = ‘13987’ OR form_post_id = ‘13988’ OR form_post_id = ‘13989’ OR form_post_id = ‘13990’ OR form_post_id = ‘13991’ OR form_post_id = ‘13992’ OR form_post_id = ‘13994’) AND (form_date BETWEEN ‘$startDate’ AND ‘$endDate’) ORDER BY form_date ASC”);
if(!empty($results)){
foreach($results as $rows){
$string = $rows->form_value;
$form_date = explode(” “, $rows->form_date);
$array = explode(“””, $string);
$indexName = array_search(“clientName”,$array);
$indexStatus = array_search(“creditStatus”, $array);
$indexAmount = array_search(“creditAmount”, $array);
$indexHour = array_search(“creditHour”, $array);
$indexDescription = array_search(“description”, $array);
/* if Credit paid by customers /
if ($array[$indexName+2] == $emailAddress && $array[$indexStatus+2] == “1”){
if($array[$indexDescription+2] == “CREDIT”){
$priceRate = $array[$indexAmount+2] / $array[$indexHour+2];
}
$HoursRemaining += $array[$indexHour+2];
echo “”;
}
/
if Tasks made */
if ($array[$indexName+2] == $emailAddress && $array[$indexStatus+2] == “2”){
$HoursRemaining -= ($array[$indexHour+2] / 60);
echo “”;
}
}
}
echo “

Date Description Hours Amount Hours Remaining
” . $form_date[0] . ” ” . $array[$indexDescription+2] . ” + ” . number_format(round($array[$indexHour+2], 2), 2) . ” h +$ ” . number_format(round($array[$indexAmount+2], 2), 2) . ” ” . number_format(round($HoursRemaining, 2), 2) . ” h
” . $form_date[0] . ” ” . $array[$indexDescription+2] . ” – ” . number_format(round($array[$indexHour+2] / 60, 2), 2) . ” h -$ ” . number_format(round(($array[$indexHour+2] / 60 * $priceRate), 2), 2) . ” ” . number_format(round($HoursRemaining, 2), 2) . ” h

[/insert_php]

0
, , Flamingo RoRo 2 years 2019-12-02T21:22:55-05:00 0 Answers 70 views 0

Leave an answer

Browse
Browse