V1rus Private
User / IP
:
216.73.217.108
Host / Server
:
190.92.174.125 / aerosofthealthcare.com
System
:
Linux s3739.bom1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64
Cmd
|
Upload
|
Mass Deface
|
Create
|
Sym
:
/
home
/
aerosoft
/
public_html
/
InventorySystem
/
Viewing: print_daily_transactions.php
<?php $page_title = 'Daily Transactions Print'; require_once('includes/load.php'); page_require_level(3); ?> <?php if(isset($_GET['date'])){ $date = remove_junk($db->escape($_GET['date'])); $transactions = get_daily_transactions($date); $daily_summary_sql = "SELECT COALESCE(SUM(price), 0) as daily_sales, COUNT(*) as transaction_count FROM sales WHERE DATE(date) = '{$date}'"; $daily_summary = find_by_sql($daily_summary_sql); $daily_sales = $daily_summary[0]['daily_sales']; $transaction_count = $daily_summary[0]['transaction_count']; } else { die("Date parameter missing."); } function get_daily_transactions($date) { global $db; $sql = "SELECT s.id, p.name as product_name, s.qty as quantity, s.price as total_amount, p.buy_price as cost_price, (s.price - (p.buy_price * s.qty)) as profit, s.date FROM sales s JOIN products p ON s.product_id = p.id WHERE DATE(s.date) = '{$date}' ORDER BY s.date DESC"; return find_by_sql($sql); } ?> <!doctype html> <html lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Daily Transactions Report</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"/> <style> @import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap'); @media print { html,body{ font-family: "Montserrat", Helvetica, Arial, sans-serif; font-size: 9.5pt; margin: 0; padding: 0; }.page-break { page-break-before:always; width: auto; margin: auto; } } .page-break{ width: 980px; margin: 0 auto; } .report-head{ margin: 40px 0; text-align: center; } .table>thead:first-child>tr:first-child>th{ border-top: 1px solid #000; } table thead tr th { text-align: center; border: 1px solid #ededed; } table tbody tr td{ vertical-align: middle; } .report-head,table.table thead tr th,table tbody tr td,table tfoot tr td{ border: 1px solid #212121; white-space: nowrap; } .report-head h1,table thead tr th,table tfoot tr td{ background-color: #f8f8f8; } tfoot{ color:#000; text-transform: uppercase; font-weight: 500; } </style> </head> <body> <div class="page-break"> <div class="report-head"> <h1>Daily Transactions Report</h1> <strong>Date: <?php echo date('d-m-Y', strtotime($date)); ?></strong><br> <strong>Generated on: <?php echo date('d-m-Y H:i:s'); ?></strong> </div> <table class="table table-border"> <thead> <tr> <th>#</th> <th>Product Name</th> <th>Qty</th> <th>Cost Price</th> <th>Sale Price</th> <th>Total Amount</th> <th>Profit</th> <th>Time</th> </tr> </thead> <tbody> <?php if(!empty($transactions)): ?> <?php $counter = 1; ?> <?php foreach($transactions as $transaction): ?> <tr> <td><?php echo $counter++; ?></td> <td><?php echo remove_junk($transaction['product_name']); ?></td> <td><?php echo (int)$transaction['quantity']; ?></td> <td>₹<?php echo number_format($transaction['cost_price'], 2); ?></td> <td>₹<?php echo number_format($transaction['total_amount'] / $transaction['quantity'], 2); ?></td> <td>₹<?php echo number_format($transaction['total_amount'], 2); ?></td> <td>₹<?php echo number_format($transaction['profit'], 2); ?></td> <td><?php echo date('H:i:s', strtotime($transaction['date'])); ?></td> </tr> <?php endforeach; ?> <tr style="background-color: #f8f9fa; font-weight: bold;"> <td colspan="5" class="text-right">TOTALS:</td> <td>₹<?php echo number_format($daily_sales, 2); ?></td> <td>₹<?php $total_profit = array_sum(array_column($transactions, 'profit')); echo number_format($total_profit, 2); ?></td> <td></td> </tr> <?php else: ?> <tr> <td colspan="8" class="text-center">No transactions found for this date.</td> </tr> <?php endif; ?> </tbody> </table> </div> </body> </html> <?php if(isset($db)) { $db->db_disconnect(); } ?>
Coded With 💗 by
HanzOFC