receipt.func.php 82 KB

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