- $total += $_->get($field) foreach @cust_bill_pkg;
-
- $money_char. sprintf('%.2f', $total);
+ $search->{'select'} = "SUM(cust_bill_pkg.$field) AS total";
+ my $result = qsearchs($search);
+ $money_char. sprintf('%.2f', $result ? $result->get('total') : 0);