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(); }
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 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); } }
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 GrandTotalTest() { //arrange double subtotal = 60; double tax = 3.6; //act double grandTotal = GrandTotal.FinalTotal(subtotal, tax); //assert Assert.AreEqual(grandTotal, 63.6); }
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) { } }
public ActionResult AllResults(string Month, int StudentID) { // double? RecurrenceFee, NonRecurrenceFee,GrandTotal; // decimal? Discount, PlentyFee; GrandTotal GT = new GrandTotal(); if (Month != "" && StudentID != null) { //Recurrence Fee try { double?fee = db.StudentFeeMonths.Where(x => x.StudentId == StudentID && x.Months == Month && x.Status == "Pending").FirstOrDefault().FeePayable; if (fee == null) { fee = 0; } GT.RecurrenceFee = fee.ToString(); } catch (Exception ex) { return(RedirectToAction("StudentFeeDetails")); } //NonRecurrence Fee List <NonRecurringFeeMultiplier> result = db.NonRecurringFeeMultipliers.Where(x => x.StudentId == StudentID && x.Month == Month && x.Status == "Pending").ToList(); double?totalfee = 0; for (int i = 0; i < result.Count(); i++) { totalfee += result[i].TutionFee; } GT.NonRecurrenceFee = totalfee.ToString(); //Discount var result1 = (from std_dis in db.StudentDiscounts join fee_dis in db.FeeDiscounts on std_dis.FeeDiscountId equals fee_dis.Id where std_dis.StudentId == StudentID && std_dis.Month == Month select new { fee_dis.Amount }).ToList(); decimal?totalfee1 = 0; for (int i = 0; i < result1.Count(); i++) { totalfee1 += result1[i].Amount; } GT.Discount = totalfee1.ToString(); //arrears var StudentFeeMonthData = db.StudentFeeMonths.Where(x => x.StudentId == StudentID && x.Months == Month).FirstOrDefault(); GT.StudentFeeMonthId = StudentFeeMonthData.Id; var _SessionId = StudentFeeMonthData.SessionId; int _Id = StudentFeeMonthData.Id - 1; bool Flag = true; double?Arrear = 0; while (Flag) { try { double?payableamount = db.StudentFeeMonths.Where(x => x.StudentId == StudentID && x.SessionId == _SessionId && x.Status == "Pending" && x.Id == _Id).FirstOrDefault().FeePayable; Arrear += payableamount; _Id--; } catch (Exception ex) { Flag = false; } } GT.Arrear = Arrear.ToString(); //plentyfee var result3 = (from stdplenty in db.StudentPenalties join plenty in db.PenaltyFees on stdplenty.PenaltyId equals plenty.Id where stdplenty.StudentId == StudentID select new { plenty.Amount }).ToList(); decimal?totalfee3 = 0; for (int i = 0; i < result3.Count(); i++) { totalfee3 += result3[i].Amount; } GT.PlentyFee = totalfee3.ToString(); string Result = Newtonsoft.Json.JsonConvert.SerializeObject(GT); return(Content(Result)); } return(Content("0")); }
//====================== 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); } } }
private ClientPortfolio GetListOperations(string AccountNumber, string StartDate, string EndDate) { byte[] bs; string schema; string TimeZone = Properties.Settings.Default.TimeInfo.ToString(); string strtDate = StartDate + TimeZone; string edDate = EndDate + TimeZone; string fileName = Properties.Settings.Default.REP_REGADVICE_QUERY.ToString(); string OperationName = Properties.Settings.Default.REP_REGADVICE_OPNAME.ToString(); int RowCount = 10; RowCount = Properties.Settings.Default.DEFAULT_ROW_COUNT; string TemplateFileName = HttpContext.Current.Server.MapPath("~/" + fileName); string filter = FileToString(TemplateFileName); filter = filter.Replace("@AccountReference", AccountNumber); filter = filter.Replace("@StartDate", strtDate); filter = filter.Replace("@EndDate", edDate); ClientPortfolio clientPortfolio = new ClientPortfolio(); List <InstrumentInfo> instrumentInfoList = new List <InstrumentInfo>(); BrokerInfo brokerInfo = new BrokerInfo(); AccountDetails accountDetails = new AccountDetails(); try { rt = mid.DataSetListZIP(SessionID, OperationName, RowCount, filter, out schema, out bs); if (rt.HasError) // lets see what server thinks about that { Logger logger = LogManager.GetCurrentClassLogger(); logger.Error(DateTime.Now.ToString() + "\t" + rt.ErrorInfo.ErrorReference + "\t" + rt.ErrorInfo.ErrorText); } else { /* unzip output from server */ DataSet opListDS = Utils.unZipDS(bs, schema); DataTable Balances = opListDS.Tables["BALANCE"]; DataTable Balchange = opListDS.Tables["BALCHANGE"]; DataTable ISIN = opListDS.Tables["ISIN"]; DataTable TranTypes = opListDS.Tables["CONFIG_TRANSACTION_TYPE"]; decimal NetActivity = 0.0M; var balanceList = from Balance in Balances.AsEnumerable() select new { BalanceAccount = Balance.Field <int>("BALANCE_ACCOUNT"), AccountReference = Balance.Field <string>("ACCOUNT_REFERENCE"), StartPledge = Balance.Field <decimal?>("BALTIME_PLEDGED_OPEN") == null ? 0 : Balance.Field <decimal?>("BALTIME_PLEDGED_OPEN"), EndingPledge = Balance.Field <decimal?>("BALTIME_PLEDGED_CLOSE") == null ? 0 : Balance.Field <decimal?>("BALTIME_PLEDGED_CLOSE"), Price = Balance.Field <decimal?>("PHIST_CLOSE") == null ? 0 : Balance.Field <decimal?>("PHIST_CLOSE"), // Value = Balance.Field<decimal?>("PHIST_CLOSE") == null ? 0 : Balance.Field<decimal?>("PHIST_CLOSE") * Balance.Field<decimal?>("BALTIME_BALANCE_CLOSE") ,//== null ? 0 : Balance.Field<decimal?>("BALTIME_BALANCE_CLOSE"), Value = Balance.Field <decimal?>("PHIST_CLOSE") * Balance.Field <decimal?>("BALTIME_BALANCE_CLOSE"), //== null ? 0 : Balance.Field<decimal?>("BALTIME_BALANCE_CLOSE"), ISINCCY = Balance.Field <string>("PHIST_CCY"), Name = Balance.Field <string>("NAME_BLOCK_1"), BrokerName = Balance.Field <string>("DEPOPART_NAME"), BrokerCode = Balance.Field <string>("DEPOPART_CODE"), BalCarriedForward = Balance.Field <decimal?>("BALTIME_BALANCE_CLOSE"), BalBroughtForward = Balance.Field <decimal?>("BALTIME_BALANCE_OPEN"), ISIN = Balance.Field <int?>("BALANCE_ISIN"), ISIN_CCY = Balance.Field <string>("PHIST_CCY") }; List <InstrumentInfo> InstrumentInfoList = new List <InstrumentInfo>(); NetActivity = 0; foreach (var b in balanceList.ToList()) { brokerInfo.BrokerCode = b.BrokerCode; brokerInfo.BrokerName = b.BrokerName; accountDetails.Name = b.Name; accountDetails.Account = b.AccountReference.ToString(); InstrumentInfo InstrInfo = new InstrumentInfo(); InstrInfo.InstrumentISINCode = b.ISIN.ToString(); //Get Balance Data var BalChange = from Balch in Balchange.AsEnumerable() where Balch.Field <int>("BALCHANGE_ACCOUNT") == b.BalanceAccount && Balch.Field <int>("BALCHANGE_ISIN") == b.ISIN && Balch.Field <string>("TRANS_CCY") == b.ISINCCY /* No records will be returned if there is a transaction without currency */ select new { TransactionID = Balch.Field <int>("Trans_ID"), TransactionType = Balch.Field <string>("Trans_Type"), TransactionDate = Balch.Field <DateTime>("BALCHANGE_DATE"), TransactonQty = Balch.Field <decimal?>("BALCHANGE_QTY"), TransactonCurr = Balch.Field <string>("TRANS_CCY") }; //GetInstruments Header var Instrument = from isin in ISIN.AsEnumerable() where isin.Field <int>("ISIN_ID") == b.ISIN select new { ISINID = isin.Field <int>("ISIN_ID"), ISIN_Code = isin.Field <string>("ISIN_CODE"), ISIN_CCY = isin.Field <string>("ISIN_CCY"), ISIN_FULL_NAME = isin.Field <string>("ISIN_FULL_NAME"), ISIN_SHORT_NAME = isin.Field <string>("ISIN_SHORT_NAME") }; InstrInfo.InstrumentISINCode = b.ISIN.ToString(); foreach (var inst in Instrument.ToList()) { InstrInfo.InstrumentISINCode = inst.ISIN_Code; InstrInfo.InstrumentCode = inst.ISIN_SHORT_NAME.ToString(); InstrInfo.InstrumentName = inst.ISIN_FULL_NAME.ToString(); InstrInfo.ISINCurrency = inst.ISIN_CCY.ToString(); } //Get Transaction Details ----------------------------------------------------Balchange -------------------------------------------------------------- NetActivity = 0; List <TransactionActivity> TransActivityList = new List <TransactionActivity>(); foreach (var bal in BalChange.ToList()) { TransactionActivity TransActivity = new TransactionActivity(); TransActivity.TransactionDate = bal.TransactionDate.ToString("yyyy-MM-dd"); TransActivity.TransactionID = bal.TransactionID.ToString(); TransActivity.TransCurrency = bal.TransactonCurr; TransActivity.Quantity = bal.TransactonQty.ToString(); NetActivity = NetActivity + Convert.ToDecimal(TransActivity.Quantity); var TransType = from TranType in TranTypes.AsEnumerable() where TranType.Field <string>("TRANTYPE") == bal.TransactionType select new { TranType = TranType.Field <string>("TRANTYPE"), TranDesc = TranType.Field <string>("TRANTYPE_DESCRIPTION") }; foreach (var Tran in TransType.ToList()) { TransActivity.TransType = Tran.TranDesc; } TransActivityList.Add(TransActivity); } // InstrInfo.TransactionActivity = TransActivityList; // TransActivityList.GroupBy(x => x.TransactionID).Select(g => g.First()); //InstrInfo.TransactionActivity = TransActivityList.Distinct().ToList(); //InstrInfo.TransactionActivity = InstrInfo.TransactionActivity = TransActivityList.GroupBy(p => p.TransactionID).Select(g => g.First()).ToList(); InstrInfo.BroughtForwardDate = StartDate.ToString(); InstrInfo.CarryForwardDate = EndDate.ToString(); //; InstrInfo.PledgeEndingBalance = b.EndingPledge.ToString(); InstrInfo.PlegeStartingBalance = b.StartPledge.ToString(); InstrInfo.Value = b.Value.ToString().Trim() == "" ? "0" : b.Value.ToString().Trim(); InstrInfo.Price = b.Price.ToString(); InstrInfo.NetActivityAmount = NetActivity.ToString(); InstrInfo.CarryForwardAmount = b.BalCarriedForward.ToString(); InstrInfo.BroughtForwardAmount = b.BalBroughtForward.ToString(); InstrInfo.ISINCurrency = b.ISINCCY; InstrumentInfoList.Add(InstrInfo); } //GrandTotal List <GrandTotal> GrandTotalList = new List <Models.GrandTotal>(); try { var GrandTotal = from t in InstrumentInfoList group t by t.ISINCurrency into g select new { ISINCurrency = g.Key, totalAmount = g.Sum(a => (decimal.Parse(a.Value))) // blanks will be treated as 0 }; foreach (var g in GrandTotal.ToList()) { GrandTotal grandTotal = new GrandTotal(); grandTotal.GrandTotalCurrency = g.ISINCurrency; grandTotal.GrandTotalAmount = g.totalAmount.ToString(); GrandTotalList.Add(grandTotal); } } catch (Exception ex) { Logger logger = LogManager.GetCurrentClassLogger(); logger.Error(DateTime.Now.ToString() + "\t" + ex.Message); } clientPortfolio.GrandTotal = GrandTotalList; clientPortfolio.AccountDetails = accountDetails; clientPortfolio.Broker = brokerInfo; clientPortfolio.InstrumentInfo = InstrumentInfoList; } } catch (Exception ex) { Logger logger = LogManager.GetCurrentClassLogger(); logger.Error(DateTime.Now.ToString() + "\t" + ex.Message); //Console.WriteLine(String.Format("Operations list exception:\r\n{0}", ex.Message)); } finally { //always close once done. //if (mid != null) // mid.Close(); } return(clientPortfolio); }
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 List <Reports.Models.InvoiceReportModel> GetInvoiceReportModel() { var result = from item in this.Invoicedetail.Where(o => o.IsSelected) select new Reports.Models.InvoiceReportModel { Id = item.Penjualan.Id, Pcs = item.Penjualan.Pcs, Price = item.Penjualan.Price, STT = item.Penjualan.STT, ChangeDate = item.Penjualan.ChangeDate, Tujuan = item.Penjualan.ToCityNavigation.CityName, DoNumber = item.Penjualan.DoNumber, Via = item.Penjualan.PortType.ToString(), PortType = item.Penjualan.PortType, Reciver = item.Penjualan.Reciver.Name, Shiper = item.Penjualan.Shiper.Name, PenjualanId = item.PenjualanId, Total = item.Penjualan.Total, Weight = item.Penjualan.Weight, Etc = item.Penjualan.Etc, Tax = item.Penjualan.Tax, PackingCosts = item.Penjualan.PackingCosts, InvoiceId = item.InvoiceId, Terbilang = GrandTotal.Terbilang(), NumberView = this.NumberView, CustomerName = this.CustomerSelectedItem.Name, DeadLine = this.DeadLine, CreateDate = item.Penjualan.ChangeDate }; return(result.ToList()); }
private void SetGrandTotal() { GrandTotal = PedestrianFare + CargoFare; txtGrandTotal.Text = TKHelper.IDR(GrandTotal.ToString()); }