Too few arguments to function m_reservation::getAll() codeigniter

Saya ingin export excel dari CI namun ada error seperti Too few arguments to function M_reservation::getAll()

ini adalah Modelnya

 function getAll($date1, $date2){
           $query =  $this->db->query("SELECT ht_users.display_name, ht_users.user_email,  _order.room_num_search, _order.wc_order_id,  _order.total_order, _order.status, ht_posts.post_title, ht_posts.post_date FROM ht_st_order_item_meta AS _order
            inner join ht_users on _order.user_id = ht_users.ID
            inner join ht_posts on _order.room_id = ht_posts.ID
            WHERE
            (
              (
                  _order.check_in_timestamp <= UNIX_TIMESTAMP('".$date1."')
                  AND _order.check_out_timestamp >= UNIX_TIMESTAMP('".$date1."')
              )
              OR (
                  _order.check_in_timestamp <= UNIX_TIMESTAMP('".$date2."')
                  AND _order.check_out_timestamp >= UNIX_TIMESTAMP('".$date2."')
              )
              OR (
                  _order.check_in_timestamp <= UNIX_TIMESTAMP('".$date1."')
                  AND _order.check_out_timestamp >= UNIX_TIMESTAMP('".$date2."')
              )
              OR (
                  _order.check_in_timestamp >= UNIX_TIMESTAMP('".$date1."')
                  AND _order.check_out_timestamp <= UNIX_TIMESTAMP('".$date2."')
              )
          )");
           return $query->result();
     }

Ini adalah Controller

                $semua = $this->M_reservation->getAll()->result();
		// Create new Spreadsheet object
		$spreadsheet = new Spreadsheet();

		// Set document properties
		$spreadsheet->setActiveSheetIndex(0)
                      ->setCellValue('A1', 'No')
                      ->setCellValue('B1', 'Booking ID')
                      ->setCellValue('C1', 'Order Date')
                      ->setCellValue('D1', 'Client Name')
                      ->setCellValue('E1', 'Client Email')
                      ->setCellValue('F1', 'Phone')
                      ->setCellValue('G1', 'Inclution')
                      ->setCellValue('H1', 'Room name')
                      ->setCellValue('I1', 'Bed Order')
                      ->setCellValue('J1', 'Status')
                      ->setCellValue('K1', 'Total Order');
         $kolom = 2;
         $nomor = 1;
          foreach($semua as $u) {
          	 //$total = $total + $u->total_order;
               $spreadsheet->setActiveSheetIndex(0)
                           ->setCellValue('A' . $kolom, $nomor)
                           ->setCellValue('B' . $kolom, $u->wc_order_id)
                           ->setCellValue('C' . $kolom, $u->post_date)
                           ->setCellValue('D' . $kolom, $u->display_name)
                           ->setCellValue('E' . $kolom, $u->user_email)
                           ->setCellValue('F' . $kolom)
                           ->setCellValue('G' . $kolom)
                           ->setCellValue('H' . $kolom, $u->post_title)
                           ->setCellValue('I' . $kolom, $u->room_num_search)
                           ->setCellValue('J' . $kolom, $u->status)
                           ->setCellValue('K' . $kolom, $u->total);

               $kolom++;
               $nomor++;

           }
        $writer = new Xlsx($spreadsheet);

Ini adalah View

<!DOCTYPE html>
<html>
<head>
     <title>Tutorial Export Dengan Codeigniter</title>
</head>
<body>
     <a href="<?php echo base_url('export'); ?>">Export Data</a>
     <table border="1" cellspacing="0">
          <thead>
               <tr>
                    <th>Booking ID</th>
                    <th>Order Date</th>
                    <th>Client Name</th>
                    <th>Client Email</th>
                    <th>Phone</th>
                    <th>Inclusion</th>
                    <th>Room Name</th>
                    <th>Bed Order</th>
                    <th>Status</th>
                    <th>Total Order</th>
               </tr>
          </thead>
          <tbody>
               <?php $index = 1; ?>
               <?php foreach($semua as $u): ?>

                                    ?>
                                    <tr  class='odd gradeX context'>
                                        <td><?php echo $u->wc_order_id ?></td>
                                        <td><?php echo $u->post_date?></td>
                                        <td><?php echo $u->display_name?></td>
                                        <td><?php echo $u->user_email?></td>
                                        <td></td>
                                        <td></td>
                                        <td><?php echo $u->post_title?></td>
                                        <td><?php echo $u->room_num_search?></td>
                                        <td><?php echo $u->status?></td>


                                    </tr>
                                    <?php $no++; } ?>
                                    <tr style="background-color:#ddd">
                                      <td></td>
                                      <td></td>
                                      <td></td>
                                      <td></td>
                                      <td></td>
                                      <td></td>
                                      <td></td>
                                      <td></td>
                                      <td></td>

                                      <td></td>
                                    </tr>
               <?php endforeach; ?>
          </tbody>
     </table>
</body>
</html>

avatar present
@present

15 Kontribusi 1 Poin

Diperbarui 4 tahun yang lalu

1 Jawaban:

Jawaban Terpilih

Masalahnya ada di model getall() disana kn ada argument date1 dan date2, sedangkan yang dipanggil cuma getall() aja tanpa argument makanya error, jika argument nya tidak wajib diisi maka bisa dibuat dibuat value defaultnya dengan null atau lainnya :

<pre> function getAll($date1 = null, $date2 = null){ ..... } </pre>

avatar Terra
@Terra

81 Kontribusi 39 Poin

Dipost 4 tahun yang lalu

Login untuk ikut Jawaban