<?php include('login-status.php'); include("global.inc.php"); include("connection.inc.php"); global $db; $order_no_arr = (isset($_REQUEST['o'])?$_REQUEST['o']:array()); if(isset($_POST['downloadList'])) { if(count($order_no_arr) > 0) { $strOrders = implode(", ", $order_no_arr); $sql_shipto_dtls = "SELECT order_id as OrderID, CONCAT(order_shipto_name, ' ', order_shipto_surname)as Name, ". "order_shipto_company_name as CompanyName, ". "order_shipto_addr1 as Address1, order_shipto_addr2 as Address2, order_shipto_addr3 as Address3, ". "order_shipto_city as City, state_name as State, ". "order_shipto_pincode as PIN, order_shipto_email as Email, order_shipto_phone as Phone, ". "order_shipto_mobile as Mobile, CASE order_is_payment_online WHEN 1 THEN '".ONLINE."' WHEN 0 THEN". "'".OFFLINE."' WHEN 2 THEN '".ONLINEFAIL."' END AS PaymentType, CASE order_from WHEN 0 THEN '". FROM_PITARA."' WHEN 1 THEN '".FROM_CHAKMAK."' END AS OrderFrom ". "FROM customer_order, states WHERE order_id IN (".$strOrders.") AND order_shipto_state = state_id"; if(!$result = mysqli_query($db, $sql_shipto_dtls)) die(mysqli_error()); $list = array(); while($row = mysqli_fetch_assoc($result)) { $list[] = array( 'OrderID'=>$row['OrderID'], 'Name' =>$row['Name'], 'CompanyName'=>$row['CompanyName'], 'Address1'=>$row['Address1'], 'Address2'=>$row['Address2'], 'Address3'=>$row['Address3'], 'City'=>$row['City'], 'State'=>$row['State'], 'PIN'=>$row['PIN'], 'Email'=>$row['Email'], 'Phone'=>$row['Phone'], 'Mobile'=>$row['Mobile'], 'PaymentType'=>$row['PaymentType'], 'OrderFrom'=>$row['OrderFrom'] ); } exportMysqlToCsv($list, 'CustomerList.csv'); exit(); } } pageHeaderOne("Eklavya Publications Address Labels"); adminPageHeaderTwo(); $self_address = 'Eklavya Foundation, <br />'. 'Jamnalal Bajaj Parisar, <br />'. 'Jatkhedi Road, Jatkhedi, Bhopal � 462 026 (M.P)<br />'. 'Phone: (0755) 2977770, 71, 72, 73<br />'. 'E-mail: [email protected] www.eklavya.in<br />'; ?> <style type="text/css"> <!-- div#sow_box { font-size:1em; text-align:left; border:1px solid black; margin-bottom:5px; margin-left:5px; padding: .5em ; } p{color:#000;} --> </style> <!-- Add print.css file to display record in PDF format --> <link type="text/css" rel="stylesheet" href="print.css" media="print"> <?php adminPageHeaderThree(); ?> <div id="content_box" style="width: 980px;"> <?php if(count($order_no_arr) > 0) { if(isset($_POST['printLables'])) { ?> <div style="text-align:center; padding:2em;margin:auto;" id="Print"> <input type="button" value="Print" name="Print" onclick="window.print();"> </div> <?php $strOrders = implode(", ", $order_no_arr); $sql_shipto_dtls = "SELECT order_id , order_shipto_name, order_shipto_surname, order_shipto_company_name, ". "order_shipto_addr1, order_shipto_addr2, order_shipto_addr3, ". "order_shipto_city, order_shipto_state, order_shipto_country, ". "order_shipto_pincode, order_shipto_email, order_shipto_phone, order_shipto_mobile, order_num_of_packets ". "FROM customer_order WHERE order_id IN (".$strOrders.") "; if(!$result = mysqli_query($db, $sql_shipto_dtls)) die(mysqli_error()); $j=0; while($row_details = mysqli_fetch_assoc($result)) { if(!$row_details['order_num_of_packets']) $order_num_of_packets = 1; else $order_num_of_packets = $row_details['order_num_of_packets']; for($i=1;$i<=$order_num_of_packets;$i++) { echo '<div id="sow_box">'; echo '<b>Order Number:'.$row_details['order_id'].' Pkt. '.$i.'/'.$order_num_of_packets.'</b><br />'; echo '<div style="text-align:center;">'; echo '<div style="text-align:center;width:400px;margin:auto;border-bottom: solid 1px;font-size:15"><img src="images/pitara.jpg" alt="" style="text-align:center;margin:auto;" /></div><br />'; echo '<h4><u>PRINTED BOOKS</u></h4>'; // echo '<div style="text-align:left;">'; echo '<p style="text-align:left;padding-left:5px;width:400px;margin:auto;font-weight:bold;font-size:18px">To, <br />'; if(strlen($row_details['order_shipto_company_name']) > 0 AND (strlen($row_details['order_shipto_name'])> 0 || strlen($row_details['order_shipto_surname']) > 0 )) echo $row_details['order_shipto_company_name'].'<br />Attn: '.$row_details['order_shipto_name']." ".$row_details['order_shipto_surname'].'<br/>'; else if(strlen($row_details['order_shipto_name'])> 0 || strlen($row_details['order_shipto_surname']) > 0 ) echo $row_details['order_shipto_name']." ".$row_details['order_shipto_surname'].'<br />'; if(strlen($row_details['order_shipto_addr1']) > 0) echo $row_details['order_shipto_addr1'].', '; if(strlen($row_details['order_shipto_addr2']) > 0) echo $row_details['order_shipto_addr2'].', '; if(strlen($row_details['order_shipto_addr3']) > 0) echo $row_details['order_shipto_addr3'].', '; if(strlen($row_details['order_shipto_city']) > 0) echo '<br />'.$row_details['order_shipto_city'].' '.$row_details['order_shipto_pincode'].', '; if(strlen($row_details['order_shipto_state']) > 0) echo getStatesName($row_details['order_shipto_state']).' '; if(strlen($row_details['order_shipto_phone']) > 0) echo '<br />Phone: '.$row_details['order_shipto_phone'].''; if(strlen($row_details['order_shipto_mobile']) > 0) echo '<br />Mobile: '.$row_details['order_shipto_mobile']; echo '</p>'; echo '<div style="text-align:center;margin:auto;"><img src="images/gal.jpg" alt="" style="margin:auto;" /></div><br />'; echo '</div>'; echo '<p style="font-weight:bold;">'.$self_address.'</p>'; echo '</div>'; if($j++ == 1) { echo '<div class="page-break"></div>'; $j = 0; } } } } } else { echo '<div style="color:#ff0000;padding:2em;font-weight:bold;text-align:center;">'. 'Select atleast one order. Use checkboxes for selection. Click <a href="admin-status.php">here</a>'. '</div>'; } ?> </div>