Example #1
0
        /// <summary>
        ///     显示摊销及其计算表
        /// </summary>
        /// <param name="amort">摊销</param>
        /// <param name="serializer">表示器</param>
        /// <param name="dt">计算账面价值的时间</param>
        /// <param name="showSchedule">是否显示计算表</param>
        /// <returns>格式化的信息</returns>
        private string ListAmort(Amortization amort, IEntitySerializer serializer, DateTime?dt = null,
                                 bool showSchedule = true)
        {
            var sb = new StringBuilder();

            var bookValue = Accountant.GetBookValueOn(amort, dt);

            if (dt.HasValue &&
                !bookValue?.IsZero() != true)
            {
                return(null);
            }

            sb.AppendLine(
                $"{amort.StringID} {amort.Name.CPadRight(35)}{amort.Date:yyyyMMdd}" +
                $"U{amort.User.AsUser().CPadRight(5)} " +
                $"{amort.Value.AsCurrency().CPadLeft(13)}{(dt.HasValue ? bookValue.AsCurrency().CPadLeft(13) : "-".CPadLeft(13))}" +
                $"{(amort.TotalDays?.ToString(CultureInfo.InvariantCulture) ?? "-").CPadLeft(4)}{amort.Interval.ToString().CPadLeft(20)}");
            if (showSchedule && amort.Schedule != null)
            {
                foreach (var amortItem in amort.Schedule)
                {
                    sb.AppendLine(ListAmortItem(amortItem));
                    if (amortItem.VoucherID != null)
                    {
                        sb.AppendLine(serializer.PresentVoucher(Accountant.SelectVoucher(amortItem.VoucherID)).Wrap());
                    }
                }
            }

            return(sb.ToString());
        }
Example #2
0
        /// <summary>
        ///     显示资产及其折旧计算表
        /// </summary>
        /// <param name="asset">资产</param>
        /// <param name="serializer">表示器</param>
        /// <param name="dt">计算账面价值的时间</param>
        /// <param name="showSchedule">是否显示折旧计算表</param>
        /// <returns>格式化的信息</returns>
        private string ListAsset(Asset asset, IEntitySerializer serializer, DateTime?dt = null,
                                 bool showSchedule = true)
        {
            var sb = new StringBuilder();

            var bookValue = Accountant.GetBookValueOn(asset, dt);

            if (dt.HasValue &&
                !bookValue?.IsZero() != true)
            {
                return(null);
            }

            sb.AppendLine(
                $"{asset.StringID} {asset.Name.CPadRight(35)}{asset.Date:yyyyMMdd}" +
                $"U{asset.User.AsUser().CPadRight(5)} " +
                asset.Value.AsCurrency(asset.Currency).CPadLeft(13) +
                (dt.HasValue ? bookValue.AsCurrency(asset.Currency).CPadLeft(13) : "-".CPadLeft(13)) +
                asset.Salvge.AsCurrency(asset.Currency).CPadLeft(13) +
                asset.Title.AsTitle().CPadLeft(5) +
                asset.DepreciationTitle.AsTitle().CPadLeft(5) +
                asset.DevaluationTitle.AsTitle().CPadLeft(5) +
                asset.DepreciationExpenseTitle.AsTitle().CPadLeft(5) +
                asset.DepreciationExpenseSubTitle.AsSubTitle() +
                asset.DevaluationExpenseTitle.AsTitle().CPadLeft(5) +
                asset.DevaluationExpenseSubTitle.AsSubTitle() +
                asset.Life.ToString().CPadLeft(4) +
                asset.Method.ToString().CPadLeft(20));

            if (showSchedule && asset.Schedule != null)
            {
                foreach (var assetItem in asset.Schedule)
                {
                    sb.AppendLine(ListAssetItem(assetItem));
                    if (assetItem.VoucherID != null)
                    {
                        sb.AppendLine(serializer.PresentVoucher(Accountant.SelectVoucher(assetItem.VoucherID)).Wrap());
                    }
                }
            }

            return(sb.ToString());
        }