如何计算C#中增值税卢比的增值税百分比? [英] how to calculate VAT percentage from VAT rupees in C#?

查看:104
本文介绍了如何计算C#中增值税卢比的增值税百分比?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个函数,它将从总金额和增值税金额中返还增值税百分比。

我的职能是: -

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:

Quote:

rupees = decimal.Divide(卢比,totalAmt);

rupees = decimal.Divide(rupees, totalAmt);



应该是:


Should be:

rupees = decimal.Divide(rupees, totalAmt-vatAmt);


这篇关于如何计算C#中增值税卢比的增值税百分比?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆