receipt.func.php 80 KB

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