<?php } ?> </td> </tr> <?php } ?> <?php } ?> <?php } ?> <?php if ($fees = edd_get_payment_fees($payment->ID, 'item')) { ?> <?php foreach ($fees as $fee) { ?> <tr> <td class="edd_fee_label"><?php echo esc_html($fee['label']); ?> </td> <?php if (edd_item_quantities_enabled()) { ?> <td></td> <?php }
_e('Discount Code', 'edd'); ?> :</span> <span><?php if (isset($user_info['discount']) && $user_info['discount'] !== 'none') { echo '<code>' . $user_info['discount'] . '</code>'; } else { _e('None', 'edd'); } ?> </span> </p> </div> <?php $fees = edd_get_payment_fees($payment_id); if (!empty($fees)) { ?> <div class="edd-order-fees edd-admin-box-inside"> <p class="strong"><?php _e('Fees', 'edd'); ?> :</p> <ul class="edd-payment-fees"> <?php foreach ($fees as $fee) { ?> <li><span class="fee-label"><?php echo $fee['label'] . ':</span> ' . '<span class="fee-amount" data-fee="' . esc_attr($fee['amount']) . '">' . edd_currency_filter($fee['amount'], $currency_code); ?> </span></li>
/** * Get Discount From Payment Data * * Handles to get points from payment data * * @package Easy Digital Downloads - Points and Rewards * @since 1.0.0 **/ public function edd_points_get_payment_discount($payment_id) { //discount given agains points $pointsdiscount = edd_get_payment_fees($payment_id); $discount = 0; foreach ($pointsdiscount as $key => $fee) { if (isset($fee['id']) && $fee['id'] == 'points_redeem') { $discount = abs($fee['amount']); } } return $discount; }
/** * Retrieves Recent Sales * * @access public * @since 1.5 * @return array */ public function get_recent_sales() { $sales = array(); $query = edd_get_payments(array('number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish')); if ($query) { $i = 0; foreach ($query as $payment) { $payment_meta = edd_get_payment_meta($payment->ID); $user_info = edd_get_payment_meta_user_info($payment->ID); $cart_items = edd_get_payment_meta_cart_details($payment->ID); $sales['sales'][$i]['ID'] = $payment->ID; $sales['sales'][$i]['key'] = edd_get_payment_key($payment->ID); $sales['sales'][$i]['subtotal'] = edd_get_payment_subtotal($payment->ID); $sales['sales'][$i]['tax'] = edd_get_payment_tax($payment->ID); $sales['sales'][$i]['fees'] = edd_get_payment_fees($payment->ID); $sales['sales'][$i]['total'] = edd_get_payment_amount($payment->ID); $sales['sales'][$i]['gateway'] = edd_get_payment_gateway($payment->ID); $sales['sales'][$i]['email'] = edd_get_payment_user_email($payment->ID); $sales['sales'][$i]['date'] = $payment->post_date; $sales['sales'][$i]['products'] = array(); $c = 0; foreach ($cart_items as $key => $item) { $price_override = isset($payment_meta['cart_details']) ? $item['price'] : null; $price = edd_get_download_final_price($item['id'], $user_info, $price_override); if (isset($cart_items[$key]['item_number'])) { $price_name = ''; $price_options = $cart_items[$key]['item_number']['options']; if (isset($price_options['price_id'])) { $price_name = edd_get_price_option_name($item['id'], $price_options['price_id'], $payment->ID); } } $sales['sales'][$i]['products'][$c]['name'] = get_the_title($item['id']); $sales['sales'][$i]['products'][$c]['price'] = $price; $sales['sales'][$i]['products'][$c]['price_name'] = $price_name; $c++; } $i++; } } return $sales; }
/** * Retrieves Recent Sales * * @access public * @since 1.5 * @return array */ public function get_recent_sales() { global $wp_query; $sales = array(); if( ! user_can( $this->user_id, 'view_shop_reports' ) && ! $this->override ) { return $sales; } if( isset( $wp_query->query_vars['id'] ) ) { $query = array(); $query[] = edd_get_payment_by( 'id', $wp_query->query_vars['id'] ); } elseif( isset( $wp_query->query_vars['purchasekey'] ) ) { $query = array(); $query[] = edd_get_payment_by( 'key', $wp_query->query_vars['purchasekey'] ); } elseif( isset( $wp_query->query_vars['email'] ) ) { $query = edd_get_payments( array( 'meta_key' => '_edd_payment_user_email', 'meta_value' => $wp_query->query_vars['email'], 'number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish' ) ); } else { $query = edd_get_payments( array( 'number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish' ) ); } if ( $query ) { $i = 0; foreach ( $query as $payment ) { $payment_meta = edd_get_payment_meta( $payment->ID ); $user_info = edd_get_payment_meta_user_info( $payment->ID ); $cart_items = edd_get_payment_meta_cart_details( $payment->ID ); $sales['sales'][ $i ]['ID'] = edd_get_payment_number( $payment->ID ); $sales['sales'][ $i ]['transaction_id'] = edd_get_payment_transaction_id( $payment->ID ); $sales['sales'][ $i ]['key'] = edd_get_payment_key( $payment->ID ); $sales['sales'][ $i ]['discount'] = isset( $user_info['discount'] ) && $user_info['discount'] != 'none' ? explode( ',', $user_info['discount'] ) : array(); $sales['sales'][ $i ]['subtotal'] = edd_get_payment_subtotal( $payment->ID ); $sales['sales'][ $i ]['tax'] = edd_get_payment_tax( $payment->ID ); $sales['sales'][ $i ]['fees'] = edd_get_payment_fees( $payment->ID ); $sales['sales'][ $i ]['total'] = edd_get_payment_amount( $payment->ID ); $sales['sales'][ $i ]['gateway'] = edd_get_payment_gateway( $payment->ID ); $sales['sales'][ $i ]['email'] = edd_get_payment_user_email( $payment->ID ); $sales['sales'][ $i ]['date'] = $payment->post_date; $sales['sales'][ $i ]['products'] = array(); $c = 0; foreach ( $cart_items as $key => $item ) { $item_id = isset( $item['id'] ) ? $item['id'] : $item; $price = isset( $item['price'] ) ? $item['price'] : false; $price_id = isset( $item['item_number']['options']['price_id'] ) ? $item['item_number']['options']['price_id'] : null; $quantity = isset( $item['quantity'] ) && $item['quantity'] > 0 ? $item['quantity'] : 1; if( ! $price ) { // This function is only used on payments with near 1.0 cart data structure $price = edd_get_download_final_price( $item_id, $user_info, null ); } $price_name = ''; if ( isset( $item['item_number'] ) && isset( $item['item_number']['options'] ) ) { $price_options = $item['item_number']['options']; if ( isset( $price_options['price_id'] ) ) { $price_name = edd_get_price_option_name( $item['id'], $price_options['price_id'], $payment->ID ); } } $sales['sales'][ $i ]['products'][ $c ]['quantity'] = $quantity; $sales['sales'][ $i ]['products'][ $c ]['name'] = get_the_title( $item['id'] ); $sales['sales'][ $i ]['products'][ $c ]['price'] = $price; $sales['sales'][ $i ]['products'][ $c ]['price_name'] = $price_name; $c++; } $i++; } } return $sales; }
/** * Filter purchase summaries to adapt for Stripe deposits * * @since 1.0.4 * @param string $summary The current summary * @param array $purchase_data The data for a given purchase * @param bool $email * @return string $summary The updated summary */ function edd_wallet_maybe_override_summary($summary, $purchase_data, $email) { // Get the payment ID $payment = edd_get_payment_by('key', $purchase_data['purchase_key']); if ($payment) { $payment_id = $payment->ID; // Get the payment fees $fees = edd_get_payment_fees($payment_id); if ($fees && count($fees) == 1) { if ($fees[0]['id'] == 'edd-wallet-deposit') { $summary = edd_get_option('edd_wallet_deposit_description', __('Deposit to wallet', 'edd-wallet')); } } } return $summary; }
?> <tr> <td class="edd_receipt_payment_status"><strong><?php _e('Payment Status', 'edd'); ?> :</strong></td> <td class="edd_receipt_payment_status <?php echo strtolower($status); ?> "><?php echo $status; ?> </td> </tr> <?php if ($fees = edd_get_payment_fees($payment->ID, $meta)) { ?> <tr> <td><strong><?php _e('Fees', 'edd'); ?> :</strong></td> <td> <ul class="edd_receipt_fees"> <?php foreach ($fees as $fee) { ?> <li> <span class="edd_fee_label"><?php echo esc_html($fee['label']); ?>
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); } } }
/** * Retrieve payments. * * The query can be modified in two ways; either the action before the * query is run, or the filter on the arguments (existing mainly for backwards * compatibility). * * @access public * @since 1.8 * @return object */ public function get_payments() { do_action('edd_pre_get_payments', $this); $query = new WP_Query($this->args); if ('payments' != $this->args['output']) { return $query->posts; } if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $details = new stdClass(); $payment_id = get_post()->ID; $details->ID = $payment_id; $details->date = get_post()->post_date; $details->post_status = get_post()->post_status; $details->total = edd_get_payment_amount($payment_id); $details->subtotal = edd_get_payment_subtotal($payment_id); $details->tax = edd_get_payment_tax($payment_id); $details->fees = edd_get_payment_fees($payment_id); $details->key = edd_get_payment_key($payment_id); $details->gateway = edd_get_payment_gateway($payment_id); $details->user_info = edd_get_payment_meta_user_info($payment_id); $details->cart_details = edd_get_payment_meta_cart_details($payment_id, true); if (edd_get_option('enable_sequential')) { $details->payment_number = edd_get_payment_number($payment_id); } $this->payments[] = apply_filters('edd_payment', $details, $payment_id, $this); } wp_reset_postdata(); } do_action('edd_post_get_payments', $this); return $this->payments; }
<td><?php echo date_i18n(get_option('date_format'), strtotime($meta['date'])); ?> </td> </tr> <?php } ?> <?php if ($fees = edd_get_payment_fees($payment->ID, 'fee')) { ?> <tr> <td><strong><?php _e('Fees', 'edd_downloads'); ?> :</strong></td> <td> <ul class="edd_receipt_fees"> <?php foreach ($fees as $fee) {