Example #1
0
        public void DoanhThuNgay() // doanh thu xe theo ngày
        {
            int s = 0;

            Console.Write("Nhập ngày cần thống kê:");
            string         timeTk = Console.ReadLine();
            List <ThongKe> listKt = new List <ThongKe>();

            foreach (VeXe ve in lstQuanLyVeXe)
            {
                if (ve.Tg != timeTk)
                {
                    continue;
                }
                ThongKe kt = null;
                if ((kt = KiemTraBienSo(ve.Xe.BienSoXe, listKt)) != null)
                {
                    kt.SoLuongVe += ve.SoLuongBan;
                    kt.SoLuongVe += TongTienVe(ve);
                    s            += TongTienVe(ve);
                }
                else
                {
                    listKt.Add(new ThongKe(ve.Xe, ve.SoLuongBan, TongTienVe(ve)));
                    s += TongTienVe(ve);
                }
            }
            Console.WriteLine("Ngày     " + timeTk);
            Console.WriteLine("Biển số xe   Số lượng    Tổng tiền");
            foreach (ThongKe tk in listKt)
            {
                Console.WriteLine(tk.xe.BienSoXe + "    " + tk.SoLuongVe + "    " + tk.TongTien);
            }
            Console.WriteLine("Tổng     " + s);
        }
Example #2
0
        public void doanhthuthang() // thống kê doanh thu xe theo tháng
        {
            int s = 0;

            Console.Write("Nhập tháng cần thống kê:");
            string         timeTk = Console.ReadLine();
            List <ThongKe> listKt = new List <ThongKe>();

            foreach (VeXe ve in lstQuanLyVeXe)
            {
                string[] tmp1 = timeTk.Split('/');
                string[] tmp2 = ve.Tg.Split('/');
                if (tmp1[0] != tmp2[1] || tmp1[1] != tmp2[2])
                {
                    continue;
                }

                ThongKe kt = null;
                if ((kt = KiemTraBienSo(ve.Xe.BienSoXe, listKt)) != null)
                {
                    kt.SoLuongVe += ve.SoLuongBan;
                    kt.SoLuongVe += TongTienVe(ve);
                    s            += TongTienVe(ve);
                }
                else
                {
                    listKt.Add(new ThongKe(ve.Xe, ve.SoLuongBan, TongTienVe(ve)));
                    s += TongTienVe(ve);
                }
            }
            Console.WriteLine("Tháng     " + timeTk);
            Console.WriteLine("Biển số xe   Số lượng    Tổng tiền");
            foreach (ThongKe tk in listKt)
            {
                Console.WriteLine(tk.xe.BienSoXe + "    " + tk.SoLuongVe + "    " + tk.TongTien);
            }
            Console.WriteLine("Tổng     " + s);
        }