private void Frm_onAdd(object sender, EventArgs e) { Bill bill = BillDAL.Instance.GetBillByID(BillDAL.Instance.GetMAXIDBill()); ItemInBill item = new ItemInBill(bill.ID, bill.CheckOut, bill.StaffID, StaffDAL.Instance.GetNamebyID(bill.StaffID), bill.NOTE, Math.Abs(bill.Total), true); this.flowLayoutPanelBill.Controls.Add(item); this.SetBackGround(); this.SizeChange(); this.cbSearch.SelectedIndex = 0; this.SearchAllNote(); }
private void LoadBill() { flowLayoutPanelBill.Controls.Clear(); List <Bill> bills = BillDAL.Instance.LoadBill(); Income = Spend = 0; bool setcolor = true; foreach (Bill bill in bills) { if (setcolor) { setcolor = false; } else { setcolor = true; } string StaffName = StaffDAL.Instance.GetNamebyID(bill.StaffID); ItemInBill item = new ItemInBill(bill.ID, bill.CheckOut, bill.StaffID, StaffName, bill.NOTE, Math.Abs(bill.Total), setcolor); if (bill.Total < 0) { Spend += bill.Total; } else { Income += bill.Total; } item.Tag = bill; flowLayoutPanelBill.Controls.Add(item); } Spend *= -1; lbTotalIncome.Text = string.Format("{0:n0}", Income).ToString(); lbTotalSpend.Text = string.Format("{0:n0}", Spend).ToString(); SizeChange(); }