Preview: tax-report.php
Size: 26.93 KB
/home/godevadmin/public_html/admin/tax-report.php
<?php
include("../include/config.php");
include("../include/functions.php");
validate_admin();
?>
<!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" cellpadding="0" cellspacing="0">
<?php include("header.php") ?>
<link rel="stylesheet" href="../colorbox/colorbox.css" />
<script src="../colorbox/jquery.colorbox.js"></script>
<link rel="stylesheet" href="calender/css/jquery-ui.css">
<script src="calender/js/jquery-ui.js"></script>
<script>
$(function() {
$( "#search_from_date" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat:'yy-mm-dd' ,
yearRange:'2014:<?php echo date('Y'); ?>',
onClose: function( selectedDate ) {
$( "#search_to_date" ).val(selectedDate);
$( "#search_to_date" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#search_to_date" ).datepicker({
changeMonth: true,
changeYear: true,
numberOfMonths: 2,
dateFormat:'yy-mm-dd' ,
yearRange:'2014:<?php echo date('Y'); ?>',
})
$( "#search_from_date" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat:'yy-mm-dd' ,
yearRange:'2014:<?php echo date('Y'); ?>',
onClose: function( selectedDate ) {
$( "#visit_date_to" ).val(selectedDate);
$( "#visit_date_to" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#search_to_date" ).datepicker({
changeMonth: true,
changeYear: true,
numberOfMonths: 2,
dateFormat:'yy-mm-dd' ,
yearRange:'2014:<?php echo date('Y'); ?>',
})
});
</script>
<tr>
<td align="right" class="paddRtLt70" valign="top">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<!------------ Search Section ----------------->
<tr>
<td align="left" valign="middle" class="bodr" style="padding-bottom:20px;">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="headingbg bodr text14" style="padding-left:20px;">Search<span style="float:right; padding-right:10px;"></span></td>
</tr>
<tr><td height="10"></td></tr>
<tr>
<td>
<form name="searchForm" method="post" action="tax-report.php">
<table width="100%" border="0" cellspacing="4" cellpadding="4">
<tr>
<td width="11%" align="right" ><strong>Order ID:</strong></td>
<td width="18%"><input type="text" name="search_order_id" value="<?php echo $_REQUEST['search_order_id']; ?>"/></td>
<td width="12%" align="right" ><strong>Email:</strong></td>
<td width="15%"><input type="text" name="search_email" value="<?php echo $_REQUEST['search_email']; ?>"/></td>
<!-- <td width="8%" align="right" ><strong>Payment Method:</strong></td>
<td width="14%"><select name="search_payment_method" style="width:150px;" >
<option value="">Select Method</option>
<option value="Cash On Delivery" <?php if($_REQUEST['search_payment_method']=='Cash On Delivery'){ ?>selected<?php } ?>>Cash On Delivery</option>
<option value="Online Payment" <?php if($_REQUEST['search_payment_method']=='Online Payment'){ ?>selected<?php } ?>>Online Payment</option>
</select></td>-->
<td width="6%" rowspan="2"><input type="submit" name="search" value="Search" /></td>
<td width="16%" rowspan="2"><a href="tax-report.php">View All</a></td>
</tr>
<tr>
<!-- <td width="11%" align="right" ><strong>User ID:</strong></td>
<td width="18%"><input type="text" name="search_user_id" value="<?php echo $_REQUEST['search_user_id']; ?>"/></td>-->
<td width="12%" align="right" ><strong>Order Status:</strong></td>
<td width="15%"><select name="order_status" style="width:150px;">
<option value="">-Select-</option>
<?php $orderArr=$obj->query("select * from $tbl_order_status where status=1 order by id");
while($resultOrder=$obj->fetchNextObject($orderArr)){?>
<option value="<?php echo stripslashes($resultOrder->id); ?>" <?php if($_REQUEST['order_status']==$resultOrder->id){?>selected<?php } ?> ><?php echo stripslashes($resultOrder->order_status); ?></option>
<?php } ?>
</select></td>
<td width="11%" align="right" ><strong>Payment Status</strong></td>
<td width="18%"><select name="payment_status" style="width:150px;">
<option value="">-Select-</option>
<option value="1" <?php if($_REQUEST['payment_status']=='1'){ ?>selected<?php } ?>> Successful</option>
<option value="0" <?php if($_REQUEST['payment_status']=='0'){ ?>selected<?php } ?>> Unsuccessful</option>
</select></td>
<!-- <td width="8%" align="right" ><strong>Order Via:</strong></td>
<td width="14%"><select name="order_via" style="width:150px;">
<option value="">-Select-</option>
<option value="Website" <?php if($_REQUEST['order_via']=='Website'){ ?>selected<?php } ?>>Website</option>
<option value="App" <?php if($_REQUEST['order_via']=='App'){?>selected<?php } ?>>App</option>
</select></td>-->
</tr>
<tr>
<td width="12%" align="right" ><strong>From Date:</strong></td>
<td width="15%"><input type="text" name="search_from_date" id="search_from_date" value="<?php echo $_REQUEST['search_from_date']; ?>"/></td>
<td width="8%" align="right" ><strong>To Date:</strong></td>
<td width="14%"><input type="text" name="search_to_date" id="search_to_date" value="<?php echo $_REQUEST['search_to_date']; ?>"/></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
<tr><td height="10"></td></tr>
<!----- Search End --------->
<tr>
<td align="left" valign="middle" class="headingbg bodr text14">
<em><img src="images/arrow2.gif" width="21" height="21" hspace="10" align="absmiddle" /></em>Admin: View Amount Breakup Report
<span style="float:right;">
<form name="exportfrm" action="export-tax.php">
<input type="hidden" name="exportExcel" value="yes" />
<input type="hidden" name="search_order_id" value="<?php echo $_REQUEST['search_order_id'];?>" />
<input type="hidden" name="search_email" value="<?php echo $_REQUEST['search_email'];?>" />
<input type="hidden" name="payment_status" value="<?php echo $_REQUEST['payment_status'];?>" />
<input type="hidden" name="search_user_id" value="<?php echo $_REQUEST['search_user_id'];?>" />
<input type="hidden" name="order_status" value="<?php echo $_REQUEST['order_status'];?>" />
<input type="hidden" name="order_via" value="<?php echo $_REQUEST['order_via'];?>" />
<input type="hidden" name="search_from_date" value="<?php echo $_REQUEST['search_from_date'];?>" />
<input type="hidden" name="search_to_date" value="<?php echo $_REQUEST['search_to_date'];?>" />
<input type="submit" name="export" class="button" value="Export To Excel" />
</form>
</span>
</td>
</tr>
<form name="frm" method="post" action="order-del.php" enctype="multipart/form-data">
<tr>
<td height="100" align="left" valign="top" bgcolor="#FFFFFF" class="bodr">
<table width="100%" cellpadding="0" cellspacing="0">
<?php if($_SESSION['sess_msg']){ ?>
<tr><td align="center"><font color="#FF0000"><strong><?php echo $_SESSION['sess_msg'];$_SESSION['sess_msg']='';?></strong></font></td></tr>
<?php }?>
<tr>
<td align="left">
<?php
$where='';
if($_REQUEST['search_order_id']!=''){
$name=$_REQUEST['search_order_id'];
$where.=" and tbl_order.id='".$name."'";
}
if($_REQUEST['search_user_id']!=''){
$name=$_REQUEST['search_user_id'];
$where.=" and tbl_order.user_id='".$name."'";
}
if($_REQUEST['search_email']!=''){
$name=$_REQUEST['search_email'] ;
$where.=" and tbl_order.ship_email like '%$name%' ";
}
if($_REQUEST['order_status']!=''){
$name=$_REQUEST['order_status'] ;
$where.=" and tbl_order.order_status='".$name."'";
}
if($_REQUEST['search_from_date']!='' && $_REQUEST['search_to_date']!=''){
$where.=" and tbl_order.order_date>='".$_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)
{
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="middle"><font face="Arial, Helvetica, sans-serif" color="#FF0000" size="+1">No Record</font></td>
</tr>
</table>
<?php
}
else
{
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="middle"><strong><?php echo $reccnt; ?> Records Found.</strong></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="3%" align="left" class="padd5" bgcolor="#f3f4f6"><strong>S No.</strong></td>
<td width="4%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Order ID</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Amount Paid by Customer</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Cart Amount</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Amount Paid to Fresh Farms</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Grocery</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Produce</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Non-Food</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Soda</strong></td>
<td width="9%" align="left" bgcolor="#f3f4f6" class="padd5"><strong> Refund Processed (due to items unavailability) </strong></td>
<td width="6%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Discount</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Discount Via</strong></td>
<td width="7%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>MyValue Commission</strong></td>
<td width="4%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Low Tax</strong></td> <td width="4%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>High Tax</strong></td> <td width="9%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>City of Chicago/Soda Tax</strong></td>
<td width="4%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Total Sales Tax</strong></td>
<td width="6%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Delivery Type</strong></td>
<td width="7%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Delivery Charge/Fresh Farms Coupon</strong></td>
<td width="7%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Driver Tip</strong></td>
<td width="5%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>CC Fees</strong></td>
<td width="17%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Order Date & Time</strong></td>
<!--<td width="11%" align="center" bgcolor="#f3f4f6" class="padd5" > <input name="check_all" type="checkbox" id="check_all" onclick="checkall(this.form)" value="check_all" /></td> -->
</tr>
<?php
$i=0;
while($line=$obj->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 = "";
}
?>
<tr bgcolor="<?php echo $bgcolor;?>">
<td class="padd5"><strong><?php echo $i+$start; ?>.</strong></td>
<td class="padd5">
<?php
echo stripslashes($line->id);
?>
</td>
<td class="padd5">
<?php $storetotal=$obj->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;
}
}
?>
</td>
<td class="padd5">
<?php $storetotal=$obj->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);
} ?>
</td><td class="padd5">
<?php
//$pricePaidToFfarms = ($line->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);
?>
</td><td class="padd5">
<?php echo $website_currency_symbol." ".number_format($grocery_items, 2);
?>
</td><td class="padd5">
<?php echo $website_currency_symbol." ".number_format($low_tax_items, 2);
?>
</td>
<td class="padd5">
<?php echo $website_currency_symbol." ".number_format($high_tax_items, 2);
?>
</td>
<td class="padd5">
<?php echo $website_currency_symbol." ".number_format($soda_tax_items, 2);
?>
</td>
<td class="padd5">
</td><td class="padd5">
<?php
echo $website_currency_symbol." ".number_format($line->discount/$scount,2);
?>
</td>
<td class="padd5">
<?php echo $line->discount_via;
?>
</td>
<td class="padd5">
<?php
echo $website_currency_symbol." ".number_format(($total*4/100),2);
?>
</td>
<td class="padd5">
<?php $lowtotal=0;
$storelowtax=$obj->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);
?>
</td><td class="padd5">
<?php $hightotal=0;
$storehightax=$obj->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);
?>
</td><td class="padd5">
<?php $citytotal=0;
$storecitytax=$obj->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);
?>
</td><td class="padd5">
<?php
echo $website_currency_symbol." ".number_format($lowtotal+$hightotal+$citytotal,2);
?>
</td><td class="padd5">
<?php
echo $line->delivery_type;
?>
</td>
<td class="padd5">
<?php
echo $website_currency_symbol." ".number_format($line->shipping_amount,2);
?>
</td>
<td class="padd5">
<?php
echo $website_currency_symbol." ".number_format($line->drivertip/$scount,2);
?>
</td>
<td class="padd5">
<?php
echo $website_currency_symbol." ".number_format(($totalamt*2.99/100),2);
?>
</td>
<td class="padd5">
<?php
echo date('d M Y H:i',strtotime($line->order_date));
?>
</td>
<!--<td align="center" valign="middle" class="padd5">
<input type="checkbox" name="ids[]" value="<?php echo $line->id;?>" />
</td> -->
</tr>
<?php
}
?>
<tr>
<td valign="top" colspan="14" align="right">
</td> </tr>
<tr>
<td valign="top" colspan="14" align="right" class="dark_red" style="padding-right:150px;"> </td>
</tr>
<tr>
<td valign="top" colspan="14" align="right" class="dark_red" style="padding-right:150px;"><?php include("../include/paging.inc.php"); ?>
</td> </tr>
<tr>
<td valign="top" colspan="14" align="right" class="dark_red" style="padding-right:150px;"> </td>
</tr>
<tr><td align="right" style="padding-right:80px;" colspan="14"> <input type="hidden" name="what" value="what" />
<!-- <input type="submit" name="Submit" value="Delete" class="button" onclick="return del_prompt(this.form,this.value)" /> --></td></tr>
</table><?php }?>
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr><td height="100"></td></tr>
<?php include('footer.php'); ?>
</table>
</body>
</html>
Directory Contents
Dirs: 10 × Files: 414