1
[insert_php]
global $wpdb;
$current_user = wp_get_current_user();
$emailAddress = $current_user->user_email;
/*$emailAddress = "[email protected]";*/

[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]
1
  • Can you elaborate on what you are trying to achieve, what you're currently doing and how it is failing?
    – kero
    Dec 10, 2019 at 8:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.