<?
include getenv("DOCUMENT_ROOT")."/include/session_include.php";

$goStr = "switched=$switched&page=$page&key_word=$key_word&column=$column&sorting_type=$sorting_type&switch=$switch";

//$func->checkAdmin("index.php");


/*
for($i=0; $i<sizeof($_POST); $i++) {
	list($key, $value) = each($_POST);
	$$key = $value;

	if(is_array($value))
	{
		$count = 10;
		for($i = 0; $i < $count; $i ++) {
			if ($value[$i]) echo "ARRAY[$key][$value[$i]]<br>";
		}
	}
	else 	echo "[$key][$value]<br>";
	//print_r($_POST);
}

//exit;
*/


$d_uid = trim($_POST["duid"]);


if($duid == "") {
		$msg = "Invaild data. Please try again. [Err - d_uid / RECEIPT VIEW POPUP]";
		$func -> modalMsg ($msg, 1);
		exit();
} else {

		// Get Information
		$query = "SELECT * FROM tbl_daily WHERE d_uid = '".$d_uid."' LIMIT 1 ";
		$result=$jdb->fQuery($query, "fetch query error");
		//echo"$query";

		for($i=0; $i<sizeof($result); $i++)
		{
			//list($key, $value) = each($result);
			foreach ( (Array) $result as $key => $value )			
				$$key = $value;
		}

		//$d_visitdateSTR = $func -> convertFormat ($d_visitdate, 3);
		
		$d_nameSTR = str_replace("\\", "", $d_name);
		$d_addressSTR = str_replace("\\", "", $d_address);
		$d_accountnoSTR = str_replace("\\", "", $d_accountno);
	
		$d_payeenameSTR = str_replace("\\", "", $d_payeename);
		
		$d_regionSTR = str_replace("\\", "", $d_region);
		$d_drinitialSTR = str_replace("\\", "", $d_drinitial);
		
		$folderPath = getenv("DOCUMENT_ROOT")."/upload_sign/".$d_customeruid;
		
		if (is_file($folderPath."/".trim($d_payeesign))) {
			$d_payeesignSTR = "<img style='border:1px solid;' src='/upload_sign/".$d_customeruid."/".$d_payeesign."'>";
		}
		else {
			$d_payeesignSTR = "None";
		}	
			
		$d_paynoteSTR = str_replace("\\", "", $d_paynote);

		$d_orderdateSTR = $func -> convertFormat ($d_orderdate, 3);

		// Note 정보도 가져와야 함
		$qry_note = "SELECT * FROM tbl_note WHERE n_dailyuid = '$d_uid' ";
		$rt_note=$jdb->fQuery($qry_note, "fetch query error");
		$n_noteSTR = str_replace("\\", "", $rt_note['n_note']);
		
		// Driver 정보
		$qry_dvr = "SELECT m_initial FROM tbl_member WHERE m_uid = '".$d_driveruid."' ";
		$rt_dvr = $jdb->fQuery($qry_dvr, "fetch query error");
		$m_initialSTR = $rt_dvr['m_initial'];

}

?>



<div class="modal-header">
  <h4 class="modal-title">RECEIPT VIEW</h4>
  <button type="button" class="btn" data-bs-dismiss="modal" aria-label="Close" style="color:#fff;"><i class="bi bi-x"></i></button>
</div>
<div class="modal-body">
    <table class="tb-info-box">
      <tr>
        <td class="td-title-info">Order Date</td>
        <td class="td-text-info">
          <?=$d_orderdateSTR?>
        </td>
      </tr>
      <tr>
        <td class="td-title-info">Restaurant Name</td>
        <td class="td-text-info">
          <?=$d_nameSTR?>
        </td>
      </tr>
      <tr>
        <td class="td-title-info">Account No</td>
        <td class="td-text-info">
          <?=$d_accountnoSTR?>
        </td>
      </tr>
      <tr>
        <td class="td-title-info">Address</td>
        <td class="td-text-info">
          <?=$d_addressSTR?>
        </td>
      </tr>
      <tr>
        <td class="td-title-info">Region</td>
        <td class="td-text-info">
          <?=$d_regionSTR?>
        </td>
      </tr>      
      <tr>
        <td class="td-title-info">Driver</td>
        <td class="td-text-info">
          <?=$d_drinitialSTR?>
        </td>
      </tr>
      <tr>
        <td class="td-title-info">Oil Quantity</td>
        <td class="td-text-info">
          <?=$d_quantity?>
        </td>
      </tr>
      <tr>
        <td class="td-title-info">Cash</td>
        <td class="td-text-info">
          <?=$d_payamount?>
        </td>
      </tr>
      <tr>
        <td class="td-title-info">Payee Name</td>
        <td class="td-text-info">
          <?=$d_payeenameSTR?>
        </td>
      </tr>
      <tr>
        <td class="td-title-info">Signature</td>
        <td class="td-text-info">
          <?=$d_payeesignSTR?>
        </td>
      </tr>
<!--
      <tr>
        <td class="td-title-info">Note</td>
        <td class="td-text-info">
          <textarea id="note" class="textarea" name="note" rows="4" cols="20"><?=$n_noteSTR?></textarea>
        </td>
      </tr>
-->
      <tr>
        <td class="td-title-info">Accounting Note</td>
        <td class="td-text-info">
          <textarea id="note" class="textarea" name="note" rows="4" cols="20"><?=$d_paynoteSTR?></textarea>
        </td>
      </tr>            
    </table>
    <br>
    <div class="text-center" width-200>
      <button type="button" class="btn-gray" data-bs-dismiss="modal">CLOSE</button>
    </div>
</div>
      
<!--      
      <div class="modal-header">
        <h4 class="modal-title">DAILY RECORD</h4>
        <button type="button" class="btn" data-bs-dismiss="modal" aria-label="Close" style="color:#fff;"><i class="bi bi-x"></i></button>
      </div>
      <div class="modal-body">

<FORM NAME=dailyrecord id=dailyrecord METHOD=POST ACTION="/lib/user_process.php">
    	<input type=hidden name=actionStr value="DAILYRECORD">
    	<input type=hidden name=actionPage value="">
    	<input type=hidden name=h_uid id=h_uid value="<?=$h_uid?>">
    	<input type=hidden name=h_date id=h_date value="<?=$h_date?>">
    	<input type=hidden name=h_driveruid id=h_driveruid value="<?=$h_driveruid?>">
			<input type=hidden name=mode value="<?=$mode?>">
			    	
			<input type=hidden name=switched value="<?=$getSWHStr?>">
			<input type=hidden name=page value="<?=$page?>">
			<input type=hidden name=key_word value="<?=$key_word?>">
			<input type=hidden name=column value="<?=$column?>">
			<input type=hidden name=sorting_type value="<?=$sorting_type?>">
			<input type=hidden name=switch value="<?=$switch?>">

			
          <table class="tb-info-box">

            <tr>
              <td class="td-title-info">Departure Time</td>
              <td class="td-text-info">
                <input type="text" id="h_departuretime" name="h_departuretime" value="<?=$h_departuretime?>">
              </td>
            </tr>

            <tr>
              <td class="td-title-info">Arrival Time</td>
              <td class="td-text-info">
                <input type="text" id="h_arrivaltime" name="h_arrivaltime" value="<?=$h_arrivaltime?>">
              </td>
            </tr>


            <tr>
              <td class="td-title-info">Cash Return</td>
              <td class="td-text-info">
                <input type="text" id="h_balance_r" name="h_balance_r" value="<?=$cashreturn?>" <?=$readonlySTR?> placeholder="100" maxlength="7">
              </td>
            </tr>
   
            <tr>
              <td class="td-title-info">Cash In</td>
              <td class="td-text-info">
                <input type="text" id="h_balance_in" name="h_balance_in" value="<?=$h_balance_in?>" placeholder="100" maxlength="7">
              </td>
            </tr>

            <tr>
              <td class="td-title-info">Gas</td>
              <td class="td-text-info">
                <input type="text" id="h_balance_g" name="h_balance_g" value="<?=$h_balance_g?>" placeholder="100" maxlength="7">
              </td>
            </tr>


            <tr>
              <td class="td-title-info">Comment</td>
              <td class="td-text-info">
                <textarea id="h_comment" class="textarea" name="h_comment" rows="4" cols="20"><?=$h_commentSTR?></textarea>
              </td>
            </tr>
          </table>
          <br>
          <div class="text-center grid-layout-col-2">
            <button type="submit" class="btn-sub">SAVE</button>
            <button type="button" class="btn-gray" data-bs-dismiss="modal">CLOSE</button>
          </div>
</FORM>

      </div>
-->


<div class="modal fade" id="myModalPopup" tabindex="-1" role="dialog" aria-labelledby="myModalPopup"  style="opacity: 0.5; padding-right: 0px !important;">
  <div class="modal-dialog modal-dialog-centered modal-xl" role="document">
      <div class="modal-content" style="background-color:#2A9B56 !important; max-width:260px; margin: 0 auto;">
        <div class="myModalPopup-body" style="text-align: center; border-radius: 5px; max-height:60px;	font-size:18px; background-color:#2A9B56; color: #FFFFFF; font-weight: bold;padding:0.5em 1em; ">

        </div>     	
      </div>
  </div>
</div>