示例#1
0
        private static void CalculateTotalsOfVatNumber(List <object> vats)
        {
            object selected = SelectVat(vats);

            if (selected is NormalVatNumber normal)
            {
                NormalVatNumber.CalculateAndPrint(normal);
            }
            else if (selected is SimpleVatNumber simple)
            {
                SimpleVatNumber.CalculateAndPrint(simple);
            }
            else
            {
                Console.WriteLine("The entered VAT number does not exist!");
            }
        }
示例#2
0
        public static void CalculateAndPrint(SimpleVatNumber selected)
        {
            decimal billTotal = Utilities.Sum(selected.Bills);

            decimal profit = billTotal;

            if (profit > 0)
            {
                decimal taxable = profit * SIMPLE_TAXABLE_PERCENTAGE / 100;
                decimal taxes   = taxable * SIMPLE_TAX_PERCENTAGE / 100;
                decimal net     = profit - taxes;

                Console.WriteLine($"Net gain: {net}; total taxation: {taxes}");
            }
            else
            {
                Console.WriteLine($"Profit: {profit}");
            }
        }