} echo ' <tr class="dataTableRow">' . "\n" . ' <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . ' x</td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['name']; if (isset($order->products[$i]['attributes']) && ($k = sizeof($order->products[$i]['attributes'])) > 0) { for ($j = 0; $j < $k; $j++) { echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])); if ($order->products[$i]['attributes'][$j]['price'] != '0') { echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')'; } if ($order->products[$i]['attributes'][$j]['product_attribute_is_free'] == '1' and $order->products[$i]['product_is_free'] == '1') { echo TEXT_INFO_ATTRIBUTE_FREE; } echo '</i></small></nobr>'; } } echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n"; echo ' <td class="dataTableContent" align="right" valign="top">' . zen_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') . '</b></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') . '</b></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(zen_round($order->products[$i]['final_price'], $decimals) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') . '</b></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top"><b>' . $priceIncTax . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') . '</b></td>' . "\n"; echo ' </tr>' . "\n"; } ?> <tr> <td align="right" colspan="8"><table border="0" cellspacing="0" cellpadding="2"> <?php for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) { echo ' <tr>' . "\n" . ' <td align="right" class="' . str_replace('_', '-', $order->totals[$i]['class']) . '-Text">' . $order->totals[$i]['title'] . '</td>' . "\n" . ' <td align="right" class="' . str_replace('_', '-', $order->totals[$i]['class']) . '-Amount">' . $order->totals[$i]['text'] . '</td>' . "\n" . ' </tr>' . "\n"; } ?> </table></td> </tr> </table></td> </tr>
if (isset($order->products[$i]['attributes']) && ($k = sizeof($order->products[$i]['attributes'])) > 0) { for ($j = 0; $j < $k; $j++) { echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])); if ($order->products[$i]['attributes'][$j]['price'] != '0') { echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')'; } if ($order->products[$i]['attributes'][$j]['product_attribute_is_free'] == '1' and $order->products[$i]['product_is_free'] == '1') { echo TEXT_INFO_ATTRIBUTE_FREE; } echo '</i></small></nobr>'; } } echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n"; echo ' <td class="dataTableContent" valign="top">'; if ($display_tax) { echo zen_display_tax_value($order->products[$i]['tax']) . '%'; } else { echo ENTRY_NO_TAX; } echo '</td>' . "\n"; if ($display_tax) { echo ' <td class="dataTableContent" align="right" valign="top"><strong>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</strong></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top"><strong>' . $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</strong></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top"><strong>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</strong></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top"><strong>' . $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</strong></td>' . "\n"; echo ' </tr>' . "\n"; } else { echo ' <td class="dataTableContent" align="right" valign="top"><strong>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</strong></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="top"><strong>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</strong></td>' . "\n" . ' </tr>' . "\n"; } } ?> <tr> <td colspan="8" align="right"><table border="0" cellpadding="2" cellspacing="0">
echo ' <td class="dataTableContent" valign="top" width="10">' . zen_draw_checkbox_field('incl_product_' . $i, 'yes') . '</td>' . "\n"; } echo ' <td class="dataTableContent" valign="middle" align="left">' . $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name']; if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) { for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) { echo '<br /><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value']; if ($order->products[$i]['attributes'][$j]['price'] != '0') { echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')'; } if ($order->products[$i]['attributes'][$j]['product_attribute_is_free'] == '1' and $order->products[$i]['product_is_free'] == '1') { echo TEXT_INFO_ATTRIBUTE_FREE; } echo '</i></small></nobr>'; } } echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="middle">' . $order->products[$i]['model'] . '</td>' . "\n" . ' <td class="dataTableContent" align="right" valign="middle">' . zen_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" . ' <td class="dataTableContent" align="right" valign="middle"><strong>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') . '</strong></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="middle"><strong>' . $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') . '</strong></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="middle"><strong>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') . '</strong></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="middle"><strong>' . $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') . '</strong></td>' . "\n"; echo ' </tr>' . "\n"; } ?> <tr> <?php if (sizeof($order->products) > 1) { ?> <td valign="top" colspan="2"><table border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top"> <?php echo zen_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?> </td> <td valign="bottom" class="main"><input type="submit" value="<?php echo BUTTON_SPLIT;
function draw_packing_slip_order($order, &$pdf) { global $db; require_once DIR_WS_CLASSES . 'currencies.php'; $currencies = new currencies(); // prepare order-status pulldown list $orders_statuses = array(); $orders_status_array = array(); $orders_status = $db->Execute("select orders_status_id, orders_status_name\n from " . TABLE_ORDERS_STATUS . "\n where language_id = '" . (int) $_SESSION['languages_id'] . "'"); while (!$orders_status->EOF) { $orders_statuses[] = array('id' => $orders_status->fields['orders_status_id'], 'text' => $orders_status->fields['orders_status_name'] . ' [' . $orders_status->fields['orders_status_id'] . ']'); $orders_status_array[$orders_status->fields['orders_status_id']] = $orders_status->fields['orders_status_name']; $orders_status->MoveNext(); } /* display order information header */ $pdf->SetFont('Arial', 'B', 6); /* order object doesn't include orderid. added id to info so we can retrieve it here */ $pdf->Cell(120, 14, ENTRY_ORDER_ID . $order->info['id']); $pdf->Cell(236, 14, ENTRY_DATE_PURCHASED . ' ' . zen_date_long($order->info['date_purchased'])); $pdf->MultiCell(220, 14, ENTRY_PAYMENT_METHOD . ' ' . $order->info['payment_method']); $pdf->SetFont('Arial', '', 10); if (TAX_ID_NUMBER != '') { $pdf->SetFillColor(180, 180, 180); $pdf->Cell(30, 14, TABLE_HEADING_QTY, 1, 0, '', 1); $pdf->Cell(160, 14, TABLE_HEADING_PRODUCTS, 1, 0, '', 1); $pdf->Cell(160, 14, TABLE_HEADING_PRODUCTS_MODEL, 1, 0, '', 1); $pdf->Cell(60, 14, TABLE_HEADING_TAX, 1, 0, '', 1); $pdf->Cell(78, 14, TABLE_HEADING_PRICE_NO_TAX, 1, 0, 'R', 1); $pdf->MultiCell(78, 14, TABLE_HEADING_TOTAL_NO_TAX, 1, 'R', 1); } else { $pdf->SetFillColor(180, 180, 180); $pdf->Cell(25, 14, TABLE_HEADING_QTY, 1, 0, '', 1); $pdf->Cell(120, 14, TABLE_HEADING_PRODUCTS, 1, 0, '', 1); $pdf->Cell(120, 14, TABLE_HEADING_PRODUCTS_MODEL, 1, 0, '', 1); $pdf->Cell(40, 14, TABLE_HEADING_TAX, 1, 0, 'R', 1); $pdf->Cell(68, 14, TABLE_HEADING_PRICE_EXCLUDING_TAX, 1, 0, 'R', 1); $pdf->Cell(68, 14, TABLE_HEADING_PRICE_INCLUDING_TAX, 1, 0, 'R', 1); $pdf->Cell(68, 14, TABLE_HEADING_TOTAL_EXCLUDING_TAX, 1, 0, 'R', 1); $pdf->MultiCell(68, 14, TABLE_HEADING_TOTAL_INCLUDING_TAX, 1, 'R', 1); } $pdf->SetFillColor(256, 256, 256); if (TAX_ID_NUMBER != '') { /* draw order items in table when tax ID number is NOT null*/ for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { /* BEGIN update (Loose Chicken Software Development, david@loosechicken.com 01-03-2011) */ /* break attributes onto new lines */ $prod_name = $order->products[$i]['name']; $prod_attrs = array(); if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) { for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) { $prod_attrs[] = $order->products[$i]['attributes'][$j]['option'] . ': ' . zen_output_string_protected($order->products[$i]['attributes'][$j]['value']); } } /* BEGIN add (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ /* Find height of model and Product names */ $h_model = $pdf->MultiCellHeight(160, 14, $order->products[$i]['model'], 'LRT', 'L', 1); $h = $h_model; $h_product_name = $pdf->MultiCellHeight(160, 14, $prod_name, 'LRT', 'L', 1); $h = $h_product_name > $h ? $h_product_name : $h; /* If cells would be too tall, force a page break */ if ($pdf->y + $h > $pdf->PageBreakTrigger) { $pdf->AddPage(); } /* Get current y, to use with $h_product_name later when placing attributes */ $y_top = $pdf->getY(); /* END add (Loose Chicken Software Development 01-07-2011) */ $pdf->Cell(30, 14, $order->products[$i]['qty'], 'LRT', 0, '', 1); /* BEGIN update (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ /* * Changed Cell to MultiCell for the test wrapping. * Because MultiCell doesn't leave the cursor in the right place: * Retrived cursor before drawing cell, and placed it afterward base on origal location and cell width */ $y = $pdf->getY(); $x = $pdf->getX(); $pdf->MultiCell(160, 14, $prod_name, 'LRT', 'L', 1); $max_y = $pdf->getY(); $pdf->setXY($x + 160, $y); $y = $pdf->getY(); $x = $pdf->getX(); $pdf->MultiCell(160, 14, $order->products[$i]['model'], 'LRT', 'L', 1); $max_y = $pdf->getY() > $max_y ? $pdf->getY() : $max_y; $pdf->setXY($x + 160, $y); /* END update (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ $pdf->Cell(60, 14, ENTRY_NO_TAX, 'LRT', 0, '', 1); $pdf->Cell(78, 14, $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']), 'LRT', 0, 'R', 1); $pdf->MultiCell(78, 14, $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']), 'LRT', 'R', 1); /* BEGIN add (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ /* * Draw cell borders in case model or product name wrapped and thus would leave blank * spaces on the other cells. (This must be transparent so the cells are not overritten) */ $x = $pdf->GetX(); $y = $pdf->GetY(); if ($max_y > $y) { $h = $max_y - $y; $pdf->Cell(30, $h, '', 'LR', 0, '', 0); $pdf->Cell(160, $h, '', 'LR', 0, '', 0); $pdf->Cell(160, $h, '', 'LR', 0, '', 0); $pdf->Cell(60, $h, '', 'LR', 0, '', 0); $pdf->Cell(78, $h, '', 'LR', 0, '', 0); $pdf->MultiCell(78, $h, '', 'LR', 'J', 0); $pdf->setXY($x, $y); } $max_y_page = $pdf->PageNo(); /* Place attributes below product_name */ $pdf->setXY($x, $y_top + $h_product_name); /* END add (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ $pdf->SetFont('Arial', '', 8); $pdf->SetTextColor(40, 40, 40); foreach ($prod_attrs as $prod_attr) { $pdf->Cell(30, 10, '', 'LR', 0, '', 1); $pdf->Cell(160, 10, ' - ' . $prod_attr, 'LR', 0, '', 1); $pdf->Cell(160, 10, '', 'LR', 0, '', 1); $pdf->Cell(60, 10, '', 'LR', 0, '', 1); $pdf->Cell(78, 10, '', 'LR', 0, '', 1); $pdf->MultiCell(78, 10, '', 'LR', 'J', 1); } $x = $pdf->GetX(); $y = $pdf->GetY(); /* BEGIN add (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ /* * If after drawing the attributes the cursor is not as low as after drawing * the model and product name lower the cursor for the drawing of the bottom line */ if ($max_y > $y && $max_y_page == $pdf->PageNo()) { $y = $max_y; } /* END add (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ $pdf->Line($x, $y, $x + 30 + 160 + 160 + 60 + 78 + 78, $y); $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('Arial', '', 10); /* END modification (Loose Chicken Software Development 01-03-2011) */ } } else { /* draw order items in table when tax ID number IS null*/ for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { /* BEGIN update (Loose Chicken Software Development, david@loosechicken.com 01-03-2011) */ /* break attributes onto new lines */ $prod_name = $order->products[$i]['name']; $prod_attrs = array(); if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) { for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) { $prod_attrs[] = $order->products[$i]['attributes'][$j]['option'] . ': ' . zen_output_string_protected($order->products[$i]['attributes'][$j]['value']); } } /* BEGIN add (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ /* Find height of model and Product names */ $h_model = $pdf->MultiCellHeight(120, 14, $order->products[$i]['model'], 'LRT', 'L', 1); $h = $h_model; $h_product_name = $pdf->MultiCellHeight(120, 14, $prod_name, 'LRT', 'L', 1); $h = $h_product_name > $h ? $h_product_name : $h; /* If cells would be too tall, force a page break */ if ($pdf->y + $h > $pdf->PageBreakTrigger) { $pdf->AddPage(); } /* Get current y, to use with $h_product_name later when placing attributes */ $y_top = $pdf->getY(); /* END add (Loose Chicken Software Development 01-07-2011) */ $pdf->Cell(25, 14, $order->products[$i]['qty'], 'LRT', 0, '', 1); /* BEGIN update (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ /* * Changed Cell to MultiCell for the test wrapping. * Because MultiCell doesn't leave the cursor in the right place: * Retrived cursor before drawing cell, and placed it afterward base on origal location and cell width */ $y = $pdf->getY(); $x = $pdf->getX(); $pdf->MultiCell(120, 14, $prod_name, 'LRT', 'L', 1); $max_y = $pdf->getY(); $pdf->setXY($x + 120, $y); $y = $pdf->getY(); $x = $pdf->getX(); $pdf->MultiCell(120, 14, $order->products[$i]['model'], 'LRT', 'L', 1); $max_y = $pdf->getY() > $max_y ? $pdf->getY() : $max_y; $pdf->setXY($x + 120, $y); /* END update (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ /*$pdf->Cell(40, 14, zen_display_tax_value($order->products[$i]['tax']) . '%', 'LRT', 0, 'R', 1); $pdf->Cell(68, 14, $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']), 'LRT', 0, 'R', 1); $pdf->Cell(68, 14, $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']), 'LRT', 0, 'R', 1); $pdf->Cell(68, 14, $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']), 'LRT', 0, 'R', 1); $pdf->MultiCell(68, 14, $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']), 'LRT', 'R', 1); */ $pdf->Cell(40, 14, html_entity_decode(zen_display_tax_value($order->products[$i]['tax']) . '%', ENT_QUOTES, "ISO-8859-15"), 'LRT', 0, 'R', 1); if ($order->info['currency'] == 'EUR') { $f1 = str_replace('€', '€', $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value'])); $pdf->Cell(68, 14, html_entity_decode($f1), 'LRT', 'R', 1); } else { $pdf->Cell(68, 14, html_entity_decode($currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']), ENT_QUOTES, "ISO-8859-15"), 'LRT', 0, 'R', 1); } if ($order->info['currency'] == 'EUR') { $f2 = str_replace('€', '€', $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value'])); $pdf->Cell(68, 14, html_entity_decode($f2), 'LRT', 'R', 1); } else { $pdf->Cell(68, 14, html_entity_decode($currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']), ENT_QUOTES, "ISO-8859-15"), 'LRT', 0, 'R', 1); } if ($order->info['currency'] == 'EUR') { $f3 = str_replace('€', '€', $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value'])); $pdf->Cell(68, 14, html_entity_decode($f3), 'LRT', 'R', 1); } else { $pdf->Cell(68, 14, html_entity_decode($currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']), ENT_QUOTES, "ISO-8859-15"), 'LRT', 0, 'R', 1); } if ($order->info['currency'] == 'EUR') { $f = str_replace('€', '€', $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value'])); $pdf->MultiCell(68, 14, html_entity_decode($f), 'LRT', 'R', 1); } else { $pdf->MultiCell(68, 14, html_entity_decode($currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']), ENT_QUOTES, "ISO-8859-15"), 'LRT', 'R', 1); } /* BEGIN add (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ /* * Draw cell borders in case model or product name wrapped and thus would leave blank * spaces on the other cells. (This must be transparent so the cells are not overritten) */ $x = $pdf->GetX(); $y = $pdf->GetY(); if ($max_y > $y) { $h = $max_y - $y; $pdf->Cell(25, $h, '', 'LR', 0, '', 0); $pdf->Cell(120, $h, '', 'LR', 0, '', 0); $pdf->Cell(120, $h, '', 'LR', 0, '', 0); $pdf->Cell(40, $h, '', 'LR', 0, '', 0); $pdf->Cell(68, $h, '', 'LR', 0, '', 0); $pdf->Cell(68, $h, '', 'LR', 0, '', 0); $pdf->Cell(68, $h, '', 'LR', 0, '', 0); $pdf->MultiCell(68, $h, '', 'LR', 'J', 0); $pdf->setXY($x, $y); } $max_y_page = $pdf->PageNo(); /* Place attributes below product_name */ $pdf->setXY($x, $y_top + $h_product_name); /* END add (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ $pdf->SetFont('Arial', '', 8); $pdf->SetTextColor(40, 40, 40); foreach ($prod_attrs as $prod_attr) { $pdf->Cell(25, 10, '', 'LR', 0, '', 1); $pdf->Cell(120, 10, ' - ' . $prod_attr, 'LR', 0, '', 1); $pdf->Cell(120, 10, '', 'LR', 0, '', 1); $pdf->Cell(40, 10, '', 'LR', 0, '', 1); $pdf->Cell(68, 10, '', 'LR', 0, '', 1); $pdf->Cell(68, 10, '', 'LR', 0, '', 1); $pdf->Cell(68, 10, '', 'LR', 0, '', 1); $pdf->MultiCell(68, 10, '', 'LR', 'J', 1); } $x = $pdf->GetX(); $y = $pdf->GetY(); /* BEGIN add (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ /* * If after drawing the attributes the cursor is not as low as after drawing * the model and product name lower the cursor for the drawing of the bottom line */ if ($max_y > $y && $max_y_page == $pdf->PageNo()) { $y = $max_y; } /* END add (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ $pdf->Line($x, $y, $x + 25 + 120 + 120 + 40 + 68 + 68 + 68 + 68, $y); $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('Arial', '', 10); /* END modification (Loose Chicken Software Development 01-03-2011) */ } } /* order cost summary */ $pdf->Ln(); for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) { $title = strip_tags($order->totals[$i]['title']); $text = strip_tags($order->totals[$i]['text']); /* $pdf->Cell(516, 14, $title, 0, 0, 'R'); $pdf->MultiCell(50, 14, $text, 0, 'R'); */ $pdf->Cell(516, 14, html_entity_decode($title, ENT_QUOTES, "ISO-8859-15"), 0, 0, 'R'); //echo substr($text,0,5); if (substr($text, 0, 5) == '&euro') { $a = str_replace('€', '€', $text); $pdf->MultiCell(50, 14, html_entity_decode($a, ENT_QUOTES, "ISO-8859-15"), 0, 0, 'R'); } else { $pdf->MultiCell(50, 14, html_entity_decode($text, ENT_QUOTES, "ISO-8859-15"), 0, 0, 'R'); } } /* order balance */ /*$orders_balance = $db->Execute("select orders_id , balance_due from " . TABLE_ORDERS . " where orders_id = '" . zen_db_input($order->info['id']) . "' order by orders_id"); $balance_due = $orders_balance->fields['balance_due'];*/ $pdf->SetFont('Arial', 'B', ''); require_once DIR_WS_CLASSES . 'super_order.php'; $so = new super_order($order->info['id']); $pdf->Cell(516, 14, 'Amount Paid: ', 0, 0, 'R'); // $pdf->MultiCell(50, 14, $currencies->format($so->amount_applied), 0, 'R'); // $pdf->MultiCell(50, 14, $currencies->format($balance_due), 0, 'R'); // $pdf->MultiCell(50, 14, $currencies->format($so->balance_due), 0, 'R'); $var1 = substr($currencies->format($so->amount_applied), 0, 5); if ($var1 == '&euro') { $pdf->MultiCell(50, 14, '€' . $so->amount_applied, 0, 'R'); } else { $pdf->MultiCell(50, 14, html_entity_decode($currencies->format($so->amount_applied), ENT_QUOTES, "ISO-8859-15"), 0, 'R'); } $pdf->Cell(516, 14, 'Balance Due:', 0, 0, 'R'); $var = substr($currencies->format($so->balance_due), 0, 5); if ($var == '&euro') { $pdf->MultiCell(50, 14, '€' . $so->balance_due, 0, 'R'); } else { $pdf->MultiCell(50, 14, html_entity_decode($currencies->format($so->balance_due), ENT_QUOTES, "ISO-8859-15"), 0, 'R'); } //$pdf->SetFont('Arial','', 7); if (ORDER_COMMENTS_PACKING_SLIP > 0) { $pdf->Ln(); $pdf->SetFillColor(180, 180, 180); $pdf->SetFont('Arial', 'B', 10); $pdf->MultiCell(576, 14, 'Order Comments & Status', 'B'); $pdf->SetFont('Arial', '', 7); $pdf->SetFillColor(256, 256, 256); $orders_history = $db->Execute("select orders_status_id, date_added, customer_notified, comments\n from " . TABLE_ORDERS_STATUS_HISTORY . "\n where orders_id = '" . zen_db_input($order->info['id']) . "' and customer_notified >= 0\n order by date_added"); $count_comments = 0; if ($orders_history->RecordCount() >= 1 && ORDER_COMMENTS_PACKING_SLIP == 1) { while (!$orders_history->EOF) { if ($orders_history->fields['comments'] != '' && strpos($orders_history->fields['comments'], 'PayPal status:') === false) { $count_comments++; $pdf->Cell(120, 14, zen_datetime_short($orders_history->fields['date_added'])); $pdf->MultiCell(456, 14, $orders_status_array[$orders_history->fields['orders_status_id']]); $pdf->Cell(27, 14, '', 0, 0, '', 1); /* BEGIN modify (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ /* removed function zen_db_output, which was converting output into html code */ //$pdf->MultiCell(549, 14, (zen_db_output($orders_history->fields['comments'])), 'B'); $pdf->MultiCell(549, 14, $orders_history->fields['comments'], 'B'); /* END modify (Loose Chicken Software Development, david@loosechicken.com 01-07-2011) */ $pdf->SetLineWidth(0.5); $pdf->Line(18, $pdf->GetY(), 594, $pdf->GetY()); } $orders_history->MoveNext(); /*if (ORDER_COMMENTS_PACKING_SLIP == 1 && $count_comments >= 1) { break; } */ } } if ($count_comments == 0) { $pdf->MultiCell(576, 14, TEXT_NO_ORDER_HISTORY, 'B'); } } }
} ?> <td class="dataTableContent"><?php echo $rates->fields['tax_priority']; ?> </td> <td class="dataTableContent"><?php echo $rates->fields['tax_class_title']; ?> </td> <td class="dataTableContent"><?php echo $rates->fields['geo_zone_name']; ?> </td> <td class="dataTableContent"><?php echo zen_display_tax_value($rates->fields['tax_rate']); ?> %</td> <td class="dataTableContent" align="right"><?php if (isset($trInfo) && is_object($trInfo) && $rates->fields['tax_rates_id'] == $trInfo->tax_rates_id) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link_admin(FILENAME_TAX_RATES, 'page=' . $_GET['page'] . '&tID=' . $rates->fields['tax_rates_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td> </tr> <?php $rates->MoveNext(); } ?>
$OptionOption = str_replace("option value='" . $order->products[$i]['attributes'][$j]['options_values_id'] . "'", "option value='" . $order->products[$i]['attributes'][$j]['options_values_id'] . "' selected", $OptionOption); if (in_array($order->products[$i]['attributes'][$j]['options_id'], $OptionsThatAreText)) { $OptionOption = str_replace("<input type='text' size='15' name='" . $sendoptionon . "tv'>", "<input type='text' size='15' name='" . $sendoptionon . "tv' value='" . $order->products[$i]['attributes'][$j]['value'] . "'>", $OptionOption); } if ($_GET[advancedoptions] == 'yes') { echo '<br><nobr><small> <i> ' . TEXT_ATTRIBUTES_PRODUCT_OPTION . ' ' . "<input name='update_products[{$orders_products_id}][attributes][{$orders_products_attributes_id}][option]' size='25' value='" . $order->products[$i]['attributes'][$j]['option'] . "'>" . ': ' . "<input name='update_products[{$orders_products_id}][attributes][{$orders_products_attributes_id}][value]' size='20' value='" . $order->products[$i]['attributes'][$j]['value'] . "'>"; echo '</i></small></nobr>'; echo '<br><nobr><small> <i> ' . TEXT_ATTRIBUTES_OPTION_PRICE_CHANGE . ' ' . "<input name='update_products[{$orders_products_id}][attributes][{$orders_products_attributes_id}][prefix]' size='4' value='" . $order->products[$i]['attributes'][$j]['prefix'] . "'>" . ' ' . "<input name='update_products[{$orders_products_id}][attributes][{$orders_products_attributes_id}][price]' size='8' value='" . $order->products[$i]['attributes'][$j]['price'] . "'>"; echo '</i></small></nobr>'; } } if ($_GET[advancedoptions] != 'yes') { echo $OptionOption; } } echo ' </td>' . "\n" . ' <td class="' . $RowStyle . '" valign="top">' . "<input name='update_products[{$orders_products_id}][model]' size='55' value='" . $order->products[$i]['model'] . "'>" . '</td>' . "\n" . ' <td class="' . $RowStyle . '" align="right" valign="top">' . "<input class='amount' name='update_products[{$orders_products_id}][tax]' size='3' value='" . zen_display_tax_value($order->products[$i]['tax']) . "'>" . ' %</td>' . "\n" . ' <td class="' . $RowStyle . '" align="right" valign="top">' . "<input class='amount' name='update_products[{$orders_products_id}][final_price]' size='5' value='" . number_format($order->products[$i]['final_price'], 2, '.', '') . "'>" . '</td>' . "\n" . ' <td class="' . $RowStyle . '" align="right" valign="top">' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n" . ' </tr>' . "\n"; } ?> <!-- End Products Listings Block --> <!-- Begin Order Total Block --> <tr> <td align="right" colspan="6"> <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr> <td valign='top'> <br> <?php echo '<a href="' . zen_href_link(FILENAME_ORDER_EDIT, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oID . '&action=add_prdct', 'NONSSL') . '">' . zen_image_button('button_add_product.gif', TEXT_ADD_NEW_PRODUCT) . '</a>'; ?> </td>
{ $priceIncTax = $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']); } echo ' <tr class="dataTableRow">' . "\n"; echo ' <td class="dataTableContent" valign="middle" align="left">' . $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name']; if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) { for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) { echo '<br /><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])); if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')'; if ($order->products[$i]['attributes'][$j]['product_attribute_is_free'] == '1' and $order->products[$i]['product_is_free'] == '1') echo TEXT_INFO_ATTRIBUTE_FREE; echo '</i></small></nobr>'; } } echo ' </td>' . "\n" . ' <td class="dataTableContent" valign="middle">' . $order->products[$i]['model'] . '</td>' . "\n" . ' <td class="dataTableContent" align="right" valign="middle">' . zen_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" . ' <td class="dataTableContent" align="right" valign="middle"><strong>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . // (Formating modified for Super Orders) ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') . '</strong></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="middle"><strong>' . $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') . '</strong></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="middle"><strong>' . $currencies->format(zen_round($order->products[$i]['final_price'], $currencies->get_decimal_places($order->info['currency'])) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') . '</strong></td>' . "\n" . ' <td class="dataTableContent" align="right" valign="middle"><strong>' . $priceIncTax .
echo HEADING_PRODUCTS; ?> </strong></td> </tr> <?php } for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { echo ' <tr>' . "\n" . ' <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "\n" . ' <td class="main" valign="top">' . $order->products[$i]['name']; if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) { for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) { echo '<br /><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>'; } } echo ' </td>' . "\n"; if (sizeof($order->info['tax_groups']) > 1) { echo ' <td class="main" valign="top" align="right">' . zen_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n"; } echo ' <td class="main" align="right" valign="top">' . $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') . '</td>' . "\n" . ' </tr>' . "\n"; } ?> </table> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) { echo ' <tr>' . "\n" . ' <td class="' . str_replace('_', '-', $order->totals[$i]['class']) . '-Text" align="right" width="100%">' . $order->totals[$i]['title'] . '</td>' . "\n" . ' <td class="' . str_replace('_', '-', $order->totals[$i]['class']) . '-Amount" align="right" nowrap="nowrap">' . $order->totals[$i]['text'] . '</td>' . "\n" . ' </tr>' . "\n"; } ?> </table> </td> </tr> <tr>
function eo_get_product_taxes($product, $shown_price = -1, $add = true) { global $db, $currencies, $order; if (DISPLAY_PRICE_WITH_TAX == 'true') { $shown_price = (zen_round($product['final_price'], $currencies->get_decimal_places($_SESSION['currency'])) + zen_calculate_tax($product['final_price'], $product['tax'])) * $product['qty']; $shown_price += zen_round($product['onetime_charges'], $currencies->get_decimal_places($_SESSION['currency'])) + zen_calculate_tax($product['onetime_charges'], $product['tax']); } else { $shown_price = $product['final_price'] * $product['qty']; $shown_price += $product['onetime_charges']; } // Not standard Zen Cart - but clears up some math issues later $shown_price = zen_round($shown_price, $currencies->get_decimal_places($_SESSION['currency'])); if (array_key_exists('tax_description', $product)) { $products_tax_description = $product['tax_description']; } else { $query = $db->Execute('SELECT `products_tax_class_id` ' . 'FROM `' . TABLE_PRODUCTS . '` WHERE `products_id`=\'' . (int) $product['id'] . '\' '); if (!$query->EOF) { $products_tax_description = zen_get_tax_description($query->fields['products_tax_class_id']); } else { if (array_key_exists('tax', $product)) { $products_tax_description = TEXT_UNKNOWN_TAX_RATE . ' (' . zen_display_tax_value($product['tax']) . '%)'; } } } $totalTaxAdd = 0; if (zen_not_null($products_tax_description)) { $taxAdd = 0; // Done this way to ensure we calculate if (DISPLAY_PRICE_WITH_TAX == 'true') { $taxAdd = $shown_price - $shown_price / ($product['tax'] < 10 ? "1.0" . str_replace('.', '', $product['tax']) : "1." . str_replace('.', '', $product['tax'])); } else { $taxAdd = zen_calculate_tax($shown_price, $product['tax']); } if (isset($order->info['tax_groups'][$products_tax_description])) { if ($add) { $order->info['tax_groups'][$products_tax_description] += $taxAdd; } else { $order->info['tax_groups'][$products_tax_description] -= $taxAdd; } } else { if ($add) { $order->info['tax_groups'][$products_tax_description] = $taxAdd; } } $totalTaxAdd += $taxAdd; unset($taxAdd); } return $totalTaxAdd; }
echo ' <td class="dataTableContent smalltext" valign="top" align="center">' . zen_draw_checkbox_field('split_products[' . $i . ']', $orders_products_id) . NL; } echo ' <td class="dataTableContent smalltext" valign="top" align="left">' . $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name']; if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) { for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) { echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value']; if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')'; if ($order->products[$i]['attributes'][$j]['product_attribute_is_free'] == '1' and $order->products[$i]['product_is_free'] == '1') echo TEXT_INFO_ATTRIBUTE_FREE; echo '</i></small></nobr>'; } } echo ' </td>' . NL . ' <td class="dataTableContent smalltext" valign="top">' . $order->products[$i]['model'] . '</td>' . NL . ' <td class="dataTableContent smalltext" align="right" valign="top">' . zen_display_tax_value($order->products[$i]['tax']) . '%</td>' . NL . ' <td class="dataTableContent smalltext" align="right" valign="top">' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br>' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') . '</td>' . NL . ' <td class="dataTableContent smalltext" align="right" valign="top">' . $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br>' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') . '</td>' . NL . ' <td class="dataTableContent smalltext" align="right" valign="top">' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br>' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') . '</td>' . NL . ' <td class="dataTableContent smalltext" align="right" valign="top">' . $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ($order->products[$i]['onetime_charges'] != 0 ? '<br>' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') .