invoice.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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 invoice extends DooModel {
  11. /**
  12. *
  13. * @var integer $iid 发票ID
  14. */
  15. public $iid;
  16. /**
  17. *
  18. * @var integer $status 审批状态
  19. */
  20. public $status;
  21. /**
  22. *
  23. * @var string $invoiceManage 当前审批组人员
  24. */
  25. public $invoiceManage;
  26. /**
  27. *
  28. * @var string $pendingApprovals 当前需要审批的人
  29. */
  30. public $pendingApprovals;
  31. /**
  32. *
  33. * @var string $processApprovals 已经审批过的人员
  34. */
  35. public $processApprovals;
  36. /**
  37. *
  38. * @var string $invoiceSerial 发票单号
  39. */
  40. public $invoiceSerial;
  41. /**
  42. *
  43. * @var integer $invoicePrice 发票金额
  44. */
  45. public $invoicePrice;
  46. /**
  47. * 管理组人员:
  48. * @var unknown
  49. */
  50. public $moldManage;
  51. /**
  52. *
  53. * @var integer $cid 办事处ID
  54. */
  55. public $cid;
  56. /**
  57. *
  58. * @var string $categoryName 办事处名称
  59. */
  60. public $categoryName;
  61. /**
  62. *
  63. * @var integer $sid 提交发票人ID
  64. */
  65. public $sid;
  66. /**
  67. *
  68. * @var string $userName 提交人名字
  69. */
  70. public $userName;
  71. /**
  72. *
  73. * @var string $remark 备注
  74. */
  75. public $remark;
  76. /**
  77. *
  78. * @var string $invoiceElement 发票内容
  79. */
  80. public $invoiceElement;
  81. /**
  82. *
  83. * @var string $invoiceType 发票类型
  84. */
  85. public $invoiceType;
  86. /**
  87. *
  88. * @var string $invoiceTitle 发票抬头
  89. */
  90. public $invoiceTitle;
  91. /**
  92. *
  93. * @var string $invoiceCompany 开票公司
  94. */
  95. public $invoiceCompany;
  96. /**
  97. *
  98. * @var string $invoiceNo 发票号
  99. */
  100. public $invoiceNo;
  101. /**
  102. *
  103. * @var string $TIN 纳税人识别码
  104. */
  105. public $TIN;
  106. /**
  107. *
  108. * @var string $address 注册地址
  109. */
  110. public $address;
  111. /**
  112. *
  113. * @var string $phone 电话
  114. */
  115. public $phone;
  116. /**
  117. *
  118. * @var string $bank 开户银行
  119. */
  120. public $bank;
  121. /**
  122. *
  123. * @var string $bankAccount 银行账户
  124. */
  125. public $bankAccount;
  126. /**
  127. *
  128. * @var integer $doPost 邮寄
  129. */
  130. public $doPost;
  131. /**
  132. *
  133. * @var string $recipients 收件人
  134. */
  135. public $recipients;
  136. /**
  137. *
  138. * @var string $recipientsPhone 收件人电话
  139. */
  140. public $recipientsPhone;
  141. /**
  142. *
  143. * @var string $recipientsAddress 收件地址
  144. */
  145. public $recipientsAddress;
  146. /**
  147. *
  148. * @var string $mailItems 邮寄物品
  149. */
  150. public $mailItems;
  151. /**
  152. *
  153. * @var date $date 提交时间
  154. */
  155. public $date;
  156. /**
  157. *
  158. * @var date $updateTime 更新时间
  159. */
  160. public $updateTime;
  161. /**
  162. *
  163. * @var date $printTime 打印时间
  164. */
  165. public $printTime;
  166. public $_table = 'CLD_invoice';
  167. public $_primarykey = 'iid';
  168. public $_fields = array (
  169. 'iid',
  170. 'invoiceManage',
  171. 'pendingApprovals',
  172. 'processApprovals',
  173. 'invoiceSerial',
  174. 'status',
  175. 'invoicePrice',
  176. 'moldManage',
  177. 'cid',
  178. 'categoryName',
  179. 'remark',
  180. 'invoiceElement',
  181. 'invoiceType',
  182. 'invoiceTitle',
  183. 'invoiceCompany',
  184. 'invoiceNo',
  185. 'TIN',
  186. 'address',
  187. 'phone',
  188. 'bank',
  189. 'bankAccount',
  190. 'doPost',
  191. 'recipients',
  192. 'recipientsPhone',
  193. 'recipientsAddress',
  194. 'mailItems',
  195. 'sid',
  196. 'userName',
  197. 'date',
  198. 'updateTime' ,
  199. 'printTime'
  200. );
  201. public function getInvoiceByIid($iid = 0) {
  202. }
  203. /**
  204. * 获取单个可以打印的发票数据
  205. * @param number $iid 发票id
  206. */
  207. public function getInvoiceByPrint($iid = 0) {
  208. $detail = array ();
  209. if (! empty ( $iid ) && is_numeric ( $iid ))
  210. $detail = $this->getOne ( array (
  211. 'where' => "iid= '" . $iid . "' and status=2",
  212. 'asArray' => TRUE
  213. ) );
  214. return $detail;
  215. }
  216. /**
  217. * 记录发票号并完成打印
  218. * @param array $item 发票号和完成打印状态数据
  219. * @return number 返回发票ID
  220. */
  221. public function setPrintByInvoice($item = array()) {
  222. $lid = 0;
  223. if (is_array ( $item ) && ! empty ( $item )) {
  224. foreach ( $item as $key => $value ) {
  225. $this->$key = $value;
  226. }
  227. $lid = $this->update ();
  228. }
  229. return $lid;
  230. }
  231. /**
  232. * 获取待处理发票的数据 其中包括退回`终止
  233. * @return unknown
  234. */
  235. public function getPendingByInvoice() {
  236. $list = $this->find ( array (
  237. 'where' => "status=3 or status=4",
  238. 'asArray' => TRUE
  239. ) );
  240. return $list;
  241. }
  242. /**
  243. * 获取需要邮寄的发票
  244. * @return array
  245. */
  246. public function getPostByInvoice(){
  247. $list = $this->find ( array (
  248. 'where' => "status=5 and doPost=1",
  249. 'asArray' => TRUE
  250. ) );
  251. return $list;
  252. }
  253. }
  254. ?>