function out_html($gc) { // $gc->sum_tesuryou = get_sum_tesuryou($gc); $gc->sum_tesuryou = get_sum_tesuryou_d($gc); $gc->company_nm = fdb_get_name($gc, "m_company", "company_nm", "company_no", $gc->login_company_no); $arr_todoufuken = fsel_get_arr_todoufuken($gc); $arr_buken_sbt = fdiv_set_buken_sbt_array(); $sql = sql_text_create_d($gc); switch($_GET["si"]) { case "ank": $sql.= " p.anken_no".(($_GET["sa"]=="desc") ? " DESC" : "")." "; break; case "mbi": $sql.= " p.moushikomibi".(($_GET["sa"]=="desc") ? " DESC" : "")." "; break; case "sbt": $sql.= " p.buken_sbt".(($_GET["sa"]=="desc") ? " DESC" : "")." "; break; case "men": $sql.= " p.menseki".(($_GET["sa"]=="desc") ? " DESC" : "")." "; break; case "ran": $sql.= " p.rank_no".(($_GET["sa"]=="desc") ? " DESC" : "")." "; break; case "tod": $sql.= " s.todoufuken_no".(($_GET["sa"]=="desc") ? " DESC" : "")." "; break; case "shi": $sql.= " p.buken_shikucyouson_no".(($_GET["sa"]=="desc") ? " DESC" : "")." "; break; case "muk": $sql.= " c3.c_mukou_flg".(($_GET["sa"]=="desc") ? " DESC" : "")." "; break; case "tes": $sql.= " p.tesuryou".(($_GET["sa"]=="desc") ? " DESC" : "")." "; break; default: $sql.= " p.moushikomibi desc "; } $sql.= f_get_limit($gc->pn, $gc->pl, C_ORDER_LIST_COL_CNT); $rs = $gc->db->query($sql); $row_count = $gc->db->get_row_count(); //ページャーの設定 if($row_count > 0){ $page_arr = f_page_arr("tesuryo_d.php", $row_count, $gc->pl, C_ORDER_LIST_COL_CNT, C_ORDER_PAGE_TAG_CNT); } //ソート関連 $sort_mode["ank"] = ""; $sort_mode["mbi"] = ""; $sort_mode["sbt"] = ""; $sort_mode["men"] = ""; $sort_mode["ran"] = ""; $sort_mode["tod"] = ""; $sort_mode["shi"] = ""; $sort_mode["muk"] = ""; $sort_mode["tes"] = ""; foreach ($sort_mode as $key => &$value) { if($key == $_GET["si"]){ if($_GET["sa"] == "desc"){ $value = " ▼"; }else{ $value = " ▲"; } } } ?> <!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8" /> <title>手数料一覧</title> <!-- *** stylesheet *** --> <link href="css/style.css" rel="stylesheet" type="text/css" media="all" /> <!-- *** javascript *** --> <script type="text/javascript" src="js/listpage.js" charset="utf-8"></script> <script language="JavaScript"> <!-- var submit_flg = false; function run_submit(fname, mode) { document.forms[fname].mode.value = mode; if(submit_flg==false){ //ボタン2度押し対応 submit_flg = true; document.forms[fname].submit(); } } function unload_page(){ submit_flg = false; } window.onunload = unload_page; function search_run(){ var o; o = document.getElementById('mbif_y'); var mbif_y = o.options[ o.selectedIndex ].value; o = document.getElementById('mbif_m'); var mbif_m = o.options[ o.selectedIndex ].value; o = document.getElementById('mbif_d'); var mbif_d = o.options[ o.selectedIndex ].value; o = document.getElementById('mbit_y'); var mbit_y = o.options[ o.selectedIndex ].value; o = document.getElementById('mbit_m'); var mbit_m = o.options[ o.selectedIndex ].value; o = document.getElementById('mbit_d'); var mbit_d = o.options[ o.selectedIndex ].value; document.forms['form_search'].mbif.value = mbif_y + mbif_m + mbif_d; document.forms['form_search'].mbit.value = mbit_y + mbit_m + mbit_d; run_submit('form_search', 'search'); } // --> </script> </head> <body> <!-- Header --> <div id="header"> <div class="shell"> <!-- Logo + Top Nav --> <?php tcom_header_logo_nav($gc) ?> <!-- End Logo + Top Nav --> <!-- Main Nav --> <?php tcom_header_main_nav2($gc, 2) ?> <!-- End Main Nav --> </div> </div> <!-- End Header --> <!-- Container --> <div id="container"> <div class="shell"> <!-- Small Nav --> <div class="small-nav"> <a href="tesuryo_l.php">手数料管理</a> <span>></span> 手数料一覧 </div> <!-- End Small Nav --> <!-- Main --> <div id="main"> <div class="cl"> </div> <!-- Content --> <div id="content"> <!-- Box --> <div class="box"> <!-- Form --> <div class="form"> <form name="form_search" action="tesuryo_d.php" method="get" onsubmit="return false"> <input name="mode" type="hidden" value=""> <input name="mbif" type="hidden" value=""> <input name="mbit" type="hidden" value=""> <div class="box-size4 left"> <p class="inline-field"> <label style="display:inline;">集計期間:</label> <select id="mbif_y" class="field"> <?php echo fsel_get_date_y($gc, $gc->mbif_y) ?> </select><span class="ml05">年</span> <select id="mbif_m" class="field"> <?php echo fsel_get_date_m($gc, $gc->mbif_m) ?> </select><span class="ml05">月</span> <select id="mbif_d" class="field"> <?php echo fsel_get_date_d($gc, $gc->mbif_d) ?> </select><span class="ml05">日</span> ~ <select id="mbit_y" class="field"> <?php echo fsel_get_date_y($gc, $gc->mbit_y) ?> </select><span class="ml05">年</span> <select id="mbit_m" class="field"> <?php echo fsel_get_date_m($gc, $gc->mbit_m) ?> </select><span class="ml05">月</span> <select id="mbit_d" class="field"> <?php echo fsel_get_date_d($gc, $gc->mbit_d) ?> </select><span class="ml05">日</span> <button type="button" class="button color silver ml30" onclick="search_run();">検索</button> </p> </div> <div class="cl"> </div> </form> </div> <!-- End Form --> <!-- Box Head --> <div class="box-head"> <h2 class="left">抽出条件・手数料合計</h2> <div class="right"> <div class="cl"> </div> </div> </div> <!-- End Box Head --> <!-- Form --> <div class="form"> <div class="box-size4 left"> <p class="inline-field"> <label style="display:inline;">集計期間:</label> <?php echo substr($gc->mbif, 0, 4) ?>年<?php echo substr($gc->mbif, 4, 2) ?>月<?php echo substr($gc->mbif, 6, 2) ?>日 ~ <?php echo substr($gc->mbit, 0, 4) ?>年<?php echo substr($gc->mbit, 4, 2) ?>月<?php echo substr($gc->mbit, 6, 2) ?>日 </p> </div> <div style="float:right;"> <label class="ml40" style="display:inline;">手数料合計:</label> <?php echo number_format($gc->sum_tesuryou) ?>円 </div> <div class="cl"> </div> </div> <!-- End Form --> <!-- Box Head --> <div class="box-head"> <h2 class="left">手数料一覧</h2> <div class="right"> <a href="tesuryo_csv.php?mode=2&mbif=<?php echo f_hsc($gc->mbif) ?>&mbit=<?php echo f_hsc($gc->mbit) ?>&company_no=<?php echo f_hsc($gc->login_company_no) ?>" class="custom-button"><span>CSV出力</span></a> </div> </div> <!-- End Box Head --> <!-- Table --> <div class="table"> <?php if($row_count > 0){ ?> <!-- Pagging --> <div class="pagging"> <div class="box-l"> <?php echo $page_arr["cmes_str"].$page_arr["par1_str"].$page_arr["par2_str"]; ?> </div> <div class="box-c"> <div class="margin-center"> <?php echo $page_arr["back_str"].$page_arr["list_str"].$page_arr["deno_str"].$page_arr["next_str"]; ?> </div> </div> <div class="box-r"> <label>表示件数:</label> <?php echo $page_arr["plst_str"] ?> </div> </div> <!-- End Pagging --> <?php } ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr style="border-top:solid 1px #e0e0e0;"> <th width="80" class="ac"><a href="tesuryo_d.php<?php echo f_sq("ank") ?>">案件番号</a><?php echo $sort_mode["ank"] ?></th> <th width="80" class="ac"><a href="tesuryo_d.php<?php echo f_sq("mbi") ?>">申込日</a><?php echo $sort_mode["mbi"] ?></th> <th width="80" class="ac"><a href="tesuryo_d.php<?php echo f_sq("sbt") ?>">種別</a><?php echo $sort_mode["sbt"] ?></th> <th width="80" class="ac"><a href="tesuryo_d.php<?php echo f_sq("men") ?>">延床面積</a><?php echo $sort_mode["men"] ?><br />(平米)</th> <th width="50" class="ac"><a href="tesuryo_d.php<?php echo f_sq("ran") ?>">ランク</a><?php echo $sort_mode["ran"] ?></th> <th width="70"><a href="tesuryo_d.php<?php echo f_sq("tod") ?>">都道府県</a><?php echo $sort_mode["tod"] ?></th> <th><a href="tesuryo_d.php<?php echo f_sq("shi") ?>">市区町村</a><?php echo $sort_mode["shi"] ?></th> <th width="40" class="ac"><a href="tesuryo_d.php<?php echo f_sq("muk") ?>">状態</a><?php echo $sort_mode["muk"] ?></th> <th width="70" class="ac"><a href="tesuryo_d.php<?php echo f_sq("tes") ?>">手数料</a><?php echo $sort_mode["tes"] ?></th> <th width="60" class="ac">詳細</th> </tr> <?php $i = 0; while ($rs->eof==false) { $item_no = $rs->fields["item_no"]; $anken_no = $rs->fields["anken_no"]; $buken_sbt = $rs->fields["buken_sbt"]; $purpose_flg = $rs->fields["purpose_flg"]; $menseki = $rs->fields["menseki"]; $rank_no = get_rank_d($rs); // $rank_no = $rs->fields["rank_no"]; $todoufuken_no = $rs->fields["todoufuken_no"]; $buken_shikucyouson_no = $rs->fields["buken_shikucyouson_no"]; $shikucyouson_nm = $rs->fields["shikucyouson_nm"]; $mukou_flg = $rs->fields["mukou_flg"]; $c_mukou_flg = $rs->fields["c_mukou_flg"]; $m_cnt = $rs->fields["m_cnt"]; $y_cnt = $rs->fields["y_cnt"]; $tesuryou = get_tesuryo_d($rs); // $tesuryou = $rs->fields["tesuryou"]; $moushikomibi = $rs->fields["moushikomibi"]; $menseki = (float)$menseki; $moushikomi_d = substr($moushikomibi, 0, 4)."/".substr($moushikomibi, 5, 2)."/".substr($moushikomibi, 8, 2); $moushikomi_t = substr($moushikomibi, 11); $todoufuken_nm = $arr_todoufuken[$todoufuken_no]; $buken_sbt_nm = $arr_buken_sbt[$buken_sbt]; $arr = fdiv_set_rank_array(); if($rank_no != "L"){ $rank_nm = $arr[$rank_no]; }else{ $rank_nm = "L"; } /* if($purpose_flg == 1){ $rank_nm = "L"; } */ $odd = ""; if(($i % 2)==1){ $odd = " class=\"odd\""; } echo "<tr".$odd.">"; echo "<td class=\"ac\">".$anken_no."</td>"; echo "<td class=\"ac\">".$moushikomi_d."<br />".$moushikomi_t."</td>"; echo "<td class=\"ac\">".f_hsc($buken_sbt_nm)."</td>"; echo "<td class=\"ac\">".f_hsc($menseki)."</td>"; echo "<td class=\"ac\">".f_hsc($rank_nm)."</td>"; echo "<td>".f_hsc($todoufuken_nm)."</td>"; echo "<td>".f_hsc($shikucyouson_nm)."</td>"; echo "<td class=\"ac\" style=\"color: ".($c_mukou_flg==1?"red":"blue").";\">".f_hsc($c_mukou_flg==1?"無効":"有効")."</td>"; echo "<td class=\"ar\">".f_hsc($mukou_flg==1?"0":$tesuryou)."</td>"; // echo "<td class=\"ar\">".f_hsc($mukou_flg==1?"0":number_format($tesuryou))."</td>"; echo "<td class=\"ac\"><button type=\"button\" class=\"list-button\" onclick=\"location.href='item_e.php?item_no=".$item_no."&referrer=tesuryo_d&company_no=".$gc->login_company_no."&mbif=".$gc->mbif."&mbit=".$gc->mbit."';\">詳細</button></td>"; echo "</tr>"; $rs->move_next(); $i++; } $rs->free_result(); if($row_count==0){ echo "<tr>"; echo "<td colspan=\"10\" align=\"center\">データはありません。</td>"; echo "</tr>"; } ?> </table> <?php if($row_count > 0){ ?> <!-- Pagging --> <div class="pagging"> <div class="box-l"> </div> <div class="box-c"> <div class="margin-center"> <?php echo $page_arr["back_str"].$page_arr["list_str"].$page_arr["deno_str"].$page_arr["next_str"]; ?> </div> </div> <div class="box-r"> <label>表示件数:</label> <?php echo $page_arr["plst_str"] ?> </div> </div> <!-- End Pagging --> <?php } ?> </div> <!-- Table --> </div> <!-- End Box --> <div class="cl"> </div> </div> <!-- End Content --> <div class="cl"> </div> </div> <!-- Main --> </div> </div> <!-- End Container --> <!-- Footer --> <?php tcom_footer($gc) ?> <!-- End Footer --> </body> </html> <?php }
function download_csv_file2($gc) { $crlf = "\r\n"; $arr_todoufuken = fsel_get_arr_todoufuken($gc); $rank = fdiv_set_rank_array(); $file_str = ""; unset($line); $line[] = csv_item_edit("案件番号"); $line[] = csv_item_edit("申込日"); $line[] = csv_item_edit("種別"); $line[] = csv_item_edit("延床面積(平米)"); $line[] = csv_item_edit("ランク"); $line[] = csv_item_edit("都道府県"); $line[] = csv_item_edit("市区町村"); $line[] = csv_item_edit("有効"); $line[] = csv_item_edit("無効"); $line[] = csv_item_edit("手数料"); $file_str.= implode(",", $line).$crlf; ///////////////////////////////////////////////////////////// $gc->mbif = $_GET["mbif"]; $y = substr($gc->mbif, 0, 4); $m = substr($gc->mbif, 4, 2); $d = substr($gc->mbif, 6, 4); if(!@checkdate($m, $d, $y)){ $gc->mbif = date("Ym01", time()); } $gc->mbit = $_GET["mbit"]; $y = substr($gc->mbit, 0, 4); $m = substr($gc->mbit, 4, 2); $d = substr($gc->mbit, 6, 4); if(!@checkdate($m, $d, $y)){ $gc->mbit = date("Ymt", time()); } $gc->company_no = $_GET["company_no"]; if(!is_numeric($gc->company_no)){ $gc->company_no = 0; } $gc->company_nm = fdb_get_name($gc, "m_company", "company_nm", "company_no", $gc->company_no); $arr_todoufuken = fsel_get_arr_todoufuken($gc); $arr_buken_sbt = fdiv_set_buken_sbt_array(); $arr_rank = fdiv_set_rank_array(); $sql = sql_text_create_d_csv($gc); $sql.= " p.item_no"; $rs = $gc->db->query($sql); $row_count = $gc->db->get_row_count(); $i = 0; while ($rs->eof==false) { unset($line); $item_no = $rs->fields["item_no"]; $anken_no = $rs->fields["anken_no"]; $buken_sbt = $rs->fields["buken_sbt"]; $menseki = $rs->fields["menseki"]; $purpose_flg = $rs->fields["purpose_flg"]; $rank_no = get_rank_d($rs); // $rank_no = $rs->fields["rank_no"]; $todoufuken_no = $rs->fields["todoufuken_no"]; $buken_shikucyouson_no = $rs->fields["buken_shikucyouson_no"]; $shikucyouson_nm = $rs->fields["shikucyouson_nm"]; $mukou_flg = $rs->fields["mukou_flg"]; $m_cnt = $rs->fields["m_cnt"]; $y_cnt = $rs->fields["y_cnt"]; $tesuryou = get_tesuryo_d($rs); // $tesuryou = $rs->fields["tesuryou"]; $moushikomibi = $rs->fields["moushikomibi"]; $moushikomi_d = substr($moushikomibi, 0, 4)."/".substr($moushikomibi, 5, 2)."/".substr($moushikomibi, 8, 2); $todoufuken_nm = $arr_todoufuken[$todoufuken_no]; $buken_sbt_nm = $arr_buken_sbt[$buken_sbt]; if($rank_no != "L"){ $rank_nm = $arr_rank[$rank_no]; }else{ $rank_nm = "L"; } /* if($purpose_flg == 1){ $rank_nm = "L"; } */ $line[] = csv_item_edit($anken_no); $line[] = csv_item_edit($moushikomi_d); $line[] = csv_item_edit($buken_sbt_nm); $line[] = csv_item_edit($menseki); $line[] = csv_item_edit($rank_nm); $line[] = csv_item_edit($todoufuken_nm); $line[] = csv_item_edit($shikucyouson_nm); $line[] = csv_item_edit($y_cnt); $line[] = csv_item_edit($m_cnt); // $line[] = csv_item_edit($mukou_flg==1?"無効":"有効"); $line[] = csv_item_edit( ( $mukou_flg==1?"0":$tesuryou ) ); // $line[] = csv_item_edit( ( $mukou_flg==1?"0":number_format($tesuryou) ) ); $file_str.= implode(",", $line).$crlf; $rs->move_next(); $i++; } $rs->free_result(); $file_str = mb_convert_encoding($file_str, "sjis-win", C_ENCODING); $file_length = strlen($file_str); $file_name = $gc->company_nm."(".substr($gc->mbif, 0, 4)."年".substr($gc->mbif, 4, 2)."月".substr($gc->mbif, 6, 2)."日から".substr($gc->mbit, 0, 4)."年".substr($gc->mbit, 4, 2)."月".substr($gc->mbit, 6, 2).").csv"; $agent = $_SERVER['HTTP_USER_AGENT']; if(strstr($agent, "MSIE")){ $file_name = urlencode($file_name); } header("Content-Disposition: attachment; filename=".$file_name); header("Content-Length:".$file_length); header("Content-Type: application/octet-stream"); echo $file_str; return true; }