receipt.func.php 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312
  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. function cellColor($cells,$color,$obj){
  1452. $obj->getActiveSheet()->getStyle($cells)->getFill()->applyFromArray(array(
  1453. 'type' => PHPExcel_Style_Fill::FILL_SOLID,
  1454. 'startcolor' => array(
  1455. 'rgb' => $color
  1456. )
  1457. ));
  1458. }
  1459. /*
  1460. * 处理Excel导出
  1461. * @param $datas array
  1462. * 设置表格数据
  1463. * @param $titlename string
  1464. * 设置head @param $title string 设置表头
  1465. */
  1466. function excelData($trainData, $receiptDetail, $summary, $aiList,$receiptLoanDetail,$invoiceList,$RItemList,$lecturerList,$invoiceTrainingDetail) {
  1467. Doo::loadClass ( 'PHPExcel1.7.9/PHPExcel' );
  1468. $obj = new PHPExcel ();
  1469. //设置合并单元格
  1470. $obj->getActiveSheet()->mergeCells('A1:D1');
  1471. //设置居中--//字体加粗
  1472. $obj->getActiveSheet()->getStyle('A1:J1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1473. $i=2;
  1474. for(;$i<=20;$i++){
  1475. $obj->getActiveSheet()->getStyle('A'.$i.':J'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1476. //$obj->getActiveSheet()->getStyle('A'.$i)->getFont()->setName('宋体')->setBold(true);
  1477. //$obj->getActiveSheet()->getStyle('C'.$i)->getFont()->setName('宋体')->setBold(true);
  1478. }
  1479. $styleThinBlackBorderOutline = array(
  1480. 'borders' => array(
  1481. 'allborders' => array( //设置全部边框
  1482. 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
  1483. ),
  1484. ),
  1485. );
  1486. $obj->getActiveSheet()->getStyle( 'A1:D9')->applyFromArray($styleThinBlackBorderOutline);
  1487. for ($i=1;$i<=9;$i++){
  1488. cellColor('A'.$i, 'ddebf7',$obj);
  1489. }
  1490. cellColor('C2', 'ddebf7',$obj);cellColor('C3', 'ddebf7',$obj);
  1491. cellColor('C4', 'ddebf7',$obj);cellColor('C8', 'ddebf7',$obj);
  1492. cellColor('C6', 'ddebf7',$obj);cellColor('C7', 'ddebf7',$obj);
  1493. //设置单元格宽
  1494. $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
  1495. $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
  1496. $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
  1497. $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
  1498. $obj->getActiveSheet()->getColumnDimension('E')->setWidth(25);
  1499. $obj->getActiveSheet()->getDefaultRowDimension()->setRowHeight(18);
  1500. $obj->getActiveSheet()->getStyle('A1')->getFont()->setName('宋体')->setBold(true);
  1501. $obj->getactivesheet()->setCellValue ( 'A1','培训班信息' );
  1502. $obj->getactivesheet()->setCellValue ( 'A2','培训班名称' );
  1503. $obj->getactivesheet()->setCellValue ( 'B2',$trainData['trainName'] );
  1504. $obj->getactivesheet()->setCellValue ( 'C2','所在办事处' );
  1505. $obj->getactivesheet()->setCellValue ( 'D2',$trainData['categoryName'] );
  1506. $obj->getactivesheet()->setCellValue ( 'A3','开班时间' );
  1507. $obj->getactivesheet()->setCellValue ( 'B3',$trainData['trainStartDate'] );
  1508. $obj->getactivesheet()->setCellValue ( 'C3','结束时间' );
  1509. $obj->getactivesheet()->setCellValue ( 'D3',$trainData['trainEndDate'] );
  1510. $obj->getactivesheet()->setCellValue ( 'A4','参加人数' );
  1511. $obj->getactivesheet()->setCellValue ( 'B4',$trainData['participants'] );
  1512. $obj->getactivesheet()->setCellValue ( 'C4','培训班地址' );
  1513. autoCellsWidth($obj,'D',$trainData ['trainAddress']);
  1514. $obj->getactivesheet()->setCellValue ( 'D4',$trainData['trainAddress'] );
  1515. $obj->getactivesheet()->setCellValue ( 'A5','备注' );
  1516. $obj->getActiveSheet()->mergeCells('B5:D5');
  1517. $obj->getactivesheet()->setCellValue ( 'B5',$trainData['trainRemarks'] );
  1518. $obj->getActiveSheet()->mergeCells('A6:D6');
  1519. $obj->getActiveSheet()->getStyle('A6:D6')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1520. $obj->getactivesheet()->setCellValue ( 'A6','汇款信息' );
  1521. $obj->getactivesheet()->setCellValue ( 'A7','汇款人户名' );
  1522. $obj->getactivesheet()->setCellValue ( 'B7',$receiptDetail['remittanceName'] );
  1523. $obj->getactivesheet()->setCellValue ( 'C7','汇款银行' );
  1524. if(0==$receiptDetail['remittanceBankType']){
  1525. $obj->getactivesheet()->setCellValue ( 'D7','广发银行' );
  1526. }else{
  1527. $obj->getactivesheet()->setCellValue ( 'D7',其他 );
  1528. }
  1529. $obj->getactivesheet()->setCellValue ( 'A8','汇款开户银行名称' );
  1530. autoCellsWidth($obj,'B',$receiptDetail ['bankName']);
  1531. $obj->getactivesheet()->setCellValue ( 'B8',$receiptDetail['bankName'] );
  1532. $obj->getactivesheet()->setCellValue ( 'C8','汇款帐号' );
  1533. $obj->getActiveSheet()->setCellValueExplicit('D8',$receiptDetail['bankNumber'],PHPExcel_Cell_DataType::TYPE_STRING);
  1534. //$obj->getactivesheet()->setCellValue ( 'D7',$receiptDetail['bankNumber'].'' );
  1535. if(0==$receiptDetail['remittanceBankType']){
  1536. $obj->getactivesheet()->setCellValue ( 'A9','联行号' );
  1537. $obj->getActiveSheet()->mergeCells('B9:D9');
  1538. $obj->getactivesheet()->setCellValue ( 'B9',$receiptDetail['coupletNumber'] );
  1539. }
  1540. $obj->setActiveSheetIndex(0);
  1541. $obj->getActiveSheet ()->setTitle ( '信息' );
  1542. //------------------------------------------------------------------------------------------
  1543. $obj->createSheet();
  1544. $obj->setActiveSheetIndex(1);
  1545. makeSummaryData($obj,$summary,$aiList);
  1546. //------------------------------------------------------------------------------------------
  1547. //绘制借款
  1548. $obj->createSheet();
  1549. $obj->setActiveSheetIndex(2);
  1550. makeReceiptLoanData($obj,$receiptLoanDetail);
  1551. //------------------------------------------------------------------------------------------
  1552. //绘制收入
  1553. $obj->createSheet();
  1554. $obj->setActiveSheetIndex(3);
  1555. makeInvoiceData($obj,$invoiceList,$invoiceTrainingDetail);
  1556. //------------------------------------------------------------------------------------------
  1557. //绘制支出
  1558. $obj->createSheet();
  1559. $obj->setActiveSheetIndex(4);
  1560. makeItemData($obj,$RItemList);
  1561. //------------------------------------------------------------------------------------------
  1562. //绘制讲师
  1563. $obj->createSheet();
  1564. $obj->setActiveSheetIndex(5);
  1565. makeLecturerData($obj,$lecturerList);
  1566. $objWrite = PHPExcel_IOFactory::createWriter ( $obj, 'Excel2007' );
  1567. header ( 'pragma:public' );
  1568. header ( "Content-Disposition:attachment;filename=".$trainData['trainName'].".xlsx" );
  1569. header ( 'Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' );
  1570. $objWrite->save ( 'php://output' );
  1571. exit ();
  1572. }
  1573. function makeLecturerData($obj,$lecturerList){
  1574. //整体字体位置
  1575. $invoiceCount=count($lecturerList)+2;
  1576. for($i=1;$i<=$invoiceCount;$i++){
  1577. $obj->getActiveSheet()->getStyle('A'.$i.':E'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  1578. $obj->getActiveSheet()->getStyle('A'.$i.':E'.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
  1579. $obj->getActiveSheet()->getRowDimension($i)->setRowHeight(18);
  1580. }
  1581. $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
  1582. $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
  1583. $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
  1584. $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
  1585. $obj->getActiveSheet()->getColumnDimension('E')->setWidth(25);
  1586. //边框
  1587. $styleThinBlackBorderOutline = array(
  1588. 'borders' => array(
  1589. 'allborders' => array( //设置全部边框
  1590. 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
  1591. ),
  1592. ),);
  1593. $obj->getActiveSheet()->getStyle( 'A1:E'.$invoiceCount)->applyFromArray($styleThinBlackBorderOutline);
  1594. cellColor('A1', 'ddebf7',$obj);cellColor('B1', 'ddebf7',$obj);
  1595. cellColor('C1', 'ddebf7',$obj);cellColor('D1', 'ddebf7',$obj);cellColor('E1', 'ddebf7',$obj);
  1596. $obj->getactivesheet()->setCellValue ( 'A1','类型' );
  1597. $obj->getactivesheet()->setCellValue ( 'B1','讲师姓名' );
  1598. $obj->getactivesheet()->setCellValue ( 'C1','授课日数' );
  1599. $obj->getactivesheet()->setCellValue ( 'D1','日授课费' );
  1600. $obj->getactivesheet()->setCellValue ( 'E1','合计应发授课费' );
  1601. $i=2;$sumPrice=0;
  1602. foreach ($lecturerList as $key=>$value){
  1603. $lecturerName='';
  1604. if($value['ltype']=='OUTSIDE'){
  1605. $lecturerName.='外聘';
  1606. if($value['taxation']==0){
  1607. $lecturerName.='(不计税)';
  1608. }else{
  1609. $lecturerName.='(计税)';
  1610. }
  1611. }else{
  1612. $lecturerName.='员工';
  1613. }
  1614. $obj->getactivesheet()->setCellValue ( 'A'.$i,$lecturerName );
  1615. $obj->getactivesheet()->setCellValue ( 'B'.$i,$value['lecturerName'] );
  1616. $obj->getactivesheet()->setCellValue ( 'C'.$i,$value['schoolDay'] );
  1617. $obj->getactivesheet()->setCellValue ( 'D'.$i,$value['price'] );
  1618. $obj->getactivesheet()->setCellValue ( 'E'.$i,$value['fees'] );
  1619. $sumPrice+=$value['sum'];
  1620. $i++;
  1621. }
  1622. $obj->getactivesheet()->setCellValue ( 'C'.$i,'合计' );
  1623. $obj->getactivesheet()->setCellValue ( 'D'.$i,$sumPrice );
  1624. $obj->getActiveSheet ()->setTitle ( '讲师' );
  1625. }
  1626. function makeItemData($obj,$itemList){
  1627. //整体字体位置
  1628. $invoiceCount=count($itemList)+2;
  1629. for($i=1;$i<=$invoiceCount;$i++){
  1630. $obj->getActiveSheet()->getStyle('A'.$i.':E'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  1631. $obj->getActiveSheet()->getStyle('A'.$i.':E'.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
  1632. $obj->getActiveSheet()->getRowDimension($i)->setRowHeight(18);
  1633. }
  1634. $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
  1635. $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
  1636. $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
  1637. $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
  1638. //边框
  1639. $styleThinBlackBorderOutline = array(
  1640. 'borders' => array(
  1641. 'allborders' => array( //设置全部边框
  1642. 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
  1643. ),
  1644. ),);
  1645. $obj->getActiveSheet()->getStyle( 'A1:E'.$invoiceCount)->applyFromArray($styleThinBlackBorderOutline);
  1646. cellColor('A1', 'ddebf7',$obj);cellColor('B1', 'ddebf7',$obj);
  1647. cellColor('C1', 'ddebf7',$obj);cellColor('D1', 'ddebf7',$obj);
  1648. cellColor('E1', 'ddebf7',$obj);
  1649. $obj->getactivesheet()->setCellValue ( 'A1','日期' );
  1650. $obj->getactivesheet()->setCellValue ( 'B1','类别' );
  1651. $obj->getactivesheet()->setCellValue ( 'C1','金额' );
  1652. $obj->getactivesheet()->setCellValue ( 'D1','经手人' );
  1653. $obj->getactivesheet()->setCellValue ( 'E1','支出描述' );
  1654. $i=2;$maxArray=array();$sumPrice=0;
  1655. foreach ($itemList as $key=>$value){
  1656. $obj->getactivesheet()->setCellValue ( 'A'.$i,$value['date'] );
  1657. $obj->getactivesheet()->setCellValue ( 'B'.$i,$value['item'] );
  1658. $obj->getactivesheet()->setCellValue ( 'C'.$i,$value['price'] );
  1659. $obj->getactivesheet()->setCellValue ( 'D'.$i,$value['inputer'] );
  1660. $obj->getactivesheet()->setCellValue ( 'E'.$i,$value['describe'] );
  1661. array_push($maxArray, strlen($value['describe']));
  1662. $sumPrice+=$value['price'];
  1663. $i++;
  1664. }
  1665. $obj->getactivesheet()->setCellValue ( 'B'.$i,'合计' );
  1666. $obj->getactivesheet()->setCellValue ( 'C'.$i,$sumPrice );
  1667. $ma=0;
  1668. if (!empty($maxArray)){
  1669. $ma=max($maxArray);
  1670. }
  1671. $max=$ma-10;$fontlenght=25;
  1672. if($max>25){
  1673. $fontlenght=$max;
  1674. }
  1675. $obj->getActiveSheet()->getColumnDimension('E')->setWidth($fontlenght);
  1676. $obj->getActiveSheet ()->setTitle ( '支出' );
  1677. }
  1678. function makeInvoiceData($obj,$invoiceList,$invoiceTrainingDetail){
  1679. //整体字体位置
  1680. $invoiceCount=count($invoiceList)+4;
  1681. for($i=1;$i<=$invoiceCount;$i++){
  1682. $obj->getActiveSheet()->getStyle('A'.$i.':I'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  1683. $obj->getActiveSheet()->getStyle('A'.$i.':I'.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
  1684. $obj->getActiveSheet()->getRowDimension($i)->setRowHeight(18);
  1685. }
  1686. $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
  1687. $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
  1688. $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
  1689. $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
  1690. $obj->getActiveSheet()->getColumnDimension('E')->setWidth(25);
  1691. $obj->getActiveSheet()->getColumnDimension('F')->setWidth(25);
  1692. $obj->getActiveSheet()->getColumnDimension('G')->setWidth(25);
  1693. $obj->getActiveSheet()->getColumnDimension('H')->setWidth(25);
  1694. $obj->getActiveSheet()->getColumnDimension('I')->setWidth(25);
  1695. //边框
  1696. $styleThinBlackBorderOutline = array(
  1697. 'borders' => array(
  1698. 'allborders' => array( //设置全部边框
  1699. 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
  1700. ),
  1701. ),);
  1702. $obj->getActiveSheet()->getStyle( 'A1:I2')->applyFromArray($styleThinBlackBorderOutline);
  1703. cellColor('A1', 'ddebf7',$obj);cellColor('B1', 'ddebf7',$obj);
  1704. cellColor('C1', 'ddebf7',$obj);cellColor('D1', 'ddebf7',$obj);
  1705. cellColor('E1', 'ddebf7',$obj);cellColor('F1', 'ddebf7',$obj);
  1706. cellColor('H1', 'ddebf7',$obj);cellColor('G1', 'ddebf7',$obj);cellColor('I1', 'ddebf7',$obj);
  1707. $obj->getactivesheet()->setCellValue ( 'A1','培训班名称' );
  1708. $obj->getactivesheet()->setCellValue ( 'B1','办事处' );
  1709. $obj->getactivesheet()->setCellValue ( 'C1','创建' );
  1710. $obj->getactivesheet()->setCellValue ( 'D1','开班时间' );
  1711. $obj->getactivesheet()->setCellValue ( 'E1','包含发票' );
  1712. $obj->getactivesheet()->setCellValue ( 'F1','开票金额合计' );
  1713. $obj->getactivesheet()->setCellValue ( 'G1','入账金额合计' );
  1714. $obj->getactivesheet()->setCellValue ( 'H1','公司已收款' );
  1715. $obj->getactivesheet()->setCellValue ( 'I1','办事处已收款' );
  1716. if(!empty($invoiceTrainingDetail)){
  1717. $obj->getactivesheet()->setCellValue ( 'A2',$invoiceTrainingDetail['trainName'] );
  1718. $obj->getactivesheet()->setCellValue ( 'B2',$invoiceTrainingDetail['category'][0]['title'] );
  1719. $obj->getactivesheet()->setCellValue ( 'C2',$invoiceTrainingDetail['staff']['username'] );
  1720. $obj->getactivesheet()->setCellValue ( 'D2',$invoiceTrainingDetail['trainDate'] );
  1721. $obj->getactivesheet()->setCellValue ( 'E2',$invoiceTrainingDetail['invoiceTotal'] );
  1722. $obj->getactivesheet()->setCellValue ( 'F2',$invoiceTrainingDetail['invoiceTotalAmount'] );
  1723. $obj->getactivesheet()->setCellValue ( 'G2',$invoiceTrainingDetail['invoiceArriveAmount'] );
  1724. $obj->getactivesheet()->setCellValue ( 'H2',$invoiceTrainingDetail['invoiceCompanyAmount'] );
  1725. $obj->getactivesheet()->setCellValue ( 'I2',$invoiceTrainingDetail['RIAmount'] );
  1726. }
  1727. //边框
  1728. $styleThinBlackBorderOutline = array(
  1729. 'borders' => array(
  1730. 'allborders' => array( //设置全部边框
  1731. 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
  1732. ),
  1733. ),);
  1734. $obj->getActiveSheet()->getStyle( 'A4:H'.$invoiceCount)->applyFromArray($styleThinBlackBorderOutline);
  1735. cellColor('A4', 'ddebf7',$obj);cellColor('B4', 'ddebf7',$obj);
  1736. cellColor('C4', 'ddebf7',$obj);cellColor('D4', 'ddebf7',$obj);
  1737. cellColor('E4', 'ddebf7',$obj);cellColor('F4', 'ddebf7',$obj);
  1738. cellColor('H4', 'ddebf7',$obj);cellColor('G4', 'ddebf7',$obj);
  1739. $obj->getactivesheet()->setCellValue ( 'A4','开票流水' );
  1740. $obj->getactivesheet()->setCellValue ( 'B4','开票单位(抬头)' );
  1741. $obj->getactivesheet()->setCellValue ( 'C4','发票号' );
  1742. $obj->getactivesheet()->setCellValue ( 'D4','总额' );
  1743. $obj->getactivesheet()->setCellValue ( 'E4','状态' );
  1744. $obj->getactivesheet()->setCellValue ( 'F4','办事处收款' );
  1745. $obj->getactivesheet()->setCellValue ( 'G4','收款流水号' );
  1746. $obj->getactivesheet()->setCellValue ( 'H4','收款银行到账' );
  1747. $i=5;$maxArray=array();
  1748. foreach ($invoiceList as $key=>$value){
  1749. $obj->getactivesheet()->setCellValue ( 'A'.$i,$value['invoiceSerial'] );
  1750. $title='';
  1751. if(!empty($value['invoiceType'])){
  1752. $title=$value['invoiceCompany'];
  1753. }else{
  1754. $title=$value['invoiceTitle'];
  1755. }
  1756. $obj->getactivesheet()->setCellValue ( 'B'.$i,$title );
  1757. $obj->getactivesheet()->setCellValue ( 'C'.$i,$value['invoiceNo'] );
  1758. if(!empty($value['invoiceType'])){
  1759. $obj->getactivesheet()->setCellValue ( 'D'.$i,'专'.$value['invoicePrice'] );
  1760. }else{
  1761. $obj->getactivesheet()->setCellValue ( 'D'.$i,$value['invoicePrice'] );
  1762. }
  1763. if($value['untreadStatus']==3){
  1764. $obj->getactivesheet()->setCellValue ( 'E'.$i,'已入账' );
  1765. }else{
  1766. $obj->getactivesheet()->setCellValue ( 'E'.$i,'已出票' );
  1767. }
  1768. if($value['untreadStatus']==3){
  1769. if($value['RIstatus']==1){
  1770. $obj->getactivesheet()->setCellValue ( 'F'.$i,'已收款' );
  1771. }
  1772. }else{
  1773. if($value['RIstatus']==1){
  1774. $obj->getactivesheet()->setCellValue ( 'F'.$i,'已收款' );
  1775. }
  1776. }
  1777. $receivablesSerial='';
  1778. $receivablesDate='';$hang=0;
  1779. if($value['untreadStatus']==3){
  1780. foreach ($value['irDetail'] as $k=>$v){
  1781. $receivablesSerial.=$v['receivablesSerial']."\r\n";
  1782. $receivablesDate.=$v['receivablesDate']."\r\n";
  1783. $hang+=8;
  1784. }
  1785. if($hang>8){
  1786. $obj->getActiveSheet()->getRowDimension($i)->setRowHeight(18+$hang);
  1787. }
  1788. }
  1789. $obj->getActiveSheet()->getStyle('H'.$i)->getAlignment()->setWrapText(true);
  1790. $obj->getActiveSheet()->getStyle('G'.$i)->getAlignment()->setWrapText(true);
  1791. $obj->getactivesheet()->setCellValue ( 'G'.$i,$receivablesSerial );
  1792. $obj->getactivesheet()->setCellValue ( 'H'.$i,$receivablesDate );
  1793. //按字体多少自动拉长单元格
  1794. array_push($maxArray, strlen($title));
  1795. $i++;
  1796. }
  1797. $ma=0;
  1798. if (!empty($maxArray)){
  1799. $ma=max($maxArray);
  1800. }
  1801. $max=$ma-10;$fontlenght=25;
  1802. if($max>25){
  1803. $fontlenght=$max;
  1804. }
  1805. $obj->getActiveSheet()->getColumnDimension('B')->setWidth($fontlenght);
  1806. $obj->getActiveSheet ()->setTitle ( '收入' );
  1807. }
  1808. function makeReceiptLoanData($obj,$receiptLoanList){
  1809. if (empty($receiptLoanList)){
  1810. $obj->getActiveSheet ()->setTitle ( '借款' );
  1811. return ;
  1812. }
  1813. $base=$lnBase=0;$lnKey=1;$lnBase=14;
  1814. //定义行倍数
  1815. $lnKey2=2;$lnKey3=3;$lnKey4=4;$lnKey5=5;
  1816. $lnKey6=6;$lnKey7=7;$lnKey8=8;$lnKey9=9;
  1817. $lnKey10=10;$lnKey11=11;$lnKey12=12;$lnKey13=13;
  1818. $lnKey14=14;
  1819. $obj->getActiveSheet()->getColumnDimension('A')->setWidth(35);
  1820. $obj->getActiveSheet()->getColumnDimension('B')->setWidth(35);
  1821. foreach ($receiptLoanList as $key=>$receiptLoanDetail){
  1822. $lineNumber=1;
  1823. $lineNumber=$lineNumber+$base;
  1824. $maxBase=$base+16;
  1825. //echo $maxBase.'<br/>';
  1826. for (;$lineNumber<=$maxBase;$lineNumber++){
  1827. $lineNumberDynamic = 'ln'.$lineNumber;
  1828. $$lineNumberDynamic=$lineNumber;
  1829. $obj->getActiveSheet()->getStyle('A'.$lineNumber.':B'.$lineNumber)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  1830. $obj->getActiveSheet()->getStyle('A'.$lineNumber.':B'.$lineNumber)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
  1831. $obj->getActiveSheet()->getRowDimension($lineNumber)->setRowHeight(18);
  1832. }
  1833. //正文
  1834. $receiptLoanDetail ['loanItem'] = json_decode ( $receiptLoanDetail ['loanItem'], true );
  1835. $receiptLoanDetail ['sumCN'] = num_to_rmb ( $receiptLoanDetail ['sum'] );
  1836. $receiptLoanDetail ['loanSumCN'] = num_to_rmb ( $receiptLoanDetail ['loanSum'] );
  1837. $receiptLoanDetail ['amountCN'] = num_to_rmb ( $receiptLoanDetail ['amount'] );
  1838. //echo $receiptLoanDetail ['sumCN'].'<br/>';
  1839. //边框
  1840. $styleThinBlackBorderOutline = array(
  1841. 'borders' => array(
  1842. 'allborders' => array( //设置全部边框
  1843. 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
  1844. ),
  1845. ),);
  1846. $obj->getActiveSheet()->getStyle( 'A'.${'ln'.$lnKey}.':B'.${'ln'.$lnBase})->applyFromArray($styleThinBlackBorderOutline);
  1847. //绘制颜色
  1848. cellColor('A'.${'ln'.$lnKey}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey3}, 'ddebf7',$obj);
  1849. cellColor('A'.${'ln'.$lnKey2}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey6}, 'ddebf7',$obj);
  1850. cellColor('A'.${'ln'.$lnKey7}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey8}, 'ddebf7',$obj);
  1851. cellColor('A'.${'ln'.$lnKey9}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey10}, 'ddebf7',$obj);
  1852. cellColor('A'.${'ln'.$lnKey5}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey11}, 'ddebf7',$obj);
  1853. //正文内容
  1854. $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey}.':B'.${'ln'.$lnKey});
  1855. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey},'借款费用' );
  1856. $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1857. $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey3}.':B'.${'ln'.$lnKey3});
  1858. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey3},'产生费用所在办事处' );
  1859. $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey3})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1860. $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey5}.':B'.${'ln'.$lnKey5});
  1861. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey5},'汇款信息' );
  1862. $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey5})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1863. $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey11}.':B'.${'ln'.$lnKey11});
  1864. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey11},'费用说明' );
  1865. $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey11})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1866. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey2},'借款费用' );
  1867. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey2},$receiptLoanDetail ['loanItem'] ['借款费用'] [0] ['price'] );
  1868. $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey4}.':B'.${'ln'.$lnKey4});
  1869. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey4},$receiptLoanDetail ['category'] [0] ['title'] );
  1870. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey6},'汇款人户名' );
  1871. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey7},'汇款银行' );
  1872. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey8},'汇款开户银行名称' );
  1873. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey9},'汇款帐号' );
  1874. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey10},'联行号' );
  1875. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey6},$receiptLoanDetail ['remittanceName'] );
  1876. if ($receiptLoanDetail ['remittanceBankType'] == 0){
  1877. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey7},'广发银行' );
  1878. }elseif ($receiptLoanDetail ['remittanceBankType'] == 1){
  1879. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey7},'其他' );
  1880. }
  1881. autoCellsWidth($obj,'B',$receiptLoanDetail ['bankName']);
  1882. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey8},$receiptLoanDetail ['bankName'] );
  1883. $obj->getActiveSheet()->setCellValueExplicit('B'.${'ln'.$lnKey9},$receiptLoanDetail ['bankNumber'],PHPExcel_Cell_DataType::TYPE_STRING);
  1884. //$obj->getactivesheet()->setCellValue ( 'B9',$receiptLoanDetail ['bankNumber'] );
  1885. if ($receiptLoanDetail ['remittanceBankType'] == 1){
  1886. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey10},$receiptLoanDetail ['coupletNumber'] );
  1887. }else{
  1888. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey10},'' );
  1889. }
  1890. $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey12}.':B'.${'ln'.$lnKey12});
  1891. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey12},$receiptLoanDetail ['explanation'] );
  1892. $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey13}.':B'.${'ln'.$lnKey13})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  1893. $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey14}.':B'.${'ln'.$lnKey14})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  1894. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey13},'(' . $receiptLoanDetail ['receiptOrder'] . ')本次费用合计' );
  1895. $obj->getActiveSheet()->getStyle('B'.${'ln'.$lnKey13})->getAlignment()->setWrapText(true);
  1896. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey13},"¥" . $receiptLoanDetail ['sum'] . "\r\n" . $receiptLoanDetail ['sumCN'] );
  1897. $obj->getActiveSheet()->getRowDimension(${'ln'.$lnKey13})->setRowHeight(36);
  1898. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey14},'汇款金额');
  1899. $obj->getActiveSheet()->getStyle('B'.${'ln'.$lnKey14})->getAlignment()->setWrapText(true);
  1900. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey14},"¥" . $receiptLoanDetail ['amount'] . "\r\n" . $receiptLoanDetail ['amountCN'] );
  1901. $obj->getActiveSheet()->getRowDimension(${'ln'.$lnKey14})->setRowHeight(36);
  1902. //绘制计算
  1903. $lnKey=$lnBase+2;$lnKey2=$lnBase+3;$lnKey3=$lnBase+4;$lnKey4=$lnBase+5;
  1904. $lnKey5=$lnBase+6;$lnKey6=$lnBase+7;$lnKey8=$lnBase+9;$lnKey9=$lnBase+10;
  1905. $lnKey10=$lnBase+11;$lnKey11=$lnBase+12;$lnKey12=$lnBase+13;$lnKey14=$lnBase+15;
  1906. $lnKey7=$lnBase+8;$lnKey13=$lnBase+14;
  1907. $lnBase=$lnKey+14;
  1908. $base+=15;
  1909. }
  1910. //die;
  1911. $obj->getActiveSheet ()->setTitle ( '借款' );
  1912. }
  1913. //绘制汇总
  1914. function makeSummaryData($obj,$summary,$aiList){
  1915. //设置居中
  1916. //$obj->getActiveSheet()->getStyle('A1:J1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1917. for($i=1;$i<=35;$i++){
  1918. $obj->getActiveSheet()->getStyle('A'.$i.':J'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1919. if ($i>=19){
  1920. $obj->getActiveSheet()->getStyle('A'.$i.':B'.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
  1921. }
  1922. }
  1923. //设置单元格宽
  1924. $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
  1925. $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
  1926. $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
  1927. $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
  1928. $obj->getActiveSheet()->getColumnDimension('E')->setWidth(25);
  1929. $obj->getActiveSheet()->getDefaultRowDimension()->setRowHeight(18);
  1930. $obj->getActiveSheet()->mergeCells('A1:A2');
  1931. $obj->getActiveSheet()->mergeCells('B1:C1');
  1932. $obj->getActiveSheet()->mergeCells('D1:E1');
  1933. $obj->getActiveSheet()->mergeCells('C2:C3');
  1934. $obj->getActiveSheet()->mergeCells('E2:E3');
  1935. $obj->getActiveSheet()->mergeCells('A6:E6');
  1936. $obj->getActiveSheet()->mergeCells('A10:E10');
  1937. $obj->getActiveSheet()->mergeCells('A15:E15');
  1938. $obj->getActiveSheet()->mergeCells('A16:E16');
  1939. //支出详情
  1940. $obj->getActiveSheet()->mergeCells('A18:C18');
  1941. $obj->getActiveSheet()->mergeCells('A19:A35');
  1942. cellColor('A1', 'ddebf7',$obj);cellColor('A2', 'ddebf7',$obj);
  1943. cellColor('B1', 'ddebf7',$obj);cellColor('B2', 'ddebf7',$obj);
  1944. cellColor('C2', 'ddebf7',$obj);cellColor('E2', 'ddebf7',$obj);
  1945. cellColor('D1', 'ddebf7',$obj);cellColor('D2', 'ddebf7',$obj);
  1946. cellColor('E3', 'ddebf7',$obj);cellColor('C3', 'ddebf7',$obj);
  1947. for ($i=3;$i<=15;$i++){
  1948. cellColor('A'.$i, 'ddebf7',$obj);
  1949. }
  1950. //支出详情
  1951. cellColor('A18', 'ddebf7',$obj);cellColor('D18', 'ddebf7',$obj);
  1952. cellColor('E18', 'ddebf7',$obj);cellColor('A19', 'ddebf7',$obj);
  1953. for ($i=19;$i<=35;$i++){
  1954. cellColor('B'.$i, 'ddebf7',$obj);
  1955. }
  1956. //边框
  1957. $styleThinBlackBorderOutline = array(
  1958. 'borders' => array(
  1959. 'allborders' => array( //设置全部边框
  1960. 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
  1961. ),
  1962. ),
  1963. );
  1964. $obj->getActiveSheet()->getStyle( 'A1:E16')->applyFromArray($styleThinBlackBorderOutline);
  1965. //支出详情
  1966. $obj->getActiveSheet()->getStyle( 'A18:E35')->applyFromArray($styleThinBlackBorderOutline);
  1967. $obj->getactivesheet()->setCellValue ( 'A1','汇总项目' );
  1968. $obj->getactivesheet()->setCellValue ( 'B1','收入按开票金额计算' );
  1969. $obj->getactivesheet()->setCellValue ( 'D1','收入按入账金额计算' );
  1970. $obj->getactivesheet()->setCellValue ( 'B2','金额' );
  1971. $obj->getactivesheet()->setCellValue ( 'C2','占比' );
  1972. $obj->getactivesheet()->setCellValue ( 'D2','金额' );
  1973. $obj->getactivesheet()->setCellValue ( 'E2','占比' );
  1974. $obj->getactivesheet()->setCellValue ( 'A3','收入' );
  1975. $obj->getactivesheet()->setCellValue ( 'A4','支出' );
  1976. $obj->getactivesheet()->setCellValue ( 'A5','利润' );
  1977. $obj->getactivesheet()->setCellValue ( 'A6','收入-支出=利润' );
  1978. $obj->getactivesheet()->setCellValue ( 'A7','公司利润' );
  1979. $obj->getactivesheet()->setCellValue ( 'A8','办事处利润' );
  1980. $obj->getactivesheet()->setCellValue ( 'A9','公司收款' );
  1981. $obj->getactivesheet()->setCellValue ( 'A10','收入×40%=办事处利润 收入×60%=公司利润' );
  1982. $obj->getactivesheet()->setCellValue ( 'A11','备用金(借款)' );
  1983. $obj->getactivesheet()->setCellValue ( 'A12','办事处收款' );
  1984. $obj->getactivesheet()->setCellValue ( 'A13','办事处实际支出' );
  1985. $obj->getactivesheet()->setCellValue ( 'A14','付总部款' );
  1986. $obj->getactivesheet()->setCellValue ( 'A15','备用金+办事处收款-办事处实际支出=付总部款' );
  1987. //支出详情
  1988. $obj->getactivesheet()->setCellValue ( 'A18','项目' );
  1989. $obj->getactivesheet()->setCellValue ( 'D18','金额' );
  1990. $obj->getactivesheet()->setCellValue ( 'E18','占入账金额比例' );
  1991. $obj->getactivesheet()->setCellValue ( 'A19','支出明细' );
  1992. $startKey=19;
  1993. foreach ($aiList as $key=>$value){
  1994. $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  1995. $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  1996. if($value['name']=='讲课费'){
  1997. $obj->getactivesheet()->setCellValue ( 'B'.$startKey,$value['name'] );
  1998. $obj->getActiveSheet()->mergeCells('B'.$startKey.':B'.($startKey+2));
  1999. $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  2000. $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2001. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'外聘' );
  2002. $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['outsideTaxPrice'] );
  2003. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['outsideTaxProportion'].'%' );
  2004. $startKey+=1;
  2005. $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2006. $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2007. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'外聘(不计税)' );
  2008. $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['outsideNoTaxPrice'] );
  2009. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['outsideNoTaxProportion'].'%' );
  2010. $startKey+=1;
  2011. $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2012. $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2013. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'员工' );
  2014. $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['insidePrice'] );
  2015. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['insideProportion'].'%' );
  2016. }elseif($value['name']=='办公费'){
  2017. $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  2018. $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2019. $obj->getactivesheet()->setCellValue ( 'B'.$startKey,$value['name'] );
  2020. $obj->getActiveSheet()->mergeCells('B'.$startKey.':B'.($startKey+1));
  2021. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'办事处支出' );
  2022. $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['categoryPrice'] );
  2023. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['categoryProportion'].'%' );
  2024. $startKey=$startKey+1;
  2025. $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2026. $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2027. $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['companyPrice'] );
  2028. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['companyProportion'].'%' );
  2029. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'公司支出' );
  2030. }elseif($value['name']=='邮寄费'){
  2031. $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  2032. $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2033. $obj->getactivesheet()->setCellValue ( 'B'.$startKey,$value['name'] );
  2034. $obj->getActiveSheet()->mergeCells('B'.$startKey.':B'.($startKey+1));
  2035. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'办事处支出' );
  2036. $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['categoryPrice'] );
  2037. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['categoryProportion'].'%' );
  2038. $startKey=$startKey+1;
  2039. $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2040. $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2041. $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['companyPrice'] );
  2042. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['companyProportion'].'%' );
  2043. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'公司支出' );
  2044. }else{
  2045. $obj->getActiveSheet()->mergeCells('C'.$startKey.':D'.$startKey);
  2046. $obj->getactivesheet()->setCellValue ( 'B'.$startKey,$value['name'] );
  2047. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,$value['priceFormat'] );
  2048. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['proportion'].'%' );
  2049. }
  2050. $startKey++;
  2051. }
  2052. //小计
  2053. $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2054. $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2055. $obj->getActiveSheet()->mergeCells('C'.$startKey.':D'.$startKey);
  2056. $obj->getactivesheet()->setCellValue ( 'B'.$startKey,'小计' );
  2057. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,$summary[11]['total'] );
  2058. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$summary[11]['totalProportion'].'%' );
  2059. $startKey=3;
  2060. //内容
  2061. foreach ($summary as $key=>$value){
  2062. $k=$key+$startKey;
  2063. if($k==3){
  2064. $obj->getactivesheet()->setCellValue ( 'B'.$k,$value['invoiceTotalAmount'] );
  2065. $obj->getactivesheet()->setCellValue ( 'D'.$k,$value['invoiceArriveAmount'] );
  2066. }elseif($k==15){
  2067. $k+=1;
  2068. $obj->getactivesheet()->setCellValue ( 'A'.$k,'学员:'.$value['participants'].'人 讲师:'.$value['lectureCount'].' 人' );
  2069. }elseif($k==16){
  2070. }elseif($k==6||$k==10){
  2071. $k+=1;
  2072. $startKey+=1;
  2073. $obj->getactivesheet()->setCellValue ( 'B'.$k,$value[1] );
  2074. $obj->getactivesheet()->setCellValue ( 'C'.$k,$value[2] );
  2075. $obj->getactivesheet()->setCellValue ( 'D'.$k,$value[3] );
  2076. $obj->getactivesheet()->setCellValue ( 'E'.$k,$value[4] );
  2077. }else{
  2078. $obj->getactivesheet()->setCellValue ( 'B'.$k,$value[1] );
  2079. $obj->getactivesheet()->setCellValue ( 'C'.$k,$value[2] );
  2080. $obj->getactivesheet()->setCellValue ( 'D'.$k,$value[3] );
  2081. $obj->getactivesheet()->setCellValue ( 'E'.$k,$value[4] );
  2082. }
  2083. }
  2084. $obj->getActiveSheet ()->setTitle ( '汇总表' );
  2085. }
  2086. function autoCellsWidth($obj,$cellsNub,$str){
  2087. $max=strlen($str)-10;$fontlenght=35;
  2088. if($max>35){
  2089. $fontlenght=$max;
  2090. }
  2091. $obj->getActiveSheet()->getColumnDimension($cellsNub)->setWidth($fontlenght);
  2092. }
  2093. ?>