SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | /** | |
| 3 | * The order number is now needed in the URL E.g http://example.com/file.php?orderid=2 | |
| 4 | */ | |
| 5 | ||
| 6 | // Database Sanitization function see more info at http://pastebin.com/D7mA05px | |
| 7 | - | $result = mysql_query('SELECT `order`.*, `order_product`.`name`, `order_product`.`model`, `order_product`.`price`, `order_product`.`quantity`,`order_product`.`total`, `order_option`.`name` as option_name, `order_option`.`value` as option_value
|
| 7 | + | function doQuery($query) {
|
| 8 | - | FROM `order_product`, `order`, `order_option` |
| 8 | + | $numParams = func_num_args(); |
| 9 | - | WHERE `order`.`order_id` = "2"') |
| 9 | + | $params = func_get_args(); |
| 10 | ||
| 11 | if($numParams > 1) {
| |
| 12 | for($i=1;$i<$numParams;$i++) {
| |
| 13 | $params[$i] = mysql_real_escape_string($params[$i]); | |
| 14 | } | |
| 15 | $query = call_user_func_array('sprintf', $params);
| |
| 16 | } | |
| 17 | $result = @mysql_query($query); | |
| 18 | if(!$result) {
| |
| 19 | throw new Exception('DB Class - doQuery: MySQL Error - '.mysql_error());
| |
| 20 | } else {
| |
| 21 | return $result; | |
| 22 | } | |
| 23 | } | |
| 24 | ||
| 25 | // Make a MySQL Connection | |
| 26 | mysql_connect("localhost", "", "") or die(mysql_error());
| |
| 27 | mysql_select_db("opencart") or die(mysql_error());
| |
| 28 | ||
| 29 | // Checks if the order number exists and if it's actually a number and converts it to a number just incase | |
| 30 | if(isset($_GET['orderid']) && is_numeric(intval($_GET['orderid']))) {
| |
| 31 | $OrderID = intval($_GET['orderid']); | |
| 32 | } else {
| |
| 33 | die('That is not a Valid Order ID Please try again');
| |
| 34 | } | |
| 35 | ||
| 36 | // Retrieve all the data from the "example" table | |
| 37 | $result = doQuery("SELECT `order`.*, `order_product`.`name`, `order_product`.`model`, `order_product`.`price`, `order_product`.`quantity`,`order_product`.`total`, `order_option`.`name` as option_name, `order_option`.`value` as option_value FROM `order_product`, `order`, `order_option` WHERE `order`.`order_id` = '%s'", $OrderID) or die(mysql_error());
| |
| 38 | ||
| 39 | // store the record of the "example" table into $row | |
| 40 | $row = mysql_fetch_array( $result ); | |
| 41 | // Print out the contents of the entry | |
| 42 | ||
| 43 | ?> | |
| 44 | ||
| 45 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| 46 | <html xmlns="http://www.w3.org/1999/xhtml"> | |
| 47 | <style type="text/css"> | |
| 48 | .topbar {
| |
| 49 | text-align: center; | |
| 50 | } | |
| 51 | .topbar {
| |
| 52 | text-align: center; | |
| 53 | } | |
| 54 | </style> | |
| 55 | <style type="text/css"> | |
| 56 | .ui-state-hover { background-color: #ffC }
| |
| 57 | .inlineEdit-placeholder { font-style: italic; color: #555; }
| |
| 58 | .style1 {
| |
| 59 | color: #FFFFFF; | |
| 60 | font-weight: bold; | |
| 61 | font-family: Arial, Helvetica, sans-serif; | |
| 62 | } | |
| 63 | </style> | |
| 64 | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> | |
| 65 | <script type="text/javascript" src="jquery.inlineedit.js"></script> | |
| 66 | <script type="text/javascript"> | |
| 67 | ||
| 68 | $(function() {
| |
| 69 | $('.editable').inlineEdit();
| |
| 70 | }); | |
| 71 | ||
| 72 | </script> | |
| 73 | <head> | |
| 74 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
| 75 | <title>Untitled Document</title> | |
| 76 | ||
| 77 | </head> | |
| 78 | ||
| 79 | <script> | |
| 80 | function coderHakan() | |
| 81 | {
| |
| 82 | var sayfa = window.open(); | |
| 83 | sayfa.document.open("text/html");
| |
| 84 | sayfa.document.write(document.getElementById('printArea').innerHTML);
| |
| 85 | sayfa.document.close(); | |
| 86 | sayfa.print(); | |
| 87 | } | |
| 88 | </script> | |
| 89 | ||
| 90 | <script type="text/javascript"> | |
| 91 | function displayResult() | |
| 92 | {
| |
| 93 | var table=document.getElementById("products");
| |
| 94 | var row=table.insertRow(1); | |
| 95 | var cell1=row.insertCell(0); | |
| 96 | cell1.align = "left" ; | |
| 97 | ||
| 98 | var cell2=row.insertCell(1); | |
| 99 | cell2.align = "left" ; | |
| 100 | ||
| 101 | var cell3=row.insertCell(2); | |
| 102 | cell3.align = "right" ; | |
| 103 | ||
| 104 | var cell4=row.insertCell(3); | |
| 105 | cell4.align = "right" ; | |
| 106 | ||
| 107 | var cell5=row.insertCell(4); | |
| 108 | cell5.align = "right" ; | |
| 109 | ||
| 110 | cell1.innerHTML='<span class="editable">Insert Product Description</span>'; | |
| 111 | cell2.innerHTML='<span class="editable">XXXXXX</span>'; | |
| 112 | cell3.innerHTML='<span class="editable">1</span>'; | |
| 113 | cell4.innerHTML='<span class="editable">£00.00</span>'; | |
| 114 | cell5.innerHTML='<span class="editable">£00.00</span>'; | |
| 115 | } | |
| 116 | </script> | |
| 117 | ||
| 118 | ||
| 119 | ||
| 120 | ||
| 121 | ||
| 122 | ||
| 123 | ||
| 124 | ||
| 125 | ||
| 126 | ||
| 127 | ||
| 128 | ||
| 129 | ||
| 130 | ||
| 131 | ||
| 132 | ||
| 133 | ||
| 134 | ||
| 135 | <body> | |
| 136 | <hr size="10px" noshade="noshade" class="topbar" background-color="000000" /> | |
| 137 | <table width="100%" border="0" cellpadding="10" height="50" bgcolor="#000000"> | |
| 138 | <tr> | |
| 139 | <td width="50%" align="left" valign="middle" class="style1">Insert Order ID: </td> | |
| 140 | <td width="50%" align="right" valign="middle"><input type="button" style="height: 25px; width: 150px" class="topbar" onclick="coderHakan()" value="Print" /> | |
| 141 | <input type="button" style="height: 25px; width: 150px" class="topbar" onclick="displayResult()" value="Add Product Row" /></td> | |
| 142 | </tr> | |
| 143 | </table> | |
| 144 | <hr size="10px" noshade="noshade" class="topbar" background-color="000000" /> | |
| 145 | ||
| 146 | ||
| 147 | ||
| 148 | ||
| 149 | ||
| 150 | ||
| 151 | <div id="printArea"> | |
| 152 | <link rel="stylesheet" type="text/css" href="invoice.css" /> | |
| 153 | <div style="page-break-after: always;"> | |
| 154 | <h1> | |
| 155 | Invoice</h1> | |
| 156 | <div class="div1"> | |
| 157 | <table width="100%"> | |
| 158 | <tr> | |
| 159 | <td> | |
| 160 | ||
| 161 | <span class="editable">Room31 Wholesale</span> | |
| 162 | <br /> | |
| 163 | <span class="editable">Unit D2,</span> | |
| 164 | <br /> | |
| 165 | <span class="editable">Taylor Business Park</span> | |
| 166 | <br /> | |
| 167 | <span class="editable">Risley</span> | |
| 168 | <br /> | |
| 169 | <span class="editable">Warrington</span> | |
| 170 | <br /> | |
| 171 | <span class="editable">Cheshire</span> | |
| 172 | <br /> | |
| 173 | <span class="editable">WA3 6BL</span> | |
| 174 | <br /> | |
| 175 | ||
| 176 | <!-- EU-VAT - TAG --> | |
| 177 | <span class="editable">VAT Number: GB106004279</span> | |
| 178 | <br /> | |
| 179 | <!-- END EU-VAT - TAG --> | |
| 180 | <span class="editable">Telephone 01925766340</span> | |
| 181 | <br /> | |
| 182 | <span class="editable">[email protected]</span> | |
| 183 | <br /> | |
| 184 | <span class="editable">http://www.room31wholesale.co.uk</span> | |
| 185 | </td> | |
| 186 | ||
| 187 | <td align="right" valign="top"><table> | |
| 188 | <tr> | |
| 189 | <td><b>Order Date:</b></td> | |
| 190 | <td><span class="editable">21/12/2011</span></td> | |
| 191 | </tr> | |
| 192 | <tr> | |
| 193 | <td><b>Invoice No.:</b></td> | |
| 194 | <td><span class="editable">RWH20607</span></td> | |
| 195 | </tr> | |
| 196 | <tr> | |
| 197 | <td><b>Order ID:</b></td> | |
| 198 | <td><span class="editable"><?php echo $row['order_id']; ?></span></td> | |
| 199 | </tr> | |
| 200 | </table></td> | |
| 201 | </tr> | |
| 202 | </table> | |
| 203 | </div> | |
| 204 | ||
| 205 | <table class="address"> | |
| 206 | <tr class="heading"> | |
| 207 | <td width="50%"><b>To</b></td> | |
| 208 | <td width="50%"><b>Ship To (if different address)</b></td> | |
| 209 | </tr> | |
| 210 | <tr> | |
| 211 | <td> | |
| 212 | <span class="editable"><?php echo $row['payment_firstname']; ?> <?php echo $row['payment_lastname']; ?></span> | |
| 213 | <br /> | |
| 214 | <span class="editable"><?php echo $row['payment_company']; ?></span> | |
| 215 | <br /> | |
| 216 | <span class="editable"><?php echo $row['payment_address_1']; ?></span> | |
| 217 | <br /> | |
| 218 | <span class="editable"><?php echo $row['payment_address_2']; ?></span> | |
| 219 | <br /> | |
| 220 | <span class="editable"><?php echo $row['payment_city']; ?></span> | |
| 221 | <br /> | |
| 222 | <span class="editable"><?php echo $row['payment_postcode']; ?></span> | |
| 223 | <br /> | |
| 224 | <span class="editable"><?php echo $row['payment_zone']; ?></span> | |
| 225 | <br /> | |
| 226 | <span class="editable"><?php echo $row['payment_country']; ?></span> | |
| 227 | <!-- EU-VAT - TAG --> | |
| 228 | <br/> | |
| 229 | <!-- END EU-VAT - TAG --> | |
| 230 | <span class="editable"><?php echo $row['email']; ?></span> | |
| 231 | <br/> | |
| 232 | <span class="editable"><?php echo $row['telephone']; ?></span></td> | |
| 233 | <td valign="top"> | |
| 234 | <span class="editable"><?php echo $row['shipping_firstname']; ?> <?php echo $row['shipping_lastname']; ?></span> | |
| 235 | <br /> | |
| 236 | <span class="editable"><?php echo $row['shipping_company']; ?></span> | |
| 237 | <br /> | |
| 238 | <span class="editable"><?php echo $row['shipping_address_1']; ?></span> | |
| 239 | <br /> | |
| 240 | <span class="editable"><?php echo $row['shipping_address_2']; ?></span> | |
| 241 | <br /> | |
| 242 | <span class="editable"><?php echo $row['shipping_city']; ?></span> | |
| 243 | <br /> | |
| 244 | <span class="editable"><?php echo $row['shipping_postcode']; ?></span> | |
| 245 | <br /> | |
| 246 | <span class="editable"><?php echo $row['shipping_zone']; ?></span> | |
| 247 | <br /> | |
| 248 | <span class="editable"><?php echo $row['shipping_country']; ?></span> | |
| 249 | </tr> | |
| 250 | </table> | |
| 251 | <table class="product" id="products"> | |
| 252 | <tr class="heading"> | |
| 253 | <td><b>Product</b></td> | |
| 254 | <td><b>Model</b></td> | |
| 255 | <td align="right"><b>Quantity</b></td> | |
| 256 | <td align="right"><b>Unit Price</b></td> | |
| 257 | <td align="right"><b>Total</b></td> | |
| 258 | </tr> | |
| 259 | <tr> | |
| 260 | <td> | |
| 261 | <span class="editable"><span class="editable"><?php echo $row['name']; ?></span></span> | |
| 262 | <br /> | |
| 263 | <span class="editable"><small><?php echo $row['option_name']; ?> - <?php echo $row['option_value']; ?></small></span> | |
| 264 | </td> | |
| 265 | <td><span class="editable"><?php echo $row['model']; ?></span></td> | |
| 266 | <td align="right"><span class="editable"><?php echo $row['quantity']; ?></span></td> | |
| 267 | <td align="right"><span class="editable"><?php echo $row['price']; ?></span></td> | |
| 268 | <td align="right"><span class="editable"><?php echo $row['total']; ?></span></td> | |
| 269 | </tr> | |
| 270 | ||
| 271 | ||
| 272 | <?php $result2 = mysql_query('
| |
| 273 | SELECT `order_total` . *, `order_total`.`title` as order_title | |
| 274 | FROM `order_total` | |
| 275 | WHERE `order_total`.`order_id` = "1" | |
| 276 | ') | |
| 277 | or die(mysql_error()); | |
| 278 | ||
| 279 | // store the record of the "example" table into $row | |
| 280 | $row = mysql_fetch_array( $result2 ); | |
| 281 | // Print out the contents of the entry | |
| 282 | ||
| 283 | ?> | |
| 284 | ||
| 285 | <?php | |
| 286 | for($i = $row; $i < 4; $i++) {
| |
| 287 | echo $row['order_title']; | |
| 288 | } | |
| 289 | ||
| 290 | ?> | |
| 291 | ||
| 292 | <tr> | |
| 293 | <td align="right" colspan="4"><b><?php echo $row['order_title'];?></span></b></td> | |
| 294 | <td align="right"><span class="editable"><?php echo $row['value']; ?></span></td> | |
| 295 | </tr> | |
| 296 | <tr> | |
| 297 | <td align="right" colspan="4"><b><?php echo $row['order_title']; ?></b></td> | |
| 298 | <td align="right"><span class="editable"><?php echo $row['value']; ?></span></td> | |
| 299 | </tr> | |
| 300 | <tr> | |
| 301 | <td align="right" colspan="4"><b><?php echo $row['order_title']; ?></b></td> | |
| 302 | <td align="right"><span class="editable"><?php echo $row['value']; ?></span></td> | |
| 303 | </tr> | |
| 304 | <tr> | |
| 305 | <td align="right" colspan="4"><b><?php echo $row['order_title']; ?></b></td> | |
| 306 | <td align="right"><span class="editable"><?php echo $row['value']; ?></span></td> | |
| 307 | </tr> | |
| 308 | </table> | |
| 309 | <table class="product"> | |
| 310 | <tr class="heading"> | |
| 311 | <td><b>Comment</b></td> | |
| 312 | </tr> | |
| 313 | <tr> | |
| 314 | <td></td> | |
| 315 | </tr> | |
| 316 | </table> | |
| 317 | </div> | |
| 318 | ||
| 319 | </div> | |
| 320 | ||
| 321 | <p> </p> | |
| 322 | <p> </p> | |
| 323 | </body> | |
| 324 | </html> |