invoiceInfoBase.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. Doo::loadCore ( 'db/DooModel' );
  3. class invoiceInfoBase extends DooModel {
  4. public $iibID;
  5. public $invoiceTitle;
  6. public $TIN;
  7. public $address;
  8. public $phone;
  9. public $bank;
  10. public $bankAccount;
  11. public $updateDate;
  12. public $_table = 'CLD_invoiceInfoBase';
  13. public $_primarykey = 'iibID';
  14. public $_fields = array (
  15. 'iibID',
  16. 'invoiceTitle',
  17. 'TIN',
  18. 'address',
  19. 'phone',
  20. 'bank',
  21. 'bankAccount',
  22. 'updateDate'
  23. );
  24. /**
  25. *
  26. */
  27. function getIFBByTitle($fill=''){
  28. if(empty($fill)){
  29. return array();
  30. }
  31. return $this->find ( array ('where' => "invoiceTitle like '%".$fill."%'", 'asArray' => TRUE ) );
  32. }
  33. function getIFBByTIN($fill=''){
  34. if(empty($fill)){
  35. return array();
  36. }
  37. return $this->find ( array ('where' => "TIN like '%".$fill."%'", 'asArray' => TRUE ) );
  38. }
  39. /**
  40. * 根据纳税人识别码和抬头获得发票
  41. * @param string $TIN
  42. * @return unknown
  43. */
  44. function getInvoiceInfoByTT($TIN='',$invoiceTitle=''){
  45. if(empty($TIN)){
  46. return array();
  47. }
  48. $list = $this->find ( array (
  49. 'where' => "(TIN= '" . $TIN."' and invoiceTitle='".$invoiceTitle."' ) or TIN= '" . $TIN."' or invoiceTitle='".$invoiceTitle."'",
  50. 'asArray' => TRUE
  51. ) );
  52. return $list;
  53. }
  54. /**
  55. * 添加一个发票并进入审批状态
  56. * @param array $item 发票相关数据
  57. * @return number 返回发票ID
  58. */
  59. public function addInvoiceInfoBase($item = array()) {
  60. $lid = 0;
  61. if (is_array ( $item ) && ! empty ( $item )) {
  62. foreach ( $item as $key => $value ) {
  63. $this->$key = $value;
  64. }
  65. $lid = $this->insert ();
  66. }
  67. return $lid;
  68. }
  69. /**
  70. * 根据参数字段更新相应字段(主键ID必须传)
  71. * @param array $item 相关需要更新的字段信息
  72. * @return number 返回发票ID
  73. */
  74. public function setInvoiceInfoBaseByCondition($item = array()) {
  75. $lid = 0;
  76. if (is_array ( $item ) && ! empty ( $item )) {
  77. foreach ( $item as $key => $value ) {
  78. $this->$key = $value;
  79. }
  80. $lid = $this->update ();
  81. }
  82. return $lid;
  83. }
  84. public function delInvoiceInfoBaseByIibStr($iibIDStr=''){
  85. if (empty($iibIDStr)){
  86. return '';
  87. }
  88. $sql='delete from '.$this->_table.' where iibID in('.$iibIDStr.')';
  89. $query = Doo::db ()->query ( $sql );
  90. }
  91. }
  92. ?>