Create a Sales Form / POS – Tutorial Build Point Of Sale With PHP, PDO, MySQL And Jquery Part 5

How to create a sales transactions page with PHP, jquery, and adminLTE. We have been at the end of the tutorial create a point of sale system with PHP. This article was the initial goal of the tutorial create a point of sale with PHP and AdminLTE. In this article, I will discuss how to create a simple sales page. In addition, the complete source of this project will share on this part. Let’s follow the tutorial

For those of you who don’t follow the tutorial from the first, please read them in advance every part via the following URL links.

Sales form is used to manage sales transactions. Every sale transaction done will reduce stock items and print struck sales. This module is still very simple because it is only used as a learning process.

Tutorial Create a sales page with PHP, PDO, jquery and adminLTE

Database Preparation

Add 3 new tables in “pos” database: t_sale, t_sale_detail, temp_sale. To create 3 tables above please see the structure of the table in the following image:

Pos Structure Table

A little explanation of the table:

t_sale is used to store primary data on sales transactions. Table t_sale_detail to store details of items that are on sale transaction with the certain transaction code. And the temp_sale table is used to store temporary of detail items, and the data in the temp_sale will be deleted when the transaction is successfully saved and or at the beginning of login, all of the temp_sale data on the user will be emptied.

Please create 3 new store procedure: saveSale, deleteSale, restore_stock_sale


saveSale store procedure is used to store transactions into the database.


deleteSale store procedure is used to remove sales transactions from the database. The sales transaction is not deleted with DELETE MySQL function but only UPDATE MySQL by changing the sts field to 0. Because in Information system security, a transaction history is very important.


restore_stock_sale store procedure is used to restore stock items as they were when sales transactions were removed.

In this section, we will add 4 new files in the sales folder (pos/application/sales/) and edit the pos.php file to add a list of MySQL queries in the sales table. Copy the following code on each file



Display the front end of the sales menu as shown below.

Point Of Sale With Php Front End Tutorial Create Pos Php



And add the following code in the pos.php file

Up to this point, the tutorial how to create a point of sale system with PHP, PDO, jquery and adminLTE has been completed. A brief explanation on the sales transaction page:

To add an item to the shopping cart grid, we use the jquery UI autocomplete. By typing the item name or item code in the text box field, jquery will display a list of items like the following picture

Autocomplete Item On Point Of Sale System Tutorial Build Point Of Sale In Php Pdo Jquery And Adminlte

Jquery ajax will call autocomplete function in autocomplete_item.php file

To add the number of items, the user can click on the item qty section and will display the modal dialog to change qty.

If the user selects the same item in the autocomplete box, it will automatically add qty item to the grid.

Add Item In Shoping Cart Grid Tutorial Pos With Php

process payment button will display the transaction payment modal dialog like the following picture:

Point Of Sale Layout Template

After the transaction has been processed, jquery will execute the redirect script to display the sales receipt on the new browser tab (in PDF format). For the tutorial create sales receipt with PDF, I will discuss in the bonus article

Javascript redirect is useful to replace form element in HTML. This script is very useful for me to send data using POST method without creating form element in HTML.

DONE!! The tutorial point of sale system with PHP has been completed. In accordance with my promise from the beginning, you can download the complete source code of this project on the download link below:

I hope this article is helpful for all of us. If you feel helped by this article, Please give me a donation or a gift. To keep me excited about creating articles. ;p

Bonus article php tutorial how to create pdf receipt note with fpdf php library

Thus tutorial about How To Create a Sales Form / POS – Tutorial Build Point Of Sale With PHP, PDO, MySQL And Jquery Part 5

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.


 Add your comment
  1. Hi,
    I find this tutorial very interesting.
    Can you share the bonus article to create the PDF file.
    Thanks and best regards,

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.