public PayClass(ProductToSellList products, BillList bills, User actualUser, int table, double total) { Products = products; Bills = bills; ActualBill = new Bill(); ActualBill.Total = Products.CalculeTotal(); this.actualUser = actualUser; this.table = table; doTheBill(); ActualBill.Total = total; }
private void DrawProductsToSell() { pnlProductsToSell.Controls.Clear(); this.lblWorker.Text = POS.Employee.Code.ToString("000"); this.lblTableNumber.Text = POS.Index.ToString(); ProductToSellList products = POS.GetProductsToSell(); double subtotal = products.CalculeTotal(); this.lblSubtotal.Text = subtotal.ToString("0.00"); double iva = subtotal * 0.21; POS.Total = subtotal + iva; this.lblVA.Text = iva.ToString("0.00"); this.lblTotal.Text = POS.Total.ToString("0.00"); for (int i = 1; i <= products.Count; i++) { ProductToSell product = products.Get(i); // // lblDescription // Label lblDescription = new Label(); lblDescription.BackColor = System.Drawing.Color.White; lblDescription.BorderStyle = BorderStyle.FixedSingle; lblDescription.FlatStyle = FlatStyle.Popup; lblDescription.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); lblDescription.Location = new System.Drawing.Point(-3, 0); lblDescription.Name = "label " + i; lblDescription.Size = new System.Drawing.Size(138, 33); lblDescription.TabIndex = 51; lblDescription.Text = product.ActualProduct.Description; lblDescription.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; lblDescription.Click += new EventHandler(pnlProductToSell_Click); // // lblPrice // Label lblPrice = new Label(); lblPrice.BackColor = System.Drawing.Color.White; lblPrice.BorderStyle = BorderStyle.FixedSingle; lblPrice.FlatStyle = FlatStyle.Popup; lblPrice.Font = new System.Drawing.Font("Arial", 9.75F); lblPrice.Location = new System.Drawing.Point(135, 0); lblPrice.Name = "label " + i; lblPrice.Size = new System.Drawing.Size(85, 33); lblPrice.TabIndex = 52; lblPrice.Text = product.ActualProduct.Price.ToString(); lblPrice.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; lblPrice.Click += new EventHandler(pnlProductToSell_Click); // // lblAmount // Label lblAmount = new Label(); lblAmount.BackColor = System.Drawing.Color.White; lblAmount.BorderStyle = BorderStyle.FixedSingle; lblAmount.FlatStyle = FlatStyle.Popup; lblAmount.Font = new System.Drawing.Font("Arial", 9.75F); lblAmount.Location = new System.Drawing.Point(220, 0); lblAmount.Name = "label " + i; lblAmount.Size = new System.Drawing.Size(108, 33); lblAmount.TabIndex = 50; lblAmount.Text = product.Amount.ToString(); lblAmount.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; lblAmount.Click += new EventHandler(pnlProductToSell_Click); // // pnlProductToSell // Panel pnlProductToSell = new Panel(); pnlProductToSell.BackColor = System.Drawing.Color.DimGray; pnlProductToSell.BorderStyle = BorderStyle.Fixed3D; pnlProductToSell.Controls.Add(lblAmount); pnlProductToSell.Controls.Add(lblPrice); pnlProductToSell.Controls.Add(lblDescription); pnlProductToSell.ForeColor = System.Drawing.Color.Black; pnlProductToSell.Location = new System.Drawing.Point(0, 0 + ((i - 1) * 33)); pnlProductToSell.Name = "pnlPayProduct"; pnlProductToSell.Size = new System.Drawing.Size(330, 33); pnlProductToSell.TabIndex = 53; pnlProductsToSell.Controls.Add(pnlProductToSell); } }