private void initSpecial(String name, Color cor, String ordspecialid) { Panel pnCri1 = new Panel(); C1PictureBox picSelect = new C1PictureBox(); C1Label lbFoot1 = new C1Label(); C1Label lbFoot2 = new C1Label(); C1Label lbID = new C1Label(); pnCri1.BackColor = Color.FromArgb(255, 209, 81); pnCri1.Dock = System.Windows.Forms.DockStyle.Top; //pnCri1.Location = new System.Drawing.Point(0, 85); pnCri1.Size = new System.Drawing.Size(390, 47); pnCri1.Name = "pnCri" + cnt; pnCri1.BorderStyle = BorderStyle.FixedSingle; pnCri1.BackColor = cor; if (mposC.iniC.ucOrderTakeOutpnToppingBorderStyle.Equals("0")) { pnCri1.BorderStyle = BorderStyle.None; } else if (mposC.iniC.ucOrderTakeOutpnToppingBorderStyle.Equals("1")) { pnCri1.BorderStyle = BorderStyle.FixedSingle; } else if (mposC.iniC.ucOrderTakeOutpnToppingBorderStyle.Equals("1")) { pnCri1.BorderStyle = BorderStyle.Fixed3D; } pnCri1.Click += PicSpecSelect_Click; picSelect.Image = global::modernpos_pos.Properties.Resources.circle_png_circle_icon_1600; picSelect.Location = new System.Drawing.Point(4, 8); picSelect.Name = "picSelect" + cnt; picSelect.Size = new System.Drawing.Size(32, 32); picSelect.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; picSelect.TabStop = false; picSelect.Click += PicSpecSelect_Click; lbFoot1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(209)))), ((int)(((byte)(81))))); lbFoot1.BorderStyle = System.Windows.Forms.BorderStyle.None; lbFoot1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); lbFoot1.Location = new System.Drawing.Point(40, 8); lbFoot1.Name = "lbFoot1" + cnt; lbFoot1.Size = new System.Drawing.Size(232, 31); lbFoot1.TabIndex = 6; lbFoot1.Tag = null; lbFoot1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; lbFoot1.Value = name; lbFoot1.BackColor = cor; lbFoot1.Click += PicSpecSelect_Click; lbFoot2.Name = "lbFoot12" + cnt; lbFoot2.Visible = false; lbID.Visible = false; lbID.Value = ordspecialid; lbID.Name = "lbOrdSpecID" + cnt; pnCri1.Controls.Add(picSelect); pnCri1.Controls.Add(lbFoot1); pnCri1.Controls.Add(lbFoot2); pnCri1.Controls.Add(lbID); tpl.Controls.Add(pnCri1, 0, tpl.RowCount++); }
private void setPrice() { decimal sum = 0, fooprice = 0, fooqty = 0, foosum = 0, pricetogo = 0; if (decimal.TryParse(foo.foods_price, out fooprice)) { if (decimal.TryParse(lbQty.Text, out fooqty)) { // foosum = fooprice * fooqty; } } for (int i = 0; i < lfoot.Count; i++) { decimal price = 0; int qty = 0; String name = "", cnt = ""; Panel pn = (Panel)tpl.Controls["pnCri" + i]; if (pn == null) { continue; } C1Label lbQtyTopping = new C1Label(); C1Label lbPriceTopping = new C1Label(); cnt = pn.Name.Replace("pnCri", ""); lbQtyTopping = (C1Label)pn.Controls["lbQtyTopping" + cnt]; lbPriceTopping = (C1Label)pn.Controls["lbPriceTopping" + cnt]; if (int.TryParse(lbQtyTopping.Text, out qty)) { if (decimal.TryParse(lbPriceTopping.Text, out price)) { sum += (price * qty); } } } decimal.TryParse(ord.price_plus_togo, out pricetogo); foosum = (fooprice + sum + pricetogo) * fooqty; /* เป็นการคิดราคากล่อง แบบ บวกราคากล่อง ตอนท้ายรายการ * if (statusTogo) * { * decimal.TryParse(ord.price_plus_togo, out pricetogo); * foosum += pricetogo; * } */ //sum = foosum + sum; lbPrice.Value = foosum.ToString("#,###.00"); ord.sumPrice = lbPrice.Text; //ord.toppingPrice = setBill(); }
private void PicMinusTopping_Click1(object sender, EventArgs e) { //throw new NotImplementedException(); String name = "", cnt = ""; Panel pn = new Panel(); C1Label lbQtyTopping = new C1Label(); C1Label lbID = new C1Label(); C1PictureBox pic = (C1PictureBox)sender; cnt = pic.Name.Replace("picMinusTopping", ""); pn = (Panel)tpl.Controls["pnCri" + cnt]; lbQtyTopping = (C1Label)pn.Controls["lbQtyTopping" + cnt]; lbID = (C1Label)pn.Controls["lbOrdTopping" + cnt]; if (lbQtyTopping.Text.Equals("")) { return; } int chk = 0; if (int.TryParse(lbQtyTopping.Text, out chk)) { if (chk <= 0) { return; } chk--; lbQtyTopping.Value = chk.ToString(); //qty = chk.ToString(); } foreach (OrderTopping ordt in lordt) { if (ordt.foods_topping_id.Equals(lbID.Text)) { ordt.status_ok = "1"; ordt.qty = lbQtyTopping.Text; //ordt.price = ""; break; } } setPrice(); }
private void initTopping(String name, String price, Color cor, String footoppingid) { Panel pnCri1 = new Panel(); C1PictureBox picTrah = new C1PictureBox(); C1PictureBox picMinus = new C1PictureBox(); C1Label lbQty = new C1Label(); C1PictureBox picPlus = new C1PictureBox(); C1Label lbFoot1 = new C1Label(); C1Label lbPrice = new C1Label(); C1Label lbID = new C1Label(); //pnCri1.BackColor = ColorTranslator.FromHtml(mposC.iniC.TileFoodsBackColor); //pnCri1.BackColor = ColorTranslator.FromHtml(mposC.iniC.ucOrderTakeOutpnHeadBackColor); pnCri1.Dock = System.Windows.Forms.DockStyle.Top; //pnCri1.Location = new System.Drawing.Point(0, 85); pnCri1.Size = new System.Drawing.Size(390, 47); pnCri1.Name = "pnCri" + cnt; if (mposC.iniC.ucOrderTakeOutpnToppingBorderStyle.Equals("0")) { pnCri1.BorderStyle = BorderStyle.None; } else if (mposC.iniC.ucOrderTakeOutpnToppingBorderStyle.Equals("1")) { pnCri1.BorderStyle = BorderStyle.FixedSingle; } else if (mposC.iniC.ucOrderTakeOutpnToppingBorderStyle.Equals("1")) { pnCri1.BorderStyle = BorderStyle.Fixed3D; } pnCri1.BackColor = cor; picTrah.Image = global::modernpos_pos.Properties.Resources.exit; picTrah.Location = new System.Drawing.Point(360, 8); picTrah.Name = "picTrahTopping" + cnt; picTrah.Size = new System.Drawing.Size(32, 32); picTrah.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; picTrah.TabStop = false; //picMinus.Image = global::modernpos_pos.Properties.Resources.minus_red; picMinus.Image = global::modernpos_pos.Properties.Resources.minus; picMinus.Location = new System.Drawing.Point(241, 8); picMinus.Name = "picMinusTopping" + cnt; picMinus.Size = new System.Drawing.Size(32, 32); picMinus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; picMinus.TabIndex = 10; picMinus.TabStop = false; lbQty.BackColor = System.Drawing.SystemColors.MenuHighlight; lbQty.BorderStyle = System.Windows.Forms.BorderStyle.None; lbQty.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); lbQty.Location = new System.Drawing.Point(276, 8); lbQty.Name = "lbQtyTopping" + cnt; lbQty.Size = new System.Drawing.Size(49, 32); lbQty.TabIndex = 12; lbQty.Tag = null; lbQty.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; //picPlus.Image = global::modernpos_pos.Properties.Resources.plus_green_100; picPlus.Image = global::modernpos_pos.Properties.Resources.plus; picPlus.Location = new System.Drawing.Point(327, 8); picPlus.Name = "picPlusTopping" + cnt; picPlus.Size = new System.Drawing.Size(32, 32); picPlus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; picPlus.TabIndex = 11; picPlus.TabStop = false; //lbFoot1.BackColor = ColorTranslator.FromHtml(mposC.iniC.ucOrderTakeOutpnHeadBackColor); lbFoot1.BorderStyle = System.Windows.Forms.BorderStyle.None; lbFoot1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); lbFoot1.Location = new System.Drawing.Point(4, 8); lbFoot1.Name = "lbFootTopping" + cnt; lbFoot1.Size = new System.Drawing.Size(232, 31); lbFoot1.TabIndex = 6; lbFoot1.Tag = null; lbFoot1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; lbFoot1.Value = name; lbFoot1.BackColor = cor; picMinus.Click += PicMinusTopping_Click1; picPlus.Click += PicPlusTopping_Click1; picTrah.Click += PicTrahTopping_Click; lbPrice.Name = "lbPriceTopping" + cnt; lbPrice.Visible = false; lbPrice.Value = price; lbID.Value = footoppingid; lbID.Visible = false; lbID.Name = "lbOrdTopping" + cnt; pnCri1.Controls.Add(picTrah); pnCri1.Controls.Add(picMinus); pnCri1.Controls.Add(lbQty); pnCri1.Controls.Add(picPlus); pnCri1.Controls.Add(lbFoot1); pnCri1.Controls.Add(lbPrice); pnCri1.Controls.Add(lbID); //Padding padding = pnCri1.Padding; picTrah.Visible = false; tpl.Controls.Add(pnCri1, 0, tpl.RowCount++); }
private void PicSpecSelect_Click(object sender, EventArgs e) { //throw new NotImplementedException(); String name = "", cnt = ""; C1Label lbFoot1 = new C1Label(); C1Label lbFoot12 = new C1Label(); C1Label lbID = new C1Label(); C1PictureBox picSelect = new C1PictureBox(); if (sender is C1Label) { lbFoot1 = (C1Label)sender; cnt = lbFoot1.Name.Replace("lbFoot1", ""); Panel pn = new Panel(); pn = (Panel)tpl.Controls["pnCri" + cnt]; picSelect = (C1PictureBox)pn.Controls["picSelect" + cnt]; lbFoot12 = (C1Label)pn.Controls["lbFoot12" + cnt]; lbID = (C1Label)pn.Controls["lbOrdSpecID" + cnt]; } else if (sender is C1PictureBox) { picSelect = (C1PictureBox)sender; cnt = picSelect.Name.Replace("picSelect", ""); lbFoot1 = new C1Label(); Panel pn = new Panel(); pn = (Panel)tpl.Controls["pnCri" + cnt]; lbFoot12 = (C1Label)pn.Controls["lbFoot12" + cnt]; lbID = (C1Label)pn.Controls["lbOrdSpecID" + cnt]; } else if (sender is Panel) { Panel pn = (Panel)sender; cnt = pn.Name.Replace("pnCri", ""); lbFoot1 = new C1Label(); lbFoot1 = (C1Label)pn.Controls["lbFoot1" + cnt]; lbFoot12 = (C1Label)pn.Controls["lbFoot12" + cnt]; picSelect = (C1PictureBox)pn.Controls["picSelect" + cnt]; lbID = (C1Label)pn.Controls["lbOrdSpecID" + cnt]; } if (lbFoot12.Text.Equals("NO")) { picSelect.Image = global::modernpos_pos.Properties.Resources.images; //ord.foods_name = ord.foods_name + " 11111111"; lbFoot12.Value = "YES"; foreach (OrderSpecial ords in lords) { if (ords.foods_spec_id.Equals(lbID.Text)) { ords.status_ok = "1"; break; } } } else if (lbFoot12.Text.Equals("YES")) { picSelect.Image = global::modernpos_pos.Properties.Resources.circle_png_circle_icon_1600; //ord.foods_name = ""; lbFoot12.Value = "NO"; foreach (OrderSpecial ords in lords) { if (ords.foods_spec_id.Equals(lbID.Text)) { ords.status_ok = "0"; break; } } } else { picSelect.Image = global::modernpos_pos.Properties.Resources.images; lbFoot12.Value = "YES"; foreach (OrderSpecial ords in lords) { if (ords.foods_spec_id.Equals(lbID.Text)) { ords.status_ok = "1"; break; } } } }