Use the rules engine to calculate Personal Income Tax Learning

Source: Internet
Author: User

Using personal income tax calculation as the business prototype, the expression rules and the Excel template of the Decision Table are imported. It reflects the text editing of business rules and implements business logic quickly.

Create rule set


Right-click the project "test XML structure" and select "new rule package" to add a rule package named "Calculate personal income tax". The creation process is shown in:

650) this. width = 650; "src =" http://img.blog.csdn.net/20130916133957156 "style =" border: none; color: #333333; font-family: arial; font-size: 14px; line-height: 26px; background-color: # ffffff; "alt=" 20130916133957156 "/>

Create a variable ,:

650) this. width = 650; "src ="/e/u/themes/default/images/spacer.gif "style =" border: 1px solid # ddd; "alt =" spacer.gif "/> 650) this. width = 650; "src =" http://img.blog.csdn.net/20130916134112968 "style =" border: none; color: #333333; font-family: arial; font-size: 14px; line-height: 26px; background-color: # ffffff; "alt=" 20130916134112968 "/>

Create and edit expression rules


Select the "Calculate personal income tax" rule package, right-click to create "add expression rule", and name it "total monthly tax payable ". As shown in:

650) this. width = 650; "src =" http://img.blog.csdn.net/20130916134203218 "style =" border: none; "alt =" 20130916134203218 "/>

650) this. width = 650; "src =" http://img.blog.csdn.net/20130916134152046 "style =" border: none; "alt =" 20130916134152046 "/>


Write the business rules in the edit box on the right. "If", "then", and "end if" are keywords. Blue is the defined variable. The specific content is shown in:

650) this. width = 650; "src =" http://img.blog.csdn.net/20130916134244859 "style =" border: none; color: #333333; font-family: arial; font-size: 14px; line-height: 26px; background-color: # ffffff; "alt=" 20130916134244859 "/>


Table creation and content Import

Add an association decision table and name it "set tax rate ",:

650) this. width = 650; "src =" http://img.blog.csdn.net/20130916134752093 "style =" border: none; "alt =" 20130916134752093 "/>

Prepared Excel template.

650) this. width = 650; "src =" http://img.blog.csdn.net/20130916134904031 "style =" border: none; "alt =" 20130916134904031 "/>

Operation: Import Excel

650) this. width = 650; "src =" http://img.blog.csdn.net/20130916134943375 "style =" border: none; "alt =" 20130916134943375 "/>


After the data is imported, the Excel content appears in the associated decision table. To modify the content in the decision table, you can directly modify the content in the Decision Table and re-import it in Excel.

650) this. width = 650; "src =" http://img.blog.csdn.net/20130916134952781 "style =" border: none; color: #333333; font-family: arial; font-size: 14px; line-height: 26px; background-color: # ffffff; "alt=" 20130916134952781 "/>


Create and compile a post-tax wage expression


Create the "after-tax salary" expression rule and write the content, as shown in.

650) this. width = 650; "src =" http://img.blog.csdn.net/20130916135128062 "style =" border: none; color: #333333; font-family: arial; font-size: 14px; line-height: 26px; background-color: # ffffff; "alt=" 20130916135128062 "/>

650) this. width = 650; "src =" http://img.blog.csdn.net/20130916135200625 "style =" border: none; "alt =" 20130916135200625 "/>


Save, compile, and test 650) this. width = 650; "src =" http://img.blog.csdn.net/20130916135341156 "style =" border: none; color: #333333; font-family: arial; font-size: 14px; line-height: 26px; background-color: # ffffff; "alt=" 20130916135341156 "/>


650) this. width = 650; "src =" http://img.blog.csdn.net/20130916135327109 "style =" border: none; "alt =" 20130916135327109 "/>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.