private void btnDelete_Click(object sender, EventArgs e) { Int32 selectedRowCount = dgvAddedProducts.Rows.GetRowCount(DataGridViewElementStates.Selected); if (selectedRowCount > 0) { decimal Total, subTotal, subNonTaxable, Tax, GrandTotal; int taxable; Total = Convert.ToDecimal(dgvAddedProducts.SelectedRows[0].Cells["Total"].Value.ToString()); // MessageBox.Show(dgvAddedProducts.SelectedRows[0].Cells[5].Value.ToString()); taxable = Convert.ToInt32(dgvAddedProducts.SelectedRows[0].Cells[5].Value.ToString()); subTotal = Convert.ToDecimal(txtSubTotal.Text); subNonTaxable = Convert.ToDecimal(txtNonTaxable.Text); Tax = Convert.ToDecimal(txtSalesTax.Text); if (Convert.ToBoolean(taxable) && chkTaxable.Checked) { subTotal -= Total; Tax -= Total * Convert.ToDecimal(txtTaxRate.Text); } else { subNonTaxable -= Total; } GrandTotal = subNonTaxable + subTotal + Tax; txtSubTotal.Text = subTotal.ToString(); txtNonTaxable.Text = subNonTaxable.ToString(); txtSalesTax.Text = Tax.ToString(); txtGrandTotal.Text = GrandTotal.ToString(); dgvAddedProducts.Rows.RemoveAt(dgvAddedProducts.SelectedRows[0].Index); } }
public void PrintCheckReceipt(List <Product> orderItems, Check check) { foreach (var item in orderItems) { Console.WriteLine("{0,-30} {1,5}", item.Name, $"${item.Price}"); } Console.WriteLine("{0,-30} {1,5}", "Subtotal:", SubTotal.ToString("C", CultureInfo.CurrentCulture)); Console.WriteLine("{0,-30} {1,5}", "Sales Tax:", SalesTax.ToString("C", CultureInfo.CurrentCulture)); Console.WriteLine("{0,-30} {1,5}", "Grand Total:", GrandTotal.ToString("C", CultureInfo.CurrentCulture)); Console.WriteLine("{0,-30} {1,5}", "Check Payment - Tender Amount:", GrandTotal.ToString("C", CultureInfo.CurrentCulture)); Console.Write("Account Number: "); var checkNum = check.CheckNumber.ToCharArray(); for (int i = 0; i < checkNum.Length; i++) { if (i < checkNum.Length - 4) { Console.Write("x"); } else { Console.Write(checkNum[i]); } } }
private void button1_Click(object sender, EventArgs e) { try { discount = int.Parse(totalDiscount.Text); if (discount < prod && qty < (int.Parse(dataBaseqty))) { total = amount * qty - discount; GrandTotal += total - discount; grandTotal.Text = GrandTotal.ToString(); getQtyOfShelf(shelfId); updateTable(qty); remaingQty = (int.Parse(dataBaseqty)) - qty; updateTable(remaingQty); searchData(Search.Text); addDataGridView2(); clearBill(); totalDiscount.Text = "0"; } else { MessageBox.Show("Disount should not less then Amount or Your product quantity is greater then stock"); clearBill(); } } catch (Exception) { } }
private void PolpulatePaymentInfo() { this.SubTotal = 0; foreach (DataGridViewRow item in dgvSalesInfo.Rows) { if (item.Cells[8].Value != null) { SubTotal += int.Parse(item.Cells[8].Value.ToString()); } } txtAmount.Text = SubTotal.ToString(); int taxAmt = this.clsPOS.SEL_Tax(); int scAmt = this.clsPOS.SEL_ServiceCharges(); ServiceCharnge = scAmt; long tax = (SubTotal / 100) * taxAmt; Tax = int.Parse(tax.ToString()); txtTax.Text = Tax.ToString(); txtServiceCharges.Text = scAmt.ToString(); GrandTotal = SubTotal + Tax + ServiceCharnge; txtTotal.Text = GrandTotal.ToString(); }
private void TaxCalculation() { priceTextBox.Text = Convert.ToDecimal(Program.product.cost).ToString("#.##"); decimal taxPercentage = (0.13M), GrandTotal; taxTextBox.Text = (Convert.ToDecimal(priceTextBox.Text) * taxPercentage).ToString("#.##"); GrandTotal = Decimal.Add(Convert.ToDecimal(taxTextBox.Text), Convert.ToDecimal(priceTextBox.Text)); totalTextBox.Text = GrandTotal.ToString("C2"); }
public void PrintOrderTotals(List <Product> orderList) { CalcualateSubtotal(orderList); CalculateGrandTotal(); CalculateSalesTax(); Console.WriteLine("\n\nTotal"); Console.WriteLine("{0,-30} {1,5}", "Subtotal:", SubTotal.ToString("C", CultureInfo.CurrentCulture)); Console.WriteLine("{0,-30} {1,5}", "Sales Tax:", SalesTax.ToString("C", CultureInfo.CurrentCulture));; Console.WriteLine("{0,-30} {1,5}", "Grand Total:", GrandTotal.ToString("C", CultureInfo.CurrentCulture)); }
private void BindToUI() { poleCountDataLbl.Text = poleCount.ToString("n0"); wireTotalLbl.Text = wireCost.ToString("n2"); poleTotalLbl.Text = poleCost.ToString("n2"); permitTotalLbl.Text = permitCost.ToString("n2"); constTotalLbl.Text = constCost.ToString("n2"); subtotalDataLbl.Text = subTotal.ToString("n2"); taxTotalLbl.Text = saleTax.ToString("n2"); grandTotalDataLbl.Text = GrandTotal.ToString("c2"); }
public void PrintCashReceipt(List <Product> orderItems, Cash cash) { foreach (var item in orderItems) { Console.WriteLine("{0,-30} {1,5}", item.Name, $"${item.Price}"); } Console.WriteLine("{0,-30} {1,5}", "Subtotal:", SubTotal.ToString("C", CultureInfo.CurrentCulture)); Console.WriteLine("{0,-30} {1,5}", "Sales Tax:", SalesTax.ToString("C", CultureInfo.CurrentCulture)); Console.WriteLine("{0,-30} {1,5}", "Grand Total:", GrandTotal.ToString("C", CultureInfo.CurrentCulture)); Console.WriteLine("{0,-30} {1,5}", "Amount Tendered:", cash.AmountGiven.ToString("C", CultureInfo.CurrentCulture)); Console.WriteLine("{0,-30} {1,5}", "Change:", cash.Change.ToString("C", CultureInfo.CurrentCulture)); }
public void GetSummary() { try { GrandTotal = SelectedRentalPayment.TotalAmountRequired; if (AdditionalServicePayment != null) { GrandTotal += AdditionalServicePayment.TotalAmountRequired; } SubTotal = GrandTotal / (decimal)1.15; Vat = SubTotal * (decimal)0.15; InWords = CommonUtility.GetNumberInWords(GrandTotal.ToString(CultureInfo.InvariantCulture), false); } catch { } }
protected void GridInword_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow && !string.IsNullOrEmpty(Convert.ToString(DataBinder.Eval(e.Row.DataItem, "InwardNo")))) { //Taxamt += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "DiscAmnt")); SubTotal += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "SubTotal")); Discount += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Discount")); Vat += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Vat")); DekhrekhAmt += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "DekhrekhAmt")); HamaliAmt += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "HamaliAmt")); CESSAmt += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "CESSAmt")); FreightAmt += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "FreightAmt")); PackingAmt += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "PackingAmt")); PostageAmt += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "PostageAmt")); OtherCharges += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "OtherCharges")); GrandTotal += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "GrandTotal")); } if (e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[6].Text = "Total"; e.Row.Cells[7].Text = SubTotal.ToString("0.00"); e.Row.Cells[8].Text = Discount.ToString("0.00"); e.Row.Cells[9].Text = Vat.ToString("0.00"); e.Row.Cells[10].Text = DekhrekhAmt.ToString("0.00"); e.Row.Cells[11].Text = HamaliAmt.ToString("0.00"); e.Row.Cells[12].Text = CESSAmt.ToString("0.00"); e.Row.Cells[13].Text = FreightAmt.ToString("0.00"); e.Row.Cells[14].Text = PackingAmt.ToString("0.00"); e.Row.Cells[15].Text = PostageAmt.ToString("0.00"); e.Row.Cells[16].Text = OtherCharges.ToString("0.00"); e.Row.Cells[17].Text = GrandTotal.ToString("0.00"); } } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void GrdReport_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { SubTotal += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "SubTotal")); GrandTotal += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "GrandTotal")); Discount += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Discount")); Vat += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Vat")); } if (e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[4].Text = "Total : "; e.Row.Cells[5].Text = SubTotal.ToString(); e.Row.Cells[6].Text = Discount.ToString(); e.Row.Cells[7].Text = Vat.ToString(); e.Row.Cells[8].Text = GrandTotal.ToString(); } } catch (Exception ex) { } }
string IPropertyAccess.GetProperty(string strPropertyName, string strFormat, CultureInfo formatProvider, UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound) { string propertyValue = null; switch (strPropertyName.ToLower()) { case "orderid": propertyValue = _orderID.ToString(); break; //case "ordernumber": // propertyValue = _OrderNumber.ToString(); // break; case "orderdate": if (!string.IsNullOrEmpty(strFormat)) { propertyValue = _orderDate.ToString(strFormat); } else { propertyValue = _orderDate.ToString(_dateFormat); } break; case "shipdate": if (!string.IsNullOrEmpty(strFormat)) { propertyValue = _shipDate.ToString(strFormat); } else { propertyValue = _shipDate.ToString(_dateFormat); } break; case "ordertotal": if (formatProvider != null) { if (!string.IsNullOrEmpty(CurrencySymbol)) { formatProvider.NumberFormat.CurrencySymbol = CurrencySymbol; } if (!string.IsNullOrEmpty(strFormat)) { propertyValue = _orderTotal.ToString(strFormat, formatProvider.NumberFormat); } else { propertyValue = _orderTotal.ToString("C", formatProvider.NumberFormat); } } else { propertyValue = _orderTotal.ToString("C"); } break; case "grandtotal": if (formatProvider != null) { if (!string.IsNullOrEmpty(CurrencySymbol)) { formatProvider.NumberFormat.CurrencySymbol = CurrencySymbol; } if (!string.IsNullOrEmpty(strFormat)) { propertyValue = GrandTotal.ToString(strFormat, formatProvider.NumberFormat); } else { propertyValue = GrandTotal.ToString("C", formatProvider.NumberFormat); } } else { propertyValue = GrandTotal.ToString("C"); } break; case "taxtotal": if (formatProvider != null) { if (!string.IsNullOrEmpty(CurrencySymbol)) { formatProvider.NumberFormat.CurrencySymbol = CurrencySymbol; } if (!string.IsNullOrEmpty(strFormat)) { propertyValue = _taxTotal.ToString(strFormat, formatProvider.NumberFormat); } else { propertyValue = _taxTotal.ToString("C", formatProvider.NumberFormat); } } else { propertyValue = _taxTotal.ToString("C"); } break; case "shippingcost": if (formatProvider != null) { if (!string.IsNullOrEmpty(CurrencySymbol)) { formatProvider.NumberFormat.CurrencySymbol = CurrencySymbol; } if (!string.IsNullOrEmpty(strFormat)) { propertyValue = _shippingCost.ToString(strFormat, formatProvider.NumberFormat); } else { propertyValue = _shippingCost.ToString("C", formatProvider.NumberFormat); } } else { propertyValue = _shippingCost.ToString("C"); } break; case "shippingtax": if (formatProvider != null) { if (!string.IsNullOrEmpty(CurrencySymbol)) { formatProvider.NumberFormat.CurrencySymbol = CurrencySymbol; } if (!string.IsNullOrEmpty(strFormat)) { propertyValue = _shippingTax.ToString(strFormat, formatProvider.NumberFormat); } else { propertyValue = _shippingTax.ToString("C", formatProvider.NumberFormat); } } else { propertyValue = _shippingTax.ToString("C"); } break; case "discount": if (formatProvider != null) { if (!string.IsNullOrEmpty(CurrencySymbol)) { formatProvider.NumberFormat.CurrencySymbol = CurrencySymbol; } if (!string.IsNullOrEmpty(strFormat)) { propertyValue = _discount.ToString(strFormat, formatProvider.NumberFormat); } else { propertyValue = _discount.ToString("C", formatProvider.NumberFormat); } } else { propertyValue = _discount.ToString("C"); } break; case "status": propertyValue = _status; break; case "commenttocustomer": propertyValue = _commentToCustomer; break; default: propertyNotFound = true; break; } return(propertyValue); }
private void SetGrandTotal() { GrandTotal = PedestrianFare + CargoFare; txtGrandTotal.Text = TKHelper.IDR(GrandTotal.ToString()); }
//====================== END OF UI FUNCATIONALITY BUTTONS ========================= //====================== START OF SALE FUNCATIONALITY METHODS ========================= /* * Event Handler for Order Button in Sale Windows */ private void OrderButton_Click(object sender, EventArgs e) { StreamWriter FileWriter; string Reciept = "", CurrentLine, Seperator = "_", Message = ""; //Generating Dynamic Confirmation Message Based on Cart Items Message = "Please Confirm the below order:\n\n"; foreach (CartList CartItems in CartFlowLayoutPanel.Controls) { Message = Message + "\nProduct Name: " + CartItems.ProdName + "\nQuantity(s) : " + CartItems.ProdQuantity + Environment.NewLine; } Message = Message + "\n\nYou will have to pay €" + GrandTotal.ToString() + " for " + TotalItems.ToString() + " items."; Message = Message + "\n\nDo you want to confirm the order?"; DialogResult DR = MessageBox.Show(Message, "Confirm the Order", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DR == DialogResult.Yes) { foreach (CartList CartItems in CartFlowLayoutPanel.Controls) { int i; // Modifying Original Stock ProductList // Substracting Cart Quantities from stock for (i = 0; i < ProductList.Count; i++) { if (ProductList[i].ProductQuantity > 0) { if (CartItems.ProdID == ProductList[i].ProductID) { ProductList[i].ProductQuantity -= CartItems.ProdQuantity; break; } } } // Adding quantities into Sold Product List //Adding Cart Quantities from stock for (i = 0; i < SaleProductIDs.Count; i++) { if (CartItems.ProdID == SaleProductIDs[i].ProductID) { SaleProductIDs[i].ProductQuantity += CartItems.ProdQuantity; break; } } CurrentLine = CartItems.ProdCat + Seperator + CartItems.ProdName + Seperator + CartItems.ProdQuantity + Seperator + CartItems.ProdTotal; if (Reciept == "") { Reciept = CurrentLine; } else { Reciept = Reciept + Seperator + CurrentLine; } } TodaysSaleTotal += GrandTotal; //Writing current Transaction to file try { FileWriter = File.AppendText(TRANSACTIONDATABASEFILENAME); FileWriter.WriteLine(TransactionIDLabel.Text); FileWriter.WriteLine(DateTime.Today.ToShortDateString()); FileWriter.WriteLine(TotalItems.ToString()); FileWriter.WriteLine(GrandTotal.ToString()); FileWriter.WriteLine(Reciept); FileWriter.Close(); MessageBox.Show("Transaction " + TransactionIDLabel.Text + " completed successfully"); CartFlowLayoutPanel.Controls.Clear(); ProductsFlowLayoutPanel.Controls.Clear(); CurrentCartProducts.Clear(); TotalItems = 0; GrandTotal = 0; TotalItemsLabel.Text = ""; GrandTotalLabel.Text = ""; } catch { MessageBox.Show("Some Error Occured while Completing your order. Try again Later", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }