invoiceTraining.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. /**
  55. * 根据状态获取培训班
  56. * @param number $status
  57. */
  58. function getInvoiceTrainingByStatus($status = 0, $select = "") {
  59. Doo::loadModel ( 'staff' );
  60. $staff = new staff ();
  61. Doo::loadModel ( 'L_category' );
  62. $lCategory = new L_category ();
  63. $condition = array (
  64. 'where' => "status= '" . $status . "' ",
  65. 'limit'=>8,
  66. 'asArray' => TRUE
  67. );
  68. if (! empty ( $select ))
  69. $condition += array (
  70. 'select' => $select
  71. );
  72. $list=$this->find (
  73. $condition
  74. );
  75. foreach ($list as $key=>$value){
  76. $detail=$staff->getStaffBySid($value['creator']);
  77. $list[$key]['staff']=$detail;
  78. $detail=$lCategory->getCategoryById($value['cid']);
  79. $list[$key]['category']=$detail;
  80. }
  81. return $list;
  82. }
  83. }
  84. ?>