private Ledger GetLedger(Record record, ref double previousBalance) { BankRecord bankRecord = GetBankRecord(record.ID); double newBalance = previousBalance + record.Debit - record.Credit; Ledger ledger = new Ledger { Credit = record.Credit, Debit = record.Debit, Date = record.Date, VoucherNo = record.VoucherType + "-" + record.VoucherSerialNo, Particular = bankRecord != null ? "Bank" : "Cash", // TODO: This is wrong for showing all advance. ChequeNo = bankRecord != null ? bankRecord.ChequeNo : "", Remarks = record.Narration, Balance = newBalance }; previousBalance = newBalance; return ledger; }
private int InsertLedgerRecord(BLL.Model.Entity.Record record) { Record dalRecord = new Record { ProjectHeadID = GetProjectHeadId(record.ProjectName, record.HeadName), Date = record.Date, VoucherType = record.VoucherTypeKey, Debit = record.Debit, Credit = record.Credit, Narration = record.Narration, LedgerType = record.LedgerType, VoucherSerialNo = record.VoucherSerialNo, Link = record.LinkedVoucherNo, Tag = record.Tag, IsActive = true }; _db.AddToRecords(dalRecord); _db.SaveChanges(); return dalRecord.ID; }