public void Calc(DateTime startDate, DateTime endDate, int kaikeiKubun, bool hideInnerKaikeiKubunKamoku, bool omitZeroRow)
        {
            StartDate   = helper.Converter.DateTimeToNenndoKisannbi(startDate);
            EndDate     = endDate;
            KaikeiKubun = kaikeiKubun == -1 ? db.MTKaikeiKubun.RootNodeId : kaikeiKubun;
            OmitZeroRow = omitZeroRow;

            foreach (var childKaikeiKubunRow in db.MTKaikeiKubun.SelectChildren(KaikeiKubun, order: "order by kubun_code"))
            {
                var jigyouKatsudou = new JigyouKatsudou(db);
                jigyouKatsudou.Calc(startDate, endDate, childKaikeiKubunRow.GetId(), hideInnerKaikeiKubunKamoku, constants.MTKamokuKubunHierarchy.ChuuKubun, omitZeroRow: false);
                jigyouKatsudouList.Add(jigyouKatsudou);
            }
        }
예제 #2
0
        private void CalcSummary()
        {
            int year = helper.Converter.GetNenndo(StartDate);

            foreach (var pair in kamokuKubunId2BalanceSheetRow)
            {
                switch (pair.Value.TaisyakuKamokuKubunId)
                {
                case (int)models.constants.MTKamokuKubun.Shisan:         //資産
                    summaryItems[SummaryItem.ShisanSummary].Add(pair.Value);
                    break;

                case (int)models.constants.MTKamokuKubun.Husai:          //負債
                    summaryItems[SummaryItem.HusaiSummary].Add(pair.Value);
                    break;

                case (int)models.constants.MTKamokuKubun.Junshisan:      //純資産
                    summaryItems[SummaryItem.JunshisanSummary].Add(pair.Value);
                    break;
                }
            }

            //負債+純資産 (この段階では、次期繰越を含まない)
            summaryItems[SummaryItem.HusaiPlusJunshisanSummary].Add(summaryItems[SummaryItem.JunshisanSummary]);
            summaryItems[SummaryItem.HusaiPlusJunshisanSummary].Add(summaryItems[SummaryItem.HusaiSummary]);

            //次期繰越活動収支差額(本年)
            summaryItems[SummaryItem.JikiKurikoshiSagaku].CurrentSumAmount = summaryItems[SummaryItem.JikiKurikoshiSagaku].LastSumAmount
                                                                             + summaryItems[SummaryItem.ShisanSummary].CurrentSumAmount
                                                                             - summaryItems[SummaryItem.HusaiPlusJunshisanSummary].CurrentSumAmount;

            //次期繰越活動収支差額(昨年)
            {
                //AddKurikoshiで計算
            }

            {
                // うち当期活動収支差額(本年)

/*                summaryItems[SummaryItem.ToukiSagaku].CurrentSumAmount = summaryItems[SummaryItem.ShisanSummary].CurrentSumAmount
 *                                                                      - summaryItems[SummaryItem.HusaiPlusJunshisanSummary].CurrentSumAmount;
 *
 *              // うち当期活動収支差額(前年)
 *              summaryItems[SummaryItem.ToukiSagaku].LastSumAmount = summaryItems[SummaryItem.JikiKurikoshiSagaku].LastSumAmount
 *                                                                      - CalcJikiKurikoshiSagaku(StartNenndo - 1, KaikeiKubun);
 */
                // 事業活動計算書の値を持ってくる(基本金取崩額、積立金取崩額、積立金積立額などを加味しない値が必要)
                var jigyouKatsudou = new JigyouKatsudou(db);
                jigyouKatsudou.Calc(StartDate, EndDate, KaikeiKubun, hideInnerKaikeiKubunKamoku: true, targetKamokuKubunHierarchy: models.constants.MTKamokuKubunHierarchy.ChuuKubun, omitZeroRow: true);
                summaryItems[SummaryItem.ToukiSagaku].CurrentSumAmount = jigyouKatsudou.SummaryRows[(int)models.query.JigyouKatsudou.SummaryItem.ToukiKatsudouZougenSagaku].CurrentYearSum;
                summaryItems[SummaryItem.ToukiSagaku].LastSumAmount    = jigyouKatsudou.SummaryRows[(int)models.query.JigyouKatsudou.SummaryItem.ToukiKatsudouZougenSagaku].LastYearSum;
            }


            // 資産、負債、純資産の本年に前期繰越を合計する
            summaryItems[SummaryItem.ShisanSummary].CurrentSumAmount             += summaryItems[SummaryItem.ShisanSummary].LastSumAmount;
            summaryItems[SummaryItem.HusaiSummary].CurrentSumAmount              += summaryItems[SummaryItem.HusaiSummary].LastSumAmount;
            summaryItems[SummaryItem.JunshisanSummary].CurrentSumAmount          += summaryItems[SummaryItem.JunshisanSummary].LastSumAmount;
            summaryItems[SummaryItem.HusaiPlusJunshisanSummary].CurrentSumAmount += summaryItems[SummaryItem.HusaiPlusJunshisanSummary].LastSumAmount;
            foreach (var pair in kamokuKubunId2BalanceSheetRow)
            {
                pair.Value.CurrentSumAmount += pair.Value.LastSumAmount;
            }

            // 純資産に次期繰越を足す (次期繰越は純資産だが、別途計算しているため)
            //純資産
            summaryItems[SummaryItem.JunshisanSummary].Add(summaryItems[SummaryItem.JikiKurikoshiSagaku]);

            //負債+純資産
            summaryItems[SummaryItem.HusaiPlusJunshisanSummary].Add(summaryItems[SummaryItem.JikiKurikoshiSagaku]);
        }