미채택 완료

리스트 프린트시 리셋되어 출력됍니다.

2014-08-04 (월) 11:55:25 4,701

특정날짜에서 검색 한후에.

출력버튼 클릭시 검색됀 화면이 클리어됀상태로 출력됍니다.

즉 위에 리스트 메뉴까지만 출력돼고, 아래 결과는 안나옵니다.

15a239da849b8eb575a9cc888f1d75a8_1407120678_3784.gif
form 시작에서  end 종료일까지 선택후 버튼 클릭시 해당자료가 리스트 됍니다.

이후 print 버튼 클릭시.. 이대로 출력이 안돼고, 클리어됀상태로 출력됍니다.

15a239da849b8eb575a9cc888f1d75a8_1407120788_139.gif 

위의 자료소스입니다.

Copy
<?include_once("./_common.php");</body> $title = "구매신청 Report"; header( "Content-type: application/vnd.ms-excel" );   header( "Content-Disposition: attachment; filename=".date("dmYmsh").".xls");  // $title 변수명으로 저장됩니다. 원하는 이름으로 바꾸세요 header( "Content-Description: PHP4 Generated Data" );}?><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><style type="text/css"><!--body {font: small Verdana, Geneva, Arial, Helvetica, sans-serif;color: #666666;background-color: #ffffff;border: 1px solid #999999;}td {font-size: 8pt;}th {font-size: 8pt;}--></style><link rel="stylesheet" href="./css.css" />  <script src="<?=$g4[path]?>/js/jquery-1.9.1.js"></script>  <script src="<?=$g4[path]?>/js/jquery-ui.js"></script><script>  $(function() {$( "#from" ).datepicker({dateFormat:"dd-mm-yy", numberOfMonths: 2, showButtonPanel: true});$( "#end" ).datepicker({dateFormat:"dd-mm-yy", numberOfMonths: 2, showButtonPanel: true});});  </script><script language=javascript>  function win_print() {              self.print();  }</script> <? if($print== "y") { ?><body onload="javascript:win_print()" oncontextmenu="return false" onselect="return false" ondragstart="return false"> <? } ?><table width=100% cellpadding="5" cellspacing="0" border="1" align="center" style="border-collapse:collapse; border:1px gray solid;">    <col width="5"  />    <col width="8%" />    <col width="5%" />    <col width="10%" />    <col width="10%" />    <col width="8%" />    <col width="10%" />    <col width="10%" />    <col width="10%" />    <col /> <col width="8%" /> <tr>    <th colspan=18  align=center>  <table > <form id="inputForm" action="<?=$PHP_SELF?>" method="POST"> <td  align=center>Date to print <font color="blue">From <input id=from type="text"  name="from" readonly> End <input  id=end type="text" name="end" readonly> </font>     <input type="submit" value="List up" style="font-family:Tahoma; font-size:8pt; color:white; line-height:150%; background-color:rgb(153,0,0); border-color:rgb(176,176,176); height:25px;"  align=absmiddle />    </form> </td> <td  width=330 align=center><font style= "font-size:10pt; color=darkgray; Bold;">   구매신청 LIST</font></td> <td  width=130 align=center><a href="print.php?print=y">Print</a></td> <td width=200  align=center><a href="print.php?excel=y">Export to excel</a></td>  </table> </th> </tr>  <tr bgcolor=#CCFFCC>        <th><img src="./img/list_no.gif" border='0'></th>        <th>분류</th>  <th>결재상황</th>  <th>구매자</th>        <th>What kind of Pallet</th>              <th>Total(MT)</a></th>        <th>Total Price(원)</th>  <th>전화번호</th>  <th>결재은행</th>        <th>Comment</th>        <th>Date</th>    </tr><tr> <td><?//$from = "01-07-2014" ;//$end = "09-07-2014" ;if($from != "" && $end != "") {$from_sep = explode("-", $from);$end_sep = explode("-", $end);$from = $from_sep[2]."-".$from_sep[1]."-".$from_sep[0]." 00:00:00"; // 끝날짜에 하루를 더해줘서 쿼리하는 끝날의 끝시간까지 검색!if ( (int)$end_sep[0] < 9 ) $end_sep[0] = '0'.(string)( (int)$end_sep[0]+1 )  ;else  $end_sep[0] = (string)( (int)$end_sep[0]+1 ) ;    $end = $end_sep[2]."-".$end_sep[1]."-".$end_sep[0]." 00:00:00";      $i=1;$table = "g4_write_cust_req"; // 테이블명 입력.cust_req!$query5 = "select * from $table where wr_datetime BETWEEN '$from' AND '$end' and wr_id = wr_parent ";$result5 = sql_query($query5);while($row  = sql_fetch_array($result5)) {?><tr> <td align=center><?=$i?></td>  <td  align=center><?=$row[ca_name]?></td>                                    <? //카테고리명 ?> <td  align=center><font color = "red"><b><?=$row[wr_4]?></b></font></td>     <? //결재상황 ?> <td  align=center><b><?=$row[wr_1]?></b></td>                                <? //구매자 ?> <td  align=center><?=$row[wr_subject]?></td>                                 <? //pallet명 ?> <td  align=right><?=$row[wr_3]?>&nbsp;MT</td>                               <? //수량 ?> <td  align=right><?=number_format($row[wr_5])?>&nbsp;원</td>                <? //총판매가격 ?> <td  align=center><?=$row[wr_6]?></td>                                         <? //전화번호 ?> <td  align=center><?=($row[wr_9])?></td>                                      <? //결재계좌은행 ?> <td  align=center><?=$row[wr_content]?></td>                                  <? //기타사항 ?><? //   $date_sep = explode(" ", $row[wr_datetime]);//   $date_exp = explode("-", $date_sep[0]);//   $local_date = $date_exp[2]."-".$date_exp[1]."-".$date_exp[0]." ".$date_sep[1];?>  <td class="datetime" ><?=$row[wr_datetime]?></td>                               <? //등록일 ?> </tr><?  $i++;    }   // end of while}   // end of if?></td> </tr></table></body>​
 
|

답변 1개 / 댓글 1개

2014-08-04 (월) 12:41:43

<tr>
 <td>
<?
//$from = "01-07-2014" ;
//$end = "09-07-2014" ;
if($from != "" && $end != "") {
$from_sep = explode("-", $from);
$end_sep = explode("-", $end);
$from = $from_sep[2]."-".$from_sep[1]."-".$from_sep[0]." 00:00:00";
// 끝날짜에 하루를 더해줘서 쿼리하는 끝날의 끝시간까지 검색!
if ( (int)$end_sep[0] < 9 ) $end_sep[0] = '0'.(string)( (int)$end_sep[0]+1 )  ;
else  $end_sep[0] = (string)( (int)$end_sep[0]+1 ) ;
   
$end = $end_sep[2]."-".$end_sep[1]."-".$end_sep[0]." 00:00:00";     
$i=1;
$table = "g4_write_cust_req"; // 테이블명 입력.cust_req!
$query5 = "select * from $table where wr_datetime BETWEEN '$from' AND '$end' and wr_id = wr_parent ";
$result5 = sql_query($query5);
while($row  = sql_fetch_array($result5)) {
?>​

이부분 테이블 구조가 이상한건 아닌가요 

답변에 대한 댓글 1개

2014-08-04 (월) 13:11:31
답변감사합니다.
다른부분에서 그대로 복사해오느라 이중으로 쓰였네요.
그래서 고첬습니다. 그래도 프린팅 문제는 여전하네요.
위의 오류하고는 다른문제인듯 싶습니다.

답변을 작성하려면 로그인이 필요합니다.