12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277 |
- <?php
- 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">¥' . $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>';
- }
- }
-
- $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" 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">¥' . $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>';
- }
- }
-
- $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);
- }
- /**
- * 数据导出
- * @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';
- }
- ?>
|