Using Popup Window To Search Item In FrontAccounting
Recently, I work on a project for developing Enterprise Resource Planning (ERP) software for a company which selling vegetables. It's not the company that I will talk about here, but the ERP that I develop. Actually I didn't develop it from scratch but using an Open Source ERP software. After researching some software, I choose FrontAccounting because it's very suitable to my needs, easy to setup, and designed for small and medium enterprise just like my client company.
But, there is one thing that bother me from the beginning. It's the dropdown list for choosing items, customers, suppliers, and the GL accounts. I think it will be hard to search for the items if the item number is very large, let's say more than 500 items. It's true that there is a feature to search the items, suppliers, and customer which can be activated from the Company Setup menu. By doing that, we are capable to search supplier or customer by pressing space when clicking the dropdown list, then we will be provided with a textfield to search it. After that, just type some keywords and then click on the other parts of the page the dropdown list will be populated based on our search keywords. For searching items we can type the keywords directly in the textfield that we used to enter the item code. When we click on the other parts of the page, then the dropdown list will be populated instantly.
But, I still don't like it, because it's very uncomfort method in my opinion. Also, there is no same option for searching the GL accounts which can contain many items too. So, I decide to make some modifications to add one icon right beside the dropdown list. When we click that icon, a popup window will be displayed and we are able to search the items by their name there. After we select one of them, the item in dropdown list will be selected based on our selection before.
We add two functions here, ahref and ahref_cell for displaying the link for selecting item in search list into dropdown list.
Big modifications happened here. We need to modify the combo_input function to add the icon to open popup window for searching the item in dropdown list. We also need to modify the other functions which call this function to pass a new parameter to tell combo_input what kind of popup window will be opened.
We also need to add some new files for displaying the item list in popup window. From their name we already knew what they will search for.
Now, where are the code? I've pushed all of them to my GitHub, https://github.com/w3shaman/FA. The code is for FrontAccounting 2.4 which is still under development and will be included when the 2.4 released (see the following link).
Although the code is for 2.4, we can also apply the same method for FrontAccounting 2.3 which I have done for my project and it works as I expected.