<?php
/*
  www.oscGold.com (C) Kamelia-Net Jacek Krysiak
  modul oscGold wer 4.0
*/
?>

<?php
if (DISPLAY_PRICE_BRUTTO_NETTO == 'true') {
	$display_nb = 1;
  } else {
	$display_nb = 0;
}
?>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

  <!-- Naglowek BOF -->
  <tr>
    <td>
      <?php
      $info_box_contents = array();
      $info_box_contents[] = array('text' => sprintf(HEADING_TITLE));
      new contentBoxHeading($info_box_contents);
      ?>
    </td>
  </tr>
  <tr>
    <td class="main" align="center" style="padding:10px;padding-left:20px;padding-right:20px"><b><?php echo CONFIRM_INFORMATION; ?></b></td>
  </tr>
  <!-- Naglowek EOF -->

  <tr>
    <td class="main">
      <fieldset>
      <legend><?php echo HEADING_SHIPPING_INFORMATION; ?></legend>
        <table border="0" width="100%" cellspacing="1" cellpadding="3">
          <?php
          if ($sendto != false) {
            ?>
            <tr>
              <td valign="top" width="30%" class="ProductHead"><?php echo '<b>' . HEADING_DELIVERY_ADDRESS . '</b>' . (((!tep_session_is_registered('customer_is_guest')) || (defined('PURCHASE_WITHOUT_ACCOUNT_SEPARATE_SHIPPING') && PURCHASE_WITHOUT_ACCOUNT_SEPARATE_SHIPPING=='true') )? ' <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>':''); ?></td>
              <td class="ProductHead" valign="top" width="70%"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></td>
            </tr>
            <?php
          }
          ?>

          <tr>
            <td valign="top" width="30%" class="ProductHead"><?php echo '<b>' . HEADING_BILLING_ADDRESS . '</b> <a href="' . ((tep_session_is_registered('customer_is_guest')) ? tep_href_link(FILENAME_CREATE_ACCOUNT, 'guest=guest', 'SSL') : tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL')) . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
            <td class="ProductHead" valign="top" width="70%"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br>'); ?></td>
          </tr>

          <?php
          if ($order->info['shipping_method']) {
            ?>
            <tr>
              <td valign="top" width="30%" class="ProductHead"><?php echo '<b>' . HEADING_SHIPPING_METHOD . '</b> <a href="' . tep_href_link(FILENAME_CHECKOUT, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
              <td class="ProductHead" valign="top" width="70%"><?php echo $order->info['shipping_method']; ?></td>
            </tr>
            <?php
          }
          ?>

          <tr>
            <td valign="top" width="30%" class="ProductHead"><?php echo '<b>' . HEADING_PAYMENT_METHOD . '</b> <a href="' . tep_href_link(FILENAME_CHECKOUT, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
            <td class="ProductHead" valign="top" width="70%"><?php echo $order->info['payment_method']; ?></td>
          </tr>

          <?php
          if ($order->info['giftwrap_method']) {
            ?>
            <tr>
              <td class="ProductHead" valign="top" width="30%"><b><?php echo HEADING_GIFTWRAP_METHOD; ?></b></td>
              <td class="ProductHead" valign="top" width="70%"><?php echo $order->info['giftwrap_method']; ?></td>
            </tr>
            <?php
          }
          ?>
        </table>
      </fieldset>
    </td>
  </tr>

  <tr>
    <td class="main">
      <fieldset>
      <legend><?php echo HEADING_PRODUCTS_INFORMATION; ?></legend>
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td width="<?php echo (($sendto != false) ? '70%' : '100%'); ?>" valign="top">
                <table border="0" width="100%" cellspacing="1" cellpadding="2">
                  <tr>
                     <td class="main" colspan="3"><?php echo '<b>' . HEADING_PRODUCTS . '</b> <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
                  </tr>
                  <tr>
                    <td class="ProductHead" align="center"><b><?php echo HEADING_PRODUCT; ?></b></td>
                    <td class="ProductHead" align="center"><b><?php echo HEADING_QTY; ?></b></td>
                      <?php
                      if (sizeof($order->info['tax_groups']) > 1) { ?>
                        <td class="ProductHead" align="center"><b><?php echo HEADING_TAX; ?></b></td>
                        <?php
                      }
                      ?>
                    <td class="ProductHead" align="right" nowrap><b><?php echo HEADING_WARTOSC; ?></b></td>
                    <?php
                    for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
                      echo '          <tr>' . "\n" .
                           '           <td class="main" valign="top" width="70%">' . $order->products[$i]['name'] . "\n";
                      if (STOCK_CHECK == 'true') {
                        //++++ QT Pro: Begin Changed code
                        echo $check_stock[$i];
                        //++++ QT Pro: End Changed Code
                      }

                      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>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';
                        }
                      }

                      // denuz text attr  /////////////////////////////////// DODATKOWE POLA - CECHY TEKSTOWE
                      //sprawdza czy klient jest zalogowany, jezeli tak to wpisuje w sesje nr id klienta, jezeli nie to id sesji
                      if (!tep_session_is_registered('customer_id')) {
                        $sesja = tep_session_id();
                      } else {
                        $sesja = (int)$customer_id;
                      }
                      $pid = $order->products[$i]['id'];
                      $attr_q = tep_db_query("select cbta.*, pta.products_text_attributes_name from customers_basket_text_attributes as cbta, products_text_attributes as pta where cbta.products_text_attributes_id = pta.products_text_attributes_id and cbta.products_id = '" . $pid . "' and cbta.session_id = '" .$sesja. "'");
                      while ($attr = tep_db_fetch_array($attr_q)) {
                        $products_name = '<br><small>&nbsp;<i> - ' . $attr['products_text_attributes_name'] . ' ' . stripslashes($attr['products_text_attributes_text'])  . '</i></small>';
                        echo $products_name;
                      }
                      // eof denuz text attr /////////////////////////////////// DODATKOWE POLA - CECHY TEKSTOWE

                      echo '           </td>' . "\n";
                      echo '           <td class="main" align="center" valign="top" width="5%">' . $order->products[$i]['qty'] . '</td>';

                      if (sizeof($order->info['tax_groups']) > 1) {
                        echo '          <td class="main" valign="top" align="center" width="25%">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n";
                      }

                      //TotalB2B start
                      echo '           <td class="main" align="right" valign="top" width="25%"><nobr>' . $currencies->display_price_nodiscount($order->products[$i]['id'], $order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty'],$display_nb, false) . '<nobr></td>' . "\n" .'          </tr>' . "\n";
                      //TotalB2B end
                    }
                    ?>
                </table>
            </td>
          </tr>
          <tr class="infoBoxContents">
            <td width="100%" valign="top" align="right">
              <table border="0" cellspacing="0" cellpadding="2">
                <?php
                if (MODULE_ORDER_TOTAL_INSTALLED) {
                  echo $order_total_modules->output();
                }
                ?>
              </table>
            </td>
          </tr>
        </table>
      </fieldset>
    </td>
  </tr>

  <?php
  if (is_array($payment_modules->modules)) {
    if ($confirmation = $payment_modules->confirmation()) {
      $payment_info = $confirmation['title'];
      if (!tep_session_is_registered('payment_info')) tep_session_register('payment_info');
        ?>
        <tr>
          <td class="main">
            <fieldset>
            <legend><?php echo HEADING_PAYMENT_INFORMATION; ?></legend>
              <table border="0" width="100%" cellspacing="0" cellpadding="0">
                <tr>
                  <td class="main" colspan="4"><?php echo $confirmation['title']; ?></td>
                </tr>
                <?php
                for ($i=0, $n=sizeof($confirmation['fields']); $i<$n; $i++) {
                  ?>
                  <tr>
                     <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                     <td class="main"><?php echo $confirmation['fields'][$i]['title']; ?></td>
                     <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                     <td class="main"><?php echo $confirmation['fields'][$i]['field']; ?></td>
                  </tr>
                  <?php
                }
                ?>
              </table>
            </fieldset>
          </td>
        </tr>
        <?php
      }
  }

  if (tep_not_null($order->info['comments'])) {
    ?>
    <tr>
      <td>
        <fieldset>
        <legend><?php echo '<b>' . HEADING_ORDER_COMMENTS . '</b> <a href="' . tep_href_link(FILENAME_CHECKOUT, '', 'SSL') . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></legend>
          <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <td class="main"><?php echo nl2br(tep_output_string_protected($order->info['comments'])) . tep_draw_hidden_field('comments', $order->info['comments']); ?></td>
            </tr>
          </table>
        </fieldset>
      </td>
    </tr>
    <?php
  }

  if ((TEXT_PARAGON != '') && (TEXT_FAKTURA != '')) {
    ?>
    <tr>
      <td>
        <fieldset>
        <legend><?php echo TABLE_HEADING_DOKUMENT_SPRZEDAZY; ?></legend>
          <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <td class="main">
                <?php
                if ($HTTP_POST_VARS['paragon'] == "paragon") {
                  echo TEXT_PARAGON;
                  $rty = '(' . TABLE_HEADING_DOKUMENT_SPRZEDAZY . ': ' . TEXT_PARAGON . ')    ';
                  } else {
                  echo TEXT_FAKTURA;
                  $rty = '(' . TABLE_HEADING_DOKUMENT_SPRZEDAZY . ': ' . TEXT_FAKTURA . ')    ';
                }
                ?>
              </td>
            </tr>
          </table>
        </fieldset>
      </td>
    </tr>
    <?php
  }
  ?>

  <?php
  if ($module_darmo == true) {
    if (strlen($giftx) > 0) {
      ?>
      <tr><td>
        <fieldset>
        <legend><?php echo TEXT_GRATIS_HEADING; ?></legend>
           <table border="0" width="100%" cellspacing="0" cellpadding="2">
            <tr>
              <td class="main">
                <?php
                echo TEXT_GRATIS_CONFIRM;
                echo '<b>' . $giftx . '</b>';
                ?>
              </td>
             </tr>
           </table>
        </fieldset>
      </td></tr>
      <?php
    }
  }
  ?>

  <tr>
    <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>
  </tr>

  <!-- Przyciski BOF -->
    <?php
    if (strstr(MODULE_PAYMENT_INSTALLED, "raty_zagiel.php") !== false && $_POST['payment'] == 'raty_zagiel') {
      ?>
      <tr>
        <td>
          <fieldset>
            <table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td align="left" class="main" colspan="4">
                  <?php
                  if (isset($$payment->form_action_url)) {
                    $form_action_url = $$payment->form_action_url;
                  } else {
                    $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
                  }

                  # START INTEGRACJA RATY ZAGIEL eKREDYT
                  if ($_POST['payment']=='mtransfer') echo tep_draw_form('checkout_confirmation', $form_action_url, 'get');
                  elseif ($_POST['payment'] == 'raty_zagiel') echo tep_draw_form('checkout_confirmation', $form_action_url, 'post', ZAGIEL_RATY_ONSUBMIT);
                  else echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');
                  #############################################################################

                  echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');

                  if (is_array($payment_modules->modules)) {
                    echo $payment_modules->process_button();
                  }
                  echo '<input type="hidden" name="dok_zakup" value="' . $rty . '">';
                  ?>
                </td>
              </tr>
            </table>
          </fieldset>
        </td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '3'); ?></td>
      </tr>
      <tr>
        <td>
          <fieldset>
            <table border="0" width="100%" cellspacing="0" cellpadding="0">
              <?php
              if (CUSTOMER_PROFORMA == 'true') {
                ?>
                <tr>
                  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', ''); ?></td>
                  <td align="left" class="main"><?php echo tep_draw_checkbox_field('proforma', '1') . POLISH_INVOICE_PDF_PROFORMA_CONFIRMATION; ?></td>
                  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                </tr>
                <tr><td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td></tr>
                <?php
              } else {
                ?>
                <tr><td><input type="hidden" name="proforma" value="0"></td></tr>
                <?php
              }
              ?>
              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', ''); ?></td>
                <td align="left" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT) . '">' . tep_image_button('button_back.gif', 'back') . '</a>'; ?> </td>
                <td align="right" class="main">
                  <?php
                  echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n";
                  ?>
                </td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table>
          </fieldset>
        </td>
      </tr>
      <?php
    } else {
      ?>
      <tr>
        <td>
          <fieldset>
            <table border="0" width="100%" cellspacing="0" cellpadding="0">
               <?php
               if (isset($$payment->form_action_url)) {
                 $form_action_url = $$payment->form_action_url;
               } else {
                 $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
               }
               echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');
              ?>
              <?php
              if (CUSTOMER_PROFORMA == 'true' && $currency == 'PLN' && $language == 'polish') {
                ?>
                <tr>
                  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', ''); ?></td>
                  <td align="left" class="main"><?php echo tep_draw_checkbox_field('proforma', '1') . POLISH_INVOICE_PDF_PROFORMA_CONFIRMATION; ?></td>
                  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                </tr>
                <tr><td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td></tr>
                <?php
              } else {
                ?>
                <tr><td><input type="hidden" name="proforma" value="0"></td></tr>
                <?php
              }
              ?>

              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', ''); ?></td>
                <td align="left" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT) . '">' . tep_image_button('button_back.gif', 'back') . '</a>'; ?> </td>
                <td align="right" class="main">
                  <?php
                  if (is_array($payment_modules->modules)) {
                    echo $payment_modules->process_button();
                  }
                  echo '<input type="hidden" name="dok_zakup" value="' . $rty . '">';
                  echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n";
                  ?>
                </td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table>
          </fieldset>
        </td>
      </tr>
      <?php
    }
    ?>
    <!-- Przyciski EOF -->

 <tr>
  <td style="padding-top:10px">
   <table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr>
     <td width="33%">
	  <table border="0" width="100%" cellspacing="0" cellpadding="0">
       <tr>
        <td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
        <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
       </tr>
      </table>
	 </td>
     <td width="33%">
	  <table border="0" width="100%" cellspacing="0" cellpadding="0">
       <tr>
	    <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
        <td align="right"><?php echo tep_image(DIR_WS_TEMPLATES . 'images/misc/checkout_bullet.gif'); ?></td>
        <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
       </tr>
      </table>
	 </td>
     <td width="33%">
	  <table border="0" width="100%" cellspacing="0" cellpadding="0">
       <tr>
        <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
        <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
       </tr>
      </table>
     </td>
    </tr>
    <tr>
     <td align="center" width="33%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_SHIPPEY . '</a>'; ?></td>
     <td align="center" width="33%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
     <td align="center" width="33%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
    </tr>
   </table>
  </td>
 </tr>

</table>