Different Item Sales Price For Each Customer In FrontAccounting
This is a simple tutorial based on my experience when customizing FrontAccounting. In some cases we may need to have different sales price for the same item but different customer. For the example, we want to sell Item 1 to Customer A with price 500, but for the same item we want to sell to Customer B with price 550. It's true we can edit that price manually when creating the Sales Order. But, it will be more efficient if we can do that automatically based to the data we had.
In order to achieve that objective, we have to do some modifications in the code. First, we have to add new table for storing item price for each customer. After that we have to modify the following files:
Make sure you have done the backup for your current code so you can rollback to your previous code if something unexpected happened.
We add new tab for customer price entry here.
New page for managing customer price.
New file for customer price CRUD process.
The file for handling customer price, inventory/includes/db/items_prices_customer_db.inc will be included from here.
Modify function sales_order_item_controls to pass customer id when calling get_kit_price function. This will result a different price for each customer.
Modify the function get_price and get_kit_price to accept customer id parameter. This parameter will be used to get the price for each customer.
Add new menu in Inventory page so we can set customer price in an independent page.
All required files and SQL for creating new table is provided in the attachment below. For the SQL, please remember to adjust the table prefix according to your FrontAccounting settings.
Add new comment