RILecturer.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. Doo::loadCore ( 'db/DooModel' );
  3. class RILecturer extends DooModel {
  4. public $rlid;
  5. public $rid;
  6. public $ltype;
  7. public $lecturerName;
  8. public $schoolDay;
  9. public $taxation;
  10. public $price;
  11. public $fees;
  12. public $_table = 'CLD_RILecturer';
  13. public $_primarykey = 'rlid';
  14. public $_fields = array (
  15. 'rlid',
  16. 'rid',
  17. 'ltype',
  18. 'lecturerName',
  19. 'schoolDay',
  20. 'taxation',
  21. 'price',
  22. 'fees',
  23. );
  24. function getRILecturerByRlid($rlid){
  25. $detail=$this->getOne(array (
  26. 'where' => "rlid=".$rlid,
  27. 'asArray' => TRUE
  28. ));
  29. return $detail;
  30. }
  31. /**
  32. * 根据rid获得教师详情
  33. * @param number $rid
  34. */
  35. function getRILecturerByRid($rid=0){
  36. $sql = 'select (@rowNO := @rowNo+1) AS i, a.* from ' . $this->_table . ' a, (select @rowNO :=0) b where rid='.$rid;
  37. $query = Doo::db ()->query ( $sql );
  38. $list = $query->fetchAll ();
  39. Doo::loadClass ( 'XDeode' );
  40. $XDeode = new XDeode ( 5 );
  41. foreach ($list as $key=>$value){
  42. $list[$key]['rlidKey']=$XDeode->encode ( $value ['rlid'] );
  43. $list[$key]['sum']=$value['schoolDay']*$value['price'];
  44. }
  45. return $list;
  46. }
  47. /**
  48. * 获得教师支出的金额
  49. * @param string $rids
  50. * @return int
  51. */
  52. function getRILecturerPriceByRids($rids=''){
  53. if (empty($rids)){
  54. return 0;
  55. }
  56. $list = $this->find ( array (
  57. 'where' => " rid in (" .$rids.")",
  58. 'asArray' => TRUE
  59. ) );
  60. $bValue=0;
  61. foreach ($list as $key=>$value){
  62. if($value['fees']=='0.00'){
  63. $bValue+=($value['price']*$value['schoolDay']);
  64. }else{
  65. $bValue+=$value['fees'];
  66. }
  67. }
  68. return $bValue;
  69. }
  70. }
  71. ?>