receipt.func.php 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441
  1. <?php
  2. /*
  3. * 办事处汇总明细
  4. */
  5. function _getReceiptSummaryHtml($cglist,$aiAllList,$dataSummary,$year){
  6. $html=array();
  7. foreach ($cglist as $cgk=>$value){
  8. //初始化年合计数组
  9. foreach ($aiAllList as $yptempk=>$yptempv){
  10. $yearPriceArray[$value['cid']][$yptempk]=0;
  11. //栏目细则
  12. foreach ($yptempv as $k=>$v){
  13. $yearLawsPriceArray[$value['cid']][$yptempk][$v['name']]=0;
  14. }
  15. }
  16. //办事处每月数据展示
  17. $summaryDateHtml='';
  18. for($month=1;$month<=12;$month++){
  19. $summaryDateHtml.='<tr>';
  20. $summaryDateHtml.='<th>'.$value['title'].$month.'月合计</th>
  21. <td class="taR"></td>
  22. <td class="taR"></td>
  23. <td class="taR"></td>
  24. <td class="taR"></td>
  25. <td class="taR"></td>
  26. <td class="taR colGreen"></td>';
  27. $itemHtml='';
  28. if(isset($dataSummary[$value['cid']])){
  29. foreach ($aiAllList as $aiak=>$aiav){//总项目
  30. $tempHtml='';$tempPrice=0;
  31. foreach ($aiav as $k=>$v){//项目细则
  32. $falg=true;
  33. foreach ($dataSummary[$value['cid']][$month][$aiak] as $dsk=>$dsv){//数据实体
  34. if($dsv['item']==$v['name']){
  35. $tempHtml.='<td class="taR">'.$dsv['price'].'</td>';
  36. $tempPrice+=$dsv['price'];
  37. $yearLawsPriceArray[$value['cid']][$aiak][$v['name']]+=$dsv['price'];//该办事处项目细则金额合计
  38. $falg=false;
  39. break;
  40. }
  41. }
  42. if($falg){
  43. $tempHtml.='<td class="taR"></td>';
  44. }
  45. }
  46. $yearPriceArray[$value['cid']][$aiak]+=$tempPrice;
  47. $itemHtml.='<td class="taR colRed">'.$tempPrice.'</td>';//每个月份 项目金额合计
  48. $itemHtml.=$tempHtml;//每个月份项目细则金额
  49. }
  50. }else{
  51. foreach ($aiAllList as $aiak=>$aiav){
  52. $itemHtml.='<td class="taR colRed"></td>';
  53. foreach ($aiav as $k=>$v){
  54. $itemHtml.='<td class="taR"></td>';
  55. }
  56. }
  57. }
  58. $summaryDateHtml.=$itemHtml;
  59. $summaryDateHtml.='</tr>';
  60. }
  61. //办事处全年合计---全年全办事处合计
  62. $summaryYearHtml='<tr><th>'.$value['title'].'年合计</th>
  63. <td class="taR"></td>
  64. <td class="taR"></td>
  65. <td class="taR"></td>
  66. <td class="taR"></td>
  67. <td class="taR"></td>
  68. <td class="taR colGreen"></td>';
  69. foreach ($aiAllList as $aalk=>$aalv){
  70. if(!isset($topYearPrice[$aalk])){
  71. $topYearPrice[$aalk]=0;
  72. }
  73. //栏目
  74. $summaryYearHtml.='<td class="taR colRed">'.$yearPriceArray[$value['cid']][$aalk].'</td>';
  75. $topYearPrice[$aalk]+=$yearPriceArray[$value['cid']][$aalk];
  76. //栏目细则
  77. foreach ($aalv as $k=>$v){
  78. if(!isset($topYearLawsPrice[$aalk][$v['name']])){
  79. $topYearLawsPrice[$aalk][$v['name']]=0;
  80. }
  81. $summaryYearHtml.='<th>'.$yearLawsPriceArray[$value['cid']][$aalk][$v['name']].'</th>';
  82. $topYearLawsPrice[$aalk][$v['name']]+=$yearLawsPriceArray[$value['cid']][$aalk][$v['name']];
  83. }
  84. }
  85. $summaryYearHtml.='</tr>';
  86. $html[$value['cid']]['total']=$summaryYearHtml;
  87. $html[$value['cid']]['allMonth']=$summaryDateHtml;
  88. //$html.=$summaryYearHtml;//办事处合计
  89. //$html.=$summaryDateHtml;//办事处每月合计
  90. }
  91. //全办事处全年合计
  92. $topYearTempHtml='<tr><th>'.$year.'年合计</th>
  93. <td class="taR"></td><td class="taR"></td><td class="taR"></td><td class="taR"></td><td class="taR"></td>
  94. <td class="taR colGreen"></td>';
  95. foreach ($aiAllList as $aalk=>$aalv){
  96. //栏目
  97. $topYearTempHtml.='<td class="taR colRed">'.$topYearPrice[$aalk].'</td>';
  98. //栏目细则
  99. foreach ($aalv as $k=>$v){
  100. $topYearTempHtml.='<th>'.$topYearLawsPrice[$aalk][$v['name']].'</th>';
  101. }
  102. }
  103. //各办事处占比
  104. $topYearTempHtml.='</tr>';
  105. $topHtml='';
  106. $topHtml.=$topYearTempHtml;//全年合计
  107. return $topHtml;
  108. }
  109. /**
  110. * 获得借款单详情
  111. */
  112. function _getReceiptLoanHtml($receiptDetail, $verifylist, $extendHtml = '') {
  113. $receiptDetail ['loanItem'] = json_decode ( $receiptDetail ['loanItem'], true );
  114. $receiptDetail ['sumCN'] = num_to_rmb ( $receiptDetail ['sum'] );
  115. $receiptDetail ['loanSumCN'] = num_to_rmb ( $receiptDetail ['loanSum'] );
  116. $receiptDetail ['amountCN'] = num_to_rmb ( $receiptDetail ['amount'] );
  117. $executeCopy = getExecuteStaff ( $receiptDetail );
  118. // print_r ( $executeCopy );
  119. $html = '<div class="saeaList">
  120. <div class="entry loan-list" style="margin-bottom: 50px">
  121. <div class="seal"></div>
  122. <div class="seTable">
  123. <table class="table table-bordered table-condensed table-hover">
  124. <tbody>
  125. <tr>
  126. <th colspan="2" class="taC">借款费用</th>
  127. </tr>
  128. <tr>
  129. <th>借款费用</th>
  130. <td class="taR" width="140">¥' . $receiptDetail ['loanItem'] ['借款费用'] [0] ['price'] . '</td>
  131. </tr>
  132. <tr>
  133. <th class="taC" colspan="2">产生费用所在办事处</th>
  134. </tr>
  135. <tr>
  136. <th style="text-align: center" colspan="2">' . $receiptDetail ['category'] [0] ['title'] . '</th>
  137. </tr>
  138. <tr>
  139. <th colspan="2" class="taC">汇款信息</th>
  140. </tr>
  141. <tr>
  142. <th>汇款人户名</th>
  143. <td>' . $receiptDetail ['remittanceName'] . '</td>
  144. </tr>
  145. <tr>
  146. <th>汇款银行</th>';
  147. if ($receiptDetail ['remittanceBankType'] == 0)
  148. $html .= '<td>广发银行</td>';
  149. elseif ($receiptDetail ['remittanceBankType'] == 1)
  150. $html .= '<td>其他</td>';
  151. $html .= '</tr>
  152. <tr>
  153. <th>汇款开户银行名称</th>
  154. <td>' . $receiptDetail ['bankName'] . '</td>
  155. </tr>
  156. <tr>
  157. <th>汇款帐号</th>
  158. <td>' . $receiptDetail ['bankNumber'] . '</td>
  159. </tr>';
  160. if ($receiptDetail ['remittanceBankType'] == 1)
  161. $html .= '<tr>
  162. <th>联行号</th>
  163. <td>' . $receiptDetail ['coupletNumber'] . '</td>
  164. </tr>';
  165. $html .= '<tr>
  166. <th class="taC" colspan="2">费用说明</th>
  167. </tr>
  168. <tr>
  169. <td colspan="2">' . $receiptDetail ['explanation'] . '</td>
  170. </tr>
  171. <tr class="warning">
  172. <td class="taR"><b>(' . $receiptDetail ['receiptOrder'] . ')本次费用合计</b></td>
  173. <td class="taR"><b style="font-size: 24px">¥' . $receiptDetail ['sum'] . '</b><br>' . $receiptDetail ['sumCN'] . '</td>
  174. </tr>
  175. <tr class="warning">
  176. <td class="taR"><b>汇款金额</b></td>
  177. <td class="taR" width="140"><b style="font-size: 24px">¥' . $receiptDetail ['amount'] . '</b><br>' . $receiptDetail ['amountCN'] . '</td>
  178. </tr>
  179. </tbody>
  180. </table>
  181. </div>
  182. <div class="seCensor loan-censor">
  183. <div class="title">' . $receiptDetail ['receiptOrder'] . '</div>
  184. <div class="censorList clearfix censorHeight" style="height: 548px;">
  185. <ul>
  186. <li class="post">
  187. <div class="avtra">
  188. <img src="' . $receiptDetail ['staffDetail'] ['avatar'] . '_2.jpg" width="32">
  189. </div>
  190. <div class="comment">
  191. <p>
  192. <span class="fR">' . $receiptDetail ['date'] . '</span>' . $receiptDetail ['staffDetail'] ['username'] . '
  193. </p>
  194. <p>提交审批</p>
  195. </div>
  196. </li>';
  197. foreach ( $verifylist as $key => $value ) {
  198. $html .= '<li ';
  199. if ($value ['status'] == 1) {
  200. $html .= 'class="done"';
  201. } elseif ($value ['status'] == 3) {
  202. $html .= 'class="undone"';
  203. }
  204. $html .= '>
  205. <div class="avtra">
  206. <img src="' . $value [2] . '_2.jpg" width="32">
  207. </div>
  208. <div class="comment">
  209. <p class="colGray">
  210. <span class="fR">' . $value ['date'] . '</span>' . $value [1] . '';
  211. if (isset ( $value ['rolename'] )) {
  212. $html .= '(' . $value ['rolename'] . ')';
  213. }
  214. $html .= '</p>
  215. <p>' . $value ['opinion'] . '</p>
  216. </div>
  217. </li>';
  218. }
  219. foreach ( $executeCopy as $key => $value ) {
  220. $html .= '<li ';
  221. if ($value ['status'] == 1) {
  222. $html .= 'class="done"';
  223. } elseif ($value ['status'] == 3) {
  224. $html .= 'class="undone"';
  225. }
  226. $html .= '>
  227. <div class="avtra">
  228. <img src="' . $value [2] . '_2.jpg" width="32">
  229. </div>
  230. <div class="comment">
  231. <p class="colGray">
  232. <span class="fR">' . $value ['date'] . '</span>' . $value [1] . '(费用执行)
  233. </p>
  234. <p>' . $value ['opinion'] . '</p>
  235. </div>
  236. </li>';
  237. }
  238. $html .= '
  239. </ul>
  240. </div>
  241. </div>
  242. </div>
  243. ' . $extendHtml . '
  244. </div>';
  245. return $html;
  246. }
  247. function _getPaymentsCollectPayByYearHtml($statisticsPay = array()) {
  248. $html = '';
  249. $subtotalSum = array (
  250. 1 => 0,
  251. 2 => 0,
  252. 3 => 0,
  253. 4 => 0,
  254. 5 => 0,
  255. 6 => 0,
  256. 7 => 0,
  257. 8 => 0,
  258. 9 => 0,
  259. 10 => 0,
  260. 11 => 0,
  261. 12 => 0
  262. );
  263. for($i = 1; $i <= 15; $i ++) {
  264. if ($i == 1) {
  265. $html = '<tr><th colspan="2" >银行手续费</th>';
  266. $sum = 0;
  267. for($month = 1; $month <= 12; $month ++) {
  268. $falg = true;
  269. foreach ( $statisticsPay as $key => $value ) {
  270. if ($value ['expenditureMsg'] == '' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
  271. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  272. $sum += $value ['payPrice'];
  273. $subtotalSum [$month] += $value ['payPrice'];
  274. $falg = false;
  275. break;
  276. }
  277. }
  278. if ($falg)
  279. $html .= '<td class="taR">-</td>';
  280. }
  281. if ($sum == 0)
  282. $html .= '<td class="taR">-</td>';
  283. else
  284. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  285. $html .= '</tr>';
  286. } elseif ($i == 2) {
  287. $html .= '<tr><th colspan="2" >总部电话费</th>';
  288. $sum = 0;
  289. for($month = 1; $month <= 12; $month ++) {
  290. $falg = true;
  291. foreach ( $statisticsPay as $key => $value ) {
  292. if ($value ['expenditureMsg'] == '' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
  293. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  294. $sum += $value ['payPrice'];
  295. $subtotalSum [$month] += $value ['payPrice'];
  296. $falg = false;
  297. break;
  298. }
  299. }
  300. if ($falg)
  301. $html .= '<td class="taR">-</td>';
  302. }
  303. if ($sum == 0)
  304. $html .= '<td class="taR">-</td>';
  305. else
  306. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  307. $html .= '</tr>';
  308. } elseif ($i == 3) {
  309. $subtotal = array (
  310. 1 => 0,
  311. 2 => 0,
  312. 3 => 0,
  313. 4 => 0,
  314. 5 => 0,
  315. 6 => 0,
  316. 7 => 0,
  317. 8 => 0,
  318. 9 => 0,
  319. 10 => 0,
  320. 11 => 0,
  321. 12 => 0
  322. );
  323. $html .= '<tr><th rowspan="4" width="90">缴税</th>';
  324. $html .= '<th width="90">增值税</th>';
  325. $sum = 0;
  326. for($month = 1; $month <= 12; $month ++) {
  327. $falg = true;
  328. foreach ( $statisticsPay as $key => $value ) {
  329. if ($value ['expenditureMsg'] == '增值税' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
  330. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  331. $sum += $value ['payPrice'];
  332. $subtotal [$month] += $value ['payPrice'];
  333. $falg = false;
  334. break;
  335. }
  336. }
  337. if ($falg)
  338. $html .= '<td class="taR">-</td>';
  339. }
  340. if ($sum == 0)
  341. $html .= '<td class="taR">-</td>';
  342. else
  343. $html .= '<td class="taR">¥' . $sum . '</td>';
  344. $html .= '</tr>';
  345. $html .= '<th width="90">税金附加</th>';
  346. $sum = 0;
  347. for($month = 1; $month <= 12; $month ++) {
  348. $falg = true;
  349. foreach ( $statisticsPay as $key => $value ) {
  350. if ($value ['expenditureMsg'] == '税金附加' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
  351. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  352. $sum += $value ['payPrice'];
  353. $subtotal [$month] += $value ['payPrice'];
  354. $falg = false;
  355. break;
  356. }
  357. }
  358. if ($falg)
  359. $html .= '<td class="taR">-</td>';
  360. }
  361. if ($sum == 0)
  362. $html .= '<td class="taR">-</td>';
  363. else
  364. $html .= '<td class="taR">¥' . $sum . '</td>';
  365. $html .= '</tr>';
  366. $html .= '<th width="90">企业所得税</th>';
  367. $sum = 0;
  368. for($month = 1; $month <= 12; $month ++) {
  369. $falg = true;
  370. foreach ( $statisticsPay as $key => $value ) {
  371. if ($value ['expenditureMsg'] == '企业所得税' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
  372. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  373. $sum += $value ['payPrice'];
  374. $subtotal [$month] += $value ['payPrice'];
  375. $falg = false;
  376. break;
  377. }
  378. }
  379. if ($falg)
  380. $html .= '<td class="taR">-</td>';
  381. }
  382. if ($sum == 0)
  383. $html .= '<td class="taR">-</td>';
  384. else
  385. $html .= '<td class="taR">¥' . $sum . '</td>';
  386. $html .= '</tr>';
  387. $html .= '<th width="90" class="colRed">小计</th>';
  388. $sum = 0;
  389. for($month = 1; $month <= 12; $month ++) {
  390. $sum += $subtotal [$month];
  391. $subtotalSum [$month] += $subtotal [$month];
  392. if (! empty ( $subtotal [$month] ))
  393. $html .= '<td class="taR colRed">¥' . $subtotal [$month] . '</td>';
  394. else
  395. $html .= '<td class="taR">-</td>';
  396. }
  397. if ($sum == 0)
  398. $html .= '<td class="taR">-</td>';
  399. else
  400. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  401. $html .= '</tr>';
  402. } elseif ($i == 5) {
  403. $html .= '<tr><th colspan="2" >保证金</th>';
  404. $sum = 0;
  405. for($month = 1; $month <= 12; $month ++) {
  406. $falg = true;
  407. foreach ( $statisticsPay as $key => $value ) {
  408. if ($value ['expenditureMsg'] == '' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
  409. $html .= '<td class="taR">¥' . abs ( $value ['payPrice'] ) . '</td>';
  410. $sum += abs ( $value ['payPrice'] );
  411. $subtotalSum [$month] += abs ( $value ['payPrice'] );
  412. $falg = false;
  413. break;
  414. }
  415. }
  416. if ($falg)
  417. $html .= '<td class="taR">-</td>';
  418. }
  419. if ($sum == 0)
  420. $html .= '<td class="taR">-</td>';
  421. else
  422. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  423. $html .= '</tr>';
  424. }
  425. }
  426. $html .= '<tr><th class="taR" colspan="2">合计</th>';
  427. $sum = 0;
  428. foreach ( $subtotalSum as $key => $value ) {
  429. $sum += $value;
  430. if (! empty ( $value ))
  431. $html .= '<td class="taR colGreen">¥' . $value . '</td>';
  432. else
  433. $html .= '<td class="taR">-</td>';
  434. }
  435. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  436. $html .= '</tr>';
  437. $html .= '<tr class="warning"><td class="taR" colspan="2"><b>全年合计</b></td>
  438. <td class="colGreed taR" colspan="14"><b style="font-size:24px">¥' . $sum . '</b></td></tr>';
  439. return array (
  440. 'html' => $html,
  441. 'sum' => $sum
  442. );
  443. }
  444. /**
  445. * 获得汇总 日常收支年
  446. * @param array $statisticsIncome
  447. * @return string
  448. */
  449. function _getPaymentsCollectByYearHtml($statisticsIncome = array()) {
  450. $html = '';
  451. $subtotalSum = array (
  452. 1 => 0,
  453. 2 => 0,
  454. 3 => 0,
  455. 4 => 0,
  456. 5 => 0,
  457. 6 => 0,
  458. 7 => 0,
  459. 8 => 0,
  460. 9 => 0,
  461. 10 => 0,
  462. 11 => 0,
  463. 12 => 0
  464. );
  465. for($i = 1; $i <= 15; $i ++) {
  466. if ($i == 1) {
  467. $subtotal = array (
  468. 1 => 0,
  469. 2 => 0,
  470. 3 => 0,
  471. 4 => 0,
  472. 5 => 0,
  473. 6 => 0,
  474. 7 => 0,
  475. 8 => 0,
  476. 9 => 0,
  477. 10 => 0,
  478. 11 => 0,
  479. 12 => 0
  480. );
  481. $html .= '<tr><th rowspan="4" width="90">利息收入</th>';
  482. $html .= '<th width="90">银行存款</th>';
  483. $sum = 0;
  484. for($month = 1; $month <= 12; $month ++) {
  485. $falg = true;
  486. foreach ( $statisticsIncome as $key => $value ) {
  487. if ($value ['accountMsg'] == '银行存款' && $value ['month'] == $month && $value ['accountType'] == $i) {
  488. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  489. $sum += $value ['inComePrice'];
  490. $subtotal [$month] += $value ['inComePrice'];
  491. $falg = false;
  492. break;
  493. }
  494. }
  495. if ($falg)
  496. $html .= '<td class="taR">-</td>';
  497. }
  498. if ($sum == 0)
  499. $html .= '<td class="taR">-</td>';
  500. else
  501. $html .= '<td class="taR">¥' . $sum . '</td>';
  502. $html .= '</tr>';
  503. $html .= '<th width="90">活期理财收益</th>';
  504. $sum = 0;
  505. for($month = 1; $month <= 12; $month ++) {
  506. $falg = true;
  507. foreach ( $statisticsIncome as $key => $value ) {
  508. if ($value ['accountMsg'] == '活期理财收益' && $value ['month'] == $month && $value ['accountType'] == $i) {
  509. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  510. $sum += $value ['inComePrice'];
  511. $subtotal [$month] += $value ['inComePrice'];
  512. $falg = false;
  513. break;
  514. }
  515. }
  516. if ($falg)
  517. $html .= '<td class="taR">-</td>';
  518. }
  519. if ($sum == 0)
  520. $html .= '<td class="taR">-</td>';
  521. else
  522. $html .= '<td class="taR">¥' . $sum . '</td>';
  523. $html .= '</tr>';
  524. $html .= '<th width="90">固定理财收益</th>';
  525. $sum = 0;
  526. for($month = 1; $month <= 12; $month ++) {
  527. $falg = true;
  528. foreach ( $statisticsIncome as $key => $value ) {
  529. if ($value ['accountMsg'] == '固定理财收益' && $value ['month'] == $month && $value ['accountType'] == $i) {
  530. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  531. $sum += $value ['inComePrice'];
  532. $subtotal [$month] += $value ['inComePrice'];
  533. $falg = false;
  534. break;
  535. }
  536. }
  537. if ($falg)
  538. $html .= '<td class="taR">-</td>';
  539. }
  540. if ($sum == 0)
  541. $html .= '<td class="taR">-</td>';
  542. else
  543. $html .= '<td class="taR">¥' . $sum . '</td>';
  544. $html .= '</tr>';
  545. $html .= '<th width="90">个人借款</th>';
  546. $sum = 0;
  547. for($month = 1; $month <= 12; $month ++) {
  548. $falg = true;
  549. foreach ( $statisticsIncome as $key => $value ) {
  550. if ($value ['accountMsg'] == '个人借款' && $value ['month'] == $month && $value ['accountType'] == $i) {
  551. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  552. $sum += $value ['inComePrice'];
  553. $subtotal [$month] += $value ['inComePrice'];
  554. $falg = false;
  555. break;
  556. }
  557. }
  558. if ($falg)
  559. $html .= '<td class="taR">-</td>';
  560. }
  561. if ($sum == 0)
  562. $html .= '<td class="taR">-</td>';
  563. else
  564. $html .= '<td class="taR">¥' . $sum . '</td>';
  565. $html .= '</tr>';
  566. $html .= '<th width="90" class="colGreen">小计</th>';
  567. $sum = 0;
  568. for($month = 1; $month <= 12; $month ++) {
  569. $sum += $subtotal [$month];
  570. $subtotalSum [$month] += $subtotal [$month];
  571. if (! empty ( $subtotal [$month] ))
  572. $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
  573. else
  574. $html .= '<td class="taR">-</td>';
  575. }
  576. if ($sum == 0)
  577. $html .= '<td class="taR">-</td>';
  578. else
  579. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  580. $html .= '</tr>';
  581. } elseif ($i == 2) {
  582. $subtotal = array (
  583. 1 => 0,
  584. 2 => 0,
  585. 3 => 0,
  586. 4 => 0,
  587. 5 => 0,
  588. 6 => 0,
  589. 7 => 0,
  590. 8 => 0,
  591. 9 => 0,
  592. 10 => 0,
  593. 11 => 0,
  594. 12 => 0
  595. );
  596. $html .= '<tr><th rowspan="3" width="90">补贴收入</th>';
  597. $html .= '<th width="90">社保</th>';
  598. $sum = 0;
  599. for($month = 1; $month <= 12; $month ++) {
  600. $falg = true;
  601. foreach ( $statisticsIncome as $key => $value ) {
  602. if ($value ['accountMsg'] == '社保' && $value ['month'] == $month && $value ['accountType'] == $i) {
  603. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  604. $sum += $value ['inComePrice'];
  605. $subtotal [$month] += $value ['inComePrice'];
  606. $falg = false;
  607. break;
  608. }
  609. }
  610. if ($falg)
  611. $html .= '<td class="taR">-</td>';
  612. }
  613. if ($sum == 0)
  614. $html .= '<td class="taR">-</td>';
  615. else
  616. $html .= '<td class="taR">¥' . $sum . '</td>';
  617. $html .= '</tr>';
  618. $html .= '<th width="90">财政</th>';
  619. $sum = 0;
  620. for($month = 1; $month <= 12; $month ++) {
  621. $falg = true;
  622. foreach ( $statisticsIncome as $key => $value ) {
  623. if ($value ['accountMsg'] == '财政' && $value ['month'] == $month && $value ['accountType'] == $i) {
  624. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  625. $sum += $value ['inComePrice'];
  626. $subtotal [$month] += $value ['inComePrice'];
  627. $falg = false;
  628. break;
  629. }
  630. }
  631. if ($falg)
  632. $html .= '<td class="taR">-</td>';
  633. }
  634. if ($sum == 0)
  635. $html .= '<td class="taR">-</td>';
  636. else
  637. $html .= '<td class="taR">¥' . $sum . '</td>';
  638. $html .= '</tr>';
  639. $html .= '<th width="90" class="colGreen">小计</th>';
  640. $sum = 0;
  641. for($month = 1; $month <= 12; $month ++) {
  642. $sum += $subtotal [$month];
  643. $subtotalSum [$month] += $subtotal [$month];
  644. if (! empty ( $subtotal [$month] ))
  645. $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
  646. else
  647. $html .= '<td class="taR">-</td>';
  648. }
  649. if ($sum == 0)
  650. $html .= '<td class="taR">-</td>';
  651. else
  652. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  653. $html .= '</tr>';
  654. } elseif ($i == 3) {
  655. $html .= '<tr><th colspan="2" >纵横知道</th>';
  656. $sum = 0;
  657. for($month = 1; $month <= 12; $month ++) {
  658. $falg = true;
  659. foreach ( $statisticsIncome as $key => $value ) {
  660. if ($value ['accountMsg'] == '' && $value ['month'] == $month && $value ['accountType'] == $i) {
  661. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  662. $sum += $value ['inComePrice'];
  663. $subtotalSum [$month] += $value ['inComePrice'];
  664. $falg = false;
  665. break;
  666. }
  667. }
  668. if ($falg)
  669. $html .= '<td class="taR">-</td>';
  670. }
  671. if ($sum == 0)
  672. $html .= '<td class="taR">-</td>';
  673. else
  674. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  675. $html .= '</tr>';
  676. } elseif ($i == 4) {
  677. $subtotal = array (
  678. 1 => 0,
  679. 2 => 0,
  680. 3 => 0,
  681. 4 => 0,
  682. 5 => 0,
  683. 6 => 0,
  684. 7 => 0,
  685. 8 => 0,
  686. 9 => 0,
  687. 10 => 0,
  688. 11 => 0,
  689. 12 => 0
  690. );
  691. $html .= '<tr><th rowspan="3" width="90">借款收回</th>';
  692. $html .= '<th width="90">备用金</th>';
  693. $sum = 0;
  694. for($month = 1; $month <= 12; $month ++) {
  695. $falg = true;
  696. foreach ( $statisticsIncome as $key => $value ) {
  697. if ($value ['accountMsg'] == '备用金' && $value ['month'] == $month && $value ['accountType'] == $i) {
  698. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  699. $sum += $value ['inComePrice'];
  700. $subtotal [$month] += $value ['inComePrice'];
  701. $falg = false;
  702. break;
  703. }
  704. }
  705. if ($falg)
  706. $html .= '<td class="taR">-</td>';
  707. }
  708. if ($sum == 0)
  709. $html .= '<td class="taR">-</td>';
  710. else
  711. $html .= '<td class="taR">¥' . $sum . '</td>';
  712. $html .= '</tr>';
  713. $html .= '<th width="90">私人借款</th>';
  714. $sum = 0;
  715. for($month = 1; $month <= 12; $month ++) {
  716. $falg = true;
  717. foreach ( $statisticsIncome as $key => $value ) {
  718. if ($value ['accountMsg'] == '私人借款' && $value ['month'] == $month && $value ['accountType'] == $i) {
  719. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  720. $sum += $value ['inComePrice'];
  721. $subtotal [$month] += $value ['inComePrice'];
  722. $falg = false;
  723. break;
  724. }
  725. }
  726. if ($falg)
  727. $html .= '<td class="taR">-</td>';
  728. }
  729. if ($sum == 0)
  730. $html .= '<td class="taR">-</td>';
  731. else
  732. $html .= '<td class="taR">¥' . $sum . '</td>';
  733. $html .= '</tr>';
  734. $html .= '<th width="90" class="colGreen">小计</th>';
  735. $sum = 0;
  736. for($month = 1; $month <= 12; $month ++) {
  737. $sum += $subtotal [$month];
  738. $subtotalSum [$month] += $subtotal [$month];
  739. if (! empty ( $subtotal [$month] ))
  740. $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
  741. else
  742. $html .= '<td class="taR">-</td>';
  743. }
  744. if ($sum == 0)
  745. $html .= '<td class="taR">-</td>';
  746. else
  747. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  748. $html .= '</tr>';
  749. } elseif ($i == 5) {
  750. $html .= '<tr><th colspan="2" >退汇</th>';
  751. $sum = 0;
  752. for($month = 1; $month <= 12; $month ++) {
  753. $falg = true;
  754. foreach ( $statisticsIncome as $key => $value ) {
  755. if ($value ['accountMsg'] == '' && $value ['month'] == $month && $value ['accountType'] == $i) {
  756. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  757. $sum += $value ['inComePrice'];
  758. $subtotalSum [$month] += $value ['inComePrice'];
  759. $falg = false;
  760. break;
  761. }
  762. }
  763. if ($falg)
  764. $html .= '<td class="taR">-</td>';
  765. }
  766. if ($sum == 0)
  767. $html .= '<td class="taR">-</td>';
  768. else
  769. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  770. $html .= '</tr>';
  771. } elseif ($i == 6) {
  772. $html .= '<tr><th colspan="2" >其他</th>';
  773. $sum = 0;
  774. for($month = 1; $month <= 12; $month ++) {
  775. $falg = true;
  776. foreach ( $statisticsIncome as $key => $value ) {
  777. if ($value ['accountMsg'] == '' && $value ['month'] == $month && $value ['accountType'] == $i) {
  778. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  779. $sum += $value ['inComePrice'];
  780. $subtotalSum [$month] += $value ['inComePrice'];
  781. $falg = false;
  782. break;
  783. }
  784. }
  785. if ($falg)
  786. $html .= '<td class="taR">-</td>';
  787. }
  788. if ($sum == 0)
  789. $html .= '<td class="taR">-</td>';
  790. else
  791. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  792. $html .= '</tr>';
  793. } elseif ($i == 8) {
  794. $html .= '<tr><th colspan="2" >保证金</th>';
  795. $sum = 0;
  796. for($month = 1; $month <= 12; $month ++) {
  797. $falg = true;
  798. foreach ( $statisticsIncome as $key => $value ) {
  799. if ($value ['accountMsg'] == '' && $value ['month'] == $month && $value ['accountType'] == $i) {
  800. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  801. $sum += $value ['inComePrice'];
  802. $subtotalSum [$month] += $value ['inComePrice'];
  803. $falg = false;
  804. break;
  805. }
  806. }
  807. if ($falg)
  808. $html .= '<td class="taR">-</td>';
  809. }
  810. if ($sum == 0)
  811. $html .= '<td class="taR">-</td>';
  812. else
  813. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  814. $html .= '</tr>';
  815. }
  816. }
  817. $html .= '<tr><th class="taR" colspan="2">合计</th>';
  818. $sum = 0;
  819. foreach ( $subtotalSum as $key => $value ) {
  820. $sum += $value;
  821. if (! empty ( $value ))
  822. $html .= '<td class="taR colGreen">¥' . $value . '</td>';
  823. else
  824. $html .= '<td class="taR">-</td>';
  825. }
  826. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  827. $html .= '</tr>';
  828. $html .= '<tr class="warning"><td class="taR" colspan="2"><b>全年合计</b></td>
  829. <td class="colGreed taR" colspan="14"><b style="font-size:24px">¥' . $sum . '</b></td></tr>';
  830. return array (
  831. 'html' => $html,
  832. 'sum' => $sum
  833. );
  834. }
  835. /**
  836. * 获得汇总 日常收支年
  837. * @param array $statisticsIncome
  838. * @return string
  839. */
  840. function _getPaymentsCollectByDayHtml($statisticsIncome = array(), $day = 0) {
  841. $html = '<tr><th class="taC" colspan="2">日常收入</th>';
  842. for($d = 1; $d <= $day; $d ++) {
  843. $subtotalSum [$d] = 0;
  844. $html .= '<th class="taC" width="80">' . $d . '日</th>';
  845. }
  846. $html .= '<th class="taC" width="110">总计</th></tr>';
  847. for($i = 1; $i <= 15; $i ++) {
  848. if ($i == 1) {
  849. for($d = 1; $d <= $day; $d ++) {
  850. $subtotal [$d] = 0;
  851. }
  852. // $subtotal = array (
  853. // 1 => 0,
  854. // 2 => 0,
  855. // 3 => 0,
  856. // 4 => 0,
  857. // 5 => 0,
  858. // 6 => 0,
  859. // 7 => 0,
  860. // 8 => 0,
  861. // 9 => 0,
  862. // 10 => 0,
  863. // 11 => 0,
  864. // 12 => 0
  865. // );
  866. $html .= '<tr><th rowspan="4" width="90">利息收入</th>';
  867. $html .= '<th width="90">银行存款</th>';
  868. $sum = 0;
  869. for($month = 1; $month <= $day; $month ++) {
  870. $falg = true;
  871. foreach ( $statisticsIncome as $key => $value ) {
  872. if ($value ['accountMsg'] == '银行存款' && $value ['day'] == $month && $value ['accountType'] == $i) {
  873. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  874. $sum += $value ['inComePrice'];
  875. $subtotal [$month] += $value ['inComePrice'];
  876. $falg = false;
  877. break;
  878. }
  879. }
  880. if ($falg)
  881. $html .= '<td class="taR">-</td>';
  882. }
  883. if ($sum == 0)
  884. $html .= '<td class="taR">-</td>';
  885. else
  886. $html .= '<td class="taR">¥' . $sum . '</td>';
  887. $html .= '</tr>';
  888. $html .= '<th width="90">理财收益</th>';
  889. $sum = 0;
  890. for($month = 1; $month <= $day; $month ++) {
  891. $falg = true;
  892. foreach ( $statisticsIncome as $key => $value ) {
  893. if ($value ['accountMsg'] == '理财收益' && $value ['day'] == $month && $value ['accountType'] == $i) {
  894. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  895. $sum += $value ['inComePrice'];
  896. $subtotal [$month] += $value ['inComePrice'];
  897. $falg = false;
  898. break;
  899. }
  900. }
  901. if ($falg)
  902. $html .= '<td class="taR">-</td>';
  903. }
  904. if ($sum == 0)
  905. $html .= '<td class="taR">-</td>';
  906. else
  907. $html .= '<td class="taR">¥' . $sum . '</td>';
  908. $html .= '</tr>';
  909. $html .= '<th width="90">个人借款</th>';
  910. $sum = 0;
  911. for($month = 1; $month <= $day; $month ++) {
  912. $falg = true;
  913. foreach ( $statisticsIncome as $key => $value ) {
  914. if ($value ['accountMsg'] == '个人借款' && $value ['day'] == $month && $value ['accountType'] == $i) {
  915. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  916. $sum += $value ['inComePrice'];
  917. $subtotal [$month] += $value ['inComePrice'];
  918. $falg = false;
  919. break;
  920. }
  921. }
  922. if ($falg)
  923. $html .= '<td class="taR">-</td>';
  924. }
  925. if ($sum == 0)
  926. $html .= '<td class="taR">-</td>';
  927. else
  928. $html .= '<td class="taR">¥' . $sum . '</td>';
  929. $html .= '</tr>';
  930. $html .= '<th width="90" class="colGreen">小计</th>';
  931. $sum = 0;
  932. for($month = 1; $month <= $day; $month ++) {
  933. $sum += $subtotal [$month];
  934. $subtotalSum [$month] += $subtotal [$month];
  935. if (! empty ( $subtotal [$month] ))
  936. $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
  937. else
  938. $html .= '<td class="taR">-</td>';
  939. }
  940. if ($sum == 0)
  941. $html .= '<td class="taR">-</td>';
  942. else
  943. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  944. $html .= '</tr>';
  945. } elseif ($i == 2) {
  946. for($d = 1; $d <= $day; $d ++) {
  947. $subtotal [$d] = 0;
  948. }
  949. $html .= '<tr><th rowspan="3" width="90">补贴收入</th>';
  950. $html .= '<th width="90">社保</th>';
  951. $sum = 0;
  952. for($month = 1; $month <= $day; $month ++) {
  953. $falg = true;
  954. foreach ( $statisticsIncome as $key => $value ) {
  955. if ($value ['accountMsg'] == '社保' && $value ['day'] == $month && $value ['accountType'] == $i) {
  956. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  957. $sum += $value ['inComePrice'];
  958. $subtotal [$month] += $value ['inComePrice'];
  959. $falg = false;
  960. break;
  961. }
  962. }
  963. if ($falg)
  964. $html .= '<td class="taR">-</td>';
  965. }
  966. if ($sum == 0)
  967. $html .= '<td class="taR">-</td>';
  968. else
  969. $html .= '<td class="taR">¥' . $sum . '</td>';
  970. $html .= '</tr>';
  971. $html .= '<th width="90">财政</th>';
  972. $sum = 0;
  973. for($month = 1; $month <= $day; $month ++) {
  974. $falg = true;
  975. foreach ( $statisticsIncome as $key => $value ) {
  976. if ($value ['accountMsg'] == '财政' && $value ['day'] == $month && $value ['accountType'] == $i) {
  977. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  978. $sum += $value ['inComePrice'];
  979. $subtotal [$month] += $value ['inComePrice'];
  980. $falg = false;
  981. break;
  982. }
  983. }
  984. if ($falg)
  985. $html .= '<td class="taR">-</td>';
  986. }
  987. if ($sum == 0)
  988. $html .= '<td class="taR">-</td>';
  989. else
  990. $html .= '<td class="taR">¥' . $sum . '</td>';
  991. $html .= '</tr>';
  992. $html .= '<th width="90" class="colGreen">小计</th>';
  993. $sum = 0;
  994. for($month = 1; $month <= $day; $month ++) {
  995. $sum += $subtotal [$month];
  996. $subtotalSum [$month] += $subtotal [$month];
  997. if (! empty ( $subtotal [$month] ))
  998. $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
  999. else
  1000. $html .= '<td class="taR">-</td>';
  1001. }
  1002. if ($sum == 0)
  1003. $html .= '<td class="taR">-</td>';
  1004. else
  1005. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  1006. $html .= '</tr>';
  1007. } elseif ($i == 3) {
  1008. $html .= '<tr><th colspan="2" >纵横知道</th>';
  1009. $sum = 0;
  1010. for($month = 1; $month <= $day; $month ++) {
  1011. $falg = true;
  1012. foreach ( $statisticsIncome as $key => $value ) {
  1013. if ($value ['accountMsg'] == '' && $value ['day'] == $month && $value ['accountType'] == $i) {
  1014. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  1015. $sum += $value ['inComePrice'];
  1016. $subtotalSum [$month] += $value ['inComePrice'];
  1017. $falg = false;
  1018. break;
  1019. }
  1020. }
  1021. if ($falg)
  1022. $html .= '<td class="taR">-</td>';
  1023. }
  1024. if ($sum == 0)
  1025. $html .= '<td class="taR">-</td>';
  1026. else
  1027. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  1028. $html .= '</tr>';
  1029. } elseif ($i == 4) {
  1030. for($d = 1; $d <= $day; $d ++) {
  1031. $subtotal [$d] = 0;
  1032. }
  1033. $html .= '<tr><th rowspan="3" width="90">借款收回</th>';
  1034. $html .= '<th width="90">备用金</th>';
  1035. $sum = 0;
  1036. for($month = 1; $month <= $day; $month ++) {
  1037. $falg = true;
  1038. foreach ( $statisticsIncome as $key => $value ) {
  1039. if ($value ['accountMsg'] == '备用金' && $value ['day'] == $month && $value ['accountType'] == $i) {
  1040. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  1041. $sum += $value ['inComePrice'];
  1042. $subtotal [$month] += $value ['inComePrice'];
  1043. $falg = false;
  1044. break;
  1045. }
  1046. }
  1047. if ($falg)
  1048. $html .= '<td class="taR">-</td>';
  1049. }
  1050. if ($sum == 0)
  1051. $html .= '<td class="taR">-</td>';
  1052. else
  1053. $html .= '<td class="taR">¥' . $sum . '</td>';
  1054. $html .= '</tr>';
  1055. $html .= '<th width="90">私人借款</th>';
  1056. $sum = 0;
  1057. for($month = 1; $month <= $day; $month ++) {
  1058. $falg = true;
  1059. foreach ( $statisticsIncome as $key => $value ) {
  1060. if ($value ['accountMsg'] == '私人借款' && $value ['day'] == $month && $value ['accountType'] == $i) {
  1061. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  1062. $sum += $value ['inComePrice'];
  1063. $subtotal [$month] += $value ['inComePrice'];
  1064. $falg = false;
  1065. break;
  1066. }
  1067. }
  1068. if ($falg)
  1069. $html .= '<td class="taR">-</td>';
  1070. }
  1071. if ($sum == 0)
  1072. $html .= '<td class="taR">-</td>';
  1073. else
  1074. $html .= '<td class="taR">¥' . $sum . '</td>';
  1075. $html .= '</tr>';
  1076. $html .= '<th width="90" class="colGreen">小计</th>';
  1077. $sum = 0;
  1078. for($month = 1; $month <= $day; $month ++) {
  1079. $sum += $subtotal [$month];
  1080. $subtotalSum [$month] += $subtotal [$month];
  1081. if (! empty ( $subtotal [$month] ))
  1082. $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
  1083. else
  1084. $html .= '<td class="taR">-</td>';
  1085. }
  1086. if ($sum == 0)
  1087. $html .= '<td class="taR">-</td>';
  1088. else
  1089. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  1090. $html .= '</tr>';
  1091. } elseif ($i == 5) {
  1092. $html .= '<tr><th colspan="2" >退汇</th>';
  1093. $sum = 0;
  1094. for($month = 1; $month <= $day; $month ++) {
  1095. $falg = true;
  1096. foreach ( $statisticsIncome as $key => $value ) {
  1097. if ($value ['accountMsg'] == '' && $value ['day'] == $month && $value ['accountType'] == $i) {
  1098. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  1099. $sum += $value ['inComePrice'];
  1100. $subtotalSum [$month] += $value ['inComePrice'];
  1101. $falg = false;
  1102. break;
  1103. }
  1104. }
  1105. if ($falg)
  1106. $html .= '<td class="taR">-</td>';
  1107. }
  1108. if ($sum == 0)
  1109. $html .= '<td class="taR">-</td>';
  1110. else
  1111. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  1112. $html .= '</tr>';
  1113. } elseif ($i == 6) {
  1114. $html .= '<tr><th colspan="2" >其他</th>';
  1115. $sum = 0;
  1116. for($month = 1; $month <= $day; $month ++) {
  1117. $falg = true;
  1118. foreach ( $statisticsIncome as $key => $value ) {
  1119. if ($value ['accountMsg'] == '' && $value ['day'] == $month && $value ['accountType'] == $i) {
  1120. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  1121. $sum += $value ['inComePrice'];
  1122. $subtotalSum [$month] += $value ['inComePrice'];
  1123. $falg = false;
  1124. break;
  1125. }
  1126. }
  1127. if ($falg)
  1128. $html .= '<td class="taR">-</td>';
  1129. }
  1130. if ($sum == 0)
  1131. $html .= '<td class="taR">-</td>';
  1132. else
  1133. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  1134. $html .= '</tr>';
  1135. } elseif ($i == 8) {
  1136. $html .= '<tr><th colspan="2" >保证金</th>';
  1137. $sum = 0;
  1138. for($month = 1; $month <= $day; $month ++) {
  1139. $falg = true;
  1140. foreach ( $statisticsIncome as $key => $value ) {
  1141. if ($value ['accountMsg'] == '' && $value ['day'] == $month && $value ['accountType'] == $i) {
  1142. $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
  1143. $sum += $value ['inComePrice'];
  1144. $subtotalSum [$month] += $value ['inComePrice'];
  1145. $falg = false;
  1146. break;
  1147. }
  1148. }
  1149. if ($falg)
  1150. $html .= '<td class="taR">-</td>';
  1151. }
  1152. if ($sum == 0)
  1153. $html .= '<td class="taR">-</td>';
  1154. else
  1155. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  1156. $html .= '</tr>';
  1157. }
  1158. }
  1159. $html .= '<tr><th class="taR" colspan="2">合计</th>';
  1160. $sum = 0;
  1161. foreach ( $subtotalSum as $key => $value ) {
  1162. $sum += $value;
  1163. if (! empty ( $value ))
  1164. $html .= '<td class="taR colGreen">¥' . $value . '</td>';
  1165. else
  1166. $html .= '<td class="taR">-</td>';
  1167. }
  1168. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  1169. $html .= '</tr>';
  1170. $colspan = $day + 1;
  1171. $html .= '<tr class="warning"><td class="taR" colspan="2"><b>全月合计</b></td>
  1172. <td class="colGreed taR" colspan="' . $colspan . '"><b style="font-size:24px">¥' . $sum . '</b></td></tr>';
  1173. return array (
  1174. 'html' => $html,
  1175. 'sum' => $sum
  1176. );
  1177. }
  1178. function _getPaymentsCollectPayByDayHtml($statisticsPay = array(), $day = 0) {
  1179. $html = '<tr><th class="taC" colspan="2">日常支出</th>';
  1180. for($d = 1; $d <= $day; $d ++) {
  1181. $subtotalSum [$d] = 0;
  1182. $html .= '<th class="taC" width="80">' . $d . '日</th>';
  1183. }
  1184. $html .= '<th class="taC" width="110">总计</th></tr>';
  1185. for($i = 1; $i <= 15; $i ++) {
  1186. if ($i == 1) {
  1187. $html .= '<tr><th colspan="2" >银行手续费</th>';
  1188. $sum = 0;
  1189. for($month = 1; $month <= $day; $month ++) {
  1190. $falg = true;
  1191. foreach ( $statisticsPay as $key => $value ) {
  1192. if ($value ['expenditureMsg'] == '' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
  1193. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  1194. $sum += $value ['payPrice'];
  1195. $subtotalSum [$month] += $value ['payPrice'];
  1196. $falg = false;
  1197. break;
  1198. }
  1199. }
  1200. if ($falg)
  1201. $html .= '<td class="taR">-</td>';
  1202. }
  1203. if ($sum == 0)
  1204. $html .= '<td class="taR">-</td>';
  1205. else
  1206. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  1207. $html .= '</tr>';
  1208. } elseif ($i == 2) {
  1209. $html .= '<tr><th colspan="2" >总部电话费</th>';
  1210. $sum = 0;
  1211. for($month = 1; $month <= $day; $month ++) {
  1212. $falg = true;
  1213. foreach ( $statisticsPay as $key => $value ) {
  1214. if ($value ['expenditureMsg'] == '' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
  1215. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  1216. $sum += $value ['payPrice'];
  1217. $subtotalSum [$month] += $value ['payPrice'];
  1218. $falg = false;
  1219. break;
  1220. }
  1221. }
  1222. if ($falg)
  1223. $html .= '<td class="taR">-</td>';
  1224. }
  1225. if ($sum == 0)
  1226. $html .= '<td class="taR">-</td>';
  1227. else
  1228. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  1229. $html .= '</tr>';
  1230. } elseif ($i == 3) {
  1231. for($d = 1; $d <= $day; $d ++) {
  1232. $subtotal [$d] = 0;
  1233. }
  1234. $html .= '<tr><th rowspan="4" width="90">缴税</th>';
  1235. $html .= '<th width="90">增值税</th>';
  1236. $sum = 0;
  1237. for($month = 1; $month <= $day; $month ++) {
  1238. $falg = true;
  1239. foreach ( $statisticsPay as $key => $value ) {
  1240. if ($value ['expenditureMsg'] == '增值税' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
  1241. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  1242. $sum += $value ['payPrice'];
  1243. $subtotal [$month] += $value ['payPrice'];
  1244. $falg = false;
  1245. break;
  1246. }
  1247. }
  1248. if ($falg)
  1249. $html .= '<td class="taR">-</td>';
  1250. }
  1251. if ($sum == 0)
  1252. $html .= '<td class="taR">-</td>';
  1253. else
  1254. $html .= '<td class="taR">¥' . $sum . '</td>';
  1255. $html .= '</tr>';
  1256. $html .= '<th width="90">税金附加</th>';
  1257. $sum = 0;
  1258. for($month = 1; $month <= $day; $month ++) {
  1259. $falg = true;
  1260. foreach ( $statisticsPay as $key => $value ) {
  1261. if ($value ['expenditureMsg'] == '税金附加' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
  1262. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  1263. $sum += $value ['payPrice'];
  1264. $subtotal [$month] += $value ['payPrice'];
  1265. $falg = false;
  1266. break;
  1267. }
  1268. }
  1269. if ($falg)
  1270. $html .= '<td class="taR">-</td>';
  1271. }
  1272. if ($sum == 0)
  1273. $html .= '<td class="taR">-</td>';
  1274. else
  1275. $html .= '<td class="taR">¥' . $sum . '</td>';
  1276. $html .= '</tr>';
  1277. $html .= '<th width="90">企业所得税</th>';
  1278. $sum = 0;
  1279. for($month = 1; $month <= $day; $month ++) {
  1280. $falg = true;
  1281. foreach ( $statisticsPay as $key => $value ) {
  1282. if ($value ['expenditureMsg'] == '企业所得税' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
  1283. $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
  1284. $sum += $value ['payPrice'];
  1285. $subtotal [$month] += $value ['payPrice'];
  1286. $falg = false;
  1287. break;
  1288. }
  1289. }
  1290. if ($falg)
  1291. $html .= '<td class="taR">-</td>';
  1292. }
  1293. if ($sum == 0)
  1294. $html .= '<td class="taR">-</td>';
  1295. else
  1296. $html .= '<td class="taR">¥' . $sum . '</td>';
  1297. $html .= '</tr>';
  1298. $html .= '<th width="90" class="colRed">小计</th>';
  1299. $sum = 0;
  1300. for($month = 1; $month <= $day; $month ++) {
  1301. $sum += $subtotal [$month];
  1302. $subtotalSum [$month] += $subtotal [$month];
  1303. if (! empty ( $subtotal [$month] ))
  1304. $html .= '<td class="taR colRed">¥' . $subtotal [$month] . '</td>';
  1305. else
  1306. $html .= '<td class="taR">-</td>';
  1307. }
  1308. if ($sum == 0)
  1309. $html .= '<td class="taR">-</td>';
  1310. else
  1311. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  1312. $html .= '</tr>';
  1313. } elseif ($i == 5) {
  1314. $html .= '<tr><th colspan="2" >保证金</th>';
  1315. $sum = 0;
  1316. for($month = 1; $month <= $day; $month ++) {
  1317. $falg = true;
  1318. foreach ( $statisticsPay as $key => $value ) {
  1319. if ($value ['expenditureMsg'] == '' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
  1320. $html .= '<td class="taR">¥' . abs ( $value ['payPrice'] ) . '</td>';
  1321. $sum += abs ( $value ['payPrice'] );
  1322. $subtotalSum [$month] += abs ( $value ['payPrice'] );
  1323. $falg = false;
  1324. break;
  1325. }
  1326. }
  1327. if ($falg)
  1328. $html .= '<td class="taR">-</td>';
  1329. }
  1330. if ($sum == 0)
  1331. $html .= '<td class="taR">-</td>';
  1332. else
  1333. $html .= '<td class="taR colRed">¥' . $sum . '</td>';
  1334. $html .= '</tr>';
  1335. }
  1336. }
  1337. $html .= '<tr><th class="taR" colspan="2">合计</th>';
  1338. $sum = 0;
  1339. foreach ( $subtotalSum as $key => $value ) {
  1340. $sum += $value;
  1341. if (! empty ( $value ))
  1342. $html .= '<td class="taR colGreen">¥' . $value . '</td>';
  1343. else
  1344. $html .= '<td class="taR">-</td>';
  1345. }
  1346. $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
  1347. $html .= '</tr>';
  1348. $colspan = $day + 1;
  1349. $html .= '<tr class="warning"><td class="taR" colspan="2"><b>全月合计</b></td>
  1350. <td class="colGreed taR" colspan="' . $colspan . '"><b style="font-size:24px">¥' . $sum . '</b></td></tr>';
  1351. return array (
  1352. 'html' => $html,
  1353. 'sum' => $sum
  1354. );
  1355. }
  1356. function getExecuteStaff($receiptDetail) {
  1357. // 费用执行人相关数据
  1358. $executeCopy = json_decode ( $receiptDetail ['executeCopy'], true );
  1359. $executeStaff = json_decode ( $receiptDetail ['executeStaff'], true );
  1360. foreach ( $executeCopy as $k => $v ) {
  1361. $executeCopy [$k] ['date'] = '';
  1362. $executeCopy [$k] ['opinion'] = '';
  1363. $executeCopy [$k] ['status'] = '';
  1364. if (! empty ( $executeStaff ))
  1365. foreach ( $executeStaff as $m => $u ) {
  1366. if ($v [0] == $m) {
  1367. $executeCopy [$k] ['date'] = $u ['date'];
  1368. $executeCopy [$k] ['opinion'] = $u ['opinion'];
  1369. $executeCopy [$k] ['status'] = $u ['status'];
  1370. break;
  1371. }
  1372. }
  1373. }
  1374. $receiptDetail ['executeCopy'] = $executeCopy;
  1375. return $receiptDetail ['executeCopy'];
  1376. }
  1377. function num_to_rmb($num) {
  1378. $c1 = "零壹贰叁肆伍陆柒捌玖";
  1379. $c2 = "分角元拾佰仟万拾佰仟亿";
  1380. // 精确到分后面就不要了,所以只留两个小数位
  1381. $num = round ( $num, 2 );
  1382. // 将数字转化为整数
  1383. $num = $num * 100;
  1384. if (strlen ( $num ) > 10) {
  1385. return "金额太大,请检查";
  1386. }
  1387. $i = 0;
  1388. $c = "";
  1389. while ( 1 ) {
  1390. if ($i == 0) {
  1391. // 获取最后一位数字
  1392. $n = substr ( $num, strlen ( $num ) - 1, 1 );
  1393. } else {
  1394. $n = $num % 10;
  1395. }
  1396. // 每次将最后一位数字转化为中文
  1397. $p1 = substr ( $c1, 3 * $n, 3 );
  1398. $p2 = substr ( $c2, 3 * $i, 3 );
  1399. if ($n != '0' || ($n == '0' && ($p2 == '亿' || $p2 == '万' || $p2 == '元'))) {
  1400. $c = $p1 . $p2 . $c;
  1401. } else {
  1402. $c = $p1 . $c;
  1403. }
  1404. $i = $i + 1;
  1405. // 去掉数字最后一位了
  1406. $num = $num / 10;
  1407. // echo $num.'</br>';
  1408. $num = ( int ) $num;
  1409. // $num =floor($num);
  1410. // $num = round ( $num, 0, PHP_ROUND_HALF_DOWN );
  1411. // echo $num.'</br>';
  1412. // 结束循环
  1413. if ($num == 0) {
  1414. break;
  1415. }
  1416. }
  1417. // echo $c.'</br>';
  1418. $j = 0;
  1419. $slen = strlen ( $c );
  1420. while ( $j < $slen ) {
  1421. // utf8一个汉字相当3个字符
  1422. $m = substr ( $c, $j, 6 );
  1423. // 处理数字中很多0的情况,每次循环去掉一个汉字“零”
  1424. if ($m == '零元' || $m == '零万' || $m == '零亿' || $m == '零零') {
  1425. $left = substr ( $c, 0, $j );
  1426. $right = substr ( $c, $j + 3 );
  1427. $c = $left . $right;
  1428. $j = $j - 3;
  1429. $slen = $slen - 3;
  1430. }
  1431. $j = $j + 3;
  1432. }
  1433. // 这个是为了去掉类似23.0中最后一个“零”字
  1434. if (substr ( $c, strlen ( $c ) - 3, 3 ) == '零') {
  1435. $c = substr ( $c, 0, strlen ( $c ) - 3 );
  1436. }
  1437. // 将处理的汉字加上“整”
  1438. if (empty ( $c )) {
  1439. return "零元整";
  1440. } else {
  1441. return $c . "整";
  1442. }
  1443. }
  1444. /**
  1445. * 数据导出
  1446. * @param array $title 标题行名称
  1447. * @param array $data 导出数据
  1448. * @param string $fileName 文件名
  1449. * @param string $savePath 保存路径
  1450. * @param $type 是否下载 false--保存 true--下载
  1451. * @return string 返回文件全路径
  1452. * @throws PHPExcel_Exception
  1453. * @throws PHPExcel_Reader_Exception @exportExcel(array('姓名','年龄'), array(array('a',21),array('b',23)), '档案', './', true);
  1454. */
  1455. function exportExcel($title = array(), $data = array(), $fileName = '', $savePath = './', $isDown = false) {
  1456. Doo::loadClass ( 'PHPExcel1.7.9/PHPExcel' );
  1457. $obj = new PHPExcel ();
  1458. // 横向单元格标识
  1459. $cellName = array (
  1460. 'A',
  1461. 'B',
  1462. 'C',
  1463. 'D',
  1464. 'E',
  1465. 'F',
  1466. 'G',
  1467. 'H',
  1468. 'I',
  1469. 'J',
  1470. 'K',
  1471. 'L',
  1472. 'M',
  1473. 'N',
  1474. 'O',
  1475. 'P',
  1476. 'Q',
  1477. 'R',
  1478. 'S',
  1479. 'T',
  1480. 'U',
  1481. 'V',
  1482. 'W',
  1483. 'X',
  1484. 'Y',
  1485. 'Z',
  1486. 'AA',
  1487. 'AB',
  1488. 'AC',
  1489. 'AD',
  1490. 'AE',
  1491. 'AF',
  1492. 'AG',
  1493. 'AH',
  1494. 'AI',
  1495. 'AJ',
  1496. 'AK',
  1497. 'AL',
  1498. 'AM',
  1499. 'AN',
  1500. 'AO',
  1501. 'AP',
  1502. 'AQ',
  1503. 'AR',
  1504. 'AS',
  1505. 'AT',
  1506. 'AU',
  1507. 'AV',
  1508. 'AW',
  1509. 'AX',
  1510. 'AY',
  1511. 'AZ'
  1512. );
  1513. $obj->getActiveSheet ( 0 )->setTitle ( 'sheet名称' ); // 设置sheet名称
  1514. $_row = 0; // 设置纵向单元格标识
  1515. if ($title) {
  1516. $_cnt = count ( $title );
  1517. // $obj->getActiveSheet(0)->mergeCells('A'.$_row.':'.$cellName[$_cnt-1].$_row); //合并单元格
  1518. // $obj->setActiveSheetIndex(0)->setCellValue('A'.$_row, '数据导出:'.date('Y-m-d H:i:s')); //设置合并后的单元格内容
  1519. $_row ++;
  1520. $i = 0;
  1521. foreach ( $title as $v ) { // 设置列标题
  1522. $obj->setActiveSheetIndex ( 0 )->setCellValue ( $cellName [$i] . $_row, $v );
  1523. $i ++;
  1524. }
  1525. $_row ++;
  1526. }
  1527. ;
  1528. // html_entity_decode("&iuml;&raquo;&iquest;".$value['order_id']);
  1529. // 填写数据
  1530. if ($data) {
  1531. $i = 0;
  1532. foreach ( $data as $_v ) {
  1533. $j = 0;
  1534. foreach ( $_v as $_cell ) {
  1535. $obj->getActiveSheet ( 0 )->setCellValueExplicit ( $cellName [$j] . ($i + $_row), $_cell, PHPExcel_Cell_DataType::TYPE_STRING );
  1536. $j ++;
  1537. }
  1538. $i ++;
  1539. }
  1540. }
  1541. // 文件名处理
  1542. if (! $fileName) {
  1543. $fileName = uniqid ( time (), true );
  1544. }
  1545. $objWrite = PHPExcel_IOFactory::createWriter ( $obj, 'Excel2007' );
  1546. if ($isDown) { // 网页下载
  1547. header ( 'pragma:public' );
  1548. header ( "Content-Disposition:attachment;filename=$fileName.xls" );
  1549. header ( 'Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' );
  1550. $objWrite->save ( 'php://output' );
  1551. exit ();
  1552. }
  1553. $_fileName = iconv ( "utf-8", "gb2312", $fileName ); // 转码
  1554. $_savePath = $savePath . $_fileName . '.xlsx';
  1555. $objWrite->save ( $_savePath );
  1556. return $savePath . $fileName . '.xlsx';
  1557. }
  1558. function cellColor($cells,$color,$obj){
  1559. $obj->getActiveSheet()->getStyle($cells)->getFill()->applyFromArray(array(
  1560. 'type' => PHPExcel_Style_Fill::FILL_SOLID,
  1561. 'startcolor' => array(
  1562. 'rgb' => $color
  1563. )
  1564. ));
  1565. }
  1566. /*
  1567. * 处理Excel导出
  1568. * @param $datas array
  1569. * 设置表格数据
  1570. * @param $titlename string
  1571. * 设置head @param $title string 设置表头
  1572. */
  1573. function excelData($trainData, $receiptDetail, $summary, $aiList,$receiptLoanDetail,$invoiceList,$RItemList,$lecturerList,$invoiceTrainingDetail) {
  1574. Doo::loadClass ( 'PHPExcel1.7.9/PHPExcel' );
  1575. $obj = new PHPExcel ();
  1576. //设置合并单元格
  1577. $obj->getActiveSheet()->mergeCells('A1:D1');
  1578. //设置居中--//字体加粗
  1579. $obj->getActiveSheet()->getStyle('A1:J1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1580. $i=2;
  1581. for(;$i<=20;$i++){
  1582. $obj->getActiveSheet()->getStyle('A'.$i.':J'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1583. //$obj->getActiveSheet()->getStyle('A'.$i)->getFont()->setName('宋体')->setBold(true);
  1584. //$obj->getActiveSheet()->getStyle('C'.$i)->getFont()->setName('宋体')->setBold(true);
  1585. }
  1586. $styleThinBlackBorderOutline = array(
  1587. 'borders' => array(
  1588. 'allborders' => array( //设置全部边框
  1589. 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
  1590. ),
  1591. ),
  1592. );
  1593. $obj->getActiveSheet()->getStyle( 'A1:D9')->applyFromArray($styleThinBlackBorderOutline);
  1594. for ($i=1;$i<=9;$i++){
  1595. cellColor('A'.$i, 'ddebf7',$obj);
  1596. }
  1597. cellColor('C2', 'ddebf7',$obj);cellColor('C3', 'ddebf7',$obj);
  1598. cellColor('C4', 'ddebf7',$obj);cellColor('C8', 'ddebf7',$obj);
  1599. cellColor('C6', 'ddebf7',$obj);cellColor('C7', 'ddebf7',$obj);
  1600. //设置单元格宽
  1601. $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
  1602. $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
  1603. $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
  1604. $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
  1605. $obj->getActiveSheet()->getColumnDimension('E')->setWidth(25);
  1606. $obj->getActiveSheet()->getDefaultRowDimension()->setRowHeight(18);
  1607. $obj->getActiveSheet()->getStyle('A1')->getFont()->setName('宋体')->setBold(true);
  1608. $obj->getactivesheet()->setCellValue ( 'A1','培训班信息' );
  1609. $obj->getactivesheet()->setCellValue ( 'A2','培训班名称' );
  1610. $obj->getactivesheet()->setCellValue ( 'B2',$trainData['trainName'] );
  1611. $obj->getactivesheet()->setCellValue ( 'C2','所在办事处' );
  1612. $obj->getactivesheet()->setCellValue ( 'D2',$trainData['categoryName'] );
  1613. $obj->getactivesheet()->setCellValue ( 'A3','开班时间' );
  1614. $obj->getactivesheet()->setCellValue ( 'B3',$trainData['trainStartDate'] );
  1615. $obj->getactivesheet()->setCellValue ( 'C3','结束时间' );
  1616. $obj->getactivesheet()->setCellValue ( 'D3',$trainData['trainEndDate'] );
  1617. $obj->getactivesheet()->setCellValue ( 'A4','参加人数' );
  1618. $obj->getactivesheet()->setCellValue ( 'B4',$trainData['participants'] );
  1619. $obj->getactivesheet()->setCellValue ( 'C4','培训班地址' );
  1620. autoCellsWidth($obj,'D',$trainData ['trainAddress']);
  1621. $obj->getactivesheet()->setCellValue ( 'D4',$trainData['trainAddress'] );
  1622. $obj->getactivesheet()->setCellValue ( 'A5','备注' );
  1623. $obj->getActiveSheet()->mergeCells('B5:D5');
  1624. $obj->getactivesheet()->setCellValue ( 'B5',$trainData['trainRemarks'] );
  1625. $obj->getActiveSheet()->mergeCells('A6:D6');
  1626. $obj->getActiveSheet()->getStyle('A6:D6')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1627. $obj->getactivesheet()->setCellValue ( 'A6','汇款信息' );
  1628. $obj->getactivesheet()->setCellValue ( 'A7','汇款人户名' );
  1629. $obj->getactivesheet()->setCellValue ( 'B7',$receiptDetail['remittanceName'] );
  1630. $obj->getactivesheet()->setCellValue ( 'C7','汇款银行' );
  1631. if(0==$receiptDetail['remittanceBankType']){
  1632. $obj->getactivesheet()->setCellValue ( 'D7','广发银行' );
  1633. }else{
  1634. $obj->getactivesheet()->setCellValue ( 'D7',其他 );
  1635. }
  1636. $obj->getactivesheet()->setCellValue ( 'A8','汇款开户银行名称' );
  1637. autoCellsWidth($obj,'B',$receiptDetail ['bankName']);
  1638. $obj->getactivesheet()->setCellValue ( 'B8',$receiptDetail['bankName'] );
  1639. $obj->getactivesheet()->setCellValue ( 'C8','汇款帐号' );
  1640. $obj->getActiveSheet()->setCellValueExplicit('D8',$receiptDetail['bankNumber'],PHPExcel_Cell_DataType::TYPE_STRING);
  1641. //$obj->getactivesheet()->setCellValue ( 'D7',$receiptDetail['bankNumber'].'' );
  1642. if(0==$receiptDetail['remittanceBankType']){
  1643. $obj->getactivesheet()->setCellValue ( 'A9','联行号' );
  1644. $obj->getActiveSheet()->mergeCells('B9:D9');
  1645. $obj->getactivesheet()->setCellValue ( 'B9',$receiptDetail['coupletNumber'] );
  1646. }
  1647. $obj->setActiveSheetIndex(0);
  1648. $obj->getActiveSheet ()->setTitle ( '信息' );
  1649. //------------------------------------------------------------------------------------------
  1650. $obj->createSheet();
  1651. $obj->setActiveSheetIndex(1);
  1652. makeSummaryData($obj,$summary,$aiList);
  1653. //------------------------------------------------------------------------------------------
  1654. //绘制借款
  1655. $obj->createSheet();
  1656. $obj->setActiveSheetIndex(2);
  1657. makeReceiptLoanData($obj,$receiptLoanDetail);
  1658. //------------------------------------------------------------------------------------------
  1659. //绘制收入
  1660. $obj->createSheet();
  1661. $obj->setActiveSheetIndex(3);
  1662. makeInvoiceData($obj,$invoiceList,$invoiceTrainingDetail);
  1663. //------------------------------------------------------------------------------------------
  1664. //绘制支出
  1665. $obj->createSheet();
  1666. $obj->setActiveSheetIndex(4);
  1667. makeItemData($obj,$RItemList);
  1668. //------------------------------------------------------------------------------------------
  1669. //绘制讲师
  1670. $obj->createSheet();
  1671. $obj->setActiveSheetIndex(5);
  1672. makeLecturerData($obj,$lecturerList);
  1673. $objWrite = PHPExcel_IOFactory::createWriter ( $obj, 'Excel2007' );
  1674. header ( 'pragma:public' );
  1675. header ( "Content-Disposition:attachment;filename=".$trainData['trainName'].".xlsx" );
  1676. header ( 'Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' );
  1677. $objWrite->save ( 'php://output' );
  1678. exit ();
  1679. }
  1680. function makeLecturerData($obj,$lecturerList){
  1681. //整体字体位置
  1682. $invoiceCount=count($lecturerList)+2;
  1683. for($i=1;$i<=$invoiceCount;$i++){
  1684. $obj->getActiveSheet()->getStyle('A'.$i.':E'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  1685. $obj->getActiveSheet()->getStyle('A'.$i.':E'.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
  1686. $obj->getActiveSheet()->getRowDimension($i)->setRowHeight(18);
  1687. }
  1688. $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
  1689. $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
  1690. $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
  1691. $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
  1692. $obj->getActiveSheet()->getColumnDimension('E')->setWidth(25);
  1693. //边框
  1694. $styleThinBlackBorderOutline = array(
  1695. 'borders' => array(
  1696. 'allborders' => array( //设置全部边框
  1697. 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
  1698. ),
  1699. ),);
  1700. $obj->getActiveSheet()->getStyle( 'A1:E'.$invoiceCount)->applyFromArray($styleThinBlackBorderOutline);
  1701. cellColor('A1', 'ddebf7',$obj);cellColor('B1', 'ddebf7',$obj);
  1702. cellColor('C1', 'ddebf7',$obj);cellColor('D1', 'ddebf7',$obj);cellColor('E1', 'ddebf7',$obj);
  1703. $obj->getactivesheet()->setCellValue ( 'A1','类型' );
  1704. $obj->getactivesheet()->setCellValue ( 'B1','讲师姓名' );
  1705. $obj->getactivesheet()->setCellValue ( 'C1','授课日数' );
  1706. $obj->getactivesheet()->setCellValue ( 'D1','日授课费' );
  1707. $obj->getactivesheet()->setCellValue ( 'E1','合计应发授课费' );
  1708. $i=2;$sumPrice=0;
  1709. foreach ($lecturerList as $key=>$value){
  1710. $lecturerName='';
  1711. if($value['ltype']=='OUTSIDE'){
  1712. $lecturerName.='外聘';
  1713. if($value['taxation']==0){
  1714. $lecturerName.='(不计税)';
  1715. }else{
  1716. $lecturerName.='(计税)';
  1717. }
  1718. }else{
  1719. $lecturerName.='员工';
  1720. }
  1721. $obj->getactivesheet()->setCellValue ( 'A'.$i,$lecturerName );
  1722. $obj->getactivesheet()->setCellValue ( 'B'.$i,$value['lecturerName'] );
  1723. $obj->getactivesheet()->setCellValue ( 'C'.$i,$value['schoolDay'] );
  1724. $obj->getactivesheet()->setCellValue ( 'D'.$i,$value['price'] );
  1725. $obj->getactivesheet()->setCellValue ( 'E'.$i,$value['fees'] );
  1726. $sumPrice+=$value['sum'];
  1727. $i++;
  1728. }
  1729. $obj->getactivesheet()->setCellValue ( 'C'.$i,'合计' );
  1730. $obj->getactivesheet()->setCellValue ( 'D'.$i,$sumPrice );
  1731. $obj->getActiveSheet ()->setTitle ( '讲师' );
  1732. }
  1733. function makeItemData($obj,$itemList){
  1734. //整体字体位置
  1735. $invoiceCount=count($itemList)+2;
  1736. for($i=1;$i<=$invoiceCount;$i++){
  1737. $obj->getActiveSheet()->getStyle('A'.$i.':E'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  1738. $obj->getActiveSheet()->getStyle('A'.$i.':E'.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
  1739. $obj->getActiveSheet()->getRowDimension($i)->setRowHeight(18);
  1740. }
  1741. $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
  1742. $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
  1743. $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
  1744. $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
  1745. //边框
  1746. $styleThinBlackBorderOutline = array(
  1747. 'borders' => array(
  1748. 'allborders' => array( //设置全部边框
  1749. 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
  1750. ),
  1751. ),);
  1752. $obj->getActiveSheet()->getStyle( 'A1:E'.$invoiceCount)->applyFromArray($styleThinBlackBorderOutline);
  1753. cellColor('A1', 'ddebf7',$obj);cellColor('B1', 'ddebf7',$obj);
  1754. cellColor('C1', 'ddebf7',$obj);cellColor('D1', 'ddebf7',$obj);
  1755. cellColor('E1', 'ddebf7',$obj);
  1756. $obj->getactivesheet()->setCellValue ( 'A1','日期' );
  1757. $obj->getactivesheet()->setCellValue ( 'B1','类别' );
  1758. $obj->getactivesheet()->setCellValue ( 'C1','金额' );
  1759. $obj->getactivesheet()->setCellValue ( 'D1','经手人' );
  1760. $obj->getactivesheet()->setCellValue ( 'E1','支出描述' );
  1761. $i=2;$maxArray=array();$sumPrice=0;
  1762. foreach ($itemList as $key=>$value){
  1763. $obj->getactivesheet()->setCellValue ( 'A'.$i,$value['date'] );
  1764. $obj->getactivesheet()->setCellValue ( 'B'.$i,$value['item'] );
  1765. $obj->getactivesheet()->setCellValue ( 'C'.$i,$value['price'] );
  1766. $obj->getactivesheet()->setCellValue ( 'D'.$i,$value['inputer'] );
  1767. $obj->getactivesheet()->setCellValue ( 'E'.$i,$value['describe'] );
  1768. array_push($maxArray, strlen($value['describe']));
  1769. $sumPrice+=$value['price'];
  1770. $i++;
  1771. }
  1772. $obj->getactivesheet()->setCellValue ( 'B'.$i,'合计' );
  1773. $obj->getactivesheet()->setCellValue ( 'C'.$i,$sumPrice );
  1774. $ma=0;
  1775. if (!empty($maxArray)){
  1776. $ma=max($maxArray);
  1777. }
  1778. $max=$ma-10;$fontlenght=25;
  1779. if($max>25){
  1780. $fontlenght=$max;
  1781. }
  1782. $obj->getActiveSheet()->getColumnDimension('E')->setWidth($fontlenght);
  1783. $obj->getActiveSheet ()->setTitle ( '支出' );
  1784. }
  1785. function makeInvoiceData($obj,$invoiceList,$invoiceTrainingDetail){
  1786. //整体字体位置
  1787. $invoiceCount=count($invoiceList)+4;
  1788. for($i=1;$i<=$invoiceCount;$i++){
  1789. $obj->getActiveSheet()->getStyle('A'.$i.':I'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  1790. $obj->getActiveSheet()->getStyle('A'.$i.':I'.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
  1791. $obj->getActiveSheet()->getRowDimension($i)->setRowHeight(18);
  1792. }
  1793. $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
  1794. $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
  1795. $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
  1796. $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
  1797. $obj->getActiveSheet()->getColumnDimension('E')->setWidth(25);
  1798. $obj->getActiveSheet()->getColumnDimension('F')->setWidth(25);
  1799. $obj->getActiveSheet()->getColumnDimension('G')->setWidth(25);
  1800. $obj->getActiveSheet()->getColumnDimension('H')->setWidth(25);
  1801. $obj->getActiveSheet()->getColumnDimension('I')->setWidth(25);
  1802. //边框
  1803. $styleThinBlackBorderOutline = array(
  1804. 'borders' => array(
  1805. 'allborders' => array( //设置全部边框
  1806. 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
  1807. ),
  1808. ),);
  1809. $obj->getActiveSheet()->getStyle( 'A1:I2')->applyFromArray($styleThinBlackBorderOutline);
  1810. cellColor('A1', 'ddebf7',$obj);cellColor('B1', 'ddebf7',$obj);
  1811. cellColor('C1', 'ddebf7',$obj);cellColor('D1', 'ddebf7',$obj);
  1812. cellColor('E1', 'ddebf7',$obj);cellColor('F1', 'ddebf7',$obj);
  1813. cellColor('H1', 'ddebf7',$obj);cellColor('G1', 'ddebf7',$obj);cellColor('I1', 'ddebf7',$obj);
  1814. $obj->getactivesheet()->setCellValue ( 'A1','培训班名称' );
  1815. $obj->getactivesheet()->setCellValue ( 'B1','办事处' );
  1816. $obj->getactivesheet()->setCellValue ( 'C1','创建' );
  1817. $obj->getactivesheet()->setCellValue ( 'D1','开班时间' );
  1818. $obj->getactivesheet()->setCellValue ( 'E1','包含发票' );
  1819. $obj->getactivesheet()->setCellValue ( 'F1','开票金额合计' );
  1820. $obj->getactivesheet()->setCellValue ( 'G1','入账金额合计' );
  1821. $obj->getactivesheet()->setCellValue ( 'H1','公司已收款' );
  1822. $obj->getactivesheet()->setCellValue ( 'I1','办事处已收款' );
  1823. if(!empty($invoiceTrainingDetail)){
  1824. $obj->getactivesheet()->setCellValue ( 'A2',$invoiceTrainingDetail['trainName'] );
  1825. $obj->getactivesheet()->setCellValue ( 'B2',$invoiceTrainingDetail['category'][0]['title'] );
  1826. $obj->getactivesheet()->setCellValue ( 'C2',$invoiceTrainingDetail['staff']['username'] );
  1827. $obj->getactivesheet()->setCellValue ( 'D2',$invoiceTrainingDetail['trainDate'] );
  1828. $obj->getactivesheet()->setCellValue ( 'E2',$invoiceTrainingDetail['invoiceTotal'] );
  1829. $obj->getactivesheet()->setCellValue ( 'F2',$invoiceTrainingDetail['invoiceTotalAmount'] );
  1830. $obj->getactivesheet()->setCellValue ( 'G2',$invoiceTrainingDetail['invoiceArriveAmount'] );
  1831. $obj->getactivesheet()->setCellValue ( 'H2',$invoiceTrainingDetail['invoiceCompanyAmount'] );
  1832. $obj->getactivesheet()->setCellValue ( 'I2',$invoiceTrainingDetail['RIAmount'] );
  1833. }
  1834. //边框
  1835. $styleThinBlackBorderOutline = array(
  1836. 'borders' => array(
  1837. 'allborders' => array( //设置全部边框
  1838. 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
  1839. ),
  1840. ),);
  1841. $obj->getActiveSheet()->getStyle( 'A4:H'.$invoiceCount)->applyFromArray($styleThinBlackBorderOutline);
  1842. cellColor('A4', 'ddebf7',$obj);cellColor('B4', 'ddebf7',$obj);
  1843. cellColor('C4', 'ddebf7',$obj);cellColor('D4', 'ddebf7',$obj);
  1844. cellColor('E4', 'ddebf7',$obj);cellColor('F4', 'ddebf7',$obj);
  1845. cellColor('H4', 'ddebf7',$obj);cellColor('G4', 'ddebf7',$obj);
  1846. $obj->getactivesheet()->setCellValue ( 'A4','开票流水' );
  1847. $obj->getactivesheet()->setCellValue ( 'B4','开票单位(抬头)' );
  1848. $obj->getactivesheet()->setCellValue ( 'C4','发票号' );
  1849. $obj->getactivesheet()->setCellValue ( 'D4','总额' );
  1850. $obj->getactivesheet()->setCellValue ( 'E4','状态' );
  1851. $obj->getactivesheet()->setCellValue ( 'F4','办事处收款' );
  1852. $obj->getactivesheet()->setCellValue ( 'G4','收款流水号' );
  1853. $obj->getactivesheet()->setCellValue ( 'H4','收款银行到账' );
  1854. $i=5;$maxArray=array();
  1855. foreach ($invoiceList as $key=>$value){
  1856. $obj->getactivesheet()->setCellValue ( 'A'.$i,$value['invoiceSerial'] );
  1857. $title='';
  1858. if(!empty($value['invoiceType'])){
  1859. $title=$value['invoiceCompany'];
  1860. }else{
  1861. $title=$value['invoiceTitle'];
  1862. }
  1863. $obj->getactivesheet()->setCellValue ( 'B'.$i,$title );
  1864. $obj->getactivesheet()->setCellValue ( 'C'.$i,$value['invoiceNo'] );
  1865. if(!empty($value['invoiceType'])){
  1866. $obj->getactivesheet()->setCellValue ( 'D'.$i,'专'.$value['invoicePrice'] );
  1867. }else{
  1868. $obj->getactivesheet()->setCellValue ( 'D'.$i,$value['invoicePrice'] );
  1869. }
  1870. if($value['untreadStatus']==3){
  1871. $obj->getactivesheet()->setCellValue ( 'E'.$i,'已入账' );
  1872. }else{
  1873. $obj->getactivesheet()->setCellValue ( 'E'.$i,'已出票' );
  1874. }
  1875. if($value['untreadStatus']==3){
  1876. if($value['RIstatus']==1){
  1877. $obj->getactivesheet()->setCellValue ( 'F'.$i,'已收款' );
  1878. }
  1879. }else{
  1880. if($value['RIstatus']==1){
  1881. $obj->getactivesheet()->setCellValue ( 'F'.$i,'已收款' );
  1882. }
  1883. }
  1884. $receivablesSerial='';
  1885. $receivablesDate='';$hang=0;
  1886. if($value['untreadStatus']==3){
  1887. foreach ($value['irDetail'] as $k=>$v){
  1888. $receivablesSerial.=$v['receivablesSerial']."\r\n";
  1889. $receivablesDate.=$v['receivablesDate']."\r\n";
  1890. $hang+=8;
  1891. }
  1892. if($hang>8){
  1893. $obj->getActiveSheet()->getRowDimension($i)->setRowHeight(18+$hang);
  1894. }
  1895. }
  1896. $obj->getActiveSheet()->getStyle('H'.$i)->getAlignment()->setWrapText(true);
  1897. $obj->getActiveSheet()->getStyle('G'.$i)->getAlignment()->setWrapText(true);
  1898. $obj->getactivesheet()->setCellValue ( 'G'.$i,$receivablesSerial );
  1899. $obj->getactivesheet()->setCellValue ( 'H'.$i,$receivablesDate );
  1900. //按字体多少自动拉长单元格
  1901. array_push($maxArray, strlen($title));
  1902. $i++;
  1903. }
  1904. $ma=0;
  1905. if (!empty($maxArray)){
  1906. $ma=max($maxArray);
  1907. }
  1908. $max=$ma-10;$fontlenght=25;
  1909. if($max>25){
  1910. $fontlenght=$max;
  1911. }
  1912. $obj->getActiveSheet()->getColumnDimension('B')->setWidth($fontlenght);
  1913. $obj->getActiveSheet ()->setTitle ( '收入' );
  1914. }
  1915. function makeReceiptLoanData($obj,$receiptLoanList){
  1916. if (empty($receiptLoanList)){
  1917. $obj->getActiveSheet ()->setTitle ( '借款' );
  1918. return ;
  1919. }
  1920. $base=$lnBase=0;$lnKey=1;$lnBase=14;
  1921. //定义行倍数
  1922. $lnKey2=2;$lnKey3=3;$lnKey4=4;$lnKey5=5;
  1923. $lnKey6=6;$lnKey7=7;$lnKey8=8;$lnKey9=9;
  1924. $lnKey10=10;$lnKey11=11;$lnKey12=12;$lnKey13=13;
  1925. $lnKey14=14;
  1926. $obj->getActiveSheet()->getColumnDimension('A')->setWidth(35);
  1927. $obj->getActiveSheet()->getColumnDimension('B')->setWidth(35);
  1928. foreach ($receiptLoanList as $key=>$receiptLoanDetail){
  1929. $lineNumber=1;
  1930. $lineNumber=$lineNumber+$base;
  1931. $maxBase=$base+16;
  1932. //echo $maxBase.'<br/>';
  1933. for (;$lineNumber<=$maxBase;$lineNumber++){
  1934. $lineNumberDynamic = 'ln'.$lineNumber;
  1935. $$lineNumberDynamic=$lineNumber;
  1936. $obj->getActiveSheet()->getStyle('A'.$lineNumber.':B'.$lineNumber)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  1937. $obj->getActiveSheet()->getStyle('A'.$lineNumber.':B'.$lineNumber)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
  1938. $obj->getActiveSheet()->getRowDimension($lineNumber)->setRowHeight(18);
  1939. }
  1940. //正文
  1941. $receiptLoanDetail ['loanItem'] = json_decode ( $receiptLoanDetail ['loanItem'], true );
  1942. $receiptLoanDetail ['sumCN'] = num_to_rmb ( $receiptLoanDetail ['sum'] );
  1943. $receiptLoanDetail ['loanSumCN'] = num_to_rmb ( $receiptLoanDetail ['loanSum'] );
  1944. $receiptLoanDetail ['amountCN'] = num_to_rmb ( $receiptLoanDetail ['amount'] );
  1945. //echo $receiptLoanDetail ['sumCN'].'<br/>';
  1946. //边框
  1947. $styleThinBlackBorderOutline = array(
  1948. 'borders' => array(
  1949. 'allborders' => array( //设置全部边框
  1950. 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
  1951. ),
  1952. ),);
  1953. $obj->getActiveSheet()->getStyle( 'A'.${'ln'.$lnKey}.':B'.${'ln'.$lnBase})->applyFromArray($styleThinBlackBorderOutline);
  1954. //绘制颜色
  1955. cellColor('A'.${'ln'.$lnKey}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey3}, 'ddebf7',$obj);
  1956. cellColor('A'.${'ln'.$lnKey2}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey6}, 'ddebf7',$obj);
  1957. cellColor('A'.${'ln'.$lnKey7}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey8}, 'ddebf7',$obj);
  1958. cellColor('A'.${'ln'.$lnKey9}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey10}, 'ddebf7',$obj);
  1959. cellColor('A'.${'ln'.$lnKey5}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey11}, 'ddebf7',$obj);
  1960. //正文内容
  1961. $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey}.':B'.${'ln'.$lnKey});
  1962. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey},'借款费用' );
  1963. $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1964. $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey3}.':B'.${'ln'.$lnKey3});
  1965. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey3},'产生费用所在办事处' );
  1966. $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey3})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1967. $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey5}.':B'.${'ln'.$lnKey5});
  1968. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey5},'汇款信息' );
  1969. $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey5})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1970. $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey11}.':B'.${'ln'.$lnKey11});
  1971. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey11},'费用说明' );
  1972. $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey11})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1973. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey2},'借款费用' );
  1974. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey2},$receiptLoanDetail ['loanItem'] ['借款费用'] [0] ['price'] );
  1975. $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey4}.':B'.${'ln'.$lnKey4});
  1976. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey4},$receiptLoanDetail ['category'] [0] ['title'] );
  1977. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey6},'汇款人户名' );
  1978. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey7},'汇款银行' );
  1979. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey8},'汇款开户银行名称' );
  1980. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey9},'汇款帐号' );
  1981. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey10},'联行号' );
  1982. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey6},$receiptLoanDetail ['remittanceName'] );
  1983. if ($receiptLoanDetail ['remittanceBankType'] == 0){
  1984. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey7},'广发银行' );
  1985. }elseif ($receiptLoanDetail ['remittanceBankType'] == 1){
  1986. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey7},'其他' );
  1987. }
  1988. autoCellsWidth($obj,'B',$receiptLoanDetail ['bankName']);
  1989. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey8},$receiptLoanDetail ['bankName'] );
  1990. $obj->getActiveSheet()->setCellValueExplicit('B'.${'ln'.$lnKey9},$receiptLoanDetail ['bankNumber'],PHPExcel_Cell_DataType::TYPE_STRING);
  1991. //$obj->getactivesheet()->setCellValue ( 'B9',$receiptLoanDetail ['bankNumber'] );
  1992. if ($receiptLoanDetail ['remittanceBankType'] == 1){
  1993. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey10},$receiptLoanDetail ['coupletNumber'] );
  1994. }else{
  1995. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey10},'' );
  1996. }
  1997. $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey12}.':B'.${'ln'.$lnKey12});
  1998. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey12},$receiptLoanDetail ['explanation'] );
  1999. $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey13}.':B'.${'ln'.$lnKey13})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2000. $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey14}.':B'.${'ln'.$lnKey14})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2001. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey13},'(' . $receiptLoanDetail ['receiptOrder'] . ')本次费用合计' );
  2002. $obj->getActiveSheet()->getStyle('B'.${'ln'.$lnKey13})->getAlignment()->setWrapText(true);
  2003. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey13},"¥" . $receiptLoanDetail ['sum'] . "\r\n" . $receiptLoanDetail ['sumCN'] );
  2004. $obj->getActiveSheet()->getRowDimension(${'ln'.$lnKey13})->setRowHeight(36);
  2005. $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey14},'汇款金额');
  2006. $obj->getActiveSheet()->getStyle('B'.${'ln'.$lnKey14})->getAlignment()->setWrapText(true);
  2007. $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey14},"¥" . $receiptLoanDetail ['amount'] . "\r\n" . $receiptLoanDetail ['amountCN'] );
  2008. $obj->getActiveSheet()->getRowDimension(${'ln'.$lnKey14})->setRowHeight(36);
  2009. //绘制计算
  2010. $lnKey=$lnBase+2;$lnKey2=$lnBase+3;$lnKey3=$lnBase+4;$lnKey4=$lnBase+5;
  2011. $lnKey5=$lnBase+6;$lnKey6=$lnBase+7;$lnKey8=$lnBase+9;$lnKey9=$lnBase+10;
  2012. $lnKey10=$lnBase+11;$lnKey11=$lnBase+12;$lnKey12=$lnBase+13;$lnKey14=$lnBase+15;
  2013. $lnKey7=$lnBase+8;$lnKey13=$lnBase+14;
  2014. $lnBase=$lnKey+14;
  2015. $base+=15;
  2016. }
  2017. //die;
  2018. $obj->getActiveSheet ()->setTitle ( '借款' );
  2019. }
  2020. //绘制汇总
  2021. function makeSummaryData($obj,$summary,$aiList){
  2022. //设置居中
  2023. //$obj->getActiveSheet()->getStyle('A1:J1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  2024. for($i=1;$i<=35;$i++){
  2025. $obj->getActiveSheet()->getStyle('A'.$i.':J'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  2026. if ($i>=19){
  2027. $obj->getActiveSheet()->getStyle('A'.$i.':B'.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
  2028. }
  2029. }
  2030. //设置单元格宽
  2031. $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
  2032. $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
  2033. $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
  2034. $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
  2035. $obj->getActiveSheet()->getColumnDimension('E')->setWidth(25);
  2036. $obj->getActiveSheet()->getDefaultRowDimension()->setRowHeight(18);
  2037. $obj->getActiveSheet()->mergeCells('A1:A2');
  2038. $obj->getActiveSheet()->mergeCells('B1:C1');
  2039. $obj->getActiveSheet()->mergeCells('D1:E1');
  2040. $obj->getActiveSheet()->mergeCells('C2:C3');
  2041. $obj->getActiveSheet()->mergeCells('E2:E3');
  2042. $obj->getActiveSheet()->mergeCells('A6:E6');
  2043. $obj->getActiveSheet()->mergeCells('A10:E10');
  2044. $obj->getActiveSheet()->mergeCells('A15:E15');
  2045. $obj->getActiveSheet()->mergeCells('A16:E16');
  2046. //支出详情
  2047. $obj->getActiveSheet()->mergeCells('A18:C18');
  2048. $obj->getActiveSheet()->mergeCells('A19:A35');
  2049. cellColor('A1', 'ddebf7',$obj);cellColor('A2', 'ddebf7',$obj);
  2050. cellColor('B1', 'ddebf7',$obj);cellColor('B2', 'ddebf7',$obj);
  2051. cellColor('C2', 'ddebf7',$obj);cellColor('E2', 'ddebf7',$obj);
  2052. cellColor('D1', 'ddebf7',$obj);cellColor('D2', 'ddebf7',$obj);
  2053. cellColor('E3', 'ddebf7',$obj);cellColor('C3', 'ddebf7',$obj);
  2054. for ($i=3;$i<=15;$i++){
  2055. cellColor('A'.$i, 'ddebf7',$obj);
  2056. }
  2057. //支出详情
  2058. cellColor('A18', 'ddebf7',$obj);cellColor('D18', 'ddebf7',$obj);
  2059. cellColor('E18', 'ddebf7',$obj);cellColor('A19', 'ddebf7',$obj);
  2060. for ($i=19;$i<=35;$i++){
  2061. cellColor('B'.$i, 'ddebf7',$obj);
  2062. }
  2063. //边框
  2064. $styleThinBlackBorderOutline = array(
  2065. 'borders' => array(
  2066. 'allborders' => array( //设置全部边框
  2067. 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
  2068. ),
  2069. ),
  2070. );
  2071. $obj->getActiveSheet()->getStyle( 'A1:E16')->applyFromArray($styleThinBlackBorderOutline);
  2072. //支出详情
  2073. $obj->getActiveSheet()->getStyle( 'A18:E35')->applyFromArray($styleThinBlackBorderOutline);
  2074. $obj->getactivesheet()->setCellValue ( 'A1','汇总项目' );
  2075. $obj->getactivesheet()->setCellValue ( 'B1','收入按开票金额计算' );
  2076. $obj->getactivesheet()->setCellValue ( 'D1','收入按入账金额计算' );
  2077. $obj->getactivesheet()->setCellValue ( 'B2','金额' );
  2078. $obj->getactivesheet()->setCellValue ( 'C2','占比' );
  2079. $obj->getactivesheet()->setCellValue ( 'D2','金额' );
  2080. $obj->getactivesheet()->setCellValue ( 'E2','占比' );
  2081. $obj->getactivesheet()->setCellValue ( 'A3','收入' );
  2082. $obj->getactivesheet()->setCellValue ( 'A4','支出' );
  2083. $obj->getactivesheet()->setCellValue ( 'A5','利润' );
  2084. $obj->getactivesheet()->setCellValue ( 'A6','收入-支出=利润' );
  2085. $obj->getactivesheet()->setCellValue ( 'A7','公司利润' );
  2086. $obj->getactivesheet()->setCellValue ( 'A8','办事处利润' );
  2087. $obj->getactivesheet()->setCellValue ( 'A9','公司收款' );
  2088. $obj->getactivesheet()->setCellValue ( 'A10','收入×40%=办事处利润 收入×60%=公司利润' );
  2089. $obj->getactivesheet()->setCellValue ( 'A11','备用金(借款)' );
  2090. $obj->getactivesheet()->setCellValue ( 'A12','办事处收款' );
  2091. $obj->getactivesheet()->setCellValue ( 'A13','办事处实际支出' );
  2092. $obj->getactivesheet()->setCellValue ( 'A14','付总部款' );
  2093. $obj->getactivesheet()->setCellValue ( 'A15','备用金+办事处收款-办事处实际支出=付总部款' );
  2094. //支出详情
  2095. $obj->getactivesheet()->setCellValue ( 'A18','项目' );
  2096. $obj->getactivesheet()->setCellValue ( 'D18','金额' );
  2097. $obj->getactivesheet()->setCellValue ( 'E18','占入账金额比例' );
  2098. $obj->getactivesheet()->setCellValue ( 'A19','支出明细' );
  2099. $startKey=19;
  2100. foreach ($aiList as $key=>$value){
  2101. $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2102. $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2103. if($value['name']=='讲课费'){
  2104. $obj->getactivesheet()->setCellValue ( 'B'.$startKey,$value['name'] );
  2105. $obj->getActiveSheet()->mergeCells('B'.$startKey.':B'.($startKey+2));
  2106. $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  2107. $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2108. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'外聘' );
  2109. $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['outsideTaxPrice'] );
  2110. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['outsideTaxProportion'].'%' );
  2111. $startKey+=1;
  2112. $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2113. $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2114. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'外聘(不计税)' );
  2115. $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['outsideNoTaxPrice'] );
  2116. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['outsideNoTaxProportion'].'%' );
  2117. $startKey+=1;
  2118. $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2119. $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2120. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'员工' );
  2121. $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['insidePrice'] );
  2122. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['insideProportion'].'%' );
  2123. }elseif($value['name']=='办公费'){
  2124. $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  2125. $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2126. $obj->getactivesheet()->setCellValue ( 'B'.$startKey,$value['name'] );
  2127. $obj->getActiveSheet()->mergeCells('B'.$startKey.':B'.($startKey+1));
  2128. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'办事处支出' );
  2129. $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['categoryPrice'] );
  2130. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['categoryProportion'].'%' );
  2131. $startKey=$startKey+1;
  2132. $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2133. $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2134. $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['companyPrice'] );
  2135. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['companyProportion'].'%' );
  2136. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'公司支出' );
  2137. }elseif($value['name']=='邮寄费'){
  2138. $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  2139. $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2140. $obj->getactivesheet()->setCellValue ( 'B'.$startKey,$value['name'] );
  2141. $obj->getActiveSheet()->mergeCells('B'.$startKey.':B'.($startKey+1));
  2142. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'办事处支出' );
  2143. $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['categoryPrice'] );
  2144. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['categoryProportion'].'%' );
  2145. $startKey=$startKey+1;
  2146. $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2147. $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2148. $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['companyPrice'] );
  2149. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['companyProportion'].'%' );
  2150. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'公司支出' );
  2151. }else{
  2152. $obj->getActiveSheet()->mergeCells('C'.$startKey.':D'.$startKey);
  2153. $obj->getactivesheet()->setCellValue ( 'B'.$startKey,$value['name'] );
  2154. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,$value['priceFormat'] );
  2155. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['proportion'].'%' );
  2156. }
  2157. $startKey++;
  2158. }
  2159. //小计
  2160. $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2161. $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  2162. $obj->getActiveSheet()->mergeCells('C'.$startKey.':D'.$startKey);
  2163. $obj->getactivesheet()->setCellValue ( 'B'.$startKey,'小计' );
  2164. $obj->getactivesheet()->setCellValue ( 'C'.$startKey,$summary[11]['total'] );
  2165. $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$summary[11]['totalProportion'].'%' );
  2166. $startKey=3;
  2167. //内容
  2168. foreach ($summary as $key=>$value){
  2169. $k=$key+$startKey;
  2170. if($k==3){
  2171. $obj->getactivesheet()->setCellValue ( 'B'.$k,$value['invoiceTotalAmount'] );
  2172. $obj->getactivesheet()->setCellValue ( 'D'.$k,$value['invoiceArriveAmount'] );
  2173. }elseif($k==15){
  2174. $k+=1;
  2175. $obj->getactivesheet()->setCellValue ( 'A'.$k,'学员:'.$value['participants'].'人 讲师:'.$value['lectureCount'].' 人' );
  2176. }elseif($k==16){
  2177. }elseif($k==6||$k==10){
  2178. $k+=1;
  2179. $startKey+=1;
  2180. $obj->getactivesheet()->setCellValue ( 'B'.$k,$value[1] );
  2181. $obj->getactivesheet()->setCellValue ( 'C'.$k,$value[2] );
  2182. $obj->getactivesheet()->setCellValue ( 'D'.$k,$value[3] );
  2183. $obj->getactivesheet()->setCellValue ( 'E'.$k,$value[4] );
  2184. }else{
  2185. $obj->getactivesheet()->setCellValue ( 'B'.$k,$value[1] );
  2186. $obj->getactivesheet()->setCellValue ( 'C'.$k,$value[2] );
  2187. $obj->getactivesheet()->setCellValue ( 'D'.$k,$value[3] );
  2188. $obj->getactivesheet()->setCellValue ( 'E'.$k,$value[4] );
  2189. }
  2190. }
  2191. $obj->getActiveSheet ()->setTitle ( '汇总表' );
  2192. }
  2193. function autoCellsWidth($obj,$cellsNub,$str){
  2194. $max=strlen($str)-10;$fontlenght=35;
  2195. if($max>35){
  2196. $fontlenght=$max;
  2197. }
  2198. $obj->getActiveSheet()->getColumnDimension($cellsNub)->setWidth($fontlenght);
  2199. }
  2200. ?>