/** * Get the data being exported * * @return array $data */ public function get_data() { global $wpdb; $data = array(); $campaign = $this->campaign; $campaign = atcf_get_campaign($campaign); $backers = $campaign->backers(); if (empty($backers)) { return $data; } foreach ($backers as $log) { $payment_id = get_post_meta($log->ID, '_edd_log_payment_id', true); $payment = get_post($payment_id); $payment_meta = edd_get_payment_meta($payment_id); $user_info = edd_get_payment_meta_user_info($payment_id); $downloads = edd_get_payment_meta_cart_details($payment_id); $total = edd_get_payment_amount($payment_id); $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email']; $products = ''; if ($downloads) { foreach ($downloads as $key => $download) { // Download ID $id = isset($payment_meta['cart_details']) ? $download['id'] : $download; // If the download has variable prices, override the default price $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null; $price = edd_get_download_final_price($id, $user_info, $price_override); // Display the Downoad Name $products .= get_the_title($id) . ' - '; if (isset($downloads[$key]['item_number'])) { $price_options = $downloads[$key]['item_number']['options']; if (isset($price_options['price_id'])) { $products .= edd_get_price_option_name($id, $price_options['price_id']) . ' - '; } } $products .= html_entity_decode(edd_currency_filter($price)); if ($key != count($downloads) - 1) { $products .= ' / '; } } } if (is_numeric($user_id)) { $user = get_userdata($user_id); } else { $user = false; } $shipping = isset($payment_meta['shipping']) ? $payment_meta['shipping'] : null; $data[] = apply_filters('atcf_csv_cols_values', array('id' => $payment_id, 'email' => $payment_meta['email'], 'first' => $user_info['first_name'], 'last' => $user_info['last_name'], 'shipping' => isset($shipping) ? implode("\n", $shipping) : '', 'products' => $products, 'amount' => html_entity_decode(edd_currency_filter(edd_format_amount($total))), 'tax' => html_entity_decode(edd_payment_tax($payment_id, $payment_meta)), 'discount' => isset($user_info['discount']) && $user_info['discount'] != 'none' ? $user_info['discount'] : __('none', 'atcf'), 'gateway' => edd_get_gateway_admin_label(get_post_meta($payment_id, '_edd_payment_gateway', true)), 'key' => $payment_meta['key'], 'date' => date_i18n(get_option('date_format'), strtotime($payment->post_date)), 'user' => $user ? $user->display_name : __('guest', 'atcf'), 'status' => edd_get_payment_status($payment, true)), $payment_id); } $data = apply_filters('edd_export_get_data', $data); $data = apply_filters('edd_export_get_data_' . $this->export_type, $data); return $data; }
</td> </tr> <?php } ?> <?php if (edd_use_taxes()) { ?> <tr> <td><strong><?php _e('Tax', 'easy-digital-downloads'); ?> </strong></td> <td><?php echo edd_payment_tax($payment->ID); ?> </td> </tr> <?php } ?> <?php if ($edd_receipt_args['price']) { ?> <tr> <td><strong><?php _e('Subtotal', 'easy-digital-downloads'); ?>
function eddpdfi_pdf_template_vat($eddpdfi_pdf, $eddpdfi_payment, $eddpdfi_payment_meta, $eddpdfi_buyer_info, $eddpdfi_payment_gateway, $eddpdfi_payment_method, $address_line_2_line_height, $company_name, $eddpdfi_payment_date, $eddpdfi_payment_status) { global $edd_options; if (!isset($edd_options['eddpdfi_templates'])) { $edd_options['eddpdfi_templates'] = 'default'; } $color = empty($edd_options['edd_vat_pdf_colors']) ? "blue" : $edd_options['edd_vat_pdf_colors']; switch ($color) { case 'blue': $colors = array('body' => array(8, 75, 110), 'emphasis' => array(71, 155, 198), 'title' => array(0, 127, 192), 'header' => array(202, 226, 238), 'sub' => array(234, 242, 245), 'border' => array(166, 205, 226), 'notes' => array(7, 46, 66)); break; case 'red': $colors = array('body' => array(110, 8, 8), 'emphasis' => array(198, 71, 71), 'title' => array(192, 0, 0), 'header' => array(238, 202, 202), 'sub' => array(245, 243, 243), 'border' => array(226, 166, 166), 'notes' => array(66, 7, 7)); break; case 'green': $colors = array('body' => array(8, 110, 39), 'emphasis' => array(71, 198, 98), 'title' => array(0, 192, 68), 'header' => array(202, 238, 212), 'sub' => array(243, 245, 244), 'border' => array(166, 226, 179), 'notes' => array(7, 66, 28)); break; case 'orange': $colors = array('body' => array(110, 54, 8), 'emphasis' => array(198, 134, 71), 'title' => array(192, 81, 0), 'header' => array(238, 219, 202), 'sub' => array(245, 245, 243), 'border' => array(226, 224, 166), 'notes' => array(65, 66, 7)); break; case 'yellow': $colors = array('body' => array(109, 110, 8), 'emphasis' => array(197, 198, 71), 'title' => array(192, 190, 0), 'header' => array(238, 238, 202), 'sub' => array(245, 244, 243), 'border' => array(226, 193, 166), 'notes' => array(66, 38, 7)); break; case 'purple': $colors = array('body' => array(66, 8, 110), 'emphasis' => array(137, 71, 198), 'title' => array(72, 0, 192), 'header' => array(208, 202, 238), 'sub' => array(244, 243, 245), 'border' => array(189, 166, 226), 'notes' => array(35, 7, 66)); break; case 'pink': $colors = array('body' => array(110, 8, 82), 'emphasis' => array(198, 71, 152), 'title' => array(92, 0, 65), 'header' => array(238, 202, 232), 'sub' => array(245, 243, 245), 'border' => array(226, 166, 213), 'notes' => array(66, 7, 51)); break; } $eddpdfi_pdf->AddFont('opensans', ''); $eddpdfi_pdf->AddFont('opensansb', ''); $font = isset($edd_options['eddpdfi_enable_char_support']) ? 'freesans' : 'opensans'; $fontb = isset($edd_options['eddpdfi_enable_char_support']) ? 'freesans' : 'opensansb'; $eddpdfi_pdf->SetMargins(8, 8, 8); $eddpdfi_pdf->SetX(8); $eddpdfi_pdf->AddPage(); $eddpdfi_pdf->Ln(5); $eddpdfi_logo_size = 0; if (isset($eddpdfi_logo_size) && isset($edd_options['eddpdfi_logo_upload']) && !empty($edd_options['eddpdfi_logo_upload'])) { // $file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false, $alt=false, $altimgs=array() $eddpdfi_pdf->Image($edd_options['eddpdfi_logo_upload'], 8, 10, 0, '25', '', false, 'LTR', false, 96); } else { $eddpdfi_pdf->SetFont($font, '', 22); $eddpdfi_pdf->SetTextColor(50, 50, 50); $eddpdfi_pdf->Cell(0, 0, $company_name, 0, 2, 'L', false); } $eddpdfi_pdf->SetFont($font, '', 18); $eddpdfi_pdf->SetTextColor($colors['title'][0], $colors['title'][1], $colors['title'][2]); $eddpdfi_pdf->SetY(45); if ($eddpdfi_payment_status === 'Refunded') { $eddpdfi_pdf->Cell(0, 0, 'Invoice Correction', 0, 2, 'L', false); } else { $eddpdfi_pdf->Cell(0, 0, __('Invoice', 'eddpdfi'), 0, 2, 'L', false); } $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]); $eddpdfi_pdf->SetXY(8, 60); $eddpdfi_pdf->SetFont($fontb, '', 10); $eddpdfi_pdf->Cell(0, 6, __('From', 'eddpdfi'), 0, 2, 'L', false); $eddpdfi_pdf->SetFont($font, '', 10); if (!empty($edd_options['edd_vat_company_name'])) { $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['edd_vat_company_name']), $edd_options['edd_vat_company_name'], 0, 2, 'L', false); } if (!empty($edd_options['eddpdfi_name'])) { $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_name']), eddpdfi_get_settings($eddpdfi_pdf, 'name'), 0, 2, 'L', false); } if (!empty($edd_options['eddpdfi_address_line1'])) { $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_address_line1']), eddpdfi_get_settings($eddpdfi_pdf, 'addr_line1'), 0, 2, 'L', false); } if (!empty($edd_options['eddpdfi_address_line2'])) { $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_address_line2']), eddpdfi_get_settings($eddpdfi_pdf, 'addr_line2'), 0, 2, 'L', false); } if (!empty($edd_options['eddpdfi_address_city_state_zip'])) { $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_address_city_state_zip']), eddpdfi_get_settings($eddpdfi_pdf, 'city_state_zip'), 0, 2, 'L', false); } if (!empty($edd_options['base_country'])) { $countries = edd_get_country_list(); $countries['UK'] = $countries['GB']; $country = $countries[$edd_options['base_country']]; $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($country), $country, 0, 2, 'L', false); } if (!empty($edd_options['eddpdfi_email_address'])) { $eddpdfi_pdf->SetTextColor(41, 102, 152); $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_email_address']), eddpdfi_get_settings($eddpdfi_pdf, 'email'), 0, 2, 'L', false); } if (isset($edd_options['eddpdfi_url']) && $edd_options['eddpdfi_url']) { $eddpdfi_pdf->SetTextColor(41, 102, 152); $eddpdfi_pdf->Cell(0, 6, get_option('siteurl'), 0, 2, 'L', false); } if (!empty($edd_options['edd_vat_number'])) { $vat_number = maybe_unserialize($edd_options['edd_vat_number']); if (!empty($vat_number['number'])) { //$vat_number = __(sprintf('%s ID ', apply_filters('lsl_tax_label','Tax')), 'edd_vat') . $vat_number['number']; $vat_number = 'VAT No. ' . $vat_number['number']; $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($vat_number), $vat_number, 0, 2, 'L', false); } } $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]); $eddpdfi_pdf->Ln(12); $eddpdfi_pdf->Ln(); $eddpdfi_pdf->SetXY(60, 60); $eddpdfi_pdf->SetFont($fontb, '', 10); $eddpdfi_pdf->Cell(0, 6, __('To', 'eddpdfi'), 0, 2, 'L', false); $eddpdfi_pdf->SetFont($font, '', 10); $eddpdfi_pdf->Cell(0, 6, $eddpdfi_buyer_info['first_name'] . ' ' . $eddpdfi_buyer_info['last_name'], 0, 2, 'L', false); $eddpdfi_pdf->SetTextColor(41, 102, 152); $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_meta['email'], 0, 2, 'L', false); $eddpdfi_pdf->SetTextColor(50, 50, 50); $eddpdfi_pdf->Ln(4); $eddpdfi_pdf->SetX(60); $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]); $eddpdfi_pdf->Cell(30, 6, __('Invoice Date', 'eddpdfi'), 0, 0, 'L', false); $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]); $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_date, 0, 2, 'L', false); $eddpdfi_pdf->SetXY(60, 92); $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]); $eddpdfi_pdf->Cell(30, 6, __('Invoice ID', 'eddpdfi'), 0, 0, 'L', false); $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]); if (function_exists('eddpdfi_get_payment_number') && isset($edd_options['edd_vat_invoice_number'])) { $eddpdfi_pdf->Cell(0, 6, eddpdfi_get_payment_number($eddpdfi_payment->ID), 0, 2, 'L', false); } else { $eddpdfi_pdf->Cell(0, 6, '#' . $eddpdfi_payment->ID, 0, 2, 'L', false); } $eddpdfi_pdf->SetX(60); $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]); $eddpdfi_pdf->Cell(30, 6, __('Purchase Key', 'eddpdfi'), 0, 0, 'L', false); $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]); $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_meta['key'], 0, 2, 'L', false); $eddpdfi_pdf->SetX(60); $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]); $eddpdfi_pdf->Cell(30, 6, __('Payment Status', 'eddpdfi'), 0, 0, 'L', false); $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]); $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_status, 0, 2, 'L', false); $eddpdfi_pdf->SetX(60); $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]); $eddpdfi_pdf->Cell(30, 6, __('Payment Method', 'eddpdfi'), 0, 0, 'L', false); $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]); $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_method, 0, 2, 'L', false); $offset = apply_filters('eddpdfi_pdf_template_extra_fields', 0, 'color', $eddpdfi_pdf, $eddpdfi_payment, $eddpdfi_payment_meta, $eddpdfi_buyer_info, $colors); $eddpdfi_pdf->SetXY(61, 120 + $offset); $eddpdfi_pdf->SetFillColor($colors['header'][0], $colors['header'][1], $colors['header'][2]); $eddpdfi_pdf->SetDrawColor($colors['border'][0], $colors['border'][1], $colors['border'][2]); $eddpdfi_pdf->SetFont($fontb, '', 10); $eddpdfi_pdf->Cell(140, 8, __('Invoice Items', 'eddpdfi'), 1, 2, 'C', true); $eddpdfi_pdf->Ln(0.2); $eddpdfi_pdf->SetX(61); $eddpdfi_pdf->SetFillColor($colors['sub'][0], $colors['sub'][1], $colors['sub'][2]); $eddpdfi_pdf->SetFont($font, '', 9); $qenabled = version_compare(EDD_VERSION, "1.9") >= 0 ? true : (function_exists('edd_item_quanities_enabled') ? edd_item_quanities_enabled() : false); $eddpdfi_pdf->Cell($qenabled ? 95 : 102, 7, __('PRODUCT NAME', 'eddpdfi'), 'BL', 0, 'L', true); if ($qenabled) { $eddpdfi_pdf->Cell(10, 7, __('#', 'eddpdfi'), 'B', 0, 0, true); } $eddpdfi_pdf->Cell($qenabled ? 35 : 38, 7, __('PRICE', 'eddpdfi'), 'BR', 0, 'R', true); $eddpdfi_pdf->Ln(0.2); $eddpdfi_pdf_downloads = isset($eddpdfi_payment_meta['cart_details']) ? maybe_unserialize($eddpdfi_payment_meta['cart_details']) : false; $eddpdfi_pdf->Ln(); if ($eddpdfi_pdf_downloads) { $eddpdfi_pdf->SetX(61); $includes_taxes = edd_prices_include_tax(); foreach ($eddpdfi_pdf_downloads as $key => $download) { $eddpdfi_pdf->SetX(61); $eddpdfi_pdf->SetFont($font, '', 10); $eddpdfi_download_id = isset($eddpdfi_payment_meta['cart_details']) ? $download['id'] : $download; $eddpdfi_price_override = isset($eddpdfi_payment_meta['cart_details']) ? $download['price'] : null; $user_info = maybe_unserialize($eddpdfi_payment_meta['user_info']); $eddpdfi_final_download_price = edd_get_download_final_price($eddpdfi_download_id, $user_info, $eddpdfi_price_override); if (isset($user_info['discount']) && $user_info['discount'] != 'none') { $eddpdfi_discount = $user_info['discount']; } else { $eddpdfi_discount = __('None', 'eddpdfi'); } // $eddpdfi_total_price = html_entity_decode( edd_currency_filter( edd_format_amount( $eddpdfi_payment_meta['amount'] ) ) ); $eddpdfi_download_title = html_entity_decode(get_the_title($eddpdfi_download_id), ENT_COMPAT, 'UTF-8'); if (edd_has_variable_prices($eddpdfi_download_id)) { $eddpdfi_download_title .= ' - ' . edd_get_cart_item_price_name($download); $options = $download['item_number']['options']; } // error_log(print_r($download,true)); $options['is_item'] = $eddpdfi_download_id; $price = edd_get_cart_item_price($eddpdfi_download_id, $options, $includes_taxes); $eddpdfi_download_price = ' ' . html_entity_decode(edd_currency_filter(edd_format_amount($price)), ENT_COMPAT, 'UTF-8'); // $eddpdfi_download_price = ' ' . html_entity_decode( edd_currency_filter( edd_format_amount( $eddpdfi_final_download_price ) ), ENT_COMPAT, 'UTF-8' ); $eddpdfi_pdf->Cell($qenabled ? 95 : 102, 8, $eddpdfi_download_title, 'B', 0, 'L', false); if ($qenabled) { $quantity = is_array($download) ? $download['quantity'] : 1; $eddpdfi_pdf->Cell(10, 8, $quantity, 'B', 0, 'C', false); } $eddpdfi_pdf->Cell($qenabled ? 35 : 38, 8, $eddpdfi_download_price, 'B', 2, 'R', false); } $eddpdfi_pdf->Ln(5); $eddpdfi_pdf->SetX(61); $eddpdfi_pdf->SetFillColor($colors['header'][0], $colors['header'][1], $colors['header'][2]); $eddpdfi_pdf->SetFont($fontb, '', 10); $eddpdfi_pdf->Cell(140, 8, __('Invoice Totals', 'eddpdfi'), 1, 2, 'C', true); $eddpdfi_pdf->Ln(0.2); $eddpdfi_pdf->SetX(61); if (edd_use_taxes()) { //$taxrate = (edd_get_payment_amount( $eddpdfi_payment->ID ) - round(edd_get_payment_subtotal( $eddpdfi_payment->ID ))) / round(edd_get_payment_subtotal( $eddpdfi_payment->ID )) * 100; switch ($eddpdfi_buyer_info['address']['country']) { case 'BE': $taxrate = '21%'; break; case 'BG': $taxrate = '20%'; break; case 'CZ': $taxrate = '21%'; break; case 'DK': $taxrate = '25%'; break; case 'GB': $taxrate = '20%'; break; case 'UK': $taxrate = '20%'; break; case 'DE': $taxrate = '19%'; break; case 'EE': $taxrate = '20%'; break; case 'EL': $taxrate = '23%'; break; case 'ES': $taxrate = '21%'; break; case 'FR': $taxrate = '20%'; break; case 'HR': $taxrate = '25%'; break; case 'IE': $taxrate = '23%'; break; case 'IT': $taxrate = '22%'; break; case 'CY': $taxrate = '19%'; break; case 'LV': $taxrate = '21%'; break; case 'LT': $taxrate = '21%'; break; case 'LU': $taxrate = '17%'; break; case 'HU': $taxrate = '27%'; break; case 'MT': $taxrate = '18%'; break; case 'NL': $taxrate = '21%'; break; case 'AT': $taxrate = '20%'; break; case 'PL': $taxrate = '23%'; break; case 'PT': $taxrate = '23%'; break; case 'RO': $taxrate = '24%'; break; case 'SI': $taxrate = '22%'; break; case 'SK': $taxrate = '20%'; break; case 'FI': $taxrate = '24%'; break; case 'SE': $taxrate = '25%'; break; default: $taxrate = '0%'; } $eddpdfi_pdf->Cell(102, 8, __('Subtotal', 'eddpdfi'), 'B', 0, 'L', false); $eddpdfi_pdf->Cell(38, 8, html_entity_decode(edd_payment_subtotal($eddpdfi_payment->ID), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', false); $eddpdfi_pdf->SetX(61); $eddpdfi_pdf->Cell(102, 8, __(apply_filters('lsl_tax_label', 'Tax'), 'eddpdfi'), 'B', 0, 'L', false); $eddpdfi_pdf->Cell(38, 8, html_entity_decode(edd_payment_tax($eddpdfi_payment->ID), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', false); $eddpdfi_pdf->SetX(61); $eddpdfi_pdf->Cell(102, 8, __('VAT RATE', 'eddpdfi'), 'B', 0, 'L', false); $eddpdfi_pdf->Cell(38, 8, $taxrate, 'B', 2, 'R', false); } $fees = edd_get_payment_fees($eddpdfi_payment->ID); if (!empty($fees)) { foreach ($fees as $fee) { $eddpdfi_pdf->SetX(61); $eddpdfi_pdf->Cell(102, 8, $fee['label'], 'B', 0, 'L', false); $eddpdfi_pdf->Cell(38, 8, html_entity_decode(edd_currency_filter($fee['amount']), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', true); } } if ($eddpdfi_discount !== __('None', 'eddpdfi')) { $eddpdfi_pdf->SetX(61); $eddpdfi_pdf->Cell(102, 8, __('Discount Used', 'eddpdfi'), 'B', 0, 'L', false); $eddpdfi_pdf->Cell(38, 8, $eddpdfi_discount, 'B', 2, 'R', false); } $eddpdfi_pdf->SetX(61); $eddpdfi_pdf->SetFont($fontb, '', 11); $eddpdfi_pdf->Cell(102, 10, __('Total Due', 'eddpdfi'), 'B', 0, 'L', false); if ($eddpdfi_payment_status === 'Refunded') { $eddpdfi_pdf->Cell(38, 10, '-' . html_entity_decode(edd_currency_filter(edd_format_amount(edd_get_payment_amount($eddpdfi_payment->ID))), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', false); } else { $eddpdfi_pdf->Cell(38, 10, html_entity_decode(edd_currency_filter(edd_format_amount(edd_get_payment_amount($eddpdfi_payment->ID))), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', false); } $eddpdfi_pdf->Ln(10); if (isset($edd_options['eddpdfi_additional_notes']) && !empty($edd_options['eddpdfi_additional_notes'])) { $eddpdfi_pdf->SetX(60); $eddpdfi_pdf->SetFont($font, '', 13); $eddpdfi_pdf->Cell(0, 6, __('Additional Notes', 'eddpdfi'), 0, 2, 'L', false); $eddpdfi_pdf->Ln(2); $eddpdfi_pdf->SetX(60); $eddpdfi_pdf->SetFont($font, '', 10); $eddpdfi_pdf->SetTextColor($colors['notes'][0], $colors['notes'][1], $colors['notes'][2]); $eddpdfi_pdf->MultiCell(0, 6, eddpdfi_get_settings($eddpdfi_pdf, 'notes'), 0, 'L', false); } } }
?> </tbody> <tfoot> <tr> <td<?php echo edd_use_skus() ? ' colspan="2"' : ''; ?> ><strong><?php _e('Total Price', 'edd'); ?> :</strong></td> <td> <?php echo edd_payment_amount($payment->ID); if (edd_use_taxes() && (!edd_prices_show_tax_on_checkout() && $edd_options['prices_include_tax'] == 'yes')) { echo ' ' . __('(ex. tax)', 'edd'); } else { if (edd_use_taxes() && $edd_options['checkout_include_tax'] == 'yes') { printf(' ' . __('(includes %s tax)', 'edd'), edd_payment_tax($payment->ID)); } } ?> </td> </tr> </tfoot> </table> <?php }
/** * Export all Payment History to CSV * * @access private * @since 1.2 * @return void */ function edd_export_payment_history() { global $edd_options; ignore_user_abort(true); if (!edd_is_func_disabled('set_time_limit') && !ini_get('safe_mode')) { set_time_limit(0); } $mode = edd_is_test_mode() ? 'test' : 'live'; header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename=edd-payment-history-' . date('m-d-Y') . '.csv'); header("Pragma: no-cache"); header("Expires: 0"); $payments = edd_get_payments(array('offset' => 0, 'number' => -1, 'mode' => $mode)); if ($payments) { $i = 0; echo '"' . __('ID', 'edd') . '",'; echo '"' . __('Email', 'edd') . '",'; echo '"' . __('First Name', 'edd') . '",'; echo '"' . __('Last Name', 'edd') . '",'; echo '"' . __('Products', 'edd') . '",'; echo '"' . __('Discounts,', 'edd') . '",'; echo '"' . __('Amount paid', 'edd') . '",'; if (edd_use_taxes()) { echo '"' . __('Amount taxed', 'edd') . '",'; } echo '"' . __('Payment method', 'edd') . '",'; echo '"' . __('Key', 'edd') . '",'; echo '"' . __('Date', 'edd') . '",'; echo '"' . __('User', 'edd') . '",'; echo '"' . __('Status', 'edd') . '"'; echo "\r\n"; foreach ($payments as $payment) { $payment_meta = edd_get_payment_meta($payment->ID); $user_info = edd_get_payment_meta_user_info($payment->ID); echo '"' . $payment->ID . '",'; echo '"' . $payment_meta['email'] . '",'; echo '"' . $user_info['first_name'] . '",'; echo '"' . $user_info['last_name'] . '",'; $downloads = edd_get_payment_meta_cart_details($payment->ID); if (empty($downloads) || !$downloads) { $downloads = maybe_unserialize($payment_meta['downloads']); } if ($downloads) { foreach ($downloads as $key => $download) { // Download ID $id = isset($payment_meta['cart_details']) ? $download['id'] : $download; // If the download has variable prices, override the default price $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null; $user_info = unserialize($payment_meta['user_info']); $price = edd_get_download_final_price($id, $user_info, $price_override); // Display the Downoad Name echo '"' . get_the_title($id); echo ' - '; if (isset($downloads[$key]['item_number'])) { $price_options = $downloads[$key]['item_number']['options']; if (isset($price_options['price_id'])) { echo edd_get_price_option_name($id, $price_options['price_id']); echo ' - '; } } echo html_entity_decode(edd_currency_filter($price)); if ($key != count($downloads) - 1) { echo ' / '; } } echo '",'; } if (isset($user_info['discount']) && $user_info['discount'] != 'none') { echo '"' . $user_info['discount'] . '",'; } else { echo '"' . __('none', 'edd') . '",'; } echo '"' . html_entity_decode(edd_currency_filter(edd_format_amount($payment_meta['amount']))) . '",'; if (edd_use_taxes()) { echo '"' . html_entity_decode(edd_payment_tax($payment->ID, $payment_meta)) . '",'; } $gateway = get_post_meta($payment->ID, '_edd_payment_gateway', true); if ($gateway) { echo '"' . edd_get_gateway_admin_label($gateway) . '",'; } else { echo '"' . __('none', 'edd') . '",'; } echo '"' . $payment_meta['key'] . '",'; echo '"' . date_i18n(get_option('date_format'), strtotime($payment->post_date)) . '",'; $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email']; echo '"' . is_numeric($user_id) ? get_user_by('id', $user_id)->display_name : __('guest', 'edd') . '",'; echo '"' . edd_get_payment_status($payment, true) . '"'; echo "\r\n"; $i++; } } else { echo __('No payments recorded yet', 'edd'); } die; }