Adding calculation to closing voucher


i wondering if i can do this

i want to add account type “Production expense” in chart of accounts then for every closing voucher i want to update all of the stock entry that have type manufacture to keep the record of the actual cost of the production expense (the production expense will be devided among stock entry based on the qty that produced) , im also want to save the BOM production cost in stock entry so i can compare it later
i planned to compare it as a production order , so ill sum all on the stock entry