private async void loadDataFromDB() { progressBar1.Visible = true; var soldStocks = DatabaseOperations.getSoldStocks(); var stockList = new List <StockDataModel>(); var categoryNames = new List <string>(); var storeNames = new List <string>(); var dates = new List <DateTime>(); StockDataModel stock; StoreLocationDataModel store; if (soldStocks != null && soldStocks.Any()) { foreach (var data in soldStocks) { dates.Add(data.date); stock = await DatabaseOperations.getStockById(data.stockId); stockList.Add(stock); categoryNames.Add(DatabaseOperations.getCategoryName(stock.categoryId)); store = await DatabaseOperations.getStoreById(stock.storeId); storeNames.Add(store.name); totalPrice += stock.unitPrice; } totalPricetextBox.Text = FormatPrice.format(totalPrice); new UpdateDataGridView().addSoldItemsToDataGridView(stockList, categoryNames, storeNames, dates, dataGridView1); } progressBar1.Visible = false; }
public AddPurchasesForm(PurchaseOrderDataModel purchase) { InitializeComponent(); init(); supplierNameComboBox.Text = purchase.supplierName; statusComboBox.Text = purchase.status; dateCreatedDateTimePicker.Value = purchase.dateCreated; expectedDateofDeliveryDateTimePicker.Value = purchase.deliveryDate; orderRefTextBox.Text = purchase.orderNo; grandTotalPricetextBox.Text = FormatPrice.format(purchase.grandTotalPrice); grandTotalQuantitytextBox.Text = purchase.grandTotalQuantity.ToString(); grandTotalQuantity = purchase.grandTotalQuantity; grandTotalPrice = purchase.grandTotalPrice; addProductToDatagridView(purchase.productsList); saveButton.Enabled = false; deleteButton.Enabled = true; editbutton.Enabled = true; purchasedStocks = purchase.productsList; this.purchases = purchase; }
public void addExpensesToDataGridView(IEnumerable <ExpensesDataModel> Expenses, DataGridView datagridView) { foreach (var data in Expenses) { datagridView.Rows.Add((datagridView.RowCount + 1), data.name, FormatPrice.format(data.amount), data.desc, data.date); } }
public void addSelectedStockToDataGridView(StockDataModel stock, DataGridView datagridView) { int index = datagridView.RowCount + 1; datagridView.Rows.Add(index, stock.name, FormatPrice.format(stock.highestCostPrice), FormatPrice.format(stock.lowestCostPrice), FormatPrice.format(stock.lastCostPrice), FormatPrice.format(stock.unitPrice), "Remove"); }
private void clearButton_Click(object sender, EventArgs e) { cartDataGridView.Rows.Clear(); selectedRecipes.Clear(); totalPrice = 0; totalPriceTextBox.Text = FormatPrice.format(totalPrice); }
private void Recipes_Load(object sender, EventArgs e) { //get recipes from db displayRecipe(); totalPriceTextBox.Text = FormatPrice.format(totalPrice); receiptNoTextBox.Text = GenerateIDs.invoiceId(); }
private async void validateControls() { if (cartDataGridView.RowCount < 1) { MessageBox.Show("Invalid Items selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } await DatabaseOperations.addSoldRecipes(selectedRecipes); //TODO print receipt try { Ticket ticket = new Ticket { receiptDate = DateTime.Now, amountPayable = totalPrice, totalPrice = totalPrice, recipes = selectedRecipes }; await ticket.printRecipe(); } catch (Exception ex) { MessageBox.Show(ex.Message); } cartDataGridView.Rows.Clear(); selectedRecipes.Clear(); totalPrice = 0; totalPriceTextBox.Text = FormatPrice.format(totalPrice); }
public AddStockAdjustment(StockAdjustmentDataModel adjustment) { InitializeComponent(); loadCategory(); loadStocks(adjustment.categoryId); loadStores(); dateTimePicker1.Value = adjustment.date; categoryComboBox.Text = adjustment.categoryName; stockComboBox.Text = adjustment.stockName; storeComboBox.Text = adjustment.storeName; initialQtyTextBox.Text = adjustment.initialQuantity.ToString(); newQtyTextBox.Text = adjustment.newQuantity.ToString(); adjustedQtyTextBox.Text = adjustment.adjustedQuantity.ToString(); descTextBox.Text = adjustment.description; if (stockComboBox.Items.Contains(adjustment.stockName)) { int index = stockComboBox.Items.IndexOf(adjustment.stockName); var data = stocks.ElementAt(index); highestPriceTextBox.Text = FormatPrice.format(data.highestCostPrice); lowestPriceTextBox.Text = FormatPrice.format(data.lowestCostPrice); lastPriceTextBox.Text = FormatPrice.format(data.lastCostPrice); sellingPriceTextBox.Text = FormatPrice.format(data.unitPrice); } this.adjustment = adjustment; editButton.Enabled = true; deleteButton.Enabled = true; saveButton.Enabled = false; }
public void addSelectedNoteToDataGridView(StockDataModel stocks, int quantity, DataGridView datagridview) { decimal amt = quantity * stocks.lastCostPrice; datagridview.Rows.Add((datagridview.RowCount + 1), stocks.name, FormatPrice.format(stocks.lastCostPrice), quantity, FormatPrice.format(amt), "Edit", "Delete"); }
private void calcAmtPayable(decimal _amt) { var value = calcDiscount(calcSCharge(_amt)); amountPayable = value; amountPayableTextbox.Text = FormatPrice.format(value); }
public void addReceivedNotesToDataGridView(List <ReceivedNotesDataModel> receivedNotes, DataGridView datagridview) { foreach (var data in receivedNotes) { datagridview.Rows.Add((datagridview.RowCount + 1), data.grnId, data.orderId, data.dateReceived, FormatPrice.format(data.amount)); } }
public void addStocksToRecipeDataGridView(List <StockDataModel> stock, List <int> qty, DataGridView dataGridView) { for (int i = 0; i < stock.Count(); i++) { dataGridView.Rows.Add((dataGridView.RowCount + 1), stock.ElementAt(i).name, qty.ElementAt(i), FormatPrice.format(stock.ElementAt(i).unitPrice), FormatPrice.format(stock.ElementAt(i).lastCostPrice)); } }
public void addProductsToDataGridView(StockDataModel stock, int quantityToSupply, DataGridView datagridview) { decimal totalPrice = stock.lastCostPrice * quantityToSupply; datagridview.Rows.Add((datagridview.RowCount + 1).ToString(), stock.name, FormatPrice.format(stock.lastCostPrice), FormatPrice.format(stock.highestCostPrice), FormatPrice.format(stock.lowestCostPrice), quantityToSupply, FormatPrice.format(totalPrice), stock.quantity); }
public void addRecipeToDataGridView(List <RecipesDataModel> recipes, DataGridView datagridview) { foreach (var data in recipes) { datagridview.Rows.Add((datagridview.RowCount + 1), data.name, FormatPrice.format(data.price), data.desc, data.dateCreated); } }
public void addRecipeItemsToDataGridView(List <StockDataModel> stocks, List <int> quantity, DataGridView datagridview) { datagridview.Rows.Clear(); for (int i = 0; i < stocks.Count(); i++) { datagridview.Rows.Add((datagridview.RowCount + 1), stocks.ElementAt(i).name, FormatPrice.format(stocks.ElementAt(i).lastCostPrice), FormatPrice.format(stocks.ElementAt(i).unitPrice), quantity.ElementAt(i)); } }
public void addReceiptsToDataGridView(IEnumerable <ReceiptDataModel> receipts, DataGridView datagridView) { foreach (var data in receipts) { datagridView.Rows.Add((datagridView.RowCount + 1).ToString(), data.salesRep, data.repId, data.invoiceNo, FormatPrice.format(data.totalPrice), FormatPrice.format(data.discount), FormatPrice.format(data.amountPayable), FormatPrice.format(data.totalAmtPaid), data.salesType, FormatPrice.format(data.serviceCharge), data.date); } }
public void removeStockFromDataGridView(List <StockDataModel> stocks, DataGridView datagridview) { datagridview.Rows.Clear(); foreach (var stock in stocks) { datagridview.Rows.Add(datagridview.RowCount + 1, stock.name, FormatPrice.format(stock.highestCostPrice), FormatPrice.format(stock.lowestCostPrice), FormatPrice.format(stock.lastCostPrice), FormatPrice.format(stock.unitPrice), "Remove"); } }
private void clearButton_Click(object sender, EventArgs e) { this.dataGridView1.Rows.Clear(); grandTotalPrice = 0; grandTotalQuantity = 0; grandTotalQuantitytextBox.Text = getTotalQuantity(quantityToSupplytextBox.Text); totalPriceTextBox.Text = FormatPrice.format(getTotalPrice(quantityToSupplytextBox.Text)); grandTotalPricetextBox.Text = FormatPrice.format(getTotalPrice(quantityToSupplytextBox.Text)); }
public void addTransferedItemsToDataGridView(List <StockDataModel> data, List <int> quantity, DataGridView datagridview) { for (int i = 0; i < data.Count(); i++) { datagridview.Rows.Add((datagridview.RowCount + 1), data.ElementAt(i).name, FormatPrice.format(data.ElementAt(i).highestCostPrice), FormatPrice.format(data.ElementAt(i).lowestCostPrice), FormatPrice.format(data.ElementAt(i).lastCostPrice), FormatPrice.format(data.ElementAt(i).unitPrice), quantity.ElementAt(i)); } }
public void addSoldItemsToDataGridView(IEnumerable <StockDataModel> stocks, List <string> categoryNames, List <string> storeName, List <DateTime> dates, DataGridView datagridView) { for (int i = 0; i < stocks.Count(); i++) { datagridView.Rows.Add((datagridView.RowCount + 1), stocks.ElementAt(i).name, FormatPrice.format(stocks.ElementAt(i).highestCostPrice), FormatPrice.format(stocks.ElementAt(i).lowestCostPrice), FormatPrice.format(stocks.ElementAt(i).lastCostPrice), FormatPrice.format(stocks.ElementAt(i).unitPrice), dates.ElementAt(i), categoryNames.ElementAt(i), storeName.ElementAt(i)); } }
public void addPurchaseToDataGrid(List <StockDataModel> stocks, List <int> Quantity, DataGridView datagridview) { for (int i = 0; i < stocks.Count(); i++) { datagridview.Rows.Add((datagridview.RowCount + 1).ToString(), stocks.ElementAt(i).name, FormatPrice.format(stocks.ElementAt(i).highestCostPrice), FormatPrice.format(stocks.ElementAt(i).lowestCostPrice), FormatPrice.format(stocks.ElementAt(i).lastCostPrice), FormatPrice.format(stocks.ElementAt(i).unitPrice), Quantity.ElementAt(i)); } }
public void addStocksToPOSDataGridView(IEnumerable <StockDataModel> stocks, List <string> categoryNames, List <string> storeName, DataGridView datagridView) { for (int i = 0; i < stocks.Count(); i++) { datagridView.Rows.Add((datagridView.RowCount + 1).ToString(), stocks.ElementAt(i).name, categoryNames.ElementAt(i), FormatPrice.format(stocks.ElementAt(i).highestCostPrice), FormatPrice.format(stocks.ElementAt(i).lowestCostPrice), FormatPrice.format(stocks.ElementAt(i).lastCostPrice), FormatPrice.format(stocks.ElementAt(i).unitPrice), stocks.ElementAt(i).quantity, stocks.ElementAt(i).unit, storeName.ElementAt(i)); } }
public void addReceiptSoldItemsToDataGridView(IEnumerable <StockDataModel> stocks, List <SalesDataModel> soldItems, List <string> categoryNames, DataGridView datagridView) { datagridView.Rows.Clear(); for (int i = 0; i < stocks.Count(); i++) { datagridView.Rows.Add((datagridView.RowCount + 1).ToString(), stocks.ElementAt(i).name, FormatPrice.format(stocks.ElementAt(i).highestCostPrice), FormatPrice.format(stocks.ElementAt(i).lowestCostPrice), FormatPrice.format(soldItems.ElementAt(i).lastCostPrice), FormatPrice.format(soldItems.ElementAt(i).soldPrice), categoryNames.ElementAt(i)); } }
public void addSelectedNoteToDataGridView(List <StockDataModel> stocks, List <int> quantity, DataGridView datagridview) { decimal amt = 0; datagridview.Rows.Clear(); for (int i = 0; i < stocks.Count(); i++) { amt = quantity.ElementAt(i) * stocks.ElementAt(i).lastCostPrice; datagridview.Rows.Add((datagridview.RowCount + 1), stocks.ElementAt(i).name, FormatPrice.format(stocks.ElementAt(i).lastCostPrice), quantity.ElementAt(i), FormatPrice.format(amt), "Edit", "Delete"); } }
private void stockComboBox_SelectedIndexChanged(object sender, EventArgs e) { int index = stockComboBox.SelectedIndex; if (index != -1) { var stock = stocks.ElementAt(index); lastCostPriceTextBox.Text = FormatPrice.format(stock.lastCostPrice); highestCostPriceTextBox.Text = FormatPrice.format(stock.highestCostPrice); lowestCostPriceTextBox.Text = FormatPrice.format(stock.lowestCostPrice); lastUnitPriceTextBox.Text = FormatPrice.format(stock.unitPrice); } }
public void addProductsToDataGridView(List <StockDataModel> stock, List <int> quantityToSupply, DataGridView datagridview) { decimal totalPrice = 0; for (int i = 0; i < stock.Count(); i++) { totalPrice = stock.ElementAt(i).lastCostPrice *quantityToSupply.ElementAt(i); datagridview.Rows.Add((datagridview.RowCount + 1).ToString(), stock.ElementAt(i).name, FormatPrice.format(stock.ElementAt(i).lastCostPrice), FormatPrice.format(stock.ElementAt(i).highestCostPrice), FormatPrice.format(stock.ElementAt(i).lowestCostPrice), quantityToSupply.ElementAt(i), FormatPrice.format(totalPrice), stock.ElementAt(i).quantity); } }
public void addReceivedNotesItemsToDataGridView(List <StockDataModel> stocks, List <ReceivedNotesDataModel.GoodsReceived> notes, DataGridView datagridview) { decimal amt = 0; for (int i = 0; i < stocks.Count(); i++) { amt = stocks.ElementAt(i).lastCostPrice *notes.ElementAt(i).quantity; datagridview.Rows.Add((datagridview.RowCount + 1), stocks.ElementAt(i).name, FormatPrice.format(stocks.ElementAt(i).lastCostPrice), notes.ElementAt(i).quantity, amt); } }
private void loadDataFromDb() { receipts = DatabaseOperations.getReceipts().ToList(); if (receipts != null && receipts.Any()) { foreach (var data in receipts) { totalPrice += data.amountPayable; } totalPriceTextBox.Text = FormatPrice.format(totalPrice); new UpdateDataGridView().addReceiptsToDataGridView(receipts, dataGridView1); } }
private void displayRecipe() { recipeData = DatabaseOperations.getRecipes().ToList(); if (recipeData != null && recipeData.Any()) { for (int i = 0; i < recipeData.Count(); i++) { Button button = new Button(); button.Click += new EventHandler(ItemClicked); this.RecipeFlowLayoutPanel.Controls.Add(new RecipeItemPanel(recipeData.ElementAt(i).name, i, FormatPrice.format(recipeData.ElementAt(i).price), button)); } } }
private void loadDataFromDb() { dataGridView1.Rows.Clear(); totalAmount = 0; expensesList = DatabaseOperations.getExpenses().ToList(); if (expensesList != null && expensesList.Any()) { new UpdateDataGridView().addExpensesToDataGridView(expensesList, dataGridView1); foreach (var datum in expensesList) { totalAmount += datum.amount; } } totalAmtTextBox.Text = FormatPrice.format(totalAmount); }