|
='".$_REQUEST['search_from_date']."' and tbl_order.order_date<='".$_REQUEST['search_to_date']."' ";
}
if($_REQUEST['payment_status']!=''){
$name=$_REQUEST['payment_status'];
$where.=" and tbl_order.payment_status='".$name."'";
}
$start=0;
if(isset($_GET['start'])) $start=$_GET['start'];
$pagesize=100;
if(isset($_GET['pagesize'])) $pagesize=$_GET['pagesize'];
$order_by='tbl_order.id';
if(isset($_GET['order_by'])) $order_by=$_GET['order_by'];
$order_by2='desc';
if(isset($_GET['order_by2'])) $order_by2=$_GET['order_by2'];
$storeid=$obj->query("select storeid from stores where 1=1 and uid like '%$loged_userid%'");
$resstore=$obj->fetchNextObject($storeid);
//echo "select *,tbl_order.id,tbl_order.user_id,tbl_order.discount,tbl_order.order_date,tbl_order.order_status from $tbl_order left join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where 1=1 and tbl_order_itmes.storeid='$resstore->storeid' $where group by tbl_order_itmes.order_id order by $order_by $order_by2 limit $start, $pagesize";
$sql=$obj->Query("select *,tbl_order.id,tbl_order.user_id,tbl_order.discount,tbl_order.order_date,tbl_order.order_status from $tbl_order left join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where 1=1 and tbl_order_itmes.storeid='$resstore->storeid' $where group by tbl_order_itmes.order_id order by $order_by $order_by2 limit $start, $pagesize");
$sql2=$obj->query("select *,tbl_order.id,tbl_order.user_id,tbl_order.discount,tbl_order.order_date,tbl_order.order_status from $tbl_order left join tbl_order_itmes on tbl_order.id=tbl_order_itmes.order_id where 1=1 and tbl_order_itmes.storeid='$resstore->storeid' $where group by tbl_order_itmes.order_id order by $order_by $order_by2",$debug=-1);
$reccnt=$obj->numRows($sql2);
if($reccnt==0)
{
?>
| S No. |
Order ID |
Amount Paid by Customer |
Cart Amount |
Amount Paid to Fresh Farms |
Grocery |
Produce |
Non-Food |
Soda |
Refund Processed (due to items unavailability) |
Discount |
Discount Via |
MyValue Commission |
Low Tax | High Tax | City of Chicago/Soda Tax |
Total Sales Tax |
Delivery Type |
Delivery Charge/Fresh Farms Coupon |
Driver Tip |
CC Fees |
Order Date & Time |
fetchNextObject($sql))
{
$grocery_items = 0;
$low_tax_items = 0;
$high_tax_items = 0;
$soda_tax_items = 0;
$breakUp = mysql_query("SELECT tbl_order_itmes.qty, tbl_order_itmes.price, tbl_order_itmes.order_id, tbl_productprice.product_id as product_id, tbl_productprice.tax_method, tbl_order_itmes.price * tbl_order_itmes.qty AS total FROM tbl_order_itmes LEFT JOIN tbl_productprice ON tbl_order_itmes.product_id = tbl_productprice.id WHERE tbl_order_itmes.order_id = ".$line->id." and tbl_order_itmes.storeid=".$resstore->storeid."");
while($breakUpResults = mysql_fetch_assoc($breakUp))
{
if(trim($breakUpResults['tax_method']) == 'Low Tax')
{
$grocery = mysql_query("select categories from tbl_product where id=".$breakUpResults['product_id']);
$result_grocery = mysql_fetch_assoc($grocery);
$category_ids = explode(",", $result_grocery['categories']);
if(!(in_array("4337", $category_ids)))
$grocery_items+= $breakUpResults['total'];
else
$low_tax_items+= $breakUpResults['total'];
}
if(trim($breakUpResults['tax_method']) == 'High Tax')
$high_tax_items+= $breakUpResults['total'];
if(trim($breakUpResults['tax_method']) == 'City of Chicago/Soda Tax')
$soda_tax_items+= $breakUpResults['total'];
}
$storecount=$obj->query("SELECT COUNT(DISTINCT storeid) as scount from tbl_order_itmes where order_id='$line->id'");
$rs=$obj->fetchNextObject($storecount);
$scount=$rs->scount;
$i++;
if($i%2==0)
{
$bgcolor = "#f3f4f6";
}
else
{
$bgcolor = "";
}
?>
| . |
id);
?>
|
query("select * from tbl_order_itmes where order_id='$line->id'");
$strtot=$obj->fetchNextObject($storetotal);
if($strtot->storeid=='0')
{
echo $website_currency_symbol.number_format($line->total_amount,2);
}
else
{
$totalamt=0;
$storetotal=$obj->query("select * from tbl_order_itmes where order_id='$line->id' and storeid='$line->storeid'");
while($totalres=$obj->fetchNextObject($storetotal))
{
$totalamt=$totalamt+$totalres->price*$totalres->qty+$totalres->tax_value*$totalres->qty;
}
//Modified to deduct discount from total order value
$totalamt = $totalamt - ($line->discount/$scount);
echo $website_currency_symbol.number_format($totalamt,2);
//condition for Delivery Charge
if($resstore->storeid=='100'){
//commented for the month of May 18
//echo $line->total_amount;
if($totalamt>= 30 && $totalamt<40){
$line->shipping_amount = 6;
}
if($totalamt>=40){
$line->shipping_amount = 10;
}
//$10 calculation should be on Total cart value
// if(($totalamt + $line->discount/$scount)>=30)
// $line->shipping_amount = 10;
}else{
$line->shipping_amount=$line->shipping_amount/$scount;
}
}
?>
|
query("select * from tbl_order_itmes where order_id='$line->id'");
$carttot=$obj->fetchNextObject($storetotal);
if($carttot->storeid=='0'){
echo $website_currency_symbol.number_format($line->total_amount,2);} else {
$total=0;
$storetotal=$obj->query("select * from tbl_order_itmes where order_id='$line->id' and storeid='$line->storeid'");
while($totalres=$obj->fetchNextObject($storetotal)){
$total=$total+$totalres->price*$totalres->qty;}
echo $website_currency_symbol.number_format($total,2);
} ?>
|
amount - ($line->total_amount*2.99/100) - ($line->total_amount*4/100) - ($line->shipping_amount) - ($line->drivertip));
$pricePaidTostore = ($totalamt - ($line->shipping_amount + $line->drivertip/$scount + ($total*4/100) + ($totalamt*2.99/100)));
echo $website_currency_symbol." ".number_format($pricePaidTostore,2);
?>
|
|
|
|
|
|
discount/$scount,2);
?>
|
discount_via;
?>
|
|
query("select * from tbl_order_itmes where order_id='$line->id' and storeid='$line->storeid' and tax_method='Low Tax'");
while($totalres=$obj->fetchNextObject($storelowtax)){
$lowtotal=$lowtotal+$totalres->tax_value*$totalres->qty;}
echo $website_currency_symbol.number_format($lowtotal,2);
?>
|
query("select * from tbl_order_itmes where order_id='$line->id' and storeid='$line->storeid' and tax_method='High Tax'");
while($totalres=$obj->fetchNextObject($storehightax)){
$hightotal=$hightotal+$totalres->tax_value*$totalres->qty;}
echo $website_currency_symbol.number_format($hightotal,2);
?>
|
query("select * from tbl_order_itmes where order_id='$line->id' and storeid='$line->storeid' and tax_method='City of Chicago/Soda Tax'");
while($totalres=$obj->fetchNextObject($storecitytax)){
$citytotal=$citytotal+$totalres->tax_value*$totalres->qty;}
echo $website_currency_symbol.number_format($citytotal,2);
?>
|
|
delivery_type;
?>
|
shipping_amount,2);
?>
|
drivertip/$scount,2);
?>
|
|
order_date));
?>
|
|
|
| |
|
|
| |
|
|
|
|