public AjaxResult PostInvoice(Guid invoiceId) { var ajaxResult = new AjaxResult(); try { using (InvoiceBL invoiceBL = new InvoiceBL()) { var invoice = invoiceBL.GetInvoiceByID(invoiceId); ajaxResult.Data = invoiceBL.MapInvoiceToInvoiceViewModel(invoice); ajaxResult.Success = true; } } catch (Exception) { ajaxResult.Success = false; ajaxResult.Messenger = "Có lỗi xảy ra khi lấy hóa đơn theo id. Vui lòng liên hệ MISA!"; } return(ajaxResult); }
public static void ThongKeStaff() { System.Console.Clear(); System.Console.WriteLine("Thống Kê Hóa Đơn Theo Mã Nhân Viên"); string row2 = "------------------------------------------"; System.Console.WriteLine(row2); decimal doanhthu = 0; staffbl = new StaffBL(); invoicebl = new InvoiceBL(); invoice = new Invoice(); item = new Item(); staff = staffbl.Login(u, pass); var tk = invoicebl.GetInvoiceByID(u); if (tk.Count != 0) { System.Console.WriteLine("Mã Nhân Viên : " + u); System.Console.WriteLine(row2); foreach (var liss in tk) { System.Console.WriteLine("Mã Hóa Đơn : " + liss.invoiceID); System.Console.WriteLine("Ngày Tạo : " + liss.invoiceDate); System.Console.WriteLine(row2); } char c; while (true) { System.Console.WriteLine("Bạn Có Muốn Xem Chi Tiết Từng Hóa Đơn Không ? Y/N"); c = Convert.ToChar(System.Console.ReadLine()); if (c == 'y') { System.Console.Clear(); int id; System.Console.WriteLine("Nhập Vào Mã Hóa Đơn Bạn Muốn Xem "); id = Convert.ToInt16(System.Console.ReadLine()); for (int i = 0; i < tk.Count; i++) { System.Console.Clear(); if (id == tk[i].invoiceID) { var orderdetail = invoicebl.GetInvoiceDetails(id); System.Console.Clear(); System.Console.WriteLine(row2); System.Console.WriteLine("Mã Sản Phẩm ||Tên Sản Phẩm || Số Lượng || Khuyến Mãi || Đơn Giá ||Thành Tiền"); a = 0; foreach (var item in orderdetail.ItemList) { System.Console.WriteLine("{0,-15} {1,-15} {2,-15} {3,-15} {4,-15} {5,-15}", item.itemID, item.itemName, item.amount, item.Promotion, item.unitPrice + ".000 VNĐ", item.total + ".000 VNĐ"); a = a + item.total; } System.Console.WriteLine("Doanh Thu Hóa Đơn " + id + " Là : " + a + ".000 VNĐ"); doanhthu = doanhthu + a; System.Console.WriteLine("Nhấn Phím Bất Kì Để Trở Về Menu Nhân Viên...."); System.Console.ReadKey(); MenuStaff(); } else { System.Console.WriteLine("Không tìm thấy hóa đơn"); System.Console.ReadLine(); ThongKeStaff(); } } } else { MenuStaff(); } } } else { System.Console.WriteLine("Chưa Có Hóa Đơn Cho Nhân Viên Này"); System.Console.WriteLine("Nhấn Phím Bất Kì Để Về Menu Nhân Viên"); System.Console.ReadLine(); MenuStaff(); } }
public void TestGetInvoiceByStaff() { Assert.NotNull(inn.GetInvoiceByID("S111")); }