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.
There are some core files we need to modify because we need to add some new Javascript functions, adding the search icon in dropdown list, and also add a selection link to select and put the item into the dropdown list.
- includes/ui/ui_input.inc
We add two functions here, ahref and ahref_cell for displaying the link for selecting item in search list into dropdown list. - includes/ui/ui_lists.inc
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. - includes/ui/ui_view.inc
Some new Javascript functions for opening the popup window are added here.
After modifying the core files, we also need to modify some files which have the dropdown list for items, supplier, customers, or GL accounts in them. Into the following files we need to add the Javascript that containing the function for opening popup window by calling get_js_open_window function.
- admin/gl_setup.php
- gl/manage/gl_accounts.php
- inventory/inquiry/stock_status.php
- inventory/manage/item_categories.php
- inventory/manage/item_codes.php
- inventory/manage/sales_kits.php
- inventory/prices.php
- inventory/purchasing_data.php
- inventory/reorder_level.php
- manufacturing/manage/bom_edit.php
- sales/manage/customer_branches.php
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.
- gl/inquiry/accounts_list.php
- inventory/inquiry/stock_list.php
- purchasing/inquiry/suppliers_list.php
- sales/inquiry/customer_branches_list.php
- sales/inquiry/customers_list.php
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.
Add new comment