날짜별 합계구하기 도와 주세요. > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

날짜별 합계구하기 도와 주세요. 정보

날짜별 합계구하기 도와 주세요.

본문

달력형 일정표 스킨을 사용중입니다.
그림처럼 각 날짜의 총 합계를 구하고 싶습니다.
질답란에 있는 답변을 다 적용해봐도 전체게시물의 총합계만 나오고 날짜별 합계를 못 구현하겠네요.
각 날짜 마지막에 그림처럼 합계:00 이렇게 하고 싶은데요.
수량은 wr_7 필더를 사용중입니다.
회원님들 도움을 부탁드립니다.
아래는 리스트 스킨 소스입니다.
꾸벅.

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

//가로 세로 폭 지정
if (eregi('%', $width)) { $col_width = "14%"; }
else { $col_width = round($width/7); }
$col_height= 80 ;

$prevmonth = $month - 1;
$nextmonth = $month + 1;
$prevyear = $year;
$nextyear = $year;
if ($month == 1) {
  $prevmonth = 12;
  $prevyear = $year - 1;
} elseif ($month == 12) {
  $nextmonth = 1;
  $nextyear = $year + 1;
}

$maxdate = date(t, mktime(0, 0, 0, $month, 1, $year));   // the final date of $month
$offset  = date(w, mktime(0, 0, 0, $month, 1, $year));
?>

 


<a href="<?=$board_skin_path?>/excel.skin.php?bo_table=<?=$bo_table?>" onfocus=this.blur()><img src="<?=$g4[path]?>/img/exl.gif" align=absmiddle border=0></a>
<script type="text/javascript" src="<?=$board_skin_path?>/print_contents.cheditor.js"></script>
                    <a href="#" onclick="javascript:print_contents2('view_Contents', 'commentContents', '<?=$g4[title]?>')">프린트하기</a>

       <img src='<?=$board_skin_path?>/img/1.gif' border=0 align=absmiddle> 배달예정
  <img src='<?=$board_skin_path?>/img/2.gif' border=0 align=absmiddle> 배달완료
  <img src='<?=$board_skin_path?>/img/3.gif' border=0 align=absmiddle> 배달에러
 
  <img src='<?=$board_skin_path?>/img/5.gif' border=0 align=absmiddle> 일정
<div id="view_Contents">

<table   width="100%" height="39" border="0" cellpadding="0" cellspacing="0" background="<?=$board_skin_path?>/img/bar_bg.gif" >
<tr>
 <td width="10"> </td>
 <td valign="bottom">
 <a href='board.php?bo_table=<?=$bo_table?>&mode=m2'><img src="<?=$board_skin_path?>/img/btn_s_01.gif" border=0></a><a href='board.php?bo_table=<?=$bo_table?>&mode=m'><img src="<?=$board_skin_path?>/img/btn_s2_02.gif" border=0></a><a href='board.php?bo_table=<?=$bo_table?>&mode=w'><img src="<?=$board_skin_path?>/img/btn_s2_03.gif" border=0></a><a href='board.php?bo_table=<?=$bo_table?>&mode=l'><img src="<?=$board_skin_path?>/img/btn_s2_04.gif" border=0></a></td>
 <td align="right">

<div align="right">
</span><span class="day4"><?=$year?></span><span class="day5">년</span>
<a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&mode=m2&"?><?if ($month == 1) { $year_pre=$year-1; $month_pre=$month; } else {$year_pre=$year-1; $month_pre=$month;} echo ("year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/y_prev.gif" border="0" title="<?=$year_pre?>년" align="abbottom" /></a> <a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&mode=m2&"?><?if ($month == 12) { $year_pre=$year+1; $month_pre=$month; } else {$year_pre=$year+1; $month_pre=$month;} echo ("&year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/y_next.gif" border="0" title="<?=$year_pre?>년" align="abbottom" /></a> <span class="day4">
<?=$month?>
</span><span class="day5">월</span> <a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&mode=m2&"?><?if ($month == 1) { $year_pre=$year-1; $month_pre=12; } else {$year_pre=$year; $month_pre=$month-1;} echo ("year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/m_prev.gif" border="0" title="<?=$month_pre?>월" align="abbottom" /></a> <a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&mode=m2&"?><? if ($month == 12) { $year_pre=$year+1; $month_pre=1; } else {$year_pre=$year; $month_pre=$month+1;} echo ("&year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/m_next.gif" border="0" title="<?=$month_pre?>월" align="abbottom" /></a></div> </td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tbline1" >
<tr>
 <td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">일</td>
 <td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">월</td>
 <td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">화</td>
 <td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">수</td>
 <td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">목</td>
 <td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">금</td>
 <td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">토</td>
</tr>

<?
$cel_mon = sprintf("%02d",$month);
$query = "SELECT * FROM $write_table WHERE left(wr_link1,6) = '$year$cel_mon' ORDER BY wr_id ASC";
$result = sql_query($query);

// 내용을 보여주는 부분
while ($row = mysql_fetch_array($result)) {
 for ($i = 1 ; $i <= $maxdate;  $i++) {

 


  if( substr($row[wr_link1],6,2) == $i ) {
   switch ($row[wr_3]) {
   case 배달예정 :
    $html_day[$i].= "<br><img src='$board_skin_path/img/1.gif' border=0 align=absmiddle hspace=2 vspace=2>";
    break;
   case 배달완료 :
    $html_day[$i].= "<br><img src='$board_skin_path/img/2.gif' border=0 align=absmiddle hspace=2 vspace=2>";
    break;
   case 배달에러 :
    $html_day[$i].= "<br><img src='$board_skin_path/img/3.gif' border=0 align=absmiddle hspace=2 vspace=2>";
       break;
    case 지출 :
    $html_day[$i].= "<br><img src='$board_skin_path/img/4.gif' border=0 align=absmiddle hspace=2 vspace=2>";
       break;
   default :
    $html_day[$i].= "<br><img src='$board_skin_path/img/5.gif' border=0 align=absmiddle hspace=2 vspace=2>";
   }
   if( $row[wr_6]==입금){
 $html_day[$i].= "<img src='$board_skin_path/img/in.gif' border=0 align=absmiddle hspace=2 vspace=2>";
   
    }

if($row[wr_3]==배달예정||$row[wr_3]==배달완료||$row[wr_3]==배달에러){
   $html_day[$i].= "<a href='./board.php?bo_table=$bo_table&wr_id=$row[wr_id]'>".$row[wr_9]."</a>".      " "."<font color=#ff6600>$row[wr_7]</font>"."\n";
   
  }else{
   $html_day[$i].= "<a href='./board.php?bo_table=$bo_table&wr_id=$row[wr_id]'>".$row[wr_subject]."</a>"."\n";
   }

 }}
}
$rowsum = sql_fetch(" select sum(wr_7) as sum_in from $write_table ");
$rowsum_in = $rowsum[sum_in];
echo "총계수:";
echo "  ";
echo "$rowsum_in";

?>

<?
// 달력의 틀을 보여주는 부분
$temp = 7 - (($maxdate + $offset)%7);
if ($temp == 7) $temp = 0;

$count_day  = 1;
$count_last = $maxdate + $offset + $temp;

for ($count = 1; $count <= $count_last; $count++) {

 if (($count%7) == 1) echo ("<tr>\n"); // 주당 7개씩 한쎌씩을 쌓는다.

 // 날짜가 있을경우
 if ($offset < $count  &&  $count <= $maxdate + $offset) {
  $daytext = "$count_day";   // $count_day 는 숫자

  $bgcolor = "#FFFFFF"; //일반날짜

  if ($thisyear==$year && $thismonth==$month && $thisday==$count_day) {$daytext = "<font color=#ffffff style=background-color:#FF5400;font-weight:bold>$daytext</font>"; $bgcolor = "#ecff98";} //오늘날짜

  if ($count%7 == 1) {$daytext = "<font color=#FF0000>$daytext</font>"; $bgcolor = "#FEFAFF";} // 일요일
  if ($count%7 == 0) {$daytext = "<font color=#0000FF>$daytext</font>"; $bgcolor = "#F0F8FF";} // 토요일

  $tmp = sprintf("%02d",$month)."-".sprintf("%02d",$count_day);
  if ($nal[$tmp]) {
   $title = trim($nal[$tmp][1]);
   $title1 = cut_str($title,8);
   if (trim($nal[$tmp][2]) == "*") {
    $daytext = "<font color=#FF0000>$daytext</font> <font color=#804180><a title=$title>$title1</a></font>";
    $bgcolor = "#FEFAFF";
   } //공휴일
   else {
    $daytext = "$daytext <font color=#804180><a title=$title>$title1</a></font>";
   }
  }
  
  // 여기까지 숫자와 들어갈 내용에 대한 변수들의 세팅이 끝나고

  // 이제 여기 부터 직접 셀이 그려지면서 그 안에 내용이 들어 간다.
  echo ("<td height=$col_height class=tbline2 bgcolor=$bgcolor valign=top>\n");

   //글쓰기 권한여부
  if ($write_href) {
   $f_date = $year.sprintf("%02d",$month).sprintf("%02d",$count_day);
   echo " <a href='$write_href&write[wr_link1]=$f_date'>$daytext</a>\n";
  }
  else {
   echo "$daytext\n";
  }

  echo $html_day[$count_day];
  echo ("</td>\n");  // 한칸을 마무리

 $count_day++; // 날짜를 카운팅
 }

 // 날짜가 없을경우
 else { echo ("<td height=$col_height class=tbline2 bgcolor=#FBFBFB valign=top> </td>\n"); }

 if (($count%7) == 0) echo ("</tr>\n");
}
?>

</table></div>

  • 복사

댓글 전체

소스를 대강 분석해 보니 아래처럼 하면 될 것 같군요...

for ($i = 1 ; $i <= $maxdate;  $i++) {

  // .... 적당한 위치에 아래 소스 추가
  $cel_mon = sprintf("%02d",$month);
  $cel_day = sprintf("%02d",$i);
  $rowsumday = sql_fetch(" select sum(wr_7) as sum_aday from $write_table where left(wr_link1,8) = '$year$cel_mon$cel_day'");
  $sum_day[$i] = $rowsum[sum_aday];

  // 적당한 위치에 합계... 표시
  echo "합계 : $sum_day[$i]";

}
두손모아님.
알려주신대로 했는데 합계라는 글자까지만 나오고 합계는 안나오는군요.
번거로우시더라고 소스 다시한번만 봐주시면 정말 감사하겠습니다.

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

//가로 세로 폭 지정
if (eregi('%', $width)) { $col_width = "14%"; }
else { $col_width = round($width/7); }
$col_height= 80 ;

$prevmonth = $month - 1;
$nextmonth = $month + 1;
$prevyear = $year;
$nextyear = $year;
if ($month == 1) {
  $prevmonth = 12;
  $prevyear = $year - 1;
} elseif ($month == 12) {
  $nextmonth = 1;
  $nextyear = $year + 1;
}

$maxdate = date(t, mktime(0, 0, 0, $month, 1, $year));  // the final date of $month
$offset  = date(w, mktime(0, 0, 0, $month, 1, $year));
?>




<a href="<?=$board_skin_path?>/excel.skin.php?bo_table=<?=$bo_table?>" onfocus=this.blur()><img src="<?=$g4[path]?>/img/exl.gif" align=absmiddle border=0></a>
<script type="text/javascript" src="<?=$board_skin_path?>/print_contents.cheditor.js"></script>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" onclick="javascript:print_contents2('view_Contents', 'commentContents', '<?=$g4[title]?>')">프린트하기</a>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='<?=$board_skin_path?>/img/1.gif' border=0 align=absmiddle> 배달예정
<img src='<?=$board_skin_path?>/img/2.gif' border=0 align=absmiddle> 배달완료
<img src='<?=$board_skin_path?>/img/3.gif' border=0 align=absmiddle> 배달에러

<img src='<?=$board_skin_path?>/img/5.gif' border=0 align=absmiddle> 일정
<div id="view_Contents">

<table  width="100%" height="39" border="0" cellpadding="0" cellspacing="0" background="<?=$board_skin_path?>/img/bar_bg.gif" >
<tr>
<td width="10">&nbsp;</td>
<td valign="bottom">
<a href='board.php?bo_table=<?=$bo_table?>&mode=m2'><img src="<?=$board_skin_path?>/img/btn_s_01.gif" border=0></a><a href='board.php?bo_table=<?=$bo_table?>&mode=m'><img src="<?=$board_skin_path?>/img/btn_s2_02.gif" border=0></a><a href='board.php?bo_table=<?=$bo_table?>&mode=w'><img src="<?=$board_skin_path?>/img/btn_s2_03.gif" border=0></a><a href='board.php?bo_table=<?=$bo_table?>&mode=l'><img src="<?=$board_skin_path?>/img/btn_s2_04.gif" border=0></a></td>
<td align="right">

<div align="right">
</span><span class="day4"><?=$year?></span><span class="day5">년</span>
<a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&mode=m2&"?><?if ($month == 1) { $year_pre=$year-1; $month_pre=$month; } else {$year_pre=$year-1; $month_pre=$month;} echo ("year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/y_prev.gif" border="0" title="<?=$year_pre?>년" align="abbottom" /></a> <a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&mode=m2&"?><?if ($month == 12) { $year_pre=$year+1; $month_pre=$month; } else {$year_pre=$year+1; $month_pre=$month;} echo ("&year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/y_next.gif" border="0" title="<?=$year_pre?>년" align="abbottom" /></a> <span class="day4">
<?=$month?>
</span><span class="day5">월</span> <a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&mode=m2&"?><?if ($month == 1) { $year_pre=$year-1; $month_pre=12; } else {$year_pre=$year; $month_pre=$month-1;} echo ("year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/m_prev.gif" border="0" title="<?=$month_pre?>월" align="abbottom" /></a> <a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&mode=m2&"?><? if ($month == 12) { $year_pre=$year+1; $month_pre=1; } else {$year_pre=$year; $month_pre=$month+1;} echo ("&year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/m_next.gif" border="0" title="<?=$month_pre?>월" align="abbottom" /></a></div> </td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tbline1" >
<tr>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">일</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">월</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">화</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">수</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">목</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">금</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">토</td>
</tr>

<?
$cel_mon = sprintf("%02d",$month);
$query = "SELECT * FROM $write_table WHERE left(wr_link1,6) = '$year$cel_mon' ORDER BY wr_id ASC";
$result = sql_query($query);

// 내용을 보여주는 부분
while ($row = mysql_fetch_array($result)) {
for ($i = 1 ; $i <= $maxdate;  $i++) {




if( substr($row[wr_link1],6,2) == $i ) {
switch ($row[wr_3]) {
case 배달예정 :
$html_day[$i].= "<br><img src='$board_skin_path/img/1.gif' border=0 align=absmiddle hspace=2 vspace=2>";
break;
case 배달완료 :
$html_day[$i].= "<br><img src='$board_skin_path/img/2.gif' border=0 align=absmiddle hspace=2 vspace=2>";
break;
case 배달에러 :
$html_day[$i].= "<br><img src='$board_skin_path/img/3.gif' border=0 align=absmiddle hspace=2 vspace=2>";
    break;
case 지출 :
$html_day[$i].= "<br><img src='$board_skin_path/img/4.gif' border=0 align=absmiddle hspace=2 vspace=2>";
    break;
default :
$html_day[$i].= "<br><img src='$board_skin_path/img/5.gif' border=0 align=absmiddle hspace=2 vspace=2>";
}
if( $row[wr_6]==입금){
$html_day[$i].= "<img src='$board_skin_path/img/in.gif' border=0 align=absmiddle hspace=2 vspace=2>";

}

if($row[wr_3]==배달예정||$row[wr_3]==배달완료||$row[wr_3]==배달에러){
$html_day[$i].= "<a href='./board.php?bo_table=$bo_table&wr_id=$row[wr_id]'>".$row[wr_9]."</a>".      "&nbsp;"."<font color=#ff6600>$row[wr_7]</font>"."\n";

}else{
$html_day[$i].= "<a href='./board.php?bo_table=$bo_table&wr_id=$row[wr_id]'>".$row[wr_subject]."</a>"."\n";
}

}}
}
$rowsum = sql_fetch(" select sum(wr_7) as sum_in from $write_table ");
$rowsum_in = $rowsum[sum_in];
echo "총계수:";
echo "&nbsp;&nbsp;";
echo "$rowsum_in";


 // .... 적당한 위치에 아래 소스 추가

$cel_mon = sprintf("%02d",$month);
  $cel_day = sprintf("%02d",$i);
  $rowsumday = sql_fetch(" select sum(wr_7) as sum_aday from $write_table where left(wr_link1,8) = '$year$cel_mon$cel_day'");
  $sum_day[$i] = $rowsum[sum_aday];


?>

<?
// 달력의 틀을 보여주는 부분
$temp = 7 - (($maxdate + $offset)%7);
if ($temp == 7) $temp = 0;

$count_day  = 1;
$count_last = $maxdate + $offset + $temp;

for ($count = 1; $count <= $count_last; $count++) {

if (($count%7) == 1) echo ("<tr>\n"); // 주당 7개씩 한쎌씩을 쌓는다.

// 날짜가 있을경우
if ($offset < $count  &&  $count <= $maxdate + $offset) {
$daytext = "$count_day";  // $count_day 는 숫자

$bgcolor = "#FFFFFF"; //일반날짜

if ($thisyear==$year && $thismonth==$month && $thisday==$count_day) {$daytext = "<font color=#ffffff style=background-color:#FF5400;font-weight:bold>$daytext</font>"; $bgcolor = "#ecff98";} //오늘날짜

if ($count%7 == 1) {$daytext = "<font color=#FF0000>$daytext</font>"; $bgcolor = "#FEFAFF";} // 일요일
if ($count%7 == 0) {$daytext = "<font color=#0000FF>$daytext</font>"; $bgcolor = "#F0F8FF";} // 토요일

$tmp = sprintf("%02d",$month)."-".sprintf("%02d",$count_day);
if ($nal[$tmp]) {
$title = trim($nal[$tmp][1]);
$title1 = cut_str($title,8);
if (trim($nal[$tmp][2]) == "*") {
$daytext = "<font color=#FF0000>$daytext</font> <font color=#804180><a title=$title>$title1</a></font>";
$bgcolor = "#FEFAFF";
} //공휴일
else {
$daytext = "$daytext <font color=#804180><a title=$title>$title1</a></font>";
}
}

// 여기까지 숫자와 들어갈 내용에 대한 변수들의 세팅이 끝나고

// 이제 여기 부터 직접 셀이 그려지면서 그 안에 내용이 들어 간다.
echo ("<td height=$col_height class=tbline2 bgcolor=$bgcolor valign=top>\n");

//글쓰기 권한여부
if ($write_href) {
$f_date = $year.sprintf("%02d",$month).sprintf("%02d",$count_day);
echo " <a href='$write_href&write[wr_link1]=$f_date'>$daytext</a>\n";
}
else {
echo "$daytext\n";
}

echo $html_day[$count_day];

 // 적당한 위치에 합계... 표시
  echo "합계 : $sum_day[$i]";

echo ("</td>\n");  // 한칸을 마무리

$count_day++; // 날짜를 카운팅
}

// 날짜가 없을경우
else { echo ("<td height=$col_height class=tbline2 bgcolor=#FBFBFB valign=top>&nbsp;</td>\n"); }

if (($count%7) == 0) echo ("</tr>\n");
}
?>

</table></div>
첫번째 소스 위치를 잘못 놓았습니다.
이렇게 넣으셔야 합니다.
그리고
$cel_mon = sprintf("%02d",$month); // 이 줄은 없어도 됩니다. 그 위에 선언되어 있군요.

=============================================

..........
......
...

if( substr($row[wr_link1],6,2) == $i ) {

 // .... 적당한 위치에 아래 소스 추가
  $cel_day = sprintf("%02d",$i);
  $rowsumday = sql_fetch(" select sum(wr_7) as sum_aday from $write_table where left(wr_link1,8) = '$year$cel_mon$cel_day'");
  $sum_day[$i] = $rowsum[sum_aday];

switch ($row[wr_3]) {
case 배달예정 :
$html_day[$i].= "<br><img src='$board_skin_path/img/1.gif' border=0 align=absmiddle hspace=2 vspace=2>";
break;
case 배달완료 :
$html_day[$i].= "<br><img src='$board_skin_path/img/2.gif' border=0 align=absmiddle hspace=2 vspace=2>";
break;
....
...
..
위처럼 해도 안됩니다.ㅜㅜ
합계라는 글자만 나오고 합계가 안나옵니다.

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

//가로 세로 폭 지정
if (eregi('%', $width)) { $col_width = "14%"; }
else { $col_width = round($width/7); }
$col_height= 80 ;

$prevmonth = $month - 1;
$nextmonth = $month + 1;
$prevyear = $year;
$nextyear = $year;
if ($month == 1) {
  $prevmonth = 12;
  $prevyear = $year - 1;
} elseif ($month == 12) {
  $nextmonth = 1;
  $nextyear = $year + 1;
}

$maxdate = date(t, mktime(0, 0, 0, $month, 1, $year));  // the final date of $month
$offset  = date(w, mktime(0, 0, 0, $month, 1, $year));
?>




<a href="<?=$board_skin_path?>/excel.skin.php?bo_table=<?=$bo_table?>" onfocus=this.blur()><img src="<?=$g4[path]?>/img/exl.gif" align=absmiddle border=0></a>
<script type="text/javascript" src="<?=$board_skin_path?>/print_contents.cheditor.js"></script>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" onclick="javascript:print_contents2('view_Contents', 'commentContents', '<?=$g4[title]?>')">프린트하기</a>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='<?=$board_skin_path?>/img/1.gif' border=0 align=absmiddle> 배달예정
<img src='<?=$board_skin_path?>/img/2.gif' border=0 align=absmiddle> 배달완료
<img src='<?=$board_skin_path?>/img/3.gif' border=0 align=absmiddle> 배달에러

<img src='<?=$board_skin_path?>/img/5.gif' border=0 align=absmiddle> 일정
<div id="view_Contents">

<table  width="100%" height="39" border="0" cellpadding="0" cellspacing="0" background="<?=$board_skin_path?>/img/bar_bg.gif" >
<tr>
<td width="10">&nbsp;</td>
<td valign="bottom">
<a href='board.php?bo_table=<?=$bo_table?>&mode=m2'><img src="<?=$board_skin_path?>/img/btn_s_01.gif" border=0></a><a href='board.php?bo_table=<?=$bo_table?>&mode=m'><img src="<?=$board_skin_path?>/img/btn_s2_02.gif" border=0></a><a href='board.php?bo_table=<?=$bo_table?>&mode=w'><img src="<?=$board_skin_path?>/img/btn_s2_03.gif" border=0></a><a href='board.php?bo_table=<?=$bo_table?>&mode=l'><img src="<?=$board_skin_path?>/img/btn_s2_04.gif" border=0></a></td>
<td align="right">

<div align="right">
</span><span class="day4"><?=$year?></span><span class="day5">년</span>
<a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&mode=m2&"?><?if ($month == 1) { $year_pre=$year-1; $month_pre=$month; } else {$year_pre=$year-1; $month_pre=$month;} echo ("year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/y_prev.gif" border="0" title="<?=$year_pre?>년" align="abbottom" /></a> <a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&mode=m2&"?><?if ($month == 12) { $year_pre=$year+1; $month_pre=$month; } else {$year_pre=$year+1; $month_pre=$month;} echo ("&year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/y_next.gif" border="0" title="<?=$year_pre?>년" align="abbottom" /></a> <span class="day4">
<?=$month?>
</span><span class="day5">월</span> <a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&mode=m2&"?><?if ($month == 1) { $year_pre=$year-1; $month_pre=12; } else {$year_pre=$year; $month_pre=$month-1;} echo ("year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/m_prev.gif" border="0" title="<?=$month_pre?>월" align="abbottom" /></a> <a href="<?="$_SERVER[PHP_SELF]?bo_table=$bo_table&mode=m2&"?><? if ($month == 12) { $year_pre=$year+1; $month_pre=1; } else {$year_pre=$year; $month_pre=$month+1;} echo ("&year=$year_pre&month=$month_pre");?>" target="_self" onfocus="this.blur()"><img src="<?=$board_skin_path?>/img/m_next.gif" border="0" title="<?=$month_pre?>월" align="abbottom" /></a></div> </td>
</tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tbline1" >
<tr>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">일</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">월</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">화</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">수</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">목</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">금</td>
<td class="tbline2 bbs_head bbs_fhead" align="center" width="<?=$col_width?>">토</td>
</tr>

<?
$cel_mon = sprintf("%02d",$month);
$query = "SELECT * FROM $write_table WHERE left(wr_link1,6) = '$year$cel_mon' ORDER BY wr_id ASC";
$result = sql_query($query);

// 내용을 보여주는 부분
while ($row = mysql_fetch_array($result)) {
for ($i = 1 ; $i <= $maxdate;  $i++) {




if( substr($row[wr_link1],6,2) == $i ) {

 // .... 적당한 위치에 아래 소스 추가
  $cel_day = sprintf("%02d",$i);
  $rowsumday = sql_fetch(" select sum(wr_7) as sum_aday from $write_table where left(wr_link1,8) = '$year$cel_mon$cel_day'");
  $sum_day[$i] = $rowsum[sum_aday];

switch ($row[wr_3]) {
case 배달예정 :
$html_day[$i].= "<br><img src='$board_skin_path/img/1.gif' border=0 align=absmiddle hspace=2 vspace=2>";
break;
case 배달완료 :
$html_day[$i].= "<br><img src='$board_skin_path/img/2.gif' border=0 align=absmiddle hspace=2 vspace=2>";
break;
case 배달에러 :
$html_day[$i].= "<br><img src='$board_skin_path/img/3.gif' border=0 align=absmiddle hspace=2 vspace=2>";
    break;
case 지출 :
$html_day[$i].= "<br><img src='$board_skin_path/img/4.gif' border=0 align=absmiddle hspace=2 vspace=2>";
    break;
default :
$html_day[$i].= "<br><img src='$board_skin_path/img/5.gif' border=0 align=absmiddle hspace=2 vspace=2>";
}
if( $row[wr_6]==입금){
$html_day[$i].= "<img src='$board_skin_path/img/in.gif' border=0 align=absmiddle hspace=2 vspace=2>";

}

if($row[wr_3]==배달예정||$row[wr_3]==배달완료||$row[wr_3]==배달에러){
$html_day[$i].= "<a href='./board.php?bo_table=$bo_table&wr_id=$row[wr_id]'>".$row[wr_9]."</a>".      "&nbsp;"."<font color=#ff6600>$row[wr_7]</font>"."\n";

}else{
$html_day[$i].= "<a href='./board.php?bo_table=$bo_table&wr_id=$row[wr_id]'>".$row[wr_subject]."</a>"."\n";
}

}}
}
$rowsum = sql_fetch(" select sum(wr_7) as sum_in from $write_table ");
$rowsum_in = $rowsum[sum_in];
echo "총계수:";
echo "&nbsp;&nbsp;";
echo "$rowsum_in";


?>

<?
// 달력의 틀을 보여주는 부분
$temp = 7 - (($maxdate + $offset)%7);
if ($temp == 7) $temp = 0;

$count_day  = 1;
$count_last = $maxdate + $offset + $temp;

for ($count = 1; $count <= $count_last; $count++) {

if (($count%7) == 1) echo ("<tr>\n"); // 주당 7개씩 한쎌씩을 쌓는다.

// 날짜가 있을경우
if ($offset < $count  &&  $count <= $maxdate + $offset) {
$daytext = "$count_day";  // $count_day 는 숫자

$bgcolor = "#FFFFFF"; //일반날짜

if ($thisyear==$year && $thismonth==$month && $thisday==$count_day) {$daytext = "<font color=#ffffff style=background-color:#FF5400;font-weight:bold>$daytext</font>"; $bgcolor = "#ecff98";} //오늘날짜

if ($count%7 == 1) {$daytext = "<font color=#FF0000>$daytext</font>"; $bgcolor = "#FEFAFF";} // 일요일
if ($count%7 == 0) {$daytext = "<font color=#0000FF>$daytext</font>"; $bgcolor = "#F0F8FF";} // 토요일

$tmp = sprintf("%02d",$month)."-".sprintf("%02d",$count_day);
if ($nal[$tmp]) {
$title = trim($nal[$tmp][1]);
$title1 = cut_str($title,8);
if (trim($nal[$tmp][2]) == "*") {
$daytext = "<font color=#FF0000>$daytext</font> <font color=#804180><a title=$title>$title1</a></font>";
$bgcolor = "#FEFAFF";
} //공휴일
else {
$daytext = "$daytext <font color=#804180><a title=$title>$title1</a></font>";
}
}

// 여기까지 숫자와 들어갈 내용에 대한 변수들의 세팅이 끝나고

// 이제 여기 부터 직접 셀이 그려지면서 그 안에 내용이 들어 간다.
echo ("<td height=$col_height class=tbline2 bgcolor=$bgcolor valign=top>\n");

//글쓰기 권한여부
if ($write_href) {
$f_date = $year.sprintf("%02d",$month).sprintf("%02d",$count_day);
echo " <a href='$write_href&write[wr_link1]=$f_date'>$daytext</a>\n";
}
else {
echo "$daytext\n";
}

echo $html_day[$count_day];
// 적당한 위치에 합계... 표시
 echo "합계 : $sum_day[$i]";



echo ("</td>\n");  // 한칸을 마무리

$count_day++; // 날짜를 카운팅
}

// 날짜가 없을경우
else { echo ("<td height=$col_height class=tbline2 bgcolor=#FBFBFB valign=top>&nbsp;</td>\n"); }

if (($count%7) == 0) echo ("</tr>\n");
}
?>

</table></div>
// 적당한 위치에 합계... 표시
 echo "합계 : $sum_day[$i]";

가 아니라

// 적당한 위치에 합계... 표시
 echo "합계 : $sum_day[$count_day]";

이렇게 넣어야 합니다.
이런이런....

// .... 적당한 위치에 아래 소스 추가
  $cel_day = sprintf("%02d",$i);
  $rowsumday = sql_fetch(" select sum(wr_7) as sum_aday from $write_table where left(wr_link1,8) = '$year$cel_mon$cel_day'");
  $sum_day[$i] = $rowsum[sum_aday];  // 이 줄에 오타가 있었습니다. (이 줄은 삭제)
  $sum_day[$i] = $rowsumday[sum_aday]; // 이렇게 수정하세요. (이 줄로 대체)
고생 많았습니다.
실은 저도 님같은 스킨을 찾고 있습니다.
하루 하루 매출 실적등이 알고 싶은데 프로그램으로 하자니
실력이 안되서^^
스킨만 찾아보고 있는데....  저와 똑 같은 생각을 제작중이시네요 ^^
혹시 스킨을 오픈할 생각이 없으신지요...
© SIRSOFT
현재 페이지 제일 처음으로