| | |
| | | $customerId = $params["customerId"]; |
| | | $receivingType = $params["receivingType"]; |
| | | $goodsId = $params["goodsId"]; |
| | | $userId = $params["userId"]; |
| | | |
| | | $queryParams = array(); |
| | | |
| | |
| | | if ($goodsId) { |
| | | $sql .= " and (s.id in (select distinct sobill_id from t_so_bill_detail where goods_id = '%s'))"; |
| | | $queryParams[] = $goodsId; |
| | | } |
| | | if ($userId) { |
| | | $sql .= " and (s.input_user_id = '%s') "; |
| | | $queryParams[] = $userId; |
| | | } |
| | | $sql .= " order by s.deal_date desc, s.ref desc |
| | | limit %d , %d"; |
| | |
| | | if ($goodsId) { |
| | | $sql .= " and (s.id in (select distinct sobill_id from t_so_bill_detail where goods_id = '%s'))"; |
| | | $queryParams[] = $goodsId; |
| | | } |
| | | if ($userId) { |
| | | $sql .= " and (s.input_user_id = '%s') "; |
| | | $queryParams[] = $userId; |
| | | } |
| | | $data = $db->query($sql, $queryParams); |
| | | $cnt = $data[0]["cnt"]; |
| | |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | /** |
| | | * 根据销售订单单号查询其生成的采购订单 |
| | | * 用于:在销售订单生成采购订单之前,提醒用户 |
| | | */ |
| | | public function getPOBillRefListBySOBillRef($params) |
| | | { |
| | | $db = $this->db; |
| | | |
| | | $soRef = $params["soRef"]; |
| | | |
| | | $sql = "select p.ref |
| | | from t_so_bill s, t_so_po sp, t_po_bill p |
| | | where s.ref = '%s' and s.id = sp.so_id and sp.po_id = p.id |
| | | order by p.ref"; |
| | | $data = $db->query($sql, $soRef); |
| | | |
| | | return $data; |
| | | } |
| | | } |