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));
        }
Example #2
0
        /// <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);
        }
Example #3
0
        /// <summary>
        /// 获取现金流量表明细
        /// </summary>
        /// <param name="id">现金流量表标识</param>
        /// <returns></returns>
        public T_Report <T_CashFlowItemTemplate> GetCashFlowStatement(string id)
        {
            DBHelper dh = new DBHelper();
            T_Report <T_CashFlowItemTemplate> rep = new T_Report <T_CashFlowItemTemplate>();

            dh.strCmd = "[SP_GetReportDetails]";
            dh.AddPare("@RepID", SqlDbType.VarChar, 40, id);
            rep.Details = dh.Reader <T_CashFlowItemTemplate>();

            return(rep);
        }
Example #4
0
        /// <summary>
        /// 获取资产负债表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public T_Report <T_BalanceSheetTemplate> GetBalanceSheet(string id)
        {
            DBHelper dh = new DBHelper();
            T_Report <T_BalanceSheetTemplate> rep = new T_Report <T_BalanceSheetTemplate>();

            dh.strCmd = "[SP_GetReportDetails]";
            dh.AddPare("@RepID", SqlDbType.NVarChar, 40, id);
            rep.Details = dh.Reader <T_BalanceSheetTemplate>();

            return(rep);
        }
Example #5
0
        public T_Report <T_IncomeStatementTemplate> GetVoucher(int pageIndex, int pageSize, out int count, string id, string flag)
        {
            T_Report <T_IncomeStatementTemplate> result = new T_Report <T_IncomeStatementTemplate>();
            DBHelper dh = new DBHelper();

            dh.strCmd = "SP_GetIEVoucher";
            dh.AddPare("@IE_GUID", SqlDbType.NVarChar, 50, id);
            dh.AddPare("@Count", SqlDbType.Int, ParameterDirection.Output, 0, null);
            dh.AddPare("@FLAG", SqlDbType.NVarChar, 1, flag);
            result.Details = dh.Reader <T_IncomeStatementTemplate>();
            count          = dh.GetParaValue <int>("@Count");
            return(result);
        }
Example #6
0
        /// <summary>
        /// 生成资产负债预览表
        /// </summary>
        /// <param name="c_id">公司标识</param>
        /// <returns></returns>
        public T_Report <T_BalanceSheetTemplate> GenPerviewBalanceSheet(string c_id, string reportDate, string type)
        {
            T_Report <T_BalanceSheetTemplate> rep = new T_Report <T_BalanceSheetTemplate>();
            DBHelper dh = new DBHelper();

            dh.strCmd = "SP_GenPerviewBalanceSheet";
            dh.AddPare("@C_ID", SqlDbType.NVarChar, 40, c_id);
            dh.AddPare("@report_date", SqlDbType.VarChar, 10, reportDate);
            dh.AddPare("@period_type", SqlDbType.VarChar, 50, type);
            dh.AddPare("@RepNo", SqlDbType.NVarChar, ParameterDirection.Output, 40, null);
            rep.Details = dh.Reader <T_BalanceSheetTemplate>();
            rep.RepNo   = dh.GetParaValue <string>("@RepNo");
            return(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>
        /// <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));
        }
        /// <summary>
        /// 现金流量表信息页
        /// </summary>
        /// <param name="id">现金流量表标识</param>
        /// <returns></returns>
        public ActionResult CashFlowStatements(string id, string status, string reportDate, string type)
        {
            switch (type)
            {
            case "month":
                ViewBag.RepTitle = reportDate + "(月度)";
                break;

            case "quarter":
                ViewBag.RepTitle = reportDate + "(季度)";
                break;

            case "year":
                ViewBag.RepTitle = reportDate + "(年度)";
                break;

            default:
                break;
            }

            ViewBag.Type    = type;
            ViewBag.RepDate = reportDate;
            ViewBag.status  = status;

            if (string.IsNullOrEmpty(id))
            {
                T_Report <T_CashFlowItemTemplate> rep = new T_Report <T_CashFlowItemTemplate>();
                rep = new ReportSvc().GenPerviewCashFlowStatement(CompanyId(), reportDate, type);

                ViewBag.IsView = false;
                ViewBag.RepId  = string.Empty;
                return(View(rep));
            }
            else
            {
                ViewBag.IsView = true;
                ViewBag.RepId  = id;
                //获取报表日期
                return(View());
            }
        }
Example #10
0
        public T_Report <T_IncomeStatementTemplate> GetRPVoucher(string c_id, string flag, string reportDate, string type)
        {
            T_Report <T_IncomeStatementTemplate> rep = new T_Report <T_IncomeStatementTemplate>();

            rep = new ReportSvc().GenPerviewIncomeStatement(c_id, reportDate, type);
            for (int i = 0; i < rep.Details.Count; i++)
            {
                if (rep.Details[i].row_no == 1 || rep.Details[i].row_no == 4 || rep.Details[i].row_no == 5 || rep.Details[i].row_no == 10 || rep.Details[i].row_no == 11 || rep.Details[i].row_no == 12 || rep.Details[i].row_no == 13 || rep.Details[i].row_no == 15 || rep.Details[i].row_no == 18)
                {
                    rep.Details[i].Summary   = "借";
                    rep.Details[i].item_name = rep.Details[i].item_name;
                    rep.Details[i].amount_r  = rep.Details[i].amount;
                }
                if (rep.Details[i].row_no == 2 || rep.Details[i].row_no == 3 || rep.Details[i].row_no == 6 || rep.Details[i].row_no == 7 || rep.Details[i].row_no == 8 || rep.Details[i].row_no == 9 || rep.Details[i].row_no == 14 || rep.Details[i].row_no == 16 || rep.Details[i].row_no == 17)
                {
                    rep.Details[i].Summary   = "贷";
                    rep.Details[i].item_name = rep.Details[i].item_name;
                    rep.Details[i].amount_p  = rep.Details[i].amount;
                }
            }
            return(rep);
        }
Example #11
0
        public static List <T_Report <T> > GetReportDateList <T>(string companyId, string reportDate, string type)
        {
            DBHelper dh = new DBHelper();

            dh = GetBeginingDate(companyId);
            T_BeginningBalance beginDate = dh.Reader <T_BeginningBalance>().FirstOrDefault();
            Type   typeClass             = typeof(T);
            string strContent            = string.Empty;

            switch (typeClass.Name)
            {
            case "T_BalanceSheetTemplate":
                strContent = "BS";
                break;

            case "T_CashFlowItemTemplate":
                strContent = "CF";
                break;

            case "T_IncomeStatementTemplate":
                strContent = "PL";
                break;

            default:
                strContent = "BS";
                break;
            }
            dh = GetReportDateList(companyId, strContent, reportDate, type);

            List <T_Report <T> > reps       = dh.Reader <T_Report <T> >();
            List <T_Report <T> > repsDetail = new List <T_Report <T> >();
            DateTime             dtNow      = DateTime.Now;
            DateTime             dtBeingin  = new DateTime();
            int length = 0;

            if (type == "month")
            {
                if (beginDate != null && beginDate.InitialDate != null)
                {
                    dtBeingin = DateTime.Parse(beginDate.InitialDate);

                    if (dtBeingin.Year == dtNow.Year)
                    {
                        length = dtNow.Month - dtBeingin.Month;
                    }
                    else
                    {
                        dtBeingin = DateTime.Parse(dtNow.ToString("yyyy") + "/01/01");
                        length    = dtNow.Month - 1;
                    }
                }
                else
                {
                    length    = dtNow.Month - 1;
                    dtBeingin = DateTime.Parse(dtNow.ToString("yyyy") + "/01/01");
                }
                for (int i = 0; i < length; i++)
                {
                    T_Report <T> reportDetail = new T_Report <T>();
                    reportDetail.rep_date    = dtBeingin.AddMonths(i).ToString("yyyy/M");
                    reportDetail.rep_status  = "未结账";
                    reportDetail.Type        = strContent;
                    reportDetail.period_type = type;
                    repsDetail.Add(reportDetail);
                }
            }
            if (type == "quarter")
            {
                if (beginDate != null && beginDate.InitialDate != null)
                {
                    dtBeingin = DateTime.Parse(beginDate.InitialDate);
                    dtBeingin = dtBeingin.AddMonths(0 - (dtBeingin.Month - 1) % 3).AddDays(1 - dtBeingin.Day);
                    dtNow     = dtNow.AddMonths(0 - (dtNow.Month - 1) % 3).AddDays(1 - dtNow.Day);
                    if (dtBeingin.Year == dtNow.Year)
                    {
                        length = (dtNow.Month - dtBeingin.Month) / 3;
                    }
                    else
                    {
                        dtBeingin = DateTime.Parse(dtNow.ToString("yyyy") + "/01/01");
                        length    = (dtNow.Month / 3);
                    }
                }
                else
                {
                    length    = dtNow.Month;
                    dtBeingin = DateTime.Parse(dtNow.ToString("yyyy") + "/01/01");
                }
                for (int i = 0; i < length; i++)
                {
                    T_Report <T> reportDetail = new T_Report <T>();
                    reportDetail.rep_date    = dtBeingin.ToString("yyyy/") + (dtBeingin.AddMonths(i * 3).Month / 3 + 1);
                    reportDetail.rep_status  = "未结账";
                    reportDetail.Type        = strContent;
                    reportDetail.period_type = type;
                    repsDetail.Add(reportDetail);
                }
            }
            if (type == "year")
            {
                if (beginDate != null && beginDate.InitialDate != null)
                {
                    dtBeingin = DateTime.Parse(beginDate.InitialDate);
                    if (dtBeingin.Year == dtNow.Year)
                    {
                        length = dtNow.Year - dtBeingin.Year;
                    }
                    else
                    {
                        length = dtNow.Year - dtBeingin.Year;
                        length = length > 2 ? 2 : length;
                    }
                }
                for (int i = length; i > 0; i--)
                {
                    T_Report <T> reportDetail = new T_Report <T>();
                    reportDetail.rep_date    = dtNow.AddYears(-i).ToString("yyyy");
                    reportDetail.rep_status  = "未结账";
                    reportDetail.Type        = strContent;
                    reportDetail.period_type = type;
                    repsDetail.Add(reportDetail);
                }
            }
            foreach (var item in repsDetail)
            {
                var query = reps.Where(p => p.rep_date == item.rep_date);
                if (!query.Any())
                {
                    reps.Add(item);
                }
            }

            return(reps.OrderByDescending(p => p.rep_date).ToList());
        }
Example #12
0
        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();
                        }
                    }
                }
            }
        }