PHPRad Classic Calculations

Please see attached snapshot.
Need to SUM invoice amount of each PO in Create Invoice form and then validate with its PO amount.
And PO Code field should be come by Default in Create Invoice when I will select any PO from PO Master form.
PO is Main form
Create Invoice is child of PO
Application is in PHP MySql, MVC.
One PO have multiple invoices