我想代替庫存提醒產(chǎn)品,顯示到期日期提醒產(chǎn)品。<?php foreach ($stock as $item) { echo '<li class="list-group-item"><span class="badge badge-danger float-xs-right">' . +$item['qty'] . ' ' . $item['unit'] . '</span> <a href="' . base_url() . 'products/edit?id=' . $item['pid'] . '">' . $item['product_name'] . ' </a><small class="purple"> <i class="ft-map-pin"></i> ' . $item['title'] . '</small> </li>'; } ?>和 public function stock(){ $whr = ''; if ($this->aauth->get_user()->loc) { $whr = ' AND (lmpos_warehouse.loc=' . $this->aauth->get_user()->loc . ')'; } elseif (!BDATA) { $whr = ' AND (lmpos_warehouse.loc=0)'; } $query = $this->db->query("SELECT lmpos_products.*,lmpos_warehouse.title FROM lmpos_products LEFT JOIN lmpos_warehouse ON lmpos_products.warehouse=lmpos_warehouse.id WHERE (lmpos_products.qty<=lmpos_products.alert) $whr ORDER BY lmpos_products.product_name ASC LIMIT 10"); return $query->result_array();}注意:在數(shù)據(jù)庫中的產(chǎn)品表中,每個產(chǎn)品都有一個有效期您可以在這張照片中看到當(dāng)前結(jié)果
1 回答

慕萊塢森
TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個贊
例如,您有一個名為 的到期日期的數(shù)據(jù)庫表列exp,只需將徽章代碼從更改+$item['qty'] . ' ' . $item['unit']為date("F jS, Y", strtotime($item['exp']):
foreach ($stock as $item) {
echo '<li class="list-group-item"><span class="badge badge-danger float-xs-right">' . date("F jS, Y", strtotime($item['exp']) . '</span> <a href="' . base_url() . 'products/edit?id=' . $item['pid'] . '">' . $item['product_name'] . ' </a><small class="purple"> <i class="ft-map-pin"></i> ' . $item['title'] . '</small>
</li>';
}
這將以人類可讀的格式顯示到期日期
- 1 回答
- 0 關(guān)注
- 127 瀏覽
添加回答
舉報
0/150
提交
取消