public static ReceiptStatu Create(Receipt receipt, DateTime transitionDateTime, ReceiptStatusType type) { ReceiptStatu newReceiptStatus = new ReceiptStatu(); newReceiptStatus.IsActive = true; newReceiptStatus.Receipt = receipt; newReceiptStatus.TransitionDateTime = transitionDateTime; newReceiptStatus.ReceiptStatusTypeId = type.Id; return newReceiptStatus; }
public ChequeViewModel(Cheque cheque, Receipt receipt) { this.BankName = cheque.PartyRole.Party.Name; this.Branch = cheque.PartyRole.Bank.Branch; this.CheckType = cheque.Payment.PaymentMethodType.Name; this.CheckNumber = cheque.Payment.PaymentReferenceNumber; this.CheckDate = cheque.CheckDate; this.TotalAmount = receipt.ReceiptBalance; //TODO:: Affected by change in payment table. //this.TotalAmount = c.Payment.Receipt.ReceiptBalance; }
public static ReceiptStatu ChangeStatus(Receipt receipt, ReceiptStatusType receiptStatusTo, string remarks) { var statusFrom = GetActive(receipt); if (statusFrom != null && statusFrom.IsActive == true) { statusFrom.IsActive = false; } ReceiptStatu status = new ReceiptStatu(); if (statusFrom == null || statusFrom.IsActive == false) { status = Create(receipt, DateTime.Now, receiptStatusTo, true); status.Remarks = remarks; } Context.ReceiptStatus.AddObject(status); return status; }
public static ReceiptStatu GetActive(Receipt receipt) { return receipt.ReceiptStatus.FirstOrDefault(entity => entity.IsActive); }
public static void ChangeReceiptStatusFrom(Receipt receipt, DateTime today, decimal balance, ReceiptStatusType fromstatustype) { //var receiptstatus = receipt.CurrentStatus; ReceiptStatu newreceiptstatus = new ReceiptStatu(); if (fromstatustype.Id == ReceiptStatusType.OpenReceiptStatusType.Id && balance == 0) { //create receipt status var validIndicator = Context.ReceiptStatusTypeAssocs.SingleOrDefault(entity => entity.FromStatusTypeId == ReceiptStatusType.OpenReceiptStatusType.Id && entity.ToStatusTypeId == ReceiptStatusType.AppliedReceiptStatusType.Id && entity.EndDate == null); if (validIndicator != null) { newreceiptstatus.Receipt = receipt; newreceiptstatus.ReceiptStatusType = ReceiptStatusType.AppliedReceiptStatusType; newreceiptstatus.TransitionDateTime = today; newreceiptstatus.IsActive = false; Context.ReceiptStatus.AddObject(newreceiptstatus); } //create next receipt status var validIndicator1 = Context.ReceiptStatusTypeAssocs.SingleOrDefault(entity => entity.FromStatusTypeId == ReceiptStatusType.AppliedReceiptStatusType.Id && entity.ToStatusTypeId == ReceiptStatusType.ClosedReceiptStatusType.Id && entity.EndDate == null); if (validIndicator1 != null) { ReceiptStatu nextreceiptstatus = new ReceiptStatu(); nextreceiptstatus.Receipt = receipt; nextreceiptstatus.ReceiptStatusType = ReceiptStatusType.ClosedReceiptStatusType; nextreceiptstatus.TransitionDateTime = today; nextreceiptstatus.IsActive = true; Context.ReceiptStatus.AddObject(newreceiptstatus); } } else if (fromstatustype.Id == ReceiptStatusType.OpenReceiptStatusType.Id && balance != 0) { var validIndicator = Context.ReceiptStatusTypeAssocs.SingleOrDefault(entity => entity.FromStatusTypeId == ReceiptStatusType.OpenReceiptStatusType.Id && entity.ToStatusTypeId == ReceiptStatusType.AppliedReceiptStatusType.Id && entity.EndDate == null); if (validIndicator != null) { newreceiptstatus.Receipt = receipt; newreceiptstatus.ReceiptStatusType = ReceiptStatusType.AppliedReceiptStatusType; newreceiptstatus.TransitionDateTime = today; newreceiptstatus.IsActive = true; Context.ReceiptStatus.AddObject(newreceiptstatus); } } else if (fromstatustype.Id == ReceiptStatusType.AppliedReceiptStatusType.Id && balance == 0) { var validIndicator = Context.ReceiptStatusTypeAssocs.SingleOrDefault(entity => entity.FromStatusTypeId == ReceiptStatusType.AppliedReceiptStatusType.Id && entity.ToStatusTypeId == ReceiptStatusType.ClosedReceiptStatusType.Id && entity.EndDate == null); if (validIndicator != null) { newreceiptstatus.Receipt = receipt; newreceiptstatus.ReceiptStatusType = ReceiptStatusType.ClosedReceiptStatusType; newreceiptstatus.TransitionDateTime = today; newreceiptstatus.IsActive = true; Context.ReceiptStatus.AddObject(newreceiptstatus); } } }
public static ReceiptPaymentAssoc CreateReceiptPaymentAssoc(Receipt receipt, Payment payment) { ReceiptPaymentAssoc receiptPaymentAssoc = new ReceiptPaymentAssoc(); receiptPaymentAssoc.Payment = payment; receiptPaymentAssoc.Receipt = receipt; receiptPaymentAssoc.Amount = receipt.ReceiptBalance.Value; return receiptPaymentAssoc; }
public static ReceiptPaymentAssoc CreateReceiptPaymentAssoc(Receipt receipt, Payment payment, decimal amount) { ReceiptPaymentAssoc receiptPaymentAssoc = new ReceiptPaymentAssoc(); receiptPaymentAssoc.Payment = payment; receiptPaymentAssoc.Receipt = receipt; receiptPaymentAssoc.Amount = amount; return receiptPaymentAssoc; }
public static Receipt CreateReceipt(string receivedFrom, decimal receiptBalance) { Receipt receipt = new Receipt(); receipt.ReceivedFromName = receivedFrom; receipt.ReceiptBalance = receiptBalance; Context.Receipts.AddObject(receipt); return receipt; }
public static Payment GetReceiptPayment(Receipt receipt) { var payments = from r in Context.Receipts join rpa in Context.ReceiptPaymentAssocs on r.Id equals rpa.ReceiptId join p in Context.Payments on rpa.PaymentId equals p.Id where r.Id == receipt.Id && p.PaymentTypeId == PaymentType.Receipt.Id && p.ParentPaymentId == null select p; return payments.First(); }
public static Payment RetrieveAssociatedPayment(Receipt receipt, PaymentType type) { var payments = from rpa in Context.ReceiptPaymentAssocs join p in Context.Payments on rpa.PaymentId equals p.Id where p.PaymentTypeId == type.Id && rpa.ReceiptId == receipt.Id select p; return payments.First(); }