<?php
include("include/config.inc.php");
if(!isset($_SESSION['s_activId']))
{
  $_SESSION['s_urlRedirectDir'] = $_SERVER['REQUEST_URI'];
  header("Location:checkLogin.php");
}
else
{
	$to        = $_REQUEST['toDtYear']."-".$_REQUEST['toDtMonth']."-".$_REQUEST['toDtDay'];  
	$from      = $_REQUEST['fromDtYear']."-".$_REQUEST['fromDtMonth']."-".$_REQUEST['fromDtDay'];  
	
    $k = 0;
    $clientDetail = array();
    $selectClient = "SELECT *,partyName FROM mcx
	                   LEFT JOIN party ON party.partyId = mcx.partyId
					    WHERE transDate between '".$to."' AND '".$from."'";
	$selectClientRes = mysql_query($selectClient);
	while($clientRow = mysql_fetch_array($selectClientRes))
	{
	  $clientDetail[$k]['mcxId']        = $clientRow['mcxId'];
	  $clientDetail[$k]['partyName']    = $clientRow['partyName'];
	  $clientDetail[$k]['rate']         = $clientRow['rate'];
	  $clientDetail[$k]['transDate']    = date('d-m-Y',strtotime($clientRow['transDate']));
	  $clientDetail[$k]['transType']    = $clientRow['transType'];
	  $clientDetail[$k]['total']        = $clientRow['total'];
	  $clientDetail[$k]['kg']           = $clientRow['kg'];
	  $clientDetail[$k]['totalAmt']     = $clientRow['totalAmt'];
	  $clientDetail[$k]['a']            = $clientRow['rate'] * $clientRow['kg'];
	  $k++;
	}

	
	include("./bottom.php");
	$smarty->assign("clientDetail",$clientDetail);
	$smarty->display("mcxAll.tpl");
}
?>