Complicated calculator in JavaSctipt

October 4, 2014 JavaScript

I've published example of simple calculator in JavaScript earlier, this is more complicated one.

Calculator required for the automation of the sales department of ceilings producers. An algorithm for calculating the cost turned out to be very complicated with a large number of dependencies between parameters. Besides the parameters themselves ceilings existed more discounts, which are intertwined intermediate and final results of the calculations.

Calculating the cost of ceilings for a client could take up to one hour by sales manager. Firstly, it is strongly inhibited working sales team. Another negative factor was a high probability of occurrence errors in manual calculations that later affected the loyalty of the customers. Finally, it is very difficult to train a new employee computing features and exceptions to the rule.

Technical requirements were practically no initially. More accurate view of the customer that It would be nice to implement it all in an Excel.

I have proposed a variant of the web version of the calculator. As a result, it was possible to avoid dependencies Excel'ya specific versions, installation difficulties on all computers that support the current update the software part, as well as easy to implement access from various devices.

All calculations, it was decided to carry out on the front end in JavaScropt - is on the one hand made it possible to get the result instantly, without having to send the entire array of data to the server and analyze the response; on the other hand it allowed a little easier to manage all of that will change the calculator works algorithms.

The Bootstrap was selected as an interface, allowing no to think about the design of individual elements of the interface, and fully concentrate on the software part.

The final form of the calculator:

The initial problems were resolved. Now only required to make the right number - all calculations occurred immediately. The sales staff did not need to thoroughly understand the peculiarities algorithm. For ease of use to new employees for each parameter were made sufficiently detailed tooltips mentioning features and exceptions.

Working version of the interactive calculator of ceilings production.

The calculation may be several ceilings, such as kitchen, living room, bathroom. Ceilings can be of two types: PVC and fabric. For both types had a lot in common in calculating the cost.

As a result, the ceiling was implemented a class that holds the state and performs the calculations are the same for both ceilings. For both types of ceilings implemented classes that inherit from this overall ceiling of the class, allowing reflect particularities of each type.

Among other things, the export procedure has been developed in Excel the final cost estimates for the ceilings set.