« Back to History
party_master.php
|
20260723_000646.php
Initial Domain Snapshot
Copy Code
<?php require_once __DIR__ . '/modules/auth/page_acl.php'; require_once __DIR__ . '/modules/activity/activity_logger.php'; $ctx = page_require_access('party_master'); $pdo = $ctx['pdo']; $company_id = (int)$ctx['company_id']; $u = $ctx['user']; require_once __DIR__ . '/partials/header.php'; $msg=''; /* ===== SAVE PARTY ===== */ if($_SERVER['REQUEST_METHOD']=='POST'){ $party_name = trim($_POST['party_name']); $mobile = trim($_POST['mobile']); $city = trim($_POST['city']); $gst_no = trim($_POST['gst_no']); if($party_name!=''){ $stm = $pdo->prepare(" INSERT INTO party_master (company_id,party_name,mobile,city,gst_no) VALUES (?,?,?,?,?) "); $stm->execute([ $company_id, $party_name, $mobile, $city, $gst_no ]); activity_log([ 'company_id' => $company_id ?? 0, 'user_id' => $u['id'] ?? ($_SESSION['user_id'] ?? 0), 'module' => 'party', 'action_name' => 'create', 'entity_type' => 'party_master', 'entity_id' => (int)$pdo->lastInsertId(), 'remarks' => 'Party created' ]); $msg="Party added successfully"; } } /* ===== PARTY LIST ===== */ $stm = $pdo->prepare(" SELECT * FROM party_master WHERE company_id=? AND is_active=1 ORDER BY party_name "); $stm->execute([$company_id]); $party_list = $stm->fetchAll(); ?> <div class="container mt-4"> <h4>Party Master</h4> <?php if($msg){ ?> <div class="alert alert-success"><?php echo $msg; ?></div> <?php } ?> <div class="card mb-4"> <div class="card-body"> <form method="post"> <div class="row"> <div class="col-md-4 mb-3"> <label>Party Name</label> <input type="text" name="party_name" class="form-control" required> </div> <div class="col-md-2 mb-3"> <label>Mobile</label> <input type="text" name="mobile" class="form-control"> </div> <div class="col-md-3 mb-3"> <label>City</label> <input type="text" name="city" class="form-control"> </div> <div class="col-md-3 mb-3"> <label>GST No</label> <input type="text" name="gst_no" class="form-control"> </div> </div> <button class="btn btn-primary">Save Party</button> </form> </div> </div> <h5>Party List</h5> <div class="table-responsive"> <table class="table table-bordered table-striped"> <thead> <tr> <th>ID</th> <th>Party Name</th> <th>Mobile</th> <th>City</th> <th>GST</th> </tr> </thead> <tbody> <?php foreach($party_list as $row){ ?> <tr> <td><?php echo $row['party_id']; ?></td> <td><?php echo htmlspecialchars($row['party_name']); ?></td> <td><?php echo htmlspecialchars($row['mobile']); ?></td> <td><?php echo htmlspecialchars($row['city']); ?></td> <td><?php echo htmlspecialchars($row['gst_no']); ?></td> </tr> <?php } ?> </tbody> </table> </div> </div> <?php require_once __DIR__ . '/partials/footer.php'; ?>