/// <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("发票主键不能为空。"); } InvoiceInfo vInfo = new Invoice().GetByID(ID); ExchangeRateInfo eInfo = new ExchangeRate().GetInfo(vInfo.CurrencyID, vInfo.InputDate.Year, vInfo.InputDate.Month); string strRate = (eInfo.CurrencyID == "1") ? "1" : eInfo.Rate; decimal amout = Convert.ToDecimal(vInfo.Amout); decimal rate = Convert.ToDecimal(strRate); //四舍六入五成双 decimal localAmout = Math.Round(amout / rate, 2); return localAmout.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string invoiceID = GetRequest("id"); if (string.IsNullOrEmpty(invoiceID)) { ShowMsg("未指定发票,无法显示扫描图片。"); return; } this.InvoiceID = invoiceID; InvoiceInfo vInfo = new Invoice().GetByID(invoiceID); if (string.IsNullOrEmpty(vInfo.URL) == false) { imagePhoto.ImageUrl = "~/UserImg/" + vInfo.URL; } } }
private void BindList(int pageIndex, int pageSize) { if (rSearchType.SelectedValue == "1") { //按发票编号 string invoiceNum = tbInvoiceNo.Text; if (string.IsNullOrEmpty(invoiceNum)) { return; } IList<InvoiceInfo> vList = new Invoice().GetListByNumber(invoiceNum); gvList.DataSource = vList; gvList.DataBind(); } else { // 按开票日期 } }
private InvoiceInfo GetiInfoFromPage() { InvoiceInfo iInfo = new Invoice().GetByID(this.InvoiceID); HttpPostedFile upFile = flImage.PostedFile; int fileLength = upFile.ContentLength; if (fileLength <= 0) { throw new ArgumentException("操作失败,无法获取图片内容!"); } if (upFile.ContentType != "image/pjpeg") { throw new ArgumentException("操作失败,上传文件格式不正确!"); } int imageSize = 80; if (fileLength > imageSize * 1024) { throw new ArgumentException("操作失败,上传的图片超过" + imageSize + "K!"); } //无子目录 string path = GetPhysicalPath(string.Empty); if (!string.IsNullOrEmpty(iInfo.ID)) //说明做更新操作,先删除再更新 { } string fileName = string.Format("{0}_{1}.jpg", iInfo.ID, iInfo.Number); path = path + "/" + fileName; if (File.Exists(path)) { File.Delete(path); } upFile.SaveAs(path); imagePhoto.ImageUrl = "~/UserImg/" + fileName; iInfo.URL = fileName; return iInfo; }
/// <summary> /// /// </summary> /// <returns></returns> public string GetCost(string invoiceID) { if (string.IsNullOrEmpty(invoiceID)) { return "--"; } string total = new Invoice().GetRMBAmout(invoiceID); decimal dTotal = Convert.ToDecimal(total); InvoiceInfo vInfo = new Invoice().GetByID(invoiceID); decimal rate = Convert.ToDecimal(vInfo.Rate); decimal localAmout = Math.Round(dTotal / (1+ rate), 2); return localAmout.ToString(); }
private void BindGrid() { if (string.IsNullOrEmpty(this.ReportType)) { return; } sum = 0; IList<InvoiceInfo> ilist = new Invoice().GetInvoiceListAddBlank(this.ReportType, this.KeyID); gvList.DataSource = ilist; gvList.DataBind(); }
private InvoiceInfo GetiInfoFromPage() { InvoiceInfo iInfo = new Invoice().GetByID(this.PID); HttpPostedFile upFile = fuPhoto.PostedFile; int fileLength = upFile.ContentLength; if (fileLength <= 0) { throw new ArgumentException("操作失败,无法获取图片内容!"); } if (upFile.ContentType != "image/pjpeg") { throw new ArgumentException("操作失败,上传文件格式不正确!"); } int imageSize = 1024; string iSize = ConfigurationManager.AppSettings["SizeStructDiagram"]; if (iSize != String.Empty) { imageSize = int.Parse(iSize); } if (fileLength > imageSize * 1024) { iInfo = null; throw new ArgumentException("操作失败,上传的图片超过" + imageSize + "K!"); } string path = GetPhysicalPath(string.Empty); if (!string.IsNullOrEmpty(iInfo.ID)) //说明做更新操作,先删除再更新 { } string fileName = string.Format("{0}_{1}.jpg", iInfo.ID, iInfo.Number); path = path + "/" + fileName; if (File.Exists(path)) { File.Delete(path); } upFile.SaveAs(path); imagePhoto.ImageUrl = "~/UserImg/" + fileName; iInfo.URL = imagePhoto.ImageUrl; return iInfo; }