在借方和贷方论坛中显示负数

时间:2018-09-25 13:23:25

标签: excel formula

我在下面的会计计算中使用了

public class DataContext : DbContext
{
    public DataContext(DbContextOptions<DataContext> options) : base(options)
    {
    }

    public DbSet<FeedGroup> FeedGroups { get; set; }
    public DbSet<BinFeedGroupStatus> BinFeedGroupStatuses { get; set; }
    public DbSet<FeedGroupStatus> FeedGroupStatuses { get; set; }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        builder.Entity<BinFeedGroupStatus>()
            .HasKey(fgs => new {fgs.FeedGroupStatusId, fgs.BinId});

        builder.Entity<BinFeedGroupStatus>()
            .HasOne(bfgs => bfgs.FeedGroupStatus)
            .WithMany(fgs => fgs.BinFeedGroupStatuses)
            .HasForeignKey(fgs => fgs.FeedGroupStatusId)
            .OnDelete(DeleteBehavior.Cascade);

        builder.Entity<BinFeedGroupStatus>()
            .HasOne(bfgs => bfgs.Bin)
            .WithMany(b => b.BinFeedGroupStatuses)
            .HasForeignKey(fgs => fgs.BinId)
            .OnDelete(DeleteBehavior.Cascade);
    }
}

净借项公式:public partial class changedNullableFKs : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_FeedGroupStatuses_FeedGroups_FeedGroupId", table: "FeedGroupStatuses"); migrationBuilder.AlterColumn<int>( name: "FeedGroupId", table: "FeedGroupStatuses", nullable: false, oldClrType: typeof(int), oldNullable: true); migrationBuilder.AddForeignKey( name: "FK_FeedGroupStatuses_FeedGroups_FeedGroupId", table: "FeedGroupStatuses", column: "FeedGroupId", principalTable: "FeedGroups", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } //... }

净积分公式:| DEBIT_OB | CREDIT_OB | DEBIT | CREDIT | NETDEBIT | NETCREDIT | |-------------|-----------|------------|------------|-----------|-----------| | 134054.00 | 0.00 | 5195.00 | 29.50 | 139219.50 | 0.00 | | 2297.50 | 0.00 | 89.00 | 29.50 | 2357.00 | 0.00 | | -1831227.00 | 0.00 | 7808826.00 | 6248961.00 | 0.00 | 271362.00 | | 37761.00 | 0.00 | 0.00 | 0.00 | 37761.00 | 0.00 |

显示的净信用额:= IF((((A6+C6)-(B6+D6))>0), ((A6+C6)-(B6+D6)), 0)

我想要净借方金额:= IF((((B6+D6)-(A6+C6))>0), ((B6+D6)-(A6+C6)), 0)(负数)

1 个答案:

答案 0 :(得分:0)

只需在公式中添加“-”即可使公式变为负数

= IF(((((A6 + C6)-(B6 + D6))> 0),-((A6 + C6)-(B6 + D6)),0)