function outstanding_get() { $filters = $this->get("filter")["filters"]; $page = $this->get('page') !== false ? $this->get('page') : 1; $limit = $this->get('limit') !== false ? $this->get('limit') : 100; $sort = $this->get("sort"); $data["results"] = array(); $data["count"] = 0; //Bill $bill = new Bill(null, $this->entity); if (!empty($filters) && isset($filters)) { $bill->where($filters[0]["field"], $filters[0]["value"]); } $bill->where("type", "bill"); $bill->where("status", 0); $bill->where("deleted", 0); $data["results"][] = array("totalBill" => $bill->count()); //SO $so = new Bill(null, $this->entity); if (!empty($filters) && isset($filters)) { $so->where($filters[0]["field"], $filters[0]["value"]); } $so->where("type", "SO"); $so->where("status", 0); $so->where("deleted", 0); $data["results"][] = array("totalSO" => $so->count()); //Invoice $inv = new Bill(null, $this->entity); if (!empty($filters) && isset($filters)) { $inv->where($filters[0]["field"], $filters[0]["value"]); } $inv->where_in("type", array("Invoice")); $inv->where_in("status", array(0, 2)); $inv->where("deleted", 0); $inv->get(); $data["results"][] = array("totalOpenInvoice" => $inv->result_count()); //Product $p = new Product(null, $this->entity); $p->where("status", 1); $p->where("on_hand <=", "order_point"); $p->where("deleted", 0); $p->get(); $data["results"][] = array("totalMinProduct" => $p->result_count()); $this->response($data, 200); }