PDFファイルを出力した際の明細行の中身を表示させている行数を修正したいです。
正
例えば明細の中身が
1 サンプル
2 サンプル2
3 サンプル3
4 サンプル4
5 サンプル5
6 サンプル6
と、6行ある場合は上記のように出力させたいのですが、
誤
1 サンプル
2 サンプル2
3 サンプル3
4 サンプル4
5 サンプル5
5 サンプル6
と一番最後の行数だけ前の行数が表示されてしまいます。
すいません、どなたか教えてください。よろしくお願いします。
// 明細行行数分挿入
foreach ( $row as $detail_cnt => &$record ) {
$errResult = $this->getErrDetail($record["view_h_err_kbn_h"], $this->err_columns); $row[$detail_cnt]["err_naiyo"] = $errResult; $csv_row = $this->setBlankToValues ( $row [$detail_cnt], $h_details_out_def ); $csv_row["page"] = $page_cnt; $csv_row ["edit_type"] = ""; if( !isset($row[$detail_cnt+1]) ) $csv_row ["edit_type"] = $edit_type ["1line"]; $csv_rows [] = $csv_row; $row_num ++; // 1回の集約でも明細行が多ければページをまたぐ現在のページ+フッタの数 if ($row_num + 4 > $max_rownum) $page_cnt ++; } $csv_row = $this->makeCsvRow($row [$detail_cnt], $h_footer1_out_def, $page_cnt); $csv_rows [] = $csv_row; $row_num++; $csv_row = $this->makeCsvRow($row [$detail_cnt], $h_footer2_out_def, $page_cnt); $csv_rows [] = $csv_row; $row_num++; $csv_row = $this->makeCsvRow($row [$detail_cnt], $h_footer3_out_def, $page_cnt); $h_footer4_val_def = $this->extractArrayKeys($csv_order,'err_naiyo','edit_type'); $csv_row_ft4 = $this->makeCsvRow($row [$detail_cnt], $h_footer4_out_def, $page_cnt); if(!$this->isSetInRow($csv_row_ft4,$h_footer4_val_def)){//ft4に値が存在するかどうか $csv_row ["edit_type"] = $edit_type ["2lines"]; } $csv_rows [] = $csv_row; $row_num++; //値を取得 $h_footer4_val_def = array_merge($this->extractArrayKeys($csv_order,'err_naiyo','edit_type')); $csv_row = $this->makeCsvRow($row [$detail_cnt], $h_footer4_out_def, $page_cnt); if ($row_num < $max_rownum) { if($this->isSetInRow($csv_row,$h_footer4_val_def)){//$footer4に値があるとき $csv_row ["edit_type"] = $edit_type ["2lines"]; $csv_rows [] = $csv_row; $row_num ++; } $csv_row = $this->setBlankToValues ( $row [1] ); $csv_rows [] = $csv_row; $row_num ++; } else {//最大行よりも大きい場合且つ$footer4の値が存在するとき空欄をいれずに線のみ挿入 if($this->isSetInRow($csv_row,$h_footer4_val_def)){ $csv_row ["edit_type"] = $edit_type ["2lines"]; $csv_rows [] = $csv_row; $row_num ++; } }
// //次の集約があるかチェック存在しない場合処理終了
// if (! isset ( $map [$seqno + 1] ))
// break;
// // (次回集約の明細の数+footer4の有無+footer1,2,3とheaderの合計数)
// $next_rows_num = count ( $map [$seqno + 1] ) + $ft4_err_flg['next_err_flg'] + 5;
// if ($next_rows_num + $row_num >= $max_rownum){
// // 次の集約の項目の終了地点が60を超える場合、ブランク行で明細行余分を埋めて改ページ
// $margin_num = $max_rownum - $row_num;
// if ($margin_num > 0) {
// $blank_lines = $this->getBlankLines( $row [1], $margin_num );
// $csv_rows = array_merge( $csv_rows, $blank_lines );
// }
// $row_num = 0; // 初期化
// $page_cnt ++;
// }
}
//次の集約があるかチェック存在しない場合処理終了 if (! isset ( $map [$seqno + 1] )) break; if($map [$seqno+1] [1] ["view_denpyo_cls"] == DEF_DENPYO_CLS_RYODEN){ // (次回集約の明細の数+footer4の有無+footer1,2,3とheaderの合計数+両伝) $next_rows_num = count ( $map [$seqno + 1] ) + $ft4_err_flg['next_err_flg'] + 5 + 6; } else { // (次回集約の明細の数+footer4の有無+footer1,2,3とheaderの合計数) $next_rows_num = count ( $map [$seqno + 1] ) + $ft4_err_flg['next_err_flg'] + 5; } if($next_rows_num + $row_num >= $max_rownum){ // 次の集約の項目の終了地点がMAX行を超える場合、ブランク行で明細行余分を埋めて改ページ $margin_num = $max_rownum - $row_num; if ($margin_num > 0) { $blank_lines = $this->getBlankLines( $row [1], $margin_num ); $csv_rows = array_merge( $csv_rows, $blank_lines ); } $row_num = 0; // 初期化 $page_cnt ++; } } // 分行用後の行数にあわせ、表示ページ列に値を入力、必要なら空行を挿入しつつ行を出力用のCSVの形に分行した配列の集合を返す。 return $csv_rows;
あなたの回答
tips
プレビュー