我们如何在数据库中存储级联税?或用于存储税收的数据库结构
您好,我必须创建一个数据库结构来存储税务详细信息。
我有一个 itemDetails
表,其中包含商品的详细信息,例如名称和价格。
问题是每件商品都有两项税费服务费(10%)和增值税(4%) 但税费是级联的,即在我申请服务费后,然后在新的总额上我必须申请我申请增值税。
我想将其存储在数据库中;我可以通过硬编码来实现这一点,但我希望将其存储在数据库中,以便将来如果客户希望他可以通过指定税收适用的顺序以及它们是否级联来存储更多税收。每个项目可能有不同的税收结构..(例如,一个项目可能具有上述税收结构,另一个项目只有增值税,另一个项目具有完全不同的结构等)
我有一个税收类别表,用户可以在其中存储税收结构,每个项目都属于一个税收类别,即 itemDetailsTable
中有 TaxCategory_id
。我需要你的帮助来解决这个问题。
Hi i have to create a database structure for storing tax details.
I have an itemDetails
table which has the details of the item like name and price.
The problem is for each item there are two taxes service charge (10%) and VAT (4%)
but the taxes are cascaded i.e after I apply servicecharge, then on the new total I have to apply I apply vat.
I want to store this in a database; I can acheive this with hard coding it but I want it in a database so that in the future if the customer wants he can store more taxes by specifying which order the taxes apply and weather they cascade or not. And each item may have a different tax structure.. (Ex. one item may have the above mentioned tax structure, another item has only vat, another item has a completely diffenet structure etc)
I have a tax category table where the user can store a tax structure and each item will belong to a tax category i.e the itemDetailsTable
has TaxCategory_id
in it. I need your help figuring it out from there.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以添加另一个与 TaxCategory 具有多对一关系的表,该表使用排名列来定义应用税款的顺序。
然后,您的逻辑将按照taxRank 的顺序应用税款。如果您有其他顺序无关紧要的税收类别(如taxCategoryId 2),您可以将排名保留为NULL,并让您的逻辑对税率求和并应用它们。
You could add another table that has a many-to-one relationship with TaxCategory that uses a ranking column to define what order the taxes are applied in.
Your logic then applies the taxes in order of taxRank. If you have other tax categories where order doesn't matter (as in taxCategoryId 2), you can just leave the rank NULL and have your logic sum the tax rates and apply them.