public CashierReport GetCashierReport(CashierReportQuery query)
        {
            #region Repositories
            CashierRepository cashierrep = new CashierRepository();
            CashMovementRepository cashmovementrep = new CashMovementRepository();
            ElectronicFundRepository elecrep = new ElectronicFundRepository();
            PickUpRepository pickuprep = new PickUpRepository();
            CashReconciliationRepository cashreconrep = new CashReconciliationRepository();
            InstantMoneyRepository imrep = new InstantMoneyRepository();
            FNBRepository fnbrep = new FNBRepository();
            KwikPayRepository kwikrep = new KwikPayRepository();
            #endregion

            //...Get All Details
            CashierReport report = new CashierReport();

            report.CashierId = query.Cashier;
            report.ReportDate = query.Date;

            report.Cashier = cashierrep.GetCashier(query.Cashier);
            report.CashMovements = cashmovementrep.GetCashMovementsPerEmployee(query.Cashier, query.Date);
            report.ElectronicFunds = elecrep.GetElectronicFundsPerEmployee(query.Cashier, query.Date);
            report.FNB = fnbrep.GetFNBsPerEmployee(query.Cashier, query.Date);
            report.InstantMoney = imrep.GetInstantMoneysPerEmployee(query.Cashier, query.Date);
            report.KwikPays = kwikrep.GetKwikPaysPerEmployee(query.Cashier, query.Date);
            report.Pickups = pickuprep.GetPickUpsPerEmployee(query.Cashier, query.Date);
            report.Recons = cashreconrep.GetCashReconcilationsPerEmployee(query.Cashier, query.Date);

            //...Initialize Totals
            report.CashTotal= 0;
            report.CardsTotal= 0;
            report.ChequeTotal= 0;
            report.SassaTotal= 0;
            report.PickupTotal= 0;
            report.FloatTotal= 0;
            report.ExtraFloatTotal= 0;
            report.SigmaTotal= 0;
            report.IMFloatTotal= 0;
            report.IMRecTotal= 0;
            report.IMPaidTotal= 0;
            report.FNBRefTotal= 0;
            report.FNBRetTotal= 0;
            report.ElecTotal= 0;
            report.AirTotal= 0;
            report.AccTotal= 0;

            //...Get Totals
            foreach(CashMovement item in report.CashMovements)
            {
                report.CashTotal += item.Amount;
            }

            foreach(ElectronicFund item in report.ElectronicFunds)
            {
                switch(item.ElectronicTypeID)
                {
                    case 1: report.SassaTotal += item.Total; break;
                    case 2: report.CardsTotal += item.Total; break;
                    case 3: report.ChequeTotal += item.Total; break;
                }
            }

            foreach(PickUp item in report.Pickups)
            {
                report.PickupTotal += item.Amount;
                //report.CardsTotal += item.Amount;
            }

            foreach(CashReconciliation item in report.Recons)
            {
                switch (item.ReconciliationTypeID)
                {
                    case 1: report.FloatTotal += item.Amount; break;
                    case 2: report.ExtraFloatTotal += item.Amount; break;
                    case 3: report.SigmaTotal += item.Amount; break;
                }
            }

            foreach(InstantMoney item in report.InstantMoney)
            {
                switch (item.InstantMoneyTypeID)
                {
                    case 1: report.IMFloatTotal += item.Amount; break;
                    case 2: report.IMRecTotal += item.Amount; break;
                    case 3: report.IMPaidTotal += item.Amount; break;
                }
            }

            foreach(FNB item in report.FNB)
            {
                switch (item.FNBTypeID)
                {
                    case 1: report.FNBRefTotal += item.Amount; break;
                    case 2: report.FNBRetTotal += item.Amount; break;
                }
            }

            foreach (KwikPay item in report.KwikPays)
            {
                switch (item.KwikPayTypeID)
                {
                    case 1: report.ElecTotal += item.Amount; break;
                    case 2: report.AirTotal += item.Amount; break;
                    case 3: report.AccTotal += item.Amount; break;
                }
            }

            return report;
        }
Example #2
0
        public CashierReport GetCashierReport(CashierReportQuery query)
        {
            #region Repositories
            CashierRepository            cashierrep      = new CashierRepository();
            CashMovementRepository       cashmovementrep = new CashMovementRepository();
            ElectronicFundRepository     elecrep         = new ElectronicFundRepository();
            PickUpRepository             pickuprep       = new PickUpRepository();
            CashReconciliationRepository cashreconrep    = new CashReconciliationRepository();
            InstantMoneyRepository       imrep           = new InstantMoneyRepository();
            FNBRepository     fnbrep  = new FNBRepository();
            KwikPayRepository kwikrep = new KwikPayRepository();
            #endregion

            //...Get All Details
            CashierReport report = new CashierReport();

            report.CashierId  = query.Cashier;
            report.ReportDate = query.Date;

            report.Cashier         = cashierrep.GetCashier(query.Cashier);
            report.CashMovements   = cashmovementrep.GetCashMovementsPerEmployee(query.Cashier, query.Date);
            report.ElectronicFunds = elecrep.GetElectronicFundsPerEmployee(query.Cashier, query.Date);
            report.FNB             = fnbrep.GetFNBsPerEmployee(query.Cashier, query.Date);
            report.InstantMoney    = imrep.GetInstantMoneysPerEmployee(query.Cashier, query.Date);
            report.KwikPays        = kwikrep.GetKwikPaysPerEmployee(query.Cashier, query.Date);
            report.Pickups         = pickuprep.GetPickUpsPerEmployee(query.Cashier, query.Date);
            report.Recons          = cashreconrep.GetCashReconcilationsPerEmployee(query.Cashier, query.Date);

            //...Initialize Totals
            report.CashTotal       = 0;
            report.CardsTotal      = 0;
            report.ChequeTotal     = 0;
            report.SassaTotal      = 0;
            report.PickupTotal     = 0;
            report.FloatTotal      = 0;
            report.ExtraFloatTotal = 0;
            report.SigmaTotal      = 0;
            report.IMFloatTotal    = 0;
            report.IMRecTotal      = 0;
            report.IMPaidTotal     = 0;
            report.FNBRefTotal     = 0;
            report.FNBRetTotal     = 0;
            report.ElecTotal       = 0;
            report.AirTotal        = 0;
            report.AccTotal        = 0;

            //...Get Totals
            foreach (CashMovement item in report.CashMovements)
            {
                report.CashTotal += item.Amount;
            }

            foreach (ElectronicFund item in report.ElectronicFunds)
            {
                switch (item.ElectronicTypeID)
                {
                case 1: report.SassaTotal += item.Total; break;

                case 2: report.CardsTotal += item.Total; break;

                case 3: report.ChequeTotal += item.Total; break;
                }
            }

            foreach (PickUp item in report.Pickups)
            {
                report.PickupTotal += item.Amount;
                //report.CardsTotal += item.Amount;
            }

            foreach (CashReconciliation item in report.Recons)
            {
                switch (item.ReconciliationTypeID)
                {
                case 1: report.FloatTotal += item.Amount; break;

                case 2: report.ExtraFloatTotal += item.Amount; break;

                case 3: report.SigmaTotal += item.Amount; break;
                }
            }

            foreach (InstantMoney item in report.InstantMoney)
            {
                switch (item.InstantMoneyTypeID)
                {
                case 1: report.IMFloatTotal += item.Amount; break;

                case 2: report.IMRecTotal += item.Amount; break;

                case 3: report.IMPaidTotal += item.Amount; break;
                }
            }

            foreach (FNB item in report.FNB)
            {
                switch (item.FNBTypeID)
                {
                case 1: report.FNBRefTotal += item.Amount; break;

                case 2: report.FNBRetTotal += item.Amount; break;
                }
            }

            foreach (KwikPay item in report.KwikPays)
            {
                switch (item.KwikPayTypeID)
                {
                case 1: report.ElecTotal += item.Amount; break;

                case 2: report.AirTotal += item.Amount; break;

                case 3: report.AccTotal += item.Amount; break;
                }
            }

            return(report);
        }