HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/xampp/htdocs/dropfile/php/uploads/dbin.php
 <?php session_start();
$_SESSION["favcolor"] = "green";
?>

 <html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />



</head>



<?php 

error_reporting(0);



$company=$_POST['company'];

//echo "company:".$company;

$contact=$_POST['contact'].$_POST['sir'];

$tel  =$_POST['tel'];

$fax  =$_POST['fax'];

$invo  =$_POST['invo'];

$sales  =$_POST['sales'];

$address  =$_POST['address'];

$cmmt  =$_POST['cmmt'];

$item1  =$_POST['item1'];

$item2  =$_POST['item2'];

$item3  =$_POST['item3'];

$item4  =$_POST['item4'];

$item5  =$_POST['item5'];

$item6  =$_POST['item6'];

$item7  =$_POST['item7'];

$item8  =$_POST['item8'];

$item9  =$_POST['item9'];

$item10  =$_POST['item10'];

$item11  =$_POST['item11'];

$item12  =$_POST['item12'];

$item13  =$_POST['item13'];

$item14  =$_POST['item14'];

$item15  =$_POST['item15'];

$item16  =$_POST['item16'];

$item17  =$_POST['item17'];

$item18  =$_POST['item18'];

$w1  =$_POST['w1'];

$w2  =$_POST['w2'];

$w3  =$_POST['w3'];

$w4  =$_POST['w4'];

$w5  =$_POST['w5'];

$w6  =$_POST['w6'];

$w7  =$_POST['w7'];

$w8  =$_POST['w8'];

$w9  =$_POST['w9'];

$w10  =$_POST['w10'];

$w11  =$_POST['w11'];

$w12  =$_POST['w12'];

$w13  =$_POST['w13'];

$w14  =$_POST['w14'];

$w15  =$_POST['w15'];

$w16  =$_POST['w16'];

$w17  =$_POST['w17'];

$w18  =$_POST['w18'];

$h1  =$_POST['h1'];

$h2  =$_POST['h2'];

$h3  =$_POST['h3'];

$h4  =$_POST['h4'];

$h5  =$_POST['h5'];

$h6  =$_POST['h6'];

$h7  =$_POST['h7'];

$h8  =$_POST['h8'];

$h9  =$_POST['h9'];

$h10  =$_POST['h10'];

$h11  =$_POST['h11'];

$h12  =$_POST['h12'];

$h13  =$_POST['h13'];

$h14  =$_POST['h14'];

$h15  =$_POST['h15'];

$h16  =$_POST['h16'];

$h17  =$_POST['h17'];

$h18  =$_POST['h18'];

$v1  =$_POST['v1'];

$v2  =$_POST['v2'];

$v3  =$_POST['v3'];

$v4  =$_POST['v4'];

$v5  =$_POST['v5'];

$v6  =$_POST['v6'];

$v7  =$_POST['v7'];

$v8  =$_POST['v8'];

$v9  =$_POST['v9'];

$v10  =$_POST['v10'];

$v11  =$_POST['v11'];

$v12  =$_POST['v12'];

$v13  =$_POST['v13'];

$v14  =$_POST['v14'];

$v15  =$_POST['v15'];

$v16  =$_POST['v16'];

$v17  =$_POST['v17'];

$v18  =$_POST['v18'];





$p1  =$_POST['p1'];

$p2  =$_POST['p2'];

$p3  =$_POST['p3'];

$p4  =$_POST['p4'];

$p5  =$_POST['p5'];

$p6  =$_POST['p6'];

$p7  =$_POST['p7'];

$p8  =$_POST['p8'];

$p9  =$_POST['p9'];

$p10  =$_POST['p10'];

$p11  =$_POST['p11'];

$p12  =$_POST['p12'];

$p13  =$_POST['p13'];

$p14  =$_POST['p14'];

$p15  =$_POST['p15'];

$p16  =$_POST['p16'];

$p17  =$_POST['p17'];

$p18  =$_POST['p18'];



//${'c'.($t).'dv'}=${'c'.($t).'dv'};}



for ( $t = 1; $t <= 18; $t += 1) {

	if ( ${'v'.$t}=='') {

	${'a'.$t}=0;

	}

	elseif ( ${'w'.$t}==0) {

	${'a'.$t}=1;	

	}

	elseif (${'w'.$t}*${'h'.$t}*${'v'.$t}%900<>0) {

	${'a'.$t}=floor((${'w'.$t}*${'h'.$t}/900)+1)*${'v'.$t};}

	

	else {

	${'a'.$t}=${'w'.$t}*${'h'.$t}*${'v'.$t}/900;}

	}	

	

	for ( $t = 1; $t <= 18; $t += 1) {

	if ( ${'a'.$t}==0) {

	${'a'.$t}='';	

	}

	}

//echo "a3:".$a3;	

	

for ( $t = 1; $t <= 18; $t += 1) {

	if ( ${'w'.$t}==0) {

	${'s'.$t}=${'p'.$t}*${'v'.$t};	

	}

	else {

${'s'.$t}=${'a'.$t}*${'p'.$t};	}

}



	for ( $t = 1; $t <= 18; $t += 1) {

	if ( ${'s'.$t}==0) {

	${'s'.$t}='';	

	}

	}

//echo "s3:".$s3;		



$sum=0;

for ( $t = 1; $t <= 18; $t += 1) {

$sum=$sum+${'s'.$t};

}

//echo "sum:".$sum;



$tax=round($sum*0.05,0);

$tsum=$sum+$tax;





//echo "<br>jobid:".$jobid;







	

	





?>

 <body>

<form id="form_25464" class="appnitro"  method="post" action="dbinR3.php">

<h2>大型海報輸出報價單</h2>

<table width="850" border="0">

  <tr>

    <td width="74" height="25" align="left"  >客戶名稱 </td>

	<td width="310" align="left" ><input  size="40" name="company" type="text" maxlength="25" value="<?php echo $company;?>"/></td>

    <td width="58" align="left" >廠商</td>    

    <td width="390" align="left" >博盟實業有限公司</td>

  </tr>

  <tr>

    <td align="left">聯絡人 </td>

   <td width="310" align="left" ><input  size="40" name="contact" type="text" maxlength="25" value="<?php echo $contact;?>"/></td>

    <td align="left">業務</td>

    

    <td align="left"><input  size="40" name="sales" type="text" maxlength="25" value="<?php echo $sales;?>"/></td>

  </tr>

    <tr>

    <td width="74" height="25" align="left"  >電話 </td>

    <td width="310" align="left" ><input  size="40" name="tel" type="text" maxlength="25" value="<?php echo $tel;?>"/></td>

    <td width="58" align="left" >電話</td>    

    <td width="390" align="left" >02-2788-8066</td>

  </tr>

    <tr>

    <td width="74" height="25" align="left"  >傳真 </td>

    <td width="310" align="left" ><input  size="40" name="fax" type="text" maxlength="25" value="<?php echo $fax;?>"/></td>

    <td width="58" align="left" >傳真</td>    

    <td width="390" align="left" >02-2788-8026</td>

  </tr>

      <tr>

    <td width="74" height="25" align="left"  >統編 </td>

    <td width="310" align="left" ><input  size="40" name="invo" type="text" maxlength="25" value="<?php echo $invo;?>"/></td>

    <td width="58" align="left" >地址</td>    

    <td width="390" align="left" >台北市115南港區南港路三段50巷15號</td>

  </tr>



  <tr>

    <td colspan="1" align="left">  地址    </td>

    <td width="310" align="left" ><input  size="40" name="address" type="text" maxlength="25" value="<?php echo $address;?>"/></td>

    </tr>

  

 </table>



</p>

<table width="850" border="1">

  <tr>

    <td width="247" colspan="1" >品名</td>

    <td colspan="4" >輸出尺寸</td>

    <td width="98" rowspan="1" >張數</td>

    <td width="95" rowspan="1" >單價</td>

    <td width="103" rowspan="1" >才數</td>

    <td width="65" rowspan="1" >小計</td>

  </tr> 

  

<tr>

 

	<?php

	$price='';

	$host="127.0.0.1";

	$user="root";

	$pass="fredsql";

	$db="promo";

	$price='';

	$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");

	mysql_query("SET NAMES 'utf8'");

	mysql_select_db($db) or die ("Unable to select database!");

	$query = "SELECT  * from stock where stockName='$item1' ";

	$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());

	while($row = mysql_fetch_object($result))

	{ 

	$price=$row->price;

	}

//echo "pr:".$price."session:".$_SESSION["p0"];
	if ($_SESSION["p1"]<>0) {

		$price=$_SESSION["p1"];}

		else {

		$price=$price;}	
		
	if ($_SESSION["v1"]<>0) {

		$v1=$_SESSION["v1"];}

		
		
		
//echo "_pr2:".$price;
		
	if ($a1=='') {		
	$s1=$price*$v1;}
	//echo "sumv:".$i."-".${'s'.$i};}
	
	else {
	$s1=$price*$a1;}
	//echo "suma:".$i.":".${'s'.$i};}
	

	?>

	<td width="247" colspan="1" ><input  size="36" name="item1" type="text" maxlength="55" value="<?php echo $item1;?>"/></td>

    <td width="30" colspan="1" >寬</td>

    <td width="52"><input  size="6" name="w1" type="text" maxlength="55" value="<?php echo $w1;?>"/></td>

    <td width="30" >高</td>

    <td width="52"><input  size="6" name="h1" type="text" maxlength="55" value="<?php echo $h1;?>"/></td>

    <td width="98" rowspan="1" ><input  size="6" name="v1" type="text" maxlength="55" value="<?php echo $v1;?>"/></td>

	<td width="95" rowspan="1" ><input  size="14" name="p1" type="text" maxlength="55" value="<?php echo $price;?>"/></td>  

    <td width="103" rowspan="1" ><input  size="14" name="a1" type="text" maxlength="55" value="<?php echo $a1;?>"/></td>  

    <td width="65" rowspan="1" ><input  size="14" name="s1" type="text" maxlength="55" value="<?php  $s1= $price*$a1;echo $price*$a1;?>"/></td>    

    </tr>



<?php

$j=1;

foreach($_SESSION['price'] as $key=>$value)

    {

    // and print out the values

	

    //echo 'The value of $_SESSION['."'".$key."'".'] is '."'".$value."'".' <br />';

	${'p'.$j}=$value;

	//echo "pp-".$j."=".${'p'.$j};

	$j=$j+1;

    }



 for ($i=2; $i<=18; $i+= 1)  {

	$price='';

	$query = "SELECT  * from stock where stockName='${'item'.$i}'";

	$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());

	while($row = mysql_fetch_object($result))

	{ 

	$price=$row->price;

	}



	//echo "_pp:".${'p'.$i};

	

		if ($_SESSION["p1"]<>0) {

		$price=${'p'.$i};}

		else {

		$price=$price;}	
		
		
		if ($_SESSION["v1"]<>0) {
		${'v'.$i}=$_SESSION['v'.$i];
		}

	//echo "area:".$i."-".${'a'.$i};
	//echo "vol:".$i."-".${'v'.$i};
	
	if (${'a'.$i}=='') {		
	${'s'.$i}=$price*${'v'.$i};}
	//echo "sumv:".$i."-".${'s'.$i};}
	
	else {
	${'s'.$i}=$price*${'a'.$i};}
	//echo "suma:".$i.":".${'s'.$i};}
	
	
echo '<tr>

	<td width="247" colspan="1" ><input  size="36" name="item'.$i.'" type="text" maxlength="55" value="'.${'item'.$i}.'"/></td>

    <td width="30" colspan="1" >寬</td>

    <td width="52"><input  size="6" name="w'.$i.'" type="text" maxlength="55" value="'.${'w'.$i}.'"/></td>

    <td width="30" >高</td>

    <td width="52"><input  size="6" name="h'.$i.'" type="text" maxlength="55" value="'.${'h'.$i}.'"/></td>

    <td width="98" rowspan="1" ><input  size="6" name="v'.$i.'" type="text" maxlength="55" value="'.${'v'.$i}.'"/></td>

	<td width="95" rowspan="1" ><input  size="14" name="p'.$i.'" type="text" maxlength="55" value="'.$price.'"/></td>  

    <td width="103" rowspan="1" ><input  size="14" name="a'.$i.'" type="text" maxlength="55" value="'.${'a'.$i}.'"/></td>  

    <td width="65" rowspan="1" ><input  size="14" name="s'.$i.'" type="text" maxlength="55" value="'.${'s'.$i}.'"/></td>

  </tr>';

 }

 ?> 

</table>



  <?php

$sum=0;

for ( $t = 1; $t <= 18; $t += 1) {

$sum=$sum+${'s'.$t};

}

//echo "sum:".$sum;



$tax=round($sum*0.05,0);

$tsum=$sum+$tax;

?>  



<table width="850" border="1">

    <tr>

      <td width="565" rowspan="3" colspan="2" ></td>
	  

      <td >合計</td>

      <td height="29" align="right" ><?php echo number_format($sum);?></td>

    </tr>

    <tr>

      <td >營業稅</td>

      <td height="27" align="right" ><?php echo number_format($tax);?></td>

    </tr>

    <tr>

      <td width="136" >總計</td>

    <td width="127" height="20" align="right" ><?php echo  number_format($tsum);?> </td>



  </tr>



</table>  



<table width="850" border="1">

    <tr>

    <td width="44" height="40" >備註 </td>

	<td width="790"><input   name="cmmt" type="text" maxlength="55" value="<?php echo $cmmt;?>"/></td>

  </tr>



</table>





<table width="850" border="0">

    <tr>

    <td align="right"><?php echo $jobdd;?>  </td>   

  </tr>



</table>



<?php









////////////////////////////////////////////////////////////



?>

<table width="850" border="0">

    <tr>

	

	<td width="59"><input id="saveForm" class="button_text" type="submit" name="submit" value="確認資訊" /></td>

 <!--  <td width="59"><a href="dbin-print.php"><font size="2">出單</font></a></td>  -->

    <td width="47"><a href="index5.php"><font size="2">報價單</font></a></td>

    <td width="730"><a href="index.html"><font size="2">主選單</font></a></td>

  </tr>



</table>











</form>

</body>



</html>