invoiceTraining.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 invoiceTraining extends DooModel {
  11. public $itid;
  12. public $status;
  13. public $trainName;
  14. public $cid;
  15. public $categoryName;
  16. public $creator;
  17. public $trainDate;
  18. public $invoiceTotal;
  19. public $invoiceTotalAmount;
  20. public $invoiceArriveAmount;
  21. public $arriveSchedule;
  22. public $creatorDate;
  23. public $_table = 'CLD_invoiceTraining';
  24. public $_primarykey = 'itid';
  25. public $_fields = array (
  26. 'itid',
  27. 'status',
  28. 'trainName',
  29. 'cid',
  30. 'categoryName',
  31. 'creator',
  32. 'trainDate',
  33. 'invoiceTotal',
  34. 'invoiceTotalAmount',
  35. 'invoiceArriveAmount',
  36. 'arriveSchedule',
  37. 'creatorDate'
  38. );
  39. /**
  40. * 添加一个培训班
  41. * @param array $item 培训班相关数据
  42. * @return number 返回培训班ID
  43. */
  44. public function addInvoiceTraining($item = array()) {
  45. $itid = 0;
  46. if (is_array ( $item ) && ! empty ( $item )) {
  47. foreach ( $item as $key => $value ) {
  48. $this->$key = $value;
  49. }
  50. $itid = $this->insert ();
  51. }
  52. return $itid;
  53. }
  54. function getInvoiceTrainingByTodo($select = ""){
  55. Doo::loadModel ( 'staff' );
  56. $staff = new staff ();
  57. Doo::loadModel ( 'L_category' );
  58. $lCategory = new L_category ();
  59. $condition = array (
  60. 'where' => "status= 0 or status=1 ",
  61. 'limit'=>8,
  62. 'asArray' => TRUE
  63. );
  64. if (! empty ( $select ))
  65. $condition += array (
  66. 'select' => $select
  67. );
  68. $list=$this->find (
  69. $condition
  70. );
  71. foreach ($list as $key=>$value){
  72. $detail=$staff->getStaffBySid($value['creator']);
  73. $list[$key]['staff']=$detail;
  74. $detail=$lCategory->getCategoryById($value['cid']);
  75. $list[$key]['category']=$detail;
  76. }
  77. return $list;
  78. }
  79. /**
  80. * 根据状态获取培训班
  81. * @param number $status
  82. */
  83. function getInvoiceTrainingByStatus($status = 0, $select = "") {
  84. Doo::loadModel ( 'staff' );
  85. $staff = new staff ();
  86. Doo::loadModel ( 'L_category' );
  87. $lCategory = new L_category ();
  88. $condition = array (
  89. 'where' => "status= '" . $status . "' ",
  90. 'limit'=>8,
  91. 'asArray' => TRUE
  92. );
  93. if (! empty ( $select ))
  94. $condition += array (
  95. 'select' => $select
  96. );
  97. $list=$this->find (
  98. $condition
  99. );
  100. foreach ($list as $key=>$value){
  101. $detail=$staff->getStaffBySid($value['creator']);
  102. $list[$key]['staff']=$detail;
  103. $detail=$lCategory->getCategoryById($value['cid']);
  104. $list[$key]['category']=$detail;
  105. }
  106. return $list;
  107. }
  108. }
  109. ?>