<?php
ob_start();
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
require("includes/config.php");
require("includes/function.php");
$formname = 'Pending Purchase (BC Confirmed, Not Purchased)';
$action   = 'pending_purchase_fr.php';
$zdb = $_SESSION["zdbyear_".$dbname];
mysqli_select_db($conn, $zdb);
$supplierList = mysqli_query($conn,"SELECT accode,name FROM accmast WHERE grpcode='009' ORDER BY name");
$customerList = mysqli_query($conn,"SELECT accode,name FROM accmast WHERE grpcode='010' ORDER BY name");
include("includes/linkshead.php");
?>
<style>
body{background:#f0f2f5;padding:10px 14px;}
.sim-card{background:#fff;border-radius:10px;max-width:540px;margin:0 auto;box-shadow:0 1px 3px rgba(0,0,0,.08),0 4px 16px rgba(0,0,0,.06);overflow:hidden;}
.sim-card-header{background:#fff;border-bottom:2px solid #f1f5f9;padding:12px 20px;display:flex;align-items:center;justify-content:space-between;}
.sim-card-header h2{font-size:15px;font-weight:700;color:#1e293b;margin:0;}
.sim-body{padding:20px;}
.fr{display:flex;align-items:center;margin-bottom:11px;}
.fl{display:flex;align-items:center;margin-bottom:11px;}
.lbl{font-size:13px;font-weight:600;color:#374151;white-space:nowrap;text-align:right;padding-right:12px;min-width:130px;flex-shrink:0;}
.finp{flex:1;padding:8px 12px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:6px;font-size:13.5px;color:#1e293b;outline:none;width:100%;box-sizing:border-box;font-family:inherit;}
.finp:focus{background:#fff;border-color:#3b82f6;}
.btn-bar{display:flex;justify-content:center;gap:8px;padding:14px 20px;border-top:1px solid #f1f5f9;background:#fafafa;}
.sbtn{padding:9px 28px;border-radius:8px;border:none;font-size:13px;font-weight:600;cursor:pointer;}
.sbtn-go{background:#16a34a;color:#fff;}.sbtn-reset{background:#f1f5f9;color:#374151;}
</style>
</head><body>
<form action="<?php echo $action; ?>" method="POST" target="rptframe">
<div class="sim-card">
    <div class="sim-card-header"><h2><i class="fa fa-cart-plus" style="color:#3b82f6;margin-right:8px;"></i><?php echo $formname; ?></h2></div>
    <div class="sim-body">
        <div class="fr"><span class="lbl">From Date</span><input type="date" name="frmdate" class="finp" value="<?php echo date('Y-m-01'); ?>"></div>
        <div class="fr"><span class="lbl">To Date</span><input type="date" name="todate" class="finp" value="<?php echo date('Y-m-d'); ?>"></div>
        <div class="fl"><span class="lbl">Supplier</span>
            <select name="supplier" class="finp" style="flex:1;"><option value="0">-- All --</option>
            <?php while($r=mysqli_fetch_assoc($supplierList)): ?><option value="<?php echo $r['accode']; ?>"><?php echo htmlspecialchars($r['name']); ?></option><?php endwhile; ?>
            </select></div>
        <div class="fl"><span class="lbl">Customer</span>
            <select name="customer" class="finp" style="flex:1;"><option value="0">-- All --</option>
            <?php while($r=mysqli_fetch_assoc($customerList)): ?><option value="<?php echo $r['accode']; ?>"><?php echo htmlspecialchars($r['name']); ?></option><?php endwhile; ?>
            </select></div>
    </div>
    <div class="btn-bar">
        <button type="submit" class="sbtn sbtn-go"><i class="fa fa-search"></i> Show Report</button>
        <button type="reset" class="sbtn sbtn-reset">Reset</button>
    </div>
</div>
</form>
<br>
<iframe name="rptframe" style="width:100%;height:75vh;border:none;border-radius:10px;box-shadow:0 1px 3px rgba(0,0,0,.08);"></iframe>
<?php include("includes/linksfoot.php"); ?>
</body></html>
