receipt.func.php 86 KB

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