Example #1
0
 public function getPayments()
 {
     $first_date = Input::get('first_date');
     $last_date = Input::get('last_date');
     $submit = Input::get('submit');
     $page = Input::get('page');
     if (isset($first_date) && isset($last_date)) {
         $data = Bookings::where('date_booking', '>=', $first_date)->where('date_booking', '<=', $last_date)->paginate(10);
     } else {
         $data = Bookings::orderBy('id', 'desc')->paginate(10);
     }
     if (isset($submit) && $submit == 'print') {
         if (isset($page)) {
             $no = $page * 10 - 9;
         } else {
             $no = 1;
         }
         $pdf = App::make('dompdf');
         $html = '<center><b>Report of Financial</b></center>';
         $html .= '<br><br><br>';
         $html .= '<table border="1" align="center" width="100%" padding="0" cellpadding="5">';
         $html .= '<tr>';
         $html .= '<td>No</td>';
         $html .= '<td>Booking Code</td>';
         $html .= '<td>Date Booking</td>';
         $html .= '<td>Date Expired</td>';
         $html .= '<td>Service & Room Count</td>';
         $html .= '<td>Total</td>';
         $html .= '</tr>';
         foreach ($data as $row) {
             $temp = CountService($row->id) + CountRoom($row->id);
             $html .= '<tr>';
             $html .= '<td>' . $no . '</td>';
             $html .= '<td>' . $row->booking_code . '</td>';
             $html .= '<td>' . $row->date_booking . '</td>';
             $html .= '<td>' . $row->date_booking_to . '</td>';
             $html .= '<td>' . $temp . '</td>';
             $html .= '<td>' . Total($row->id) . '</td>';
             $html .= '</tr>';
             $no++;
         }
         $html .= '</table>';
         $pdf->loadHTML($html)->setPaper('a4')->setOrientation('potrait');
         return $pdf->download('Report Of Financial.pdf');
     } else {
         return View::make('home/dashboard', array())->nest('content', 'payments/report', array('data' => $data));
     }
 }
Example #2
0
    ?>
</td>
								<td><?php 
    echo $row->number_of_days;
    ?>
 Days</td>
								<td><?php 
    echo $row->date_booking_to;
    ?>
</td>
								<td><?php 
    echo CountService($row->id) + CountRoom($row->id);
    ?>
</td>
								<td><?php 
    echo Total($row->id);
    ?>
</td>
							</tr>
							<?php 
    $no++;
}
?>
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<div class="pagination">
			<?php 
if (isset($_GET['search'])) {
Example #3
0
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8"/>
    <title>Exercice fonction</title>
  </head>
  <body>
<?php 
include 'calcul_prix.php';
$commande1 = array('prix_unitaire' => 12, 'quantite' => 5);
$commande2 = array('prix_unitaire' => 10, 'quantite' => 1);
$commande3 = array('prix_unitaire' => 15, 'quantite' => 3);
$commandes = array($commande1, $commande2, $commande3);
$total = Total($commandes);
$i = 0;
foreach ($commandes as $commande) {
    ++$i;
    $prix = Prix($commande['prix_unitaire'], $commande['quantite']);
    echo "<p>La commande " . $i . " contient " . $commande['quantite'] . " unités à " . $commande['prix_unitaire'] . "€ pièce; Soit un sous-total de " . $prix . "€.</p>";
}
echo "<p><strong>Le prix total de ces " . $i . " commandes est " . $total . "€</strong></p>";
?>
  </body>
</html>