receipt.func.php 79 KB

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