invoiceStatistics.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. Doo::loadCore ( 'db/DooModel' );
  3. class invoiceStatistics extends DooModel {
  4. public $sid;
  5. public $priceClass;
  6. public $date;
  7. public $cid;
  8. public $staff;
  9. public $invoicePrice;
  10. public $accountPrice;
  11. public $receivablesPrice;
  12. public $irid;
  13. public $_table = 'CLD_invoiceStatistics';
  14. public $_primarykey = 'sid';
  15. public $_fields = array (
  16. 'sid',
  17. 'staff',
  18. 'priceClass',
  19. 'invoicePrice',
  20. 'receivablesPrice',
  21. 'accountPrice',
  22. 'date',
  23. 'cid',
  24. 'irid'
  25. );
  26. /**
  27. * 根据参数字段更新相应字段(主键ID必须传)
  28. * @param array $item 相关需要更新的字段信息
  29. * @return number 返回发票ID
  30. */
  31. public function setInvoiceStatisticsByCondition($item = array()) {
  32. $lid = 0;
  33. if (is_array ( $item ) && ! empty ( $item )) {
  34. foreach ( $item as $key => $value ) {
  35. $this->$key = $value;
  36. }
  37. $lid = $this->insert ();
  38. }
  39. return $lid;
  40. }
  41. /**
  42. * 根据参数字段更新相应字段(主键ID必须传)
  43. * @param array $item 相关需要更新的字段信息
  44. * @return number 返回发票ID
  45. */
  46. public function updateInvoiceStatisticsByIrid($item = array(), $irid = 0) {
  47. if (is_numeric ( $irid ) && is_array ( $item ) && ! empty ( $item )) {
  48. foreach ( $item as $key => $value ) {
  49. $this->$key = $value;
  50. }
  51. $lid = $this->update ( array (
  52. 'where' => 'irid=' . $irid
  53. ) );
  54. }
  55. return $lid;
  56. }
  57. function getClientByCid($cid) {
  58. $sql = "select sum(price) from " . $this->_table . " where staff= '" . $cid . "' and ";
  59. $query = Doo::db ()->query ( $sql );
  60. $result = $query->fetch ();
  61. return $result;
  62. }
  63. /*
  64. * public function getProjectByIdList($projectid){ return $this->find ( array ('where' => "pid= '".$projectid."'", 'asArray' => TRUE ) ); }
  65. */
  66. }
  67. ?>