receipt.func.php 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550
  1. <?php
  2. /**
  3. * 获得借款单详情
  4. */
  5. function _getReceiptLoanHtml($receiptDetail,$verifylist,$extendHtml='') {
  6. $receiptDetail ['loanItem'] = json_decode ( $receiptDetail ['loanItem'], true );
  7. $receiptDetail ['sumCN'] = num_to_rmb ( $receiptDetail ['sum'] );
  8. $receiptDetail ['loanSumCN'] = num_to_rmb ( $receiptDetail ['loanSum'] );
  9. $receiptDetail ['amountCN'] = num_to_rmb ( $receiptDetail ['amount'] );
  10. $executeCopy=getExecuteStaff($receiptDetail);
  11. //print_r ( $executeCopy );
  12. $html = '<div class="saeaList">
  13. <div class="entry loan-list" style="margin-bottom: 50px">
  14. <div class="seal"></div>
  15. <div class="seTable">
  16. <table class="table table-bordered table-condensed table-hover">
  17. <tbody>
  18. <tr>
  19. <th colspan="2" class="taC">借款费用</th>
  20. </tr>
  21. <tr>
  22. <th>借款费用</th>
  23. <td class="taR" width="140">¥' . $receiptDetail ['loanItem'] ['借款费用'] [0] ['price'] . '</td>
  24. </tr>
  25. <tr>
  26. <th class="taC" colspan="2">产生费用所在办事处</th>
  27. </tr>
  28. <tr>
  29. <th style="text-align: center" colspan="2">' . $receiptDetail ['category'] [0] ['title'] . '</th>
  30. </tr>
  31. <tr>
  32. <th colspan="2" class="taC">汇款信息</th>
  33. </tr>
  34. <tr>
  35. <th>汇款人户名</th>
  36. <td>' . $receiptDetail ['remittanceName'] . '</td>
  37. </tr>
  38. <tr>
  39. <th>汇款银行</th>';
  40. if ($receiptDetail ['remittanceBankType'] == 0)
  41. $html .= '<td>广发银行</td>';
  42. elseif ($receiptDetail ['remittanceBankType'] == 1)
  43. $html .= '<td>其他</td>';
  44. $html .= '</tr>
  45. <tr>
  46. <th>汇款开户银行名称</th>
  47. <td>' . $receiptDetail ['bankName'] . '</td>
  48. </tr>
  49. <tr>
  50. <th>汇款帐号</th>
  51. <td>' . $receiptDetail ['bankNumber'] . '</td>
  52. </tr>';
  53. if ($receiptDetail ['remittanceBankType'] == 1)
  54. $html .= '<tr>
  55. <th>联行号</th>
  56. <td>' . $receiptDetail ['coupletNumber'] . '</td>
  57. </tr>';
  58. $html .= '<tr>
  59. <th class="taC" colspan="2">费用说明</th>
  60. </tr>
  61. <tr>
  62. <td colspan="2">' . $receiptDetail ['explanation'] . '</td>
  63. </tr>
  64. <tr class="warning">
  65. <td class="taR"><b>(' . $receiptDetail ['receiptOrder'] . ')本次费用合计</b></td>
  66. <td class="taR"><b style="font-size: 24px">¥' . $receiptDetail ['sum'] . '</b><br>' . $receiptDetail ['sumCN'] . '</td>
  67. </tr>
  68. <tr class="warning">
  69. <td class="taR"><b>汇款金额</b></td>
  70. <td class="taR" width="140"><b style="font-size: 24px">¥' . $receiptDetail ['amount'] . '</b><br>' . $receiptDetail ['amountCN'] . '</td>
  71. </tr>
  72. </tbody>
  73. </table>
  74. </div>
  75. <div class="seCensor loan-censor">
  76. <div class="title">' . $receiptDetail ['receiptOrder'] . '</div>
  77. <div class="censorList clearfix censorHeight" style="height: 548px;">
  78. <ul>
  79. <li class="post">
  80. <div class="avtra">
  81. <img src="' . $receiptDetail ['staffDetail']['avatar'] . '_2.jpg" width="32">
  82. </div>
  83. <div class="comment">
  84. <p>
  85. <span class="fR">' . $receiptDetail ['date'] . '</span>' . $receiptDetail ['staffDetail']['username'] . '
  86. </p>
  87. <p>提交审批</p>
  88. </div>
  89. </li>';
  90. foreach ($verifylist as $key=>$value){
  91. $html.='<li ';
  92. if ($value['status']==1){
  93. $html.='class="done"';
  94. }elseif($value['status']==3){
  95. $html.='class="undone"';
  96. }
  97. $html.='>
  98. <div class="avtra">
  99. <img src="'.$value[2].'_2.jpg" width="32">
  100. </div>
  101. <div class="comment">
  102. <p class="colGray">
  103. <span class="fR">'.$value['date'].'</span>'.$value[1].'';
  104. if(isset($value['rolename'])){
  105. $html.='('.$value['rolename'].')';
  106. }
  107. $html.='</p>
  108. <p>'.$value['opinion'].'</p>
  109. </div>
  110. </li>';
  111. }
  112. foreach ($executeCopy as $key=>$value){
  113. $html.='<li ';
  114. if ($value['status']==1){
  115. $html.='class="done"';
  116. }elseif($value['status']==3){
  117. $html.='class="undone"';
  118. }
  119. $html.='>
  120. <div class="avtra">
  121. <img src="'.$value[2].'_2.jpg" width="32">
  122. </div>
  123. <div class="comment">
  124. <p class="colGray">
  125. <span class="fR">'.$value['date'].'</span>'.$value[1].'(费用执行)
  126. </p>
  127. <p>'.$value['opinion'].'</p>
  128. </div>
  129. </li>';
  130. }
  131. $html.='
  132. </ul>
  133. </div>
  134. </div>
  135. </div>
  136. '.$extendHtml.'
  137. </div>';
  138. return $html;
  139. }
  140. function _getPaymentsCollectPayByYearHtml($statisticsPay = array()) {
  141. $html = '';
  142. $subtotalSum = array (
  143. 1 => 0,
  144. 2 => 0,
  145. 3 => 0,
  146. 4 => 0,
  147. 5 => 0,
  148. 6 => 0,
  149. 7 => 0,
  150. 8 => 0,
  151. 9 => 0,
  152. 10 => 0,
  153. 11 => 0,
  154. 12 => 0
  155. );
  156. for($i = 1; $i <= 15; $i ++) {
  157. if ($i == 1) {
  158. $html = '<tr><th colspan="2" >银行手续费</th>';
  159. $sum = 0;
  160. for($month = 1; $month <= 12; $month ++) {
  161. $falg = true;
  162. foreach ( $statisticsPay as $key => $value ) {
  163. if ($value ['expenditureMsg'] == '' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
  164. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  165. $sum += $value ['payPrice'];
  166. $subtotalSum [$month] += $value ['payPrice'];
  167. $falg = false;
  168. break;
  169. }
  170. }
  171. if ($falg)
  172. $html .= '<td class="taR">-</td>';
  173. }
  174. if ($sum == 0)
  175. $html .= '<td class="taR">-</td>';
  176. else
  177. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  178. $html .= '</tr>';
  179. } elseif ($i == 2) {
  180. $html .= '<tr><th colspan="2" >总部电话费</th>';
  181. $sum = 0;
  182. for($month = 1; $month <= 12; $month ++) {
  183. $falg = true;
  184. foreach ( $statisticsPay as $key => $value ) {
  185. if ($value ['expenditureMsg'] == '' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
  186. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  187. $sum += $value ['payPrice'];
  188. $subtotalSum [$month] += $value ['payPrice'];
  189. $falg = false;
  190. break;
  191. }
  192. }
  193. if ($falg)
  194. $html .= '<td class="taR">-</td>';
  195. }
  196. if ($sum == 0)
  197. $html .= '<td class="taR">-</td>';
  198. else
  199. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  200. $html .= '</tr>';
  201. } elseif ($i == 3) {
  202. $subtotal = array (
  203. 1 => 0,
  204. 2 => 0,
  205. 3 => 0,
  206. 4 => 0,
  207. 5 => 0,
  208. 6 => 0,
  209. 7 => 0,
  210. 8 => 0,
  211. 9 => 0,
  212. 10 => 0,
  213. 11 => 0,
  214. 12 => 0
  215. );
  216. $html .= '<tr><th rowspan="4" width="90">缴税</th>';
  217. $html .= '<th width="90">增值税</th>';
  218. $sum = 0;
  219. for($month = 1; $month <= 12; $month ++) {
  220. $falg = true;
  221. foreach ( $statisticsPay as $key => $value ) {
  222. if ($value ['expenditureMsg'] == '增值税' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
  223. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  224. $sum += $value ['payPrice'];
  225. $subtotal [$month] += $value ['payPrice'];
  226. $falg = false;
  227. break;
  228. }
  229. }
  230. if ($falg)
  231. $html .= '<td class="taR">-</td>';
  232. }
  233. if ($sum == 0)
  234. $html .= '<td class="taR">-</td>';
  235. else
  236. $html .= '<td class="taR">¥' . $sum . '</td>';
  237. $html .= '</tr>';
  238. $html .= '<th width="90">税金附加</th>';
  239. $sum = 0;
  240. for($month = 1; $month <= 12; $month ++) {
  241. $falg = true;
  242. foreach ( $statisticsPay as $key => $value ) {
  243. if ($value ['expenditureMsg'] == '税金附加' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
  244. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  245. $sum += $value ['payPrice'];
  246. $subtotal [$month] += $value ['payPrice'];
  247. $falg = false;
  248. break;
  249. }
  250. }
  251. if ($falg)
  252. $html .= '<td class="taR">-</td>';
  253. }
  254. if ($sum == 0)
  255. $html .= '<td class="taR">-</td>';
  256. else
  257. $html .= '<td class="taR">¥' . $sum . '</td>';
  258. $html .= '</tr>';
  259. $html .= '<th width="90">企业所得税</th>';
  260. $sum = 0;
  261. for($month = 1; $month <= 12; $month ++) {
  262. $falg = true;
  263. foreach ( $statisticsPay as $key => $value ) {
  264. if ($value ['expenditureMsg'] == '企业所得税' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
  265. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  266. $sum += $value ['payPrice'];
  267. $subtotal [$month] += $value ['payPrice'];
  268. $falg = false;
  269. break;
  270. }
  271. }
  272. if ($falg)
  273. $html .= '<td class="taR">-</td>';
  274. }
  275. if ($sum == 0)
  276. $html .= '<td class="taR">-</td>';
  277. else
  278. $html .= '<td class="taR">¥' . $sum . '</td>';
  279. $html .= '</tr>';
  280. $html .= '<th width="90" class="colRed">小计</th>';
  281. $sum = 0;
  282. for($month = 1; $month <= 12; $month ++) {
  283. $sum += $subtotal [$month];
  284. $subtotalSum [$month] += $subtotal [$month];
  285. if (! empty ( $subtotal [$month] ))
  286. $html .= '<td class="taR colRed">¥' . $subtotal [$month] . '</td>';
  287. else
  288. $html .= '<td class="taR">-</td>';
  289. }
  290. if ($sum == 0)
  291. $html .= '<td class="taR">-</td>';
  292. else
  293. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  294. $html .= '</tr>';
  295. } elseif ($i == 5) {
  296. $html .= '<tr><th colspan="2" >保证金</th>';
  297. $sum = 0;
  298. for($month = 1; $month <= 12; $month ++) {
  299. $falg = true;
  300. foreach ( $statisticsPay as $key => $value ) {
  301. if ($value ['expenditureMsg'] == '' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
  302. $html .= '<td class="taR">¥' . abs ( $value ['payPrice'] ) . '</td>';
  303. $sum += abs ( $value ['payPrice'] );
  304. $subtotalSum [$month] += abs ( $value ['payPrice'] );
  305. $falg = false;
  306. break;
  307. }
  308. }
  309. if ($falg)
  310. $html .= '<td class="taR">-</td>';
  311. }
  312. if ($sum == 0)
  313. $html .= '<td class="taR">-</td>';
  314. else
  315. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  316. $html .= '</tr>';
  317. }
  318. }
  319. $html .= '<tr><th class="taR" colspan="2">合计</th>';
  320. $sum = 0;
  321. foreach ( $subtotalSum as $key => $value ) {
  322. $sum += $value;
  323. if (! empty ( $value ))
  324. $html .= '<td class="taR colGreen">¥' . $value . '</td>';
  325. else
  326. $html .= '<td class="taR">-</td>';
  327. }
  328. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  329. $html .= '</tr>';
  330. $html .= '<tr class="warning"><td class="taR" colspan="2"><b>全年合计</b></td>
  331. <td class="colGreed taR" colspan="14"><b style="font-size:24px">¥' . $sum . '</b></td></tr>';
  332. return array (
  333. 'html' => $html,
  334. 'sum' => $sum
  335. );
  336. }
  337. /**
  338. * 获得汇总 日常收支年
  339. * @param array $statisticsIncome
  340. * @return string
  341. */
  342. function _getPaymentsCollectByYearHtml($statisticsIncome = array()) {
  343. $html = '';
  344. $subtotalSum = array (
  345. 1 => 0,
  346. 2 => 0,
  347. 3 => 0,
  348. 4 => 0,
  349. 5 => 0,
  350. 6 => 0,
  351. 7 => 0,
  352. 8 => 0,
  353. 9 => 0,
  354. 10 => 0,
  355. 11 => 0,
  356. 12 => 0
  357. );
  358. for($i = 1; $i <= 15; $i ++) {
  359. if ($i == 1) {
  360. $subtotal = array (
  361. 1 => 0,
  362. 2 => 0,
  363. 3 => 0,
  364. 4 => 0,
  365. 5 => 0,
  366. 6 => 0,
  367. 7 => 0,
  368. 8 => 0,
  369. 9 => 0,
  370. 10 => 0,
  371. 11 => 0,
  372. 12 => 0
  373. );
  374. $html .= '<tr><th rowspan="4" width="90">利息收入</th>';
  375. $html .= '<th width="90">银行存款</th>';
  376. $sum = 0;
  377. for($month = 1; $month <= 12; $month ++) {
  378. $falg = true;
  379. foreach ( $statisticsIncome as $key => $value ) {
  380. if ($value ['accountMsg'] == '银行存款' && $value ['month'] == $month && $value ['accountType'] == $i) {
  381. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  382. $sum += $value ['inComePrice'];
  383. $subtotal [$month] += $value ['inComePrice'];
  384. $falg = false;
  385. break;
  386. }
  387. }
  388. if ($falg)
  389. $html .= '<td class="taR">-</td>';
  390. }
  391. if ($sum == 0)
  392. $html .= '<td class="taR">-</td>';
  393. else
  394. $html .= '<td class="taR">¥' . $sum . '</td>';
  395. $html .= '</tr>';
  396. $html .= '<th width="90">活期理财收益</th>';
  397. $sum = 0;
  398. for($month = 1; $month <= 12; $month ++) {
  399. $falg = true;
  400. foreach ( $statisticsIncome as $key => $value ) {
  401. if ($value ['accountMsg'] == '活期理财收益' && $value ['month'] == $month && $value ['accountType'] == $i) {
  402. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  403. $sum += $value ['inComePrice'];
  404. $subtotal [$month] += $value ['inComePrice'];
  405. $falg = false;
  406. break;
  407. }
  408. }
  409. if ($falg)
  410. $html .= '<td class="taR">-</td>';
  411. }
  412. if ($sum == 0)
  413. $html .= '<td class="taR">-</td>';
  414. else
  415. $html .= '<td class="taR">¥' . $sum . '</td>';
  416. $html .= '</tr>';
  417. $html .= '<th width="90">固定理财收益</th>';
  418. $sum = 0;
  419. for($month = 1; $month <= 12; $month ++) {
  420. $falg = true;
  421. foreach ( $statisticsIncome as $key => $value ) {
  422. if ($value ['accountMsg'] == '固定理财收益' && $value ['month'] == $month && $value ['accountType'] == $i) {
  423. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  424. $sum += $value ['inComePrice'];
  425. $subtotal [$month] += $value ['inComePrice'];
  426. $falg = false;
  427. break;
  428. }
  429. }
  430. if ($falg)
  431. $html .= '<td class="taR">-</td>';
  432. }
  433. if ($sum == 0)
  434. $html .= '<td class="taR">-</td>';
  435. else
  436. $html .= '<td class="taR">¥' . $sum . '</td>';
  437. $html .= '</tr>';
  438. $html .= '<th width="90">个人借款</th>';
  439. $sum = 0;
  440. for($month = 1; $month <= 12; $month ++) {
  441. $falg = true;
  442. foreach ( $statisticsIncome as $key => $value ) {
  443. if ($value ['accountMsg'] == '个人借款' && $value ['month'] == $month && $value ['accountType'] == $i) {
  444. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  445. $sum += $value ['inComePrice'];
  446. $subtotal [$month] += $value ['inComePrice'];
  447. $falg = false;
  448. break;
  449. }
  450. }
  451. if ($falg)
  452. $html .= '<td class="taR">-</td>';
  453. }
  454. if ($sum == 0)
  455. $html .= '<td class="taR">-</td>';
  456. else
  457. $html .= '<td class="taR">¥' . $sum . '</td>';
  458. $html .= '</tr>';
  459. $html .= '<th width="90" class="colGreen">小计</th>';
  460. $sum = 0;
  461. for($month = 1; $month <= 12; $month ++) {
  462. $sum += $subtotal [$month];
  463. $subtotalSum [$month] += $subtotal [$month];
  464. if (! empty ( $subtotal [$month] ))
  465. $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
  466. else
  467. $html .= '<td class="taR">-</td>';
  468. }
  469. if ($sum == 0)
  470. $html .= '<td class="taR">-</td>';
  471. else
  472. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  473. $html .= '</tr>';
  474. } elseif ($i == 2) {
  475. $subtotal = array (
  476. 1 => 0,
  477. 2 => 0,
  478. 3 => 0,
  479. 4 => 0,
  480. 5 => 0,
  481. 6 => 0,
  482. 7 => 0,
  483. 8 => 0,
  484. 9 => 0,
  485. 10 => 0,
  486. 11 => 0,
  487. 12 => 0
  488. );
  489. $html .= '<tr><th rowspan="3" width="90">补贴收入</th>';
  490. $html .= '<th width="90">社保</th>';
  491. $sum = 0;
  492. for($month = 1; $month <= 12; $month ++) {
  493. $falg = true;
  494. foreach ( $statisticsIncome as $key => $value ) {
  495. if ($value ['accountMsg'] == '社保' && $value ['month'] == $month && $value ['accountType'] == $i) {
  496. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  497. $sum += $value ['inComePrice'];
  498. $subtotal [$month] += $value ['inComePrice'];
  499. $falg = false;
  500. break;
  501. }
  502. }
  503. if ($falg)
  504. $html .= '<td class="taR">-</td>';
  505. }
  506. if ($sum == 0)
  507. $html .= '<td class="taR">-</td>';
  508. else
  509. $html .= '<td class="taR">¥' . $sum . '</td>';
  510. $html .= '</tr>';
  511. $html .= '<th width="90">财政</th>';
  512. $sum = 0;
  513. for($month = 1; $month <= 12; $month ++) {
  514. $falg = true;
  515. foreach ( $statisticsIncome as $key => $value ) {
  516. if ($value ['accountMsg'] == '财政' && $value ['month'] == $month && $value ['accountType'] == $i) {
  517. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  518. $sum += $value ['inComePrice'];
  519. $subtotal [$month] += $value ['inComePrice'];
  520. $falg = false;
  521. break;
  522. }
  523. }
  524. if ($falg)
  525. $html .= '<td class="taR">-</td>';
  526. }
  527. if ($sum == 0)
  528. $html .= '<td class="taR">-</td>';
  529. else
  530. $html .= '<td class="taR">¥' . $sum . '</td>';
  531. $html .= '</tr>';
  532. $html .= '<th width="90" class="colGreen">小计</th>';
  533. $sum = 0;
  534. for($month = 1; $month <= 12; $month ++) {
  535. $sum += $subtotal [$month];
  536. $subtotalSum [$month] += $subtotal [$month];
  537. if (! empty ( $subtotal [$month] ))
  538. $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
  539. else
  540. $html .= '<td class="taR">-</td>';
  541. }
  542. if ($sum == 0)
  543. $html .= '<td class="taR">-</td>';
  544. else
  545. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  546. $html .= '</tr>';
  547. } elseif ($i == 3) {
  548. $html .= '<tr><th colspan="2" >纵横知道</th>';
  549. $sum = 0;
  550. for($month = 1; $month <= 12; $month ++) {
  551. $falg = true;
  552. foreach ( $statisticsIncome as $key => $value ) {
  553. if ($value ['accountMsg'] == '' && $value ['month'] == $month && $value ['accountType'] == $i) {
  554. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  555. $sum += $value ['inComePrice'];
  556. $subtotalSum [$month] += $value ['inComePrice'];
  557. $falg = false;
  558. break;
  559. }
  560. }
  561. if ($falg)
  562. $html .= '<td class="taR">-</td>';
  563. }
  564. if ($sum == 0)
  565. $html .= '<td class="taR">-</td>';
  566. else
  567. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  568. $html .= '</tr>';
  569. } elseif ($i == 4) {
  570. $subtotal = array (
  571. 1 => 0,
  572. 2 => 0,
  573. 3 => 0,
  574. 4 => 0,
  575. 5 => 0,
  576. 6 => 0,
  577. 7 => 0,
  578. 8 => 0,
  579. 9 => 0,
  580. 10 => 0,
  581. 11 => 0,
  582. 12 => 0
  583. );
  584. $html .= '<tr><th rowspan="3" width="90">借款收回</th>';
  585. $html .= '<th width="90">备用金</th>';
  586. $sum = 0;
  587. for($month = 1; $month <= 12; $month ++) {
  588. $falg = true;
  589. foreach ( $statisticsIncome as $key => $value ) {
  590. if ($value ['accountMsg'] == '备用金' && $value ['month'] == $month && $value ['accountType'] == $i) {
  591. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  592. $sum += $value ['inComePrice'];
  593. $subtotal [$month] += $value ['inComePrice'];
  594. $falg = false;
  595. break;
  596. }
  597. }
  598. if ($falg)
  599. $html .= '<td class="taR">-</td>';
  600. }
  601. if ($sum == 0)
  602. $html .= '<td class="taR">-</td>';
  603. else
  604. $html .= '<td class="taR">¥' . $sum . '</td>';
  605. $html .= '</tr>';
  606. $html .= '<th width="90">私人借款</th>';
  607. $sum = 0;
  608. for($month = 1; $month <= 12; $month ++) {
  609. $falg = true;
  610. foreach ( $statisticsIncome as $key => $value ) {
  611. if ($value ['accountMsg'] == '私人借款' && $value ['month'] == $month && $value ['accountType'] == $i) {
  612. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  613. $sum += $value ['inComePrice'];
  614. $subtotal [$month] += $value ['inComePrice'];
  615. $falg = false;
  616. break;
  617. }
  618. }
  619. if ($falg)
  620. $html .= '<td class="taR">-</td>';
  621. }
  622. if ($sum == 0)
  623. $html .= '<td class="taR">-</td>';
  624. else
  625. $html .= '<td class="taR">¥' . $sum . '</td>';
  626. $html .= '</tr>';
  627. $html .= '<th width="90" class="colGreen">小计</th>';
  628. $sum = 0;
  629. for($month = 1; $month <= 12; $month ++) {
  630. $sum += $subtotal [$month];
  631. $subtotalSum [$month] += $subtotal [$month];
  632. if (! empty ( $subtotal [$month] ))
  633. $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
  634. else
  635. $html .= '<td class="taR">-</td>';
  636. }
  637. if ($sum == 0)
  638. $html .= '<td class="taR">-</td>';
  639. else
  640. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  641. $html .= '</tr>';
  642. } elseif ($i == 5) {
  643. $html .= '<tr><th colspan="2" >退汇</th>';
  644. $sum = 0;
  645. for($month = 1; $month <= 12; $month ++) {
  646. $falg = true;
  647. foreach ( $statisticsIncome as $key => $value ) {
  648. if ($value ['accountMsg'] == '' && $value ['month'] == $month && $value ['accountType'] == $i) {
  649. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  650. $sum += $value ['inComePrice'];
  651. $subtotalSum [$month] += $value ['inComePrice'];
  652. $falg = false;
  653. break;
  654. }
  655. }
  656. if ($falg)
  657. $html .= '<td class="taR">-</td>';
  658. }
  659. if ($sum == 0)
  660. $html .= '<td class="taR">-</td>';
  661. else
  662. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  663. $html .= '</tr>';
  664. } elseif ($i == 6) {
  665. $html .= '<tr><th colspan="2" >其他</th>';
  666. $sum = 0;
  667. for($month = 1; $month <= 12; $month ++) {
  668. $falg = true;
  669. foreach ( $statisticsIncome as $key => $value ) {
  670. if ($value ['accountMsg'] == '' && $value ['month'] == $month && $value ['accountType'] == $i) {
  671. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  672. $sum += $value ['inComePrice'];
  673. $subtotalSum [$month] += $value ['inComePrice'];
  674. $falg = false;
  675. break;
  676. }
  677. }
  678. if ($falg)
  679. $html .= '<td class="taR">-</td>';
  680. }
  681. if ($sum == 0)
  682. $html .= '<td class="taR">-</td>';
  683. else
  684. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  685. $html .= '</tr>';
  686. } elseif ($i == 8) {
  687. $html .= '<tr><th colspan="2" >保证金</th>';
  688. $sum = 0;
  689. for($month = 1; $month <= 12; $month ++) {
  690. $falg = true;
  691. foreach ( $statisticsIncome as $key => $value ) {
  692. if ($value ['accountMsg'] == '' && $value ['month'] == $month && $value ['accountType'] == $i) {
  693. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  694. $sum += $value ['inComePrice'];
  695. $subtotalSum [$month] += $value ['inComePrice'];
  696. $falg = false;
  697. break;
  698. }
  699. }
  700. if ($falg)
  701. $html .= '<td class="taR">-</td>';
  702. }
  703. if ($sum == 0)
  704. $html .= '<td class="taR">-</td>';
  705. else
  706. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  707. $html .= '</tr>';
  708. }
  709. }
  710. $html .= '<tr><th class="taR" colspan="2">合计</th>';
  711. $sum = 0;
  712. foreach ( $subtotalSum as $key => $value ) {
  713. $sum += $value;
  714. if (! empty ( $value ))
  715. $html .= '<td class="taR colGreen">¥' . $value . '</td>';
  716. else
  717. $html .= '<td class="taR">-</td>';
  718. }
  719. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  720. $html .= '</tr>';
  721. $html .= '<tr class="warning"><td class="taR" colspan="2"><b>全年合计</b></td>
  722. <td class="colGreed taR" colspan="14"><b style="font-size:24px">¥' . $sum . '</b></td></tr>';
  723. return array (
  724. 'html' => $html,
  725. 'sum' => $sum
  726. );
  727. }
  728. /**
  729. * 获得汇总 日常收支年
  730. * @param array $statisticsIncome
  731. * @return string
  732. */
  733. function _getPaymentsCollectByDayHtml($statisticsIncome = array(), $day = 0) {
  734. $html = '<tr><th class="taC" colspan="2">日常收入</th>';
  735. for($d = 1; $d <= $day; $d ++) {
  736. $subtotalSum [$d] = 0;
  737. $html .= '<th class="taC" width="80">' . $d . '日</th>';
  738. }
  739. $html .= '<th class="taC" width="110">总计</th></tr>';
  740. for($i = 1; $i <= 15; $i ++) {
  741. if ($i == 1) {
  742. for($d = 1; $d <= $day; $d ++) {
  743. $subtotal [$d] = 0;
  744. }
  745. // $subtotal = array (
  746. // 1 => 0,
  747. // 2 => 0,
  748. // 3 => 0,
  749. // 4 => 0,
  750. // 5 => 0,
  751. // 6 => 0,
  752. // 7 => 0,
  753. // 8 => 0,
  754. // 9 => 0,
  755. // 10 => 0,
  756. // 11 => 0,
  757. // 12 => 0
  758. // );
  759. $html .= '<tr><th rowspan="4" width="90">利息收入</th>';
  760. $html .= '<th width="90">银行存款</th>';
  761. $sum = 0;
  762. for($month = 1; $month <= $day; $month ++) {
  763. $falg = true;
  764. foreach ( $statisticsIncome as $key => $value ) {
  765. if ($value ['accountMsg'] == '银行存款' && $value ['day'] == $month && $value ['accountType'] == $i) {
  766. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  767. $sum += $value ['inComePrice'];
  768. $subtotal [$month] += $value ['inComePrice'];
  769. $falg = false;
  770. break;
  771. }
  772. }
  773. if ($falg)
  774. $html .= '<td class="taR">-</td>';
  775. }
  776. if ($sum == 0)
  777. $html .= '<td class="taR">-</td>';
  778. else
  779. $html .= '<td class="taR">¥' . $sum . '</td>';
  780. $html .= '</tr>';
  781. $html .= '<th width="90">理财收益</th>';
  782. $sum = 0;
  783. for($month = 1; $month <= $day; $month ++) {
  784. $falg = true;
  785. foreach ( $statisticsIncome as $key => $value ) {
  786. if ($value ['accountMsg'] == '理财收益' && $value ['day'] == $month && $value ['accountType'] == $i) {
  787. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  788. $sum += $value ['inComePrice'];
  789. $subtotal [$month] += $value ['inComePrice'];
  790. $falg = false;
  791. break;
  792. }
  793. }
  794. if ($falg)
  795. $html .= '<td class="taR">-</td>';
  796. }
  797. if ($sum == 0)
  798. $html .= '<td class="taR">-</td>';
  799. else
  800. $html .= '<td class="taR">¥' . $sum . '</td>';
  801. $html .= '</tr>';
  802. $html .= '<th width="90">个人借款</th>';
  803. $sum = 0;
  804. for($month = 1; $month <= $day; $month ++) {
  805. $falg = true;
  806. foreach ( $statisticsIncome as $key => $value ) {
  807. if ($value ['accountMsg'] == '个人借款' && $value ['day'] == $month && $value ['accountType'] == $i) {
  808. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  809. $sum += $value ['inComePrice'];
  810. $subtotal [$month] += $value ['inComePrice'];
  811. $falg = false;
  812. break;
  813. }
  814. }
  815. if ($falg)
  816. $html .= '<td class="taR">-</td>';
  817. }
  818. if ($sum == 0)
  819. $html .= '<td class="taR">-</td>';
  820. else
  821. $html .= '<td class="taR">¥' . $sum . '</td>';
  822. $html .= '</tr>';
  823. $html .= '<th width="90" class="colGreen">小计</th>';
  824. $sum = 0;
  825. for($month = 1; $month <= $day; $month ++) {
  826. $sum += $subtotal [$month];
  827. $subtotalSum [$month] += $subtotal [$month];
  828. if (! empty ( $subtotal [$month] ))
  829. $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
  830. else
  831. $html .= '<td class="taR">-</td>';
  832. }
  833. if ($sum == 0)
  834. $html .= '<td class="taR">-</td>';
  835. else
  836. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  837. $html .= '</tr>';
  838. } elseif ($i == 2) {
  839. for($d = 1; $d <= $day; $d ++) {
  840. $subtotal [$d] = 0;
  841. }
  842. $html .= '<tr><th rowspan="3" width="90">补贴收入</th>';
  843. $html .= '<th width="90">社保</th>';
  844. $sum = 0;
  845. for($month = 1; $month <= $day; $month ++) {
  846. $falg = true;
  847. foreach ( $statisticsIncome as $key => $value ) {
  848. if ($value ['accountMsg'] == '社保' && $value ['day'] == $month && $value ['accountType'] == $i) {
  849. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  850. $sum += $value ['inComePrice'];
  851. $subtotal [$month] += $value ['inComePrice'];
  852. $falg = false;
  853. break;
  854. }
  855. }
  856. if ($falg)
  857. $html .= '<td class="taR">-</td>';
  858. }
  859. if ($sum == 0)
  860. $html .= '<td class="taR">-</td>';
  861. else
  862. $html .= '<td class="taR">¥' . $sum . '</td>';
  863. $html .= '</tr>';
  864. $html .= '<th width="90">财政</th>';
  865. $sum = 0;
  866. for($month = 1; $month <= $day; $month ++) {
  867. $falg = true;
  868. foreach ( $statisticsIncome as $key => $value ) {
  869. if ($value ['accountMsg'] == '财政' && $value ['day'] == $month && $value ['accountType'] == $i) {
  870. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  871. $sum += $value ['inComePrice'];
  872. $subtotal [$month] += $value ['inComePrice'];
  873. $falg = false;
  874. break;
  875. }
  876. }
  877. if ($falg)
  878. $html .= '<td class="taR">-</td>';
  879. }
  880. if ($sum == 0)
  881. $html .= '<td class="taR">-</td>';
  882. else
  883. $html .= '<td class="taR">¥' . $sum . '</td>';
  884. $html .= '</tr>';
  885. $html .= '<th width="90" class="colGreen">小计</th>';
  886. $sum = 0;
  887. for($month = 1; $month <= $day; $month ++) {
  888. $sum += $subtotal [$month];
  889. $subtotalSum [$month] += $subtotal [$month];
  890. if (! empty ( $subtotal [$month] ))
  891. $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
  892. else
  893. $html .= '<td class="taR">-</td>';
  894. }
  895. if ($sum == 0)
  896. $html .= '<td class="taR">-</td>';
  897. else
  898. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  899. $html .= '</tr>';
  900. } elseif ($i == 3) {
  901. $html .= '<tr><th colspan="2" >纵横知道</th>';
  902. $sum = 0;
  903. for($month = 1; $month <= $day; $month ++) {
  904. $falg = true;
  905. foreach ( $statisticsIncome as $key => $value ) {
  906. if ($value ['accountMsg'] == '' && $value ['day'] == $month && $value ['accountType'] == $i) {
  907. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  908. $sum += $value ['inComePrice'];
  909. $subtotalSum [$month] += $value ['inComePrice'];
  910. $falg = false;
  911. break;
  912. }
  913. }
  914. if ($falg)
  915. $html .= '<td class="taR">-</td>';
  916. }
  917. if ($sum == 0)
  918. $html .= '<td class="taR">-</td>';
  919. else
  920. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  921. $html .= '</tr>';
  922. } elseif ($i == 4) {
  923. for($d = 1; $d <= $day; $d ++) {
  924. $subtotal [$d] = 0;
  925. }
  926. $html .= '<tr><th rowspan="3" width="90">借款收回</th>';
  927. $html .= '<th width="90">备用金</th>';
  928. $sum = 0;
  929. for($month = 1; $month <= $day; $month ++) {
  930. $falg = true;
  931. foreach ( $statisticsIncome as $key => $value ) {
  932. if ($value ['accountMsg'] == '备用金' && $value ['day'] == $month && $value ['accountType'] == $i) {
  933. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  934. $sum += $value ['inComePrice'];
  935. $subtotal [$month] += $value ['inComePrice'];
  936. $falg = false;
  937. break;
  938. }
  939. }
  940. if ($falg)
  941. $html .= '<td class="taR">-</td>';
  942. }
  943. if ($sum == 0)
  944. $html .= '<td class="taR">-</td>';
  945. else
  946. $html .= '<td class="taR">¥' . $sum . '</td>';
  947. $html .= '</tr>';
  948. $html .= '<th width="90">私人借款</th>';
  949. $sum = 0;
  950. for($month = 1; $month <= $day; $month ++) {
  951. $falg = true;
  952. foreach ( $statisticsIncome as $key => $value ) {
  953. if ($value ['accountMsg'] == '私人借款' && $value ['day'] == $month && $value ['accountType'] == $i) {
  954. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  955. $sum += $value ['inComePrice'];
  956. $subtotal [$month] += $value ['inComePrice'];
  957. $falg = false;
  958. break;
  959. }
  960. }
  961. if ($falg)
  962. $html .= '<td class="taR">-</td>';
  963. }
  964. if ($sum == 0)
  965. $html .= '<td class="taR">-</td>';
  966. else
  967. $html .= '<td class="taR">¥' . $sum . '</td>';
  968. $html .= '</tr>';
  969. $html .= '<th width="90" class="colGreen">小计</th>';
  970. $sum = 0;
  971. for($month = 1; $month <= $day; $month ++) {
  972. $sum += $subtotal [$month];
  973. $subtotalSum [$month] += $subtotal [$month];
  974. if (! empty ( $subtotal [$month] ))
  975. $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
  976. else
  977. $html .= '<td class="taR">-</td>';
  978. }
  979. if ($sum == 0)
  980. $html .= '<td class="taR">-</td>';
  981. else
  982. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  983. $html .= '</tr>';
  984. } elseif ($i == 5) {
  985. $html .= '<tr><th colspan="2" >退汇</th>';
  986. $sum = 0;
  987. for($month = 1; $month <= $day; $month ++) {
  988. $falg = true;
  989. foreach ( $statisticsIncome as $key => $value ) {
  990. if ($value ['accountMsg'] == '' && $value ['day'] == $month && $value ['accountType'] == $i) {
  991. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  992. $sum += $value ['inComePrice'];
  993. $subtotalSum [$month] += $value ['inComePrice'];
  994. $falg = false;
  995. break;
  996. }
  997. }
  998. if ($falg)
  999. $html .= '<td class="taR">-</td>';
  1000. }
  1001. if ($sum == 0)
  1002. $html .= '<td class="taR">-</td>';
  1003. else
  1004. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  1005. $html .= '</tr>';
  1006. } elseif ($i == 6) {
  1007. $html .= '<tr><th colspan="2" >其他</th>';
  1008. $sum = 0;
  1009. for($month = 1; $month <= $day; $month ++) {
  1010. $falg = true;
  1011. foreach ( $statisticsIncome as $key => $value ) {
  1012. if ($value ['accountMsg'] == '' && $value ['day'] == $month && $value ['accountType'] == $i) {
  1013. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  1014. $sum += $value ['inComePrice'];
  1015. $subtotalSum [$month] += $value ['inComePrice'];
  1016. $falg = false;
  1017. break;
  1018. }
  1019. }
  1020. if ($falg)
  1021. $html .= '<td class="taR">-</td>';
  1022. }
  1023. if ($sum == 0)
  1024. $html .= '<td class="taR">-</td>';
  1025. else
  1026. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  1027. $html .= '</tr>';
  1028. } elseif ($i == 8) {
  1029. $html .= '<tr><th colspan="2" >保证金</th>';
  1030. $sum = 0;
  1031. for($month = 1; $month <= $day; $month ++) {
  1032. $falg = true;
  1033. foreach ( $statisticsIncome as $key => $value ) {
  1034. if ($value ['accountMsg'] == '' && $value ['day'] == $month && $value ['accountType'] == $i) {
  1035. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  1036. $sum += $value ['inComePrice'];
  1037. $subtotalSum [$month] += $value ['inComePrice'];
  1038. $falg = false;
  1039. break;
  1040. }
  1041. }
  1042. if ($falg)
  1043. $html .= '<td class="taR">-</td>';
  1044. }
  1045. if ($sum == 0)
  1046. $html .= '<td class="taR">-</td>';
  1047. else
  1048. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  1049. $html .= '</tr>';
  1050. }
  1051. }
  1052. $html .= '<tr><th class="taR" colspan="2">合计</th>';
  1053. $sum = 0;
  1054. foreach ( $subtotalSum as $key => $value ) {
  1055. $sum += $value;
  1056. if (! empty ( $value ))
  1057. $html .= '<td class="taR colGreen">¥' . $value . '</td>';
  1058. else
  1059. $html .= '<td class="taR">-</td>';
  1060. }
  1061. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  1062. $html .= '</tr>';
  1063. $colspan = $day + 1;
  1064. $html .= '<tr class="warning"><td class="taR" colspan="2"><b>全月合计</b></td>
  1065. <td class="colGreed taR" colspan="' . $colspan . '"><b style="font-size:24px">¥' . $sum . '</b></td></tr>';
  1066. return array (
  1067. 'html' => $html,
  1068. 'sum' => $sum
  1069. );
  1070. }
  1071. function _getPaymentsCollectPayByDayHtml($statisticsPay = array(), $day = 0) {
  1072. $html = '<tr><th class="taC" colspan="2">日常支出</th>';
  1073. for($d = 1; $d <= $day; $d ++) {
  1074. $subtotalSum [$d] = 0;
  1075. $html .= '<th class="taC" width="80">' . $d . '日</th>';
  1076. }
  1077. $html .= '<th class="taC" width="110">总计</th></tr>';
  1078. for($i = 1; $i <= 15; $i ++) {
  1079. if ($i == 1) {
  1080. $html .= '<tr><th colspan="2" >银行手续费</th>';
  1081. $sum = 0;
  1082. for($month = 1; $month <= $day; $month ++) {
  1083. $falg = true;
  1084. foreach ( $statisticsPay as $key => $value ) {
  1085. if ($value ['expenditureMsg'] == '' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
  1086. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  1087. $sum += $value ['payPrice'];
  1088. $subtotalSum [$month] += $value ['payPrice'];
  1089. $falg = false;
  1090. break;
  1091. }
  1092. }
  1093. if ($falg)
  1094. $html .= '<td class="taR">-</td>';
  1095. }
  1096. if ($sum == 0)
  1097. $html .= '<td class="taR">-</td>';
  1098. else
  1099. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  1100. $html .= '</tr>';
  1101. } elseif ($i == 2) {
  1102. $html .= '<tr><th colspan="2" >总部电话费</th>';
  1103. $sum = 0;
  1104. for($month = 1; $month <= $day; $month ++) {
  1105. $falg = true;
  1106. foreach ( $statisticsPay as $key => $value ) {
  1107. if ($value ['expenditureMsg'] == '' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
  1108. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  1109. $sum += $value ['payPrice'];
  1110. $subtotalSum [$month] += $value ['payPrice'];
  1111. $falg = false;
  1112. break;
  1113. }
  1114. }
  1115. if ($falg)
  1116. $html .= '<td class="taR">-</td>';
  1117. }
  1118. if ($sum == 0)
  1119. $html .= '<td class="taR">-</td>';
  1120. else
  1121. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  1122. $html .= '</tr>';
  1123. } elseif ($i == 3) {
  1124. for($d = 1; $d <= $day; $d ++) {
  1125. $subtotal [$d] = 0;
  1126. }
  1127. $html .= '<tr><th rowspan="4" width="90">缴税</th>';
  1128. $html .= '<th width="90">增值税</th>';
  1129. $sum = 0;
  1130. for($month = 1; $month <= $day; $month ++) {
  1131. $falg = true;
  1132. foreach ( $statisticsPay as $key => $value ) {
  1133. if ($value ['expenditureMsg'] == '增值税' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
  1134. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  1135. $sum += $value ['payPrice'];
  1136. $subtotal [$month] += $value ['payPrice'];
  1137. $falg = false;
  1138. break;
  1139. }
  1140. }
  1141. if ($falg)
  1142. $html .= '<td class="taR">-</td>';
  1143. }
  1144. if ($sum == 0)
  1145. $html .= '<td class="taR">-</td>';
  1146. else
  1147. $html .= '<td class="taR">¥' . $sum . '</td>';
  1148. $html .= '</tr>';
  1149. $html .= '<th width="90">税金附加</th>';
  1150. $sum = 0;
  1151. for($month = 1; $month <= $day; $month ++) {
  1152. $falg = true;
  1153. foreach ( $statisticsPay as $key => $value ) {
  1154. if ($value ['expenditureMsg'] == '税金附加' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
  1155. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  1156. $sum += $value ['payPrice'];
  1157. $subtotal [$month] += $value ['payPrice'];
  1158. $falg = false;
  1159. break;
  1160. }
  1161. }
  1162. if ($falg)
  1163. $html .= '<td class="taR">-</td>';
  1164. }
  1165. if ($sum == 0)
  1166. $html .= '<td class="taR">-</td>';
  1167. else
  1168. $html .= '<td class="taR">¥' . $sum . '</td>';
  1169. $html .= '</tr>';
  1170. $html .= '<th width="90">企业所得税</th>';
  1171. $sum = 0;
  1172. for($month = 1; $month <= $day; $month ++) {
  1173. $falg = true;
  1174. foreach ( $statisticsPay as $key => $value ) {
  1175. if ($value ['expenditureMsg'] == '企业所得税' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
  1176. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  1177. $sum += $value ['payPrice'];
  1178. $subtotal [$month] += $value ['payPrice'];
  1179. $falg = false;
  1180. break;
  1181. }
  1182. }
  1183. if ($falg)
  1184. $html .= '<td class="taR">-</td>';
  1185. }
  1186. if ($sum == 0)
  1187. $html .= '<td class="taR">-</td>';
  1188. else
  1189. $html .= '<td class="taR">¥' . $sum . '</td>';
  1190. $html .= '</tr>';
  1191. $html .= '<th width="90" class="colRed">小计</th>';
  1192. $sum = 0;
  1193. for($month = 1; $month <= $day; $month ++) {
  1194. $sum += $subtotal [$month];
  1195. $subtotalSum [$month] += $subtotal [$month];
  1196. if (! empty ( $subtotal [$month] ))
  1197. $html .= '<td class="taR colRed">¥' . $subtotal [$month] . '</td>';
  1198. else
  1199. $html .= '<td class="taR">-</td>';
  1200. }
  1201. if ($sum == 0)
  1202. $html .= '<td class="taR">-</td>';
  1203. else
  1204. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  1205. $html .= '</tr>';
  1206. } elseif ($i == 5) {
  1207. $html .= '<tr><th colspan="2" >保证金</th>';
  1208. $sum = 0;
  1209. for($month = 1; $month <= $day; $month ++) {
  1210. $falg = true;
  1211. foreach ( $statisticsPay as $key => $value ) {
  1212. if ($value ['expenditureMsg'] == '' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
  1213. $html .= '<td class="taR">¥' . abs ( $value ['payPrice'] ) . '</td>';
  1214. $sum += abs ( $value ['payPrice'] );
  1215. $subtotalSum [$month] += abs ( $value ['payPrice'] );
  1216. $falg = false;
  1217. break;
  1218. }
  1219. }
  1220. if ($falg)
  1221. $html .= '<td class="taR">-</td>';
  1222. }
  1223. if ($sum == 0)
  1224. $html .= '<td class="taR">-</td>';
  1225. else
  1226. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  1227. $html .= '</tr>';
  1228. }
  1229. }
  1230. $html .= '<tr><th class="taR" colspan="2">合计</th>';
  1231. $sum = 0;
  1232. foreach ( $subtotalSum as $key => $value ) {
  1233. $sum += $value;
  1234. if (! empty ( $value ))
  1235. $html .= '<td class="taR colGreen">¥' . $value . '</td>';
  1236. else
  1237. $html .= '<td class="taR">-</td>';
  1238. }
  1239. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  1240. $html .= '</tr>';
  1241. $colspan = $day + 1;
  1242. $html .= '<tr class="warning"><td class="taR" colspan="2"><b>全月合计</b></td>
  1243. <td class="colGreed taR" colspan="' . $colspan . '"><b style="font-size:24px">¥' . $sum . '</b></td></tr>';
  1244. return array (
  1245. 'html' => $html,
  1246. 'sum' => $sum
  1247. );
  1248. }
  1249. function getExecuteStaff($receiptDetail){
  1250. // 费用执行人相关数据
  1251. $executeCopy = json_decode ( $receiptDetail ['executeCopy'], true );
  1252. $executeStaff = json_decode ( $receiptDetail ['executeStaff'], true );
  1253. foreach ( $executeCopy as $k => $v ) {
  1254. $executeCopy [$k] ['date'] = '';
  1255. $executeCopy [$k] ['opinion'] = '';
  1256. $executeCopy [$k] ['status'] = '';
  1257. if (! empty ( $executeStaff ))
  1258. foreach ( $executeStaff as $m => $u ) {
  1259. if ($v [0] == $m) {
  1260. $executeCopy [$k] ['date'] = $u ['date'];
  1261. $executeCopy [$k] ['opinion'] = $u ['opinion'];
  1262. $executeCopy [$k] ['status'] = $u ['status'];
  1263. break;
  1264. }
  1265. }
  1266. }
  1267. $receiptDetail ['executeCopy'] = $executeCopy;
  1268. return $receiptDetail['executeCopy'];
  1269. }
  1270. function num_to_rmb($num) {
  1271. $c1 = "零壹贰叁肆伍陆柒捌玖";
  1272. $c2 = "分角元拾佰仟万拾佰仟亿";
  1273. // 精确到分后面就不要了,所以只留两个小数位
  1274. $num = round ( $num, 2 );
  1275. // 将数字转化为整数
  1276. $num = $num * 100;
  1277. if (strlen ( $num ) > 10) {
  1278. return "金额太大,请检查";
  1279. }
  1280. $i = 0;
  1281. $c = "";
  1282. while ( 1 ) {
  1283. if ($i == 0) {
  1284. // 获取最后一位数字
  1285. $n = substr ( $num, strlen ( $num ) - 1, 1 );
  1286. } else {
  1287. $n = $num % 10;
  1288. }
  1289. // 每次将最后一位数字转化为中文
  1290. $p1 = substr ( $c1, 3 * $n, 3 );
  1291. $p2 = substr ( $c2, 3 * $i, 3 );
  1292. if ($n != '0' || ($n == '0' && ($p2 == '亿' || $p2 == '万' || $p2 == '元'))) {
  1293. $c = $p1 . $p2 . $c;
  1294. } else {
  1295. $c = $p1 . $c;
  1296. }
  1297. $i = $i + 1;
  1298. // 去掉数字最后一位了
  1299. $num = $num / 10;
  1300. // echo $num.'</br>';
  1301. $num = ( int ) $num;
  1302. // $num =floor($num);
  1303. // $num = round ( $num, 0, PHP_ROUND_HALF_DOWN );
  1304. // echo $num.'</br>';
  1305. // 结束循环
  1306. if ($num == 0) {
  1307. break;
  1308. }
  1309. }
  1310. // echo $c.'</br>';
  1311. $j = 0;
  1312. $slen = strlen ( $c );
  1313. while ( $j < $slen ) {
  1314. // utf8一个汉字相当3个字符
  1315. $m = substr ( $c, $j, 6 );
  1316. // 处理数字中很多0的情况,每次循环去掉一个汉字“零”
  1317. if ($m == '零元' || $m == '零万' || $m == '零亿' || $m == '零零') {
  1318. $left = substr ( $c, 0, $j );
  1319. $right = substr ( $c, $j + 3 );
  1320. $c = $left . $right;
  1321. $j = $j - 3;
  1322. $slen = $slen - 3;
  1323. }
  1324. $j = $j + 3;
  1325. }
  1326. // 这个是为了去掉类似23.0中最后一个“零”字
  1327. if (substr ( $c, strlen ( $c ) - 3, 3 ) == '零') {
  1328. $c = substr ( $c, 0, strlen ( $c ) - 3 );
  1329. }
  1330. // 将处理的汉字加上“整”
  1331. if (empty ( $c )) {
  1332. return "零元整";
  1333. } else {
  1334. return $c . "整";
  1335. }
  1336. }
  1337. /**
  1338. * 数据导出
  1339. * @param array $title 标题行名称
  1340. * @param array $data 导出数据
  1341. * @param string $fileName 文件名
  1342. * @param string $savePath 保存路径
  1343. * @param $type 是否下载 false--保存 true--下载
  1344. * @return string 返回文件全路径
  1345. * @throws PHPExcel_Exception
  1346. * @throws PHPExcel_Reader_Exception @exportExcel(array('姓名','年龄'), array(array('a',21),array('b',23)), '档案', './', true);
  1347. */
  1348. function exportExcel($title = array(), $data = array(), $fileName = '', $savePath = './', $isDown = false) {
  1349. Doo::loadClass ( 'PHPExcel1.7.9/PHPExcel' );
  1350. $obj = new PHPExcel ();
  1351. // 横向单元格标识
  1352. $cellName = array (
  1353. 'A',
  1354. 'B',
  1355. 'C',
  1356. 'D',
  1357. 'E',
  1358. 'F',
  1359. 'G',
  1360. 'H',
  1361. 'I',
  1362. 'J',
  1363. 'K',
  1364. 'L',
  1365. 'M',
  1366. 'N',
  1367. 'O',
  1368. 'P',
  1369. 'Q',
  1370. 'R',
  1371. 'S',
  1372. 'T',
  1373. 'U',
  1374. 'V',
  1375. 'W',
  1376. 'X',
  1377. 'Y',
  1378. 'Z',
  1379. 'AA',
  1380. 'AB',
  1381. 'AC',
  1382. 'AD',
  1383. 'AE',
  1384. 'AF',
  1385. 'AG',
  1386. 'AH',
  1387. 'AI',
  1388. 'AJ',
  1389. 'AK',
  1390. 'AL',
  1391. 'AM',
  1392. 'AN',
  1393. 'AO',
  1394. 'AP',
  1395. 'AQ',
  1396. 'AR',
  1397. 'AS',
  1398. 'AT',
  1399. 'AU',
  1400. 'AV',
  1401. 'AW',
  1402. 'AX',
  1403. 'AY',
  1404. 'AZ'
  1405. );
  1406. $obj->getActiveSheet ( 0 )->setTitle ( 'sheet名称' ); // 设置sheet名称
  1407. $_row = 0; // 设置纵向单元格标识
  1408. if ($title) {
  1409. $_cnt = count ( $title );
  1410. // $obj->getActiveSheet(0)->mergeCells('A'.$_row.':'.$cellName[$_cnt-1].$_row); //合并单元格
  1411. // $obj->setActiveSheetIndex(0)->setCellValue('A'.$_row, '数据导出:'.date('Y-m-d H:i:s')); //设置合并后的单元格内容
  1412. $_row ++;
  1413. $i = 0;
  1414. foreach ( $title as $v ) { // 设置列标题
  1415. $obj->setActiveSheetIndex ( 0 )->setCellValue ( $cellName [$i] . $_row, $v );
  1416. $i ++;
  1417. }
  1418. $_row ++;
  1419. }
  1420. ;
  1421. // html_entity_decode("&iuml;&raquo;&iquest;".$value['order_id']);
  1422. // 填写数据
  1423. if ($data) {
  1424. $i = 0;
  1425. foreach ( $data as $_v ) {
  1426. $j = 0;
  1427. foreach ( $_v as $_cell ) {
  1428. $obj->getActiveSheet ( 0 )->setCellValueExplicit ( $cellName [$j] . ($i + $_row), $_cell, PHPExcel_Cell_DataType::TYPE_STRING );
  1429. $j ++;
  1430. }
  1431. $i ++;
  1432. }
  1433. }
  1434. // 文件名处理
  1435. if (! $fileName) {
  1436. $fileName = uniqid ( time (), true );
  1437. }
  1438. $objWrite = PHPExcel_IOFactory::createWriter ( $obj, 'Excel2007' );
  1439. if ($isDown) { // 网页下载
  1440. header ( 'pragma:public' );
  1441. header ( "Content-Disposition:attachment;filename=$fileName.xls" );
  1442. header ( 'Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' );
  1443. $objWrite->save ( 'php://output' );
  1444. exit ();
  1445. }
  1446. $_fileName = iconv ( "utf-8", "gb2312", $fileName ); // 转码
  1447. $_savePath = $savePath . $_fileName . '.xlsx';
  1448. $objWrite->save ( $_savePath );
  1449. return $savePath . $fileName . '.xlsx';
  1450. }
  1451. ?>