private void dGDonHang_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { DonHang.madon = Int16.Parse(dGDonHang.CurrentRow.Cells[0].Value.ToString()); Thanhtoan._addThanhtoan(dGDonHang.CurrentRow.Cells[0].Value.ToString()); ThanhToanHD tt = new ThanhToanHD(); tt.Show(); }
private void ThanhToanHD_Load(object sender, EventArgs e) { DataTable dt = Thanhtoan._getThongtin(DonHang.madon.ToString()); DataTable dt1 = Thanhtoan._getThoiGiancho(DonHang.madon.ToString()); lbHD.Text = dt.Rows[0][0].ToString(); LBKH.Text = dt.Rows[0][1].ToString(); lbDH.Text = dt.Rows[0][2].ToString(); lbLH.Text = dt.Rows[0][3].ToString(); lbKL.Text = dt.Rows[0][4].ToString(); lbDC.Text = dt.Rows[0][5].ToString(); lbTT.Text = dt.Rows[0][6].ToString(); lbTGDI.Text = dt.Rows[0][7].ToString(); lbTGC.Text = dt1.Rows[0][0].ToString(); lbGuiQD.Text = dt1.Rows[0][1].ToString(); lbCanTra.Text = (Int32.Parse(lbTT.Text) + Int32.Parse(lbTT.Text) * 0.1 - Int32.Parse(lbDC.Text)).ToString(); }
public void Menu013() { Console.Clear(); Orders o1 = new Orders(); o1.BooksList = new List <OrderDetails>(); OrderDetails od = new OrderDetails(); o1.BooksList.Add(od); List <Orders> lo = new List <Orders>(); lo = order.GetAllOrderInDay(); if (lo == null || lo.Count == 0) { Console.Clear(); Console.Write("-Chưa có hóa đơn được tạo trong ngày hôm nay ! Bấm phím bất kỳ để quay lại...."); Console.ReadKey(); Menu010(); } Employees ebl = new Employees(); Console.WriteLine("======================================================================================================="); Console.WriteLine(" +++ CỬA HÀNG SÁCH TG +++ \n"); Console.WriteLine("-------------------------------------------------------------------------------------------------------"); Console.WriteLine("Lịch sử giao dịch:"); Console.WriteLine("================================================================================"); Console.WriteLine("| Mã hóa đơn | Người tạo | Thời gian tạo | Tổng tiền |"); Console.WriteLine("| ---------- --------- ------------- --------- |"); decimal ttn = 0; foreach (var item in lo) { string id_b = "| BL" + item.ID_Order + new string(' ', 10 - item.ID_Order.ToString().Length); ebl = employee.GetEmployeeByID(item.ID_E.ID_E); string name = " " + ebl.full_name + new string(' ', 20 - ebl.full_name.Length); string time = " " + string.Format("{0:dd/MM/yyyy hh:mm tt}", item.creation_time) + new string(' ', 20 - string.Format("{0:dd/MM/yyyy hh:mm tt}", item.creation_time).ToString().Length); decimal tongtien = 0; lo = order.GetOrderByID(item.ID_Order); foreach (var item1 in lo) { for (int i = 0; i < item1.BooksList.Count; i++) { tongtien = tongtien + item1.BooksList[i].book.unit_price; } } string tt = " " + string.Format("{0:0,0}", tongtien) + new string(' ', 16 - string.Format("{0:0,0}", tongtien).ToString().Length) + "VNĐ"; Console.WriteLine(id_b + "|" + name + "|" + time + "|" + tt + "|"); ttn = ttn + tongtien; } Console.WriteLine("================================================================================\n"); Console.WriteLine("TỔNG THU NHẬP ({0}) : {1} VNĐ", string.Format("{0:dd/MM/yyyy}", lo[0].creation_time), string.Format("{0:0,0}", ttn)); Console.WriteLine("-------------------------------------------------------------------------------------------------------\n"); Console.WriteLine("BL0 .Quay lại"); Console.WriteLine("-------------------------------------------------------------------------------------------------------\n"); Console.Write("#Chọn: BL"); string id = Console.ReadLine(); if (id == "0") { Menu010(); } int a = TryParse(id); if (order.GetOrderByID(a) != null && a > 0) { Console.Clear(); lo = order.GetOrderByID(TryParse(id)); Console.WriteLine("======================================================================================================="); Console.WriteLine(" CỬA HÀNG SÁCH TG \n"); Console.WriteLine("-------------------------------------------------------------------------------------------------------"); Console.WriteLine(" Ngày bán: " + new string(' ', 20 - string.Format("{0:dd/MM/yyyy hh:mm tt}", lo[0].creation_time).ToString().Length) + string.Format("{0:dd/MM/yyyy hh:mm tt}", lo[0].creation_time)); Console.WriteLine(" ***HÓA ĐƠN BÁN HÀNG*** "); Console.WriteLine("- Mã hóa đơn : BL{0}", id); Console.WriteLine("- Người bán : " + employee.GetEmployeeByID(lo[0].ID_E.ID_E).full_name); Console.WriteLine("========================================================================================================="); Console.WriteLine("| Mã sách | Tên sách | Tên tác giả | Đơn giá | SL | Thành tiền |"); Console.WriteLine("| ------- -------- ----------- ------- -- ---------- |"); decimal tt = 0; foreach (var item in lo) { for (int i = 0; i < item.BooksList.Count; i++) { string id_book = "| MN" + item.BooksList[i].book.ID_Book + new string(' ', 7 - item.BooksList[i].book.ID_Book.ToString().Length); string name = " " + book.GetBookById(item.BooksList[i].book.ID_Book).book_title + new string(' ', 24 - book.GetBookById(item.BooksList[i].book.ID_Book).book_title.Length); string author = " " + book.GetBookById(item.BooksList[i].book.ID_Book).author + new string(' ', 25 - book.GetBookById(item.BooksList[i].book.ID_Book).author.Length); string dongia = " " + string.Format("{0:0,0}", item.BooksList[i].book.unit_price / Convert.ToDecimal(item.BooksList[i].quantity)) + new string(' ', 9 - string.Format("{0:0,0}", item.BooksList[i].book.unit_price / Convert.ToDecimal(item.BooksList[i].quantity)).ToString().Length) + "VNĐ"; string sl = " " + item.BooksList[i].quantity + new string(' ', 5 - item.BooksList[i].quantity.ToString().Length); string thanhtien = " " + string.Format("{0:0,0}", item.BooksList[i].book.unit_price) + new string(' ', 14 - string.Format("{0:0,0}", item.BooksList[i].book.unit_price).ToString().Length) + "VNĐ"; Console.WriteLine(id_book + "|" + name + "|" + author + "|" + dongia + "|" + sl + "|" + thanhtien + "|"); tt = tt + item.BooksList[i].book.unit_price; } } Console.WriteLine("========================================================================================================="); string _tt = string.Format("{0:0,0}", tt) + new string(' ', 16 - string.Format("{0:0,0}", tt).ToString().Length) + "VNĐ"; Console.WriteLine(" Tổng tiền: " + _tt); Console.WriteLine("-----------------------------------------Hẹn gặp lại !!!-------------------------------------------------\n"); Console.Write("Bấm phím bất kỳ để quay lại......"); Console.ReadKey(); Menu013(); } else { Console.WriteLine("- Mã hóa đơn bạn nhập không tồn tại !"); for (; ;) { Console.WriteLine("1. Nhập lại"); Console.WriteLine("2. Thoát\n"); Console.Write("#Chọn: "); string chon = Console.ReadLine(); if (chon == "1") { Menu013(); break; } else if (chon == "2") { Menu010(); break; } else { Console.Clear(); Console.WriteLine("- Ký tự bạn nhập không đúng !"); } } } }
private void button2_Click(object sender, EventArgs e) { Thanhtoan._updateThanhToan(DonHang.madon.ToString(), textBox1.Text, lbtraLai.Text); }