« Back to History
expense_report_manage_print.php
|
20260721_154032.php
Initial Bulk Import
Copy Code
<?php require_once __DIR__ . '/modules/auth/page_acl.php'; $ctx = page_require_access('expense_report_manage'); $pdo = $ctx['pdo']; $company_id = (int)$ctx['company_id']; function h($s){ return htmlspecialchars((string)$s,ENT_QUOTES,'UTF-8'); } $month = (int)($_GET['month'] ?? date('m')); $year = (int)($_GET['year'] ?? date('Y')); $display_month = date('F Y', mktime(0,0,0,$month,1,$year)); $start = "$year-$month-01"; $end = date("Y-m-t", strtotime($start)); $q = $pdo->prepare(" SELECT transaction_date,transaction_remarks,withdrawal_amt,remark,rapier_share FROM expense_report WHERE company_id=? AND transaction_date BETWEEN ? AND ? ORDER BY transaction_date "); $q->execute([$company_id,$start,$end]); $data = $q->fetchAll(PDO::FETCH_ASSOC); $total=0; $totalRapier=0; foreach($data as $r){ $total+=(float)$r['withdrawal_amt']; $totalRapier+=(float)$r['rapier_share']; } ?> <!DOCTYPE html> <html> <head> <title>Expense Report</title> </head> <body style="font-family:Arial; margin:30px;"> <div style="text-align:center; margin-bottom:25px;"> <h2 style="margin:0;">Expense Report</h2> <div style="font-weight:bold;"><?=h($display_month)?></div> </div> <form method="get" style="margin-bottom:20px;"> Month: <select name="month"> <?php for($m=1;$m<=12;$m++): ?> <option value="<?=$m?>" <?=$m==$month?'selected':''?>> <?=date('F',mktime(0,0,0,$m,1))?> </option> <?php endfor; ?> </select> Year: <select name="year"> <?php for($y=date('Y')-2;$y<=date('Y');$y++): ?> <option value="<?=$y?>" <?=$y==$year?'selected':''?>> <?=$y?> </option> <?php endfor; ?> </select> <button type="submit">Filter</button> <button type="button" onclick="window.print()">Print</button> </form> <table style="width:100%; border-collapse:collapse;"> <tr style="background:#eee;"> <th style="border:1px solid #000;padding:6px;">Date</th> <th style="border:1px solid #000;padding:6px;">Description</th> <th style="border:1px solid #000;padding:6px;text-align:right;">Amount</th> <th style="border:1px solid #000;padding:6px;">Remark</th> <th style="border:1px solid #000;padding:6px;text-align:right;">Rapier Share</th> </tr> <?php foreach($data as $r): ?> <tr> <td style="border:1px solid #000;padding:6px;"> <?=date('d-M-Y',strtotime($r['transaction_date']))?> </td> <td style="border:1px solid #000;padding:6px;"> <?=h($r['transaction_remarks'])?> </td> <td style="border:1px solid #000;padding:6px;text-align:right;"> ₹ <?=number_format((float)$r['withdrawal_amt'],2)?> </td> <td style="border:1px solid #000;padding:6px;"> <?=h($r['remark'])?> </td> <td style="border:1px solid #000;padding:6px;text-align:right;"> ₹ <?=number_format((float)$r['rapier_share'],2)?> </td> </tr> <?php endforeach; ?> <tr style="font-weight:bold;background:#f5f5f5;"> <td colspan="2" style="border:1px solid #000;padding:6px;text-align:right;"> Total </td> <td style="border:1px solid #000;padding:6px;text-align:right;"> ₹ <?=number_format($total,2)?> </td> <td style="border:1px solid #000;padding:6px;text-align:right;"> Rapier Total </td> <td style="border:1px solid #000;padding:6px;text-align:right;"> ₹ <?=number_format($totalRapier,2)?> </td> </tr> </table> </body> </html>