123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- Doo::loadCore('db/DooModel');
- class receiptDetail extends DooModel {
- public $rdid;
- public $item;
- public $staff;
-
- public $itemCategory;
- public $price;
-
- public $date;
- public $pastDate;
- public $cid;
-
- public $rid;
- public $status;
-
- public $_table = 'CLD_receiptDetail';
- public $_primarykey = 'rdid';
-
- public $_fields = array('rdid', 'item', 'staff', 'itemCategory', 'price', 'date','pastDate', 'cid', 'rid', 'status');
- function getReceiptDetailByYear($cidIn,$year){
- if(empty($cidIn)||(!is_numeric($year))){
- return array();
- }
-
- $list=$this->find ( array (
- 'select' => 'item,sum(price) as price,itemCategory,item,Month(pastDate) as month,cid',
- 'where' => " status=1 and Year(pastDate)=" . $year ." and cid in (".$cidIn.")" ,
- 'groupby' => 'item,Month(pastDate),item',
- 'asArray' => true
- ) );
- return $list;
-
- }
-
- /**
- * 按人员年月合计报销单项目金额
- * @param string $sid
- * @param string $year
- * @param string $month
- * @return unknown
- */
- function getReceiptTotalItem($sid='',$year='',$month=''){
- if(empty($sid))
- return array();
- $list=$this->find ( array (
- 'select' => 'staff,item,sum(price) as price,itemCategory,Month(pastDate) as month',
- 'where' => 'staff=' . $sid . " and status=1 and Year(pastDate)=" . $year . ' and Month(pastDate)=' . $month,
- 'groupby' => 'item,Month(pastDate),itemCategory',
- 'asArray' => true
- ) );
- return $list;
- }
-
- /**
- * 按人员年月合计报销单大项金额
- * @param string $sid
- * @param string $year
- * @param string $month
- * @return unknown
- */
- function getReceiptTotalItemCategory($sid='',$year='',$month=''){
- if(empty($sid))
- return array();
- $list=$this->find ( array (
- 'select' => 'staff,sum(price) as price,itemCategory,Month(pastDate) as month',
- 'where' => 'staff=' . $sid . " and status=1 and Year(pastDate)=" . $year . ' and Month(pastDate)=' . $month,
- 'groupby' => 'Month(pastDate),itemCategory',
- 'asArray' => true
- ) );
- return $list;
- }
-
- /**
- * 根据RID 项目详情获得信息
- * @param string $rid
- * @param string $item
- * @param string $itemCategory
- * @return unknown
- */
- function getReceiptDetailByRIC($rid='',$item='',$itemCategory=''){
- if (!is_numeric($rid)||empty($item)||empty($itemCategory)){
- return array();
- }
-
- $rinfo = $this->getOne ( array (
- 'where' => 'rid=' . $rid.' and item like "'.$item.'" and itemCategory like "'.$itemCategory.'"',
- 'asArray' => true
- ) );
-
- return $rinfo;
- }
-
- }
- ?>
|