Engee documentation
Notebook

Value added tax (VAT)

VAT is an indirect tax. It is calculated by the seller when goods (work, services, property rights) are sold to the buyer.

This model allows us to calculate VAT on any purchases by specifying them as an array of prices.

The model itself is shown in the figure below.

image.png

Next, let's add an auxiliary function to the model and specify the shopping list.

In [ ]:
# Подключение вспомогательной функции запуска модели.
function run_model( name_model)
    
    Path = (@__DIR__) * "/" * name_model * ".engee"
    
    if name_model in [m.name for m in engee.get_all_models()] # Проверка условия загрузки модели в ядро
        model = engee.open( name_model ) # Открыть модель
        model_output = engee.run( model, verbose=true ); # Запустить модель
    else
        model = engee.load( Path, force=true ) # Загрузить модель
        model_output = engee.run( model, verbose=true ); # Запустить модель
        engee.close( name_model, force=true ); # Закрыть модель
    end
    sleep(5)
    return model_output
end
Out[0]:
run_model (generic function with 1 method)
In [ ]:
Purchases = [100, 120, 12.55];

Let's run the model and output the calculated tax amount.

In [ ]:
run_model("NDS") # Запуск модели.

Sum = collect(simout["NDS/Сумма покупок"]);
NDS = collect(simout["NDS/НДС от покупок"]);

println("Сумма покупок: " * string(Sum.value))
println("НДС от покупок: " * string(NDS.value))
Building...
Progress 100%
Сумма покупок: Any[232.55]
НДС от покупок: Any[46.510000000000005]

Conclusion

In this example we have demonstrated the possibilities of using Engee to realise everyday tasks.

Blocks used in example