/// <summary> /// 获取发票的汇率按照开票时间计算 /// </summary> /// <param name="ID"></param> /// <returns></returns> public string GetExchangeRate(string ID) { if (string.IsNullOrEmpty(ID)) { throw new ArgumentNullException("发票主键不能为空。"); } InvoiceInfo vInfo = new Invoice().GetByID(ID); if (vInfo.CurrencyID == "1") { return "1"; } ExchangeRateInfo eInfo = new ExchangeRate().GetInfo(vInfo.CurrencyID, vInfo.InputDate.Year, vInfo.InputDate.Month); return eInfo.Rate.ToString(); }
/// <summary> /// 获取发票的等额人民币价值,汇率按照开票时间计算 /// </summary> /// <param name="ID"></param> /// <returns></returns> public string GetRMBAmout(string ID) { if (string.IsNullOrEmpty(ID)) { throw new ArgumentNullException("发票主键不能为空。"); } CommonFeeInfo vInfo = new CommonFee().GetByID(ID); ExchangeRateInfo eInfo = new ExchangeRate().GetInfo(vInfo.CurrencyID, vInfo.Year, vInfo.MonthNumOfYear); string strRate = (eInfo.CurrencyID == "1") ? "1" : eInfo.Rate; decimal amout = Convert.ToDecimal(vInfo.Amount); decimal rate = Convert.ToDecimal(strRate); //四舍六入五成双 decimal localAmout = Math.Round(amout / rate, 2); return localAmout.ToString(); }
/// <summary> /// 获取发票的等额人民币价值,汇率按照开票时间计算 /// </summary> /// <param name="reportID"></param> /// <returns></returns> public string GetRMBAmout(string reportID) { if (string.IsNullOrEmpty(reportID)) { throw new ArgumentNullException("reportID不能为空。"); } RentContainerReportInfo vInfo = GetByID(reportID); // 运费、滞期、速遣合计 string total = GetAmout(reportID); decimal dTotal = decimal.Parse(total); if (vInfo.CurrencyID != "1" && vInfo.InputDate == null) { return "--"; } decimal amount = new ExchangeRate().GetRMB(total, vInfo.CurrencyID, vInfo.CreateTime); return amount.ToString(); }
/// <summary> /// 获取发票的等额人民币价值,汇率按照开票时间计算 /// </summary> /// <param name="ID"></param> /// <returns></returns> public string GetRMBAmout(string ID) { if (string.IsNullOrEmpty(ID)) { throw new ArgumentNullException("发票主键不能为空。"); } VoyageOtherInfo vInfo = GetByID(ID); // 运费、滞期、速遣合计 string total = vInfo.Amount; decimal dTotal = decimal.Parse(total); if (vInfo.CurrencyID != "1" && vInfo.InputDate == null) { return "--"; } decimal amount = new ExchangeRate().GetRMB(total, vInfo.CurrencyID, vInfo.CreateTime); return amount.ToString(); }
/// <summary> /// 绑定汇率 /// </summary> private void BindRate() { string year = ddlYear.SelectedValue; string month = ddlMonth.SelectedValue; string dimID = new DimTime().GetIDByMonth(year, month); string currencyID = ddlCurrency.SelectedValue; ExchangeRateInfo eInfo = new ExchangeRate().GetInfo(currencyID, dimID); lbRate.Text = eInfo.Rate; this.RateID = eInfo.ID; }
public string GetRMBAmout(VoyageLCLInfo vInfo) { // 运费、滞期、速遣合计 string total = GetAmout(vInfo); decimal dTotal = decimal.Parse(total); if (vInfo.CurrencyID != "1" && vInfo.InputDate == null) { return "--"; } decimal amount = new ExchangeRate().GetRMB(total, vInfo.CurrencyID, vInfo.CreateTime); return amount.ToString(); }
protected void ddlDate_SelectedIndexChanged(object sender, EventArgs e) { try { string year = ddlYear.SelectedValue; string month = ddlMonth.SelectedValue; string dimID = new DimTime().GetIDByMonth(year, month); string currencyID = ddlCurrency.SelectedValue; ExchangeRateInfo eInfo = new ExchangeRate().GetInfo(currencyID, dimID); lbRate.Text = eInfo.Rate; this.RateID = eInfo.ID; } catch (ArgumentNullException aex) { ShowMsg(aex.Message); } catch (Exception ex) { ShowMsg(ex.Message); Log(ex); } }