/// <summary>
        /// Used to fetch list of return bills
        /// </summary>
        /// <param name="branchId"></param>
        /// <returns></returns>
        private List <ReturnBillAC> GetReturnBillList(int branchId)
        {
            List <ReturnBillAC> listOfReturnBillAC = new List <ReturnBillAC>();
            List <POSBill>      listOfPOSBill      = _iReturnBillRepository.GetPOSBillListByBranchId(branchId);

            if (listOfPOSBill.Any())
            {
                foreach (var posBill in listOfPOSBill)
                {
                    ReturnBillAC returnBillAC = new ReturnBillAC();
                    returnBillAC.BillId         = posBill.Id;
                    returnBillAC.BillNumber     = posBill.BillNo;
                    returnBillAC.Amount         = posBill.TotalAmount;
                    returnBillAC.BillDate       = posBill.BillDate.Date;
                    returnBillAC.Branch         = posBill.BranchDetail.Name;
                    returnBillAC.BranchId       = posBill.BranchID;
                    returnBillAC.CashierName    = posBill.UserDetail.UserName;
                    returnBillAC.CustomerNumber = posBill.Customer.MembershipCode;
                    listOfReturnBillAC.Add(returnBillAC);
                }
            }
            return(listOfReturnBillAC);
        }
        /// <summary>
        /// This method used for get ReturnBillDetailAC. -An
        /// </summary>
        /// <param name="posBill"></param>
        /// <returns></returns>
        private ReturnBillDetailAc GetReturnBillDetailAC(POSBill posBill)
        {
            try
            {
                ReturnBillDetailAc  returnBillDetailAC = new ReturnBillDetailAc();
                List <ReturnBillAC> listOfReturnBillAC = new List <ReturnBillAC>();
                ReturnBillAC        retunBillAC        = new ReturnBillAC();
                retunBillAC.Amount       = posBill.TotalAmount;
                retunBillAC.BillDate     = posBill.BillDate;
                retunBillAC.BillId       = posBill.Id;
                retunBillAC.BillNumber   = posBill.BillNo;
                retunBillAC.Branch       = posBill.BranchDetail.Name;
                retunBillAC.CashierName  = posBill.UserDetail.UserName;
                retunBillAC.CustomerName = posBill.Customer.Name;
                listOfReturnBillAC.Add(retunBillAC);
                returnBillDetailAC.ReturnBillList = listOfReturnBillAC;
                List <POSBillItem> listOfPOSBillItem = _iReturnBillRepository.GetPOSBillItemListByBillId(posBill.Id);
                if (listOfPOSBillItem.Any())
                {
                    List <RetunrBillItemListAC> listOfRetunrBillItemListAC = new List <RetunrBillItemListAC>();
                    foreach (var posBillItem in listOfPOSBillItem)
                    {
                        RetunrBillItemListAC retunrBillItemListAC = new RetunrBillItemListAC();
                        retunrBillItemListAC.BarCode        = posBillItem.ItemProfile.Barcode;
                        retunrBillItemListAC.POSBillItemId  = posBillItem.Id;
                        retunrBillItemListAC.BillQunatity   = posBillItem.Quantity;
                        retunrBillItemListAC.Flavour        = posBillItem.ItemProfile.FlavourEn;
                        retunrBillItemListAC.Name           = posBillItem.ItemProfile.ItemNameEn;
                        retunrBillItemListAC.ReturnBillItem = posBillItem.ReturnedQuantity;
                        retunrBillItemListAC.SellPrice      = posBillItem.SellPrice;
                        retunrBillItemListAC.Unit           = posBillItem.ItemProfile.SystemParameter.ValueEn;
                        retunrBillItemListAC.ReturnQunatity = 0;

                        //this is used for check totale return qunatity
                        List <POSReturnBillItem> listOfPOSReturnBillItem = _iReturnBillRepository.GetListOfPOSRetunBillItemByPOSBillItemId(posBillItem.Id);
                        if (listOfPOSReturnBillItem.Count > 0)
                        {
                            int totalQunatity = 0;
                            foreach (var posRetunrBillItem in listOfPOSReturnBillItem)
                            {
                                totalQunatity = totalQunatity + posRetunrBillItem.ReturnedQuantity;
                            }
                            retunrBillItemListAC.ReturnedQunatity = totalQunatity;
                        }
                        listOfRetunrBillItemListAC.Add(retunrBillItemListAC);
                    }
                    returnBillDetailAC.ReturnBillItemList = listOfRetunrBillItemListAC;
                }
                List <POSBillPayment> listOfPOSBillPayment = _iReturnBillRepository.GetPOSBillPaymentListByBillId(posBill.Id);
                if (listOfPOSBillPayment.Any())
                {
                    List <ReturnBillPaymentTypeListAC> listOfReturnBillPaymentTypeListAC = new List <ReturnBillPaymentTypeListAC>();
                    foreach (var posBillPayment in listOfPOSBillPayment)
                    {
                        ReturnBillPaymentTypeListAC posBillPaymentAC = new ReturnBillPaymentTypeListAC();
                        posBillPaymentAC.BankTransactionNumber = posBillPayment.BankPOSTransNo;
                        posBillPaymentAC.PaymentType           = posBillPayment.ParamType.ValueEn;
                        posBillPaymentAC.PaymentId             = posBillPayment.Id;
                        if (posBillPaymentAC.PaymentType == "Cash")//when payment type is cash so check how much amount retunr by cashier to customer.
                        {
                            decimal amt = _iReturnBillRepository.GetCustomerPayTotalAmount(posBill.Id);
                            if (amt != posBill.TotalAmount)
                            {
                                posBillPaymentAC.Amount = posBillPayment.Amount - (amt - posBill.TotalAmount);
                            }
                            else
                            {
                                posBillPaymentAC.Amount = posBillPayment.Amount;
                            }
                        }
                        else
                        {
                            posBillPaymentAC.Amount = posBillPayment.Amount;
                        }
                        listOfReturnBillPaymentTypeListAC.Add(posBillPaymentAC);
                    }
                    returnBillDetailAC.ReturnBillPaymentTypeList = listOfReturnBillPaymentTypeListAC;
                }

                return(returnBillDetailAC);
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }