public static List <ERP_V2.Reports.TR01.TR01ReportModel> GetData() { var reportModel = new Reports.TR01.TR01ReportModel() { Provider = "落泰企業有限公司", Contact = "陳小姐", TelNo = "+886-3-3790713 分機 305", Address = "桃園市蘆竹區中福里興街225號", OrderNO = "T-0001", Date = "2017/01/01", FAX = "123-345-223-3" }; reportModel.DetaiList = new List <Reports.TR01.Detail>() { new Reports.TR01.Detail() { ItemNO = "3M-2353", Spec = "1KG/罐", Date = "2017/02/03", Qty = 5, Unit = "KG", Price = 150, TotalPrice = 750, RelativeNO = "1234-5", SeqNO = 1, REM = "USD" }, new Reports.TR01.Detail() { ItemNO = "3M-4444", Spec = "1KG/罐", Date = "2017/02/03", Qty = 5, Unit = "KG", Price = 150, TotalPrice = 750, RelativeNO = "1234-5", SeqNO = 1, REM = "USD" }, new Reports.TR01.Detail() { ItemNO = "3M-5555", Spec = "1KG/罐", Date = "2017/02/03", Qty = 5, Unit = "KG", Price = 150, TotalPrice = 750, RelativeNO = "1234-5", SeqNO = 1, REM = "USD" }, new Reports.TR01.Detail() { ItemNO = "3M-6666", Spec = "1KG/罐", Date = "2017/02/03", Qty = 5, Unit = "KG", Price = 150, TotalPrice = 750, RelativeNO = "1234-5", SeqNO = 1, REM = "USD" }, new Reports.TR01.Detail() { ItemNO = "3M-7777", Spec = "1KG/罐", Date = "2017/02/03", Qty = 5, Unit = "KG", Price = 150, TotalPrice = 750, RelativeNO = "1234-5", SeqNO = 1, REM = "USD" }, new Reports.TR01.Detail() { ItemNO = "3M-8888", Spec = "1KG/罐", Date = "2017/02/03", Qty = 5, Unit = "KG", Price = 150, TotalPrice = 750, RelativeNO = "1234-5", SeqNO = 1, REM = "USD" }, new Reports.TR01.Detail() { ItemNO = "3M-9999", Spec = "1KG/罐", Date = "2017/02/03", Qty = 5, Unit = "KG", Price = 150, TotalPrice = 750, RelativeNO = "1234-5", SeqNO = 1, REM = "USD" } }; var result = new List <ERP_V2.Reports.TR01.TR01ReportModel>(); result.Add(reportModel); return(result); }
public ActionResult CreateReport(int key) { TR01Service _Service = new TR01Service(); var temp = _Service.GetMD(key); var model = new ERP_V2.ViewModels.TR01.Edit(); model.Master = new ERP_V2.ViewModels.TR01.TR01AViewModel(temp.Master); var entity = new PURSysEntities(); var BA01B = entity.BA01B.FirstOrDefault(x => x.BA01B_ID == model.Master.BA01B_ID); if (BA01B == null) { BA01B = new BA01B(); } var BA01A = entity.BA01A.FirstOrDefault(x => x.BA01A_ID == model.Master.BA01A_ID); var dataCollection = new List <ERP_V2.ViewModels.TR01.TR01BViewModel>(); foreach (var item in temp.DetaiList) { dataCollection.Add(new ERP_V2.ViewModels.TR01.TR01BViewModel(item)); } model.DetailList = dataCollection; var companyName = model.Master.CPN_NM; decimal taxRate = 1; if (model.Master.TAX_RT.HasValue) { taxRate = decimal.Parse(model.Master.TAX_RT.Value.ToString()); } var reportModel = new Reports.TR01.TR01ReportModel() { Company = model.Master.CPN_NM, Provider = BA01A.INC_NM, Contact = BA01B.CNT_NM, TelNo = BA01B.TEL_NO, Address = BA01A.ADD_DR, OrderNO = model.Master.PUR_NO, Date = model.Master.DtPUR_DT.Value.ToString("yyyy/MM/dd"), FAX = BA01A.FAX_NO, TaxRate = taxRate }; reportModel.Unit = entity.BA03A.FirstOrDefault(x => x.BA03A_ID == model.Master.BA03A_ID).CUR_NM; reportModel.DetaiList = new List <Reports.TR01.Detail>(); int i = 1; decimal total = 0; foreach (var item in dataCollection) { var BA02A = entity.BA02A.FirstOrDefault(x => x.BA02A_ID == item.BA02A_ID); var detailItem = new Reports.TR01.Detail() { ItemNO = item.ITM_NM, Spec = BA02A.ITM_SP, Date = model.Master.DtEXP_DT.Value.ToString("yyyy/MM/dd"), Qty = item.PUR_QT, Unit = BA02A.UNT_NM, Price = item.PUR_PR.Value, TotalPrice = item.PUR_QT * item.PUR_PR.Value, RelativeNO = item.REL_NO, SeqNO = i, REM = item.REM_MM }; total += detailItem.TotalPrice; reportModel.DetaiList.Add(detailItem); i++; } var result = new List <ERP_V2.Reports.TR01.TR01ReportModel>(); reportModel.Price = total;//未稅 reportModel.TotalSummaryPrice = total * taxRate; if (UserInfo.LanguageType == Utility.Language.Type.VN) { } reportModel.TotalSummaryPrice = Math.Round(reportModel.TotalSummaryPrice, 0); var str = reportModel.TotalSummaryPrice.ToString("G29"); if (str == "0") { reportModel.MoneyInChinese = ""; } else { reportModel.MoneyInChinese = " " + ConvertVN(str); //EastAsiaNumericFormatter.FormatWithCulture("L", total, null, new CultureInfo("zh-TW")); } // var tempNum = EastAsiaNumericFormatter.FormatWithCulture("L", 50500, null, new CultureInfo("zh-TW")); result.Add(reportModel); System.Web.HttpContext.Current.Session["tempData"] = result; return(View()); }