receiptDetail.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. Doo::loadCore('db/DooModel');
  3. class receiptDetail extends DooModel {
  4. public $rdid;
  5. public $item;
  6. public $staff;
  7. public $itemCategory;
  8. public $price;
  9. public $date;
  10. public $pastDate;
  11. public $cid;
  12. public $rid;
  13. public $status;
  14. public $_table = 'CLD_receiptDetail';
  15. public $_primarykey = 'rdid';
  16. public $_fields = array('rdid', 'item', 'staff', 'itemCategory', 'price', 'date','pastDate', 'cid', 'rid', 'status');
  17. /**
  18. * 按人员年月合计报销单项目金额
  19. * @param string $sid
  20. * @param string $year
  21. * @param string $month
  22. * @return unknown
  23. */
  24. function getReceiptTotalItem($sid='',$year='',$month=''){
  25. if(empty($sid))
  26. return array();
  27. $list=$this->find ( array (
  28. 'select' => 'staff,item,sum(price) as price,itemCategory,Month(date) as month',
  29. 'where' => 'staff=' . $sid . " and status=1 and Year(date)=" . $year . ' and Month(date)=' . $month,
  30. 'groupby' => 'item,Month(date),itemCategory',
  31. 'asArray' => true
  32. ) );
  33. return $list;
  34. }
  35. /**
  36. * 按人员年月合计报销单大项金额
  37. * @param string $sid
  38. * @param string $year
  39. * @param string $month
  40. * @return unknown
  41. */
  42. function getReceiptTotalItemCategory($sid='',$year='',$month=''){
  43. if(empty($sid))
  44. return array();
  45. $list=$this->find ( array (
  46. 'select' => 'staff,sum(price) as price,itemCategory,Month(date) as month',
  47. 'where' => 'staff=' . $sid . " and status=1 and Year(date)=" . $year . ' and Month(date)=' . $month,
  48. 'groupby' => 'Month(date),itemCategory',
  49. 'asArray' => true
  50. ) );
  51. return $list;
  52. }
  53. /**
  54. * 根据RID 项目详情获得信息
  55. * @param string $rid
  56. * @param string $item
  57. * @param string $itemCategory
  58. * @return unknown
  59. */
  60. function getReceiptDetailByRIC($rid='',$item='',$itemCategory=''){
  61. if (!is_numeric($rid)||empty($item)||empty($itemCategory)){
  62. return array();
  63. }
  64. $rinfo = $this->getOne ( array (
  65. 'where' => 'rid=' . $rid.' and item like "'.$item.'" and itemCategory like "'.$itemCategory.'"',
  66. 'asArray' => true
  67. ) );
  68. return $rinfo;
  69. }
  70. }
  71. ?>