receipt.func.php 82 KB

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