问题描述
我创建了一个函数,它将从总金额和增值税金额中返还增值税百分比。
我的职能是: -
I created a function that will return the VAT percentage from Total and VAT amount..
My Function is :-
public decimal vatRsToPer(decimal vatAmt, decimal totalAmt)
{
try
{
decimal rupees;
rupees = decimal.Multiply(vatAmt, 100m);
rupees = decimal.Divide(rupees, totalAmt);
return rupees;
}
catch {
return 0m;
}
}
问题是,假设总金额为2400.00,增值税%为4 ,这意味着增值税卢比是96.00..
如果我想从增值税卢比96.00和总卢比2496.00(包括增值税卢比)中获得增值税的百分比)。然后我的功能返回3.85而不是4..
请帮助我,我做错了....
每个建议将被赞赏...
Problem is, suppose the total amt is "2400.00" and VAT% is "4", that means the VAT Rupees is "96.00"..
If i want to get the percentage of the VAT from that VAT rupees "96.00" and Total rupees "2496.00"(which is including VAT rupees). then my function return "3.85" not "4"..
Please Help me, Where I did wrong....
Every Suggestion will be appreciated...
推荐答案
请帮助我,我做错了......
Please Help me, Where I did wrong....
这里:
Here:
rupees = decimal.Divide(卢比,totalAmt);
rupees = decimal.Divide(rupees, totalAmt);
应该是:
Should be:
rupees = decimal.Divide(rupees, totalAmt-vatAmt);
这篇关于如何计算C#中增值税卢比的增值税百分比?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!