?> <tr> <td class="evt_category"><?php echo $label; ?> </td> <td class="evt_curr"><?php echo curr($amount_ht); ?> €</td> <td class="evt_curr"><?php echo curr($tax); ?> %</td> <td class="evt_curr"><?php echo curr($amount_ttc); ?> €</td> <td class="evt_curr"><?php echo $remaining; ?> </td> </tr> <?php } ?> </table> <?php if ($event->can_be_administrated()) { ?> <div id="evt_status" class="evt_shadowed">
€</td> </tr> <tr> <th class="th_left">{{Organizer revenue}}</th> <td class="evt_curr"><b><?php echo curr($report['organizer_revenue']); ?> €</b></td> </tr> </table> <br/> {{For information:}}<br/> <table class="eb_report"> <tr> <th class="th_left">{{Paypal fees}}</th> <td class="evt_curr"><?php echo curr($report['paypal_fee']); ?> €</td> </tr> <tr> <th class="th_left">{{Real Event-Biller fees}}</th> <td class="evt_curr"><?php echo curr($report['real_eb_fee']); ?> €</td> </tr> </table> </td> </tr> </table>
function command_regular($tickets, $event, $tax_array) { ?> <table id="tickets" class="evt_table inline"> <tr> <th>{{Ticket rate}}</th> <th>{{Unit price}} (€)</th> <th>{{Quantity}}</th> <th>{{Total tax excluded}} (€)</th> <th>{{Tax}} (%)</th> <th>{{Tax amount}} (€)</th> <th>{{Total due}} (€)</th> </tr> <?php $i = 0; foreach ($tickets as $ticket) { $event_title = $event->title; $amount_ht = str_replace(",", "", curr($ticket->amount)); $label = $ticket->name; $tax_rate = $ticket->tax_rate; $remaining = $ticket->get_remaining(); ?> <tr id="ticket_<?php echo $i; ?> "> <td><?php echo $label; ?> </td> <td id="unit_price_<?php echo $i; ?> " class="evt_curr"> <?php echo $amount_ht; ?> </td> <td> <input id="<?php echo $i; ?> _amount" type="number" min="0" max="<?php echo $remaining; ?> " name="ticket_<?php echo $i; ?> " value="<?php echo_default_value("ticket_{$ticket->id}", 0); ?> " data-id="<?php echo $i; ?> " data-type="quantity" /> <br/> <span id="max_quantity_info_<?php echo $i; ?> " class="form_help"> {{Max:}} <?php echo $remaining; ?> </span> </td> <td id="total_ticket_ht_<?php echo $i; ?> " class="evt_curr" data-type="amount_ht">0.00</td> <td id="tax_rate_<?php echo $i; ?> " class="evt_curr" data-type="tax" data-value="<?php echo str_replace('.', '_', $tax_rate); ?> "> <?php echo $tax_rate; ?> </td> <td id="tax_amount_<?php echo $i; ?> " class="evt_curr" data-type="tax_amount">0.00</td> <td id="ttc_<?php echo $i; ?> " class="evt_curr">0.00</td> </tr> <?php $i++; } ?> <tr> <th class="th_left" colspan="3">Total</th> <td id="sub_total" class="evt_curr">0.00</td> </tr> </table> <script> var rate_nbr = <?php echo count($tickets); ?> ; var max_reached = "{{Max quantity reached}}"; var tax_nbr = <?php echo count($tax_array); ?> ; var taxes = new Array( <?php $is_first = TRUE; $i = 0; foreach ($tax_array as $tax_rate) { if ($is_first) { $is_first = FALSE; } else { echo ','; } echo "new Array('{$tax_rate}', '{$i}')"; $i++; } ?> ); $(function() { $('input[data-type="quantity"]').change(eb_sync_amount); $('input[data-type="quantity"]').keyup(eb_sync_amount); $('input[data-type="quantity"]').each(eb_sync_amount); }); function eb_sync_amount() { var quantity = Math.abs($(this).val()); var max_quantity = $(this).attr('max'); if (quantity > max_quantity) { quantity = max_quantity; } $(this).val(quantity); var id = $(this).attr('data-id'); var unit_price = $('#unit_price_' + id).html(); var total_ht = quantity * unit_price; log($('#total_ticket_ht_' + id)); $('#total_ticket_ht_' + id).html(eb_curr(total_ht)); var tax_rate = $('#tax_rate_' + id).html(); var tax_amount = eb_curr((tax_rate/100) * total_ht); $('#tax_amount_' + id).html(tax_amount); var ttc = parseFloat(tax_amount) + parseFloat(total_ht); log(tax_amount + '+' + total_ht + '=' + ttc); $('#ttc_' + id).html(eb_curr(ttc)); var sub_total = 0; for (i = 0; i < rate_nbr; i++) { var current = $('#total_ticket_ht_' + i).html(); sub_total = parseFloat(sub_total) + parseFloat(current); } $('#sub_total').html(eb_curr(sub_total)); eb_update_total(); eb_sync_next_button(); } function eb_sync_next_button_spec() { var quantity_test = false; $("input[id*='_amount']").each(function(){ if ($(this).val() > 0) { quantity_test = true; } }); return quantity_test; } </script> <?php }
public static function invoice_from_report($report, $event) { $bill = new Bill(); $bill->user_id = $_SESSION['user_id']; $bill->target = BILL_TARGET_ORGANIZER; $bill->client_name = $event->organizer_name; $bill->event_id = $event->id; $bill->client_address_id = $event->billing_address_id; $bill->client_vat = $event->vat; $bill->type = BILL_TYPE_INVOICE; $organizer = User::get_biller(); $bill->biller_address_id = $organizer->address_id; $bill->biller_name = $organizer->get_company_name(); $bill->biller_vat = $organizer->vat; $label = "Event-Biller-I-"; $bill->label = $label . "EVT-" . sprintf("%06d", $event->id); $tickets = $event->get_tickets(); $item = new Item('/item/service_fee'); $item->quantity = 1; $sold_ticket_nbr = $report["ticket_quantity"]; $rate = deal_get_description($event->deal_name); $amount_ticket_sales = $report['total']; $item->description = <<<EOF <b>{{Ticket sales fees}}</b><br/> {{Amount ticket sales:}} {$amount_ticket_sales}€ {{Sold ticket number:}} {$sold_ticket_nbr}<br/> {{Rate details:}} {$rate} EOF; $item->tax_rate = 19.6; $item->total_ttc = curr($report['eb_fee']); $item->total_ht = curr($item->total_ttc / (1 + $item->tax_rate / 100)); $item->total_tax = $item->total_ttc - $item->total_ht; $bill->items[] = $item; $bill->compute(); return $bill; }
,<br/> You have made a payment authorization for the following quotation.<br/> If the event is confirmed, you will receive an invoice and your payment will be captured.<br/> If the event is cancelled, your payment authorization will be also cancelled and you will receive a notification by email.<br/> </p> <?php print_bill($bill); ?> <br/> <br/> <p> Please make sure that the amount of <b><?php echo curr($bill->total_ttc); ?> €</b> will be avalable for at least <?php echo AUTHORIZATION_DELAY; ?> days.<br/> You can access to this quotation via this permalink: <a href="<?php echo $bill->url(); ?> "><?php echo $bill->url(); ?> </a> </p>
$rowspan = count($tickets) + 2; $ticket_table .= <<<EOF \t</tr> \t<tr> \t\t<th>{{Categories}}</th> \t\t<th>{{Unit price}}</th> \t\t<th>{{Taxes}}</th> \t\t<th>{{Total due}}</th> \t\t<th>{{Remaining}}</th> \t</tr> EOF; foreach ($tickets as $ticket) { $tax = curr($ticket->tax_rate); $label = $ticket->name; $amount_ht = curr($ticket->amount); $amount_ttc = curr($amount_ht * ($tax / 100 + 1)); $remaining = $ticket->get_remaining(); if ($remaining <= 0) { $remaining = 0; } $ticket_table .= <<<EOF \t<tr> \t\t<td class="evt_category">{$label}</td> \t\t<td class="evt_curr">{$amount_ht}€</td> \t\t<td class="evt_curr">{$tax}%</td> \t\t<td class="evt_curr">{$amount_ttc}€</td> \t\t<td class="evt_curr">{$remaining}</td> \t</tr> EOF; } $ticket_table .= <<<EOF
function generateGoogleCAN() { date_default_timezone_set("America/Denver"); //include( plugin_dir_path( __FILE__ ) . 'functions.php'); global $woocommerce, $product, $post, $re_wcvt_options, $xml; $args = array('post_type' => 'product', 'posts_per_page' => -1); $loop = new WP_Query($args); $xml = new DOMDocument('1.0', 'UTF-8'); $xml->formatOutput = true; $rss = $xml->createElement("rss"); $rss_node = $xml->appendChild($rss); //add RSS element to XML node $rss_node->setAttribute("version", "2.0"); //set RSS version $rss_node->setAttribute("xmlns:atom", "http://www.w3.org/2005/Atom"); $rss_node->setAttribute("xmlns:g", "http://base.google.com/ns/1.0"); $currentItem = $xml->createElement("channel"); $currentItem = $rss_node->appendChild($currentItem); $currentItem->appendChild($xml->createElement('title', 'Novosbed')); $buildLinks = $xml->createElement('link'); $buildLinks = $currentItem->appendChild($buildLinks); $buildLinks->appendChild($xml->createCDATASection('http://wwww.novosbed.com')); $currentItem->appendChild($xml->createElement('description', '----------------------------------------------')); while ($loop->have_posts()) { $loop->the_post(); global $product; $product = get_product($loop->post); $attributes = $product->get_attributes(); //print_r($product); // Debug option make sure is commented out live //print_r($attributes); //checks if product is in stock and visable to public. if ($product->is_in_stock() && $product->is_visible()) { /* append it to the document created */ // Checks if product has sizes (twin/twin XL.. etc) if ($product->has_child()) { // Loops through products and gets variation attriubtes (sku/weight/etc) $ProdVar = $product->get_available_variations(); foreach ($ProdVar as $Variation) { $buildItem = $xml->createElement("item"); $buildItem = $currentItem->appendChild($buildItem); $buildItem->appendChild($xml->createElement('g:title', ucfirst(get_the_title()) . ' ' . ucfirst($Variation['attributes']['attribute_pa_firmness']))); // This is not working yet $buildLink = $xml->createElement('g:link'); $buildLink = $buildItem->appendChild($buildLink); $buildLink->appendChild($xml->createCDATASection(ucfirst(get_permalink()))); $buildItem->appendChild($xml->createElement('g:type', ucfirst(getGType()))); $buildCat = $xml->createElement('g:google_product_catergory'); $buildCat = $buildItem->appendChild($buildCat); $buildCat->appendChild($xml->createCDATASection(getCat())); $buildItem->appendChild($xml->createElement('g:brand', brand())); $buildItem->appendChild($xml->createElement('g:availablility', 'In Stock')); $buildItem->appendChild($xml->createElement('g:condition', 'New')); //Add shipping branch $buildShipping = $xml->createElement("g:shipping"); $buildShipping = $buildItem->appendChild($buildShipping); $buildShipping->appendChild($xml->createElement('g:country', 'CAN')); $buildShipping->appendChild($xml->createElement('g:service', 'FedEx Ground')); $buildShipping->appendChild($xml->createElement('g:price', '0.00 CAD')); //Back to Item $buildItem->appendChild($xml->createElement('g:ID', $Variation['sku'] . 'CAN')); // loop multi dimensional array to get size $buildItem->appendChild($xml->createElement('g:size', ucfirst($Variation['attributes']['attribute_pa_size']))); $buildItem->appendChild($xml->createElement('g:price', '$' . curr($Variation) . ' CAD')); // Strips 'lbs' from weight retrived even if empty variable $weight = str_replace(array(' ', 'l', 'b', 's'), '', $Variation['weight']); if (!empty($weight)) { // if number remains print weight + lbs $buildItem->appendChild($xml->createElement('g:weight', $weight . ' lbs')); } if (!empty($Variation['dimensions'])) { // if product has data in dimensions will echo $buildItem->appendChild($xml->createElement('g:dimensions', $Variation['dimensions'])); } $buildDesc = $xml->createElement('g:description'); $buildDesc = $buildItem->appendChild($buildDesc); $buildDesc->appendChild($xml->createCDATASection(strip_tags($Variation['variation_description']))); //print_r($Variation); // Debug option make sure is commented out live // loops through gallry image items and retrives file path. if (metadata_exists('post', $post->ID, '_product_feed_gallery')) { $product_image_gallery = get_post_meta($post->ID, '_product_feed_gallery', true); $attachments = array_filter(explode(',', $product_image_gallery)); if ($attachments) { $i = 0; foreach ($attachments as $attachment_id) { $image_link = wp_get_attachment_url($attachment_id); if ($i < 1) { $buildImage = $xml->createElement('g:image'); $buildImage = $buildItem->appendChild($buildImage); $buildImage->appendChild($xml->createCDATASection($image_link)); $i++; } else { $buildAddImage = $xml->createElement('g:additional_image'); $buildAddImage = $buildItem->appendChild($buildAddImage); $buildAddImage->appendChild($xml->createCDATASection($image_link)); $i++; } } } } // end foreach// end foreach $buildItem->appendChild($xml->createElement('g:mpn', $Variation['sku'] . 'CAN')); } } //echo '<br>'; } // Loop trough rest of products available that have no sizes. //checks for products with no child objects and is visable if (!$product->has_child() && $product->is_visible()) { $buildItem = $xml->createElement("item"); $buildItem = $currentItem->appendChild($buildItem); $buildItem->appendChild($xml->createElement('g:title', get_the_title())); // This is not working yet $buildLink = $xml->createElement('g:link'); $buildLink = $buildItem->appendChild($buildLink); $buildLink->appendChild($xml->createCDATASection(ucfirst(get_permalink()))); $buildItem->appendChild($xml->createElement('g:type', getGType())); $buildCat = $xml->createElement('g:google_product_catergory'); $buildCat = $buildItem->appendChild($buildCat); $buildCat->appendChild($xml->createCDATASection(getCat())); $buildItem->appendChild($xml->createElement('g:brand', brand())); $buildItem->appendChild($xml->createElement('g:availablility', 'In Stock')); $buildItem->appendChild($xml->createElement('g:condition', 'New')); //Add shipping branch $buildShipping = $xml->createElement("g:shipping"); $buildShipping = $buildItem->appendChild($buildShipping); $buildShipping->appendChild($xml->createElement('g:country', 'CAN')); $buildShipping->appendChild($xml->createElement('g:service', 'FedEx Ground')); $buildShipping->appendChild($xml->createElement('g:price', '0.00 CAD')); //Back to Item $buildItem->appendChild($xml->createElement('g:ID', $product->sku . 'CAN')); //$buildItem->appendChild($xml->createElement('g:size', ucfirst($Variation['attributes']['attribute_pa_size']))); $buildItem->appendChild($xml->createElement('g:price', '$' . $product->price . ' CAD')); // Strips 'lbs' from weight retrived even if empty variable $weight = str_replace(array(' ', 'l', 'b', 's'), '', $product->weight); if (!empty($weight)) { // if number remains print weight + lbs $buildItem->appendChild($xml->createElement('g:weight', $product->weight . ' lbs')); } if (!empty($product->length)) { // if product has data in dimensions will echo $buildItem->appendChild($xml->createElement('g:dimensions', $product->length . '"x' . $product->width . '"x' . $product->height . '"')); } $buildDesc = $xml->createElement('g:description'); $buildDesc = $buildItem->appendChild($buildDesc); $buildDesc->appendChild($xml->createCDATASection(strip_tags(description($post)))); if (metadata_exists('post', $post->ID, '_product_feed_gallery')) { $product_image_gallery = get_post_meta($post->ID, '_product_feed_gallery', true); $attachments = array_filter(explode(',', $product_image_gallery)); if ($attachments) { $i = 0; foreach ($attachments as $attachment_id) { $image_link = wp_get_attachment_url($attachment_id); if ($i < 1) { $buildImage = $xml->createElement('g:image'); $buildImage = $buildItem->appendChild($buildImage); $buildImage->appendChild($xml->createCDATASection($image_link)); $i++; } else { $buildAddImage = $xml->createElement('g:additional_image'); $buildAddImage = $buildItem->appendChild($buildAddImage); $buildAddImage->appendChild($xml->createCDATASection($image_link)); $i++; } } } } // end foreach// end foreach $buildItem->appendChild($xml->createElement('g:mpn', $product->sku . 'CAN')); } } echo writeFileCAN($xml); wp_reset_query(); }
function generateCritCAN() { date_default_timezone_set("America/Denver"); //include( plugin_dir_path( __FILE__ ) . 'functions.php'); global $woocommerce, $product, $post, $re_wcvt_options, $xml; $args = array('post_type' => 'product', 'posts_per_page' => -1); $loop = new WP_Query($args); $xml = new DOMDocument('1.0', 'UTF-8'); $xml->formatOutput = true; $currentItem = $xml->createElement("products"); $currentItem = $xml->appendChild($currentItem); while ($loop->have_posts()) { $loop->the_post(); global $product; $product = get_product($loop->post); $attributes = $product->get_attributes(); //print_r($product); // Debug option make sure is commented out live //print_r($attributes); //checks if product is in stock and visable to public. if ($product->is_in_stock() && $product->is_visible()) { /* append it to the document created */ // Checks if product has sizes (twin/twin XL.. etc) if ($product->has_child()) { // Loops through products and gets variation attriubtes (sku/weight/etc) $ProdVar = $product->get_available_variations(); foreach ($ProdVar as $Variation) { $buildItem = $xml->createElement("product"); $buildItem->setAttribute("ID", $Variation['variation_id']); $buildItem = $currentItem->appendChild($buildItem); $buildItem->appendChild($xml->createElement('name', ucfirst(get_the_title()) . ' ' . ucfirst($Variation['attributes']['attribute_pa_firmness']) . ' - ' . ucfirst($Variation['attributes']['attribute_pa_size']))); $buildLink = $xml->createElement('producturl'); $buildLink = $buildItem->appendChild($buildLink); $buildLink->appendChild($xml->createCDATASection(ucfirst(get_permalink()))); if (metadata_exists('post', $post->ID, '_product_feed_gallery')) { $product_image_gallery = get_post_meta($post->ID, '_product_feed_gallery', true); $attachments = array_filter(explode(',', $product_image_gallery)); if ($attachments) { $i = 0; foreach ($attachments as $attachment_id) { $image_link = wp_get_attachment_url($attachment_id); if ($i < 1) { $big = wp_get_attachment_image_src($attachment_id, 'full'); $small = wp_get_attachment_image_src($attachment_id, 'medium'); $buildImageSmall = $xml->createElement('smallimage'); $buildImageSamll = $buildItem->appendChild($buildImageSmall); $buildImageSmall->appendChild($xml->createCDATASection($small[0])); $buildImage = $xml->createElement('bigimage'); $buildImage = $buildItem->appendChild($buildImage); $buildImage->appendChild($xml->createCDATASection($big[0])); $i++; } } } } $buildDesc = $xml->createElement('description'); $buildDesc = $buildItem->appendChild($buildDesc); $buildDesc->appendChild($xml->createCDATASection(strip_tags($Variation['variation_description']))); $buildItem->appendChild($xml->createElement('price', strip_tags(curr($Variation)))); if ($product->is_in_stock()) { $buildItem->appendChild($xml->createElement('instock', '1')); } else { $buildItem->appendChild($xml->createElement('instock', '0')); } //print_r(CatID()); $buildItem->appendChild($xml->createElement('categoryid1', CatID()[0])); $buildItem->appendChild($xml->createElement('categoryid2', CatID()[1])); $buildItem->appendChild($xml->createElement('categoryid3', CatID()[2])); } } } // Loop trough rest of products available that have no sizes. //checks for products with no child objects and is visable if (!$product->has_child() && $product->is_visible()) { // print_r($product); $buildItem = $xml->createElement("product"); $buildItem->setAttribute("ID", $product->id); $buildItem = $currentItem->appendChild($buildItem); $buildItem->appendChild($xml->createElement('name', get_the_title())); $buildLink = $xml->createElement('producturl'); $buildLink = $buildItem->appendChild($buildLink); $buildLink->appendChild($xml->createCDATASection(ucfirst(get_permalink()))); if (metadata_exists('post', $post->ID, '_product_feed_gallery')) { $product_image_gallery = get_post_meta($post->ID, '_product_feed_gallery', true); $attachments = array_filter(explode(',', $product_image_gallery)); if ($attachments) { $i = 0; foreach ($attachments as $attachment_id) { $image_link = wp_get_attachment_url($attachment_id); if ($i < 1) { $big = wp_get_attachment_image_src($attachment_id, 'full'); $small = wp_get_attachment_image_src($attachment_id, 'medium'); $buildImageSmall = $xml->createElement('smallimage'); $buildImageSamll = $buildItem->appendChild($buildImageSmall); $buildImageSmall->appendChild($xml->createCDATASection($small[0])); $buildImage = $xml->createElement('bigimage'); $buildImage = $buildItem->appendChild($buildImage); $buildImage->appendChild($xml->createCDATASection($big[0])); $i++; } } } } $buildDesc = $xml->createElement('description'); $buildDesc = $buildItem->appendChild($buildDesc); $buildDesc->appendChild($xml->createCDATASection(strip_tags(description($post)))); $buildItem->appendChild($xml->createElement('price', strip_tags($product->price))); $buildItem->appendChild($xml->createElement('categoryid1', CatID()[0])); $buildItem->appendChild($xml->createElement('categoryid2', CatID()[1])); $buildItem->appendChild($xml->createElement('categoryid3', CatID()[2])); } } echo writeFileCritCAN($xml); wp_reset_query(); }
$payment_type = "Pending"; } ?> <html> <head> <title>Execute payment</title> </head> <body> <!-- action=payment_success&tx=2MN52113X70237425&st=Pending&amt=1.20&cc=EUR&cm=&item_number= --> <p><?php print_r($_GET); ?> </p> <p>Do you want to proceed?</p> <a href="../../index.php?action=payment_success&tx=2MN52113X7023<?php printf("%04d", rand(0, 9999)); ?> &st=<?php echo $payment_type; ?> &amt=<?php echo curr($_GET["amount"]); ?> &cc=<?php echo $_GET["currency_code"]; ?> &cm=&item_number=">Yes</a> <a href="../../index.php?action=payment_cancel">No</a> <a href="../../index.php">Good Bye</a> </body> </html>