receipt.func.php 81 KB

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