$FileString = ""; for ($index = 0; $index < mysqli_num_rows($OrderQuery['Query']); $index++) { $Data = mysqli_fetch_assoc($OrderQuery['Query']); $FileString = $FileString . $Data['OrderID'] . ','; // if ( ($index + 1) != mysqli_num_rows($OrderQuery['Query']) ) { // $FileString = $FileString . ','; // } } echo $FileString; } elseif ($_GET['action'] == "print_nametag") { header("Content-type: text/csv"); header("Content-Disposition: attachment; filename=Nametags.csv"); header("Pragma: no-cache"); header("Expires: 0"); $FileString = "section1,section2,section3,section4,section5\r\n"; $Data = GetOrderInfo($DBConn); if ($Data == false) { return false; } foreach ($Data as $Key => $Value) { if ($Value == NULL) { $Data[$Key] = ""; } } $Days = $Data['Days']; $FileString = $FileString . '"' . $Data['LName'] . ", " . $Data['FName'] . "\",\"" . $Data['Address'] . "\",\"" . $Data['City'] . ", " . $Data['State'] . " " . $Data['Zip'] . "\",\"" . $Data['BoothName'] . "\",\"" . $_GET['OrderID'] . "\"\r\n"; $AttendeeQuery = MySQLQuery($DBConn, 'select FName, LName, SpouseName, City, State, AgeGroup from attendees where OrderID="' . $_GET['OrderID'] . '";'); if ($AttendeeQuery['Result'] == false) { echo $AttendeeQuery['Query']; return false; }
// Create new PHPExcel object $objPHPExcel = new PHPExcel(); // Set document properties $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") ->setSubject("Office 2007 XLSX Test Document") ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") ->setKeywords("office 2007 openxml php") ->setCategory("Test result file"); $orderarr = GetOrderInfo($id); $currrow = 1; $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setAutoSize(true); $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true); $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true); $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setAutoSize(true); $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setAutoSize(true); $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setAutoSize(true); $currrow = 0; $currrow++;
function MetodListOrderStr($field_key,$field_value,$suffix,$line) { // $a = Array('type'=>'td', 'value'=>$value, 'tdname'=>$tdname, 'sorturl'=>$sorturl, 'ascdesc'=>$ascdesc); $tdname = ''; if(isset($field_value['tdname'])) $tdname = $field_value['tdname']; $sorturl = ''; $value = ''; //$value .= htmlspecialchars($this->GetFieldValue($line,$field_key.$suffix,$field_value['fieldtype'])); $orderarr = GetOrderInfo($line['id'],$line); $value.= '<a href="ordertoxls.php?id='.$line['id'].'" title="Импорт в Excel">'.$this->adm->DrawIcon('xls',' width="32" ').'</a>'; $value.= ' <br> '; if($this->GetAdmConfig($this->moduleact,'hideordertable')) { $value.= ' <a href="#" onclick=" document.getElementById(\'_ordertable_id_'.$line['id'].'\').style.display = \'block\'; return false; ">Показать таблицу заказа</a> <div style="display:none;" id="_ordertable_id_'.$line['id'].'">'; } $value.= ' <a href="#" onclick=" document.location.href = \'workadmin.php?act=changeadmconfig&modulename='.$this->moduleact.'&var=hideordertable&value=0\'; return false;">Всегда показывать таблицу заказа</a><br> <a href="#" onclick=" document.location.href = \'workadmin.php?act=changeadmconfig&modulename='.$this->moduleact.'&var=hideordertable&value=1\'; return false;">Всегда скрывать таблицу заказа</a><br> <style> .admin_order_table .admin_order_table th, .admin_order_table td { border:1px solid #c7c7c7; border-collapse:collapse; padding:0px; } </style> '; $value.='<table class="admin_order_table">'; $value.='<tr><td>Фото</td><td>(ID)</td><td>АРТ</td><td>Товар</td><td>Цена</td><td>К-во</td><td>Сумма</td></tr>'; foreach($orderarr['products'] AS $key=>$oneproduct) { if(isset($oneproduct['isdeleted'])) { $oneproduct['id'] = ' '; $oneproduct['artikul'] = ' '; $oneproduct['img'][0] = ''; $oneproduct['url'] = ''; $oneproduct['title'] = 'Товар удален из базы'; $oneproduct['id'] = ''; } else { $addstr = GetAddStr(100,75,$oneproduct['img'][0]); } $resprice = $oneproduct['_order_value'] * $oneproduct['_order_price']; $value.=' <tr> <td>'.($oneproduct['img'][0]=='' ? ' ' : '<a target="_blank" href="'.$oneproduct['url'].'"><img src="'.$oneproduct['img'][0].'" '.$addstr.'></a>').'</td> <td>'.$oneproduct['id'].'</td> <td>'.htmlspecialchars($oneproduct['artikul']).'</td> <td><a '.($oneproduct['url']=='' ? '' : ' href="'.$oneproduct['url'].'"').'>'.$oneproduct['title'].'</a></td> <td>'.$oneproduct['_order_price'].'</td> <td>'.$oneproduct['_order_value'].'</td> <td>'.PriceToStr($resprice).'</td> </tr> '; } $value.='</table>'; if($this->GetAdmConfig($this->moduleact,'hideordertable')) $value.= '</div>'; $a = Array('type'=>'td', 'value'=>$value, 'tdname'=>$tdname, 'sorturl'=>$sorturl, ); return Array($a); }