Esempio n. 1
0
        public byte[] LevyRollExcludeSundries(DateTime processMonth, string buildingName, string dataPath)
        {
            var lr = new LevyRollReport();

            return(lr.RunReport(processMonth, buildingName, dataPath, false));
        }
Esempio n. 2
0
        public List <BuildingClosingBalance> BuildingBalancesGet(DateTime processMonth, string buildingDataPath)
        {
            var lr = new LevyRollReport();

            return(lr.BuildingBalancesGet(processMonth, buildingDataPath));
        }
Esempio n. 3
0
        public byte[] LevyRollReport(DateTime processMonth, string buildingName, string dataPath)
        {
            var lr = new LevyRollReport();

            return(lr.RunReport(processMonth, buildingName, dataPath, true));
        }
        public List <DebitOrderItem> RunDebitOrderForBuilding(int buildingId, DateTime processMonth, bool showFeeBreakdown)
        {
            int period;

            processMonth = new DateTime(processMonth.Year, processMonth.Month, 1);
            var query = _DataContext.CustomerDebitOrderSet
                        .Where(a => a.BuildingId == buildingId)
                        .Select(b => new DebitOrderItem()
            {
                BuildingId              = b.BuildingId,
                CustomerCode            = b.CustomerCode,
                BranchCode              = b.BranceCode,
                AccountTypeId           = b.AccountType,
                AccountNumber           = b.AccountNumber,
                DebitOrderCollectionDay = b.DebitOrderCollectionDay,
                DebitOrderFeeDisabled   = b.IsDebitOrderFeeDisabled,                       //disabled on unit level
                DebitOrderCancelDate    = b.DebitOrderCancelDate,
                DebitOrderCancelled     = b.DebitOrderCancelled,
                MaxDebitOrderAmount     = b.MaxDebitAmount
            });

            var debitOrderItems = query.ToList().Where(a => a.DebitOrderActive).ToList();


            //   DateTime collectionDay = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddMonths(1);
            DateTime collectionDay    = new DateTime(processMonth.Year, processMonth.Month, 1);
            var      building         = _DataContext.tblBuildings.Single(a => a.id == buildingId);
            var      buildingSettings = _DataContext.tblBuildingSettings.SingleOrDefault(a => a.buildingID == buildingId);
            var      levyRollData     = new List <LevyRollDataItem>();

            if (debitOrderItems.Count > 0)
            {
                var customers = debitOrderItems.Select(a => a.CustomerCode).Distinct().ToList();
                levyRollData = new LevyRollReport().LoadReportData(processMonth, building.DataPath, customers, out period);
            }

            decimal debitOrderFee = 0;

            if (buildingSettings != null)
            {
                debitOrderFee = buildingSettings.DebitOrderFee;
                if (building.IsDebitOrderFeeDisabled)
                {
                    debitOrderFee = 0; //disabled on building level
                }
            }
            foreach (var item in debitOrderItems)
            {
                item.DebitOrderFee = debitOrderFee;
                item.IsDebitOrderFeeDisabledOnBuilding = building.IsDebitOrderFeeDisabled;
                var levyRollItem = levyRollData.SingleOrDefault(a => a.CustomerCode.Trim().ToLower() == item.CustomerCode.Trim().ToLower());
                if (levyRollItem != null)
                {
                    item.LevyRollDue  = levyRollItem.Due;
                    item.Payments     = levyRollItem.Payments;
                    item.AmountDue    = item.LevyRollDue + item.Payments;
                    item.CustomerName = levyRollItem.CustomerDesc;
                }
                if (item.DebitOrderCollectionDay == DebitOrderDayType.One)
                {
                    item.CollectionDay = collectionDay;
                }
                else
                {
                    item.CollectionDay = new DateTime(collectionDay.Year, collectionDay.Month, 15);
                }
            }

            return(debitOrderItems.Where(a => a.AmountDue > 0).ToList());
        }