Preview: printInvoice.php
Size: 14.89 KB
/home/godevadmin/public_html/admin/printInvoice.php
<?php
session_start();
include("../include/config.php");
include("../include/functions.php");
include("../include/simpleimage.php");
validate_admin();
if($_REQUEST['order_id']!=''){
$sql=$obj->query("select * from $tbl_order where id=".$_REQUEST['order_id']);
$result=$obj->fetchNextObject($sql);
$prosub=array();
if($result->sub_id){
$subArr=explode(",",$result->sub_id);
if(count($subArr)>0){
foreach($subArr as $value){
$sqlsubs=$obj->query("SELECT b.product_id,b.subscription_type FROM user_subscription as a left join user_subscription_order_details as b on a.sub_id=b.subs_id WHERE a.userid='" . $result->user_id . "' and a.sub_id=$value");
$Subresult = $obj->fetchNextObject($sqlsubs);
$prosub[$Subresult->product_id]=$Subresult->subscription_type;
}
}
}
}
$moment_id = 0;
$momentMixOrder = false; //Non moment or mix moment order flag
$itmesQry = $obj->query("select * from $tbl_order_itmes where order_id='".$result->id."'");
$totalsku=$obj->numRows($itmesQry);
while($resultItem = $obj->fetchNextObject($itmesQry)){
if(!empty($resultItem->moment_id)){
$moment_id = $resultItem->moment_id;
}
if($resultItem->section != 'moments')
{
$momentMixOrder = true;
}
}
$moment_address = '';
if($moment_id != 0)
{
$momentQuery = $obj->query("SELECT fname, lname, email, phone, full_address, zipcode FROM tbl_moments WHERE id=$moment_id");
$momentData = $obj->fetchNextObject($momentQuery);
// Moment Recipent Address
$moment_address .= '<tr><td colspan=2><h2>Moment Recipient Address:</h2></td>
<tr>
<td class="paddBot11 paddRt14" colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%"><strong>Name:</strong></td>
<td width="34%">'.stripslashes($momentData->fname).' '.stripslashes($momentData->lname).'</td>
<td width="14%"><strong> Phone:</strong></td>
<td width="34%">'.stripslashes($momentData->phone).'</td>
</tr>
<tr>
<td width="18%"><strong>Address:</strong></td>
<td width="34%">'.stripslashes($momentData->full_address).'</td>
<td width="14%"><strong> Pincode:</strong></td>
<td width="34%">'.stripslashes($momentData->zipcode).'</td>
</tr>
<tr>
<td width="14%"><strong> Email:</strong></td>
<td width="34%">'.stripslashes($momentData->email).'</td>
</tr>
</table>
</td>
</tr>';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo SITE_TITLE; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/admin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="middle" class="headingbg bodr text14">
Order Details
</td>
</tr>
<tr>
<td height="100" align="left" valign="top" bgcolor="#f7faf9" class="bodr">
<form name="frm" method="POST" enctype="multipart/form-data" action="" onSubmit="return validate(this)">
<input type="hidden" name="submitForm" value="yes" />
<input type="hidden" name="id" value="<?php echo $_REQUEST['id'];?>" />
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="paddBot11 paddRt14" colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%"><strong>Order Date:</strong></td>
<td width="34%"><?php $added_date=explode("-",$result->order_date); if($added_date[0]!='0000'){ echo date("d M Y H:i",strtotime($result->order_date)); }?></td>
<td width="14%"><strong>Order ID:</strong></td>
<td width="34%"><?php
echo stripslashes($result->id);
?></td>
</tr>
<tr>
<td width="18%"><strong>User ID:</strong></td>
<td width="34%"><?php echo stripslashes($result->user_id);?></td>
<td width="14%"><strong>Email:</strong></td>
<td width="34%"><?php echo stripslashes($result->ship_email);?></td>
</tr>
</table>
</td>
</tr>
<?php
$deliveryInfo = 'Delivery Information';
if($moment_id > 0 && $momentMixOrder == false){
$deliveryInfo = 'Billing Information';
}
else if($moment_id > 0 && $momentMixOrder == true){
$deliveryInfo = 'Delivery/Billing Information';
}
?>
<tr>
<td class="paddBot11 paddRt14" colspan="2"><h2><?php echo $deliveryInfo; ?></h2></td>
</tr>
<tr>
<td class="paddBot11 paddRt14" colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%"><strong> First Name:</strong></td>
<td width="34%"><?php echo stripslashes($result->ship_fname);?></td>
<td width="14%"><strong> Last Name:</strong></td>
<td width="34%"><?php echo stripslashes($result->ship_lname);?></td>
</tr>
<tr>
<td width="18%"><strong> House Number:</strong></td>
<td width="34%"><?php echo stripslashes($result->ship_house_no);?></td>
<td width="14%"><strong> Street:</strong></td>
<td width="34%"><?php echo stripslashes($result->ship_street);?></td>
</tr>
<tr>
<td width="18%"><strong> Complex:</strong></td>
<td width="34%"><?php echo stripslashes($result->ship_complex);?></td>
<td width="14%"><strong> Landmark:</strong></td>
<td width="34%"><?php echo stripslashes($result->ship_landmark);?></td>
</tr>
<tr>
<td width="18%"><strong> City:</strong></td>
<td width="34%"><?php echo getField('city',$tbl_city,$result->ship_city_id);?></td>
<td width="14%"><strong> Area:</strong></td>
<td width="34%"><?php echo $result->area;?></td>
</tr>
<tr>
<td width="18%"><strong> Pincode:</strong></td>
<td width="34%"><?php echo stripslashes($result->ship_pincode);?></td>
<td width="14%"><strong> </strong></td>
<td width="34%"> </td>
</tr>
<tr>
<td width="18%"><strong> Mobile:</strong></td>
<td width="34%"><?php echo stripslashes($result->ship_mobile);?></td>
<td width="18%"><strong> Phone:</strong></td>
<td width="34%"><?php echo stripslashes($result->ship_phone);?></td>
</tr>
</table>
</td>
</tr>
<?php echo $moment_address; ?>
<tr>
<td class="paddBot11 paddRt14" colspan="2"> </td>
</tr>
<?php if($result->coupon_code!=''){ ?>
<tr>
<td class="paddBot11 paddRt14" colspan="2"><h2>Discount Information</h2></td>
</tr>
<tr>
<td class="paddBot11 paddRt14" colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%"><strong>Coupoun Code Used:</strong></td>
<td width="34%"><?php echo stripslashes($result->coupon_code);?></td>
<td width="14%"> </td>
<td width="34%"> </td>
</tr>
</table>
</td>
</tr>
<?php } ?> <tr>
<td class="paddBot11 paddRt14" colspan="2"><h2>Payment Information</h2></td>
</tr>
<tr>
<td class="paddBot11 paddRt14" colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%"><strong>Payment Method:</strong></td>
<td width="34%"><?php echo stripslashes($result->payment_method);?></td>
<td width="14%"> </td>
<td width="34%"> </td>
</tr>
<tr>
<td class="paddBot11 paddRt14" colspan="2"><h2>Delivery Notes (if any)</h2></td>
</tr>
<tr>
<td class="paddBot11 paddRt14" colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%"><?php echo $result->delivery_note;?></td>
<td width="34%"> </td>
<td width="14%"> </td>
<td width="34%"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="paddBot11 paddRt14" colspan="2"> </td>
</tr>
<tr>
<td class="paddBot11 paddRt14" colspan="2"><h2>Ordered Products ( Total Ordered SKUs: <?php echo $totalsku;?> )</h2></td>
</tr>
<tr><td colspan="2">
<?php
$enq_message.="<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='100%'><table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr style='background:#e7f6f1;' >
<td width='40%' height='30'><h3>Product Purchased</h3></td> <td width='15%' height='15'><!--<h3>User Remarks</h3>--></td>
<td width='10%'><h3>Qty</h3></td>
<td width='22%'><h3>Unit Price($website_currency_symbol)</h3></td>
<td width='23%'><h3>Price ($website_currency_symbol)</h3></td>
</tr>
<tr>
<td><strong> </strong></td> <td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>";
$itmesArr=$obj->query("select * from $tbl_order_itmes where order_id='".$result->id."'");
while($resultItem=$obj->fetchNextObject($itmesArr)){
$bg_color = '';
$sf_product = '';
if($result->ship_state == 'NY')
{
$store_front_quantity = check_storefront_stock($resultItem->productid);
if($store_front_quantity > 0){
$bg_color = 'class="prod-color"';
$sf_product = ' - QGo';
}
}
$custumdate='2021-07-08 00:00:00';
$substype='';
if($result->order_date > $custumdate){
if($resultItem->subscription_type=='Weekly' || $resultItem->subscription_type=='Bi Weekly' || $resultItem->subscription_type=='Monthly'){
$substype=" ($resultItem->subscription_type Subscription)";
}
} else {
$substype=$prosub[$resultItem->product_id];
if($substype=='Weekly' || $substype=='Bi Weekly' || $substype=='Monthly'){
$substype=" ($substype Subscription)";
}
}
$enq_message.="<tr>
<td $bg_color><strong>".$resultItem->product_name.$resultItem->size_type.$substype.$sf_product."</strong></td> <td>".$resultItem->user_replacement_option."</td>
<td>".$resultItem->qty."</td>
<td>".number_format($resultItem->price,2)."</td>
<td>$website_currency_symbol ".number_format($resultItem->price*$resultItem->qty,2)."</td>
</tr>";
}
$enq_message.=" <tr>
<td> </td>
<td> </td>
<td>Billed Amount</td>
<td>$website_currency_symbol ".number_format($result->amount,2)."</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>Tax</td>
<td>$website_currency_symbol ".number_format($result->tax_value,2)."</td>
</tr>
<tr>
<tr>";
if($result->special_discount!=''){
$enq_message.="<tr>
<td> </td>
<td> </td>
<td>Special Discount</td>
<td>$website_currency_symbol ".number_format($result->special_discount,2)."</td>
</tr>";
}
if($result->other_discount>0){
$enq_message.="<tr>
<td> </td>
<td> </td>
<td>".$result->other_discount_via." Discount</td>
<td>$website_currency_symbol".number_format($result->other_discount,2)."</td>
</tr>";
}
$enq_message.="
<td> </td>
<td> </td>
<td>Discounts</td>
<td>$website_currency_symbol ".number_format($result->discount,2)."</td>
</tr>";
if($result->expres_amt>0){
$enq_message.="<tr>
<td> </td>
<td> </td>
<td>Express Delivery</td>
<td>$website_currency_symbol ".number_format($result->expres_amt,2)."</td>
</tr>";
}else{
$enq_message.="<tr>
<td> </td>
<td> </td>
<td>Delivery Charges</td>
<td>$website_currency_symbol ".number_format($result->shipping_amount,2)."</td>
</tr>";
}
$enq_message.="<tr>
<td> </td>
<td> </td>
<td>Minimum Order Charge</td>
<td>$website_currency_symbol ".number_format($result->min_order_charge,2)."</td>
</tr>";
$enq_message.="<tr>
<td> </td>
<td> </td>
<td>Tip</td>
<td>$website_currency_symbol ".number_format($result->drivertip,2)."</td>
</tr>";
if($result->saving>0){
$enq_message.="<tr>
<td> </td>
<td> </td>
<td>Saving</td>
<td>$website_currency_symbol ".number_format($result->saving,2)."</td>
</tr>";
}
$enq_message.="
<tr>
<td> </td>
<td> </td>
<td><strong>Total Amount:</strong></td>
<td>$website_currency_symbol ".number_format($result->total_amount,2)."</td>
</tr>
</table></td>
</tr>
</table>"; echo $enq_message;?></td></tr>
<tr>
<td width="43%" align="right" class="paddRt14 paddBot11"> </td>
<td width="57%" align="left" class="paddBot11">
</td>
</tr>
</table>
</form>
</td>
</tr>
<tr><td align="center"> </td></tr>
</table>
</body>
</html>
<script>
var is_chrome = function () { return Boolean(window.chrome); }
if(is_chrome)
{
window.print();
setTimeout(function(){window.close();}, 20000);
//give them 10 seconds to print, then close
}
else
{
window.print();
window.close();
}
</script>
Directory Contents
Dirs: 10 × Files: 414