private void advTree1_NodeClick(object sender, DevComponents.AdvTree.TreeNodeMouseEventArgs e)
        {
            List <OrderDetails> listOrderDetails = objOrderDetails.SelectAll();

            if (e.Node.Name.Contains("Produt_"))
            {
                this.listViewEx1.Items.Clear();
                int   ProductId = int.Parse(e.Node.Name.Split('_')[1]);
                int   STT       = 0;
                float TongTien  = 0;
                for (int i = 0; i < listOrderDetails.Count; i++)
                {
                    if (listOrderDetails[i].ProductID == ProductId)
                    {
                        STT++;
                        ListViewItem item = new ListViewItem(STT.ToString());
                        item.SubItems.Add(listOrderDetails[i].OrderID.ToString());
                        item.SubItems.Add(listOrderDetails[i].Quantity.ToString());
                        item.SubItems.Add(Converts.ChuyenDoiTienTeVietNam(listOrderDetails[i].UnitPrice));
                        item.SubItems.Add(Converts.ChuyenDoiTienTeVietNam(listOrderDetails[i].SubTotal));
                        this.listViewEx1.Items.Add(item);
                        TongTien += listOrderDetails[i].SubTotal;
                    }
                }
                this.lblThongKE.Text = "Tổng số lượng bán  ra : " + STT + " , giúp thu vào : " + Converts.ChuyenDoiTienTeVietNam(TongTien);
            }
        }
Exemple #2
0
 public void LoadList(int ID)
 {
     IDBanDangChon = ID;
     listOrder     = Orders.GetOrderByTableID(IDBanDangChon);
     this.Text     = "In bill bàn : " + IDBanDangChon;
     this.listView_CacMonDaGoi.Items.Clear();
     this.listView_CacMonDaGoi.Items.Clear();
     for (int i = 0; i < listOrder.Count; i++)
     {
         int STT = 1;
         listOrderDetail = OrderDetails.GetByOrderID(listOrder[i].OrderID);
         for (int j = 0; j < listOrderDetail.Count; j++)
         {
             ListViewItem item = new ListViewItem(STT.ToString());
             item.SubItems.Add(listOrderDetail[j].Name);
             item.SubItems.Add(listOrderDetail[j].Quantity.ToString());
             item.SubItems.Add(Converts.ChuyenDoiTienTeVietNam(listOrderDetail[j].UnitPrice));
             item.SubItems.Add(Converts.ChuyenDoiTienTeVietNam(listOrderDetail[j].SubTotal));
             item.SubItems.Add(Converts.ChuyenDoiTienTeVietNam(listOrderDetail[j].Discount));
             item.SubItems.Add(Converts.ChuyenDoiTienTeVietNam(listOrderDetail[j].SubTotal));
             item.SubItems.Add(listOrderDetail[j].ProductID.ToString());
             item.SubItems.Add(listOrderDetail[j].OrderDetailsID.ToString());
             this.listView_CacMonDaGoi.Items.Add(item);
             STT++;
         }
     }
 }
        private void ThongKe()
        {
            listViewEx1.Items.Clear();
            if (cbbNam.SelectedItem != null)
            {
                int           Thang = slider1.Value;
                int           Nam   = int.Parse(cbbNam.SelectedItem.ToString());
                List <Orders> L     = objOrders.SelectAll();
                int           count = 1;

                int  SLmonan  = 0;
                long tongTien = 0;
                foreach (Orders c in L)
                {
                    if (c.DateCreated.Year == Nam && c.DateCreated.Month == Thang)
                    {
                        List <OrderDetails> L1 = OrderDetails.GetByOrderID(c.OrderID);

                        foreach (OrderDetails c1 in L1)
                        {
                            if (c1.OrderID == c.OrderID)
                            {
                                ListViewItem Item = listViewEx1.Items.Add(count.ToString());
                                count++;

                                SLmonan++;
                                Products TD = Products.FindByID(c1.ProductID);
                                Item.SubItems.Add(TD.Name);

                                Item.SubItems.Add(c1.Quantity.ToString());
                                Item.SubItems.Add(Converts.ChuyenDoiTienTeVietNam(c1.UnitPrice));
                                Item.SubItems.Add(Converts.ChuyenDoiTienTeVietNam(c1.SubTotal));
                                //MessageBox.Show(tongTien.ToString());
                                tongTien += (long)c1.SubTotal;
                            }
                        }
                    }
                }

                if (tongTien != 0)
                {
                    ListViewItem Item1 = listViewEx1.Items.Add(" ");
                    Item1.SubItems.Add("");
                    Item1.SubItems.Add("");
                    ListViewItem.ListViewSubItem sub = Item1.SubItems.Add("Tổng ");
                    sub.ForeColor = Color.Blue;
                    sub.Font      = new Font(new FontFamily("Tahoma"), 10f, FontStyle.Bold);
                    ListViewItem.ListViewSubItem sub1 = Item1.SubItems.Add(Converts.ChuyenDoiTienTeVietNam(tongTien));
                    sub1.ForeColor = Color.Blue;
                    sub1.Font      = new Font(new FontFamily("Tahoma"), 10f, FontStyle.Bold);
                }
            }
        }
 private void txt_ThueVAT_Leave(object sender, EventArgs e)
 {
     if ((sender as TextEdit).Name == "txt_ThueVAT")
     {
         this.txt_ThueVAT.Text = Converts.ChuyenDoiTienTeVietNam(float.Parse(this.txt_ThueVAT.Text));
     }
     if ((sender as TextEdit).Name == "txt_PhiDichVu")
     {
         this.txt_PhiDichVu.Text = Converts.ChuyenDoiTienTeVietNam(float.Parse(this.txt_PhiDichVu.Text));
     }
     if ((sender as TextEdit).Name == "txt_GiamGia")
     {
         this.txt_GiamGia.Text = Converts.ChuyenDoiTienTeVietNam(float.Parse(this.txt_GiamGia.Text));
     }
 }
 private void Load_ThanhTOan()
 {
     if (this.listView_CacMonDaGoi.Items.Count != 0)
     {
         float TongTien = 0;
         for (int i = 0; i < this.listView_CacMonDaGoi.Items.Count; i++)
         {
             TongTien += Converts.ReturnFloat(this.listView_CacMonDaGoi.Items[i].SubItems[4].Text);
         }
         this.txt_ThanhTien.Text = Converts.ChuyenDoiTienTeVietNam(TongTien);
         try
         {
             this.txt_TongTien.Text = Converts.ChuyenDoiTienTeVietNam((TongTien + float.Parse(txt_ThueVAT.Text) + float.Parse(txt_PhiDichVu.Text) - float.Parse(txt_GiamGia.Text)));
         }
         catch (Exception ex)
         {
             txt_TongTien.Text = ex.Message;
         }
     }
 }
Exemple #6
0
        private void cmdOK_Click(object sender, EventArgs e)
        {
            this.listViewEx1.Items.Clear();
            DateTime Time = DateTime.Now;

            if (rdHomNay.Checked)
            {
                Time = DateTime.Now;
            }
            if (rdHomQua.Checked)
            {
                Time = Time.AddDays(-1);
            }
            if (rdNgayKhac.Checked)
            {
                Time = this.dateNavigator_Ngay.DateTime;
            }
            ListOrder = objOrder.SelectAll();
            int   STT      = 0;
            float TongTien = 0;

            for (int i = 0; i < ListOrder.Count; i++)
            {
                if (ListOrder[i].DateCreated.ToShortDateString() == Time.ToShortDateString())
                {
                    ListViewItem item = new ListViewItem(STT.ToString());
                    item.SubItems.Add(ListOrder[i].OrderID.ToString());
                    item.SubItems.Add(ListOrder[i].DateCreated.ToShortTimeString());
                    item.SubItems.Add(ListOrder[i].UserName);
                    item.SubItems.Add(Converts.ChuyenDoiTienTeVietNam(ListOrder[i].TotalMoney));
                    TongTien += ListOrder[i].TotalMoney;
                    this.listViewEx1.Items.Add(item);
                    STT++;
                }
            }
            this.lblThongKe.Text = "Số bàn : " + STT + " , thu về được : " + Converts.ChuyenDoiTienTeVietNam(TongTien);
        }
 private void txt_ThueVAT_EditValueChanged(object sender, EventArgs e)
 {
     if (this.listView_CacMonDaGoi.Items.Count != 0)
     {
         float TongTien = 0;
         for (int i = 0; i < this.listView_CacMonDaGoi.Items.Count; i++)
         {
             TongTien += float.Parse(this.listView_CacMonDaGoi.Items[i].SubItems[4].Text);
         }
         this.txt_ThanhTien.Text = Converts.ChuyenDoiTienTeVietNam(TongTien);
         try
         {
             this.txt_TongTien.Text     = Converts.ChuyenDoiTienTeVietNam(TongTien + Converts.ReturnFloat(txt_ThueVAT.Text) + Converts.ReturnFloat(txt_PhiDichVu.Text) - Converts.ReturnFloat(txt_GiamGia.Text));
             this.btn_InBill.Enabled    = true;
             this.btn_ThanhToan.Enabled = true;
         }
         catch
         {
             txt_TongTien.Text          = "Thông tin đầu vào sai";
             this.btn_InBill.Enabled    = false;
             this.btn_ThanhToan.Enabled = false;
         }
     }
 }
 private void LoadListView_CacMonDaChon()
 {
     this.listView_CacMonDaGoi.Items.Clear();
     listOrder = Orders.GetOrderByTableID(IDBanDangChon);
     this.listView_CacMonDaGoi.Items.Clear();
     for (int i = 0; i < listOrder.Count; i++)
     {
         int STT = 1;
         listOrderDetail = OrderDetails.GetByOrderID(listOrder[i].OrderID);
         for (int j = 0; j < listOrderDetail.Count; j++)
         {
             ListViewItem item = new ListViewItem(STT.ToString());
             item.SubItems.Add(listOrderDetail[j].Name);
             item.SubItems.Add(listOrderDetail[j].Quantity.ToString());
             item.SubItems.Add(Converts.ChuyenDoiTienTeVietNam(listOrderDetail[j].UnitPrice));
             item.SubItems.Add(Converts.ChuyenDoiTienTeVietNam(listOrderDetail[j].SubTotal));
             item.SubItems.Add(listOrderDetail[j].ProductID.ToString());
             item.SubItems.Add(listOrderDetail[j].OrderDetailsID.ToString());
             this.listView_CacMonDaGoi.Items.Add(item);
             STT++;
         }
     }
     Load_ThanhTOan();
 }