Item Saved Successfully...!!
";
}
if(isset($_POST[$_SESSION['selectitemforpurchase']]))
{
extract($_POST);
print $fd = count($pitem_id);
//$t = time();
/*mysql_query("insert into purchase (amount , payment_mode , time , date , tims) values ('$grandtotalamnt' , '$paymode' , '$time' , '$date' , '$t') ");
$qury = mysql_query("select * from purchase where tims = '$t' ");
while($rrrr = mysql_fetch_array($qury))
{
$purchase_id = $rrrr['id'];
}
for($i = 0; $i < $fd; $i++)
{
$gg = $pitem_id[$i];
$quantity = $item_quan[$gg];
$wet_type = $weight_type[$gg];
$item_det = $item_details[$gg];
$item_ids = $item_id[$gg];
$categ_ids = $categ_id[$gg];
$brockrage = $brockrages[$gg];
$amnts = $total_amnts[$gg];
$rate = $item_rates[$gg];
mysql_query("insert into item_purchase (purchase_id , cat_id , item_id , rate , quantity , brockrage , weight_type , total_amout , time , date) values ('$purchase_id' , '$categ_ids' , '$item_ids' , '$rate' , '$quantity' , '$brockrage' , '$wet_type' , '$amnts' , '$time' , '$date') ");
}*/
//$_SESSION['selectitemforpurchase'] = "FX".rand(1111111,9999999);
//print "Success : Order successfully Submitted !
";
}
if(isset($_POST['prev_cust_card_no']))
{
$customer_id = $_POST['prev_cust_card_no'];
?>
Product Name |
Weight |
Qunatity |
Product Detail |
Shop Now |
'$dates' group by T2.item_id order by count(T2.item_id) DESC LIMIT 10 ");
$num = mysql_num_rows($qry);
if($num > 0)
{
$cnt = 0;
while($res = mysql_fetch_assoc($qry))
{
$cnt = $cnt+1;
if(($cnt%2) == 0)
$class = "darkcss";
else
$class = "lightcss";
$item_id = $res['id'];
$pur_item_name = $res['item_name'];
$cat_id = $res['cat_id'];
?>
|
|
|
|
|
";
}
if(isset($_POST['showprdfpur']))
{
$reereerer = '';
if(isset($_POST['section_id']) and ($_POST['section_id']) > 0)
{
$section_id = $_POST['section_id'];
$reereerer .= " and section_id = '$section_id' ";
}
if(isset($_POST['category_id']) and ($_POST['category_id']) > 0)
{
$category_id = $_POST['category_id'];
$reereerer .= " and cat_id = '$category_id' ";
}
if(isset($_POST['sub_cat_id']) and ($_POST['sub_cat_id']) > 0)
{
$sub_cat_id = $_POST['sub_cat_id'];
$reereerer .= " and sub_cate_id = '$sub_cat_id' ";
}
if(isset($_POST['item_name']) and ($_POST['item_name'] != ''))
{
$item_name = $_POST['item_name'];
$reereerer .= " and item_name like '%$item_name%' ";
}
if($reereerer == '')
{
$reereerer = " order by id limit 50";
}
?>
Product Name |
Weight |
Qunatity |
Product Detail |
Shop Now |
0)
{
$cnt = 0;
while($res = mysql_fetch_assoc($qry))
{
$cnt = $cnt+1;
if(($cnt%2) == 0)
$class = "darkcss";
else
$class = "lightcss";
$item_id = $res['id'];
$pur_item_name = $res['item_name'];
$cat_id = $res['cat_id'];
?>
|
|
|
|
|
";
}
if(isset($_POST['order_customer_card']))
{
$order_customer_card = $_POST['order_customer_card'];
$item_id = $_POST['item_id'];
$weight_id = $_POST['product_weight'];
$item_quantity = $_POST['item_quantity'];
$weight_type = $_POST['wttype'];
$date = date('Y-m-d');
$time = date('H:i:s');
if($weight_id == 'Other')
{
if($weight_type == 1 or $weight_type == 2)
{
$total_quantity = $item_quantity*1000;
}
else
{
$total_quantity = $item_quantity;
}
$que = mysql_query("select * from item_price where item_id = '$item_id' and weight <= '$total_quantity' and mode = 1 order by weight DESC limit 1 ");
$num = mysql_num_rows($que);
if($num == 0)
{
$que = mysql_query("select * from item_price where item_id = '$item_id' and weight > '$total_quantity' and mode = 1 order by weight ASC limit 1 ");
}
while($ddd = mysql_fetch_array($que))
{
$price = $ddd['price'];
$rate_weight_type = $ddd['weight_type'];
$weight = $ddd['weight'];
}
}
else
{
$que = mysql_query("select * from item_price where item_id = '$item_id' and id = '$weight_id' and mode = 1 ");
while($ddd = mysql_fetch_array($que))
{
$price = $ddd['price'];
$rate_weight_type = $weight_type = $ddd['weight_type'];
$weight = $ddd['weight'];
}
}
$que = mysql_query("select * from customer where card_number = '$order_customer_card' ");
while($ddd = mysql_fetch_array($que))
{
$customer_id = $ddd['id'];
}
if($weight_id == 'Other')
{
if($weight_type == 1 or $weight_type == 2)
{
$total_quantity = $item_quantity*1000;
$item_quantity = 0;
}
else
{
$total_quantity = $item_quantity;
$item_quantity = 0;
}
}
else
{
$total_quantity = $item_quantity*$weight;
}
mysql_query("insert into order_request (item_id , customer_id , item_weight , weight_type , item_quantity , total_quantity , rate , rate_weight_type , time , date , mode ) values ('$item_id' , '$customer_id' , '$weight' , '$weight_type' , '$item_quantity' , '$total_quantity' , '$price' , '$rate_weight_type' , '$time' , '$date' , 1) ");
$ytty = 'Sr. No | Item Name | Weight | Rate | Total Quantity | Total Amount | Remove |
';
$srno = 0;
$grant_total = 0;
$query = mysql_query("select * from order_request where customer_id = '$customer_id' and mode = 1 ");
while($rrr = mysql_fetch_array($query))
{
$srno++;
if(($srno%2) > 0)
$datacss = 'datalight';
else
$datacss = 'datadark';
$id = $rrr['id'];
$item_id = $rrr['item_id'];
$item_weight = $rrr['item_weight'];
$total_quantity = $rrr['total_quantity'];
$rate = $rrr['rate'];
$rate_weight_type = $rrr['rate_weight_type'];
$weight_type = $rrr['weight_type'];
$que = mysql_query("select * from item_price where item_id = '$item_id' and mode = 1 ");
while($row = mysql_fetch_array($que))
{
$item_rate_weight = $row['weight'];
}
$sadfsd = mysql_query("select * from weight_type where id = '$weight_type' ");
while($rtrfdft = mysql_fetch_array($sadfsd))
{
$weight_name = $rtrfdft['weight_name'];
}
$sadfsd = mysql_query("select * from weight_type where id = '$rate_weight_type' ");
while($rtrfdft = mysql_fetch_array($sadfsd))
{
$rate_weight_name = $rtrfdft['weight_name'];
}
$que = mysql_query("SELECT * FROM item where id = '$item_id' ");
while($ddd = mysql_fetch_array($que))
{
$item_name = $ddd['item_name'];
}
$totalamnt = ($rate/$item_weight)*$total_quantity;
$totalamnt = round($totalamnt,2);
$grant_total = $grant_total+$totalamnt;
if($rate_weight_type == 1 or $rate_weight_type == 2)
{
$titmweight = $item_weight/1000;
}
else
{
$titmweight = $item_weight;
}
if($weight_type == 1 or $weight_type == 2)
{
$totmntweight = $total_quantity/1000;
}
else
{
$totmntweight = $total_quantity;
}
$ytty .= "$srno | $item_name | $titmweight $rate_weight_name | $rate | $totmntweight $weight_name | $totalamnt |  |
";
}
$ytty .= "
";
print $ytty;
}
if(isset($_POST['cust_card_no']))
{
$order_customer_card = $_POST['cust_card_no'];
$que = mysql_query("select * from customer where card_number = '$order_customer_card' ");
while($ddd = mysql_fetch_array($que))
{
$customer_id = $ddd['id'];
}
$ytty = 'Sr. No | Item Name | Weight | Rate | Total Quantity | Total Amount | Remove |
';
$srno = 0;
$grant_total = 0;
$query = mysql_query("select * from order_request where customer_id = '$customer_id' and mode = 1 ");
while($rrr = mysql_fetch_array($query))
{
$srno++;
if(($srno%2) > 0)
$datacss = 'datalight';
else
$datacss = 'datadark';
$id = $rrr['id'];
$item_id = $rrr['item_id'];
$item_weight = $rrr['item_weight'];
$total_quantity = $rrr['total_quantity'];
$rate = $rrr['rate'];
$rate_weight_type = $rrr['rate_weight_type'];
$weight_type = $rrr['weight_type'];
$que = mysql_query("select * from item_price where item_id = '$item_id' and mode = 1 ");
while($row = mysql_fetch_array($que))
{
$item_rate_weight = $row['weight'];
}
$sadfsd = mysql_query("select * from weight_type where id = '$weight_type' ");
while($rtrfdft = mysql_fetch_array($sadfsd))
{
$weight_name = $rtrfdft['weight_name'];
}
$sadfsd = mysql_query("select * from weight_type where id = '$rate_weight_type' ");
while($rtrfdft = mysql_fetch_array($sadfsd))
{
$rate_weight_name = $rtrfdft['weight_name'];
}
$que = mysql_query("SELECT * FROM item where id = '$item_id' ");
while($ddd = mysql_fetch_array($que))
{
$item_name = $ddd['item_name'];
}
$totalamnt = ($rate/$item_weight)*$total_quantity;
$totalamnt = round($totalamnt,2);
$grant_total = $grant_total+$totalamnt;
if($rate_weight_type == 1 or $rate_weight_type == 2)
{
$titmweight = $item_weight/1000;
}
else
{
$titmweight = $item_weight;
}
if($weight_type == 1 or $weight_type == 2)
{
$totmntweight = $total_quantity/1000;
}
else
{
$totmntweight = $total_quantity;
}
$ytty .= "$srno | $item_name | $titmweight $rate_weight_name | $rate | $totmntweight $weight_name | $totalamnt |  |
";
}
$ytty .= "
";
print $ytty;
}
if(isset($_POST['remove_order_id']))
{
$customer_card_no = $_POST['customer_card_no'];
$remove_order_id = $_POST['remove_order_id'];
$que = mysql_query("select * from customer where card_number = '$customer_card_no' ");
while($ddd = mysql_fetch_array($que))
{
$customer_id = $ddd['id'];
}
$query = mysql_query("delete from order_request where id = '$remove_order_id' and customer_id = '$customer_id' and mode = 1 ");
$ytty = 'Sr. No | Item Name | Weight | Rate | Total Quantity | Total Amount | Remove |
';
$srno = 0;
$grant_total = 0;
$query = mysql_query("select * from order_request where customer_id = '$customer_id' and mode = 1 ");
while($rrr = mysql_fetch_array($query))
{
$srno++;
if(($srno%2) > 0)
$datacss = 'datalight';
else
$datacss = 'datadark';
$id = $rrr['id'];
$item_id = $rrr['item_id'];
$item_weight = $rrr['item_weight'];
$total_quantity = $rrr['total_quantity'];
$rate = $rrr['rate'];
$rate_weight_type = $rrr['rate_weight_type'];
$weight_type = $rrr['weight_type'];
$que = mysql_query("select * from item_price where item_id = '$item_id' and mode = 1 ");
while($row = mysql_fetch_array($que))
{
$item_rate_weight = $row['weight'];
}
$sadfsd = mysql_query("select * from weight_type where id = '$weight_type' ");
while($rtrfdft = mysql_fetch_array($sadfsd))
{
$weight_name = $rtrfdft['weight_name'];
}
$sadfsd = mysql_query("select * from weight_type where id = '$rate_weight_type' ");
while($rtrfdft = mysql_fetch_array($sadfsd))
{
$rate_weight_name = $rtrfdft['weight_name'];
}
$que = mysql_query("SELECT * FROM item where id = '$item_id' ");
while($ddd = mysql_fetch_array($que))
{
$item_name = $ddd['item_name'];
}
$totalamnt = ($rate/$item_weight)*$total_quantity;
$totalamnt = round($totalamnt,2);
$grant_total = $grant_total+$totalamnt;
if($rate_weight_type == 1 or $rate_weight_type == 2)
{
$titmweight = $item_weight/1000;
}
else
{
$titmweight = $item_weight;
}
if($weight_type == 1 or $weight_type == 2)
{
$totmntweight = $total_quantity/1000;
}
else
{
$totmntweight = $total_quantity;
}
$ytty .= "$srno | $item_name | $titmweight $rate_weight_name | $rate | $totmntweight $weight_name | $totalamnt |  |
";
}
$ytty .= "
";
print $ytty;
}
if(isset($_POST['customerOrderCheckOut']))
{
$customer_id = $_POST['customer_id'];
$que = mysql_query("SELECT * FROM order_request where customer_id = '$customer_id' and mode = 1 ");
$total_num = mysql_num_rows($que);
if($total_num > 0)
{
$stime = time();
$time = date('H:i:s');
$date = date('Y-m-d');
$que = mysql_query("SELECT SUM((rate/item_weight)*total_quantity) FROM order_request where customer_id = '$customer_id' and mode = 1 ");
while($rrr = mysql_fetch_array($que))
{
$total_price = $rrr[0];
}
mysql_query("INSERT INTO customer_order (customer_id , total_price , stime , time , date , mode ) VALUES ('$customer_id' , '$total_price' , '$stime' , '$time' , '$date' , 1)");
$que = mysql_query("SELECT id FROM customer_order where customer_id = '$customer_id' and stime = '$stime' and mode = 1 ");
while($rrr = mysql_fetch_array($que))
{
$order_id = $rrr[0];
}
$que = mysql_query("SELECT * FROM order_request where customer_id = '$customer_id' and mode = 1 ");
while($rrr = mysql_fetch_array($que))
{
$item_id = $rrr['item_id'];
$item_weight = $rrr['item_weight'];
$item_quantity = $rrr['item_quantity'];
$rate = $rrr['rate'];
$rate_weight_type = $rrr['rate_weight_type'];
$weight_type = $rrr['weight_type'];
$total_weight = $rrr['total_quantity'];
$price = ($rate/$item_weight)*$total_weight;
mysql_query("INSERT INTO order_details (order_id , customer_id , item_id , weight , quantity , total_weight , weight_type , item_rate , price , time , date , mode) VALUES ('$order_id' , '$customer_id' , '$item_id' , '$item_weight' , '$item_quantity' , '$total_weight' , '$weight_type' , '$rate' , '$price' , '$time' , '$date' , 1) ");
}
$ytty = 'Sr. No | Item Name | Weight | Quantity | Total Quantity | Rate | Total Amount |
';
$srno = 0;
$grant_total = 0;
$query = mysql_query("select * from order_request where customer_id = '$customer_id' and mode = 1 ");
while($rrr = mysql_fetch_array($query))
{
$srno++;
if(($srno%2) > 0)
$datacss = 'datalight';
else
$datacss = 'datadark';
$id = $rrr['id'];
$item_id = $rrr['item_id'];
$item_weight = $rrr['item_weight'];
$item_quantity = $rrr['item_quantity'];
$rate = $rrr['rate'];
$rate_weight_type = $rrr['rate_weight_type'];
$weight_type = $rrr['weight_type'];
$que = mysql_query("select * from item_price where item_id = '$item_id' and mode = 1 ");
while($row = mysql_fetch_array($que))
{
$item_rate_weight = $row['weight'];
}
$sadfsd = mysql_query("select * from weight_type where id = '$weight_type' ");
while($rtrfdft = mysql_fetch_array($sadfsd))
{
$weight_name = $rtrfdft['weight_name'];
}
$sadfsd = mysql_query("select * from weight_type where id = '$rate_weight_type' ");
while($rtrfdft = mysql_fetch_array($sadfsd))
{
$rate_weight_name = $rtrfdft['weight_name'];
}
$que = mysql_query("SELECT * FROM item where id = '$item_id' ");
while($ddd = mysql_fetch_array($que))
{
$item_name = $ddd['item_name'];
}
if($weight_type == 1 or $weight_type == 2)
$item_weight = $item_weight/1000;
$totalamnt = $rate*$item_quantity;
$totalquan = $item_weight*$item_quantity;
$grant_total = $grant_total+$totalamnt;
$ytty .= "$srno | $item_name | $titmweight $rate_weight_name | $rate | $totmntweight $weight_name | $totalamnt |  |
";
}
$ytty .= ' |
Total Amount | '.$grant_total.' |
';
mysql_query("update order_request set mode = 2 where customer_id = '$customer_id' and mode = 1 ");
include('SMTPconfig.php');
include('SMTPClass.php');
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$fddf[0] = "aapnobazar.in@gmail.com";
$fddf[1] = "aapnobazar.kousal@gmail.com";
$fddf[2] = "aapnobazar.surendra@gmail.com";
for($i = 0; $i < 3; $i++)
{
$to = $fddf[$i];
$subject = "Order Request";
$body = $ytty;
//$SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $SmtpUser, $to, $subject, $body);
//$SMTPChat = $SMTPMail->SendMail();
}
}
print "Success : Your Order Completed !";
}
}
if(isset($_POST['itemNameInfo']))
{
print "ll".$ghghsafsf = $_POST['itemNameInfo'];
//mysql_query("$ghghsafsf");
}
if(isset($_POST['showpuritm']))
{
$dfdfdfd = '';
if(isset($_POST['section_id']) and ($_POST['section_id']) > 0)
{
$section_id = $_POST['section_id'];
$dfdfdfd .= " and section_id = '$section_id' ";
}
if(isset($_POST['category_id']) and ($_POST['category_id']) > 0)
{
$category_id = $_POST['category_id'];
$dfdfdfd .= " and cat_id = '$category_id' ";
}
if(isset($_POST['sub_cat_id']) and ($_POST['sub_cat_id']) > 0)
{
$sub_cat_id = $_POST['sub_cat_id'];
$dfdfdfd .= " and sub_cate_id = '$sub_cat_id' ";
}
if(isset($_POST['item_name']) and ($_POST['item_name'] != ''))
{
$item_name = $_POST['item_name'];
$dfdfdfd .= " and item_name like '%$item_name%' ";
}
if($dfdfdfd == '')
{
$uyuy = mysql_query("select * from product_section order by id limit 1 ");
while($rrrr = mysql_fetch_array($uyuy))
{
$section_id = $rrrr['id'];
}
$query = mysql_query("select * from item where status = 1 and section_id = '$section_id' ");
$hjhj = mysql_num_rows($query);
if($hjhj > 0)
{
$dsfdgfgsd = " and ( ";
while($rrrrr = mysql_fetch_array($query))
{
$id = $rrrrr['id'];
$dsfdgfgsd .= " item_id = '$id' or ";
}
$dsfdgfgsd .= " item_id = '$id' ) ";
}
}
else
{
$query = mysql_query("select * from item where status = 1 $dfdfdfd ");
$hjhj = mysql_num_rows($query);
if($hjhj > 0)
{
$dsfdgfgsd = " and ( ";
while($rrrrr = mysql_fetch_array($query))
{
$id = $rrrrr['id'];
$dsfdgfgsd .= " item_id = '$id' or ";
}
$dsfdgfgsd .= " item_id = '$id' ) ";
}
}
$need_item = $_POST['neededitem'];
if($need_item == 1)
{
$dsfdgfgsd .= " and (select ((SUM(total_weight)*125)/100) from order_details where item_id = order_details.item_id) > (select SUM(total_stock) from item_stock where item_id = order_details.item_id)";
}
?>
0)
{ ?>
No Member Found !";
}
}
if(isset($_POST['payingCustomerId']))
{
$customer_id = $_POST['payingCustomerId'];
$amount_paid = $_POST['amountPaids'];
$time = date('H:i:s');
$date = date('Y-m-d');
$ggkk = mysql_query("select * from payment where customer_id = '$customer_id' and mode = 1 ");
while($sdfsd = mysql_fetch_array($ggkk))
{
$total_orders_amnt = $sdfsd['order_amount'];
$order_total_amount = $sdfsd['total_amount'];
$total_due_amount = $sdfsd['due_amount'];
$paid_amount = $sdfsd['paid_amount'];
$balance_amnt = $sdfsd['balance'];
}
if($total_due_amount > $amount_paid)
{
$left_due_amnt = $total_due_amount-$amount_paid;
$left_balance = 0;
$tot_paid_amount = $amount_paid+$paid_amount;
}
else
{
$left_balance = $balance_amnt+($amount_paid-$total_due_amount);
$left_due_amnt = 0;
$tot_paid_amount = $amount_paid+$paid_amount;
}
mysql_query("update payment set due_amount = '$left_due_amnt' , paid_amount = '$tot_paid_amount' , balance = '$left_balance' where customer_id = '$customer_id' and mode = 1 ");
mysql_query("insert into order_payment (customer_id , amount , date , time) values ('$customer_id' , '$amount_paid' , '$date' , '$time') ");
echo "
Amount Successfully Paid !
";
}
if(isset($_POST['purchaseOrder']))
{
$pur_item_id = $_POST['pur_item_id'];
$pur_item_quantity = $_POST['pur_item_quantity'];
$item_weight_type = $_POST['item_weight_type'];
$time = date('H:i:s');
$date = date('Y-m-d');
if($item_weight_type == 1 or $item_weight_type == 2)
{
$quantity = $pur_item_quantity*1000;
}
else
{
$quantity = $pur_item_quantity;
}
mysql_query("insert into item_purchase_req (item_id , quantity , weight_type , date , time , mode) values ('$pur_item_id' , '$quantity' , '$item_weight_type' , '$date' , '$time' , 1) ");
}
if(isset($_POST['customerSearchBy']))
{
$sby = $_POST['customerSearchBy'];
$searchname = $_POST['searchBy'];
if($sby == 1)
{
$erere = "where card_number like '%$searchname%'";
}
if($sby == 2)
{
$erere = "where name like '%$searchname%'";
}
if($sby == 3)
{
$erere = "where mobile_office like '%$searchname%'";
}
$query = mysql_query("select * from customer $erere ");
$numss = mysql_num_rows($query);
if($numss > 0)
{ ?>
0)
{ ?>
0)
{
?>
Sr. No |
Weight |
Quantity |
Total Weight |
= 1000 and ($weight_tpe == 1 or $weight_tpe == 3))
{
$fdsfds = ($totalitweight)/1000;
$wet_tpe = 1;
}
if($totalitweight >= 1000 and ($weight_tpe == 2 or $weight_tpe == 4))
{
$fdsfds = ($totalitweight)/1000;
$wet_tpe = 2;
}
if($totalitweight < 1000 and ($weight_tpe == 1 or $weight_tpe == 3))
{
$fdsfds = $totalitweight;
$wet_tpe = 3;
}
if($totalitweight < 1000 and ($weight_tpe == 2 or $weight_tpe == 4))
{
$fdsfds = $totalitweight;
$wet_tpe = 4;
}
$q = mysql_query("SELECT * FROM weight_type where id = '$wet_tpe' ");
while($rrr = mysql_fetch_array($q))
{
$wet_type_name = $rrr['weight_name'];
}
?>
|
|
|
|
0)
{
$section_id = $_POST['section_id'];
$reereerer .= " and section_id = '$section_id' ";
}
if(isset($_POST['category_id']) and ($_POST['category_id']) > 0)
{
$category_id = $_POST['category_id'];
$reereerer .= " and cat_id = '$category_id' ";
}
if(isset($_POST['sub_cat_id']) and ($_POST['sub_cat_id']) > 0)
{
$sub_cat_id = $_POST['sub_cat_id'];
$reereerer .= " and sub_cate_id = '$sub_cat_id' ";
}
if(isset($_POST['item_name']) and ($_POST['item_name'] != ''))
{
$item_name = $_POST['item_name'];
$reereerer .= " and item_name like '%$item_name%' ";
}
if($reereerer == '')
{
$reereerer = " order by id limit 50";
}
?>