odoo tax calculation is not correct - python-2.7

I created a supplier invoice whose amount without taxes = 5125,000.
In my country we add a tax of 1% on the total amount of the invoice without taxes so 5125,000 + 1% = 5176,25 then we add the taxes on the products which is in this case 19% for all products 5176 , 250 + 19% = 6159.7375
. Finally I add a stamp tax of amount 0,600 of or the total equal to 6160,338
So my problem is I noticed that when calculating the amount of the tax 19% there is an error odoo gives the result of 5176,250 + 19% = 6159,746 where the final result of my invoice is different from the actual result it gives me a total equal to 6160,346
How can I solve this problem? Any help please ?

Related

Net Present Value With Discount Rate

I'm trying to calculate net present value and payments of a 5,000 installment loan with a discount rate of 20%, an interest rate of 59% (simple annual), biweekly repayments for 3 years of payments. I need to know what the monthly payments will be, monthly interest, etc. and use those payments as the cash flows for NPV. I have started this but don't seem to be getting the right result, if it is correct, then problem solved but it seems off to me, I'm getting a little over $8,000 as the cumulated NPV (then if I add the negative principal due to the discounts and minus the starting principal balance I get around $1,500 net):
let's assume the fm2_bin_co_rate = 25% here:
data NPVBW;
set base_data;
rpmt_freq=26;
rate59=0.59/rpmt_freq; /*Interest rate*/
nper59=78; /*Number of periods: Term in installments*/
pv59=5000; /*Present value: loan amt * monthly charge off rate /2 for biweekly*/
pmt59 = FINANCE('pmt', rate59, nper59, pv59); /*Monthly payment*/
pb59=pv59; /*Principal Balance*/
do period59 = 1 to nper59;
ppmt59=FINANCE('ppmt', rate59, period59, nper59, pv59); /*Payment on the principal*/
mi59=pmt59- ppmt59; /*Payment on the interest*/
pb59=((pb59*(1-fm_bin_co_rate/nper59))+ppmt59)*(1-.014*(12/rpmt_freq)) /*early payoff rate*/;
npvrate59=1.2**(period59/rpmt_freq);
npvper59=pmt59/(1.2**(period59/rpmt_freq))/*discount rate*/*(1-fm_bin_co_rate/nper59)/*charge off rate over life of loan*/*(1-.014*(12/rpmt_freq)) /*early payoff rate per month*/;
output;
end;
run;

Sum of a column but give the average of the sum for every applied filter?

I give here a sample data:
As you see we have a fact table for monthly expenses, and daily occupancy FT with row for every day for each residence. The residents vary but most of them are permanent. I think this is not
The goal is to find the expense for each resident per day.
The calculation for that is:
PRPD expense = SUM ( actual_amount) / SUM ( number_of_residents )
I put that PRPD expense in a card on the report page and I have filters for Year, Month and Residence Name.
If I select both residences for January the calculation is as follows:
(3000+2500) / (30+31+31) = **59.78**
In reality we have:
For Residence A:
3000 / (30+31) = 49.18
For Residence B:
2500 / 31 = 80.65
The average for both residences:
(49.18 + 80.65) = **64.92**
And the average is what we need. How do I accomplish this?
Thank you in advance.

Count of products where sum of sales for particular product is higher than 2% of total sales - Power BI - DAX Measure

I have facts tables with sales
I would like to create measure that counts number of products where sum of sales for particular product is higher than 2% of total sales.
For example:
1. sum of sales for 'ProductKey' 310 is 5000.
2. sum of sales for 'ProductKey' 346 is 2000.
3. 2% of sum of total sales is 3000.
Product 310 would be included in count product 346 wouldn't be included in count.
How would I write such measure?
I've tried to created something like this:
Big Sales =
var SalesTotal = CALCULATE(SUM(fact_InternetSales[SalesAmount]))
var twoperceSalesAmount =
CALCULATE (SUM(fact_InternetSales[SalesAmount]), ALL( fact_InternetSales )) * 0.02
return
CALCULATE (COUNT(fact_InternetSales[ProductKey]),
FILTER (fact_InternetSales, SalesTotal - twoperceSalesAmount > 0))
Thansk
Kind regards,
Robert
You were almost there.
The pseudoalgorithm is:
1. Calculate threshold
2. Consider only product with sales above threshold
3. Count number of products
Big Sales:=
var _threshold = CALCULATE(SUM(fact_InternetSales[SalesAmount]),ALL(fact_InternetSales))*0.02
var _productlist =
FILTER(ADDCOLUMNS(
SUMMARIZE(
fact_InternetSales,
fact_InternetSales[ProductKey),
"productsales",CALCULATE(SUM(fact_InternetSales[SalesAmount]))),
[productsales]>_threshold)
RETURN
Countrows(_productlist)
If it is very slow web can optimize it.
Also solution with SUMX works:
Big Sales SUMX =
SUMX(VALUES(fact_InternetSales[ProductKey]),
IF(CALCULATE(SUM(fact_InternetSales[SalesAmount]))>
CALCULATE(SUM(fact_InternetSales[SalesAmount]),ALL(fact_InternetSales))*0.02,1))

Adding Tax to Shipping in Opencart

How do you add tax to a shipping amount on Opencart?
I obtain the following checkout summary on my site:
Sub-Total: £332.50
Delivery Zone 1: £49.99
VAT (20%): £66.50
Total: £448.99
Delivery is £49.99 inclusive of VAT so it needs to read as follows:
Sub-Total: £332.50
Delivery Zone 1: £41.66
VAT (20%): £74.83
Total: £448.99
How can this be solved?
You shoud assign a tax class to your shipping mode in Extensions > Shippings and put the price of your shipping method without the VAT price included. Make sure you also set a tax class on your product and that Extensions > Order totals > Taxes is enabled.
Your checkout summary now will show you the shipping price without the VAT included. You'll find the total VAT price (calculated by adding the VAT of the product's price and that of the shipping cost) in the VAT field.

Buyers Premium Excel Calculation

I have this deadline in the next few hours and I would really appreciate your help.
I need to create a formula to calculate buyer premium fees from the hammer price at an auction.
It works like this.
The hammer price is = X
Tax1 £0-£100,000 = 25% (Every sale is charged 25% up to the value of £100,000 so max is £125,000 for this part)
Tax2 £100,000-£2,000,000 = 20% If the hammer price exceeds £100,000, then 20% is added for this portion.
Tax3 £2,000,000+ = 12%. If the hammer price exceeds £2,000,000, then 12% is added to this portion.
Could anyone help me create a formula that would allow me to enter the hammer price and it would auto-calculate the total fees and give me the total price including those 3 taxes.
The code I have so far is this:
Tax 1 = IF(B3<=100000,B3*0.25,100000*1.25)
Tax 2 = IF(B3<1900000,B3*0.2,1900000*0.2)
Tax 3 = (B3-2000000)*0.12
You can use simple if statement for the same
Please refer to the formula in the address bar below.
Breaking this down into smaller chunks
Cost less than 100k, 25%, otherwise 25% of 100k
=IF(A1<10000,A1*0.25,25000)
Cost over 100k but less than 2m, 20% of the portion between 100k and 2m + the 25% of 100k
+IF(AND(A1<2000000,A1>=100000),(A1-100000)*0.2,(IF(A1<100000,0,40000)))
Cost over 2m, 12% of the portion over 2m plus the previous chunks+IF(A1>2000000,(A1-2000000)*0.12,(IF(A1<2000000,0,65000)))
Putting it all together
=IF(A1<10000,A1*0.25,25000)+IF(AND(A1<2000000,A1>=100000),(A1-100000)*0.2,(IF(A1<100000,0,40000)))+IF(A1>2000000,(A1-2000000)*0.12,(IF(A1<2000000,0,65000)))
Few test cases
* Hammer Commission
* 0 0
* 10 2.5
* 100000 25000
* 100001 25000.2
* 2000000 130000
you can try this one which conforms to your conditions:
=IF(B3<=100000,B3*0.25,IF(AND(B3>100000,B3<=2000000),B3*0.2,IF(B3>2000000,B3*0.12,"NOT FOUND")))
Please confirm if below calculation for hammer price £500,000 are correct.
See below screenshot for functions used:
I'm still trying to share excel file with you. Can't upload here!!!
Excel file with required functions. See instructions to change Hammer Price in file.
Hammer Price Excel File