Example #1
0
        public MeterInvoiceDetailInfo CalculateUnitInvoice(MeterInfo meter, ConsumeProfile consume, ConsumeType consumeType)
        {
            decimal AGPrice = TariffPriceList.Where(t => t.StartPeriod <= consume.Period && t.EndPeriod >= consume.Period).Select(t => t.AGDistributionUnitPrice).FirstOrDefault();

            decimal OGPrice = TariffPriceList.Where(t => t.StartPeriod <= consume.Period && t.EndPeriod >= consume.Period).Select(t => t.OGDistributionUnitPrice).FirstOrDefault();



            decimal energyPrice = Math.Round(consume.Consume * 0.167M, 2);

            decimal distributionPrice;

            if (consume.AGOG == (int)AGOG.AG)
            {
                distributionPrice = Math.Round(AGPrice * consume.Consume, 2);
            }
            else
            {
                distributionPrice = Math.Round(OGPrice * consume.Consume, 2);
            }

            decimal municipalityTax;

            if (consume.CalculateMunicipalityTax)
            {
                municipalityTax = Math.Round(energyPrice * 0.01M, 2);
            }
            else
            {
                municipalityTax = 0M;
            }

            decimal energyFundTax = Math.Round(energyPrice * 0.01M, 2);

            decimal trtTax = Math.Round(energyPrice * 0.02M, 2);


            var meterInvoice = new MeterInvoiceDetailInfo()
            {
                EnergyPrice       = energyPrice,
                DistributionPrice = distributionPrice,
                MunicipalityTax   = municipalityTax,
                EnergyFundTax     = energyFundTax,
                TRTTax            = trtTax,
                Consume           = consume.Consume,
                ConsumeType       = consumeType
            };


            return(meterInvoice);
        }
Example #2
0
        public void CalculatePeriodInvoice()
        {
            decimal AGPrice = TariffPriceList.Where(t => t.StartPeriod <= Period && t.EndPeriod >= Period).Select(t => t.AGDistributionUnitPrice).FirstOrDefault();

            decimal OGPrice = TariffPriceList.Where(t => t.StartPeriod <= Period && t.EndPeriod >= Period).Select(t => t.OGDistributionUnitPrice).FirstOrDefault();

            foreach (var item in PeriodConsumeList)
            {
                decimal energyPrice = Math.Round(item.Consume * 0.167M, 2);

                decimal distributionPrice;

                if (item.AGOG == (int)AGOG.AG)
                {
                    distributionPrice = Math.Round(AGPrice * item.Consume, 2);
                }
                else
                {
                    distributionPrice = Math.Round(OGPrice * item.Consume, 2);
                }

                decimal municipalityTax;

                if (item.CalculateMunicipalityTax)
                {
                    municipalityTax = Math.Round(energyPrice * 0.01M, 2);
                }
                else
                {
                    municipalityTax = 0M;
                }

                decimal energyFundTax = Math.Round(energyPrice * 0.01M, 2);

                decimal trtTax = Math.Round(energyPrice * 0.02M, 2);


                InvoiceDetails.Add(new MeterInvoiceDetailInfo()
                {
                    EnergyPrice       = energyPrice,
                    DistributionPrice = distributionPrice,
                    MunicipalityTax   = municipalityTax,
                    EnergyFundTax     = energyFundTax,
                    TRTTax            = trtTax,
                    Consume           = item.Consume,
                    ConsumeType       = ConsumeType.Period
                });
            }
        }