public void reloadUI() { if(_table == null) { return; } double currentMoneyOfTable = 0; foreach(KeyValuePair<int, Order> entry in OrderManager.getInstance().OrderList) { if(entry.Value != null && entry.Value.TableId == _table.TableId && (entry.Value.MoneyReceive < entry.Value.BillMoney || entry.Value.BillMoney == 0)) { currentMoneyOfTable += (double)(entry.Value.BillMoney - entry.Value.MoneyReceive); } } TextBlockTableId.Text = "Bàn số " + _table.TableId.ToString(); if (currentMoneyOfTable > 0) { ImageState.Source = (ImageSource)GridParent.FindResource("ImageGreenDot"); TextBlockState.Text = "Đang sử dụng"; TextBlockState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF18FA00")); TextBlockMoney.Text = UtilFuction.formatMoney((decimal)currentMoneyOfTable) + " VND"; } else { ImageState.Source = (ImageSource)GridParent.FindResource("ImageGrayDot"); TextBlockState.Text = "Chưa sử dụng"; TextBlockState.Foreground = new SolidColorBrush(Colors.White); TextBlockMoney.Text = "Mở bàn"; } }
private void TextBoxQuantity_TextChanged(object sender, TextChangedEventArgs e) { if (_foodWithOrder == null) { return; } int newQuantity = 0; if (!int.TryParse(TextBoxQuantity.Text, out newQuantity)) { BtnEdit.IsEnabled = false; return; } textBlockTotal.Text = UtilFuction.formatMoney(newQuantity * _foodWithOrder.Food.Price); BtnEdit.IsEnabled = true; if (newQuantity != previousQuantity) { orderInfo.BtnAccept.Visibility = Visibility.Visible; orderInfo.BtnCancel.Visibility = Visibility.Visible; } else { orderInfo.BtnAccept.Visibility = Visibility.Hidden; orderInfo.BtnCancel.Visibility = Visibility.Hidden; } orderInfo.onChangeMoney(); }
private void setupUI() { if (FoodData == null) { return; } TextBlockName.Text = FoodData.FoodId + " - " + FoodData.Name; TextBlockPrice.Text = UtilFuction.formatMoney(FoodData.Price) + " vnđ"; TextBlockCategory.Text = FoodCategorizeManager.getInstance().FoodCategorizeList[FoodData.FoodCategorizeId].Name; }
public void exportBillAsPdf(string path, Order order) { if (order == null) { return; } try { FileStream fs = new FileStream(path + "\\Order" + order.OrderId.ToString() + ".pdf", FileMode.Create); Document document = new Document(PageSize.A4, 25, 25, 30, 30); PdfWriter writer = PdfWriter.GetInstance(document, fs); document.Open(); string orderStr = "Nhà hàng: " + RestaurantInfoManager.getInstance().Info.Name; orderStr += "\n" + "Số điện thoại: " + RestaurantInfoManager.getInstance().Info.Phone; orderStr += "\n" + "Địa chỉ: " + RestaurantInfoManager.getInstance().Info.Address; orderStr += "\n" + "Thời điểm: " + DateTime.Now.ToString("H:mm:ss dd/MM/yyyy"); orderStr += "\n\n" + " Hóa đơn bán hàng "; foreach (FoodWithOrder foodWithOrder in order.FoodWithOrders) { string strFoodName = foodWithOrder.Food.FoodId + "-" + foodWithOrder.Food.Name; string strQuantity = foodWithOrder.Quantities.ToString(); string strFoodPrice = "x " + UtilFuction.formatMoney(foodWithOrder.Food.Price); orderStr += "\n" + strFoodName + UtilFuction.getSpacesFromQuantityChar(50, strFoodName) + strQuantity + UtilFuction.getSpacesFromQuantityChar(10, strQuantity) + strFoodPrice + UtilFuction.getSpacesFromQuantityChar(10, strFoodPrice); } string totalStr = "TỔNG CỘNG: "; orderStr += "\n\n" + totalStr + UtilFuction.getSpacesFromQuantityChar(70, totalStr) + UtilFuction.formatMoney(order.BillMoney); orderStr += "\n\n\n Nếu quý khách có nhu cầu xuất hóa đơn, \n xin liên hệ với chúng tôi trong ngày."; iTextSharp.text.Font font = null; try { var vini = BaseFont.CreateFont("c:/windows/fonts/aachenb.ttf", BaseFont.IDENTITY_H, true); font = new iTextSharp.text.Font(vini, 14); } catch (Exception ex) { } if (font != null) { document.Add(new Paragraph(18, orderStr, font)); } else { document.Add(new Paragraph(16, orderStr, font)); } document.Close(); fs.Close(); } catch (Exception ex) { } }
public void onChangeMoney() { decimal totalMoney = 0; foreach (OrderInfo orderInfo in LVOrderInfo.Items.OfType <OrderInfo>()) { totalMoney += orderInfo.billMoney; } TextBlockTotalAllOrder.Text = "Thành tiền: " + UtilFuction.formatMoney(totalMoney) + " VND"; totalAllOrder = totalMoney; }
public void setupOrderWithFoodUI() { if (_foodWithOrder != null) { textBlockName.Text = _foodWithOrder.Food.Name; TextBoxQuantity.Text = _foodWithOrder.Quantities.ToString(); TextBlockSinglePrice.Text = UtilFuction.formatMoney(_foodWithOrder.Food.Price); textBlockTotal.Text = UtilFuction.formatMoney(_foodWithOrder.Quantities * _foodWithOrder.Food.Price); previousQuantity = _foodWithOrder.Quantities; } }
private void reloadTotalBill() { decimal totalBill = 0; var ingredientWithImportBillList = new List <IngredientWithImportBill>(); foreach (ImportIngredientCell importIngredientCell in LVIngredient.Items.OfType <ImportIngredientCell>()) { ingredientWithImportBillList.Add(importIngredientCell._ingredientWithImportBill); totalBill += (importIngredientCell._ingredientWithImportBill.SinglePricePerUnit * (decimal)importIngredientCell._ingredientWithImportBill.Quantities); } TextBlockTotal.Text = "Tổng cộng: " + UtilFuction.formatMoney(totalBill) + " VND"; }
public void reloadUI(ImportBill importBillRoot) { _importBill = importBillRoot; TextBoxId.Text = _importBill.ImportBillId.ToString(); TextBoxTime.Text = _importBill.CreatedDate.ToString(); TextBoxTotal.Text = UtilFuction.formatMoney(_importBill.BillMoney); LVIngredient.Items.Clear(); foreach (IngredientWithImportBill ingredient in _importBill.IngredientWithImportBills) { LVIngredient.Items.Add(new ImportIngredientCell(ingredient)); } }
private void checkAndReloadTotal() { decimal price = 0; decimal quantity = 0; if (!decimal.TryParse(TextBoxPrice.Text, out price) || !decimal.TryParse(TextBoxQuantity.Text, out quantity)) { TextBoxTotal.Text = "0"; return; } TextBoxTotal.Text = UtilFuction.formatMoney(price * quantity); }
public void onChangeMoney() { decimal totalBill = 0; foreach (OrderWithFood orderWithFood in listViewOrderWithFood.Items.OfType <OrderWithFood>()) { decimal money = 0; decimal.TryParse(orderWithFood.textBlockTotal.Text, out money); totalBill += money; } TextBlockTotalOrder.Text = "Tổng cộng " + UtilFuction.formatMoney(totalBill); billMoney = totalBill; if (orderTab != null) { orderTab.onChangeMoney(); } }
public void reloadUI() { if (_ingredientWithImportBill == null) { TextBlockIngredient.Text = "Error"; TextBlockPrice.Text = "Error"; TextBlockQuantity.Text = "Error"; TextBlockTotal.Text = "Error"; return; } TextBlockIngredient.Text = _ingredientWithImportBill.Ingredient.Name; TextBlockPrice.Text = UtilFuction.formatMoney(_ingredientWithImportBill.SinglePricePerUnit) + " / " + UnitManager.getInstance().UnitList[_ingredientWithImportBill.Ingredient.UnitId].Name; TextBlockQuantity.Text = _ingredientWithImportBill.Quantities.ToString(); TextBlockTotal.Text = UtilFuction.formatMoney((decimal)_ingredientWithImportBill.Quantities * _ingredientWithImportBill.SinglePricePerUnit); }
public void exportBillAsPdf(string path, Order order) { if (order == null) { return; } try { FileStream fs = new FileStream(path + "\\Order" + order.OrderId.ToString() + ".pdf", FileMode.Create); Document document = new Document(PageSize.A4, 25, 25, 30, 30); PdfWriter writer = PdfWriter.GetInstance(document, fs); document.Open(); string orderStr = "Nhà hàng: " + RestaurantInfoManager.getInstance().Info.Name; orderStr += "\n" + "Số điện thoại: " + RestaurantInfoManager.getInstance().Info.Phone; orderStr += "\n" + "Địa chỉ: " + RestaurantInfoManager.getInstance().Info.Address; orderStr += "\n" + "Thời điểm: " + DateTime.Now.ToString("H:mm:ss dd/MM/yyyy"); orderStr += "\n\n" + " Hóa đơn bán hàng "; var index = 1; foreach (FoodWithOrder foodWithOrder in order.FoodWithOrders) { string strFoodName = index + "-" + foodWithOrder.Food.Name; string strQuantity = foodWithOrder.Quantities.ToString(); string strFoodPrice = "x " + UtilFuction.formatMoney(foodWithOrder.Food.Price); orderStr += "\n" + strFoodName + UtilFuction.getSpacesFromQuantityChar(50, strFoodName) + strQuantity + UtilFuction.getSpacesFromQuantityChar(10, strQuantity) + strFoodPrice + UtilFuction.getSpacesFromQuantityChar(10, strFoodPrice); index++; } orderStr += "\n ========================================================================"; string totalStr = "TỔNG CỘNG: "; orderStr += "\n\n" + totalStr + UtilFuction.getSpacesFromQuantityChar(70, totalStr) + UtilFuction.formatMoney(order.BillMoney); //orderStr += "\n\n\n Nếu quý khách có nhu cầu xuất hóa đơn, \n xin liên hệ với chúng tôi trong ngày."; string appFolderPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); iTextSharp.text.Font font = null; try { string fontPath = Path.Combine(Directory.GetParent(appFolderPath).Parent.FullName, "Resource/Font/VT323-Regular.ttf"); var vini = BaseFont.CreateFont(fontPath, BaseFont.IDENTITY_H, true); font = new iTextSharp.text.Font(vini, 14); } catch (Exception ex) { } if (font != null) { document.Add(new Paragraph(18, orderStr, font)); } else { document.Add(new Paragraph(16, orderStr, font)); } document.Close(); fs.Close(); } catch (Exception ex) { Console.Write(ex.Message); } }
public void reloadAllUI() { reloadLVOrderWithFood(); var order = OrderManager.getInstance().OrderList[OrderId]; TextBlockHeader.Text = "Order " + OrderId; billMoney = order.BillMoney; BtnAccept.Visibility = Visibility.Hidden; BtnCancel.Visibility = Visibility.Hidden; foreach (KeyValuePair <int, Food> entry in FoodManager.getInstance().FoodList) { if (entry.Value != null) { bool isContinue = false; foreach (FoodWithOrder foodWithOrder in order.FoodWithOrders) { if (foodWithOrder.FoodId == entry.Value.FoodId) { isContinue = true; } } if (isContinue) { continue; } string txt = entry.Value.FoodId + " - " + entry.Value.Name; var imgSrc = (ImageSource)Application.Current.FindResource("ImageDefaultFood"); if (entry.Value.ImageId != null) { byte[] imgData = null; ImageManager.getInstance().loadImageFromLocal(entry.Value.ImageId ?? default(int), out imgData); if (imgData != null) { var img = UtilFuction.ByteToImage(imgData); imgSrc = UtilFuction.imageToBitmapSource(img); } } var item = ComboBoxSelectFood.addItem(txt, imgSrc); item.Tag = entry.Value.FoodId; } } onChangeMoney(); if (orderHistoryTab != null) { BtnAddFood.Visibility = Visibility.Hidden; TextBlockHeader.Text += (" - " + order.CreatedDate.ToShortDateString()) + " - " + UtilFuction.formatMoney(billMoney) + " VND"; } }
public void reloadUI() { TextBlockBillId.Text = "Hóa đơn #" + importBill.ImportBillId.ToString(); TextBlockTime.Text = importBill.CreatedDate.ToShortDateString(); TextBlockMoney.Text = UtilFuction.formatMoney(importBill.BillMoney); }