123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538 |
- <?php
- /*
- * 办事处汇总明细
- */
- function _getReceiptSummaryHtml($cglist,$aiAllList,$dataSummary,$year){
-
-
- $html=array();
- foreach ($cglist as $cgk=>$value){
-
-
- //初始化年合计数组
- foreach ($aiAllList as $yptempk=>$yptempv){
- $yearPriceArray[$value['cid']][$yptempk]=0;
- //栏目细则
- foreach ($yptempv as $k=>$v){
- $yearLawsPriceArray[$value['cid']][$yptempk][$v['name']]=0;
- }
- }
-
-
- //办事处每月数据展示
- $summaryDateHtml='';
- for($month=1;$month<=12;$month++){
- $summaryDateHtml.='<tr>';
- $summaryDateHtml.='<th>'.$value['title'].$month.'月合计</th>
- <td class="taR"></td>
- <td class="taR"></td>
- <td class="taR"></td>
- <td class="taR"></td>
- <td class="taR"></td>
- <td class="taR colGreen"></td>';
-
- $itemHtml='';
- if(isset($dataSummary[$value['cid']])){
- foreach ($aiAllList as $aiak=>$aiav){//总项目
-
- $tempHtml='';$tempPrice=0;
- foreach ($aiav as $k=>$v){//项目细则
- $falg=true;
- foreach ($dataSummary[$value['cid']][$month][$aiak] as $dsk=>$dsv){//数据实体
- if($dsv['item']==$v['name']){
- $tempHtml.='<td class="taR">'.$dsv['price'].'</td>';
- $tempPrice+=$dsv['price'];
- $yearLawsPriceArray[$value['cid']][$aiak][$v['name']]+=$dsv['price'];//该办事处项目细则金额合计
- $falg=false;
- break;
- }
- }
- if($falg){
- $tempHtml.='<td class="taR"></td>';
- }
- }
-
- $yearPriceArray[$value['cid']][$aiak]+=$tempPrice;
-
- $itemHtml.='<td class="taR colRed">'.$tempPrice.'</td>';//每个月份 项目金额合计
- $itemHtml.=$tempHtml;//每个月份项目细则金额
- }
- }else{
- foreach ($aiAllList as $aiak=>$aiav){
- $itemHtml.='<td class="taR colRed"></td>';
- foreach ($aiav as $k=>$v){
- $itemHtml.='<td class="taR"></td>';
- }
- }
- }
-
- $summaryDateHtml.=$itemHtml;
- $summaryDateHtml.='</tr>';
- }
-
-
-
- //办事处全年合计---全年全办事处合计
- $summaryYearHtml='<tr><th>'.$value['title'].'年合计</th>
- <td class="taR"></td>
- <td class="taR"></td>
- <td class="taR"></td>
- <td class="taR"></td>
- <td class="taR"></td>
- <td class="taR colGreen"></td>';
- foreach ($aiAllList as $aalk=>$aalv){
- if(!isset($topYearPrice[$aalk])){
- $topYearPrice[$aalk]=0;
- }
- //栏目
- $summaryYearHtml.='<td class="taR colRed">'.$yearPriceArray[$value['cid']][$aalk].'</td>';
- $topYearPrice[$aalk]+=$yearPriceArray[$value['cid']][$aalk];
- //栏目细则
- foreach ($aalv as $k=>$v){
- if(!isset($topYearLawsPrice[$aalk][$v['name']])){
- $topYearLawsPrice[$aalk][$v['name']]=0;
- }
-
- $summaryYearHtml.='<th>'.$yearLawsPriceArray[$value['cid']][$aalk][$v['name']].'</th>';
- $topYearLawsPrice[$aalk][$v['name']]+=$yearLawsPriceArray[$value['cid']][$aalk][$v['name']];
- }
- }
- $summaryYearHtml.='</tr>';
-
- $html[$value['cid']]['total']=$summaryYearHtml; //办事处合计
- $html[$value['cid']]['allMonth']=$summaryDateHtml; //办事处每月合计
- }
-
- //全办事处全年合计
- $topYearTempHtml='<tr><th>'.$year.'年合计</th>
- <td class="taR"></td><td class="taR"></td><td class="taR"></td><td class="taR"></td><td class="taR"></td>
- <td class="taR colGreen"></td>';
- foreach ($aiAllList as $aalk=>$aalv){
- //栏目
- $topYearTempHtml.='<td class="taR colRed">'.$topYearPrice[$aalk].'</td>';
- //栏目细则
- foreach ($aalv as $k=>$v){
- $topYearTempHtml.='<th>'.$topYearLawsPrice[$aalk][$v['name']].'</th>';
- }
- }
- $topYearTempHtml.='</tr>';
-
- //各办事处占比
- $categoryHtml='';
- foreach ($cglist as $cgk=>$value){
- $categoryProportionHtml='<tr><th>'.$value['title'].'费用占比</th>
- <td class="taR"></td><td class="taR"></td><td class="taR"></td><td class="taR"></td><td class="taR"></td>
- <td class="taR colGreen"></td>';
- foreach ($aiAllList as $aalk=>$aalv){
- //合计占比-栏目
- if(empty($yearPriceArray[$value['cid']][$aalk])||empty($topYearPrice[$aalk])){
- $categoryProportionHtml.='<td class="taR colRed"></td>';
- }else{
- $proportionTotal=$yearPriceArray[$value['cid']][$aalk]/$topYearPrice[$aalk];
- $categoryProportionHtml.='<td class="taR colRed">'.(int)($proportionTotal*100).'%</td>';
- }
-
- //栏目细则
- foreach ($aalv as $k=>$v){
- //细则占比计算
- if(empty($yearLawsPriceArray[$value['cid']][$aalk][$v['name']])||empty($topYearLawsPrice[$aalk][$v['name']])){
- $categoryProportionHtml.='<th></th>';
- }else{
- $proportionLawsTotal=$yearLawsPriceArray[$value['cid']][$aalk][$v['name']]/$topYearLawsPrice[$aalk][$v['name']];
- $categoryProportionHtml.='<th>'.(int)($proportionLawsTotal*100).'%</th>';
- }
- }
- }
- $categoryProportionHtml.='</tr>';
-
-
- $categoryHtml.=$html[$value['cid']]['total'];
- $categoryHtml.=$categoryProportionHtml;
- $categoryHtml.=$html[$value['cid']]['allMonth'];
- }
-
- $topHtml='';
- $topHtml.=$topYearTempHtml;//全年合计
- $topHtml.=$categoryHtml;//办事处合计
-
- return $topHtml;
- }
- /**
- * 获得借款单详情
- */
- function _getReceiptLoanHtml($receiptDetail, $verifylist, $extendHtml = '') {
- $receiptDetail ['loanItem'] = json_decode ( $receiptDetail ['loanItem'], true );
- $receiptDetail ['sumCN'] = num_to_rmb ( $receiptDetail ['sum'] );
- $receiptDetail ['loanSumCN'] = num_to_rmb ( $receiptDetail ['loanSum'] );
- $receiptDetail ['amountCN'] = num_to_rmb ( $receiptDetail ['amount'] );
-
- $executeCopy = getExecuteStaff ( $receiptDetail );
- // print_r ( $executeCopy );
-
- $html = '<div class="saeaList">
- <div class="entry loan-list" style="margin-bottom: 50px">
- <div class="seal"></div>
- <div class="seTable">
- <table class="table table-bordered table-condensed table-hover">
- <tbody>
- <tr>
- <th colspan="2" class="taC">借款费用</th>
- </tr>
- <tr>
- <th>借款费用</th>
- <td class="taR" width="140">¥' . $receiptDetail ['loanItem'] ['借款费用'] [0] ['price'] . '</td>
- </tr>
-
- <tr>
- <th class="taC" colspan="2">产生费用所在办事处</th>
- </tr>
- <tr>
- <th style="text-align: center" colspan="2">' . $receiptDetail ['category'] [0] ['title'] . '</th>
- </tr>
- <tr>
- <th colspan="2" class="taC">汇款信息</th>
- </tr>
- <tr>
- <th>汇款人户名</th>
- <td>' . $receiptDetail ['remittanceName'] . '</td>
- </tr>
- <tr>
- <th>汇款银行</th>';
-
- if ($receiptDetail ['remittanceBankType'] == 0)
- $html .= '<td>广发银行</td>';
- elseif ($receiptDetail ['remittanceBankType'] == 1)
- $html .= '<td>其他</td>';
-
- $html .= '</tr>
- <tr>
- <th>汇款开户银行名称</th>
- <td>' . $receiptDetail ['bankName'] . '</td>
- </tr>
- <tr>
- <th>汇款帐号</th>
- <td>' . $receiptDetail ['bankNumber'] . '</td>
- </tr>';
- if ($receiptDetail ['remittanceBankType'] == 1)
- $html .= '<tr>
- <th>联行号</th>
- <td>' . $receiptDetail ['coupletNumber'] . '</td>
- </tr>';
-
- $html .= '<tr>
- <th class="taC" colspan="2">费用说明</th>
- </tr>
- <tr>
- <td colspan="2">' . $receiptDetail ['explanation'] . '</td>
- </tr>
-
- <tr class="warning">
- <td class="taR"><b>(' . $receiptDetail ['receiptOrder'] . ')本次费用合计</b></td>
- <td class="taR"><b style="font-size: 24px">¥' . $receiptDetail ['sum'] . '</b><br>' . $receiptDetail ['sumCN'] . '</td>
- </tr>
- <tr class="warning">
- <td class="taR"><b>汇款金额</b></td>
- <td class="taR" width="140"><b style="font-size: 24px">¥' . $receiptDetail ['amount'] . '</b><br>' . $receiptDetail ['amountCN'] . '</td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="seCensor loan-censor">
- <div class="title">' . $receiptDetail ['receiptOrder'] . '</div>
- <div class="censorList clearfix censorHeight" style="height: 548px;">
- <ul>
- <li class="post">
- <div class="avtra">
- <img src="' . $receiptDetail ['staffDetail'] ['avatar'] . '_2.jpg" width="32">
- </div>
- <div class="comment">
- <p>
- <span class="fR">' . $receiptDetail ['date'] . '</span>' . $receiptDetail ['staffDetail'] ['username'] . '
- </p>
- <p>提交审批</p>
- </div>
- </li>';
- foreach ( $verifylist as $key => $value ) {
- $html .= '<li ';
- if ($value ['status'] == 1) {
- $html .= 'class="done"';
- } elseif ($value ['status'] == 3) {
- $html .= 'class="undone"';
- }
- $html .= '>
- <div class="avtra">
- <img src="' . $value [2] . '_2.jpg" width="32">
- </div>
- <div class="comment">
- <p class="colGray">
- <span class="fR">' . $value ['date'] . '</span>' . $value [1] . '';
- if (isset ( $value ['rolename'] )) {
- $html .= '(' . $value ['rolename'] . ')';
- }
- $html .= '</p>
- <p>' . $value ['opinion'] . '</p>
- </div>
- </li>';
- }
-
- foreach ( $executeCopy as $key => $value ) {
- $html .= '<li ';
- if ($value ['status'] == 1) {
- $html .= 'class="done"';
- } elseif ($value ['status'] == 3) {
- $html .= 'class="undone"';
- }
- $html .= '>
- <div class="avtra">
- <img src="' . $value [2] . '_2.jpg" width="32">
- </div>
- <div class="comment">
- <p class="colGray">
- <span class="fR">' . $value ['date'] . '</span>' . $value [1] . '(费用执行)
- </p>
- <p>' . $value ['opinion'] . '</p>
- </div>
- </li>';
- }
- $html .= '
- </ul>
- </div>
- </div>
- </div>
-
- ' . $extendHtml . '
-
- </div>';
- return $html;
- }
- function _getPaymentsCollectPayByYearHtml($statisticsPay = array()) {
- $html = '';
- $subtotalSum = array (
- 1 => 0,
- 2 => 0,
- 3 => 0,
- 4 => 0,
- 5 => 0,
- 6 => 0,
- 7 => 0,
- 8 => 0,
- 9 => 0,
- 10 => 0,
- 11 => 0,
- 12 => 0
- );
- for($i = 1; $i <= 15; $i ++) {
-
- if ($i == 1) {
-
- $html = '<tr><th colspan="2" >银行手续费</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsPay as $key => $value ) {
- if ($value ['expenditureMsg'] == '' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
- $sum += $value ['payPrice'];
- $subtotalSum [$month] += $value ['payPrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colRed">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 2) {
-
- $html .= '<tr><th colspan="2" >总部电话费</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsPay as $key => $value ) {
- if ($value ['expenditureMsg'] == '' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
- $sum += $value ['payPrice'];
- $subtotalSum [$month] += $value ['payPrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colRed">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 3) {
-
- $subtotal = array (
- 1 => 0,
- 2 => 0,
- 3 => 0,
- 4 => 0,
- 5 => 0,
- 6 => 0,
- 7 => 0,
- 8 => 0,
- 9 => 0,
- 10 => 0,
- 11 => 0,
- 12 => 0
- );
- $html .= '<tr><th rowspan="4" width="90">缴税</th>';
- $html .= '<th width="90">增值税</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsPay as $key => $value ) {
- if ($value ['expenditureMsg'] == '增值税' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
- $sum += $value ['payPrice'];
- $subtotal [$month] += $value ['payPrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90">税金附加</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsPay as $key => $value ) {
- if ($value ['expenditureMsg'] == '税金附加' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
- $sum += $value ['payPrice'];
- $subtotal [$month] += $value ['payPrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90">企业所得税</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsPay as $key => $value ) {
- if ($value ['expenditureMsg'] == '企业所得税' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
- $sum += $value ['payPrice'];
- $subtotal [$month] += $value ['payPrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90" class="colRed">小计</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $sum += $subtotal [$month];
- $subtotalSum [$month] += $subtotal [$month];
-
- if (! empty ( $subtotal [$month] ))
- $html .= '<td class="taR colRed">¥' . $subtotal [$month] . '</td>';
- else
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colRed">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 5) {
-
- $html .= '<tr><th colspan="2" >保证金</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsPay as $key => $value ) {
- if ($value ['expenditureMsg'] == '' && $value ['month'] == $month && $value ['expenditureType'] == $i) {
- $html .= '<td class="taR">¥' . abs ( $value ['payPrice'] ) . '</td>';
- $sum += abs ( $value ['payPrice'] );
- $subtotalSum [$month] += abs ( $value ['payPrice'] );
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colRed">¥' . $sum . '</td>';
- $html .= '</tr>';
- }
- }
-
- $html .= '<tr><th class="taR" colspan="2">合计</th>';
- $sum = 0;
- foreach ( $subtotalSum as $key => $value ) {
- $sum += $value;
- if (! empty ( $value ))
- $html .= '<td class="taR colGreen">¥' . $value . '</td>';
- else
- $html .= '<td class="taR">-</td>';
- }
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- $html .= '<tr class="warning"><td class="taR" colspan="2"><b>全年合计</b></td>
- <td class="colGreed taR" colspan="14"><b style="font-size:24px">¥' . $sum . '</b></td></tr>';
-
- return array (
- 'html' => $html,
- 'sum' => $sum
- );
- }
- /**
- * 获得汇总 日常收支年
- * @param array $statisticsIncome
- * @return string
- */
- function _getPaymentsCollectByYearHtml($statisticsIncome = array()) {
- $html = '';
- $subtotalSum = array (
- 1 => 0,
- 2 => 0,
- 3 => 0,
- 4 => 0,
- 5 => 0,
- 6 => 0,
- 7 => 0,
- 8 => 0,
- 9 => 0,
- 10 => 0,
- 11 => 0,
- 12 => 0
- );
- for($i = 1; $i <= 15; $i ++) {
-
- if ($i == 1) {
- $subtotal = array (
- 1 => 0,
- 2 => 0,
- 3 => 0,
- 4 => 0,
- 5 => 0,
- 6 => 0,
- 7 => 0,
- 8 => 0,
- 9 => 0,
- 10 => 0,
- 11 => 0,
- 12 => 0
- );
- $html .= '<tr><th rowspan="4" width="90">利息收入</th>';
- $html .= '<th width="90">银行存款</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '银行存款' && $value ['month'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90">活期理财收益</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '活期理财收益' && $value ['month'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90">固定理财收益</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '固定理财收益' && $value ['month'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90">个人借款</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '个人借款' && $value ['month'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90" class="colGreen">小计</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $sum += $subtotal [$month];
- $subtotalSum [$month] += $subtotal [$month];
-
- if (! empty ( $subtotal [$month] ))
- $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
- else
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 2) {
-
- $subtotal = array (
- 1 => 0,
- 2 => 0,
- 3 => 0,
- 4 => 0,
- 5 => 0,
- 6 => 0,
- 7 => 0,
- 8 => 0,
- 9 => 0,
- 10 => 0,
- 11 => 0,
- 12 => 0
- );
- $html .= '<tr><th rowspan="3" width="90">补贴收入</th>';
- $html .= '<th width="90">社保</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '社保' && $value ['month'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90">财政</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '财政' && $value ['month'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90" class="colGreen">小计</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $sum += $subtotal [$month];
- $subtotalSum [$month] += $subtotal [$month];
- if (! empty ( $subtotal [$month] ))
- $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
- else
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 3) {
-
- $html .= '<tr><th colspan="2" >纵横知道</th>';
-
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '' && $value ['month'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotalSum [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
-
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 4) {
-
- $subtotal = array (
- 1 => 0,
- 2 => 0,
- 3 => 0,
- 4 => 0,
- 5 => 0,
- 6 => 0,
- 7 => 0,
- 8 => 0,
- 9 => 0,
- 10 => 0,
- 11 => 0,
- 12 => 0
- );
- $html .= '<tr><th rowspan="3" width="90">借款收回</th>';
- $html .= '<th width="90">备用金</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '备用金' && $value ['month'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90">私人借款</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '私人借款' && $value ['month'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90" class="colGreen">小计</th>';
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $sum += $subtotal [$month];
- $subtotalSum [$month] += $subtotal [$month];
- if (! empty ( $subtotal [$month] ))
- $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
- else
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 5) {
-
- $html .= '<tr><th colspan="2" >退汇</th>';
-
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '' && $value ['month'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotalSum [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 6) {
-
- $html .= '<tr><th colspan="2" >其他</th>';
-
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '' && $value ['month'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotalSum [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 8) {
-
- $html .= '<tr><th colspan="2" >保证金</th>';
-
- $sum = 0;
- for($month = 1; $month <= 12; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '' && $value ['month'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotalSum [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- }
- }
-
- $html .= '<tr><th class="taR" colspan="2">合计</th>';
- $sum = 0;
- foreach ( $subtotalSum as $key => $value ) {
- $sum += $value;
- if (! empty ( $value ))
- $html .= '<td class="taR colGreen">¥' . $value . '</td>';
- else
- $html .= '<td class="taR">-</td>';
- }
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- $html .= '<tr class="warning"><td class="taR" colspan="2"><b>全年合计</b></td>
- <td class="colGreed taR" colspan="14"><b style="font-size:24px">¥' . $sum . '</b></td></tr>';
-
- return array (
- 'html' => $html,
- 'sum' => $sum
- );
- }
- /**
- * 获得汇总 日常收支年
- * @param array $statisticsIncome
- * @return string
- */
- function _getPaymentsCollectByDayHtml($statisticsIncome = array(), $day = 0) {
- $html = '<tr><th class="taC" colspan="2">日常收入</th>';
-
- for($d = 1; $d <= $day; $d ++) {
- $subtotalSum [$d] = 0;
- $html .= '<th class="taC" width="80">' . $d . '日</th>';
- }
- $html .= '<th class="taC" width="110">总计</th></tr>';
-
- for($i = 1; $i <= 15; $i ++) {
-
- if ($i == 1) {
-
- for($d = 1; $d <= $day; $d ++) {
- $subtotal [$d] = 0;
- }
-
- // $subtotal = array (
- // 1 => 0,
- // 2 => 0,
- // 3 => 0,
- // 4 => 0,
- // 5 => 0,
- // 6 => 0,
- // 7 => 0,
- // 8 => 0,
- // 9 => 0,
- // 10 => 0,
- // 11 => 0,
- // 12 => 0
- // );
- $html .= '<tr><th rowspan="4" width="90">利息收入</th>';
- $html .= '<th width="90">银行存款</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '银行存款' && $value ['day'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90">理财收益</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '理财收益' && $value ['day'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90">个人借款</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '个人借款' && $value ['day'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90" class="colGreen">小计</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $sum += $subtotal [$month];
- $subtotalSum [$month] += $subtotal [$month];
-
- if (! empty ( $subtotal [$month] ))
- $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
- else
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 2) {
-
- for($d = 1; $d <= $day; $d ++) {
- $subtotal [$d] = 0;
- }
- $html .= '<tr><th rowspan="3" width="90">补贴收入</th>';
- $html .= '<th width="90">社保</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '社保' && $value ['day'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90">财政</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '财政' && $value ['day'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90" class="colGreen">小计</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $sum += $subtotal [$month];
- $subtotalSum [$month] += $subtotal [$month];
- if (! empty ( $subtotal [$month] ))
- $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
- else
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 3) {
-
- $html .= '<tr><th colspan="2" >纵横知道</th>';
-
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '' && $value ['day'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotalSum [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
-
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 4) {
-
- for($d = 1; $d <= $day; $d ++) {
- $subtotal [$d] = 0;
- }
- $html .= '<tr><th rowspan="3" width="90">借款收回</th>';
- $html .= '<th width="90">备用金</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '备用金' && $value ['day'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90">私人借款</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '私人借款' && $value ['day'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotal [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90" class="colGreen">小计</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $sum += $subtotal [$month];
- $subtotalSum [$month] += $subtotal [$month];
- if (! empty ( $subtotal [$month] ))
- $html .= '<td class="taR colGreen">¥' . $subtotal [$month] . '</td>';
- else
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 5) {
-
- $html .= '<tr><th colspan="2" >退汇</th>';
-
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '' && $value ['day'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotalSum [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 6) {
-
- $html .= '<tr><th colspan="2" >其他</th>';
-
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '' && $value ['day'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotalSum [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 8) {
-
- $html .= '<tr><th colspan="2" >保证金</th>';
-
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsIncome as $key => $value ) {
- if ($value ['accountMsg'] == '' && $value ['day'] == $month && $value ['accountType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['inComePrice'] . '</td>';
- $sum += $value ['inComePrice'];
- $subtotalSum [$month] += $value ['inComePrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- }
- }
-
- $html .= '<tr><th class="taR" colspan="2">合计</th>';
- $sum = 0;
- foreach ( $subtotalSum as $key => $value ) {
- $sum += $value;
- if (! empty ( $value ))
- $html .= '<td class="taR colGreen">¥' . $value . '</td>';
- else
- $html .= '<td class="taR">-</td>';
- }
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- $colspan = $day + 1;
- $html .= '<tr class="warning"><td class="taR" colspan="2"><b>全月合计</b></td>
- <td class="colGreed taR" colspan="' . $colspan . '"><b style="font-size:24px">¥' . $sum . '</b></td></tr>';
-
- return array (
- 'html' => $html,
- 'sum' => $sum
- );
- }
- function _getPaymentsCollectPayByDayHtml($statisticsPay = array(), $day = 0) {
- $html = '<tr><th class="taC" colspan="2">日常支出</th>';
-
- for($d = 1; $d <= $day; $d ++) {
- $subtotalSum [$d] = 0;
- $html .= '<th class="taC" width="80">' . $d . '日</th>';
- }
- $html .= '<th class="taC" width="110">总计</th></tr>';
-
- for($i = 1; $i <= 15; $i ++) {
-
- if ($i == 1) {
-
- $html .= '<tr><th colspan="2" >银行手续费</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsPay as $key => $value ) {
- if ($value ['expenditureMsg'] == '' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
- $sum += $value ['payPrice'];
- $subtotalSum [$month] += $value ['payPrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colRed">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 2) {
-
- $html .= '<tr><th colspan="2" >总部电话费</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsPay as $key => $value ) {
- if ($value ['expenditureMsg'] == '' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
- $sum += $value ['payPrice'];
- $subtotalSum [$month] += $value ['payPrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colRed">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 3) {
-
- for($d = 1; $d <= $day; $d ++) {
- $subtotal [$d] = 0;
- }
- $html .= '<tr><th rowspan="4" width="90">缴税</th>';
- $html .= '<th width="90">增值税</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsPay as $key => $value ) {
- if ($value ['expenditureMsg'] == '增值税' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
- $sum += $value ['payPrice'];
- $subtotal [$month] += $value ['payPrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90">税金附加</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsPay as $key => $value ) {
- if ($value ['expenditureMsg'] == '税金附加' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
- $sum += $value ['payPrice'];
- $subtotal [$month] += $value ['payPrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90">企业所得税</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsPay as $key => $value ) {
- if ($value ['expenditureMsg'] == '企业所得税' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
- $html .= '<td class="taR">¥' . $value ['payPrice'] . '</td>';
- $sum += $value ['payPrice'];
- $subtotal [$month] += $value ['payPrice'];
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR">¥' . $sum . '</td>';
- $html .= '</tr>';
-
- $html .= '<th width="90" class="colRed">小计</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $sum += $subtotal [$month];
- $subtotalSum [$month] += $subtotal [$month];
-
- if (! empty ( $subtotal [$month] ))
- $html .= '<td class="taR colRed">¥' . $subtotal [$month] . '</td>';
- else
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colRed">¥' . $sum . '</td>';
- $html .= '</tr>';
- } elseif ($i == 5) {
-
- $html .= '<tr><th colspan="2" >保证金</th>';
- $sum = 0;
- for($month = 1; $month <= $day; $month ++) {
- $falg = true;
- foreach ( $statisticsPay as $key => $value ) {
- if ($value ['expenditureMsg'] == '' && $value ['day'] == $month && $value ['expenditureType'] == $i) {
- $html .= '<td class="taR">¥' . abs ( $value ['payPrice'] ) . '</td>';
- $sum += abs ( $value ['payPrice'] );
- $subtotalSum [$month] += abs ( $value ['payPrice'] );
- $falg = false;
- break;
- }
- }
- if ($falg)
- $html .= '<td class="taR">-</td>';
- }
- if ($sum == 0)
- $html .= '<td class="taR">-</td>';
- else
- $html .= '<td class="taR colRed">¥' . $sum . '</td>';
- $html .= '</tr>';
- }
- }
-
- $html .= '<tr><th class="taR" colspan="2">合计</th>';
- $sum = 0;
- foreach ( $subtotalSum as $key => $value ) {
- $sum += $value;
- if (! empty ( $value ))
- $html .= '<td class="taR colGreen">¥' . $value . '</td>';
- else
- $html .= '<td class="taR">-</td>';
- }
- $html .= '<td class="taR colGreen">¥' . $sum . '</td>';
- $html .= '</tr>';
- $colspan = $day + 1;
- $html .= '<tr class="warning"><td class="taR" colspan="2"><b>全月合计</b></td>
- <td class="colGreed taR" colspan="' . $colspan . '"><b style="font-size:24px">¥' . $sum . '</b></td></tr>';
-
- return array (
- 'html' => $html,
- 'sum' => $sum
- );
- }
- function getExecuteStaff($receiptDetail) {
- // 费用执行人相关数据
- $executeCopy = json_decode ( $receiptDetail ['executeCopy'], true );
- $executeStaff = json_decode ( $receiptDetail ['executeStaff'], true );
- foreach ( $executeCopy as $k => $v ) {
- $executeCopy [$k] ['date'] = '';
- $executeCopy [$k] ['opinion'] = '';
- $executeCopy [$k] ['status'] = '';
- if (! empty ( $executeStaff ))
- foreach ( $executeStaff as $m => $u ) {
- if ($v [0] == $m) {
- $executeCopy [$k] ['date'] = $u ['date'];
- $executeCopy [$k] ['opinion'] = $u ['opinion'];
- $executeCopy [$k] ['status'] = $u ['status'];
- break;
- }
- }
- }
- $receiptDetail ['executeCopy'] = $executeCopy;
- return $receiptDetail ['executeCopy'];
- }
- function num_to_rmb($num) {
- $c1 = "零壹贰叁肆伍陆柒捌玖";
- $c2 = "分角元拾佰仟万拾佰仟亿";
- // 精确到分后面就不要了,所以只留两个小数位
- $num = round ( $num, 2 );
- // 将数字转化为整数
- $num = $num * 100;
- if (strlen ( $num ) > 10) {
- return "金额太大,请检查";
- }
- $i = 0;
- $c = "";
- while ( 1 ) {
- if ($i == 0) {
- // 获取最后一位数字
- $n = substr ( $num, strlen ( $num ) - 1, 1 );
- } else {
- $n = $num % 10;
- }
- // 每次将最后一位数字转化为中文
- $p1 = substr ( $c1, 3 * $n, 3 );
- $p2 = substr ( $c2, 3 * $i, 3 );
-
- if ($n != '0' || ($n == '0' && ($p2 == '亿' || $p2 == '万' || $p2 == '元'))) {
- $c = $p1 . $p2 . $c;
- } else {
- $c = $p1 . $c;
- }
- $i = $i + 1;
- // 去掉数字最后一位了
-
- $num = $num / 10;
- // echo $num.'</br>';
- $num = ( int ) $num;
- // $num =floor($num);
- // $num = round ( $num, 0, PHP_ROUND_HALF_DOWN );
- // echo $num.'</br>';
- // 结束循环
- if ($num == 0) {
- break;
- }
- }
- // echo $c.'</br>';
- $j = 0;
- $slen = strlen ( $c );
- while ( $j < $slen ) {
- // utf8一个汉字相当3个字符
- $m = substr ( $c, $j, 6 );
- // 处理数字中很多0的情况,每次循环去掉一个汉字“零”
- if ($m == '零元' || $m == '零万' || $m == '零亿' || $m == '零零') {
- $left = substr ( $c, 0, $j );
- $right = substr ( $c, $j + 3 );
- $c = $left . $right;
- $j = $j - 3;
- $slen = $slen - 3;
- }
- $j = $j + 3;
- }
- // 这个是为了去掉类似23.0中最后一个“零”字
- if (substr ( $c, strlen ( $c ) - 3, 3 ) == '零') {
- $c = substr ( $c, 0, strlen ( $c ) - 3 );
- }
- // 将处理的汉字加上“整”
- if (empty ( $c )) {
- return "零元整";
- } else {
- return $c . "整";
- }
- }
- /**
- * 数据导出
- * @param array $title 标题行名称
- * @param array $data 导出数据
- * @param string $fileName 文件名
- * @param string $savePath 保存路径
- * @param $type 是否下载 false--保存 true--下载
- * @return string 返回文件全路径
- * @throws PHPExcel_Exception
- * @throws PHPExcel_Reader_Exception @exportExcel(array('姓名','年龄'), array(array('a',21),array('b',23)), '档案', './', true);
- */
- function exportExcel($title = array(), $data = array(), $fileName = '', $savePath = './', $isDown = false) {
- Doo::loadClass ( 'PHPExcel1.7.9/PHPExcel' );
- $obj = new PHPExcel ();
-
- // 横向单元格标识
- $cellName = array (
- 'A',
- 'B',
- 'C',
- 'D',
- 'E',
- 'F',
- 'G',
- 'H',
- 'I',
- 'J',
- 'K',
- 'L',
- 'M',
- 'N',
- 'O',
- 'P',
- 'Q',
- 'R',
- 'S',
- 'T',
- 'U',
- 'V',
- 'W',
- 'X',
- 'Y',
- 'Z',
- 'AA',
- 'AB',
- 'AC',
- 'AD',
- 'AE',
- 'AF',
- 'AG',
- 'AH',
- 'AI',
- 'AJ',
- 'AK',
- 'AL',
- 'AM',
- 'AN',
- 'AO',
- 'AP',
- 'AQ',
- 'AR',
- 'AS',
- 'AT',
- 'AU',
- 'AV',
- 'AW',
- 'AX',
- 'AY',
- 'AZ'
- );
-
- $obj->getActiveSheet ( 0 )->setTitle ( 'sheet名称' ); // 设置sheet名称
- $_row = 0; // 设置纵向单元格标识
- if ($title) {
- $_cnt = count ( $title );
- // $obj->getActiveSheet(0)->mergeCells('A'.$_row.':'.$cellName[$_cnt-1].$_row); //合并单元格
- // $obj->setActiveSheetIndex(0)->setCellValue('A'.$_row, '数据导出:'.date('Y-m-d H:i:s')); //设置合并后的单元格内容
- $_row ++;
- $i = 0;
- foreach ( $title as $v ) { // 设置列标题
- $obj->setActiveSheetIndex ( 0 )->setCellValue ( $cellName [$i] . $_row, $v );
- $i ++;
- }
- $_row ++;
- }
- ;
- // html_entity_decode("".$value['order_id']);
-
- // 填写数据
- if ($data) {
- $i = 0;
- foreach ( $data as $_v ) {
- $j = 0;
- foreach ( $_v as $_cell ) {
- $obj->getActiveSheet ( 0 )->setCellValueExplicit ( $cellName [$j] . ($i + $_row), $_cell, PHPExcel_Cell_DataType::TYPE_STRING );
- $j ++;
- }
- $i ++;
- }
- }
-
- // 文件名处理
- if (! $fileName) {
- $fileName = uniqid ( time (), true );
- }
-
- $objWrite = PHPExcel_IOFactory::createWriter ( $obj, 'Excel2007' );
-
- if ($isDown) { // 网页下载
- header ( 'pragma:public' );
- header ( "Content-Disposition:attachment;filename=$fileName.xls" );
- header ( 'Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' );
- $objWrite->save ( 'php://output' );
- exit ();
- }
-
- $_fileName = iconv ( "utf-8", "gb2312", $fileName ); // 转码
- $_savePath = $savePath . $_fileName . '.xlsx';
- $objWrite->save ( $_savePath );
-
- return $savePath . $fileName . '.xlsx';
- }
- function cellColor($cells,$color,$obj){
-
- $obj->getActiveSheet()->getStyle($cells)->getFill()->applyFromArray(array(
- 'type' => PHPExcel_Style_Fill::FILL_SOLID,
- 'startcolor' => array(
- 'rgb' => $color
- )
- ));
- }
- /**
- * 导出办事处全年汇中明细execl
- */
- function excelRCData($summaryData,$aiAllList,$year){
- Doo::loadClass ( 'PHPExcel1.7.9/PHPExcel' );
- $obj = new PHPExcel ();
-
- //表头计算
- $cellCount=$last=0;$sectionCount=array();
- foreach ($aiAllList as $key=>$value){
- //栏目细则个数
- $sectionCount[$key]=count($value)+1;
- $cellCount+=$sectionCount[$key];
-
- $sectionCount[$key]=$sectionCount[$key]+7;
- $last=$sectionCount[$key];
- }
- $cellCount=$cellCount+7;
-
-
- //设置宽高
- $colNum=1;$maxCol='ZZ';
- for ($col='A';$colNum<=$cellCount;$col++){
- $obj->getActiveSheet()->getColumnDimension($col)->setWidth(18);
- cellColor($col.'1', 'ddebf7',$obj);cellColor($col.'2', 'ddebf7',$obj);
- cellColor($col.'3', 'ddebf7',$obj);
-
- //合并收入单元格
- if($colNum>1||$colNum>=7){
- //$obj->getActiveSheet()->mergeCells($col.'1:'.$col.'2');
- }
-
- $colNum++;
- if($colNum==$cellCount){
- $maxCol=$col;
- }
-
- }
- $obj->getActiveSheet()->getDefaultRowDimension()->setRowHeight(18);
-
- //设置边框
- $styleThinBlackBorderOutline = array('borders' => array(
- 'allborders' => array( //设置全部边框
- 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
- ),),);
- $obj->getActiveSheet()->getStyle( 'A1:'.$maxCol.'3')->applyFromArray($styleThinBlackBorderOutline);
-
- //设置合并单元格
- $obj->getActiveSheet()->mergeCells('A1:A3');
- $obj->getActiveSheet()->mergeCells('B1:G2');
- $obj->getActiveSheet()->mergeCells('H1:'.$maxCol.'1');
-
- // echo (int)($cellCount/26).'</br>';
- // echo ($cellCount%26).'</br>';
-
- // echo $cellCount;die;
- // cellColor('A1:', 'ddebf7',$obj);
-
- //$obj->getActiveSheet()->getStyle('A1:J1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
-
- $objWrite = PHPExcel_IOFactory::createWriter ( $obj, 'Excel2007' );
- header ( 'pragma:public' );
- header ( "Content-Disposition:attachment;filename=".$year."办事处费用明细.xlsx" );
- header ( 'Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' );
- $objWrite->save ( 'php://output' );
- exit ();
- }
- /*
- * 处理Excel导出
- * @param $datas array
- * 设置表格数据
- * @param $titlename string
- * 设置head @param $title string 设置表头
- */
- function excelData($trainData, $receiptDetail, $summary, $aiList,$receiptLoanDetail,$invoiceList,$RItemList,$lecturerList,$invoiceTrainingDetail) {
- Doo::loadClass ( 'PHPExcel1.7.9/PHPExcel' );
- $obj = new PHPExcel ();
-
-
- //设置合并单元格
- $obj->getActiveSheet()->mergeCells('A1:D1');
- //设置居中--//字体加粗
- $obj->getActiveSheet()->getStyle('A1:J1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
- $i=2;
- for(;$i<=20;$i++){
- $obj->getActiveSheet()->getStyle('A'.$i.':J'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
- //$obj->getActiveSheet()->getStyle('A'.$i)->getFont()->setName('宋体')->setBold(true);
- //$obj->getActiveSheet()->getStyle('C'.$i)->getFont()->setName('宋体')->setBold(true);
- }
-
- $styleThinBlackBorderOutline = array(
- 'borders' => array(
- 'allborders' => array( //设置全部边框
- 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
- ),
- ),
- );
- $obj->getActiveSheet()->getStyle( 'A1:D9')->applyFromArray($styleThinBlackBorderOutline);
- for ($i=1;$i<=9;$i++){
- cellColor('A'.$i, 'ddebf7',$obj);
- }
- cellColor('C2', 'ddebf7',$obj);cellColor('C3', 'ddebf7',$obj);
- cellColor('C4', 'ddebf7',$obj);cellColor('C8', 'ddebf7',$obj);
- cellColor('C6', 'ddebf7',$obj);cellColor('C7', 'ddebf7',$obj);
-
- //设置单元格宽
- $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('E')->setWidth(25);
- $obj->getActiveSheet()->getDefaultRowDimension()->setRowHeight(18);
-
- $obj->getActiveSheet()->getStyle('A1')->getFont()->setName('宋体')->setBold(true);
-
- $obj->getactivesheet()->setCellValue ( 'A1','培训班信息' );
-
- $obj->getactivesheet()->setCellValue ( 'A2','培训班名称' );
- $obj->getactivesheet()->setCellValue ( 'B2',$trainData['trainName'] );
- $obj->getactivesheet()->setCellValue ( 'C2','所在办事处' );
- $obj->getactivesheet()->setCellValue ( 'D2',$trainData['categoryName'] );
-
- $obj->getactivesheet()->setCellValue ( 'A3','开班时间' );
- $obj->getactivesheet()->setCellValue ( 'B3',$trainData['trainStartDate'] );
- $obj->getactivesheet()->setCellValue ( 'C3','结束时间' );
- $obj->getactivesheet()->setCellValue ( 'D3',$trainData['trainEndDate'] );
-
- $obj->getactivesheet()->setCellValue ( 'A4','参加人数' );
- $obj->getactivesheet()->setCellValue ( 'B4',$trainData['participants'] );
- $obj->getactivesheet()->setCellValue ( 'C4','培训班地址' );
- autoCellsWidth($obj,'D',$trainData ['trainAddress']);
- $obj->getactivesheet()->setCellValue ( 'D4',$trainData['trainAddress'] );
-
- $obj->getactivesheet()->setCellValue ( 'A5','备注' );
- $obj->getActiveSheet()->mergeCells('B5:D5');
- $obj->getactivesheet()->setCellValue ( 'B5',$trainData['trainRemarks'] );
-
- $obj->getActiveSheet()->mergeCells('A6:D6');
- $obj->getActiveSheet()->getStyle('A6:D6')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
- $obj->getactivesheet()->setCellValue ( 'A6','汇款信息' );
-
- $obj->getactivesheet()->setCellValue ( 'A7','汇款人户名' );
- $obj->getactivesheet()->setCellValue ( 'B7',$receiptDetail['remittanceName'] );
- $obj->getactivesheet()->setCellValue ( 'C7','汇款银行' );
- if(0==$receiptDetail['remittanceBankType']){
- $obj->getactivesheet()->setCellValue ( 'D7','广发银行' );
- }else{
- $obj->getactivesheet()->setCellValue ( 'D7',其他 );
- }
-
- $obj->getactivesheet()->setCellValue ( 'A8','汇款开户银行名称' );
-
- autoCellsWidth($obj,'B',$receiptDetail ['bankName']);
-
- $obj->getactivesheet()->setCellValue ( 'B8',$receiptDetail['bankName'] );
- $obj->getactivesheet()->setCellValue ( 'C8','汇款帐号' );
- $obj->getActiveSheet()->setCellValueExplicit('D8',$receiptDetail['bankNumber'],PHPExcel_Cell_DataType::TYPE_STRING);
- //$obj->getactivesheet()->setCellValue ( 'D7',$receiptDetail['bankNumber'].'' );
-
- if(0==$receiptDetail['remittanceBankType']){
- $obj->getactivesheet()->setCellValue ( 'A9','联行号' );
- $obj->getActiveSheet()->mergeCells('B9:D9');
- $obj->getactivesheet()->setCellValue ( 'B9',$receiptDetail['coupletNumber'] );
- }
- $obj->setActiveSheetIndex(0);
- $obj->getActiveSheet ()->setTitle ( '信息' );
-
- //------------------------------------------------------------------------------------------
- $obj->createSheet();
- $obj->setActiveSheetIndex(1);
- makeSummaryData($obj,$summary,$aiList);
-
- //------------------------------------------------------------------------------------------
- //绘制借款
- $obj->createSheet();
- $obj->setActiveSheetIndex(2);
- makeReceiptLoanData($obj,$receiptLoanDetail);
-
- //------------------------------------------------------------------------------------------
- //绘制收入
- $obj->createSheet();
- $obj->setActiveSheetIndex(3);
- makeInvoiceData($obj,$invoiceList,$invoiceTrainingDetail);
-
- //------------------------------------------------------------------------------------------
- //绘制支出
- $obj->createSheet();
- $obj->setActiveSheetIndex(4);
- makeItemData($obj,$RItemList);
-
- //------------------------------------------------------------------------------------------
- //绘制讲师
- $obj->createSheet();
- $obj->setActiveSheetIndex(5);
- makeLecturerData($obj,$lecturerList);
-
- $objWrite = PHPExcel_IOFactory::createWriter ( $obj, 'Excel2007' );
- header ( 'pragma:public' );
- header ( "Content-Disposition:attachment;filename=".$trainData['trainName'].".xlsx" );
- header ( 'Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' );
- $objWrite->save ( 'php://output' );
- exit ();
- }
- function makeLecturerData($obj,$lecturerList){
- //整体字体位置
- $invoiceCount=count($lecturerList)+2;
- for($i=1;$i<=$invoiceCount;$i++){
- $obj->getActiveSheet()->getStyle('A'.$i.':E'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
- $obj->getActiveSheet()->getStyle('A'.$i.':E'.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
- $obj->getActiveSheet()->getRowDimension($i)->setRowHeight(18);
- }
- $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('E')->setWidth(25);
- //边框
- $styleThinBlackBorderOutline = array(
- 'borders' => array(
- 'allborders' => array( //设置全部边框
- 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
- ),
- ),);
- $obj->getActiveSheet()->getStyle( 'A1:E'.$invoiceCount)->applyFromArray($styleThinBlackBorderOutline);
- cellColor('A1', 'ddebf7',$obj);cellColor('B1', 'ddebf7',$obj);
- cellColor('C1', 'ddebf7',$obj);cellColor('D1', 'ddebf7',$obj);cellColor('E1', 'ddebf7',$obj);
- $obj->getactivesheet()->setCellValue ( 'A1','类型' );
- $obj->getactivesheet()->setCellValue ( 'B1','讲师姓名' );
- $obj->getactivesheet()->setCellValue ( 'C1','授课日数' );
- $obj->getactivesheet()->setCellValue ( 'D1','日授课费' );
- $obj->getactivesheet()->setCellValue ( 'E1','合计应发授课费' );
- $i=2;$sumPrice=0;
- foreach ($lecturerList as $key=>$value){
- $lecturerName='';
- if($value['ltype']=='OUTSIDE'){
- $lecturerName.='外聘';
- if($value['taxation']==0){
- $lecturerName.='(不计税)';
- }else{
- $lecturerName.='(计税)';
- }
- }else{
- $lecturerName.='员工';
- }
-
- $obj->getactivesheet()->setCellValue ( 'A'.$i,$lecturerName );
-
- $obj->getactivesheet()->setCellValue ( 'B'.$i,$value['lecturerName'] );
-
- $obj->getactivesheet()->setCellValue ( 'C'.$i,$value['schoolDay'] );
- $obj->getactivesheet()->setCellValue ( 'D'.$i,$value['price'] );
- $obj->getactivesheet()->setCellValue ( 'E'.$i,$value['fees'] );
- $sumPrice+=$value['sum'];
- $i++;
- }
- $obj->getactivesheet()->setCellValue ( 'C'.$i,'合计' );
- $obj->getactivesheet()->setCellValue ( 'D'.$i,$sumPrice );
- $obj->getActiveSheet ()->setTitle ( '讲师' );
- }
- function makeItemData($obj,$itemList){
- //整体字体位置
- $invoiceCount=count($itemList)+2;
- for($i=1;$i<=$invoiceCount;$i++){
- $obj->getActiveSheet()->getStyle('A'.$i.':E'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
- $obj->getActiveSheet()->getStyle('A'.$i.':E'.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
- $obj->getActiveSheet()->getRowDimension($i)->setRowHeight(18);
- }
- $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
-
- //边框
- $styleThinBlackBorderOutline = array(
- 'borders' => array(
- 'allborders' => array( //设置全部边框
- 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
- ),
- ),);
- $obj->getActiveSheet()->getStyle( 'A1:E'.$invoiceCount)->applyFromArray($styleThinBlackBorderOutline);
- cellColor('A1', 'ddebf7',$obj);cellColor('B1', 'ddebf7',$obj);
- cellColor('C1', 'ddebf7',$obj);cellColor('D1', 'ddebf7',$obj);
- cellColor('E1', 'ddebf7',$obj);
- $obj->getactivesheet()->setCellValue ( 'A1','日期' );
- $obj->getactivesheet()->setCellValue ( 'B1','类别' );
- $obj->getactivesheet()->setCellValue ( 'C1','金额' );
- $obj->getactivesheet()->setCellValue ( 'D1','经手人' );
- $obj->getactivesheet()->setCellValue ( 'E1','支出描述' );
- $i=2;$maxArray=array();$sumPrice=0;
- foreach ($itemList as $key=>$value){
- $obj->getactivesheet()->setCellValue ( 'A'.$i,$value['date'] );
- $obj->getactivesheet()->setCellValue ( 'B'.$i,$value['item'] );
- $obj->getactivesheet()->setCellValue ( 'C'.$i,$value['price'] );
-
- $obj->getactivesheet()->setCellValue ( 'D'.$i,$value['inputer'] );
- $obj->getactivesheet()->setCellValue ( 'E'.$i,$value['describe'] );
- array_push($maxArray, strlen($value['describe']));
- $sumPrice+=$value['price'];
- $i++;
- }
-
- $obj->getactivesheet()->setCellValue ( 'B'.$i,'合计' );
- $obj->getactivesheet()->setCellValue ( 'C'.$i,$sumPrice );
- $ma=0;
- if (!empty($maxArray)){
- $ma=max($maxArray);
- }
- $max=$ma-10;$fontlenght=25;
-
- if($max>25){
- $fontlenght=$max;
- }
- $obj->getActiveSheet()->getColumnDimension('E')->setWidth($fontlenght);
-
- $obj->getActiveSheet ()->setTitle ( '支出' );
- }
- function makeInvoiceData($obj,$invoiceList,$invoiceTrainingDetail){
-
- //整体字体位置
- $invoiceCount=count($invoiceList)+4;
-
- for($i=1;$i<=$invoiceCount;$i++){
- $obj->getActiveSheet()->getStyle('A'.$i.':I'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
- $obj->getActiveSheet()->getStyle('A'.$i.':I'.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
- $obj->getActiveSheet()->getRowDimension($i)->setRowHeight(18);
- }
- $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('E')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('F')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('G')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('H')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('I')->setWidth(25);
-
- //边框
- $styleThinBlackBorderOutline = array(
- 'borders' => array(
- 'allborders' => array( //设置全部边框
- 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
- ),
- ),);
- $obj->getActiveSheet()->getStyle( 'A1:I2')->applyFromArray($styleThinBlackBorderOutline);
-
- cellColor('A1', 'ddebf7',$obj);cellColor('B1', 'ddebf7',$obj);
- cellColor('C1', 'ddebf7',$obj);cellColor('D1', 'ddebf7',$obj);
- cellColor('E1', 'ddebf7',$obj);cellColor('F1', 'ddebf7',$obj);
- cellColor('H1', 'ddebf7',$obj);cellColor('G1', 'ddebf7',$obj);cellColor('I1', 'ddebf7',$obj);
-
- $obj->getactivesheet()->setCellValue ( 'A1','培训班名称' );
- $obj->getactivesheet()->setCellValue ( 'B1','办事处' );
- $obj->getactivesheet()->setCellValue ( 'C1','创建' );
- $obj->getactivesheet()->setCellValue ( 'D1','开班时间' );
- $obj->getactivesheet()->setCellValue ( 'E1','包含发票' );
- $obj->getactivesheet()->setCellValue ( 'F1','开票金额合计' );
- $obj->getactivesheet()->setCellValue ( 'G1','入账金额合计' );
- $obj->getactivesheet()->setCellValue ( 'H1','公司已收款' );
- $obj->getactivesheet()->setCellValue ( 'I1','办事处已收款' );
-
- if(!empty($invoiceTrainingDetail)){
- $obj->getactivesheet()->setCellValue ( 'A2',$invoiceTrainingDetail['trainName'] );
- $obj->getactivesheet()->setCellValue ( 'B2',$invoiceTrainingDetail['category'][0]['title'] );
- $obj->getactivesheet()->setCellValue ( 'C2',$invoiceTrainingDetail['staff']['username'] );
- $obj->getactivesheet()->setCellValue ( 'D2',$invoiceTrainingDetail['trainDate'] );
- $obj->getactivesheet()->setCellValue ( 'E2',$invoiceTrainingDetail['invoiceTotal'] );
- $obj->getactivesheet()->setCellValue ( 'F2',$invoiceTrainingDetail['invoiceTotalAmount'] );
- $obj->getactivesheet()->setCellValue ( 'G2',$invoiceTrainingDetail['invoiceArriveAmount'] );
- $obj->getactivesheet()->setCellValue ( 'H2',$invoiceTrainingDetail['invoiceCompanyAmount'] );
- $obj->getactivesheet()->setCellValue ( 'I2',$invoiceTrainingDetail['RIAmount'] );
- }
-
-
- //边框
- $styleThinBlackBorderOutline = array(
- 'borders' => array(
- 'allborders' => array( //设置全部边框
- 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
- ),
- ),);
- $obj->getActiveSheet()->getStyle( 'A4:H'.$invoiceCount)->applyFromArray($styleThinBlackBorderOutline);
-
- cellColor('A4', 'ddebf7',$obj);cellColor('B4', 'ddebf7',$obj);
- cellColor('C4', 'ddebf7',$obj);cellColor('D4', 'ddebf7',$obj);
- cellColor('E4', 'ddebf7',$obj);cellColor('F4', 'ddebf7',$obj);
- cellColor('H4', 'ddebf7',$obj);cellColor('G4', 'ddebf7',$obj);
-
-
- $obj->getactivesheet()->setCellValue ( 'A4','开票流水' );
- $obj->getactivesheet()->setCellValue ( 'B4','开票单位(抬头)' );
- $obj->getactivesheet()->setCellValue ( 'C4','发票号' );
- $obj->getactivesheet()->setCellValue ( 'D4','总额' );
- $obj->getactivesheet()->setCellValue ( 'E4','状态' );
- $obj->getactivesheet()->setCellValue ( 'F4','办事处收款' );
- $obj->getactivesheet()->setCellValue ( 'G4','收款流水号' );
- $obj->getactivesheet()->setCellValue ( 'H4','收款银行到账' );
-
- $i=5;$maxArray=array();
- foreach ($invoiceList as $key=>$value){
- $obj->getactivesheet()->setCellValue ( 'A'.$i,$value['invoiceSerial'] );
-
- $title='';
- if(!empty($value['invoiceType'])){
- $title=$value['invoiceCompany'];
- }else{
- $title=$value['invoiceTitle'];
- }
- $obj->getactivesheet()->setCellValue ( 'B'.$i,$title );
-
- $obj->getactivesheet()->setCellValue ( 'C'.$i,$value['invoiceNo'] );
- if(!empty($value['invoiceType'])){
- $obj->getactivesheet()->setCellValue ( 'D'.$i,'专'.$value['invoicePrice'] );
- }else{
- $obj->getactivesheet()->setCellValue ( 'D'.$i,$value['invoicePrice'] );
- }
-
- if($value['untreadStatus']==3){
- $obj->getactivesheet()->setCellValue ( 'E'.$i,'已入账' );
- }else{
- $obj->getactivesheet()->setCellValue ( 'E'.$i,'已出票' );
- }
-
- if($value['untreadStatus']==3){
- if($value['RIstatus']==1){
- $obj->getactivesheet()->setCellValue ( 'F'.$i,'已收款' );
- }
- }else{
- if($value['RIstatus']==1){
- $obj->getactivesheet()->setCellValue ( 'F'.$i,'已收款' );
- }
- }
- $receivablesSerial='';
- $receivablesDate='';$hang=0;
- if($value['untreadStatus']==3){
- foreach ($value['irDetail'] as $k=>$v){
- $receivablesSerial.=$v['receivablesSerial']."\r\n";
- $receivablesDate.=$v['receivablesDate']."\r\n";
- $hang+=8;
- }
- if($hang>8){
- $obj->getActiveSheet()->getRowDimension($i)->setRowHeight(18+$hang);
- }
-
- }
- $obj->getActiveSheet()->getStyle('H'.$i)->getAlignment()->setWrapText(true);
- $obj->getActiveSheet()->getStyle('G'.$i)->getAlignment()->setWrapText(true);
-
- $obj->getactivesheet()->setCellValue ( 'G'.$i,$receivablesSerial );
- $obj->getactivesheet()->setCellValue ( 'H'.$i,$receivablesDate );
-
-
- //按字体多少自动拉长单元格
- array_push($maxArray, strlen($title));
-
- $i++;
- }
- $ma=0;
- if (!empty($maxArray)){
- $ma=max($maxArray);
- }
- $max=$ma-10;$fontlenght=25;
- if($max>25){
- $fontlenght=$max;
- }
- $obj->getActiveSheet()->getColumnDimension('B')->setWidth($fontlenght);
-
-
- $obj->getActiveSheet ()->setTitle ( '收入' );
- }
- function makeReceiptLoanData($obj,$receiptLoanList){
- if (empty($receiptLoanList)){
- $obj->getActiveSheet ()->setTitle ( '借款' );
- return ;
- }
-
- $base=$lnBase=0;$lnKey=1;$lnBase=14;
- //定义行倍数
- $lnKey2=2;$lnKey3=3;$lnKey4=4;$lnKey5=5;
- $lnKey6=6;$lnKey7=7;$lnKey8=8;$lnKey9=9;
- $lnKey10=10;$lnKey11=11;$lnKey12=12;$lnKey13=13;
- $lnKey14=14;
-
- $obj->getActiveSheet()->getColumnDimension('A')->setWidth(35);
- $obj->getActiveSheet()->getColumnDimension('B')->setWidth(35);
- foreach ($receiptLoanList as $key=>$receiptLoanDetail){
- $lineNumber=1;
- $lineNumber=$lineNumber+$base;
- $maxBase=$base+16;
- //echo $maxBase.'<br/>';
- for (;$lineNumber<=$maxBase;$lineNumber++){
- $lineNumberDynamic = 'ln'.$lineNumber;
- $$lineNumberDynamic=$lineNumber;
-
- $obj->getActiveSheet()->getStyle('A'.$lineNumber.':B'.$lineNumber)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
- $obj->getActiveSheet()->getStyle('A'.$lineNumber.':B'.$lineNumber)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
- $obj->getActiveSheet()->getRowDimension($lineNumber)->setRowHeight(18);
- }
-
- //正文
- $receiptLoanDetail ['loanItem'] = json_decode ( $receiptLoanDetail ['loanItem'], true );
- $receiptLoanDetail ['sumCN'] = num_to_rmb ( $receiptLoanDetail ['sum'] );
- $receiptLoanDetail ['loanSumCN'] = num_to_rmb ( $receiptLoanDetail ['loanSum'] );
- $receiptLoanDetail ['amountCN'] = num_to_rmb ( $receiptLoanDetail ['amount'] );
- //echo $receiptLoanDetail ['sumCN'].'<br/>';
- //边框
- $styleThinBlackBorderOutline = array(
- 'borders' => array(
- 'allborders' => array( //设置全部边框
- 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
- ),
- ),);
- $obj->getActiveSheet()->getStyle( 'A'.${'ln'.$lnKey}.':B'.${'ln'.$lnBase})->applyFromArray($styleThinBlackBorderOutline);
-
-
- //绘制颜色
- cellColor('A'.${'ln'.$lnKey}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey3}, 'ddebf7',$obj);
- cellColor('A'.${'ln'.$lnKey2}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey6}, 'ddebf7',$obj);
- cellColor('A'.${'ln'.$lnKey7}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey8}, 'ddebf7',$obj);
- cellColor('A'.${'ln'.$lnKey9}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey10}, 'ddebf7',$obj);
- cellColor('A'.${'ln'.$lnKey5}, 'ddebf7',$obj);cellColor('A'.${'ln'.$lnKey11}, 'ddebf7',$obj);
-
- //正文内容
- $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey}.':B'.${'ln'.$lnKey});
- $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey},'借款费用' );
- $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
- $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey3}.':B'.${'ln'.$lnKey3});
- $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey3},'产生费用所在办事处' );
- $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey3})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
- $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey5}.':B'.${'ln'.$lnKey5});
- $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey5},'汇款信息' );
- $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey5})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
- $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey11}.':B'.${'ln'.$lnKey11});
- $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey11},'费用说明' );
- $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey11})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
-
- $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey2},'借款费用' );
- $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey2},$receiptLoanDetail ['loanItem'] ['借款费用'] [0] ['price'] );
-
- $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey4}.':B'.${'ln'.$lnKey4});
- $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey4},$receiptLoanDetail ['category'] [0] ['title'] );
-
- $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey6},'汇款人户名' );
- $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey7},'汇款银行' );
- $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey8},'汇款开户银行名称' );
- $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey9},'汇款帐号' );
- $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey10},'联行号' );
-
- $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey6},$receiptLoanDetail ['remittanceName'] );
- if ($receiptLoanDetail ['remittanceBankType'] == 0){
- $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey7},'广发银行' );
- }elseif ($receiptLoanDetail ['remittanceBankType'] == 1){
- $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey7},'其他' );
- }
-
- autoCellsWidth($obj,'B',$receiptLoanDetail ['bankName']);
-
- $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey8},$receiptLoanDetail ['bankName'] );
- $obj->getActiveSheet()->setCellValueExplicit('B'.${'ln'.$lnKey9},$receiptLoanDetail ['bankNumber'],PHPExcel_Cell_DataType::TYPE_STRING);
- //$obj->getactivesheet()->setCellValue ( 'B9',$receiptLoanDetail ['bankNumber'] );
- if ($receiptLoanDetail ['remittanceBankType'] == 1){
- $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey10},$receiptLoanDetail ['coupletNumber'] );
- }else{
- $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey10},'' );
- }
-
- $obj->getActiveSheet()->mergeCells('A'.${'ln'.$lnKey12}.':B'.${'ln'.$lnKey12});
- $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey12},$receiptLoanDetail ['explanation'] );
-
- $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey13}.':B'.${'ln'.$lnKey13})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getActiveSheet()->getStyle('A'.${'ln'.$lnKey14}.':B'.${'ln'.$lnKey14})->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey13},'(' . $receiptLoanDetail ['receiptOrder'] . ')本次费用合计' );
- $obj->getActiveSheet()->getStyle('B'.${'ln'.$lnKey13})->getAlignment()->setWrapText(true);
- $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey13},"¥" . $receiptLoanDetail ['sum'] . "\r\n" . $receiptLoanDetail ['sumCN'] );
- $obj->getActiveSheet()->getRowDimension(${'ln'.$lnKey13})->setRowHeight(36);
-
- $obj->getactivesheet()->setCellValue ( 'A'.${'ln'.$lnKey14},'汇款金额');
- $obj->getActiveSheet()->getStyle('B'.${'ln'.$lnKey14})->getAlignment()->setWrapText(true);
- $obj->getactivesheet()->setCellValue ( 'B'.${'ln'.$lnKey14},"¥" . $receiptLoanDetail ['amount'] . "\r\n" . $receiptLoanDetail ['amountCN'] );
- $obj->getActiveSheet()->getRowDimension(${'ln'.$lnKey14})->setRowHeight(36);
-
- //绘制计算
- $lnKey=$lnBase+2;$lnKey2=$lnBase+3;$lnKey3=$lnBase+4;$lnKey4=$lnBase+5;
- $lnKey5=$lnBase+6;$lnKey6=$lnBase+7;$lnKey8=$lnBase+9;$lnKey9=$lnBase+10;
- $lnKey10=$lnBase+11;$lnKey11=$lnBase+12;$lnKey12=$lnBase+13;$lnKey14=$lnBase+15;
- $lnKey7=$lnBase+8;$lnKey13=$lnBase+14;
- $lnBase=$lnKey+14;
-
-
- $base+=15;
- }
- //die;
- $obj->getActiveSheet ()->setTitle ( '借款' );
-
- }
- //绘制汇总
- function makeSummaryData($obj,$summary,$aiList){
- //设置居中
- //$obj->getActiveSheet()->getStyle('A1:J1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
- for($i=1;$i<=35;$i++){
- $obj->getActiveSheet()->getStyle('A'.$i.':J'.$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
- if ($i>=19){
- $obj->getActiveSheet()->getStyle('A'.$i.':B'.$i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
- }
- }
-
- //设置单元格宽
- $obj->getActiveSheet()->getColumnDimension('A')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('B')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('C')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('D')->setWidth(25);
- $obj->getActiveSheet()->getColumnDimension('E')->setWidth(25);
- $obj->getActiveSheet()->getDefaultRowDimension()->setRowHeight(18);
-
- $obj->getActiveSheet()->mergeCells('A1:A2');
- $obj->getActiveSheet()->mergeCells('B1:C1');
- $obj->getActiveSheet()->mergeCells('D1:E1');
- $obj->getActiveSheet()->mergeCells('C2:C3');
- $obj->getActiveSheet()->mergeCells('E2:E3');
- $obj->getActiveSheet()->mergeCells('A6:E6');
- $obj->getActiveSheet()->mergeCells('A10:E10');
- $obj->getActiveSheet()->mergeCells('A15:E15');
- $obj->getActiveSheet()->mergeCells('A16:E16');
- //支出详情
- $obj->getActiveSheet()->mergeCells('A18:C18');
- $obj->getActiveSheet()->mergeCells('A19:A35');
-
- cellColor('A1', 'ddebf7',$obj);cellColor('A2', 'ddebf7',$obj);
- cellColor('B1', 'ddebf7',$obj);cellColor('B2', 'ddebf7',$obj);
- cellColor('C2', 'ddebf7',$obj);cellColor('E2', 'ddebf7',$obj);
- cellColor('D1', 'ddebf7',$obj);cellColor('D2', 'ddebf7',$obj);
- cellColor('E3', 'ddebf7',$obj);cellColor('C3', 'ddebf7',$obj);
- for ($i=3;$i<=15;$i++){
- cellColor('A'.$i, 'ddebf7',$obj);
- }
- //支出详情
- cellColor('A18', 'ddebf7',$obj);cellColor('D18', 'ddebf7',$obj);
- cellColor('E18', 'ddebf7',$obj);cellColor('A19', 'ddebf7',$obj);
-
- for ($i=19;$i<=35;$i++){
- cellColor('B'.$i, 'ddebf7',$obj);
- }
-
- //边框
- $styleThinBlackBorderOutline = array(
- 'borders' => array(
- 'allborders' => array( //设置全部边框
- 'style' => \PHPExcel_Style_Border::BORDER_THIN //粗的是thick
- ),
-
- ),
- );
- $obj->getActiveSheet()->getStyle( 'A1:E16')->applyFromArray($styleThinBlackBorderOutline);
- //支出详情
- $obj->getActiveSheet()->getStyle( 'A18:E35')->applyFromArray($styleThinBlackBorderOutline);
-
- $obj->getactivesheet()->setCellValue ( 'A1','汇总项目' );
- $obj->getactivesheet()->setCellValue ( 'B1','收入按开票金额计算' );
- $obj->getactivesheet()->setCellValue ( 'D1','收入按入账金额计算' );
- $obj->getactivesheet()->setCellValue ( 'B2','金额' );
- $obj->getactivesheet()->setCellValue ( 'C2','占比' );
- $obj->getactivesheet()->setCellValue ( 'D2','金额' );
- $obj->getactivesheet()->setCellValue ( 'E2','占比' );
-
- $obj->getactivesheet()->setCellValue ( 'A3','收入' );
- $obj->getactivesheet()->setCellValue ( 'A4','支出' );
- $obj->getactivesheet()->setCellValue ( 'A5','利润' );
- $obj->getactivesheet()->setCellValue ( 'A6','收入-支出=利润' );
-
- $obj->getactivesheet()->setCellValue ( 'A7','公司利润' );
- $obj->getactivesheet()->setCellValue ( 'A8','办事处利润' );
- $obj->getactivesheet()->setCellValue ( 'A9','公司收款' );
- $obj->getactivesheet()->setCellValue ( 'A10','收入×40%=办事处利润 收入×60%=公司利润' );
-
- $obj->getactivesheet()->setCellValue ( 'A11','备用金(借款)' );
- $obj->getactivesheet()->setCellValue ( 'A12','办事处收款' );
- $obj->getactivesheet()->setCellValue ( 'A13','办事处实际支出' );
- $obj->getactivesheet()->setCellValue ( 'A14','付总部款' );
- $obj->getactivesheet()->setCellValue ( 'A15','备用金+办事处收款-办事处实际支出=付总部款' );
-
- //支出详情
- $obj->getactivesheet()->setCellValue ( 'A18','项目' );
- $obj->getactivesheet()->setCellValue ( 'D18','金额' );
- $obj->getactivesheet()->setCellValue ( 'E18','占入账金额比例' );
- $obj->getactivesheet()->setCellValue ( 'A19','支出明细' );
-
- $startKey=19;
- foreach ($aiList as $key=>$value){
- $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- if($value['name']=='讲课费'){
- $obj->getactivesheet()->setCellValue ( 'B'.$startKey,$value['name'] );
- $obj->getActiveSheet()->mergeCells('B'.$startKey.':B'.($startKey+2));
- $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
- $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'外聘' );
- $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['outsideTaxPrice'] );
- $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['outsideTaxProportion'].'%' );
- $startKey+=1;
- $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'外聘(不计税)' );
- $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['outsideNoTaxPrice'] );
- $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['outsideNoTaxProportion'].'%' );
- $startKey+=1;
- $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'员工' );
- $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['insidePrice'] );
- $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['insideProportion'].'%' );
-
- }elseif($value['name']=='办公费'){
- $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
- $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getactivesheet()->setCellValue ( 'B'.$startKey,$value['name'] );
- $obj->getActiveSheet()->mergeCells('B'.$startKey.':B'.($startKey+1));
- $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'办事处支出' );
- $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['categoryPrice'] );
- $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['categoryProportion'].'%' );
- $startKey=$startKey+1;
- $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['companyPrice'] );
- $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['companyProportion'].'%' );
- $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'公司支出' );
-
- }elseif($value['name']=='邮寄费'){
- $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
- $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getactivesheet()->setCellValue ( 'B'.$startKey,$value['name'] );
- $obj->getActiveSheet()->mergeCells('B'.$startKey.':B'.($startKey+1));
- $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'办事处支出' );
- $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['categoryPrice'] );
- $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['categoryProportion'].'%' );
- $startKey=$startKey+1;
- $obj->getActiveSheet()->getStyle('D'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getactivesheet()->setCellValue ( 'D'.$startKey,$value['companyPrice'] );
- $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['companyProportion'].'%' );
- $obj->getactivesheet()->setCellValue ( 'C'.$startKey,'公司支出' );
- }else{
- $obj->getActiveSheet()->mergeCells('C'.$startKey.':D'.$startKey);
- $obj->getactivesheet()->setCellValue ( 'B'.$startKey,$value['name'] );
- $obj->getactivesheet()->setCellValue ( 'C'.$startKey,$value['priceFormat'] );
- $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$value['proportion'].'%' );
- }
- $startKey++;
- }
- //小计
- $obj->getActiveSheet()->getStyle('C'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getActiveSheet()->getStyle('E'.$startKey)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
- $obj->getActiveSheet()->mergeCells('C'.$startKey.':D'.$startKey);
- $obj->getactivesheet()->setCellValue ( 'B'.$startKey,'小计' );
- $obj->getactivesheet()->setCellValue ( 'C'.$startKey,$summary[11]['total'] );
- $obj->getactivesheet()->setCellValue ( 'E'.$startKey,$summary[11]['totalProportion'].'%' );
-
- $startKey=3;
- //内容
- foreach ($summary as $key=>$value){
- $k=$key+$startKey;
- if($k==3){
- $obj->getactivesheet()->setCellValue ( 'B'.$k,$value['invoiceTotalAmount'] );
- $obj->getactivesheet()->setCellValue ( 'D'.$k,$value['invoiceArriveAmount'] );
- }elseif($k==15){
- $k+=1;
- $obj->getactivesheet()->setCellValue ( 'A'.$k,'学员:'.$value['participants'].'人 讲师:'.$value['lectureCount'].' 人' );
- }elseif($k==16){
-
- }elseif($k==6||$k==10){
- $k+=1;
- $startKey+=1;
- $obj->getactivesheet()->setCellValue ( 'B'.$k,$value[1] );
- $obj->getactivesheet()->setCellValue ( 'C'.$k,$value[2] );
- $obj->getactivesheet()->setCellValue ( 'D'.$k,$value[3] );
- $obj->getactivesheet()->setCellValue ( 'E'.$k,$value[4] );
- }else{
- $obj->getactivesheet()->setCellValue ( 'B'.$k,$value[1] );
- $obj->getactivesheet()->setCellValue ( 'C'.$k,$value[2] );
- $obj->getactivesheet()->setCellValue ( 'D'.$k,$value[3] );
- $obj->getactivesheet()->setCellValue ( 'E'.$k,$value[4] );
-
- }
-
- }
-
- $obj->getActiveSheet ()->setTitle ( '汇总表' );
- }
- function autoCellsWidth($obj,$cellsNub,$str){
- $max=strlen($str)-10;$fontlenght=35;
- if($max>35){
- $fontlenght=$max;
- }
- $obj->getActiveSheet()->getColumnDimension($cellsNub)->setWidth($fontlenght);
- }
- ?>
|