Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <?php
- include '../../../../DatabaseController/conn.php';
- $conn = $pdo->open();
- $stmt = $conn->prepare("SELECT * FROM users
- LEFT JOIN user_title ON users.title_id = user_title.title_id
- LEFT JOIN user_dept ON users.department_id = user_dept.department_id
- LEFT JOIN user_position ON users.position_id = user_position.position_id
- WHERE id=:id");
- $stmt->execute(['id'=>$_SESSION['user_id']]);
- $user = $stmt->fetch();
- $pdo->close();
- ?>
- <?php
- if (!isset($_SESSION['accounting']) || $_SESSION["position"] == null){
- unset($_SESSION['position']); //Position ID
- unset($_SESSION['accounting']); //Position
- $_SESSION['unathorized'] = "We Are Watching You, You've Visiting Unathorized Access..";
- header('Location: /OneTrinity/');
- exit();
- }
- ?>
- <html>
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title>Sales Report</title>
- <style type="text/css">
- @font-face {
- font-family: 'Franklin Gothic Book'; /*a name to be used later*/
- src: url('../../../../Fonts/FranklinGothic.ttf'); /*URL to font*/
- }
- body {
- font-family: Franklin Gothic Book;
- }
- form {
- overflow: hidden;
- }
- table, th, td {
- border: 1px solid black;
- }
- table tfoot {
- display: table-row-group;
- }
- .address {
- font-size: 10pt;
- }
- .customer-details{
- background-color: #0094de;
- color: white;
- text-align: center;
- font-size: 9.7pt;
- font-weight: bold;
- }
- .remarks{
- border: 1px solid black;
- background-color: black;
- color: white;
- text-align:center;
- font-size: 9.7pt;
- padding-top: 7px;
- font-weight: bold;
- }
- .queryResult-CSS {
- text-align: center;
- }
- @page {
- size: 14in 8.5in;
- height: 356mm;
- width: 216mm;
- }
- @media print {
- body {
- -webkit-print-color-adjust: exact;
- }
- .customer-details {
- -webkit-print-color-adjust: exact;
- }
- .remarks{
- -webkit-print-color-adjust: exact;
- }
- }
- </style>
- </head>
- <body>
- <div>
- <?php
- $brand_id = $_POST['show_brand'];
- $model_id = $_POST['show_model'];
- $container_id = $_POST['show_container'];
- // for date purposes
- date_default_timezone_set('Asia/Manila');
- $date = date('M d, Y g:i:s A');
- $conn = $pdo->open();
- try {
- $selectModelName = $conn->prepare("SELECT pm.model_name, c.container_number FROM product_model as pm
- LEFT JOIN brand as b ON pm.brand_id = b.brand_id
- LEFT JOIN product as p on pm.model_id = p.model_id
- LEFT JOIN container as c on p.container_id = c.container_id
- WHERE pm.model_id = :model_id AND b.brand_id = :brand_id AND c.container_id = :container_id
- GROUP BY pm.model_id");
- $selectModelName->execute(['model_id'=>$model_id,'brand_id'=>$brand_id, 'container_id'=>$container_id]);
- $displayModelName = $selectModelName->fetchAll();
- foreach ($displayModelName as $data) {
- $model_name = $data['model_name'];
- $container_number = $data['container_number'];
- if ($brand_id == "1") {
- echo "
- <div style='float: left; max-width: 600px;'>
- <img src='../../../../styles/brand-logos/trinx-straight.png' style='margin-left:120px;width:200px; height: 200px;'>
- <span><p style='font-size: 16pt; margin-left: 100px'>".$model_name."</p></span>
- </div>
- <div style='float: right;'>
- <span class='address'><p>ONE TRINITY CORPORATION</p></span>
- <span class='address'><p>HERMOSO COMPOUND DALANDANDAN, VALENZUELA</p></span>
- <span class='address'><p>TEL/FAX: +632 292 7071</p></span>
- <span class='address'><p>URL: www.trinx.com</p></span>
- <span class='address'>
- <p>Email:
- <span style='color:#0094de;'>philippines@trinx.com</span>
- </p>
- </span>
- <span></span><p style='font-size: 16pt;margin-top: 95.3px;'>".$container_number."</p></span>
- <span></span><p style='font-size: 16pt;'>".$date."</p></span>
- </div>
- ";
- } else if ($brand_id == "2") {
- echo "
- <div style='float: left; max-width: 600px;'>
- <img src='../../../../styles/brand-logos/keysto.png' style='margin-left:120px;width:200px; height: 200px;'>
- <span><p style='font-size: 16pt; margin-left: 100px'>".$model_name."</p></span>
- </div>
- <div style='float: right;'>
- <span class='address'><p>ONE TRINITY CORPORATION</p></span>
- <span class='address'><p>HERMOSO COMPOUND DALANDANDAN, VALENZUELA</p></span>
- <span class='address'><p>TEL/FAX: +632 292 7071</p></span>
- <span class='address'><p>URL: www.trinx.com</p></span>
- <span class='address'>
- <p>Email:
- <span style='color:#0094de;'>philippines@trinx.com</span>
- </p>
- </span>
- <span></span><p style='font-size: 16pt;margin-top: 95.3px;'>".$container_number."</p></span>
- <span></span><p style='font-size: 16pt;'>".$date."</p></span>
- </div>
- ";
- } else if ($brand_id == "3") {
- echo "
- <div style='float: left; max-width: 600px;'>
- <img src='../../../../styles/brand-logos/phantom.png' style='margin-left:120px;width:200px; height: 200px;'>
- <span><p style='font-size: 16pt; margin-left: 100px'>".$model_name."</p></span>
- </div>
- <div style='float: right;'>
- <span class='address'><p>ONE TRINITY CORPORATION</p></span>
- <span class='address'><p>HERMOSO COMPOUND DALANDANDAN, VALENZUELA</p></span>
- <span class='address'><p>TEL/FAX: +632 292 7071</p></span>
- <span class='address'><p>URL: www.trinx.com</p></span>
- <span class='address'>
- <p>Email:
- <span style='color:#0094de;'>philippines@trinx.com</span>
- </p>
- </span>
- <span></span><p style='font-size: 16pt;margin-top: 95.3px;'>".$container_number."</p></span>
- <span></span><p style='font-size: 16pt;'>".$date."</p></span>
- </div>
- ";
- } else if ($brand_id == "4") {
- echo "
- <div style='float: left; max-width: 600px;'>
- <img src='../../../../styles/brand-logos/concept.png' style='margin-left:120px;width:200px; height: 200px;'>
- <span><p style='font-size: 16pt; margin-left: 100px'>".$model_name."</p></span>
- </div>
- <div style='float: right;'>
- <span class='address'><p>ONE TRINITY CORPORATION</p></span>
- <span class='address'><p>HERMOSO COMPOUND DALANDANDAN, VALENZUELA</p></span>
- <span class='address'><p>TEL/FAX: +632 292 7071</p></span>
- <span class='address'><p>URL: www.trinx.com</p></span>
- <span class='address'>
- <p>Email:
- <span style='color:#0094de;'>philippines@trinx.com</span>
- </p>
- </span>
- <span></span><p style='font-size: 16pt;margin-top: 95.3px;'>".$container_number."</p></span>
- <span></span><p style='font-size: 16pt;'>".$date."</p></span>
- </div>
- ";
- }
- }
- } catch (PDOEXception $e) {
- echo $e->getMessage();
- }
- $pdo->close();
- ?>
- </div>
- <table style="width:100%" cellspacing="0" cellpadding="0">
- <thead>
- <tr>
- <th class="customer-details" style='text-align:center; vertical-align: top;padding-top: 10px;' rowspan="2">Customer Name</th>
- <th class="customer-details" style='text-align:center; vertical-align: top;padding-top: 10px;' rowspan="2">Sold Quantity</th>
- <th class="customer-details" style='text-align:center; vertical-align: top;padding-top: 10px;' rowspan="2">Stocked Quantity</th>
- <th class="customer-details" style='text-align:center; vertical-align: top;padding-top: 10px;' rowspan="2">Unit Price</th>
- <th class="customer-details" style='text-align:center; vertical-align: top;padding-top: 10px;' rowspan="2">Total Price by Brand</th>
- <th class="customer-details" style='text-align:center; vertical-align: top;padding-top: 10px;' rowspan="2">Date Delivered</th>
- <th class="customer-details" style='text-align:center;vertical-align: top;padding-top: 10px;padding-bottom: 5px;' colspan="5">Remarks</th>
- <tr>
- <th class="remarks">BANK NAME</th>
- <th class="remarks">PAYMENT METHOD</th>
- <th class="remarks">CHEQUE NUMBER</th>
- <th class="remarks">CHEQUE DATE</th>
- <th class="remarks">AMOUNT</th>
- </tr>
- </tr>
- </thead>
- <tbody>
- <?php
- $model_id = $_POST['show_model'];
- $container_id = $_POST['show_container'];
- try {
- $total = array(); //Total QTY
- $totalPrice = array();
- $totalAmount = array();
- $selectDataToShow = $conn->prepare("
- SELECT t.transaction_id,
- IFNULL(pay.trans_count, 0) AS trans_count,
- IFNULL(pays.multi_count, 0) AS multi_count,
- CONCAT(cl.firstName, ' ', cl.lastName) as full, t.transaction_no,
- COUNT(p.model_id) as qty, ps.unitPrice, ps.promoPrice, COUNT(p.qr_code) as stock,
- SUM(ps.unitPrice) as one, SUM(ps.promoPrice) as two, t.transaction_date, t.skip
- FROM transactions as t
- LEFT JOIN product_sales as ps ON t.transaction_no = ps.transaction_no
- LEFT JOIN product as p ON ps.product_id = p.product_id
- LEFT JOIN (
- SELECT
- COUNT(CASE WHEN pay.transaction_id > 0 THEN 1 END) AS trans_count,pay.transaction_id,pay.payment_id
- FROM payments as pay
- GROUP BY pay.transaction_id
- ) pay
- ON pay.transaction_id = t.transaction_id
- LEFT JOIN (
- SELECT
- COUNT(CASE WHEN pays.multi_transaction_id > 0 THEN 1 END) AS multi_count,pays.multi_transaction_id,pays.payment_id
- FROM payments as pays
- GROUP BY pays.multi_transaction_id
- ) pays ON pays.multi_transaction_id = t.multi_transaction_id
- LEFT JOIN client as cl ON t.client_id = cl.client_id
- WHERE p.prod_active = 1 AND p.prod_status = 1 AND p.prod_owned = 1 AND p.tran_status = 1 AND ps.sales_status = 1
- AND p.model_id = :model_id AND p.container_id = :container_id
- GROUP BY t.transaction_id");
- $selectDataToShow->execute(['model_id'=>$model_id, 'container_id'=>$container_id]);
- $passContainerData = $selectDataToShow->fetchAll();
- $remarksShow = $conn->prepare("SELECT
- t.transaction_id,
- payments.payment_id,
- payments.payment_method, payments.bank_name, payments.check_no,payments.check_date,
- payments.payment_amount
- FROM transactions as t
- LEFT JOIN product_sales as ps ON t.transaction_no = ps.transaction_no
- LEFT JOIN product as p ON ps.product_id = p.product_id
- LEFT JOIN (
- SELECT pay.transaction_id,pay.multi_transaction_id,pay.payment_id, pay.payment_method, pay.bank_name, pay.check_no, pay.check_date, pay.payment_amount
- FROM payments as pay
- ) payments ON (CASE payments.transaction_id WHEN 0
- THEN payments.multi_transaction_id = t.multi_transaction_id
- ELSE payments.transaction_id = t.transaction_id
- END)
- LEFT JOIN client as cl ON t.client_id = cl.client_id
- WHERE p.prod_active = 1 AND p.prod_status = 1 AND p.prod_owned = 1 AND p.tran_status = 1 AND ps.sales_status = 1
- AND p.model_id = :model_id AND p.container_id = :container_id
- GROUP by t.transaction_id,payments.payment_id");
- $remarksShow->execute(['model_id'=>$model_id, 'container_id'=>$container_id]);
- $remarks = $remarksShow->fetchAll();
- foreach ($passContainerData as $data){
- $stock = $data['stock'];
- $total[] = $stock;
- }
- // count array to use for looping
- $count_total_elements = count($total);
- //get the sum of the array to use as first array element
- $total_qty = array_sum($total);
- $pass_array_value = array(); //Index Stocked QTY
- $pass_array_value[0]["stocked_qty"] = $total_qty;
- $array_def_qty = array($total_qty);
- // array where new elements will be pass to
- for ($i = 0, $j = 0, $k = 1; $i < $count_total_elements; $i++, $j++, $k++) {
- $new_array_element[$i] = $array_def_qty[$j] - $total[$i];
- array_push($array_def_qty, $new_array_element[$i]);
- $pass_array_value[$k]["stocked_qty"] = $new_array_element[$i];
- }
- //get the last array value
- $last_array_element = array_pop($array_def_qty);
- $resultArrayQTy = array();
- foreach ($passContainerData as $k => $v) {
- $resultArrayQTy[$k] = array_merge($passContainerData[$k], $pass_array_value[$k]);
- }
- $j = 0; // Iniatiate Iteration
- // echo '<pre>';
- // print_r($remarks);
- // echo '</pre>';
- foreach ($resultArrayQTy as $data)
- {
- $count = $data["trans_count"];
- $multi_trans_count = $data["multi_count"];
- if ($count >= 1 && $multi_trans_count == 0)
- {
- for($i = 1; $i <= $count; $i++, $j++)
- {
- if ($i == 1)
- {
- echo '<tr>';
- echo '<td class="queryResult-CSS">'.$data["full"].'</td>';
- echo '<td class="queryResult-CSS">'.$data["qty"].' PC/s</td>';
- echo '<td class="queryResult-CSS">'.$data["stocked_qty"].' PC/s</td>';
- if($data['two'] > "0.00"){
- $totalPrice[] = $data['two'];
- echo '<td class="queryResult-CSS">₱'.number_format($data["promoPrice"], 2).'</td>';
- echo '<td class="queryResult-CSS">₱'.number_format($data["two"], 2).'</td>';
- }
- else
- {
- $totalPrice[] = $data['one'];
- echo '<td class="queryResult-CSS">₱'.number_format($data["unitPrice"], 2).'</td>';
- echo '<td class="queryResult-CSS">₱'.number_format($data["one"], 2).'</td>';
- }
- echo '<td class="queryResult-CSS">'.$data["transaction_date"].'</td>';
- if($data["transaction_id"] == $remarks[$j]["transaction_id"]){
- if($remarks[$j]["bank_name"] = " "){
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else{
- echo '<td class="queryResult-CSS">'.$remarks[$j]["bank_name"].'</td>';
- }
- if($remarks[$j]["payment_method"] == '1')
- {
- echo '<td class="queryResult-CSS">'."CASH".'</td>';
- }
- elseif ($remarks[$j]["payment_method"] == '2'){
- echo '<td class="queryResult-CSS">'."ONLINE CASH".'</td>';
- }
- elseif ($remarks[$j]["payment_method"] == '3'){
- echo '<td class="queryResult-CSS">'."CHEQUE".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- if ($remarks[$j]["check_no"] == "")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'.$remarks[$j]["check_no"].'</td>';
- }
- if ($remarks[$j]["check_date"] == "0000-00-00")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'.$remarks[$j]["check_date"].'</td>';
- }
- if ($remarks[$j]["payment_amount"] == "")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else{
- echo '<td class="queryResult-CSS">₱'.number_format($remarks[$j]["payment_amount"], 2).'</td>';
- }
- }
- }
- else
- {
- echo '<tr>';
- echo '<td class="queryResult-CSS">'."- - - - - - - - -".'</td>';
- echo '<td class="queryResult-CSS">'."- - - - - - - - -".'</td>';
- echo '<td class="queryResult-CSS">'."- - - - - - - - -".'</td>';
- echo '<td class="queryResult-CSS">'."- - - - - - - - -".'</td>';
- echo '<td class="queryResult-CSS">'."- - - - - - - - -".'</td>';
- echo '<td class="queryResult-CSS">'."- - - - - - - - -".'</td>';
- if($data["transaction_id"] == $remarks[$j]["transaction_id"]){
- if($remarks[$i]["bank_name"] = " "){
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else{
- echo '<td class="queryResult-CSS">'.$remarks[$j]["bank_name"].'</td>';
- }
- if($remarks[$j]["payment_method"] == '1')
- {
- echo '<td class="queryResult-CSS">'."CASH".'</td>';
- }
- elseif ($remarks[$j]["payment_method"] == '2'){
- echo '<td class="queryResult-CSS">'."ONLINE CASH".'</td>';
- }
- elseif ($remarks[$j]["payment_method"] == '3'){
- echo '<td class="queryResult-CSS">'."CHEQUE".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- if ($remarks[$j]["check_no"] == "")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'.$remarks[$j]["check_no"].'</td>';
- }
- if ($remarks[$j]["check_date"] == "0000-00-00" || $remarks[$j]["check_date"] == "")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'.$remarks[$j]["check_date"].'</td>';
- }
- if ($remarks[$j]["payment_amount"] == "")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else{
- echo '<td class="queryResult-CSS">₱'.number_format($remarks[$j]["payment_amount"], 2).'</td>';
- }
- }
- }
- }
- }
- elseif ($count == 0 && $multi_trans_count == 0){
- for($i = 0; $i <= 0; $i++, $j++)
- {
- if ($i == 0)
- {
- echo '<tr>';
- echo '<td class="queryResult-CSS">'.$data["full"].'</td>';
- echo '<td class="queryResult-CSS">'.$data["qty"].' PC/s</td>';
- echo '<td class="queryResult-CSS">'.$data["stocked_qty"].' PC/s</td>';
- if($data['two'] > "0.00"){
- $totalPrice[] = $data['two'];
- echo '<td class="queryResult-CSS">₱'.number_format($data["promoPrice"], 2).'</td>';
- echo '<td class="queryResult-CSS">₱'.number_format($data["two"], 2).'</td>';
- }
- else
- {
- $totalPrice[] = $data['one'];
- echo '<td class="queryResult-CSS">₱'.number_format($data["unitPrice"], 2).'</td>';
- echo '<td class="queryResult-CSS">₱'.number_format($data["one"], 2).'</td>';
- }
- echo '<td class="queryResult-CSS">'.$data["transaction_date"].'</td>';
- if($data["transaction_id"] == $remarks[$j]["transaction_id"])
- {
- if($remarks[$j]["bank_name"] = " "){
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else{
- echo '<td class="queryResult-CSS">'.$remarks[$j]["bank_name"].'</td>';
- }
- if($remarks[$j]["payment_method"] == '1')
- {
- echo '<td class="queryResult-CSS">'."CASH".'</td>';
- }
- elseif ($remarks[$j]["payment_method"] == '2'){
- echo '<td class="queryResult-CSS">'."ONLINE CASH".'</td>';
- }
- elseif ($remarks[$j]["payment_method"] == '3'){
- echo '<td class="queryResult-CSS">'."CHEQUE".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- if ($remarks[$j]["check_no"] == "")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'.$remarks[$j]["check_no"].'</td>';
- }
- if ($remarks[$j]["check_date"] == "0000-00-00" || $remarks[$j]["check_date"] == "")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'.$remarks[$j]["check_date"].'</td>';
- }
- if ($remarks[$j]["payment_amount"] == "")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else{
- echo '<td class="queryResult-CSS">₱'.number_format($remarks[$j]["payment_amount"], 2).'</td>';
- }
- }
- }
- }
- }
- elseif ($multi_trans_count > 0)
- {
- for($i = 1; $i <= $multi_trans_count; $i++, $j++)
- {
- if ($i == 1)
- {
- echo '<tr>';
- echo '<td class="queryResult-CSS">'.$data["full"].'</td>';
- echo '<td class="queryResult-CSS">'.$data["qty"].' PC/s</td>';
- echo '<td class="queryResult-CSS">'.$data["stocked_qty"].' PC/s</td>';
- if($data['two'] > "0.00"){
- $totalPrice[] = $data['two'];
- echo '<td class="queryResult-CSS">₱'.number_format($data["promoPrice"], 2).'</td>';
- echo '<td class="queryResult-CSS">₱'.number_format($data["two"], 2).'</td>';
- }
- else
- {
- $totalPrice[] = $data['one'];
- echo '<td class="queryResult-CSS">₱'.number_format($data["unitPrice"], 2).'</td>';
- echo '<td class="queryResult-CSS">₱'.number_format($data["one"], 2).'</td>';
- }
- echo '<td class="queryResult-CSS">'.$data["transaction_date"].'</td>';
- if($data["transaction_id"] == $remarks[$j]["transaction_id"]){
- if($remarks[$j]["bank_name"] = " "){
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else{
- echo '<td class="queryResult-CSS">'.$remarks[$j]["bank_name"].'</td>';
- }
- if($remarks[$j]["payment_method"] == '1')
- {
- echo '<td class="queryResult-CSS">'."CASH".'</td>';
- }
- elseif ($remarks[$j]["payment_method"] == '2'){
- echo '<td class="queryResult-CSS">'."ONLINE CASH".'</td>';
- }
- elseif ($remarks[$j]["payment_method"] == '3'){
- echo '<td class="queryResult-CSS">'."CHEQUE".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- if ($remarks[$j]["check_no"] == "")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'.$remarks[$j]["check_no"].'</td>';
- }
- if ($remarks[$j]["check_date"] == "0000-00-00" || $remarks[$j]["check_date"] == "")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'.$remarks[$j]["check_date"].'</td>';
- }
- if ($remarks[$j]["payment_amount"] == "")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else{
- echo '<td class="queryResult-CSS">₱'.number_format($remarks[$j]["payment_amount"], 2).'</td>';
- }
- }
- }
- else
- {
- echo '<tr>';
- echo '<td class="queryResult-CSS">'."- - - - - - - - -".'</td>';
- echo '<td class="queryResult-CSS">'."- - - - - - - - -".'</td>';
- echo '<td class="queryResult-CSS">'."- - - - - - - - -".'</td>';
- echo '<td class="queryResult-CSS">'."- - - - - - - - -".'</td>';
- echo '<td class="queryResult-CSS">'."- - - - - - - - -".'</td>';
- echo '<td class="queryResult-CSS">'."- - - - - - - - -".'</td>';
- if($data["transaction_id"] == $remarks[$j]["transaction_id"]){
- if($remarks[$i]["bank_name"] = " "){
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else{
- echo '<td class="queryResult-CSS">'.$remarks[$j]["bank_name"].'</td>';
- }
- if($remarks[$j]["payment_method"] == '1')
- {
- echo '<td class="queryResult-CSS">'."CASH".'</td>';
- }
- elseif ($remarks[$j]["payment_method"] == '2'){
- echo '<td class="queryResult-CSS">'."ONLINE CASH".'</td>';
- }
- elseif ($remarks[$j]["payment_method"] == '3'){
- echo '<td class="queryResult-CSS">'."CHEQUE".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- if ($remarks[$j]["check_no"] == "")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'.$remarks[$j]["check_no"].'</td>';
- }
- if ($remarks[$j]["check_date"] == "0000-00-00" || $remarks[$j]["check_date"] == "")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else
- {
- echo '<td class="queryResult-CSS">'.$remarks[$j]["check_date"].'</td>';
- }
- if ($remarks[$j]["payment_amount"] == "")
- {
- echo '<td class="queryResult-CSS">'."N/A".'</td>';
- }
- else{
- echo '<td class="queryResult-CSS">₱'.number_format($remarks[$j]["payment_amount"], 2).'</td>';
- }
- }
- }
- }
- }
- }
- // echo $j;
- //count array to use for looping
- $count_total_elements = count($total);
- //get the sum of the array to use as first array element
- $total_qty = array_sum($total);
- //array where new elements will be pass to
- $pass_array_value = array($total_qty);
- for($i = 0, $j = 0; $i < $count_total_elements; $i++, $j++){
- $new_array_element[$i] = $pass_array_value[$j] - $total[$i];
- array_push($pass_array_value, $new_array_element[$i]);
- }
- // $
- //get the last array value
- $last_array_element = array_pop($pass_array_value);
- //total price per brand
- $totalPriceByBrand = array_sum($totalPrice);
- echo "</tr> </tbody>";
- echo "
- <tfoot style='border:none;'>
- <tr>
- <th colspan='1'>
- <th style='text-align:center;'><h5>Closed:</h5></th>
- <th style='text-align:center;'><h4 class='red'>".$last_array_element." Qty</h4></th>
- <th style='text-align:right;'><h5>Total Price Per Brand:</h5></th>
- <th style='text-align:center;'><h4 class='red'>₱".number_format($totalPriceByBrand, 2)."</h4></th>
- </th>
- </tr>
- </tfoot>
- ";
- }
- catch (PDOException $e) {
- echo $e->getMessage();
- }
- ?>
- <!-- </tbody> -->
- </tbody>
- </body>
- </html>
- <script type="text/javascript">
- window.open();
- setTimeout(function(){
- window.print();
- window.close();
- }, 250);
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement