=$disarra[$i] && $bookquantity<$disarra[$i+1] ) { $finaldiscountvalu=$disarra[$i]; } } elseif($bookquantity>=$disarra[$i]) { $finaldiscountvalu=$disarra[$i]; } } if(!isset($finaldiscountvalu)) { $finaldiscountvalu=0; } $querydis= "SELECT * FROM discountmaster where quantity='$finaldiscountvalu'"; $resultdiscount = mysql_query($querydis); $recodis=mysql_fetch_assoc($resultdiscount); $getperdis=$recodis['discount']; $disfactor=$recodis['dfactor']; if($disfactor=='yes') { $getperdis=($getperdis*$booksizefactor); } $valuewithdis=($getperdis*$TotalCost)/100; $valuewithdis=$TotalCost-$valuewithdis; $smarty->assign("discount",$getperdis); $smarty->assign("pricewithdis",$valuewithdis); $customyotal=($bookquantity*$valuewithdis); $smarty->assign("customyotal",$customyotal); $smarty->assign("Estimatedprice",$TotalCost); } $sql = "SELECT * FROM sizes"; $result = mysql_query($sql); //$record=array(); while($row=mysql_fetch_assoc($result)) { $record[]=$row; } $smarty->assign('records',$record); $booktype= "SELECT * FROM covermaster"; $resultbooktype = mysql_query($booktype); $booktype=array(); while($rowbooktype=mysql_fetch_assoc($resultbooktype)) { $booktype[]=$rowbooktype; } $smarty->assign('booktype',$booktype); $papertype= "SELECT * FROM papertype"; $resultpapertype = mysql_query($papertype); $papertype=array(); while($rowpapertype=mysql_fetch_assoc($resultpapertype)) { $papertype[]=$rowpapertype; } $smarty->assign('papertype',$papertype); $binding= "SELECT * FROM bindingmaster"; $resultbinding = mysql_query($binding); $getbinding=array(); while($rowbibding=mysql_fetch_assoc($resultbinding)) { $getbinding[]=$rowbibding; } $smarty->assign('getbinding',$getbinding); $discountquery = mysql_query("SELECT * FROM discountmaster order by quantity asc"); $disrecods=array(); $i=0; while($rowdis=mysql_fetch_assoc($discountquery)) { $disrecods[$i]=$rowdis; $getperdistemp=$rowdis['discount']; $disfactortemp=$rowdis['dfactor']; if($disfactortemp=='yes') { $getperdistemp=($getperdistemp*$booksizefactor); } if(!isset($TotalCost)) { $TotalCost=0; } $valuewithdistemp=($getperdistemp*$TotalCost)/100; $valuewithdistemp=$TotalCost-$valuewithdistemp; $disrecods[$i]['rateperbook']=$valuewithdistemp; $totalprice=($valuewithdistemp*$rowdis['quantity']); $disrecods[$i]['totalprize']=$totalprice; $i++; } if(isset($_POST['getquo'])) { $to=$_POST['emailadd']; $subject="Quote Details"; // Your subject // From $header = 'From: info@picatype.com' . "\r\n"; $header.= "Content-type: text/html\r\n"; //add code for selecting $userid and $pass for user table for the input $email_to. // Your message $randpad="admin".rand(); $messages=""; $messages.=""."


"; $messages.="Email Address:".$_POST['emailadd']."
"; $messages.="Contact Number:".$_POST['contactno']."

"; $messages.="Quote : \r\n"; //$messages.="-------------------------------------- \r\n"; $messages.=""; $sqlquote = "SELECT * FROM sizes where id=".$_POST['booksize']; $resultrow = mysql_query($sqlquote); $quoteize=mysql_fetch_assoc($resultrow); if($_POST['booktype']==1) { $booktypequote="B&W Interior (Colored Cover)"; } if($_POST['booktype']==2) { $booktypequote="Full Color (Interior and Cover)"; } if($_POST['papertype']==1) { $papertypequote="Plain Paper"; } if($_POST['papertype']==2) { $papertypequote="Coated paper"; } $sqlbingq = "SELECT * FROM bindingmaster where id=".$_POST['selebinding']; $resultrowqbind = mysql_query($sqlbingq); $quotebinding=mysql_fetch_assoc($resultrowqbind); $messages.=""; $messages.=""; $messages.=""; $messages.=""; $messages.=""; $messages.=""; $messages.=""; $discountquery1 = mysql_query("SELECT * FROM discountmaster order by quantity asc"); $disrecods1=array(); $i=0; $messages.=""; while($rowdis1=mysql_fetch_assoc($discountquery1)) { $disrecods1[$i]=$rowdis1; $getperdistemp1=$rowdis1['discount']; $disfactortemp1=$rowdis1['dfactor']; if($disfactortemp1=='yes') { $getperdistemp1=($getperdistemp1*$booksizefactor); } if(!isset($TotalCost)) { $TotalCost=0; } $valuewithdistemp1=($getperdistemp1*$TotalCost)/100; $valuewithdistemp1=$TotalCost-$valuewithdistemp1; $disrecods1[$i]['rateperbook']=$valuewithdistemp1; $totalprice1=($valuewithdistemp1*$rowdis1['quantity']); $disrecods1[$i]['totalprize']=$totalprice1; $messages.=""; $i++; } if($_POST['bookquantity']!=1) { $messages.=""; $messages.=""; $messages.=""; } // $messages.="UserId: $userid \r\n"; $messages.="
Number Of Pages:".$_POST['pages']."
Book Size:".$quoteize['tsize']."
Book Type:".$booktypequote."
Paper Type:".$papertypequote."
Binding:".$quotebinding['bindingmaster']."

\r\n
Rates:
QTYRATETotal Price
".$rowdis1['quantity']."".$valuewithdistemp1."".$totalprice1."

\r\n
Entered Quantity:
".$_POST['bookquantity']."".$valuewithdis."".$customyotal."
"; //$messages.="Quote - picatype.com \r\n"; //$messages.="-------------------------------------- \r\n"; //echo $messages;exit; // send email $sentmail = mail($to,$subject,$messages,$header); $sentmail2 = mail("claude@picatype.com",$subject,$messages,$header); // $sentmail2 = mail("claude@picatype.com",$subject,$messages,$header); // $sentmail2 = mail("pritam@realityinfo.com",$subject,$messages,$header); $thankss="Thankyou for your enquiry."; } $smarty->assign('disrecods',$disrecods); if(!(isset($thankss))) { $smarty->assign("thnk", ""); } else { $smarty->assign("thnk",$thankss); } $smarty->assign("error", $error); $smarty->display("calculate.tpl"); ?>