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