invoiceManage.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. Doo::loadCore ( 'db/DooModel' );
  3. /**
  4. * 发票相关管理相关信息及其操作业务逻辑
  5. * @author CP.
  6. * @version 1.0
  7. * @namespace invoice
  8. * @package invoiceModel
  9. */
  10. class invoiceManage extends DooModel {
  11. /**
  12. *
  13. * @var integer $iid 管理组ID
  14. */
  15. public $iid;
  16. /**
  17. *
  18. * @var string $staff 管理组人员
  19. */
  20. public $staff;
  21. /**
  22. *
  23. * @var string $mold 管理组名称
  24. */
  25. public $mold;
  26. public $_table = 'CLD_invoiceManage';
  27. public $_primarykey = 'iid';
  28. public $_fields = array (
  29. 'iid',
  30. 'staff',
  31. 'mold'
  32. );
  33. /**
  34. * 根据管理组获取审批组成员
  35. * @return array|array() 该管理组相关数据,人员数据数组化
  36. */
  37. public function getInvoiceByMold($mold = "") {
  38. $detail = array ();
  39. if (! empty ( $mold )) {
  40. $detail = $this->getOne ( array (
  41. 'where' => 'mold="' . $mold . '"',
  42. 'asArray' => TRUE
  43. ) );
  44. if(empty($detail ['staff']))
  45. $detail ['staffList'] = array();
  46. else
  47. $detail ['staffList'] = json_decode ( $detail ['staff'], true );
  48. }
  49. return $detail;
  50. }
  51. public function getInvoiceByStaff($sid = 0) {
  52. $lsit=array();
  53. if (! empty ( $sid ))
  54. $lsit = $this->find ( array (
  55. 'select'=>'mold',
  56. 'where' => 'staff like "%[\"' . $sid . '\",%"',
  57. 'asArray' => TRUE
  58. ) );
  59. return $lsit;
  60. }
  61. /**
  62. * 获取所有管理组数据
  63. * @return array|array() 该管理组相关数据,人员数据数组化
  64. */
  65. public function getInvoiceByAll() {
  66. $lsit = $this->find ( array (
  67. 'asArray' => TRUE
  68. ) );
  69. foreach ( $lsit as $key => $value ) {
  70. $lsit [$key] ['staffList'] = json_decode ( $value ['staff'], true );
  71. }
  72. return $lsit;
  73. }
  74. }
  75. // ?>