Powered by Blogger.

Change Default Account on Create Work Order Front Accounting



Base on the article Add Parameters on “System and General GL Setup” FrontAccounting we want to implement it into the “Create Work Order” form. This is the way, open file “\manufacturing\work_order_entry.php”, then find code below.

if (!isset($_POST['Labour']) || list_updated('stock_id') || list_updated('type'))
{
     $bank_act = get_default_bank_account();
     $item = get_item(get_post('stock_id'));
     $_POST['Labour'] = price_format(get_post('type') == WO_ASSEMBLY ? $item['labour_cost'] : 0);
     $_POST['cr_lab_acc'] = $bank_act['account_code'];
     $_POST['Costs'] = price_format(get_post('type') == WO_ASSEMBLY ? $item['overhead_cost'] : 0);
     $_POST['cr_acc'] = $bank_act['account_code'];
     $Ajax->activate('_page_body');
 }


Then, modified like code below.

if (!isset($_POST['Labour']) || list_updated('stock_id') || list_updated('type'))
{
     //$bank_act = get_default_bank_account();
     $company_record = get_company_prefs();
     $item = get_item(get_post('stock_id'));
     $_POST['Labour'] = price_format(get_post('type') == WO_ASSEMBLY ? $item['labour_cost'] : 0);
     //$_POST['cr_lab_acc'] = $bank_act['account_code'];
     $_POST['cr_lab_acc'] = $company_record["default_workorder_creditlabour_act"];
     $_POST['Costs'] = price_format(get_post('type') == WO_ASSEMBLY ? $item['overhead_cost'] : 0);
     //$_POST['cr_acc'] = $bank_act['account_code'];
     $_POST['cr_acc'] = $company_record["default_workorder_creditovrhead_act"];
     $Ajax->activate('_page_body');
 }

It’s done, and this is the result.


No comments