private decimal CaculateProfit() { decimal expense = string.IsNullOrEmpty(tbExpense.Text) ? 0 : CurrencyUtil.ToDecimal(tbExpense.Text); decimal adjustment = string.IsNullOrEmpty(tbAdjustmentAmount.Text) ? 0 : CurrencyUtil.ToDecimal(tbAdjustmentAmount.Text); return(_totalRevenue + adjustment - expense); }
private void dgvListDetails_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.Value != null) { // Weight column if (e.ColumnIndex == 2 || e.ColumnIndex == 3) { if (double.Parse(e.Value.ToString()).Equals(Constants.MAX_WEIGHT_VALUE)) { e.Value = "MAX"; } else { e.Value = string.Format("{0:N3} kg", e.Value.ToString()); } e.FormattingApplied = true; } // Value column or Total totalCost column if (e.ColumnIndex == 4) { e.Value = CurrencyUtil.ToStringWithCurrencySign((decimal)e.Value); e.FormattingApplied = true; } } }
private bool ValidateInput() { if (_checkedRows.Count == 0) { MessageBox.Show("Hãy chọn hóa đơn cần quyết toán.", "Không có hóa đơn"); return(false); } if (chkUseAdjustment.Checked) { if (CurrencyUtil.ToDecimal(tbAdjustmentAmount.Text) == 0) { MessageBox.Show("Tiền điều chỉnh phải khác 0.", "Tiền điều chỉnh không hợp lệ"); return(false); } if (string.IsNullOrWhiteSpace(tbAdjustmentReason.Text)) { MessageBox.Show("Vui lòng ghi rõ lý do sử dụng tiền điều chỉnh.", "Thiếu lý do sử dụng tiền điều chỉnh"); return(false); } } if (CurrencyUtil.ToDecimal(lblPaymentBalanceText.Text) < 0) { MessageBox.Show("Số tiền thanh toán không hợp lệ. Hãy sử dụng tiền điều chỉnh nếu cần.", "Không thể quyết toán"); return(false); } return(true); }
private void dgvItemsList_SelectionChanged(object sender, EventArgs e) { try { if (dgvItemsList.SelectedRows.Count <= 0) { return; } TicketPriceConfiguration selectedItem = dgvItemsList.SelectedRows[0].DataBoundItem as TicketPriceConfiguration; tbPrice.Text = CurrencyUtil.ToString(selectedItem.price); tbRemark.Text = selectedItem.description; _selectedId = selectedItem.id; _selectedClass = selectedItem.seat_class; rbUpper.Checked = selectedItem.seat_class == Constants.SeatClass.B.ToString(); rbLower.Checked = selectedItem.seat_class == Constants.SeatClass.A.ToString(); rbFloor.Checked = selectedItem.seat_class == Constants.SeatClass.S.ToString(); } catch (Exception exc) { AppLogger.logError("dgvItemsList_SelectionChanged", exc); } }
private void dgvItemsList_SelectionChanged(object sender, EventArgs e) { try { if (dgvItemsList.SelectedRows.Count <= 0) { return; } TicketReturnFeeConfiguration selectedItem = dgvItemsList.SelectedRows[0].DataBoundItem as TicketReturnFeeConfiguration; rbAmount.Checked = selectedItem.fee_amount > 0; rbPercent.Checked = selectedItem.fee_percent > 0; tbId.Text = selectedItem.id; tbBeforeDate.Text = selectedItem.before_day.ToString(); tbBeforeHour.Text = selectedItem.before_hour.ToString(); tbAmount.Text = CurrencyUtil.ToString(selectedItem.fee_amount); tbPercent.Text = selectedItem.fee_percent.ToString(); } catch (Exception exc) { AppLogger.logError("dgvItemsList_SelectionChanged", exc); } }
public MastersController() { result = new Result(); countryUtil = new CountryUtil(); stateUtil = new StateUtil(); cityUtil = new CityUtil(); areaUtil = new AreaUtil(); subareaUtil = new SubAreaUtil(); appointmentTypeUtil = new AppointmentTypeUtil(); currencyUtil = new CurrencyUtil(); dateFormatUtil = new DateFormatUtil(); documentTypeUtil = new DocumentTypeUtil(); languageUtil = new LanguageUtil(); religionUtil = new ReligionUtil(); nationalityUtil = new NationalityUtil(); sourceUtil = new SourceUtil(); durationDaysUtil = new DurationDaysUtil(); packageUtil = new PackageUtil(); // scoreColumnUtil = new ScoreColumnUtil(); timeFormatUtil = new TimeFormatUtil(); industryUtil = new IndustryUtil(); paymentModeUtil = new PaymentModeUtil(); applicationTemplatePlaceHolderUtil = new ApplicationTemplatePlaceHolderUtil(); }
private void tbPrice_Leave(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tbPrice.Text) && CurrencyUtil.ToDecimal(_model.Price) != 0 && (string.IsNullOrEmpty(tbCost.Text) || CurrencyUtil.ToDecimal(_model.Cost) == 0)) { _model.Cost = CurrencyUtil.ToString(CurrencyUtil.ToDecimal(_model.Price) / (decimal)1.3); } }
private void _txtSalePrice_Leave(object sender, EventArgs e) { if (!string.IsNullOrEmpty(_txtSalePrice.Text) && CurrencyUtil.ToDecimal(_model.NewPrice) != 0 && (string.IsNullOrEmpty(_txtImportPrice.Text) || CurrencyUtil.ToDecimal(_model.NewCost) == 0)) { _model.NewCost = CurrencyUtil.ToString(CurrencyUtil.ToDecimal(_model.NewPrice) / (decimal)1.3); } }
private void dgvOrdersList_CellValueChanged(object sender, DataGridViewCellEventArgs e) { int count = 0; decimal totalPayment = 0; try { if (e.ColumnIndex == 0 && e.RowIndex != -1) { _checkedRows.Clear(); // Loops through every row and calculates the sum of checked rows foreach (DataGridViewRow row in dgvOrdersList.Rows) { if (row.Cells[0].Value != null && (bool)row.Cells[0].Value == true) { count++; decimal cost; if (decimal.TryParse(row.Cells["TotalCostColumn"].Value.ToString(), out cost)) { _checkedRows.Add(row); totalPayment += cost; } } } //_chkOrdersListHeaderSelectAll.Checked = _orders.Count.Equals(count); } } catch (Exception ex) { AppLogger.logError(this.ToString(), ex); } tbOrdersCount.Text = count.ToString(); tbTotalPayment.Text = CurrencyUtil.ToStringWithCurrencySign(totalPayment); }
void UpdateMaster() { dgAccountsTransGrid.UpdateMaster(master); bool RoundTo100; var Comp = api.CompanyEntity; if (Comp.SameCurrency(master._Currency)) { RoundTo100 = Comp.RoundTo100; } else { ShowCurrency = true; RoundTo100 = !CurrencyUtil.HasDecimals(master._Currency); } if (RoundTo100) { Debit.HasDecimals = Credit.HasDecimals = Amount.HasDecimals = Total.HasDecimals = false; } if (!Comp._UseVatOperation) { VatOperation.Visible = false; } }
private XsltArgumentList getXSLTArguments(PreviewTransformParams previewTransformParams, List <Overdraft> overdrafts, List <PayrollCompanyConfiguration> payrollCompanyConfiguration, PreviewTransformResultDetail previewTransformResultDetail, string originalString, string stampingOriginalString) { var dateFormat = new DateTimeUtil(); var currencyConvert = new CurrencyUtil(); var catalogSatManager = new CatalogSATUtil(previewTransformParams.IdentityWorkID, previewTransformParams.InstanceID, overdrafts, payrollCompanyConfiguration); //QRCode var qrData = base.GetQRCodeWithTemplate(new XMLGet(previewTransformResultDetail.XML)); var qrCode = new QRutil().GetQRBase64(qrData, 20); XsltArgumentList xsltArgumentList = new XsltArgumentList(); //default arguments - Logo xsltArgumentList.AddParam("logoCotorraTemplate", "", "data:image/png;base64," + GetLogoCotorra()); xsltArgumentList.AddParam("overdraftID", "", previewTransformResultDetail.OverdraftID.ToString()); //fiscal arguments xsltArgumentList.AddParam("cbbUriTemplate", "", !string.IsNullOrEmpty(qrCode) ? "data:image/png;base64," + qrCode : string.Empty); xsltArgumentList.AddParam("originalstring", "", !string.IsNullOrEmpty(originalString) ? originalString : string.Empty); xsltArgumentList.AddParam("stamporiginalstring", "", !string.IsNullOrEmpty(stampingOriginalString) ? stampingOriginalString : string.Empty); //object catalog argument xsltArgumentList.AddExtensionObject("urn:catalogSat", catalogSatManager); //object for convert total amount in words xsltArgumentList.AddExtensionObject("urn:convert", currencyConvert); xsltArgumentList.AddExtensionObject("urn:dateFormat", dateFormat); return(xsltArgumentList); }
public JsonController() { Result = new Result(); countryUtil = new CountryUtil(); stateUtil = new StateUtil(); areaUtil = new AreaUtil(); userUtil = new UserUtil(); subareaUtil = new SubAreaUtil(); appointmentTypeUtil = new AppointmentTypeUtil(); currencyUtil = new CurrencyUtil(); dateFormatUtil = new DateFormatUtil(); languageUtil = new LanguageUtil(); religionUtil = new ReligionUtil(); durationDaysUtil = new DurationDaysUtil(); sourceUtil = new SourceUtil(); packageUtil = new PackageUtil(); cityUtil = new CityUtil(); //scoreColumnUtil = new ScoreColumnUtil(); nationalityUtil = new NationalityUtil(); timeFormatUtil = new TimeFormatUtil(); industryUtil = new IndustryUtil(); paymentModeUtil = new PaymentModeUtil(); applicationTemplatePlaceHolderUtil = new ApplicationTemplatePlaceHolderUtil(); jobTypeUtill = new JobTypeUtill(); jobStatusUtill = new JobStatusUtill(); packageTypeUtill = new PackageTypeUtill(); paperTypeUtill = new PaperTypeUtill(); paperSubTypeUtill = new PaperSubTypeUtill(); paymentStatusUtill = new PaymentStatusUtill(); currencyUtil = new CurrencyUtil(); leminationTypeUtill = new LeminationTypeUtill(); }
private void dgvItemsList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { try { if (e.Value != null) { // Weight column if (e.ColumnIndex == 1) { e.Value = string.Format("{0:N3} kg", e.Value.ToString()); e.FormattingApplied = true; } // Value column or Total totalCost column if (e.ColumnIndex == 4 || e.ColumnIndex == 5) { e.Value = CurrencyUtil.ToStringWithCurrencySign((decimal)e.Value); e.FormattingApplied = true; } } } catch (Exception ex) { AppLogger.logError(this.ToString(), ex); } }
public void onSellEditChanged() { if (current != Company.Null) { tl_commitionSell.Text = CurrencyUtil.format(commitionToSell); tl_totIncom.Text = CurrencyUtil.format(totalIncom); } }
public void onBuyEditChanged() { if (current != Company.Null) { tl_commitionBuy.Text = CurrencyUtil.format(commitionToBuy); tl_totExpense.Text = CurrencyUtil.format(totalExpense); } }
/// <summary> Update data on the screen. </summary> private void onUpdate() { TransactionSummary s = parent.select(history); this.SubItems[1].Text = CurrencyUtil.format(s.sales); this.SubItems[2].Text = CurrencyUtil.format(s.expenditures); this.SubItems[3].Text = CurrencyUtil.format(s.balance); }
protected override void btnSave_Click(object sender, EventArgs e) { try { string errorMessage = ValidInput(); if (string.IsNullOrEmpty(errorMessage) == false) { MessageBox.Show(errorMessage, "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (MessageBox.Show("Thay đổi thông tin chi tiết của Doanh thu có thể làm thay đổi tổng doanh thu.\r\n Bạn có chắc chắn muốn thay đổi không?" , "Chú ý" , MessageBoxButtons.YesNo , MessageBoxIcon.Warning , MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.No) { return; } base.btnSave_Click(sender, e); using (ThanhVanTranSysEntities context = new ThanhVanTranSysEntities()) { RevenueDetail expenseDetail = _isUpdating ? context.RevenueDetails.SingleOrDefault(i => i.id == tbId.Text.Trim()) : new RevenueDetail(); expenseDetail.id = IsUpdating ? tbId.Text : IDGenerator.ExpenseId(); expenseDetail.object_id = tbObjectId.Text; expenseDetail.revenue_id = _revenueId; expenseDetail.amount = CurrencyUtil.ToDecimal(tbAmount.Text); expenseDetail.created_by = _isUpdating ? expenseDetail.created_by : SystemParam.CurrentUser.id; expenseDetail.created_date = _isUpdating ? expenseDetail.created_date : dtpCreateDate.Value; expenseDetail.description = tbRemark.Text; expenseDetail.type = cbType.SelectedValue.ToString(); expenseDetail.title = string.Empty; AppLogger.logInfo("btnSave_Click", IsUpdating ? "UPDATE" : "INSERT", expenseDetail); if (IsUpdating == false) { context.RevenueDetails.AddObject(expenseDetail); } context.SaveChanges(); ChangeViewStatus(false); } UpdateExpenseAmount(); LoadExpenseDetail(); } catch (Exception exc) { AppLogger.logError("btnSave_Click", exc); } }
public StringBuilder UpdatePrice() { StringBuilder errorMessage = new StringBuilder(); try { AppLogger.logInfo(" UpdatePrice "); errorMessage = checkData(); if (errorMessage.Length != 0) { return(errorMessage); } ProductPrice oldPrice = _model.Product.ProductPrices.FirstOrDefault(i => i.IsCurrentPrice); //_businessPrice.GetProductAvailablePrice(product.Id); if (oldPrice != null) { oldPrice.IsCurrentPrice = false; } ProductPrice price = new ProductPrice(); price.ProductId = _model.Product.Id; price.Price = CurrencyUtil.ToDecimal(_model.NewPrice); price.Cost = CurrencyUtil.ToDecimal(_model.NewCost); price.IsCurrentPrice = true; _model.Product.Price = price.Price; _model.Product.Cost = price.Cost; _model.Product.ChangedDate = DateTime.Now; _model.Product.ChangedBy = SystemParam.CurrentUser.Id; _model.Product.ProductPrices.Add(price); try { //_businessPrice.Insert(price, false); //_businessPrice.Update(oldPrice, true); _businessProduct.Update(_model.Product); } catch (Exception exc) { AppLogger.logError(exc.Message); errorMessage.AppendLine(exc.Message); } return(errorMessage); } catch (Exception exc) { AppLogger.logError(exc.Message); return(errorMessage.AppendLine(exc.Message)); } }
private void btnPayPrint_Click(object sender, EventArgs e) { if (CurrencyUtil.ToDecimal(_model.CusChange) < 0) { return; } Result = PaymentResult.PayandPrint; this.Close(); }
private string ConcatenateHeader(string header, string header2, OverdraftTotalsResult totals) { CurrencyUtil cur = new CurrencyUtil(); var stringQuantity = cur.ToText(new CurrencyToTextParams() { CurrencyAmount = Math.Round(totals.Total, 2), CurrencyCode = "MXN", CurrencyName = "Pesos" }); return(header + "$ " + Math.Round(totals.Total, 2) + " " + stringQuantity + header2); }
private void LoadExpenseDetail() { using (ThanhVanTranSysEntities context = new ThanhVanTranSysEntities()) { var RevenueDetails = context.RevenueDetails.Where(i => i.revenue_id == _revenueId).ToList(); dgvFinacial.DataSource = RevenueDetails; tbTotalAmount.Text = CurrencyUtil.ToString(RevenueDetails.Sum(i => i.amount)); } }
private void LoadOrderInfo(IrregularOrder order, Collection <OrderItem> items) { lblOrderIDText.Text = order.id; lblOrderStatusText.Text = EnumHelper.Parse <Constants.DeliveryStatus>(order.order_status).GetDescription(); tbTotalItemsQuantity.Text = order.total_quantity.ToString(); tbTotalCost.Text = CurrencyUtil.ToString(order.total_cost); dgvItemsList.AutoGenerateColumns = false; dgvItemsList.DataSource = items; tbTotalPayment.Text = CurrencyUtil.ToString(order.total_cost); }
static public string UnicontaCurrencyISO(Company company, BankStatement bankAccount) { if (bankAccount._Currency != 0) { return(CurrencyUtil.GetStringFromId((Currencies)bankAccount._Currency)); } else { return(CurrencyUtil.GetStringFromId((Currencies)company._Currency)); } }
private bool ValidateInput() { bool valid = true; if (CurrencyUtil.ToDecimal(tbPaymentBalance.Text) < 0) { MessageBox.Show("Số tiền thanh toán không hợp lệ.", "Không thể quyết toán", MessageBoxButtons.OK, MessageBoxIcon.Warning); valid = false; } return(valid); }
/// <summary> /// 通过金币判断是否可以加速 /// </summary> /// <param name="id">蓝图ID</param> /// <returns></returns> public bool BeSpeedUpByMoney(int id) { long needCout = GetNeedGlod(id); long gold = CurrencyUtil.GetRechargeCurrencyCount(); if (gold < needCout) { return(false); } return(true); }
private void UpdateMoneys() { if (m_Money1 && m_Money1.Label) { m_Money1.Label.text = CurrencyUtil.GetRechargeCurrencyCount().ToString(); } if (m_Money2 && m_Money2.Label) { m_Money2.Label.text = CurrencyUtil.GetGameCurrencyCount().ToString(); } }
private void SetValueToTicketControl(Ticket ticket) { lblTicketId.Text = ticket.id; tbPassengerName.Text = ticket.passenger_name.Trim(); tbIDCardNumber.Text = ticket.passenger_id_card_no.Trim(); tbPickupLocation.Text = ticket.pickup_location.Trim(); tbPhoneNumber.Text = ticket.phone; lblSeatNo.Text = ticket.seat_class + ticket.seat_number.ToString(CultureInfo.InvariantCulture); lblPrice.Text = CurrencyUtil.ToString(GetPriceBySeatClass(_seatClass.ToString())); lblCreateBy.Text = ticket.user_id; }
private void OnControlUnFocus(object sender, EventArgs e) { if (((Control)sender).Enabled) { ValidateInput(); decimal totalCost = CalculateTotalCost(OrderItem.weight, OrderItem.size, OrderItem.value, OrderItem.quantity); if (!this.tbTotalCost.Enabled) { this.tbTotalCost.Text = CurrencyUtil.ToString(totalCost); } } }
public AdminSettingsController() { result = new Result(); jobTypeUtill = new JobTypeUtill(); jobStatusUtill = new JobStatusUtill(); packageTypeUtill = new PackageTypeUtill(); paperTypeUtill = new PaperTypeUtill(); paperSubTypeUtill = new PaperSubTypeUtill(); paymentStatusUtill = new PaymentStatusUtill(); currencyUtil = new CurrencyUtil(); leminationTypeUtill = new LeminationTypeUtill(); }
public void GetTextFromQuantityNoDecimalPoint() { CurrencyUtil cur = new CurrencyUtil(); var txt = cur.ToText(new CurrencyToTextParams() { CurrencyAmount = 1200, CurrencyCode = "MXN", CurrencyName = "Pesos" }); Assert.NotEmpty(txt); Assert.Equal("Mil doscientos pesos 00/00 MXN", txt); }