add function count total from cost in table

add function count total from cost in table