Either place would do for updates. It is probably safer to use the cart interface if you want to be able to in the future. Small mistakes in code view may work, but could also prevent the cart interface from being used in the future.
In this case though the update is really simple... I think just update :
$totalDiscount += (($this->TotalColumn("TotalPrice") * 0.2) + 0);//Result
to refer to the calculated discouned total instead of "TotalPrice" when doing the discount.