/// <summary> /// 更新期初数 /// </summary> /// <param name="data"></param> /// <returns></returns> public string UpdBeginningBalance(string data) { string strFmt = "{{\"Result\":{0},\"Msg\":\"{1}\"}}"; string msg = string.Empty; List <T_BeginningBalance> beginningBalance = new JavaScriptSerializer().Deserialize <List <T_BeginningBalance> >(data); T_BeginningBalance currItem = new T_BeginningBalance(); while (beginningBalance.Any(i => i.children.Count > 0)) { currItem = beginningBalance.Where(i => i.children.Count > 0).FirstOrDefault(); beginningBalance.AddRange(currItem.children); currItem.children = new List <T_BeginningBalance>(); } bool result = false; if (true) { result = new ReportSvc().UpdBeginningBalance(beginningBalance, Session["CurrentCompanyGuid"].ToString()); msg = result ? General.Resource.Common.Success : General.Resource.Common.Failed; } else { msg = FMS.Resource.FinanceReport.FinanceReport.VaildError; } return(string.Format(strFmt, result.ToString().ToLower(), msg)); }
public string GetRPVoucher(string id, string reportDate, string type, string flag) { T_Report <T_IncomeStatementTemplate> rep = new T_Report <T_IncomeStatementTemplate>(); rep = new ReportSvc().GetRPVoucher(CompanyId(), flag, reportDate, type); return(new JavaScriptSerializer().Serialize(rep.Details)); }
/// <summary> /// 判断流水账部分编辑修改,新增是否已结账 /// </summary> /// <returns></returns> /// <remarks> /// 2017/4/3 sunp update /// </remarks> public string isCheckout(string repDate, string status) { int count = 0; ExceResult res = new ExceResult(); string CId = CompanyId(); List <T_Report <IncomeStatement> > rep = new List <T_Report <IncomeStatement> >(); rep = new ReportSvc().isCheckout(repDate, status, out count, CId); string msg = string.Empty; bool result = false; if (rep.Count == 0) { msg = General.Resource.Common.Success; result = true; } else { msg = General.Resource.Common.Failed; result = false; } return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}" , result.ToString().ToLower(), msg)); }
/// <summary> /// 获取资产负债表列表 /// </summary> /// <returns></returns> /// <remarks> /// 2017/1/3 liujf update /// </remarks> public string GetReportList(string reportDate, string type) { string CId = CompanyId(); List <T_Report <T_BalanceSheetTemplate> > lst = ReportSvc.GetBalanceSheetList(CId, reportDate, type); return(JsonConvert.SerializeObject(lst)); }
/// <summary> /// 获取资产负债表列表(废弃) /// </summary> /// <returns></returns> public string GetReportList(string reportDate, string type) { string CId = CompanyId(); List <T_Report <T_CashFlowItemTemplate> > lst = ReportSvc.GetCashFlowList(CId, reportDate, type); return(JsonConvert.SerializeObject(lst)); }
public string GetReportDateList(string reportDate, string type) { string CId = CompanyId(); List <T_Report <T_IncomeStatementTemplate> > lst = ReportSvc.GetReportDateList <T_IncomeStatementTemplate>(CId, reportDate, type); return(JsonConvert.SerializeObject(lst)); }
/// <summary> /// 获取现金流量表列表 /// </summary> /// <param name="page">页索引</param> /// <param name="rows">页大小</param> /// <returns></returns> public string GetCashFlowStatements(string page = "1", string rows = "10") { int count = 0; List <T_Report <T_CashFlowItemTemplate> > reps = new ReportSvc().GetCashFlowStatements (Session["CurrentCompanyGuid"].ToString()); return(new JavaScriptSerializer().Serialize(reps)); }
/// <summary> /// 更新现金流量表 /// </summary> /// <returns></returns> public string UpdCashFlowStatement() { string strFmt = "{{\"Result\":{0},\"Msg\":\"{1}\"}}"; bool result = new ReportSvc().UpdCashFlowStatement(Session["CurrentCompany"].ToString()); return(string.Format(strFmt, result.ToString().ToLower(), result ? General.Resource.Common.Success : General.Resource.Common.Failed)); }
/// <summary> /// 获取现金流量表列表 /// </summary> /// <param name="page">页索引</param> /// <param name="rows">页大小</param> /// <returns></returns> public string GetCashFlowStatements(string page, string rows) { int count = 0; List <T_Report> reps = new ReportSvc().GetCashFlowStatements (Session["CurrentCompany"].ToString(), int.Parse(page), int.Parse(rows), out count); string strFmt = "{{\"total\":{0},\"rows\":{1}}}"; return(string.Format(strFmt, count, new JavaScriptSerializer().Serialize(reps))); }
/// <summary> /// 验证起初数 /// </summary> /// <returns></returns> public string VaildBeginningBalance() { string strFmt = "{{\"Result\":{0},\"Msg\":\"{1}\"}}"; List <T_BeginningBalance> beginningBalance = new ReportSvc().VaildBeginningBalance(Session["CurrentCompanyGuid"].ToString()); bool result = beginningBalance.Any(); return(string.Format(strFmt, result.ToString().ToLower(), result ? string.Empty : FinanceReport.BeginningBalanceError)); }
/// <summary> /// 获取科目汇总信息 /// </summary> /// <remarks>借用T_BeginningBalance模型</remarks> /// <returns></returns> public string GetAccSum() { string strFmt = "{{\"total\":{0},\"rows\":{1}}}"; List <T_BeginningBalance> beginningBalance = new ReportSvc().GetAccountSummary(Session["CurrentCompanyGuid"].ToString()); return(string.Format(strFmt, beginningBalance.Count, GenBalanceJson(beginningBalance))); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <param name="reportDate"></param> /// <param name="type"></param> /// <param name="status"></param> /// <returns></returns> public List <T_BalanceSheetTemplate> GetBanlance(string id, string reportDate, string type, string status, string end) { T_Report <T_BalanceSheetTemplate> rep = new T_Report <T_BalanceSheetTemplate>(); string Begin_date = string.Empty; string End_date = string.Empty; string report_fix = "BS"; ReportSvc svc = new ReportSvc(); if (type != "seach") { Common.Function.Common.GetReportDateAndRepNo(reportDate, type, ref report_fix, ref Begin_date, ref End_date); var date = DateTime.Parse(Begin_date); Begin_date = date.AddMonths(1 - date.Month).ToString("yyyy/MM/dd"); } else { Begin_date = DateTime.Now.ToString("yyyy") + "/01/01"; End_date = end; report_fix += "D"; } rep.RepNo = report_fix; if (string.IsNullOrEmpty(id)) { rep = svc.GenPerviewBalanceSheet(CompanyId(), reportDate, type); } else { rep = svc.GetBalanceSheet(id); } if (status != "已结账") { List <T_BalanceSheetTemplate> lstBan = rep.Details; foreach (var item in lstBan) { if (item.asset_row_no != 14 && item.asset_row_no != 9 && item.asset_row_no != 24 && item.asset_row_no != 26 && item.asset_row_no != 28) { item.asset_start_amount = null; item.asset_end_amount = null; } if (item.debt_row_no != 38 && item.debt_row_no != 40 && item.debt_row_no != 40 && item.debt_row_no != 45) { item.debt_start_amount = null; item.debt_end_amount = null; } if (item.debt_row_no == 51) { item.debt_end_amount = svc.GetProfitYearAmount(CompanyId(), Begin_date, End_date); } } GetBalanceAmount(rep, Begin_date, End_date); } return(rep.Details); }
/// <summary> /// 资产负债表信息页面 /// </summary> /// <param name="id">资产负债表标识</param> /// <returns></returns> public ActionResult BalanceSheet(string id) { if (string.IsNullOrEmpty(id)) { T_Report rep = new ReportSvc().GenPerviewBalanceSheet(Session["CurrentCompany"].ToString()); return(View(rep)); } else { return(View(new ReportSvc().GetBalanceSheet(id))); } }
/// <summary> /// 获取起初数 /// </summary> /// <returns></returns> public string GetBeginningBalance() { string strFmt = "{{\"total\":{0},\"rows\":{1},\"footer\":{2}}}"; string strFooter = "[{{\"Acc_Name\":\"资产合计:\",\"Money\":{0}}},{{\"Acc_Name\":\"负债及所有者权益合计:\",\"Money\":\"{1}\"}}]"; List <T_BeginningBalance> beginningBalance = new ReportSvc().GetBeginningBalance(Session["CurrentCompanyGuid"].ToString()); //return string.Format(strFmt, beginningBalance.Count, GenBeginningBalanceJson(beginningBalance,string.Empty)); return(string.Format(strFmt, beginningBalance.Count, GenBeginningBalanceJson(beginningBalance), string.Format(strFooter, 0, 0))); }
/// <summary> /// 现金流量表信息页 /// </summary> /// <param name="id">现金流量表标识</param> /// <returns></returns> public ActionResult CashFlowStatement(string id) { CashFlowStatement rep = new CashFlowStatement(); if (string.IsNullOrEmpty(id)) { rep = new ReportSvc().GenPerviewCashFlowStatement(Session["CurrentCompany"].ToString()); } else { rep = new ReportSvc().GetCashFlowStatement(id); } return(View(rep)); }
/// <summary> /// 利润表信息页 /// </summary> /// <param name="id">利润表标识</param> /// <returns></returns> public ViewResult IncomeStatement(string id) { IncomeStatement rep = new IncomeStatement(); if (string.IsNullOrEmpty(id)) { rep = new ReportSvc().GenPerviewIncomeStatement(Session["CurrentCompany"].ToString()); } else { rep = new ReportSvc().GetIncomeStatement(id); } return(View(rep)); }
/// <summary> /// 获取利润表明细 /// </summary> /// <param name="id"></param> /// <returns></returns> /// <remarks> /// 2017/1/4 liujf update /// </remarks> public string GetIncomeStatement(string id, string reportDate, string type) { T_Report <T_IncomeStatementTemplate> rep = new T_Report <T_IncomeStatementTemplate>(); if (string.IsNullOrEmpty(id)) { rep = new ReportSvc().GenPerviewIncomeStatement(CompanyId(), reportDate, type); } else { //rep = new ReportSvc().GetIncomeStatement(id); rep = new ReportSvc().GenPerviewIncomeStatement(CompanyId(), reportDate, type); } return(new JavaScriptSerializer().Serialize(rep.Details)); }
/// <summary> /// 更新利润表 /// </summary> /// <returns></returns> /// <remarks> /// 2017/1/3 liujf update /// </remarks> public string CreateIncomeStatement(string repDate, string type) { ExceResult res = new ExceResult(); string result = new ReportSvc().CreateIncomeStatement(CompanyId(), repDate, type); if (string.IsNullOrEmpty(result)) { res.success = true; } else { res.success = false; res.msg = result; } return(Newtonsoft.Json.JsonConvert.SerializeObject(res)); }
/// <summary> /// 获取现金流量明细 /// </summary> /// <param name="id"></param> /// <returns></returns> public string GetCashFlowStatement(string id, string reportDate, string type) { T_Report <T_CashFlowItemTemplate> rep = new T_Report <T_CashFlowItemTemplate>(); if (string.IsNullOrEmpty(id)) { rep = new ReportSvc().GenPerviewCashFlowStatement(CompanyId(), reportDate, type); } else { //rep = new ReportSvc().GetCashFlowStatement(id); rep = new ReportSvc().GenPerviewCashFlowStatement(CompanyId(), reportDate, type); } return(JsonConvert.SerializeObject(rep.Details)); }
public string CreateBalanceSheet(string repDate, string type, List <T_BalanceSheetTemplate> lstBanlance) { ExceResult res = new ExceResult(); string result = ""; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required)) { string strReportID = Guid.NewGuid().ToString(); string strRepNo = "BS"; string strStart = string.Empty; string strEnd = string.Empty; Common.Function.Common.GetReportDateAndRepNo(repDate, type, ref strRepNo, ref strStart, ref strEnd); result = new ReportSvc().CreateReportInfo(CompanyId(), repDate, type, strReportID, strRepNo + repDate); if (string.IsNullOrEmpty(result)) { T_ReportDetails report = new T_ReportDetails(); DataTable dtBanlance = Common.Function.Common.GetTableByEntity <T_ReportDetails>(report); foreach (var item in lstBanlance) { //result = new ReportSvc().CreateReportDetailByBanlance(item, strReportID); //if (!string.IsNullOrEmpty(result)) //{ // break; //} addDataToTableByEntity(item, dtBanlance, strReportID); } result = new ReportSvc().CreateReportDetailByBanlance(dtBanlance, typeof(T_ReportDetails).Name); } if (string.IsNullOrEmpty(result)) { scope.Complete(); } } //string result = new ReportSvc().UpdBalanceSheet(CompanyId(), repDate,type,lstBanlance); if (string.IsNullOrEmpty(result)) { res.success = true; } else { res.success = false; res.msg = result; } return(Newtonsoft.Json.JsonConvert.SerializeObject(res)); }
/// <summary> /// 资产负债表信息页面 /// </summary> /// <param name="id">资产负债表标识</param> /// <returns></returns> /// <remarks> /// 2017/1/3 liujf update /// </remarks> public ActionResult BalanceSheet(string id, string reportDate, string type, string status, string end) { switch (type) { case "month": ViewBag.RepTitle = reportDate + "(月度)"; break; case "quarter": ViewBag.RepTitle = reportDate + "(季度)"; break; case "year": ViewBag.RepTitle = reportDate + "(年度)"; break; case "seach": ViewBag.RepTitle = end + "(时间)"; break; default: break; } ViewBag.Type = type; ViewBag.RepDate = reportDate; if (string.IsNullOrEmpty(id)) { T_Report <T_BalanceSheetTemplate> rep = new ReportSvc().GenPerviewBalanceSheet(CompanyId(), reportDate, type); ViewBag.IsView = false; ViewBag.RepId = string.Empty; ViewBag.Status = status; ViewBag.End = end; return(View(rep)); } else { ViewBag.IsView = true; ViewBag.RepId = id; ViewBag.Status = status; ViewBag.End = end; //获取报表日期 return(View()); } }
/// <summary> /// 结账反结账 /// </summary> /// <returns></returns> /// <remarks> /// 2017/3/22 sunp update /// </remarks> public string settled(string id, string status) { ExceResult res = new ExceResult(); bool result = new ReportSvc().settled(id, status); string msg = string.Empty; if (result) { msg = General.Resource.Common.Success; } else { msg = General.Resource.Common.Failed; } return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}" , result.ToString().ToLower(), msg)); }
/// <summary> /// 结账反结账(现金流量表) /// </summary> /// <returns></returns> /// <remarks> /// 2018/06/07 zm /// </remarks> public string settledcash(string id, string status, string repDate, string period) { string CId = CompanyId(); ExceResult res = new ExceResult(); bool result = new ReportSvc().settledcash(id, status, CId, repDate, period); string msg = string.Empty; if (result) { msg = General.Resource.Common.Success; } else { msg = General.Resource.Common.Failed; } return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}" , result.ToString().ToLower(), msg)); }
/// <summary> /// 利润表信息页 /// </summary> /// <param name="id">利润表标识</param> /// <returns></returns> public ActionResult IncomeStatement(string id, string reportDate, string type, string status, string period) { switch (type) { case "month": ViewBag.RepTitle = reportDate + "(月度)"; break; case "quarter": ViewBag.RepTitle = reportDate + "(季度)"; break; case "year": ViewBag.RepTitle = reportDate + "(年度)"; break; default: break; } ViewBag.Period = period; ViewBag.Type = type; ViewBag.RepDate = reportDate; ViewBag.status = status; if (string.IsNullOrEmpty(id)) { T_Report <T_IncomeStatementTemplate> rep = new ReportSvc().GenPerviewIncomeStatement(CompanyId(), reportDate, type); ViewBag.IsView = false; ViewBag.RepId = string.Empty; return(View(rep)); } else { ViewBag.IsView = true; ViewBag.RepStatus = status; ViewBag.RepId = id; //获取报表日期 return(View()); } }
public bool AddNewCompany(FormCollection form) { bool result = false; List <T_Company> Info = new List <T_Company>(); Info = new CompanySvc().GetCompanyInfo("", form["CompanyID"]); if (Info.Count.Equals(0)) { //创建 //UpdCompany T_Company company = new T_Company(); company.C_GUID = Guid.NewGuid().ToString(); Session["C_GUID"] = company.C_GUID; company.Name = form["Name"]; company.Taxpayer = form["TaxO"]; company.CompanyID = form["CompanyID"]; string address = form["country"] + "-" + form["province"] + "-" + form["city"]; company.Address = address; company.Country = form["country"]; company.Province = form["province"]; company.City = form["city"]; company.Contacter = ""; company.ContactWay = ""; company.Type = ""; company.AuditDate = DateTime.Today.ToString(); if (new CompanySvc().UpdCompany(company, "", Session["CurrentUserGuid"].ToString())) { AddCompanyCurrency(company.C_GUID, form["Currency"]); AddCompanySetting(company.C_GUID, form["Currency"]); if (Session["CurrentCompanyGuid"].ToString() == "") { Session["CurrentCompanyGuid"] = company.C_GUID; } Session["Currency"] = form["Currency"]; int count = 0; List <T_ExpenseType> List = new List <T_ExpenseType>(); string cid = "66666666-6666-6666-6666-666666666666"; List = new DetailSvc().GetExpenseTypeList(cid, out count); string id = company.C_GUID.ToString(); for (var i = 0; i < List.Count; i++) { string newID = Guid.NewGuid().ToString(); T_ExpenseType form1 = new T_ExpenseType(); form1.ET_GUID = newID; form1.ExpenseType = List[i].ExpenseType; form1.ExpenseFlag = List[i].ExpenseFlag; form1.SaleFlag = List[i].SaleFlag; form1.ManageFlag = List[i].ManageFlag; form1.FinanceFlag = List[i].FinanceFlag; form1.OtherFlag = List[i].OtherFlag; form1.TaxFlag = List[i].TaxFlag; result = new DetailSvc().UpdExpenseTypeRecord(form1, id); } List <T_Tax> ListTax = new List <T_Tax>(); ListTax = new TaxSvc().GetTax(cid); for (var i = 0; i < ListTax.Count; i++) { string newID = Guid.NewGuid().ToString(); T_Tax form2 = new T_Tax(); form2.T_GUID = newID; form2.Name = ListTax[i].Name; form2.Rate = ListTax[i].Rate; form2.Type = ListTax[i].Type; form2.C_GUID = id; new TaxSvc().UpdTax(form2); } //List<T_RateHistory> RateList = new List<T_RateHistory>(); //RateList = new CurrencySvc().GetRateModel(cid,form["Currency"]); //for (var i = 0; i < RateList.Count; i++) //{ // string newID = Guid.NewGuid().ToString(); // T_RateHistory form3 = new T_RateHistory(); // form3.GUID = newID; // form3.FAmount = RateList[i].FAmount; // form3.FCurrency = RateList[i].FCurrency; // form3.TAmount = RateList[i].TAmount; // form3.TCurrency = RateList[i].TCurrency; // form3.CurrentRecord = RateList[i].CurrentRecord; // form3.Currency = RateList[i].Currency; // form3.Rate = RateList[i].Rate; // form3.TRate = RateList[i].TRate; // form3.C_GUID = id; // new CurrencySvc().UpdRateHistory(form3); //} /*添加快速关注模板(新建model以及表)**/ new AccountSvc().UpdIntAccount(cid, id); string Nowtime = GetMinutesDate().ToString(); List <T_QuickAttention> QuickAttenList = new List <T_QuickAttention>(); QuickAttenList = new ReportSvc().GetQuickAttentionModel(cid); for (var i = 0; i < QuickAttenList.Count; i++) { string newID = Guid.NewGuid().ToString(); T_QuickAttention form4 = new T_QuickAttention(); form4.id = newID; form4.c_guid = id; form4.attention_type = QuickAttenList[i].attention_type; form4.attention_type_amount = QuickAttenList[i].attention_type_amount; form4.statistical_time = Convert.ToDateTime(Nowtime); form4.statistical_currency = QuickAttenList[i].statistical_currency; form4.attention_state = QuickAttenList[i].attention_state; form4.push_account = QuickAttenList[i].push_account; form4.push_frequency = QuickAttenList[i].push_frequency; form4.company_name = QuickAttenList[i].company_name; new ReportSvc().UpdQuickAttention(form4); } result = true; } } else { result = false; } return(result); }
public void GetBalanceAmount(T_Report <T_BalanceSheetTemplate> rep, string beginDate, string endDate) { DataTable dtBanlanceAmount = new DataTable(); dtBanlanceAmount = new ReportSvc().GetBanlanceAmount(CompanyId(), beginDate, endDate); List <T_BalanceSheetTemplate> lstBanlance = rep.Details; for (int i = 0; i < lstBanlance.Count(); i++) { if (lstBanlance[i].asset_row_no != null) { DataRow[] drBanlance = dtBanlanceAmount.Select("Balanceitem_name='" + lstBanlance[i].asset_item_name + "'"); if (drBanlance.Length > 0) { string strName = string.Empty; for (int j = 0; j < drBanlance.Length; j++) { if (strName != drBanlance[j]["Name"].ToString()) { if (drBanlance[j]["addOrDecrease"].ToString() == "0") { lstBanlance[i].asset_start_amount = Common.Function.Common.GetAmountValue(lstBanlance[i].asset_start_amount.ToString()) + Common.Function.Common.GetAmountValue(drBanlance[j]["OldAmount"].ToString()); lstBanlance[i].asset_end_amount = Common.Function.Common.GetAmountValue(drBanlance[j]["OldAmount"].ToString()) + Common.Function.Common.GetAmountValue(lstBanlance[i].asset_end_amount.ToString()) + Common.Function.Common.GetAmountValue(drBanlance[j]["Amount"].ToString()); } else { lstBanlance[i].asset_start_amount = Common.Function.Common.GetAmountValue(lstBanlance[i].asset_start_amount.ToString()) - Common.Function.Common.GetAmountValue(drBanlance[j]["OldAmount"].ToString()); lstBanlance[i].asset_end_amount = Common.Function.Common.GetAmountValue(drBanlance[j]["OldAmount"].ToString()) + Common.Function.Common.GetAmountValue(lstBanlance[i].asset_end_amount.ToString()) + Common.Function.Common.GetAmountValue(drBanlance[j]["Amount"].ToString()); } } //else //{ // if (drBanlance[j]["addOrDecrease"].ToString() == "0") // { // lstBanlance[i].asset_end_amount = Common.Function.Common.GetAmountValue(drBanlance[j]["Amount"].ToString()); // } // else // { // lstBanlance[i].asset_end_amount = Common.Function.Common.GetAmountValue(drBanlance[j]["Amount"].ToString()); // } //} strName = drBanlance[j]["Name"].ToString(); } } } if (lstBanlance[i].debt_row_no != null) { DataRow[] drBanlance = dtBanlanceAmount.Select("Balanceitem_name='" + lstBanlance[i].debt_item_name + "'"); if (drBanlance.Length > 0) { string strName = string.Empty; for (int j = 0; j < drBanlance.Length; j++) { if (strName != drBanlance[j]["Name"].ToString()) { if (drBanlance[j]["addOrDecrease"].ToString() == "0") { lstBanlance[i].debt_start_amount = Common.Function.Common.GetAmountValue(lstBanlance[i].debt_start_amount.ToString()) + Common.Function.Common.GetAmountValue(drBanlance[j]["OldAmount"].ToString()); lstBanlance[i].debt_end_amount = Common.Function.Common.GetAmountValue(drBanlance[j]["OldAmount"].ToString()) + Common.Function.Common.GetAmountValue(lstBanlance[i].debt_end_amount.ToString()) + Common.Function.Common.GetAmountValue(drBanlance[j]["Amount"].ToString()); } else { lstBanlance[i].debt_start_amount = Common.Function.Common.GetAmountValue(lstBanlance[i].debt_start_amount.ToString()) - Common.Function.Common.GetAmountValue(drBanlance[j]["OldAmount"].ToString()); lstBanlance[i].debt_end_amount = Common.Function.Common.GetAmountValue(drBanlance[j]["OldAmount"].ToString()) + Common.Function.Common.GetAmountValue(lstBanlance[i].debt_end_amount.ToString()) + Common.Function.Common.GetAmountValue(drBanlance[j]["Amount"].ToString()); } } //else //{ // if (drBanlance[j]["addOrDecrease"].ToString() == "0") // { // lstBanlance[i].debt_end_amount = Common.Function.Common.GetAmountValue(drBanlance[j]["Amount"].ToString()); // } // else // { // lstBanlance[i].debt_end_amount = Common.Function.Common.GetAmountValue(drBanlance[j]["Amount"].ToString()); // } //} strName = drBanlance[j]["Name"].ToString(); } } } } }
/// <summary> /// 结账功能 /// </summary> /// <param name="id"></param> /// <param name="repDate"></param> /// <param name="type"></param> /// <param name="status"></param> /// <returns></returns> public string UpdBalance(string id, string repDate, string type, string status) { ExceResult res = new ExceResult(); string result = ""; ReportSvc svc = new ReportSvc(); using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required)) { if (status == "已结账") { T_ReportDetails report = new T_ReportDetails(); DataTable dtBanlance = Common.Function.Common.GetTableByEntity <T_ReportDetails>(report); List <T_BalanceSheetTemplate> lstBanlance = new List <T_BalanceSheetTemplate>(); lstBanlance = GetBanlance(id, repDate, type, "未结账", ""); //执行创建资产负债表操作 string strReportID = Guid.NewGuid().ToString(); string strRepNo = "BS"; string strStart = string.Empty; string strEnd = string.Empty; Common.Function.Common.GetReportDateAndRepNo(repDate, type, ref strRepNo, ref strStart, ref strEnd); if (string.IsNullOrEmpty(id)) { result = new ReportSvc().CreateReportInfo(CompanyId(), repDate, type, strReportID, strRepNo + repDate); id = strReportID; } else { result = svc.DeleteReportDetail(id); } if (string.IsNullOrEmpty(result)) { foreach (var item in lstBanlance) { addDataToTableByEntity(item, dtBanlance, id); } result = new ReportSvc().CreateReportDetailByBanlance(dtBanlance, typeof(T_ReportDetails).Name); } if (type == "month") { DateTime dtRep = DateTime.Parse(repDate + "/01"); //if (dtRep.Month == 6) if (dtRep.Month == 12) { if (!svc.CreateHisBeginBalance(CompanyId(), dtRep.ToString("yyyy/MM/dd"))) { result = "科目初始值更新失败!"; } } } } else { if (type == "month") { DateTime dtRep = DateTime.Parse(repDate + "/01"); //if (dtRep.Month == 6) if (dtRep.Month == 12) { if (!svc.UpdateHisToBeginBalance(CompanyId(), dtRep.ToString("yyyy/MM/dd"))) { result = "科目初始值撤销失败!"; } } } } if (svc.settled(id, status)) { scope.Complete(); } else { result = "状态修改失败"; } } //string result = new ReportSvc().UpdBalanceSheet(CompanyId(), repDate,type,lstBanlance); if (string.IsNullOrEmpty(result)) { res.success = true; } else { res.success = false; res.msg = result; } return(Newtonsoft.Json.JsonConvert.SerializeObject(res)); }