Code of Bakery Inventory Management System in C# [Free Download]
The Bakery Inventory Management System is a software delveped in C#.net.
The Bakery Inventory Management System is very good if you have a small bakery business in your city.
We all know that keeping track of inventory can be a problem  during rush hours, but with the use of this system you will be able to manage your bakery inventory with a well managed way and help to ensure that your products will always be well-stocked.
This Bakery Inventory Management System is developed in C# .NET and Database of MS Access is being used .
Functional Requirements of Bakery Inventory Management System Final Year Project
- Secure Login/Logout
- The admin can Insert, delete, view, update and search List of Products
- The admin can Stock In
- The admin can Stock-Out
- The admin can Insert, delete, view, update and search Users
- The system will Generate Inventory Reports
- The system will Prevent Stocking Out insufficient availability
- The system will Categorized the Product List
frmEditProduct.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 |
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 BakeryInventorySystem { public partial class frmEditProduct : Form { SQLConfig config = new SQLConfig(); usableFunction func = new usableFunction(); string sql; int maxrow; frmListofProducts frm; public frmEditProduct(string id,frmListofProducts frm) { InitializeComponent(); retrieveProduct(id); this.frm = frm; } private void retrieveProduct(string id) { sql = "SELECT PROCODE,PRONAME,PRODESC,CATEGORY, PROPRICE FROM tblProductInfo WHERE PROCODE='" + id + "'"; maxrow = config.maxrow(sql); if(maxrow > 0) { foreach(DataRow r in config.dt.Rows) { txtPROCODE.Text = r.Field<string>(0); TXTPRONAME.Text = r.Field<string>(1); TXTDESC.Text = r.Field<string>(2); cboCateg.Text = r.Field<string>(3); TXTPRICE.Text = r.Field<decimal>(4).ToString(); } } } private void frmEditProduct_Load(object sender, EventArgs e) { } private void BTNSAVE_Click(object sender, EventArgs e) { sql = "UPDATE tblProductInfo SET PRONAME='" + TXTPRONAME.Text + "' ,PRODESC='" + TXTDESC.Text + "',CATEGORY='" + cboCateg.Text + "',PROPRICE=" + TXTPRICE.Text + " WHERE PROCODE='" + txtPROCODE.Text + "'"; config.Execute_CUD(sql, "Error to update Bread.", "Bread Has Been Updated."); } private void btnList_Click(object sender, EventArgs e) { frm.refresh(); this.Close(); } } } |
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 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
namespace BakeryInventorySystem { partial class frmEditProduct { /// <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.cboCateg = new System.Windows.Forms.ComboBox(); this.Label1 = new System.Windows.Forms.Label(); this.txtPROCODE = new System.Windows.Forms.TextBox(); this.TXTDESC = new System.Windows.Forms.RichTextBox(); this.TXTPRICE = new System.Windows.Forms.TextBox(); this.Label2 = new System.Windows.Forms.Label(); this.TXTPRONAME = new System.Windows.Forms.TextBox(); this.Label3 = new System.Windows.Forms.Label(); this.Label7 = new System.Windows.Forms.Label(); this.Label4 = new System.Windows.Forms.Label(); this.Label6 = new System.Windows.Forms.Label(); this.Button2 = new System.Windows.Forms.Button(); this.btnList = new System.Windows.Forms.Button(); this.BTNSAVE = new System.Windows.Forms.Button(); this.SuspendLayout(); // // cboCateg // this.cboCateg.FormattingEnabled = true; this.cboCateg.Items.AddRange(new object[] { "Bread", "Cake", "Pastry"}); this.cboCateg.Location = new System.Drawing.Point(145, 199); this.cboCateg.Name = "cboCateg"; this.cboCateg.Size = new System.Drawing.Size(339, 21); this.cboCateg.TabIndex = 69; this.cboCateg.Text = "Select"; // // Label1 // this.Label1.AutoSize = true; this.Label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Label1.Location = new System.Drawing.Point(49, 66); this.Label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.Label1.Name = "Label1"; this.Label1.Size = new System.Drawing.Size(44, 15); this.Label1.TabIndex = 68; this.Label1.Text = "Code:"; // // txtPROCODE // this.txtPROCODE.Enabled = false; this.txtPROCODE.Location = new System.Drawing.Point(145, 65); this.txtPROCODE.Name = "txtPROCODE"; this.txtPROCODE.Size = new System.Drawing.Size(339, 20); this.txtPROCODE.TabIndex = 67; // // TXTDESC // this.TXTDESC.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.TXTDESC.Location = new System.Drawing.Point(145, 132); this.TXTDESC.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.TXTDESC.Name = "TXTDESC"; this.TXTDESC.Size = new System.Drawing.Size(339, 60); this.TXTDESC.TabIndex = 60; this.TXTDESC.Text = ""; // // TXTPRICE // this.TXTPRICE.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.TXTPRICE.Location = new System.Drawing.Point(145, 235); this.TXTPRICE.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.TXTPRICE.Name = "TXTPRICE"; this.TXTPRICE.Size = new System.Drawing.Size(99, 30); this.TXTPRICE.TabIndex = 61; // // Label2 // this.Label2.AutoSize = true; this.Label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Label2.Location = new System.Drawing.Point(49, 102); this.Label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.Label2.Name = "Label2"; this.Label2.Size = new System.Drawing.Size(53, 15); this.Label2.TabIndex = 62; this.Label2.Text = "Name :"; // // TXTPRONAME // this.TXTPRONAME.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.TXTPRONAME.Location = new System.Drawing.Point(145, 99); this.TXTPRONAME.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.TXTPRONAME.Name = "TXTPRONAME"; this.TXTPRONAME.Size = new System.Drawing.Size(339, 23); this.TXTPRONAME.TabIndex = 59; // // Label3 // this.Label3.AutoSize = true; this.Label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Label3.Location = new System.Drawing.Point(49, 135); this.Label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.Label3.Name = "Label3"; this.Label3.Size = new System.Drawing.Size(88, 15); this.Label3.TabIndex = 63; this.Label3.Text = "Description :"; // // Label7 // this.Label7.AutoSize = true; this.Label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Label7.Location = new System.Drawing.Point(49, 200); this.Label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.Label7.Name = "Label7"; this.Label7.Size = new System.Drawing.Size(75, 15); this.Label7.TabIndex = 65; this.Label7.Text = "Category : "; // // Label4 // this.Label4.AutoSize = true; this.Label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Label4.Location = new System.Drawing.Point(252, 235); this.Label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.Label4.Name = "Label4"; this.Label4.Size = new System.Drawing.Size(34, 16); this.Label4.TabIndex = 66; this.Label4.Text = "php"; // // Label6 // this.Label6.AutoSize = true; this.Label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Label6.Location = new System.Drawing.Point(49, 235); this.Label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.Label6.Name = "Label6"; this.Label6.Size = new System.Drawing.Size(48, 15); this.Label6.TabIndex = 64; this.Label6.Text = "Price :"; // // Button2 // this.Button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Button2.Location = new System.Drawing.Point(355, 285); this.Button2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.Button2.Name = "Button2"; this.Button2.Size = new System.Drawing.Size(97, 32); this.Button2.TabIndex = 58; this.Button2.Text = "Close"; this.Button2.UseVisualStyleBackColor = true; // // btnList // this.btnList.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnList.Location = new System.Drawing.Point(250, 285); this.btnList.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.btnList.Name = "btnList"; this.btnList.Size = new System.Drawing.Size(97, 32); this.btnList.TabIndex = 57; this.btnList.Text = "List"; this.btnList.UseVisualStyleBackColor = true; this.btnList.Click += new System.EventHandler(this.btnList_Click); // // BTNSAVE // this.BTNSAVE.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.BTNSAVE.Location = new System.Drawing.Point(145, 285); this.BTNSAVE.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.BTNSAVE.Name = "BTNSAVE"; this.BTNSAVE.Size = new System.Drawing.Size(97, 32); this.BTNSAVE.TabIndex = 56; this.BTNSAVE.Text = "Save"; this.BTNSAVE.UseVisualStyleBackColor = true; this.BTNSAVE.Click += new System.EventHandler(this.BTNSAVE_Click); // // frmEditProduct // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(583, 448); this.Controls.Add(this.cboCateg); this.Controls.Add(this.Label1); this.Controls.Add(this.txtPROCODE); this.Controls.Add(this.TXTDESC); this.Controls.Add(this.TXTPRICE); this.Controls.Add(this.Label2); this.Controls.Add(this.TXTPRONAME); this.Controls.Add(this.Label3); this.Controls.Add(this.Label7); this.Controls.Add(this.Label4); this.Controls.Add(this.Label6); this.Controls.Add(this.Button2); this.Controls.Add(this.btnList); this.Controls.Add(this.BTNSAVE); this.Name = "frmEditProduct"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Edit Product"; this.Load += new System.EventHandler(this.frmEditProduct_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion internal System.Windows.Forms.ComboBox cboCateg; internal System.Windows.Forms.Label Label1; internal System.Windows.Forms.TextBox txtPROCODE; internal System.Windows.Forms.RichTextBox TXTDESC; internal System.Windows.Forms.TextBox TXTPRICE; internal System.Windows.Forms.Label Label2; internal System.Windows.Forms.TextBox TXTPRONAME; internal System.Windows.Forms.Label Label3; internal System.Windows.Forms.Label Label7; internal System.Windows.Forms.Label Label4; internal System.Windows.Forms.Label Label6; internal System.Windows.Forms.Button Button2; internal System.Windows.Forms.Button btnList; internal System.Windows.Forms.Button BTNSAVE; } } |
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 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
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 BakeryInventorySystem { public partial class frmInventoryReports : Form { public frmInventoryReports() { InitializeComponent(); } SQLConfig config = new SQLConfig(); usableFunction func = new usableFunction(); string query; int maxrow; private void RDOSELECT(RadioButton RDO) { if (RDO.Checked) { switch (RDO.Text) { case "All" : query = "SELECT P.PROCODE AS [ProductCode], (PRONAME + ' ' + PRODESC) AS [Product],CATEGORY AS [Category], PROPRICE AS [Price],PROQTY AS [Quantity] " + " FROM tblProductInfo AS P WHERE CATEGORY ='" + cboCateg.Text + "' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; break; case "Stock-In": query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATERECEIVED) AS [ReceivedDate], (PRONAME + ' ' + PRODESC) AS [Product], PROPRICE AS [Price],RECEIVEDQTY AS [Quantity],(ROUND(RECEIVEDQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockIn AS S, tblProductInfo AS P WHERE S.PROCODE=P.PROCODE AND CATEGORY ='" + cboCateg.Text + "' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; break; case "Sold" : query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATEOUT) AS [TransactionDate], (PRONAME + ' ' + PRODESC) AS [Product], PROPRICE AS [Price],OUTQTY AS [Quantity],(ROUND(OUTQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockOut AS S, tblProductInfo AS P WHERE S.PROCODE=P.PROCODE AND CATEGORY ='" + cboCateg.Text + "' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; break; case "Today": if( RDO.Text == "Stock-In") { query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATERECEIVED) AS [ReceivedDate], (PRONAME + ' ' + PRODESC) AS [Product], PROPRICE AS [Price],RECEIVEDQTY AS [Quantity],(ROUND(RECEIVEDQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockIn AS S, tblProductInfo AS P " + " WHERE S.PROCODE=P.PROCODE AND DATEVALUE(DATERECEIVED) = NOW() AND PRODESC LIKE '%" + txtSearch.Text + "%' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; } else if (RDO.Text == "Sold") { query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATEOUT) AS [TransactionDate], (PRONAME + ' ' + PRODESC) AS [Product],('Net/VolWt:' + PRONETWT ) AS [Description],PROPRICE as Price,(OUTQTY + PROUNIT) AS [Quantity],(ROUND(OUTQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockOut AS S, tblProductInfo AS P WHERE S.PROCODE=P.PROCODE AND DATEVALUE(DATERECEIVED) = NOW() AND CATEGORY ='" + cboCateg.Text + "' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; } break; case "Weekly": if (RDO.Text == "Stock-In") { query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATERECEIVED) AS [ReceivedDate], (PRONAME + ' ' + PRODESC) AS [Product],PROPRICE AS [Price],RECEIVEDQTY AS [Quantity],(ROUND(RECEIVEDQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockIn AS S, tblProductInfo AS P " + " WHERE S.PROCODE=P.PROCODE AND MONTH(DATERECEIVED) = MONTH(NOW()) AND DATEVALUE(DATEPART(ww,DATEOUT)) = DATEVALUE(DATEPART(ww,NOW())) AND PRODESC LIKE '%" + txtSearch.Text + "%' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; } else if (RDO.Text == "Sold") { query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATEOUT) AS [TransactionDate], (PRONAME + ' ' + PRODESC) AS [Product],('Net/VolWt:' + PRONETWT ) AS [Description],PROPRICE as Price,(OUTQTY + PROUNIT) AS [Quantity],(ROUND(OUTQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockOut AS S, tblProductInfo AS P " + " WHERE S.PROCODE=P.PROCODE AND MONTH(DATERECEIVED) = MONTH(NOW()) AND DATEVALUE(DATEPART(ww,DATEOUT)) = DATEVALUE(DATEPART(ww,NOW())) AND CATEGORY ='" + cboCateg.Text + "' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; } break; case "Monthly": if( RDO.Text == "Stock-In") { query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATERECEIVED) AS [ReceivedDate], (PRONAME + ' ' + PRODESC) AS [Product],PROPRICE AS [Price],RECEIVEDQTY AS [Quantity],(ROUND(RECEIVEDQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockIn AS S, tblProductInfo AS P " + " WHERE S.PROCODE=P.PROCODE AND MONTH(DATERECEIVED) = MONTH(NOW()) AND PRODESC LIKE '%" + txtSearch.Text + "%' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; } else if (RDO.Text == "Sold") { query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATEOUT) AS [TransactionDate], (PRONAME + ' ' + PRODESC) AS [Product],('Net/VolWt:' + PRONETWT) AS [Description],PROPRICE as Price,(OUTQTY + PROUNIT) AS [Quantity],(ROUND(OUTQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockOut AS S, tblProductInfo AS P " + " WHERE S.PROCODE=P.PROCODE AND MONTH(DATERECEIVED) = MONTH(NOW()) AND CATEGORY ='" + cboCateg.Text + "' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; } break; } config.Load_DTG(query, dtglist); } } private void RDOCLEAR(string ACTIONS,RadioButton rdo) { if (rdo.Checked) { switch (ACTIONS) { case "Product": rdoProduct.Checked = false; break; case "Transaction": rdoStockIn.Checked = false; rdoStockOut.Checked = false; rdoMonthly.Checked = false; rdoWeekly.Checked = false; rdoToday.Checked = false; break; } if( rdo.Text != "Today" && rdo.Text != "21 days" && rdo.Text != "Weekly" && rdo.Text != "Monthly") { LBLLIST.Text = "List of " + rdo.Text + " (" + cboCateg.Text + ")"; } } } private void RDOCLEARDATE() { rdoMonthly.Checked = false; rdoWeekly.Checked = false; rdoToday.Checked = false; } private void frmInventoryReports_Load(object sender, EventArgs e) { RDOCLEAR("Transaction", rdoProduct); LBLLIST.Text = "List of Products (" + cboCateg.Text + ")"; RDOSELECT(rdoProduct); } private void rdoProduct_CheckedChanged(object sender, EventArgs e) { RDOCLEAR("Transaction", rdoProduct); LBLLIST.Text = "List of Products (" + cboCateg.Text + ")"; RDOSELECT(rdoProduct); } private void rdoStockIn_CheckedChanged(object sender, EventArgs e) { RDOCLEAR("Product", rdoStockIn); RDOCLEARDATE(); RDOSELECT(rdoStockIn); } private void rdoStockOut_CheckedChanged(object sender, EventArgs e) { RDOCLEAR("Product", rdoStockOut); RDOCLEARDATE(); RDOSELECT(rdoStockOut); } private void rdoToday_CheckedChanged(object sender, EventArgs e) { if(rdoStockIn.Checked) { RDOCLEAR("Product", rdoStockIn); query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATERECEIVED) AS [ReceivedDate], (PRONAME + ' ' + PRODESC) AS [Product],PROPRICE AS [Price],RECEIVEDQTY AS [Quantity],(ROUND(RECEIVEDQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockIn AS S, tblProductInfo AS P " + " WHERE S.PROCODE=P.PROCODE AND DATEVALUE(DATERECEIVED) = DATEVALUE(NOW()) AND PRODESC LIKE '%" + txtSearch.Text + "%' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; config.Load_DTG(query, dtglist); } else if (rdoStockOut.Checked) { RDOCLEAR("Product", rdoStockOut); query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATEOUT) AS [TransactionDate], (PRONAME + ' ' + PRODESC) AS [Product],PROPRICE AS [Price],OUTQTY AS [Quantity],(ROUND(OUTQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockOut AS S, tblProductInfo AS P WHERE S.PROCODE=P.PROCODE AND DATEVALUE(DATEOUT) =DATEVALUE(NOW()) AND CATEGORY ='" + cboCateg.Text + "' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; config.Load_DTG(query, dtglist); } } private void rdoWeekly_CheckedChanged(object sender, EventArgs e) { if (rdoStockIn.Checked) { RDOCLEAR("Product", rdoStockIn); query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATERECEIVED) AS [ReceivedDate], (PRONAME + ' ' + PRODESC) AS [Product],PROPRICE AS [Price],RECEIVEDQTY AS [Quantity],(ROUND(RECEIVEDQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockIn AS S, tblProductInfo AS P " + " WHERE S.PROCODE=P.PROCODE AND MONTH(DATERECEIVED) = MONTH(NOW()) AND PRODESC LIKE '%" + txtSearch.Text + "%' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; config.Load_DTG(query, dtglist); } else if (rdoStockOut.Checked) { RDOCLEAR("Product", rdoStockOut); query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATEOUT) AS [TransactionDate], (PRONAME + ' ' + PRODESC) AS [Product],PROPRICE AS [Price],OUTQTY AS [Quantity],(ROUND(OUTQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockOut AS S, tblProductInfo AS P " + " WHERE S.PROCODE=P.PROCODE AND MONTH(DATEOUT) = MONTH(NOW()) AND DatePart('ww',DATEVALUE(DATEOUT))= DatePart('ww',DATEVALUE(NOW())) AND CATEGORY ='" + cboCateg.Text + "' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; config.Load_DTG(query, dtglist); } } private void rdoMonthly_CheckedChanged(object sender, EventArgs e) { if (rdoStockIn.Checked) { RDOCLEAR("Product", rdoStockIn); query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATERECEIVED) AS [ReceivedDate], (PRONAME + ' ' + PRODESC) AS [Product],PROPRICE AS [Price],RECEIVEDQTY AS [Quantity],(ROUND(RECEIVEDQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockIn AS S, tblProductInfo AS P " + " WHERE S.PROCODE=P.PROCODE AND MONTH(DATERECEIVED) = MONTH(NOW()) AND PRODESC LIKE '%" + txtSearch.Text + "%' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; config.Load_DTG(query, dtglist); } else if (rdoStockOut.Checked) { RDOCLEAR("Product", rdoStockOut); query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATEOUT) AS [TransactionDate], (PRONAME + ' ' + PRODESC) AS [Product],PROPRICE AS [Price],OUTQTY AS [Quantity],(ROUND(OUTQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockOut AS S, tblProductInfo AS P " + " WHERE S.PROCODE=P.PROCODE AND MONTH(DATEOUT) = MONTH(NOW()) AND CATEGORY ='" + cboCateg.Text + "' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; config.Load_DTG(query, dtglist); } } private void btnSearch_Click(object sender, EventArgs e) { if( rdoProduct.Checked) { rdoStockOut.Checked = true; } DateTime dfrom = DateTime.Parse(dtpFrom.Text); DateTime dto = DateTime.Parse(dtpTo.Text); if( rdoStockIn.Checked) { LBLLIST.Text = "Stock of " + cboCateg.Text + " from " + dfrom + " to " + dto; query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATERECEIVED) AS [ReceivedDate], (PRONAME + ' ' + PRODESC) AS [Product],PROPRICE AS [Price],RECEIVEDQTY AS [Quantity],(ROUND(RECEIVEDQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockIn AS S, tblProductInfo AS P " + " WHERE S.PROCODE=P.PROCODE AND DATEVALUE(DATERECEIVED) BETWEEN #" + dfrom + "# AND #" + dto + "# AND PRODESC LIKE '%" + txtSearch.Text + "%' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; config.Load_DTG(query, dtglist); } else if (rdoStockOut.Checked) { LBLLIST.Text = "Sold " + cboCateg.Text + " from " + dfrom + " to " + dto; query = "SELECT P.PROCODE AS [ProductCode],DATEVALUE(DATEOUT) AS [TransactionDate], (PRONAME + ' ' + PRODESC) AS [Product],PROPRICE AS [Price],OUTQTY AS [Quantity],(ROUND(OUTQTY * PROPRICE)) AS [TotalPrice] " + " FROM tblStockOut AS S, tblProductInfo AS P " + " WHERE S.PROCODE=P.PROCODE AND DATEVALUE(DATEOUT) BETWEEN #" + dfrom + "# AND #" + dto + "# AND CATEGORY ='" + cboCateg.Text + "' AND PRONAME LIKE '%" + txtSearch.Text + "%'"; config.Load_DTG(query, dtglist); } } private void BTNSEARCHGRID_Click(object sender, EventArgs e) { RDOCLEAR("Transaction", rdoProduct); LBLLIST.Text = "List of Products (" + cboCateg.Text + ")"; RDOSELECT(rdoProduct); } private void btnClose_Click(object sender, EventArgs e) { this.Close(); } private void btnpreview_Click(object sender, EventArgs e) { Form frm = new frmPrint(LBLLIST.Text, cboCateg.Text, dtpFrom.Text, dtpTo.Text, txtSearch.Text , rdoToday, rdoWeekly, rdoMonthly, rdoStockIn, rdoStockOut, rdoProduct); frm.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 |
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 BakeryInventorySystem { public partial class frmListofProducts : Form { public frmListofProducts() { InitializeComponent(); } SQLConfig config = new SQLConfig(); usableFunction func = new usableFunction(); string sql; int maxrow; private void btnNew_Click(object sender, EventArgs e) { Form frm = new frmProduct(); frm.ShowDialog(); } public void refresh() { sql = "SELECT PROCODE as [ProductCode], (PRONAME + ' ' + PRODESC) AS [Product],CATEGORY AS [Category], (PROPRICE) AS [Price],PROQTY AS [Quantity] FROM tblProductInfo"; config.Load_DTG(sql, DTGLIST); } private void btnRefresh_Click(object sender, EventArgs e) { sql = "SELECT PROCODE as [ProductCode], (PRONAME + ' ' + PRODESC) AS [Product],CATEGORY AS [Category], (PROPRICE) AS [Price],PROQTY AS [Quantity] FROM tblProductInfo"; config.Load_DTG(sql, DTGLIST); } private void Button1_Click(object sender, EventArgs e) { this.Close(); } private void btnDelete_Click(object sender, EventArgs e) { sql = "DELETE * FROM tblStockIn WHERE PROCODE = '" + DTGLIST.CurrentRow.Cells[0].Value + "'"; config.Execute_Query(sql); sql = "DELETE * FROM tblStockOut WHERE PROCODE = '" + DTGLIST.CurrentRow.Cells[0].Value + "'"; config.Execute_Query(sql); sql = "DELETE * FROM tblProductInfo WHERE PROCODE = '" + DTGLIST.CurrentRow.Cells[0].Value + "'"; config.Execute_CUD(sql, "Failed to delete", "Product has been deleted."); } private void btnEdit_Click(object sender, EventArgs e) { Form frm = new frmEditProduct(DTGLIST.CurrentRow.Cells[0].Value.ToString(),this); frm.ShowDialog(); } private void frmListofProducts_Load(object sender, EventArgs e) { btnRefresh_Click(sender, e); } private void TXTSEARCH_TextChanged(object sender, EventArgs e) { DTGLIST.Columns.Clear(); sql = "SELECT PROCODE as [ProductCode], (PRONAME + ' ' + PRODESC) AS [Product],CATEGORY AS [Category], (PROPRICE) AS [Price],PROQTY AS [Quantity] FROM tblProductInfo WHERE (PROCODE + ' ' + PRONAME + ' ' + PRODESC + ' ' + CATEGORY) LIKE '%" + TXTSEARCH.Text + "%'"; config.Load_DTG(sql, DTGLIST); } } } |