Courier service Parcel Management System Project Code in PHP and SQLite
This is a Courier service Parcel Management System Project. This is a web-based project and its main purpose is to offer an automated platform for courier services to manage and track parcels information. This project has a simple user interface and user-friendly functionalities of the given project.
This project is developed with following
- HTML
- CSS
- Bootstrap
- JavaScript
- jQuery
- Ajax
- XAMPP v3.3.0
- PHP Language
- SQLite Database
Courier service Parcel Management System Project
This Courier service Parcel Management System Project allows system users to save the list of couriers/parcels and list of the parcels types. The system users are in charge also of Populating the list of parcels. The parcels require some appropriate information such as the tracking code and sender/receiver details. The project traces the updates of each courier parcel.
Functional Requirements of Courier service Parcel Management System Project
- Secure Login/Logout
- Display the summary of the project lists.
- Insert/ delete/ view/ update/ search Parcel Type List
- Insert/ delete/ view/ update/ search Carrier List
- Insert/ delete/ view/ update/ search Parcel List
- Update Parcel Status
- Tracks the Parcel Updates
- Insert/ delete/ view/ update/ search User List
- Update Account Credentials
Admin Login details
Username: admin
Password: admin123
carriers.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
<div class="card"> <div class="card-header d-flex justify-content-between"> <h3 class="card-title">Carrier List</h3> <div class="card-tools align-middle"> <button class="btn btn-dark btn-sm py-1 rounded-0" type="button" id="create_new">Add New</button> </div> </div> <div class="card-body"> <table class="table table-hover table-striped table-bordered"> <colgroup> <col width="5%"> <col width="25%"> <col width="20%"> <col width="25%"> <col width="10%"> <col width="15%"> </colgroup> <thead> <tr> <th class="text-center p-0">#</th> <th class="text-center p-0">Name</th> <th class="text-center p-0">Contact</th> <th class="text-center p-0">Address</th> <th class="text-center p-0">Status</th> <th class="text-center p-0">Action</th> </tr> </thead> <tbody> <?php $sql = "SELECT * FROM `carrier_list` order by `name` asc"; $qry = $conn->query($sql); $i = 1; while($row = $qry->fetchArray()): ?> <tr> <td class="text-center p-1"><?php echo $i++; ?></td> <td class="py-1 px-2"><?php echo $row['name'] ?></td> <td class="py-1 px-2"><?php echo $row['contact'] ?></td> <td class="py-1 px-2 text-truncate" title="<?php echo $row['address'] ?>"><?php echo $row['address'] ?></td> <td class="py-1 px-2 text-center"> <?php if($row['status'] == 1){ echo '<span class="py-1 px-3 badge rounded-pill bg-success"><small>Active</small></span>'; }else{ echo '<span class="py-1 px-3 badge rounded-pill bg-danger"><small>Inactive</small></span>'; } ?> </td> <th class="text-center py-1 px-2"> <div class="btn-group" role="group"> <button id="btnGroupDrop1" type="button" class="btn btn-primary dropdown-toggle btn-sm rounded-0 py-0" data-bs-toggle="dropdown" aria-expanded="false"> Action </button> <ul class="dropdown-menu" aria-labelledby="btnGroupDrop1"> <li><a class="dropdown-item edit_data" data-id = '<?php echo $row['carrier_id'] ?>' href="javascript:void(0)">Edit</a></li> <li><a class="dropdown-item delete_data" data-id = '<?php echo $row['carrier_id'] ?>' data-name = '<?php echo $row['name'] ?>' href="javascript:void(0)">Delete</a></li> </ul> </div> </th> </tr> <?php endwhile; ?> <?php if(!$qry->fetchArray()): ?> <tr> <th class="text-center p-0" colspan="6">No data display.</th> </tr> <?php endif; ?> </tbody> </table> </div> </div> <script> $(function(){ $('#create_new').click(function(){ uni_modal('Add New Carrier/Delivery Rider',"manage_carrier.php") }) $('.edit_data').click(function(){ uni_modal('Edit Carrier/Delivery Rider Details',"manage_carrier.php?id="+$(this).attr('data-id')) }) $('.delete_data').click(function(){ _conf("Are you sure to delete <b>"+$(this).attr('data-name')+"</b> from list?",'delete_data',[$(this).attr('data-id')]) }) }) function delete_data($id){ $('#confirm_modal button').attr('disabled',true) $.ajax({ url:'./Actions.php?a=delete_carrier', method:'POST', data:{id:$id}, dataType:'JSON', error:err=>{ console.log(err) alert("An error occurred.") $('#confirm_modal button').attr('disabled',false) }, success:function(resp){ if(resp.status == 'success'){ location.reload() }else if(resp.status == 'failed' && !!resp.msg){ var el = $('<div>') el.addClass('alert alert-danger pop-msg') el.text(resp.msg) el.hide() $('#confirm_modal .modal-body').prepend(el) el.show('slow') }else{ alert("An error occurred.") } $('#confirm_modal button').attr('disabled',false) } }) } </script> |
manage_account.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
<?php require_once("DBConnection.php"); $qry = $conn->query("SELECT * FROM `user_list` where user_id = '{$_SESSION['user_id']}'"); foreach($qry->fetchArray() as $k => $v){ $$k = $v; } ?> <h3>Manage Account</h3> <hr> <div class="col-md-6"> <form action="" id="user-form"> <input type="hidden" name="id" value="<?php echo isset($user_id) ? $user_id : '' ?>"> <div class="form-group"> <label for="fullname" class="control-label">Full Name</label> <input type="text" name="fullname" id="fullname" required class="form-control form-control-sm rounded-0" value="<?php echo isset($fullname) ? $fullname : '' ?>"> </div> <div class="form-group"> <label for="username" class="control-label">Username</label> <input type="text" name="username" id="username" required class="form-control form-control-sm rounded-0" value="<?php echo isset($username) ? $username : '' ?>"> </div> <div class="form-group"> <label for="password" class="control-label">New Password</label> <input type="password" name="password" id="password" class="form-control form-control-sm rounded-0" value=""> </div> <div class="form-group"> <label for="old_password" class="control-label">Old Password</label> <input type="password" name="old_password" id="old_password" class="form-control form-control-sm rounded-0" value=""> </div> <div class="form-group"> <small>Leave the password field blank if you don't want update your password.</small> </div> <div class="form-group d-flex w-100 justify-content-end"> <button class="btn btn-sm btn-primary rounded-0 my-1">Update</button> </div> </form> </div> <script> $(function(){ $('#user-form').submit(function(e){ e.preventDefault(); $('.pop_msg').remove() var _this = $(this) var _el = $('<div>') _el.addClass('pop_msg') $('#uni_modal button').attr('disabled',true) $('#uni_modal button[type="submit"]').text('submitting form...') $.ajax({ url:'./Actions.php?a=update_credentials', method:'POST', data:$(this).serialize(), dataType:'JSON', error:err=>{ console.log(err) _el.addClass('alert alert-danger') _el.text("An error occurred.") _this.prepend(_el) _el.show('slow') $('#uni_modal button').attr('disabled',false) $('#uni_modal button[type="submit"]').text('Save') }, success:function(resp){ if(resp.status == 'success'){ location.reload() }else{ _el.addClass('alert alert-danger') } _el.text(resp.msg) _el.hide() _this.prepend(_el) _el.show('slow') $('#uni_modal button').attr('disabled',false) $('#uni_modal button[type="submit"]').text('Save') } }) }) }) </script> |
manage_carrier.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
<?php require_once("DBConnection.php"); if(isset($_GET['id'])){ $qry = $conn->query("SELECT * FROM `carrier_list` where carrier_id = '{$_GET['id']}'"); foreach($qry->fetchArray() as $k => $v){ $$k = $v; } } ?> <div class="container-fluid"> <form action="" id="carrier-form"> <input type="hidden" name="id" value="<?php echo isset($carrier_id) ? $carrier_id : '' ?>"> <div class="form-group"> <label for="name" class="control-label">Name</label> <input type="text" name="name" autofocus id="name" required class="form-control form-control-sm rounded-0" value="<?php echo isset($name) ? $name : '' ?>"> </div> <div class="form-group"> <label for="contact" class="control-label">Contact</label> <input type="text" name="contact" autofocus id="contact" required class="form-control form-control-sm rounded-0" value="<?php echo isset($contact) ? $contact : '' ?>"> </div> <div class="form-group"> <label for="address" class="control-label">Address</label> <textarea name="address" id="address" required class="form-control form-control-sm rounded-0" rows="3" style="resize:none"><?php echo isset($address) ? $address : '' ?></textarea> </div> <div class="form-group"> <label for="status" class="control-label">Status</label> <select name="status" id="status" class="form-select form-select-sm rounded-0" required> <option value="1" <?php echo isset($status) && $status == 1 ? 'selected' : '' ?>>Active</option> <option value="0" <?php echo isset($status) && $status == 0 ? 'selected' : '' ?>>Inactive</option> </select> </div> </form> </div> <script> $(function(){ $('#carrier-form').submit(function(e){ e.preventDefault(); $('.pop_msg').remove() var _this = $(this) var _el = $('<div>') _el.addClass('pop_msg') $('#uni_modal button').attr('disabled',true) $('#uni_modal button[type="submit"]').text('submitting form...') $.ajax({ url:'./Actions.php?a=save_carrier', method:'POST', data:$(this).serialize(), dataType:'JSON', error:err=>{ console.log(err) _el.addClass('alert alert-danger') _el.text("An error occurred.") _this.prepend(_el) _el.show('slow') $('#uni_modal button').attr('disabled',false) $('#uni_modal button[type="submit"]').text('Save') }, success:function(resp){ if(resp.status == 'success'){ _el.addClass('alert alert-success') $('#uni_modal').on('hide.bs.modal',function(){ location.reload() }) if("<?php echo isset($carrier_id) ?>" != 1) _this.get(0).reset(); }else{ _el.addClass('alert alert-danger') } _el.text(resp.msg) _el.hide() _this.prepend(_el) _el.show('slow') $('#uni_modal button').attr('disabled',false) $('#uni_modal button[type="submit"]').text('Save') } }) }) }) </script> |
manage_parcel.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
<?php require_once("DBConnection.php"); if(isset($_GET['id'])){ $qry = $conn->query("SELECT * FROM `parcel_list` where parcel_id = '{$_GET['id']}'"); foreach($qry->fetchArray() as $k => $v){ $$k = $v; } } ?> <div class="container-fluid"> <form action="" id="parcel-form"> <input type="hidden" name="id" value="<?php echo isset($parcel_id) ? $parcel_id : '' ?>"> <div class="col-12"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="code" class="control-label">Tracking Code</label> <input type="text" name="code" autofocus id="code" required class="form-control form-control-sm rounded-0" value="<?php echo isset($code) ? $code : '' ?>"> </div> <div class="form-group"> <label for="parcel_type_id" class="control-label">Parcel Type</label> <select name="parcel_type_id" id="parcel_type_id" required class="form-select form-select-sm rounded-0 select2" data-placeholder="Select Parcel Type here"> <option value="" disabled <?php echo !isset($parcel_type_id) ? "selected": '' ?>></option> <?php $parcel_type = $conn->query("SELECT * FROM `parcel_type_list` where status = 1 ".(isset($parcel_type_id) ? " OR parcel_type_id = '{$parcel_type_id}'" : "")." order by name asc "); while($row = $parcel_type->fetchArray()): ?> <option value="<?php echo $row['parcel_type_id'] ?>"<?php echo isset($parcel_type_id) && $parcel_type_id == $row['parcel_type_id'] ? 'selected' : '' ?>><?php echo $row['name'] ?></option> <?php endwhile; ?> </select> </div> <div class="form-group"> <label for="sender_name" class="control-label">Sender Name</label> <input type="text" name="sender_name" id="sender_name" required class="form-control form-control-sm rounded-0" value="<?php echo isset($sender_name) ? $sender_name : '' ?>"> </div> <div class="form-group"> <label for="sender_contact" class="control-label">Sender Contact</label> <input type="text" name="sender_contact" id="sender_contact" required class="form-control form-control-sm rounded-0" value="<?php echo isset($sender_contact) ? $sender_contact : '' ?>"> </div> <div class="form-group"> <label for="sender_address" class="control-label">Sender Address</label> <textarea rows="3" name="sender_address" style="resize:none" id="sender_address" required class="form-control form-control-sm rounded-0"><?php echo isset($sender_address) ? $sender_address : '' ?></textarea> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="receiver_name" class="control-label">Receiver Name</label> <input type="text" name="receiver_name" id="receiver_name" required class="form-control form-control-sm rounded-0" value="<?php echo isset($receiver_name) ? $receiver_name : '' ?>"> </div> <div class="form-group"> <label for="receiver_contact" class="control-label">Receiver Contact</label> <input type="text" name="receiver_contact" id="receiver_contact" required class="form-control form-control-sm rounded-0" value="<?php echo isset($receiver_contact) ? $receiver_contact : '' ?>"> </div> <div class="form-group"> <label for="receiver_address" class="control-label">Receiver Address</label> <textarea rows="3" name="receiver_address" style="resize:none" id="receiver_address" required class="form-control form-control-sm rounded-0"><?php echo isset($receiver_address) ? $receiver_address : '' ?></textarea> </div> <div class="form-group"> <label for="remarks" class="control-label">Remarks</label> <textarea rows="3" name="remarks" style="resize:none" id="remarks" required class="form-control form-control-sm rounded-0"><?php echo isset($remarks) ? $remarks : '' ?></textarea> </div> </div> </div> </div> </form> </div> <script> $(function(){ $('.select2').select2({ width:'100%', dropdownParent: $('#uni_modal') }) $('#parcel-form').submit(function(e){ e.preventDefault(); $('.pop_msg').remove() var _this = $(this) var _el = $('<div>') _el.addClass('pop_msg') $('#uni_modal button').attr('disabled',true) $('#uni_modal button[type="submit"]').text('submitting form...') $.ajax({ url:'./Actions.php?a=save_parcel', method:'POST', data:$(this).serialize(), dataType:'JSON', error:err=>{ console.log(err) _el.addClass('alert alert-danger') _el.text("An error occurred.") _this.prepend(_el) _el.show('slow') $('#uni_modal button').attr('disabled',false) $('#uni_modal button[type="submit"]').text('Save') }, success:function(resp){ if(resp.status == 'success'){ _el.addClass('alert alert-success') $('#uni_modal').on('hide.bs.modal',function(){ location.reload() }) if("<?php echo isset($parcel_id) ?>" != 1) _this.get(0).reset(); }else{ _el.addClass('alert alert-danger') } _el.text(resp.msg) _el.hide() _this.prepend(_el) _el.show('slow') $('#uni_modal button').attr('disabled',false) $('#uni_modal button[type="submit"]').text('Save') } }) }) }) </script> |
manage_parcel_type.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
<?php require_once("DBConnection.php"); if(isset($_GET['id'])){ $qry = $conn->query("SELECT * FROM `parcel_type_list` where parcel_type_id = '{$_GET['id']}'"); foreach($qry->fetchArray() as $k => $v){ $$k = $v; } } ?> <div class="container-fluid"> <form action="" id="parcel_type-form"> <input type="hidden" name="id" value="<?php echo isset($parcel_type_id) ? $parcel_type_id : '' ?>"> <div class="form-group"> <label for="name" class="control-label">Name</label> <input type="text" name="name" autofocus id="name" required class="form-control form-control-sm rounded-0" value="<?php echo isset($name) ? $name : '' ?>"> </div> <div class="form-group"> <label for="description" class="control-label">Description</label> <textarea name="description" id="description" required class="form-control form-control-sm rounded-0" rows="3" style="resize:none"><?php echo isset($description) ? $description : '' ?></textarea> </div> <div class="form-group"> <label for="status" class="control-label">Status</label> <select name="status" id="status" class="form-select form-select-sm rounded-0" required> <option value="1" <?php echo isset($status) && $status == 1 ? 'selected' : '' ?>>Active</option> <option value="0" <?php echo isset($status) && $status == 0 ? 'selected' : '' ?>>Inactive</option> </select> </div> </form> </div> <script> $(function(){ $('#parcel_type-form').submit(function(e){ e.preventDefault(); $('.pop_msg').remove() var _this = $(this) var _el = $('<div>') _el.addClass('pop_msg') $('#uni_modal button').attr('disabled',true) $('#uni_modal button[type="submit"]').text('submitting form...') $.ajax({ url:'./Actions.php?a=save_parcel_type', method:'POST', data:$(this).serialize(), dataType:'JSON', error:err=>{ console.log(err) _el.addClass('alert alert-danger') _el.text("An error occurred.") _this.prepend(_el) _el.show('slow') $('#uni_modal button').attr('disabled',false) $('#uni_modal button[type="submit"]').text('Save') }, success:function(resp){ if(resp.status == 'success'){ _el.addClass('alert alert-success') $('#uni_modal').on('hide.bs.modal',function(){ location.reload() }) if("<?php echo isset($parcel_type_id) ?>" != 1) _this.get(0).reset(); }else{ _el.addClass('alert alert-danger') } _el.text(resp.msg) _el.hide() _this.prepend(_el) _el.show('slow') $('#uni_modal button').attr('disabled',false) $('#uni_modal button[type="submit"]').text('Save') } }) }) }) </script> |
parcels.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
<div class="card"> <div class="card-header d-flex justify-content-between"> <h3 class="card-title">Parcels List</h3> <div class="card-tools align-middle"> <button class="btn btn-dark btn-sm py-1 rounded-0" type="button" id="create_new">Add New</button> </div> </div> <div class="card-body"> <table class="table table-hover table-striped table-bordered"> <colgroup> <col width="5%"> <col width="30%"> <col width="25%"> <col width="25%"> <col width="15%"> </colgroup> <thead> <tr> <th class="text-center p-0">#</th> <th class="text-center p-0">Tracking Code</th> <th class="text-center p-0">Parcel Type</th> <th class="text-center p-0">Status</th> <th class="text-center p-0">Action</th> </tr> </thead> <tbody> <?php $sql = "SELECT p.*,pt.name as `type` FROM `parcel_list` p inner join parcel_type_list pt on p.parcel_type_id = pt.parcel_type_id order by strftime('%s',p.date_added) desc"; $qry = $conn->query($sql); $i = 1; while($row = $qry->fetchArray()): ?> <tr> <td class="text-center p-0"><?php echo $i++; ?></td> <td class="py-0 px-1"><?php echo $row['code'] ?></td> <td class="py-0 px-1 text-center"><?php echo $row['type'] ?></td> <td class="py-0 px-1 text-center"> <?php switch($row['status']){ case '0': echo '<span class="badge bg-dark text-light rounded-pill">Pending</span>'; break; case '1': echo '<span class="badge bg-primary rounded-pill">Out for Delivery</span>'; break; case '2': echo '<span class="badge bg-success rounded-pill">Delivered</span>'; break; case '3': echo '<span class="badge bg-danger rounded-pill">Delivery Faield</span>'; break; } ?> </td> <th class="text-center py-0 px-1"> <div class="btn-group" role="group"> <button id="btnGroupDrop1" type="button" class="btn btn-primary dropdown-toggle btn-sm rounded-0 py-0" data-bs-toggle="dropdown" aria-expanded="false"> Action </button> <ul class="dropdown-menu" aria-labelledby="btnGroupDrop1"> <li><a class="dropdown-item edit_data" href = './?page=view_parcel&id=<?php echo $row['parcel_id'] ?>' >View</a></li> <li><a class="dropdown-item edit_data" data-id = '<?php echo $row['parcel_id'] ?>' href="javascript:void(0)">Edit</a></li> <li><a class="dropdown-item delete_data" data-id = '<?php echo $row['parcel_id'] ?>' data-name = '<?php echo $row['code'] ?>' href="javascript:void(0)">Delete</a></li> </ul> </div> </th> </tr> <?php endwhile; ?> <?php if(!$qry->fetchArray()): ?> <tr> <th class="text-center p-0" colspan="5">No data display.</th> </tr> <?php endif; ?> </tbody> </table> </div> </div> <script> $(function(){ $('#create_new').click(function(){ uni_modal('Parcel Entry',"manage_parcel.php","large") }) $('.edit_data').click(function(){ uni_modal('Edit Parcel Details',"manage_parcel.php?id="+$(this).attr('data-id'),"large") }) $('.delete_data').click(function(){ _conf("Are you sure to delete <b>"+$(this).attr('data-name')+"</b> from list?",'delete_data',[$(this).attr('data-id')]) }) }) function delete_data($id){ $('#confirm_modal button').attr('disabled',true) $.ajax({ url:'./Actions.php?a=delete_parcel', method:'POST', data:{id:$id}, dataType:'JSON', error:err=>{ console.log(err) alert("An error occurred.") $('#confirm_modal button').attr('disabled',false) }, success:function(resp){ if(resp.status == 'success'){ location.reload() }else if(resp.status == 'failed' && !!resp.msg){ var el = $('<div>') el.addClass('alert alert-danger pop-msg') el.text(resp.msg) el.hide() $('#confirm_modal .modal-body').prepend(el) el.show('slow') }else{ alert("An error occurred.") } $('#confirm_modal button').attr('disabled',false) } }) } </script> |