public ActionResult GetReceiptTemplate(int memberid, string transactiondate)
        {
            ReceiptDll objDll = new ReceiptDll();
            List <ReceiptTranscationDto> lstreceiptsHeads = objDll.GetMemberReceiptAccountdetails(memberid, transactiondate);

            ReceiptMasterDto objreceipt = new ReceiptMasterDto();

            objreceipt.lstGroupReceiptTranscationDto = lstreceiptsHeads;
            if (memberid > 0)
            {
                List <RepaymentDto> list = new List <RepaymentDto>();
                list = _repaymentService.GetRepayment(memberid, transactiondate);
                objreceipt.lstRepeyment = list;
            }
            List <ReceiptTranscationDto> lstDto = new List <ReceiptTranscationDto>();

            AccountHeadDto objAccountHead = _accountheadService.GetCashInHandAccount(false);

            ViewBag.CashInHandDetails = objAccountHead;

            return(View("_ReceiptTemplate", objreceipt));
        }
        public ActionResult CreateMemberReceipt(string id)
        {
            int AccountMasterID = string.IsNullOrEmpty(id.DecryptString()) ? default(int) : Convert.ToInt32(id.DecryptString());

            ViewBag.MID = AccountMasterID;
            ReceiptMasterDto objreceipt = new ReceiptMasterDto();

            //objreceipt.lstGroupReceiptTranscationDto = Accountheads();

            //objreceipt.lstGroupReceiptTranscationDto = Accountheads();

            if (AccountMasterID > 0)
            {
                objreceipt = _memberReceiptService.GetByID(AccountMasterID);

                List <ReceiptTranscationDto> lstTransactionDto = new List <ReceiptTranscationDto>();
                lstTransactionDto = objreceipt.lstGroupReceiptTranscationDto;

                ReceiptDll objDll = new ReceiptDll();
                List <ReceiptTranscationDto> lstreceiptsHeads = objDll.GetMemberReceiptAccountdetails(objreceipt.MemberId.Value, DateTime.Now.ToDisplayDateFormat());
                objreceipt.lstGroupReceiptTranscationDto = lstreceiptsHeads;
                foreach (var tranHead in lstTransactionDto)
                {
                    if (objreceipt.lstGroupReceiptTranscationDto.Exists(l => l.AHID == tranHead.AHID))
                    {
                        objreceipt.lstGroupReceiptTranscationDto.Find(l => l.AHID == tranHead.AHID).CrAmount = tranHead.CrAmount;
                        objreceipt.lstGroupReceiptTranscationDto.Find(l => l.AHID == tranHead.AHID).DrAmount = tranHead.DrAmount;
                    }
                }
                objreceipt.CrTotal = objreceipt.lstGroupReceiptTranscationDto.FindAll(l => l.IsMaster == false).Sum(l => l.CrAmount + l.DrAmount);
                objreceipt.DrTotal = objreceipt.CrTotal;
            }
            LoadDropDowns();
            EmployeeDto obj = _employeeService.GetByID(UserInfo.UserID);

            //meeting date changes
            GroupMeetingService          gms  = new GroupMeetingService();
            List <GroupMeetingLookupDto> list = gms.Lookup(GroupInfo.GroupID);

            if (list.Count > 0)
            {
                DateTime meetingdate = list.Max(l => l.MeetingDate);
                ViewBag.MeetingDate = meetingdate;
                AccountHeadDto objAccountHead = _accountheadService.GetCashInHandAccount(false);
                ViewBag.CashInHandDetails = objAccountHead;

                //var receiptDto = GetAccountHeadClosingBalnces();
                //ViewBag.CashInHandDetails = receiptDto;

                objreceipt.EmployeeName    = obj.EmployeeName;
                objreceipt.EmployeeCode    = obj.EmployeeCode;
                objreceipt.EmployeeID      = obj.EmployeeID;
                objreceipt.TransactionDate = meetingdate;
                //LoadDropDowns();
                return(View(objreceipt));
            }
            else
            {
                throw new Exception("There is no meeting date for this group please create meeting");
            }
        }