"iid=" . $iid, 'asArray' => TRUE ); if (! empty ( $select )) $condition += array ( 'select' => $select ); $Detail = array (); if (is_numeric ( $iid ) && ! empty ( $iid )) $Detail = $this->getOne ( $condition ); return $Detail; } /** * 获取单个可以打印的发票数据 * @param number $iid 发票id * @param number $select 需要获取的字段,为空获取全部数据 * @return array|array() 返回发票数据 */ public function getInvoiceByPrint($iid = 0, $select = "") { $condition = array ( 'where' => "iid= '" . $iid . "' and status=2", 'asArray' => TRUE ); if (! empty ( $select )) $condition += array ( 'select' => $select ); $detail = array (); if (! empty ( $iid ) && is_numeric ( $iid )) $detail = $this->getOne ( $condition ); return $detail; } /** * 添加一个发票并进入审批状态 * @param array $item 发票相关数据 * @return number 返回发票ID */ public function addInvoice($item = array()) { $lid = 0; if (is_array ( $item ) && ! empty ( $item )) { foreach ( $item as $key => $value ) { $this->$key = $value; } $lid = $this->insert (); } return $lid; } /** * 记录发票号并完成打印 * @param array $item 发票号和完成打印状态数据 * @return number 返回发票ID */ public function setPrintByInvoice($item = array()) { $lid = 0; if (is_array ( $item ) && ! empty ( $item )) { foreach ( $item as $key => $value ) { $this->$key = $value; } $lid = $this->update (); } return $lid; } /** * 根据管理组和发票当前状态获得打印发票数据;其中当iid为空时获取所有发票数据,反之获取1条数据 * @param number $sid 管理组人员ID * @param number $status 状态 为0时获取可以打印数据,为1时获取已经完成打印数据 * @param number $iid 发票ID * @return array|array() 返回所有发票数据,当iid有值时返回一条数据 */ public function getPrintInvoiceByManage($sid = 0, $status = 0, $iid = 0) { $list = array (); if (! empty ( $sid ) && empty ( $iid )) $list = $this->find ( array ( 'where' => "status=2 and printStatus=" . $status . " and moldManage like '%[\"" . $sid . "\",%'", 'desc' => 'iid', 'asArray' => TRUE ) ); elseif (! empty ( $sid ) && ! empty ( $iid )) $list = $this->getOne ( array ( 'where' => "status=2 and printStatus=" . $status . " and moldManage like '%[\"" . $sid . "\",%' and iid=" . $iid, 'asArray' => TRUE ) ); return $list; } /** * 待修改 获取待处理发票的数据 其中包括退回`终止 * @return unknown */ public function getPendingByInvoice() { $list = $this->find ( array ( 'where' => "status=3 or status=4", 'asArray' => TRUE ) ); return $list; } /** * 获取需要邮寄的发票 * @return array */ public function getPostByInvoice() { $list = $this->find ( array ( 'where' => "postStatus=0 and doPost=1 and status=2", 'asArray' => TRUE ) ); return $list; } /** * 获取已经邮寄过的发票 * @return array */ public function getPostedByInvoice() { $list = $this->find ( array ( 'where' => "postStatus=1 and doPost=1 and status=2", 'asArray' => TRUE ) ); return $list; } } ?>