diff --git a/app/Controllers/Medical.php b/app/Controllers/Medical.php index 15ff287..9304437 100644 --- a/app/Controllers/Medical.php +++ b/app/Controllers/Medical.php @@ -12430,7 +12430,7 @@ class Medical extends BaseController $whereSql = implode(' AND ', $conditions); - $sql = "SELECT p.item_name, p.genericname, + $sql = "SELECT p.item_name, p.formulation, p.genericname, IFNULL(s.packing,p.packing) AS packing, SUM(s.total_unit-s.total_sale_unit-s.total_lost_unit-s.total_return_unit) AS C_Unit_Stock_Qty, CONCAT( @@ -12453,20 +12453,21 @@ class Medical extends BaseController JOIN purchase_invoice m ON s.purchase_id=m.id LEFT JOIN med_supplier ms ON ms.sid=m.sid WHERE {$whereSql} - GROUP BY p.item_name, p.genericname, IFNULL(s.packing,p.packing) + GROUP BY p.item_name, p.formulation, p.genericname, IFNULL(s.packing,p.packing) {$havingSql} ORDER BY p.item_name"; $rows = $this->db->query($sql, $params)->getResult(); $content = '
| Item Name | Generic | Current Pak. | Current Unit Qty | ' + . 'Item Name | Formulation | Generic | Current Pak. | Current Unit Qty | ' . 'Total Sale Pak. | Total Sale Unit Qty | Lost Unit | Package/Re-Order Qty | ' . '
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ' . esc((string) ($row->item_name ?? '')) . ' | ' + . '' . esc((string) ($row->formulation ?? '')) . ' | ' . '' . esc((string) ($row->genericname ?? '')) . ' | ' . '' . esc((string) ($row->C_Pak_Qty ?? '0')) . ' | ' . '' . esc(number_format((float) ($row->C_Unit_Stock_Qty ?? 0), 2, '.', '')) . ' | '