public FileTotalRecord GenerateTotalRecord()
{
if (DetailRecords == null)
return null;
decimal net = 0, credit = 0, debit = 0;
foreach (var detail in DetailRecords)
{
net += detail.Amount;
if (detail.TransactionCode == TransactionCode.CreditItem)
credit += detail.Amount;
else if (detail.TransactionCode == TransactionCode.DebitItem)
debit += detail.Amount;
}
return new FileTotalRecord()
{
Bsb = "999-999",
NetTotalAmount = net,
CreditTotalAmount = credit,
DebitTotalAmount = debit,
CountOfType1 = DetailRecords.Count
};
}