Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/272.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php /p>_Php_Codeigniter_Tcpdf - Fatal编程技术网

Php /p>

Php /p>,php,codeigniter,tcpdf,Php,Codeigniter,Tcpdf,当有两个日期时,您能打印($records->result())吗?什么?我不知道在foreach上面的foreach添加print\r($records->result());退出并检查您是否获得两个日期的记录?只有一个日期有效,如果有两个日期,它将不起作用foreach($student\u at->result()作为$sat){print\r($records->result());exit;foreach($records->result()作为$row){是否正确? public f

当有两个日期时,您能
打印($records->result())
吗?什么?我不知道在
foreach
上面的
foreach
添加
print\r($records->result());退出并检查您是否获得两个日期的记录?只有一个日期有效,如果有两个日期,它将不起作用
foreach($student\u at->result()作为$sat){print\r($records->result());exit;foreach($records->result()作为$row){
是否正确?
public function index()
{
    $data["nav"]="4";
    $this->load->model('report_model');

    if ($this->session->userdata('position')=="Professor")
    {
        $data["records"]=$this->db->query("select * from tblclass WHERE CID IN (select CID from tblseatplan) AND AID=". $this->session->userdata('id'));
        $this->load->view('report_view', $data);
    }
    else if($this->session->userdata('position')=="Department Chair")
    {
        $AID=$this->session->userdata('id');
        $account = $this->db->query("select * from tblaccount WHERE AID='$AID'");
        foreach($account->result() as $row){
            $department = $row->Department;
        }

        $data["records"]=$this->db->query("select * from tblclass WHERE CID IN (select CID from tblseatplan) AND Course_Code_Section LIKE '%$department%'");
        $this->load->view('access_department_chair_view', $data);
    }
}

public function attendanceReport()
{
    $this->load->library('Pdf');
    $this->load->library('Pdf');
    $pdf=new Pdf('L', 'mm', 'A4', true, 'UTF-8', false);
    $pdf->SetTitle('Technological Institute of the Philippines');
    $pdf->setPrintHeader(false);
    $pdf->setPrintFooter(false);
    $pdf->SetAutoPageBreak(true, 15);
    $pdf->SetAuthor('Author');
    $pdf->SetDisplayMode('real', 'default');
    $pdf->AddPage("L");

    $CID=$this->input->post("CID");
    $period=$this->input->post("period");

    $dates=$this->db->query("SELECT date_check FROM tblattendance WHERE CID='$CID' AND period='$period'
    GROUP BY date_check ORDER BY date_check ASC");

    $students=$this->db->query("SELECT a.SID, s.Student FROM tblattendance  a
    LEFT JOIN tblstudent s ON a.SID=s.SID
    WHERE a.CID='$CID' AND a.period='$period'
    GROUP BY a.SID ORDER BY a.date_check ASC");

    $class=$this->db->query("SELECT c.*, a.First_Name, a.Last_Name FROM tblclass c 
    LEFT JOIN tblaccount a ON c.AID=a.AID WHERE c.CID='$CID'");

    foreach($students->result() as $s)
    {
        $sSID = $s->SID;
        $student_at = $this->db->query("SELECT status FROM tblattendance 
        WHERE CID='$CID' AND period='$period' AND SID='$sSID'
        ORDER BY date_check ASC");
    }

    foreach ($class->result() as $r)
    {
        $course=$r->Course_Code_Section;
        $schedule=$r->Day_Time;
        $schoolYear=$r->School_Year_Semester;
        $prof_fn=$r->First_Name;
        $prof_ln=$r->Last_Name;
    }

    $records=$this->db->query("SELECT s.Student,
    (SELECT COUNT(*) FROM tblattendance WHERE SID=.s.SID AND CID=s.CID) as meetings,
    (SELECT COUNT(*) FROM tblattendance WHERE SID=.s.SID AND period='$period' AND CID=s.CID AND status='present') as present,
    (SELECT COUNT(*) FROM tblattendance WHERE SID=.s.SID AND period='$period' AND CID=s.CID AND status='absent') as absent,
    (SELECT COUNT(*) FROM tblattendance WHERE SID=.s.SID AND period='$period' AND CID=s.CID AND status='late') as late FROM tblstudent s WHERE s.CID='$CID'");

    $note="";
    $report_header  = '<span class="tcenter">' . strtoupper($note) . '</span><br/><br/>';
    $report_header .= '<table style="width: 100%;border-collapse: collapse;">
                       <tr>
                           <th style="text-align: center;"><b>TECHNOLOGICAL INSTITUTE OF THE PHILIPPINES</b></th>
                       </tr>
                       <tr>
                           <th style="text-align: center;">MANILA</th>
                       </tr>
                       <tr>
                           <th style="text-align: center;"><b>&nbsp;</b></th>
                       </tr>
                       <tr>
                           <th style="text-align: center;"><b>STUDENT ATTENDANCE MONITORING SHEET</b></th>
                       </tr>
                       <tr>
                           <th style="text-align: center;">SCHOOL YEAR-SEMESTER: ' . $schoolYear . '</th>
                       </tr>
                       <tr>
                           <th style="text-align: center;">PERIOD: ' . ucwords($period) . '</th>
                       </tr>
                       <tr>
                           <th style="text-align: center;"><b>&nbsp;</b></th>
                       </tr>
                       <tr>
                           <th style="text-align: left;">COURSE CODE-SECTION: ' . $course . '</th>
                       </tr>
                       <tr>
                           <th style="text-align: left;">SCHEDULE:  ' . $schedule . '</th>
                       </tr>
                       <tr>
                           <th style="text-align: left;">PROFESSOR: ' . $prof_fn . ' ' . $prof_ln . '</th>
                       </tr>
                       <tr>
                           <th style="text-align: center;"><b>&nbsp;</b></th>
                       </tr>
                       <tr>
                           <th style="text-align: center;"><b>&nbsp;</b></th>
                       </tr>
                       </table>';

    $report_header .= '<table style="text-align: center;">
                       <tr style="font-size:8pt;">
                       <td style="border: 0.5px solid #808080;width: 20%; "><strong>NAME</strong>
                       <table>
                      ';

    $report_header .= '</table></td>';

    foreach($dates->result() as $d)
    {
        $report_header .= '<td style="border: 0.5px solid #808080; width: 6%;">' . $d->date_check . '</td>
                       <td style="border: 0.5px solid #808080; width: 6%;"><strong>NO. OF DAYS PRESENT</strong></td>
                       <td style="border: 0.5px solid #808080; width: 6%;"><strong>NO. OF DAYS ABSENT</strong></td>
                       <td style="border: 0.5px solid #808080; width: 6%;"><strong>NO. OF DAYS LATE</strong></td>
                       <td style="border: 0.5px solid #808080; width: 15%;"><strong>REMARKS</strong></td>
                       </tr>
                      ';
    }

    foreach($student_at->result() as $sat)
    {    
    foreach ($records->result() as $row)
    {
        $report_header .= '<tr style="font-size:8pt;">
                           <td style="border: 0.5px solid #808080; width: 20%">' . $row->Student . '</td>
                           <td style="border: 0.5px solid #808080; width: 6%;">' . strtoupper($sat->status[0]).'</td>
                           <td style="border: 0.5px solid #808080; width: 6%;">' . $row->present .'</td>
                           <td style="border: 0.5px solid #808080; width: 6%;">' . $row->absent .'</td>
                           <td style="border: 0.5px solid #808080; width: 6%;">' . $row->late .'</td>
                           <td style="border: 0.5px solid #808080; width: 15%;"></td>
                           </tr>
                          ';
    }
    }
    $report_header .= '<tr>
                       <td style="border: 0.5px solid #808080;">&nbsp;</td>';

    $report_header .= '</tr>';


    $report_footer='</table>
                    <div class="rt2">
                    </div>
                    </body>
                    </html>';
    $report="";
    $pdf->writeHTML($report_header . $report . $report_footer, true, false, true, false, '');
    $pdf->Output('Attendance Report.pdf', 'I');
}