Home php Restaurant Pos System using Php jquery

Restaurant Pos System using Php jquery

13 min read
0
0
1,931

The Restaurant pos system is developed using php. The project is built to manage sales and transactions. To make a new transaction, fields such as:items type and ingredients, qty needs to be selected. If you like to learn point of sales systems step by step, this is the right place to learn from the beginning. In this tutorial useful for making a point of sales system for a small shops.

Paste the following code inside the index.php.

<html xmlns="http://www.w3.org/1999/html">
<head>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>

<nav class="navbar navbar-dark bg-dark">
    <span class="navbar-brand mb-0 h1">Restaurant Coffee Shop Pos</span>
</nav>
            <div class="row">
                <div class="col-sm-3">
                    <div class="container">
                            <div class="list-group-item list-group-tem-action active">Item</div>

                            <div class="panel-body bg-dark" style="color: white">
                                <form id="tbl-project">
                                    <div class="panel-body bg-dark" style="color: white">

                                        <table  class="table table-bordered" style="color: white">
                                            <tr>
                                                <td>
                                                    <input  type="checkbox" name="pos"  value="Nuggets Fries">
                                                    <label>Nuggets Fries</label>
                                                </td>
                                                <td>
                                                    <input type="number" name="qty" id="qty" size="10px">
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <input type="checkbox" name="pos"  value="Village Fries">
                                                    <label>Village Fries</label>
                                                </td>
                                                <td>
                                                    <input type="number" name="qty" size="10px">
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <input type="checkbox" name="pos"  value="Fries">
                                                    <label> Fries</label>
                                                </td>
                                                <td>
                                                    <input type="number" name="qty" size="10px">
                                                </td>

                                            </tr>
                                        </table>

                                    </div>

                                </form>
                            </div>

                    </div>
                </div>

                <div class="col-sm-3">
                    <div class="container">
                        <div class="list-group-item list-group-tem-action active">Drink</div>

                        <div class="panel-body bg-dark" style="color: white">
                            <form id="tbl-project">
                                <div class="panel-body bg-dark" style="color: white">

                                    <table  class="table table-bordered" style="color: white">
                                        <tr>
                                            <td>
                                                <input  type="checkbox" name="pos"  value="Tea">
                                                <label>Tea</label>
                                            </td>
                                            <td>
                                                <input type="number" name="qty" id="qty" size="10px">
                                            </td>

                                        </tr>
                                        <tr>
                                            <td>
                                                <input type="checkbox" name="pos"  value="Coffee">
                                                <label>Coffee</label>
                                            </td>
                                            <td>
                                                <input type="number" name="qty" size="10px">
                                            </td>

                                        </tr>
                                        <tr>
                                            <td>
                                                <input type="checkbox" name="pos"  value="Apple Juice">
                                                <label>Apple Juice</label>
                                            </td>
                                            <td>
                                                <input type="number" name="qty" size="10px">
                                            </td>

                                        </tr>

                                        <tr>
                                            <td>
                                                <input type="checkbox" name="pos"  value="Orange Juice">
                                                <label>Orange Juice</label>
                                            </td>
                                            <td>
                                                <input type="number" name="qty" size="10px">
                                            </td>

                                        </tr>
                                        <tr>
                                            <td colspan="3" align="right">
                                                <input type="button" class="btn btn-info"  value="ADD" onclick="Add()">

                                            </td>
                                        </tr>

                                    </table>

                                </div>

                            </form>
                        </div>

                    </div>
                </div>
    <div class="col-sm-4">
        <div class="container">
        <div class="list-group-item list-group-tem-action active">AddProducts</div>
        <table id="tbl-item" class="table table-dark table-bordered" cellspacing="0" width="100%" align="center">
            <thead>
            <tr>
                <th>Delete</th>
                <th>Item</th>
                <th>Price</th>
                <th>Qty</th>
                <th>Total</th>
            </tr>
            <tbody>

            </tbody>
        </table>

    </div>
    </div>
        <div class="col-sm-2">
            <div class="list-group-item list-group-item-action active">Bill</div>
            <div>
                <label>Total</label>
                <input type="text" style="color: yellow; background: black; font-size: 30px;" id="total" name="total" placeholder="Total" required>
            </div>
            </br>

            <div>
                <input type="button" class="btn btn-warning" value="Reset" name="reset" id="reset">
            </div>
        </div>

</div>





<script type="text/css" src="component/jquery/jquery.js"></script>
<script type="text/css" src="component/jquery/jquery.min.js"></script>
<script type="text/css" src="component/jquery.validate.min.js"></script>

<script type="text/javascript">

    var tot = 0;
    var total = 0;

    function Add()
    {

        $("input[name='pos']:checked").each(function() {
            // Get the value
            let check = $(this).val();
            var price = null;
            if (check == "Nuggets Fries") {
                price = 12;
            } else if (check == "Village Fries") {
                price = 15;
            } else if (check == "Fries") {
                price = 35;
            }

            else if (check == "Tea")
            {
                price = 10;
            }
            else if (check == "Coffee")
            {
                price = 32;
            }
            else if (check == "Apple Juice")
            {
                price = 25;
            }
            else if (check == "Orange Juice")
            {
                price = 45;
            }

            var qty = $(this).closest("tr").find('[name="qty"]').val() || 0;
            tot = qty * price;
            var table1 =
                "<tr>" +
                "<td><button type='button' name='record' class='btn btn-warning' onclick='deleterow(this)'>Delete </td>" +
                "<td>" + check + "</td>" +
                "<td>" + price + "</td>" +
                "<td>" + qty + "</td>" +
                "<td>" + tot + "</td>" +

                "</tr>";

            total += Number(tot);
            $('#total').val(total);


            $("#tbl-item tbody").append(table1);

        });


    }

    function deleterow(e)
    {
        total_cost = parseInt($(e).parent().parent().find('td:last').text(),10);
        total -= total_cost;
        $('#total').val(total);
        $(e).parent().parent().remove();
    }



    $('#reset').click(function()
        {
            location.reload();
        }
    );


</script>

</body>


</html>

I have attached the video tutorial below it will help you to do this step by step.

Load More Related Articles
Load More By admin
Load More In php

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also

Laravel 11 CRUD Mastering RESTful API MVC with Repository Pattern

In this tutorial will teach Laravel 11 Api MVC with Repository Pattern Crud Application st…