コード例 #1
0
ファイル: RentalCharge.cs プロジェクト: VijayMVC/Cares
        /// <summary>
        /// Calculate Charge
        /// </summary>
        public RaHireGroup CalculateCharge(DateTime recCreatedDate, DateTime rAStDate, DateTime rAEndDate, DateTime stDate, DateTime eDate,
                                           Int64 operationId, Int64 hireGroupDetailId, Int32 outOdometer, Int32 inOdometer, List <TariffType> oTariffTypeList)
        {
            PricingStrategy objPs = PricingStrategyFactory.GetPricingStrategy(recCreatedDate, rAStDate, rAEndDate, operationId, oTariffTypeList);

            if (objPs == null)
            {
                throw new CaresException(Resources.RentalAgreement.RentalAgreement.TariffTypeNotDefinedForRentalCharge, null);
            }

            List <StandardRate> standardRates = standardRateRepository.GetForRaBilling(objPs.TariffType.TariffTypeCode, hireGroupDetailId, recCreatedDate).ToList();

            if (standardRates.Count == 0)
            {
                throw new CaresException(Resources.RentalAgreement.RentalAgreement.StandardTariffRateNotDefinedForRentalCharge, null);
            }

            StandardRate otStRate = standardRates[0];

            RaHireGroup tmp = objPs.CalculateRentalCharge(stDate, eDate, otStRate);

            // need to get RA vehicle as well for calculating Excess Mileage Charge for edit case
            tmp.TotalExcMileage       = objPs.GetExcessMileage(outOdometer, inOdometer, tmp.AllowedMileage ?? 0);
            tmp.TotalExcMileageCharge = objPs.GetExcessMileageCharge(tmp.TotalExcMileage, (float)tmp.ExcessMileageRt);

            return(tmp);
        }
コード例 #2
0
ファイル: RADriverHelper.cs プロジェクト: VijayMVC/Cares
        /// <summary>
        /// Calculate Ra Driver Charge
        /// </summary>
        public RaDriver CalculateCharge(DateTime rACreatedDate, DateTime startDtTime, DateTime endDtTime, long desigGradeId, bool isChauffer,
                                        long operationId, List <TariffType> oTariffTypeList)
        {
            PricingStrategy objPs = PricingStrategyFactory.GetPricingStrategy(rACreatedDate, startDtTime, endDtTime, operationId, oTariffTypeList);

            if (objPs == null)
            {
                throw new CaresException(Resources.RentalAgreement.RentalAgreement.TariffTypeNotDefinedForRaDriver, null);
            }

            RaDriver tmp;

            if (isChauffer)
            {
                List <ChaufferCharge> chaufferCharges = chaufferChargeRepository.
                                                        GetForRaBilling(objPs.TariffType.TariffTypeCode, Convert.ToInt64(desigGradeId), rACreatedDate).ToList();

                if (chaufferCharges.Count == 0)
                {
                    throw new CaresException(Resources.RentalAgreement.RentalAgreement.ChaufferRateNotDefinedForChauffer, null);
                }

                ChaufferCharge oChfRate = chaufferCharges[0];

                tmp = objPs.CalculateChaufferCharge(startDtTime, endDtTime, oChfRate);
            }
            else
            {
                List <AdditionalDriverCharge> additionalDriverCharges = additionalDriverChargeRepository.
                                                                        GetForRaBilling(objPs.TariffType.TariffTypeCode, rACreatedDate).ToList();

                if (additionalDriverCharges.Count == 0)
                {
                    throw new CaresException(Resources.RentalAgreement.RentalAgreement.DriverChargeNotDefined, null);
                }

                AdditionalDriverCharge oAddDrvRate = additionalDriverCharges[0];

                tmp = objPs.CalculateAddDriverCharge(startDtTime, endDtTime, oAddDrvRate);
            }

            return(tmp);
        }