Exemple #1
0
        public List <SalesReportModel> GetSalesReportSummaryDetails(int?AgentId, DateTime?fromdate, DateTime?todate, int AirlinesTypeId, int?currencyId)
        {
            ATLTravelPortal.Areas.Administrator.Repository.DistributorManagementProvider distributorManagementProvider = new ATLTravelPortal.Areas.Administrator.Repository.DistributorManagementProvider();

            List <Air_GetAgentBillingStatementDetails_Result> data = ent.Air_GetAgentBillingStatementDetails(AgentId, fromdate, todate, currencyId).ToList();

            var ts = SessionStore.GetTravelSession();

            var agentsByDistributor = distributorManagementProvider.GetAllAgentsByDistributorId(ts.AppUserId);
            var resultSummary       = agentsByDistributor.SelectMany(b => data.Where(x => x.AgentId == b.AgentId));


            List <SalesReportModel> model = new List <SalesReportModel>();

            foreach (var item in resultSummary)
            {
                var SalesReportModel = new SalesReportModel();
                SalesReportModel.AirlineCode  = item.Code;
                SalesReportModel.AirlineName  = item.Name;
                SalesReportModel.TicketNumber = item.TicketNumber;
                SalesReportModel.IssuedDate   = item.IssueDate;

                SalesReportModel.Cash = item.Cash;
                TotalAgentBillingStatementDetails_Cash = TotalAgentBillingStatementDetails_Cash + (decimal)item.Cash;
                SalesReportModel.SumAgentBillingStatementDetails_Cash = TotalAgentBillingStatementDetails_Cash;

                SalesReportModel.Tax = (decimal)item.Tax;
                TotalAgentBillingStatementDetails_Tax = TotalAgentBillingStatementDetails_Tax + (decimal)item.Tax;
                SalesReportModel.SumAgentBillingStatementDetails_Tax = TotalAgentBillingStatementDetails_Tax;

                SalesReportModel.Commission = (decimal)item.Commission;
                TotalAgentBillingStatementDetails_Commission = TotalAgentBillingStatementDetails_Commission + (decimal)item.Commission;
                SalesReportModel.SumAgentBillingStatementDetails_Commission = TotalAgentBillingStatementDetails_Commission;

                SalesReportModel.Payable = (decimal)item.Payable;
                TotalAgentBillingStatementDetails_Payable = TotalAgentBillingStatementDetails_Payable + (decimal)item.Payable;
                SalesReportModel.SumAgentBillingStatementDetails_Payable = TotalAgentBillingStatementDetails_Payable;

                SalesReportModel.AgentName           = item.Agent;
                SalesReportModel.serviceProviderName = item.ServiceProviderName;
                SalesReportModel.issueFrom           = item.IssueFrom;
                SalesReportModel.AgentId             = item.AgentId;
                SalesReportModel.AgentCode           = new ATLTravelPortal.Areas.Airline.Repository.BookedTicketReportProvider().GetAgentCodeById(item.AgentId);
                model.Add(SalesReportModel);
            }
            return(model);
        }
Exemple #2
0
        public List <SalesReportModel> GetDistributorSalesReportSummary(int?AgentId, DateTime?fromdate, DateTime?todate, int AirlinesTypeId, int?currencyId)
        {
            ATLTravelPortal.Areas.Administrator.Repository.DistributorManagementProvider  distributorManagementProvider  = new ATLTravelPortal.Areas.Administrator.Repository.DistributorManagementProvider();
            ATLTravelPortal.Areas.Administrator.Repository.BranchOfficeManagementProvider branchOfficeManagementProvider = new ATLTravelPortal.Areas.Administrator.Repository.BranchOfficeManagementProvider();

            List <Air_GetAgentBillingStatement_Result> data = ent.Air_GetAgentBillingStatement(null, fromdate, todate, currencyId).ToList();

            var ts = SessionStore.GetTravelSession();
            var agentsByBranchOffice = branchOfficeManagementProvider.GetAllAgentsByBranchOfficeId(ts.LoginTypeId);

            List <Air_GetAgentBillingStatement_Result> result = new List <Air_GetAgentBillingStatement_Result>();


            if (AgentId != null)
            {
                int appUserId           = branchOfficeManagementProvider.GetAppUserIdByDistributorId(AgentId.Value);
                var agentsByDistributor = distributorManagementProvider.GetAllAgentsByDistributorId(appUserId);

                result = agentsByDistributor.SelectMany(b => data.Where(x => x.Agentid == b.AgentId)).ToList();
            }
            else
            {
                result = agentsByBranchOffice.SelectMany(b => data.Where(x => x.Agentid == b.AgentId)).ToList();
            }



            List <SalesReportModel> model = new List <SalesReportModel>();



            foreach (var item in result)
            {
                var SalesReportModel = new SalesReportModel();
                SalesReportModel.AirlineId   = item.AirlineId;
                SalesReportModel.AirlineCode = item.Code;
                SalesReportModel.AirlineName = item.Name;

                SalesReportModel.Cash           = item.Cash;
                TotalAgentBillingStatement_Cash = TotalAgentBillingStatement_Cash + (Decimal)item.Cash;
                SalesReportModel.SumAgentBillingStatement_Cash = TotalAgentBillingStatement_Cash;

                SalesReportModel.Tax           = (decimal)item.Tax;
                TotalAgentBillingStatement_Tax = TotalAgentBillingStatement_Tax + (decimal)item.Tax;
                SalesReportModel.SumAgentBillingStatement_Tax = TotalAgentBillingStatement_Tax;

                SalesReportModel.Commission           = (decimal)item.Commission;
                TotalAgentBillingStatement_Commission = TotalAgentBillingStatement_Commission + (decimal)item.Commission;
                SalesReportModel.SumAgentBillingStatement_Commission = TotalAgentBillingStatement_Commission;

                SalesReportModel.Payable           = (decimal)item.Payable;
                TotalAgentBillingStatement_Payable = TotalAgentBillingStatement_Payable + (decimal)item.Payable;
                SalesReportModel.SumAgentBillingStatement_Payable = TotalAgentBillingStatement_Payable;
                SalesReportModel.AgentId = item.Agentid;
                model.Add(SalesReportModel);
            }
            return(model);
        }