RIExtend.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. Doo::loadCore ( 'db/DooModel' );
  3. class RIExtend extends DooModel {
  4. public $riid;
  5. public $rid;
  6. public $iid;
  7. public $RIstatus;
  8. public $_table = 'CLD_RIExtend';
  9. public $_primarykey = 'riid';
  10. public $_fields = array (
  11. 'riid',
  12. 'rid',
  13. 'iid',
  14. 'RIstatus',
  15. );
  16. /**
  17. *
  18. */
  19. function getRIExtendByRid($rid=0){
  20. $sql = 'select a.iid,b.irid
  21. from ' . $this->_table . ' as a left join CLD_invoice as b on (a.iid=b.iid)
  22. where b.status=2 and b.printStatus=1 and b.untreadStatus=3 and b.irid!="" and a.RIstatus=1 and a.rid= '.$rid;
  23. $query = Doo::db ()->query ( $sql );
  24. $list = $query->fetchAll ();
  25. return $list;
  26. }
  27. /**
  28. */
  29. function getAccountBookByLimit($limit = 3) {
  30. $sql = 'select *
  31. from ' . $this->_table . '
  32. ORDER BY aid desc limit ' . $limit;
  33. $query = Doo::db ()->query ( $sql );
  34. $list = $query->fetchAll ();
  35. Doo::loadClass ( 'XDeode' );
  36. $XDeode = new XDeode ( 5 );
  37. foreach ( $list as $key => $value ) {
  38. $list [$key] ['aidKey'] = $XDeode->encode ( $value ['aid'] );
  39. }
  40. return $list;
  41. }
  42. /**
  43. *
  44. * @param number $limit
  45. * @param string $con
  46. * @param string $desc
  47. * @return boolean
  48. */
  49. function getAccountBookBySql($limit = 0, $con = "", $desc = 'desc') {
  50. // $listCount = $this->count ( array (
  51. // 'where' => $con,
  52. // 'asArray' => TRUE
  53. // ) );
  54. $list = $this->find ( array (
  55. 'where' => '1 ' . $con,
  56. 'limit' => $limit,
  57. $desc => 'aid',
  58. 'asArray' => TRUE
  59. ) ); // echo $con;
  60. Doo::loadClass ( 'XDeode' );
  61. $XDeode = new XDeode ( 5 );
  62. foreach ( $list as $key => $value ) {
  63. // $list [$key] ['count'] = $listCount;
  64. $list [$key] ['aidKey'] = $XDeode->encode ( $value ['aid'] );
  65. }
  66. return $list;
  67. }
  68. }
  69. ?>