Point of Sale for CAFE in C# – Free Source Code Download
POS Project for a Cafe. It is a software-based application that helps to manage the sale transaction of Cafe businesses. The system will calculate the total amount to pay the customer and print a simple receipt after payment succeeds.
About the Cafe Point of Sale System
This project was developed using C# and the database is in MS SQL SERVER. The project requires the registered users to submit/log in their system credentials in order to access the functionalities of this application. The registered user can add new categories and items to the list. Talking about the main feature, the registered user can simply select the item by selecting the item category at first to display all available items under the selected category, and by simply clicking the item image, the item will be enlisted in the list box on the right panel of the UI and the Total Payable Amount will be automatically computed. To delete an item/s from the list, the registered user must select the item in the list and click the delete button. When the registered user clicks the “Pay” button, the payment form will be shown and the registered user will enter the customer’s tendered amount. After the payment submits, the customer change will be shown and print options of the receipt will be shown afterward. After the payment process succeeds, the list will be automatically renewed. The system is easy to use and the source code is free to download.
Functional Requirements of Point of Sale for CAFE
- Login
- Registered user Registration
- The registered user can Add New Category
- The registered user can delete Category
- The registered user can update Category
- The registered user can view Category
- The registered user can Add New Item
- The registered user can delete Item
- The registered user can update Item
- The registered user can view Item
- The registered user can Create Sale Transaction
- The registered user can Manage Payment
- The registered user can Display Calculated Change
- The registered user can Generate Printable Receipt
payform.cs
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 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace NewPOS { public partial class PayForm : Form { Database1Entities dbe = new Database1Entities(); public delegate void PayedEvent(); public event PayedEvent PayedEv; public PayForm() { InitializeComponent(); } private decimal amountToPay; public decimal AmountToPay { get { return amountToPay; } set { amountToPay = value; txtAmountToPay.Text = String.Format("{0:c}", amountToPay); } } private void btnOk_Click(object sender, EventArgs e) { try { if (txtPaymentAmount.Text == "") { MessageBox.Show("Fill out the given amount"); return; } decimal total = 0; string RemovedCurrency = (txtAmountToPay.Text).Remove(0,1); total = decimal.Parse(RemovedCurrency) - decimal.Parse(txtPaymentAmount.Text); //MessageBox.Show(total.ToString()); //return; if (total > 0) { txtAmountToPay.Text = String.Format("{0:c}", total); } else { MessageBox.Show("Change to give: " + String.Format("{0:c}", -total)); this.Dispose(); PayedEv(); } } catch { //MessageBox.Show("An Error Occured"); } } } } |
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 |
namespace NewPOS { partial class PayForm { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.lblAmountToPay = new System.Windows.Forms.Label(); this.txtAmountToPay = new System.Windows.Forms.TextBox(); this.txtPaymentAmount = new System.Windows.Forms.TextBox(); this.lblPaymentAmount = new System.Windows.Forms.Label(); this.btnOk = new System.Windows.Forms.Button(); this.SuspendLayout(); // // lblAmountToPay // this.lblAmountToPay.AutoSize = true; this.lblAmountToPay.Location = new System.Drawing.Point(30, 32); this.lblAmountToPay.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblAmountToPay.Name = "lblAmountToPay"; this.lblAmountToPay.Size = new System.Drawing.Size(84, 17); this.lblAmountToPay.TabIndex = 0; this.lblAmountToPay.Text = "Total To Pay"; // // txtAmountToPay // this.txtAmountToPay.Location = new System.Drawing.Point(133, 29); this.txtAmountToPay.Margin = new System.Windows.Forms.Padding(4); this.txtAmountToPay.Name = "txtAmountToPay"; this.txtAmountToPay.Size = new System.Drawing.Size(132, 23); this.txtAmountToPay.TabIndex = 1; // // txtPaymentAmount // this.txtPaymentAmount.Location = new System.Drawing.Point(133, 75); this.txtPaymentAmount.Margin = new System.Windows.Forms.Padding(4); this.txtPaymentAmount.Name = "txtPaymentAmount"; this.txtPaymentAmount.Size = new System.Drawing.Size(132, 23); this.txtPaymentAmount.TabIndex = 3; // // lblPaymentAmount // this.lblPaymentAmount.AutoSize = true; this.lblPaymentAmount.Location = new System.Drawing.Point(12, 78); this.lblPaymentAmount.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblPaymentAmount.Name = "lblPaymentAmount"; this.lblPaymentAmount.Size = new System.Drawing.Size(102, 17); this.lblPaymentAmount.TabIndex = 2; this.lblPaymentAmount.Text = "Given Amount"; // // btnOk // this.btnOk.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); this.btnOk.Location = new System.Drawing.Point(132, 127); this.btnOk.Margin = new System.Windows.Forms.Padding(4); this.btnOk.Name = "btnOk"; this.btnOk.Size = new System.Drawing.Size(133, 47); this.btnOk.TabIndex = 4; this.btnOk.Text = "OK"; this.btnOk.UseVisualStyleBackColor = false; this.btnOk.Click += new System.EventHandler(this.btnOk_Click); // // PayForm // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 17F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.DarkGray; this.ClientSize = new System.Drawing.Size(290, 209); this.Controls.Add(this.btnOk); this.Controls.Add(this.txtPaymentAmount); this.Controls.Add(this.lblPaymentAmount); this.Controls.Add(this.txtAmountToPay); this.Controls.Add(this.lblAmountToPay); this.Font = new System.Drawing.Font("Century Gothic", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Margin = new System.Windows.Forms.Padding(4); this.Name = "PayForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Payment"; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label lblAmountToPay; private System.Windows.Forms.TextBox txtAmountToPay; private System.Windows.Forms.TextBox txtPaymentAmount; private System.Windows.Forms.Label lblPaymentAmount; private System.Windows.Forms.Button btnOk; } } |
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 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace NewPOS { public partial class LoginForm : Form { Database1Entities dbe = new Database1Entities(); public LoginForm() { InitializeComponent(); } private void btnSignIn_Click(object sender, EventArgs e) { if (txtUserName.Text == "" || txtPassword.Text == "") { MessageBox.Show("Please enter username and password."); return; } tblUsers l = new tblUsers(); foreach (var p in dbe.tblUsers) { if (p.userName == txtUserName.Text && p.password == txtPassword.Text) { MessageBox.Show("Successfully Logged In"); Form1 f1 = new Form1(); f1.lblHello.Text = "User: " + p.userName; f1.Show(); return; } } foreach (var p in dbe.tblUsers) { if (p.userName != txtUserName.Text || p.password != txtPassword.Text) { MessageBox.Show("Wrong Username and/or Password."); return; } } } private void llblRegister_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { RegisterForm rf1 = new RegisterForm(); rf1.Show(); } } } |
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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
namespace NewPOS { partial class LoginForm { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.lbluserName = new System.Windows.Forms.Label(); this.txtUserName = new System.Windows.Forms.TextBox(); this.txtPassword = new System.Windows.Forms.TextBox(); this.lblPassword = new System.Windows.Forms.Label(); this.btnSignIn = new System.Windows.Forms.Button(); this.lblMessage = new System.Windows.Forms.Label(); this.llblRegister = new System.Windows.Forms.LinkLabel(); this.lblMessageLogin = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // lbluserName // this.lbluserName.AutoSize = true; this.lbluserName.Location = new System.Drawing.Point(47, 93); this.lbluserName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbluserName.Name = "lbluserName"; this.lbluserName.Size = new System.Drawing.Size(73, 17); this.lbluserName.TabIndex = 0; this.lbluserName.Text = "UserName"; // // txtUserName // this.txtUserName.Location = new System.Drawing.Point(128, 90); this.txtUserName.Margin = new System.Windows.Forms.Padding(4); this.txtUserName.Name = "txtUserName"; this.txtUserName.Size = new System.Drawing.Size(132, 23); this.txtUserName.TabIndex = 1; // // txtPassword // this.txtPassword.Location = new System.Drawing.Point(128, 125); this.txtPassword.Margin = new System.Windows.Forms.Padding(4); this.txtPassword.Name = "txtPassword"; this.txtPassword.Size = new System.Drawing.Size(132, 23); this.txtPassword.TabIndex = 3; this.txtPassword.UseSystemPasswordChar = true; // // lblPassword // this.lblPassword.AutoSize = true; this.lblPassword.Location = new System.Drawing.Point(47, 128); this.lblPassword.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblPassword.Name = "lblPassword"; this.lblPassword.Size = new System.Drawing.Size(69, 17); this.lblPassword.TabIndex = 2; this.lblPassword.Text = "Password"; // // btnSignIn // this.btnSignIn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); this.btnSignIn.Location = new System.Drawing.Point(128, 165); this.btnSignIn.Margin = new System.Windows.Forms.Padding(4); this.btnSignIn.Name = "btnSignIn"; this.btnSignIn.Size = new System.Drawing.Size(133, 40); this.btnSignIn.TabIndex = 4; this.btnSignIn.Text = "Sign In"; this.btnSignIn.UseVisualStyleBackColor = false; this.btnSignIn.Click += new System.EventHandler(this.btnSignIn_Click); // // lblMessage // this.lblMessage.AutoSize = true; this.lblMessage.Location = new System.Drawing.Point(15, 231); this.lblMessage.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblMessage.Name = "lblMessage"; this.lblMessage.Size = new System.Drawing.Size(111, 17); this.lblMessage.TabIndex = 5; this.lblMessage.Text = "Not Registered?"; // // llblRegister // this.llblRegister.AutoSize = true; this.llblRegister.Font = new System.Drawing.Font("Century Gothic", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.llblRegister.Location = new System.Drawing.Point(142, 227); this.llblRegister.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.llblRegister.Name = "llblRegister"; this.llblRegister.Size = new System.Drawing.Size(119, 21); this.llblRegister.TabIndex = 6; this.llblRegister.TabStop = true; this.llblRegister.Text = "Register here !"; this.llblRegister.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llblRegister_LinkClicked); // // lblMessageLogin // this.lblMessageLogin.AutoSize = true; this.lblMessageLogin.Font = new System.Drawing.Font("Century Gothic", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.lblMessageLogin.Location = new System.Drawing.Point(32, 18); this.lblMessageLogin.Name = "lblMessageLogin"; this.lblMessageLogin.Size = new System.Drawing.Size(200, 21); this.lblMessageLogin.TabIndex = 7; this.lblMessageLogin.Text = "Welcome to New Caffe !"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(33, 52); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(187, 17); this.label1.TabIndex = 8; this.label1.Text = "Please, Log In to continue..."; // // LoginForm // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 17F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.DarkGray; this.ClientSize = new System.Drawing.Size(287, 280); this.Controls.Add(this.label1); this.Controls.Add(this.lblMessageLogin); this.Controls.Add(this.llblRegister); this.Controls.Add(this.lblMessage); this.Controls.Add(this.btnSignIn); this.Controls.Add(this.txtPassword); this.Controls.Add(this.lblPassword); this.Controls.Add(this.txtUserName); this.Controls.Add(this.lbluserName); this.Font = new System.Drawing.Font("Century Gothic", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Margin = new System.Windows.Forms.Padding(4); this.Name = "LoginForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Login"; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label lbluserName; private System.Windows.Forms.TextBox txtUserName; private System.Windows.Forms.TextBox txtPassword; private System.Windows.Forms.Label lblPassword; private System.Windows.Forms.Button btnSignIn; private System.Windows.Forms.Label lblMessage; private System.Windows.Forms.LinkLabel llblRegister; private System.Windows.Forms.Label lblMessageLogin; private System.Windows.Forms.Label label1; } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
namespace NewPOS { using System; using System.Collections.Generic; public partial class tblCategory { public tblCategory() { this.tblProduct = new HashSet<tblProduct>(); } public int categoryId { get; set; } public string CategoryName { get; set; } public byte[] categoryImage { get; set; } public virtual ICollection<tblProduct> tblProduct { get; set; } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
namespace NewPOS { using System; using System.Collections.Generic; public partial class tblTransaction { public tblTransaction() { this.tblTransactionItem = new HashSet<tblTransactionItem>(); } public int transactionId { get; set; } public Nullable<System.DateTime> transactionDate { get; set; } public virtual ICollection<tblTransactionItem> tblTransactionItem { get; set; } } } |