Пример #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(NormalVatNumber selected)
        {
            decimal profit = Utilities.Sum(selected.Bills) - Utilities.Sum(selected.Expenses);

            if (profit > 0)
            {
                decimal iva = profit * IVA_PERCENTAGE / 100;
                decimal profitWithoutIva = profit - iva;
                decimal irpef            = profitWithoutIva * IRPEF_PERCENTAGE / 100;
                decimal net      = profitWithoutIva - irpef;
                decimal taxTotal = iva + irpef;

                Console.WriteLine($"Total net gain: {net}; total taxes: {taxTotal}");
            }
            else
            {
                Console.WriteLine($"Profit: {profit}; total taxes: 0");
            }
        }