Exemplo n.º 1
0
function getLessonsByStatUsersDate($idStatus, $idUsers, $dtStart, $dtEnd, $idCountry)
{
    $country = new country();
    $country->open($idCountry);
    $users = "";
    foreach ($idUsers as $u) {
        $users .= $u . ",";
    }
    $users = substr($users, 0, -1);
    $lesson = new lesson();
    $data = array();
    $i = 0;
    $list_lessons = $lesson->getByStatUserDate($idStatus, $users, $dtStart, $dtEnd);
    $html .= '<table id="datatables" class="table table-bordered table-striped responsive">';
    $html .= '   <thead>';
    $html .= '       <tr>';
    $html .= '           <th class="head0">Date</th>';
    $html .= '           <th class="head1">User</th>';
    $html .= '           <th class="head0">Client</th>';
    $html .= '           <th class="head1">Discipline</th>';
    $html .= '           <th class="head0">Hours</th>';
    $html .= '           <th class="head1">P. f/Hr User</th>';
    $html .= '           <th class="head0">P. f/Hr Company</th>';
    $html .= '           <th class="head1">Gross Value</th>';
    $html .= '           <th class="head0">Discount Value</th>';
    $html .= '           <th class="head1">Value to Pay</th>';
    $html .= '           <th class="head0">Total Value</th>';
    $html .= '           <th class="head1">Evaluation</th>';
    $html .= '       </tr>';
    $html .= '   </thead>';
    $html .= '   <tbody>';
    foreach ($list_lessons as $value) {
        $i = $i + 1;
        $html .= '       <tr src="lesson-report">';
        $html .= '           <td>' . $value['date'] . '</td>';
        $html .= '           <td>' . $value['user'] . '</td><input name="hdId" type="hidden" value="' . $value['id'] . '"/><input name="hdIdMob" type="hidden" value="' . $value['fk_mobile'] . '"/><input name="hdIdCli" type="hidden" value="' . $value['fk_client'] . '"/><input name="hdObs" type="hidden" value="' . $value['observations'] . '"/>';
        $html .= '           <td><a href="#myModalClient" role="button" class="btn btn-link" data-toggle="modal" id="aClient">' . $value['client'] . '</a></td>';
        $html .= '           <td>' . $value['discipline'] . '</td>';
        $html .= '           <td><a href="#myModalHours" role="button" class="btn btn-link" data-toggle="modal" id="aHours">' . $value['hours'] . '</a></td>';
        $html .= '           <td>(' . $country->currency . ') ' . $value['price_hour_user'] . '</td>';
        $html .= '           <td>(' . $country->currency . ') ' . $value['price_hour_comp'] . '</td>';
        $html .= '           <td>(' . $country->currency . ') ' . $value['value_wo_discount'] . '</td>';
        $html .= '           <td>(' . $country->currency . ') ' . $value['value_discount'] . '</td>';
        $html .= '           <td>(' . $country->currency . ') ' . $value['value_total_user'] . '</td>';
        $html .= '           <td>(' . $country->currency . ') ' . $value['value_total_comp'] . '</td>';
        if ($value['evaluation'] != '') {
            $html .= '           <td><a href="#myModalEval" role="button" class="btn btn-link" data-toggle="modal" id="aEval">See</a></td>';
        } elseif ($value['observations'] != '') {
            $html .= '           <td><a href="#myModalObs" role="button" class="btn btn-link" data-toggle="modal" id="aObs">See</a></td>';
        } else {
            $html .= '           <td>Not evaluated</td>';
        }
        $html .= '       </tr>';
    }
    $html .= '   </tbody>';
    $html .= '<tfoot>';
    $html .= '<tr>';
    $html .= '<th style="text-align:right" colspan="10">Sum of Total To Pay (' . $country->currency . '):</th>';
    $html .= '<th style="text-align:center" colspan="2"></th>';
    $html .= '</tr>';
    $html .= '<tr>';
    $html .= '<th style="text-align:right" colspan="10">Sum of Total Value (' . $country->currency . '):</th>';
    $html .= '<th style="text-align:center" colspan="2"></th>';
    $html .= '</tr>';
    $html .= '</tfoot>';
    $html .= '</table>';
    $data['html'] = $html;
    $data['count'] = $i;
    echo json_encode($data);
}