我正在使用预定义的php库存管理器.
所以在销售中我的数据以这种方式存储:
[{"product_id":"8","total_number":"70","selling_price":"110"}]
要在表I中显示这些值,请使用以下代码
$sub_total = 0;
$invoice_entries = json_decode($row['invoice_entries']);
foreach ($invoice_entries as $row2):
$sub_total += ($row2->total_number * $row2->selling_price);
endforeach;
$sub_total = $sub_total - ( $sub_total * ($row['discount_percentage'] / 100) );
$grand_total = $sub_total + ( $sub_total * ($row['vat_percentage'] / 100) );
echo $grand_total;
我在这里得到了所需的输出,这是销售的总价值.
现在,我正在尝试提供一个报告功能,该功能将显示所有具有客户名称,销售价值的发票.
我想计算所有发票的总和并显示在表格行中,即$grand_total的总和.
我无法理解如何获得它.任何java脚本都可以做到吗?我不太了解js.所以我不知道它是否有可能.
提前致谢