ja | en

We calculate the tax amount using the consumption tax rate at the time when the user operated it. We will respond to future consumption tax change rules.

We prepare "consumption tax rate" model.Register the initial data shown in Figure 1.

Fig.1 Setting value of consumption tax rate model

It is an example used in order model.The consumption tax rate at the time of operation (8% in the example of Fig. 2) is applied to the sales amount.

Fig. 2 Calculation example of consumption tax amount

The "tax rate start date" is assumed to be the date type.We will make "consumption tax rate" 8-byte floating point type.

Fig. 3 Consumption tax rate model

Figure 4 Types of consumption tax rate items

In the model that calculates consumption tax, prepare items corresponding to "date" "amount of money" "consumption tax" "consumption tax amount".

Figure 5 Order Date, Sales Value, Consumption Tax, Consumption Tax Item

item | Description | Type |
---|---|---|

date | Date item at the time when the tax rate is determined | Date type.It becomes the target date. |

Amount of money | Items for which tax rates are to be determined | Integer type.It is also possible to use such as using the reference linkage to post values in the product master. |

consumption tax | Consumption tax at the calculation date | Refer to the consumption tax model.By the setting described below, narrow down to the consumption tax of the target date. |

consumption tax | Multiply the amount and consumption tax and ask. | It is assumed that there is no error.(Described later) |

This item is a reference to the consumption tax model.Please make it a list box.

Fig. 6 Refer to the consumption tax model in the list box.

Suppose you do not save this value in the database.

Figure 7 Do not save in database

If you want to keep the consumption tax at the time of calculation as a record, please save it in the database.

Set the "narrow down the choices by the value of other items" setting.Do the following.

Fig. 8 Setting to narrow down choices by value of other items

- item name
- Specify the date item in which the target date is stored.
- Refining condition
- To narrow it down before the target date, specify "below".
- Referenced item name
- Specify the "tax rate start date" item of the consumption tax model.
- Operation when not yet input
- I will say "I will not make a choice".

Furthermore, suppose that this option is pre-sorted in descending order of "tax rate start date", and that only one head (of multiple choices) is used.

Figure 9 Display only the beginning of choices

With this setting, the consumption tax rate at this point will be confirmed.The image of this setting is as follows.

Fig. 10 Image of narrowing down

In addition, this item is hidden when entering.It is also hidden at the time of output.This will not be displayed on the screen.

Fig. 11 Make it hidden when entering

Figure 12 Hidden items when output

It is good to cancel hidden designation during development.You can check the current consumption tax rate on the screen.

It shows the formula for calculating the consumption tax amount.

13

IF ($ {HIDDENTAX} == 0.0, 0, (int) ROUND (VALUE (MUL ($ {AMHANBAI}, $ {HIDDENTAX})), 0))

- The consumption tax item is model reference.If you write $ {HIDDENTAX}, you get the content section (consumption tax rate).
- Generally, multiplication of sales amount and consumption tax rate causes errors in decimal part.To solve this problem, we use MUL function instead of normal multiplication.Details are "calculation formula> Calculation precisionPlease read.
- The return value of the MUL function is a string type.Apply the VALUE function and convert it to 8 byte floating point.
- We specify 0 for the number of digits in the ROUND function and round off the number as the nearest integer.
- Since the final calculation result is of integer type, we are explicitly converting the type by (int) being added at the beginning.
- The item "Hidden item consumption tax (HIDDENTAX)" is blank (null) when a date that does not exist in the consumption tax master (the date before the first consumption tax is set) is taken as the order entry date, but $ {HIDDENTAX } Will return 0.0.This is an expression after Wagby has expanded, as it will return 0.0 if the selected result is null (which is the initial value of the 8 byte floating point type).Using this property, in this case the consumption tax is set to 0.