function wpsc_display_sales_log_index()
{
    global $purchlogs;
    ?>
	<div class="wrap">
		<?php 
    //screen_icon();
    ?>
		<h2><?php 
    echo wp_specialchars(TXT_WPSC_PURCHASELOG);
    ?>
 </h2>
		<?php 
    //START OF PURCHASE LOG DEFAULT VIEW
    ?>
		<?php 
    if (isset($_GET['view_purchlogs_by']) || isset($_GET['view_purchlogs_by_status'])) {
        wpsc_change_purchlog_view($_GET['view_purchlogs_by'], $_GET['view_purchlogs_by_status']);
    }
    if (!isset($_REQUEST['purchaselog_id'])) {
        $columns = array('cb' => '<input type="checkbox" />', 'date' => 'Date', 'name' => '', 'amount' => 'Amount', 'details' => 'Details', 'status' => 'Status', 'delete' => 'Delete', 'track' => 'Track');
        register_column_headers('display-sales-list', $columns);
        ///// start of update message section //////
        //$fixpage = get_option('siteurl').'/wp-admin/admin.php?page='.WPSC_FOLDER.'/wpsc-admin/purchlogs_upgrade.php';
        $fixpage = get_option('siteurl') . '/wp-admin/admin.php?page=wpsc-sales-logs&amp;subpage=upgrade-purchase-logs';
        if (isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) || isset($_GET['locked'])) {
            ?>
			<div id="message" class="updated fade"><p>
			<?php 
            if (isset($_GET['updated']) && (int) $_GET['updated']) {
                printf(__ngettext('%s Purchase Log updated.', '%s Purchase Logs updated.', $_GET['updated']), number_format_i18n($_GET['updated']));
                unset($_GET['updated']);
            }
            if (isset($_GET['skipped']) && (int) $_GET['skipped']) {
                unset($_GET['skipped']);
            }
            if (isset($_GET['locked']) && (int) $_GET['locked']) {
                printf(__ngettext('%s product not updated, somebody is editing it.', '%s products not updated, somebody is editing them.', $_GET['locked']), number_format_i18n($_GET['locked']));
                unset($_GET['locked']);
            }
            if (isset($_GET['deleted']) && (int) $_GET['deleted']) {
                printf(__ngettext('%s Purchase Log deleted.', '%s Purchase Logs deleted.', $_GET['deleted']), number_format_i18n($_GET['deleted']));
                unset($_GET['deleted']);
            }
            //$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted','wpsc_downloadcsv','rss_key','start_timestamp','end_timestamp','email_buyer_id'), $_SERVER['REQUEST_URI'] );
            ?>
			</p></div>
		<?php 
        }
        if (get_option('wpsc_purchaselogs_fixed') == false || wpsc_check_uniquenames()) {
            ?>
				<div class='error' style='padding:8px;line-spacing:8px;'><span ><?php 
            _e('When upgrading the Wp-E-Commerce Plugin from 3.6.* to 3.7 it is required that you associate your checkout form fields with the new Purchase Logs system. To do so please ');
            ?>
 <a href='<?php 
            echo $fixpage;
            ?>
'>Click Here</a></span></div>
	<?php 
        }
        ///// end of update message section //////
        ?>
		<div id='dashboard-widgets' style='min-width: 825px;'>
			<!--
 <div class='inner-sidebar'> 
					<div class='meta-box-sortables'>			
						<?php 
        //if(IS_WP27){
        //	display_ecomm_rss_feed();
        //}
        ?>
					</div>
			</div>
-->
			<?php 
        /* end of sidebar start of main column */
        ?>
			<div id='post-body' class='has-sidebar metabox-holder' style='width:95%;'>
				<div id='dashboard-widgets-main-content-wpsc' class='has-sidebar-content'>
			
				<?php 
        if (function_exists('wpsc_right_now')) {
            echo wpsc_right_now();
        }
        ?>
 
			   	</div><br />
			   	<div id='wpsc_purchlog_searchbox'>
			   		<?php 
        wpsc_purchaselogs_searchbox();
        ?>
			   	</div><br />
			   		<?php 
        wpsc_purchaselogs_displaylist();
        ?>
 				
				
			</div>
		</div>
		<?php 
    } else {
        //NOT IN GENERIC PURCHASE LOG PAGE, IN DETAILS PAGE PER PURCHASE LOG
        if (isset($_GET['cleared']) || isset($_GET['cleared'])) {
            ?>
			<div id="message" class="updated fade"><p>
			<?php 
            if (isset($_GET['cleared']) && $_GET['cleared'] == true) {
                printf(__ngettext('Downloads for this log have been released.', 'Downloads for this log have been released.', $_GET['cleared']), $_GET['cleared']);
                unset($_GET['cleared']);
            }
            if (isset($_GET['sent']) && (int) $_GET['sent']) {
                printf(__ngettext('Receipt has been resent ', 'Receipt has been resent ', $_GET['sent']), $_GET['sent']);
                unset($_GET['sent']);
            }
            ?>
 </p></div>
			<?php 
        }
        //$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted','cleared'), $_SERVER['REQUEST_URI'] );
        ?>

			
			<?php 
        $page_back = remove_query_arg(array('locked', 'skipped', 'updated', 'deleted', 'purchaselog_id'), $_SERVER['REQUEST_URI']);
        $columns = array('title' => 'Name', 'sku' => 'SKU', 'quantity' => 'Quantity', 'price' => 'Price', 'tax' => 'Tax', 'total' => 'Total');
        register_column_headers('display-purchaselog-details', $columns);
        ?>
			<div id='post-body' class='has-sidebar' style='width:95%;'>
				<?php 
        if (wpsc_has_purchlog_shipping()) {
            ?>
				<div id='wpsc_shipping_details_box'>	
					<h3><?php 
            _e('Shipping Details');
            ?>
</h3>
					<p><strong><?php 
            echo wpsc_display_purchlog_shipping_name();
            ?>
</strong></p>
					<p>
					<?php 
            echo wpsc_display_purchlog_shipping_address();
            ?>
<br />
					<?php 
            echo wpsc_display_purchlog_shipping_city();
            ?>
<br />
					<?php 
            echo wpsc_display_purchlog_shipping_state_and_postcode();
            ?>
<br />
					<?php 
            echo wpsc_display_purchlog_shipping_country();
            ?>
<br />
					</p>
					<strong><?php 
            _e('Shipping Options');
            ?>
</strong>
					<p>
					
					<?php 
            _e('Shipping Method:');
            ?>
 <?php 
            echo wpsc_display_purchlog_shipping_method();
            ?>
<br />
					<?php 
            _e('Shipping Option:');
            ?>
 <?php 
            echo wpsc_display_purchlog_shipping_option();
            ?>
<br />
					<?php 
            if (wpsc_purchlogs_has_tracking()) {
                ?>
						<?php 
                _e('Tracking ID:');
                ?>
 <?php 
                echo wpsc_purchlogitem_trackid();
                ?>
<br />
						<?php 
                _e('Shipping Status:');
                ?>
 <?php 
                echo wpsc_purchlogitem_trackstatus();
                ?>
<br />
						<?php 
                _e('Track History:');
                ?>
 <?php 
                echo wpsc_purchlogitem_trackhistory();
                ?>
					<?php 
            }
            ?>
					</p>
				</div>
				<?php 
        }
        ?>
				<div id='wpsc_billing_details_box'>
					<h3><?php 
        _e('Billing Details');
        ?>
</h3>
					<p><strong><?php 
        _e('Purchase Log Date:');
        ?>
 </strong><?php 
        echo wpsc_purchaselog_details_date();
        ?>
 </p>
					<p><strong><?php 
        _e('Purchase Number:');
        ?>
 </strong><?php 
        echo wpsc_purchaselog_details_purchnumber();
        ?>
 </p>
					<p><strong><?php 
        _e('Buyers Name:');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_buyers_name();
        ?>
</p>
					<p><strong><?php 
        _e('Address:');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_buyers_address();
        ?>
</p>

					<p><strong><?php 
        _e('Phone:');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_buyers_phone();
        ?>
</p>
					<p><strong><?php 
        _e('Email:');
        ?>
 </strong><a href="mailto:<?php 
        echo wpsc_display_purchlog_buyers_email();
        ?>
?subject=Message From '<?php 
        echo get_option('siteurl');
        ?>
'"><?php 
        echo wpsc_display_purchlog_buyers_email();
        ?>
</a></p>
					<p><strong><?php 
        _e('Payment Method:');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_paymentmethod();
        ?>
</p>
					<?php 
        if (wpsc_display_purchlog_display_howtheyfoundus()) {
            ?>
					<p><strong><?php 
            _e('How User Found Us:');
            ?>
 </strong><?php 
            echo wpsc_display_purchlog_howtheyfoundus();
            ?>
</p>
					<?php 
        }
        ?>
				</div>
			
				<div id='wpsc_items_ordered'>
					<br />
					<h3><?php 
        _e('Items Ordered');
        ?>
</h3>
					<table class="widefat" cellspacing="0">
						<thead>
							<tr>
						<?php 
        print_column_headers('display-purchaselog-details');
        ?>
							</tr>
						</thead>
					
						<tfoot>
							<tr>
						<?php 
        php;
        ?>
							</tr>
						</tfoot>
					
						<tbody>
						<?php 
        wpsc_display_purchlog_details();
        ?>
						<tr> &nbsp;</tr>

						<tr>
							<td colspan="4">
								<?php 
        if (wpsc_purchlog_has_discount_data()) {
            ?>
								<?php 
            _e('Coupon Code');
            ?>
: <?php 
            echo wpsc_display_purchlog_discount_data();
            ?>
								<?php 
        }
        ?>
							</td>
							<th><?php 
        _e('Discount');
        ?>
 </th>
							<td><?php 
        echo wpsc_display_purchlog_discount();
        ?>
</td>
						</tr>
						
						<tr>
							<td colspan='4'></td>
							<th><?php 
        _e('Shipping');
        ?>
 </th>
							<td><?php 
        echo wpsc_display_purchlog_shipping();
        ?>
</td>
						</tr>
						<tr>
							<td colspan='4'></td>
							<th><?php 
        _e('Total');
        ?>
 </th>
							<td><?php 
        echo wpsc_display_purchlog_totalprice();
        ?>
</td>
						</tr>
						</tbody>
				</table>
				<div id='wpsc_purchlog_order_status'>
					<form action='' method='post'>
					<p><label for='<?php 
        echo $_GET['purchaselog_id'];
        ?>
'><?php 
        _e('Order Status:');
        ?>
</label><select class='selector' name='<?php 
        echo $_GET['purchaselog_id'];
        ?>
' title='<?php 
        echo $_GET['purchaselog_id'];
        ?>
' >
	 			<?php 
        while (wpsc_have_purch_items_statuses()) {
            wpsc_the_purch_status();
            ?>
	 				<option value='<?php 
            echo wpsc_the_purch_status_id();
            ?>
' <?php 
            echo wpsc_purchlog_is_checked_status();
            ?>
 ><?php 
            echo wpsc_the_purch_status_name();
            ?>
 </option>
	 			<?php 
        }
        ?>
		 			</select></p>
		 			</form>
 			</div>
 				<?php 
        wpsc_purchlogs_custom_fields();
        ?>
 				
 				
 				<!-- Start Order Notes (by Ben) -->
 				<?php 
        wpsc_purchlogs_notes();
        ?>
				<!-- End Order Notes (by Ben) -->
				
				<?php 
        wpsc_custom_checkout_fields();
        ?>
 				
				</div>
				</div>
				
				<div id='wpsc_purchlogitems_links'>
				<h3><?php 
        _e('Actions');
        ?>
</h3>
				<?php 
        if (wpsc_purchlogs_have_downloads_locked() != false) {
            ?>
<img src='<?php 
            echo WPSC_URL;
            ?>
/images/lock_open.png' alt='clear lock icon' />&ensp;<a href='<?php 
            echo $_SERVER['REQUEST_URI'] . '&amp;wpsc_admin_action=clear_locks';
            ?>
'><?php 
            echo wpsc_purchlogs_have_downloads_locked();
            ?>
</a><br /><br class='small' />
				<?php 
        }
        ?>
<img src='<?php 
        echo WPSC_URL;
        ?>
/images/printer.png' alt='printer icon' />&ensp;<a href='<?php 
        echo add_query_arg('wpsc_admin_action', 'wpsc_display_invoice');
        ?>
'><?php 
        echo TXT_WPSC_VIEW_PACKING_SLIP;
        ?>
</a>
		
<br /><br class='small' /><img src='<?php 
        echo WPSC_URL;
        ?>
/images/email_go.png' alt='email icon' />&ensp;<a href='<?php 
        echo add_query_arg('email_buyer_id', $_GET['purchaselog_id']);
        ?>
'><?php 
        echo TXT_WPSC_EMAIL_BUYER;
        ?>
</a>
		  
<br /><br class='small' /><a class='submitdelete' title='<?php 
        echo attribute_escape(__('Delete this log'));
        ?>
' href='<?php 
        echo wp_nonce_url("page.php?wpsc_admin_action=delete_purchlog&amp;purchlog_id=" . $_GET['purchaselog_id'], 'delete_purchlog_' . $_GET['purchaselog_id']);
        ?>
' onclick="if ( confirm(' <?php 
        echo js_escape(sprintf(__("You are about to delete this log '%s'\n 'Cancel' to stop, 'OK' to delete."), wpsc_purchaselog_details_date()));
        ?>
') ) { return true;}return false;"><img src='<?php 
        echo WPSC_URL . "/images/cross.png";
        ?>
' alt='delete icon' />               &nbsp;<?php 
        echo TXT_WPSC_REMOVE_LOG;
        ?>
</a>

<br /><br class='small' />&emsp;&ensp; 	<a href='<?php 
        echo $page_back;
        ?>
'><?php 
        echo TXT_WPSC_GOBACK;
        ?>
</a>
<br /><br />
			</div>
			</div>
			<br />
			<?php 
    }
    ?>
	</div>
	<?php 
}
function wpsc_display_sales_log_index()
{
    global $purchlogitem;
    ?>
   <div class="wrap">
      <h2><?php 
    echo esc_html(__('Sales', 'wpsc'));
    ?>
 </h2>
      <?php 
    //START OF PURCHASE LOG DEFAULT VIEW
    ?>
      <?php 
    if (isset($_GET['view_purchlogs_by']) || isset($_GET['view_purchlogs_by_status'])) {
        wpsc_change_purchlog_view($_GET['view_purchlogs_by'], $_GET['view_purchlogs_by_status']);
    }
    if (isset($_POST['purchlogs_searchbox'])) {
        wpsc_search_purchlog_view($_POST['purchlogs_searchbox']);
    }
    if (!isset($_REQUEST['purchaselog_id'])) {
        $columns = array('cb' => '<input type="checkbox" />', 'purchid' => __('Order ID', 'wpsc'), 'date' => __('Date / Time', 'wpsc'), 'name' => '', 'amount' => __('Amount', 'wpsc'), 'details' => __('Details', 'wpsc'), 'status' => __('Status', 'wpsc'), 'delete' => __('Delete', 'wpsc'), 'track' => __('Tracking ID', 'wpsc'));
        register_column_headers('display-sales-list', $columns);
        ///// start of update message section //////
        $fixpage = get_option('siteurl') . '/wp-admin/admin.php?page=wpsc-sales-logs&amp;subpage=upgrade-purchase-logs';
        if (isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) || isset($_GET['locked'])) {
            ?>
         <div id="message" class="updated fade"><p>
         <?php 
            if (isset($_GET['updated']) && (int) $_GET['updated']) {
                printf(_n('%s Purchase Log updated.', '%s Purchase Logs updated.', $_GET['updated'], 'wpsc'), absint($_GET['updated']));
                unset($_GET['updated']);
            }
            if (isset($_GET['skipped']) && (int) $_GET['skipped']) {
                unset($_GET['skipped']);
            }
            if (isset($_GET['locked']) && (int) $_GET['locked']) {
                printf(_n('%s product not updated, somebody is editing it.', '%s products not updated, somebody is editing them.', $_GET['locked'], 'wpsc'), absint($_GET['locked']));
                unset($_GET['locked']);
            }
            if (isset($_GET['deleted']) && (int) $_GET['deleted']) {
                printf(_n('%s Purchase Log deleted.', '%s Purchase Logs deleted.', $_GET['deleted'], 'wpsc'), absint($_GET['deleted']));
                unset($_GET['deleted']);
            }
            ?>
         </p></div>
      <?php 
        }
        if (get_option('wpsc_purchaselogs_fixed') == false || wpsc_check_uniquenames()) {
            ?>
            <div class='error' style='padding:8px;line-spacing:8px;'><span ><?php 
            printf(__('When upgrading the WP e-Commerce Plugin from 3.6.* to 3.7 it is required that you associate your checkout form fields with the new Purchase Logs system. To do so please <a href="%s">Click Here</a>', 'wpsc'), $fixpage);
            ?>
</span></div>
   <?php 
        }
        ///// end of update message section //////
        ?>
      <div id='dashboard-widgets' style='min-width: 825px;'>
         <?php 
        /* end of sidebar start of main column */
        ?>
         <div id='post-body' class='has-sidebar metabox-holder' style='width:95%;'>
            <div id='dashboard-widgets-main-content-wpsc' class='has-sidebar-content'>

            <?php 
        wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
        do_meta_boxes('dashboard_page_wpsc-sales-logs', 'top', true);
        ?>
               </div><br />
               <div id='wpsc_purchlog_searchbox'>
                  <?php 
        wpsc_purchaselogs_searchbox();
        ?>
               </div><br />
                  <?php 
        wpsc_purchaselogs_displaylist();
        ?>

         </div>
         <script type="text/javascript">
         	jQuery(document).ready(function(){postboxes.add_postbox_toggles(pagenow);});
         </script>
      </div>
      <?php 
    } else {
        //NOT IN GENERIC PURCHASE LOG PAGE, IN DETAILS PAGE PER PURCHASE LOG
        if (isset($_REQUEST['purchaselog_id'])) {
            $purchlogitem = new wpsc_purchaselogs_items((int) $_REQUEST['purchaselog_id']);
        }
        if (isset($_GET['cleared']) || isset($_GET['cleared'])) {
            ?>
         <div id="message" class="updated fade"><p>
         <?php 
            if (isset($_GET['cleared']) && $_GET['cleared'] == true) {
                _e('Downloads for this log have been released.', 'wpsc');
                unset($_GET['cleared']);
            }
            if (isset($_GET['sent']) && (int) $_GET['sent']) {
                _e('Receipt has been resent ', 'wpsc');
                unset($_GET['sent']);
            }
            ?>
 </p></div>
         <?php 
        }
        ?>


         <?php 
        $page_back = remove_query_arg(array('locked', 'skipped', 'updated', 'deleted', 'purchaselog_id'), $_SERVER['REQUEST_URI']);
        $columns = array('title' => __('Name', 'wpsc'), 'sku' => __('SKU', 'wpsc'), 'quantity' => __('Quantity', 'wpsc'), 'price' => __('Price', 'wpsc'), 'shipping' => __('Shipping', 'wpsc'), 'tax' => '', 'total' => __('Total', 'wpsc'));
        if (wpec_display_product_tax()) {
            $columns['tax'] = __('Tax Included', 'wpsc');
        }
        // if
        register_column_headers('display-purchaselog-details', $columns);
        ?>
         <div id='post-body' class='has-sidebar' style='width:95%;'>
            <?php 
        if (wpsc_has_purchlog_shipping()) {
            ?>
            <div id='wpsc_shipping_details_box'>
               <h3><?php 
            _e('Shipping Address', 'wpsc');
            ?>
</h3>
               <p><strong><?php 
            echo wpsc_display_purchlog_shipping_name();
            ?>
</strong></p>
               <p>
               <?php 
            echo wpsc_display_purchlog_shipping_address();
            ?>
<br />
               <?php 
            echo wpsc_display_purchlog_shipping_city();
            ?>
<br />
               <?php 
            echo wpsc_display_purchlog_shipping_state_and_postcode();
            ?>
<br />
               <?php 
            echo wpsc_display_purchlog_shipping_country();
            ?>
<br />
               </p>
               <strong><?php 
            _e('Shipping Options', 'wpsc');
            ?>
</strong>
               <p>

               <?php 
            _e('Shipping Method:', 'wpsc');
            ?>
 <?php 
            echo wpsc_display_purchlog_shipping_method();
            ?>
<br />
               <?php 
            _e('Shipping Option:', 'wpsc');
            ?>
 <?php 
            echo wpsc_display_purchlog_shipping_option();
            ?>
<br />
               <?php 
            if (wpsc_purchlogs_has_tracking()) {
                ?>
                  <?php 
                _e('Tracking ID:', 'wpsc');
                ?>
 <?php 
                echo wpsc_purchlogitem_trackid();
                ?>
<br />
                  <?php 
                _e('Shipping Status:', 'wpsc');
                ?>
 <?php 
                echo wpsc_purchlogitem_trackstatus();
                ?>
<br />
                  <?php 
                _e('Track History:', 'wpsc');
                ?>
 <?php 
                echo wpsc_purchlogitem_trackhistory();
                ?>
               <?php 
            }
            ?>
               </p>
            </div>
            <?php 
        }
        ?>
            <div id='wpsc_billing_details_box'>
	           <?php 
        do_action('wpsc_billing_details_top');
        ?>
               <h3><?php 
        _e('Billing Details', 'wpsc');
        ?>
</h3>
               <p><strong><?php 
        _e('Purchase Log Date:', 'wpsc');
        ?>
 </strong><?php 
        echo wpsc_purchaselog_details_date();
        ?>
 </p>
               <p><strong><?php 
        _e('Purchase Number:', 'wpsc');
        ?>
 </strong><?php 
        echo wpsc_purchaselog_details_purchnumber();
        ?>
 </p>
               <p><strong><?php 
        _e('Buyers Name:', 'wpsc');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_buyers_name();
        ?>
</p>
               <p><strong><?php 
        _e('Address:', 'wpsc');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_buyers_address();
        ?>
</p>

               <p><strong><?php 
        _e('Phone:', 'wpsc');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_buyers_phone();
        ?>
</p>
               <p><strong><?php 
        _e('Email:', 'wpsc');
        ?>
 </strong><a href="mailto:<?php 
        echo wpsc_display_purchlog_buyers_email();
        ?>
?subject=Message From '<?php 
        echo get_option('siteurl');
        ?>
'"><?php 
        echo wpsc_display_purchlog_buyers_email();
        ?>
</a></p>
               <p><strong><?php 
        _e('Payment Method:', 'wpsc');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_paymentmethod();
        ?>
</p>
               <?php 
        if (wpsc_display_purchlog_display_howtheyfoundus()) {
            ?>
               <p><strong><?php 
            _e('How User Found Us:', 'wpsc');
            ?>
 </strong><?php 
            echo wpsc_display_purchlog_howtheyfoundus();
            ?>
</p>
               <?php 
        }
        ?>
               <?php 
        do_action('wpsc_billing_details_bottom');
        ?>
            </div>

            <div id='wpsc_items_ordered'>
               <br />
               <h3><?php 
        _e('Items Ordered', 'wpsc');
        ?>
</h3>
               <table class="widefat" cellspacing="0">
                  <thead>
                     <tr>
                  <?php 
        print_column_headers('display-purchaselog-details');
        ?>
                     </tr>
                  </thead>

                  <tfoot>
                  </tfoot>

                  <tbody>
                  <?php 
        wpsc_display_purchlog_details();
        ?>
                  <tr> &nbsp;</tr>

                  <tr class="wpsc_purchaselog_start_totals">
                     <td colspan="5">
                        <?php 
        if (wpsc_purchlog_has_discount_data()) {
            ?>
                        <?php 
            _e('Coupon Code', 'wpsc');
            ?>
: <?php 
            echo wpsc_display_purchlog_discount_data();
            ?>
                        <?php 
        }
        ?>
                     </td>
                     <th><?php 
        _e('Discount', 'wpsc');
        ?>
 </th>
                     <td><?php 
        echo wpsc_display_purchlog_discount();
        ?>
</td>
                  </tr>

                  <?php 
        if (!wpec_display_product_tax()) {
            ?>
                     <tr>
                        <td colspan='5'></td>
                        <th><?php 
            _e('Taxes', 'wpsc');
            ?>
 </th>
                        <td><?php 
            echo wpec_display_purchlog_taxes();
            ?>
</td>
                     </tr>
                  <?php 
        }
        ?>

                  <tr>
                     <td colspan='5'></td>
                     <th><?php 
        _e('Shipping', 'wpsc');
        ?>
 </th>
                     <td><?php 
        echo wpsc_display_purchlog_shipping();
        ?>
</td>
                  </tr>
                  <tr>
                     <td colspan='5'></td>
                     <th><?php 
        _e('Total', 'wpsc');
        ?>
 </th>
                     <td><?php 
        echo wpsc_display_purchlog_totalprice();
        ?>
</td>
                  </tr>
                  </tbody>
            </table>
            <div id='wpsc_purchlog_order_status'>
               <form action='' method='post'>
               <p><label for='<?php 
        echo $_GET['purchaselog_id'];
        ?>
'><?php 
        _e('Order Status:', 'wpsc');
        ?>
</label><select class='selector' name='<?php 
        echo $_GET['purchaselog_id'];
        ?>
' title='<?php 
        echo $_GET['purchaselog_id'];
        ?>
' >
            <?php 
        while (wpsc_have_purch_items_statuses()) {
            wpsc_the_purch_status();
            ?>
               <option value='<?php 
            echo wpsc_the_purch_status_id();
            ?>
' <?php 
            echo wpsc_purchlog_is_checked_status();
            ?>
 ><?php 
            echo wpsc_the_purch_status_name();
            ?>
 </option>
            <?php 
        }
        ?>
               </select></p>
               </form>
         </div>
            <?php 
        wpsc_purchlogs_custom_fields();
        ?>


            <!-- Start Order Notes (by Ben) -->
            <?php 
        wpsc_purchlogs_notes();
        ?>
            <!-- End Order Notes (by Ben) -->

            <?php 
        wpsc_custom_checkout_fields();
        ?>

            </div>
            </div>

            <div id='wpsc_purchlogitems_links'>
            <h3><?php 
        _e('Actions', 'wpsc');
        ?>
</h3>
            <?php 
        do_action('wpsc_purchlogitem_links_start');
        ?>
            <?php 
        if (wpsc_purchlogs_have_downloads_locked() != false) {
            ?>
<img src='<?php 
            echo WPSC_CORE_IMAGES_URL;
            ?>
/lock_open.png' alt='clear lock icon' />&ensp;<a href='<?php 
            echo $_SERVER['REQUEST_URI'] . '&amp;wpsc_admin_action=clear_locks';
            ?>
'><?php 
            echo wpsc_purchlogs_have_downloads_locked();
            ?>
</a><br /><br class='small' />
            <?php 
        }
        ?>
<img src='<?php 
        echo WPSC_CORE_IMAGES_URL;
        ?>
/printer.png' alt='printer icon' />&ensp;<a href='<?php 
        echo add_query_arg('wpsc_admin_action', 'wpsc_display_invoice');
        ?>
'><?php 
        _e('View Packing Slip', 'wpsc');
        ?>
</a>

<br /><br class='small' /><img src='<?php 
        echo WPSC_CORE_IMAGES_URL;
        ?>
/email_go.png' alt='email icon' />&ensp;<a href='<?php 
        echo add_query_arg('email_buyer_id', $_GET['purchaselog_id']);
        ?>
'><?php 
        _e('Resend Receipt to Buyer', 'wpsc');
        ?>
</a>

<br /><br class='small' /><a class='submitdelete' title='<?php 
        echo esc_attr(__('Delete this log', 'wpsc'));
        ?>
' href='<?php 
        echo wp_nonce_url("admin.php?wpsc_admin_action=delete_purchlog&amp;purchlog_id=" . $_GET['purchaselog_id'], 'delete_purchlog_' . $_GET['purchaselog_id']);
        ?>
' onclick="if ( confirm(' <?php 
        echo esc_js(sprintf(__("You are about to delete this log '%s'\n 'Cancel' to stop, 'OK' to delete.", 'wpsc'), wpsc_purchaselog_details_date()));
        ?>
') ) { return true;}return false;"><img src='<?php 
        echo WPSC_CORE_IMAGES_URL . "/cross.png";
        ?>
' alt='delete icon' />               &nbsp;<?php 
        _e('Remove this record', 'wpsc');
        ?>
</a>

<br /><br class='small' />&emsp;&ensp;    <a href='<?php 
        echo $page_back;
        ?>
'><?php 
        _e('Go Back', 'wpsc');
        ?>
</a>
<br /><br />
         </div>
         </div>
         <br />
         <?php 
    }
    ?>
   </div>
   <?php 
}
Exemple #3
0
function get_packing_slip($purchase_ids, $purchase_id_arr)
{
    global $purchlogitem;
    if (!empty($purchase_ids) && !empty($purchase_id_arr)) {
        ?>
                    <style type="text/css">
                            body {
                                    font-family:"Helvetica Neue", Helvetica, Arial, Verdana, sans-serif;
                            }

                            h1 span {
                                    font-size:0.75em;
                            }

                            h2 {
                                    color: #333;
                            }

                            #wrapper {
                                    margin:0 auto;
                                    width:95%;
                                    page-break-after: always;
                            }

                            #header {
                            }

                            #customer {
                                    overflow:hidden;
                            }

                            #customer .shipping, #customer .billing {
                                    float: left;
                                    width: 50%;
                            }

                            table {
                                    border:1px solid #000;
                                    border-collapse:collapse;
                                    margin-top:1em;
                                    width:100%;
                            }

                            th {
                                    background-color:#efefef;
                                    text-align:center;
                            }

                            th, td {
                                    padding:5px;
                            }

                            td {
                                    text-align:center;
                            }

                            #cart-items td.amount {
                                    text-align:right;
                            }

                            td, tbody th {
                                    border-top:1px solid #ccc;
                            }
                            th.column-total {
                                    width:90px;
                            }
                            th.column-shipping {
                                    width:120px;
                            }
                            th.column-price {
                                    width:100px;
                            }
                    </style>
                <?php 
        if (!class_exists('wpsc_purchaselogs_items')) {
            require_once WP_PLUGIN_DIR . '/wp-e-commerce/wpsc-includes/purchaselogs.class.php';
        }
        foreach ($purchase_id_arr as $purchase_id_value) {
            $purchlogitem = new wpsc_purchaselogs_items((int) $purchase_id_value);
            ?>
                        <div id="wrapper">
                              <?php 
            echo smart_manager_print_logo();
            ?>
                            <div id="header" style="margin-top:-0.8em;">
                                    <h1>
                                        
                                            <?php 
            echo get_bloginfo('name');
            ?>
<br />
                                            <span><?php 
            printf(esc_html__('Packing Slip for Order #%s', 'wpsc'), $purchase_id_value);
            ?>
</span>
                                    </h1>
                            </div>
                            <div id="customer">
                                    <div class="shipping">
                                            <h2><?php 
            echo esc_html_x('Ship To:', 'packing slip', 'wpsc');
            ?>
</h2>
                                            <strong><?php 
            echo wpsc_display_purchlog_shipping_name();
            ?>
</strong><br />
                                            <?php 
            echo wpsc_display_purchlog_shipping_address();
            ?>
<br />
                                            <?php 
            echo wpsc_display_purchlog_shipping_city();
            ?>
<br />
                                            <?php 
            echo wpsc_display_purchlog_shipping_state_and_postcode();
            ?>
<br />
                                            <?php 
            echo wpsc_display_purchlog_shipping_country();
            ?>
<br />
                                    </div>
                                    <div class="billing">
                                            <h2><?php 
            echo esc_html_x('Bill To:', 'packing slip', 'wpsc');
            ?>
</h2>
                                            <strong><?php 
            echo wpsc_display_purchlog_buyers_name();
            ?>
</strong><br />
                                            <?php 
            echo wpsc_display_purchlog_buyers_address();
            ?>
<br />
                                            <?php 
            echo wpsc_display_purchlog_buyers_city();
            ?>
<br />
                                            <?php 
            echo wpsc_display_purchlog_buyers_state_and_postcode();
            ?>
<br />
                                            <?php 
            echo wpsc_display_purchlog_buyers_country();
            ?>
<br />
                                    </div>
                            </div>
                            <table id="order">
                                    <thead>
                                            <tr>
                                                    <th><?php 
            echo esc_html_x('Order Date', 'packing slip', 'wpsc');
            ?>
</th>
                                                    <th><?php 
            echo esc_html_x('Order ID', 'packing slip', 'wpsc');
            ?>
</th>
                                                    <th><?php 
            echo esc_html_x('Shipping Method', 'packing slip', 'wpsc');
            ?>
</th>
                                                    <th><?php 
            echo esc_html_x('Payment Method', 'packing slip', 'wpsc');
            ?>
</th>
                                            </tr>
                                    </thead>
                                    <tbody>
                                            <tr>
                                                    <td><?php 
            echo wpsc_purchaselog_details_date();
            ?>
</td>
                                                    <td><?php 
            echo wpsc_purchaselog_details_purchnumber();
            ?>
</td>
                                                    <td><?php 
            echo wpsc_display_purchlog_shipping_method();
            ?>
</td>
                                                    <td><?php 
            echo wpsc_display_purchlog_paymentmethod();
            ?>
</td>
                                            </tr>
                                    </tbody>
                            </table>
                            <table id="cart-items" class="widefat" cellspacing="0">
                                    <thead>
                                            <tr>
                                                    <th scope='col' id='title' class='manage-column column-title'  style=""><?php 
            _e('Item Name', 'wpsc');
            ?>
</th>
                                                    <th scope='col' id='sku' class='manage-column column-sku'  style=""><?php 
            _e('SKU', 'wpsc');
            ?>
</th>
                                                    <th scope='col' id='quantity' class='manage-column column-quantity'  style=""><?php 
            _e('Quantity', 'wpsc');
            ?>
</th>
                                                    <th scope='col' id='price' class='manage-column column-price'  style=""><?php 
            _e('Price', 'wpsc');
            ?>
</th>
                                                    <th scope='col' id='shipping' class='manage-column column-shipping'  style=""><?php 
            _e('Item Shipping', 'wpsc');
            ?>
</th>
                                                    <th scope='col' id='tax' class='manage-column column-tax'  style=""><?php 
            _e('Item Tax', 'wpsc');
            ?>
</th>
                                                    <th scope='col' id='total' class='manage-column column-total'  style=""><?php 
            _e('Item Total', 'wpsc');
            ?>
</th>

                                                    <?php 
            $cols = 5;
            // this is counted as ( count of th - 2 )
            ?>
                                            </tr>
                                    </thead>

                                    <tbody>
                                            <?php 
            while (wpsc_have_purchaselog_details()) {
                wpsc_the_purchaselog_item();
                ?>
                                                  <tr>
                                                     <td><?php 
                echo wpsc_purchaselog_details_name();
                ?>
</td> <!-- NAME! -->
                                                     <td><?php 
                echo wpsc_purchaselog_details_SKU();
                ?>
</td> <!-- SKU! -->
                                                     <td><?php 
                echo wpsc_purchaselog_details_quantity();
                ?>
</td> <!-- QUANTITY! -->
                                                     <td>
                                                        <?php 
                echo wpsc_currency_display(wpsc_purchaselog_details_price());
                do_action('wpsc_additional_sales_amount_info', wpsc_purchaselog_details_id());
                ?>
                                                     </td> <!-- PRICE! -->
                                                     <td><?php 
                echo wpsc_currency_display(wpsc_purchaselog_details_shipping());
                ?>
</td> <!-- SHIPPING! -->
                                                     <?php 
                if (wpec_display_product_tax()) {
                    ?>
                                                        <td><?php 
                    echo wpsc_currency_display(wpsc_purchaselog_details_tax());
                    ?>
</td> <!-- TAX! -->
                                                     <?php 
                }
                ?>
                                                     <!-- <td><?php 
                echo wpsc_currency_display(wpsc_purchaselog_details_discount());
                ?>
</td> --> <!-- DISCOUNT! -->
                                                     <td class="amount"><?php 
                echo wpsc_currency_display(wpsc_purchaselog_details_total());
                ?>
</td> <!-- TOTAL! -->
                                                  </tr>
                                                  <?php 
            }
            ?>

                                            <tr class="wpsc_purchaselog_start_totals">
                                                    <td colspan="<?php 
            echo $cols;
            ?>
">
                                                            <?php 
            if (wpsc_purchlog_has_discount_data()) {
                ?>
                                                                    <?php 
                esc_html_e('Coupon Code', 'wpsc');
                ?>
: <?php 
                echo wpsc_display_purchlog_discount_data();
                ?>
                                                            <?php 
            }
            ?>
                                                    </td>
                                                    <th><?php 
            esc_html_e('Discount', 'wpsc');
            ?>
 </th>
                                                    <td class="amount"><?php 
            echo wpsc_display_purchlog_discount();
            ?>
</td>
                                            </tr>

                                            <?php 
            if (!wpec_display_product_tax()) {
                ?>
                                                    <tr>
                                                            <td colspan='<?php 
                echo $cols;
                ?>
'></td>
                                                            <th><?php 
                esc_html_e('Taxes', 'wpsc');
                ?>
 </th>
                                                            <td class="amount"><?php 
                echo wpsc_display_purchlog_taxes();
                ?>
</td>
                                                    </tr>
                                            <?php 
            }
            ?>

                                            <tr>
                                                    <td colspan='<?php 
            echo $cols;
            ?>
'></td>
                                                    <th><?php 
            esc_html_e('Shipping', 'wpsc');
            ?>
 </th>
                                                    <td class="amount"><?php 
            echo wpsc_display_purchlog_shipping();
            ?>
</td>
                                            </tr>
                                            <tr>
                                                    <td colspan='<?php 
            echo $cols;
            ?>
'></td>
                                                    <th><?php 
            esc_html_e('Total', 'wpsc');
            ?>
 </th>
                                                    <td class="amount"><?php 
            echo wpsc_display_purchlog_totalprice();
            ?>
</td>
                                            </tr>
                                    </tbody>
                            </table>
                        </div>

                    <?php 
        }
        exit;
    }
}
	<div id='post-body'>
		<?php 
if (wpsc_has_purchlog_shipping()) {
    ?>
		<?php 
    do_action('wpsc_shipping_details_top', $this->log_id);
    ?>
			<div id='wpsc_shipping_details_box'>
				<h3><?php 
    esc_html_e('Shipping Address', 'wpsc');
    ?>
</h3>
				<blockquote>
					<strong>
						<?php 
    echo wpsc_display_purchlog_shipping_name() != "" ? wpsc_display_purchlog_shipping_name() . "<br />" : '<span class="field-blank">' . __('Anonymous', 'wpsc') . '</span>';
    ?>
					</strong>
					<?php 
    echo wpsc_display_purchlog_shipping_address() != "" ? wpsc_display_purchlog_shipping_address() . "<br />" : '';
    ?>
					<?php 
    echo wpsc_display_purchlog_shipping_city() != "" ? wpsc_display_purchlog_shipping_city() . "<br />" : '';
    ?>
					<?php 
    echo wpsc_display_purchlog_shipping_state_and_postcode() != "" ? wpsc_display_purchlog_shipping_state_and_postcode() . "<br />" : '';
    ?>
					<?php 
    echo wpsc_display_purchlog_shipping_country() != "" ? wpsc_display_purchlog_shipping_country() . "<br />" : '<span class="field-blank">' . __('Country not specified', 'wpsc') . '</span>';
    ?>
				</blockquote>
Exemple #5
0
?>
<br />
				<span><?php 
printf(esc_html__('Packing Slip for Order #%s', 'wp-e-commerce'), $this->log_id);
?>
</span>
			</h1>
		</div>
		<div id="customer">
			<div class="shipping">
				<h2><?php 
echo esc_html_x('Ship To:', 'packing slip', 'wp-e-commerce');
?>
</h2>
				<strong><?php 
echo wpsc_display_purchlog_shipping_name();
?>
</strong><br />
				<?php 
echo wpsc_display_purchlog_shipping_address();
?>
<br />
				<?php 
echo wpsc_display_purchlog_shipping_city();
?>
<br />
				<?php 
echo wpsc_display_purchlog_shipping_state_and_postcode();
?>
<br />
				<?php