📁
SKYSHELL MANAGER
PHP v8.3.31
Create
Create
Path:
root
/
home
/
envelopeexpertsc
/
public_html
/
Name
Size
Perm
Actions
📁
.well-known
-
0755
🗑️
🏷️
🔒
📁
cgi-bin
-
0755
🗑️
🏷️
🔒
📁
vendor
-
0755
🗑️
🏷️
🔒
📁
wp-admin
-
0755
🗑️
🏷️
🔒
📁
wp-content
-
0755
🗑️
🏷️
🔒
📁
wp-includes
-
0755
🗑️
🏷️
🔒
📄
.env
0.23 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
.htaccess
5.22 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
.user.ini
0.68 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
Guide_to_Image_Artwork_Area.pdf
133.58 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
STU BACKUP page-instant-quote.php
114.32 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
STU BACKUP page-orders.php
237.12 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
STU BACKUP page-quotes.php
182.42 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
brand.png
84.94 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
email.png
9.59 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
error_log
1473.6 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
index-maintenance.php
0.69 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
index-new.php
0.4 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
index.php
0.4 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
license.txt
19.44 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
php.ini
0.72 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
readme.a95cd84fb3cdd6dc02c7f52173c2e4bd.html
7.23 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wordfence-waf.php
0.4 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-activate.php
7.2 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-blog-header.php
0.34 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-comments-post.php
2.27 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-config-sample.php
3.26 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-config.php
3.57 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-cron.php
5.49 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-links-opml.php
2.43 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-load.php
3.84 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-login.php
50.63 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-mail.php
8.52 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-settings.php
31.88 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-signup.php
33.81 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-trackback.php
5.09 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
xmlrpc.php
3.13 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
Edit: STU BACKUP page-orders.php
<?php get_header(); if ( is_user_logged_in() ) { global $wpdb; $dsbf_debug = false; $month = date( 'm' ); $year = date( 'Y' ); $disabled = ''; // Start - calculate total posts that are not PRINTED (Stuart re-worded to (not DISPATCHED)) $wip_orders_args = array( 'post_type' => 'envelope_orders', 'post_status' => 'publish', 'posts_per_page' => -1, 'date_query' => array( 'year' => $year, 'month' => $month ), 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'status', 'value' => array( 'DISPATCHED', 'PRINTED' ), 'compare' => 'NOT IN', ) ) ); $wip_orders = new WP_Query( $wip_orders_args ); $wip_post_id_list = array(); $wip_status_list = array(); $wip_orders_count = $wip_orders->found_posts; // reset posts cursor and removes filter get_posts(); // End - calculate total posts that are not PRINTED (Stuart re-worded to (not DISPATCHED)) // Start - calculate Average Turnaround define( 'POST_COUNT', 50 ); $average_turnaround_args = array( 'post_type' => 'envelope_orders', 'post_status' => 'publish', 'posts_per_page' => POST_COUNT, 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'status', 'value' => 'DISPATCHED', 'compare' => '=', 'order' => 'DESC', 'orderby' => 'date_dispatched' ) ) ); $avrg_trnrnd_posts = new WP_Query( $average_turnaround_args ); if ( $avrg_trnrnd_posts->have_posts() ) : $post_index = 0; $despatched_within_target = 0; $despatched_over_target = 0; $average_ta = 0; while ( $avrg_trnrnd_posts->have_posts() && $post_index <= POST_COUNT ) : $avrg_trnrnd_posts->the_post(); $post_index ++; $order_date = date_create( get_the_time( 'y-m-d g:i a' ) ); $date_dispatched = date_create( date( 'y-m-d g:i a', get_post_meta( get_the_ID(), 'date_dispatched', true ) ) ); $date_difference = date_diff( $date_dispatched, $order_date ); $average_ta += $date_difference->days; if ( $date_difference->days <= 2 ) { $despatched_within_target ++; } else if ( $date_difference->days > 2 ) { $despatched_over_target ++; } endwhile; $average_turnaround = $average_ta / POST_COUNT; //$average_turnaround = round($average_turnaround); $percent_within_target = $despatched_within_target * 100 / POST_COUNT; $percent_over_target = $despatched_over_target * 100 / POST_COUNT; endif; // reset post cursor get_posts(); // End - calculate Average Turnaround // Start - calculate COD Orders $cod_orders_args = array( 'post_type' => 'envelope_orders', 'post_status' => 'publish', 'nopaging' => true,// 'posts_per_page' => -1, 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'status', 'value' => 'PAYMENT-REQ', 'compare' => '=', ) ) ); $cod_orders_posts = new WP_Query( $cod_orders_args ); $cod_orders_count = $cod_orders_posts->found_posts; // reset post cursor get_posts(); // End - calculate COD Orders // Start - calculate Total Sales MTD $last_day = date( 'd' ); $date_start = strtotime( $year . '-' . $month . '-' . 1 ); $date_end = strtotime( $year . '-' . $month . '-' . $last_day ); $total_sales_mtd_args = array( 'post_type' => 'envelope_orders', 'post_status' => 'publish', 'posts_per_page' => -1, 'date_query' => array( 'year' => $year, 'month' => $month ) ); $total_sales_mtd_posts = new WP_Query( $total_sales_mtd_args ); $total_sales_mtd = 0; if ( $total_sales_mtd_posts->have_posts() ) { while ( $total_sales_mtd_posts->have_posts() ) { $total_sales_mtd_posts->the_post(); $is_dispatched = get_post_meta( get_the_ID(), 'status', true ); //if ( strtolower( $is_dispatched ) === 'dispatched' ) { $total_sales_mtd += (float) get_post_meta( get_the_ID(), 'total_amount', true ); //} } } $total_sales_mtd = round( $total_sales_mtd ); // reset post cursor get_posts(); // End - calculate Total Sales MTD if ( isset( $_GET['download'] ) ) { $action = $_GET['download']; $start_date = $_GET['start_date']; $startDates = explode( '-', $start_date ); $startDay = $startDates[0]; $startMonth = $startDates[1]; $startYear = $startDates[2]; $end_date = $_GET['end_date']; $endDates = explode( '-', $end_date ); $endDay = $endDates[0]; $endMonth = $endDates[1]; $endYear = $endDates[2]; global $wpdb; $filename = "orders.csv"; $fh = fopen( 'php://output', 'w' ); header( 'Content-Encoding: UTF-8' ); header( "Content-type: text/csv; charset=UTF-8" ); header( "Content-Disposition: attachment; filename={$filename}" ); header( "Pragma: no-cache" ); header( "Expires: 0" ); echo "\xEF\xBB\xBF"; $header = array( 'post ID', 'Co./Last Name', 'Job Ref / PO', 'Order / Invoice No.', 'Date Despatched', 'Job Title', 'PMS Colours', 'Item Number', 'Quantity', 'Description', 'Ex-Tax Amount', 'Total Price', 'GST Amount', 'Tax Code', 'Freight', 'Freight Tax Code', 'Amount Paid', 'Delivery Status', 'Status' ); fputcsv( $fh, $header ); $args = array( 'post_type' => 'envelope_orders', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'order' => 'DESC', 'posts_per_page' => -1, 'paged' => $paged, 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'status', 'value' => array( 'DISPATCHED', 'COMPLETED' ), 'compare' => 'IN' ), array( 'key' => 'date_dispatched', 'value' => strtotime( $start_date ), 'compare' => '>=' ), array( 'key' => 'date_dispatched', 'value' => strtotime( $end_date . '+1 day' ), 'compare' => '<=' ) ) ); $quotes = new WP_Query( $args ); $temp_array = array(); if ( $quotes->have_posts() ) : while ( $quotes->have_posts() ) : $quotes->the_post(); $user_id = get_post_meta( get_the_ID(), 'user_id', true ); $company = get_post_meta( get_the_ID(), 'business_name', true ); $job_ref = get_post_meta( get_the_ID(), 'job_reference', true ); $job_title = get_post_meta( get_the_ID(), 'job_title', true ); $order_num = get_post_meta( get_the_ID(), 'invoice_number', true ); $front_colours = get_post_meta( get_the_ID(), 'front_colours_desc', true ); $back_colours = get_post_meta( get_the_ID(), 'back_colours_desc', true ); $pms_colours = $front_colours . ',' . $back_colours; $product_code = get_post_meta( get_the_ID(), 'product_code', true ); $metalic_ink = get_post_meta( get_the_ID(), 'metalic_ink', true ); $date_despatched = date( 'd-m-Y', get_post_meta( get_the_ID(), 'date_dispatched', true ) ); $status = get_post_meta( get_the_ID(), 'status', true ); $p1_qty = get_post_meta( get_the_ID(), 'p1_quantity1', true ); $p1_qty_1 = round( $p1_qty / 1000, 2 ); $product_name = get_post_meta( get_the_ID(), 'product_name', true ); $p2_require = get_post_meta( get_the_ID(), 'product2_require', true ); $print_code = get_post_meta( get_the_ID(), 'print_code', true ); $stock_rate1 = get_post_meta( get_the_ID(), 'stock_rate', true ); $total_p1 = floatval( $p1_qty_1 * $stock_rate1 ); // $tax = $total / 10; $freight = get_post_meta( get_the_ID(), 'deliveryfee', true ); $amount_paid = 0; $gst_amt = ( $total_p1 + $freight ) * 0.1; $tax_code = 'GST'; $delivery_status = 'E'; // product 1 $item_arr = array( get_the_ID(), // todo: remove $company, $job_ref, $order_num, $date_despatched, $job_title, $pms_colours, $product_code, $p1_qty_1, $product_name, $stock_rate1, $total_p1, $gst_amt, $tax_code, $freight, 'GST', $amount_paid, $delivery_status, $status ); $temp_array[] = $item_arr; fputcsv( $fh, $item_arr ); // -------------------------------------------------------------------------------- if ( $p2_require == 'Yes' ) { $product_code2 = get_post_meta( get_the_ID(), 'product_code2', true ); $product_name2 = get_post_meta( get_the_ID(), 'product_name2', true ); $p2_qty = get_post_meta( get_the_ID(), 'p2_quantity1', true ); $p2_qty_1 = round( $p2_qty / 1000, 2 ); $stock_rate2 = get_post_meta( get_the_ID(), 'stock_rate2', true ); $total_p2 = floatval( $p2_qty_1 * $stock_rate2 ); $gst_amt = ( $total_p2 + $freight ) * 0.1; $tax_code = 'GST'; $delivery_status = 'E'; // product 2 $item_arr = array( get_the_ID(), // todo: remove $company, $job_ref, $order_num, $date_despatched, $job_title, $pms_colours, $product_code2, $p2_qty_1, $product_name2, $stock_rate2, $total_p2, $gst_amt, $tax_code, $freight, 'GST', $amount_paid, $delivery_status, $status ); $temp_array[] = $item_arr; fputcsv( $fh, $item_arr ); } if ( $print_code != '' ) { $query = "SELECT * FROM `wp_printcodes_pricing` WHERE item_number = '{$print_code}'"; $print = $wpdb->get_row( $query ); $price = floatval( $print->selling_price ); $price_GST = $price / 10; $price_ex_GST = $price - $price_GST; $print_rate = floatval( get_post_meta( get_the_ID(), 'print_rate', true ) ); $perfect_fac = floatval( get_post_meta( get_the_ID(), 'perfecting_factor', true ) ); $large_fac = floatval( get_post_meta( get_the_ID(), 'large_area_factor', true ) ); $ink_fac = floatval( get_post_meta( get_the_ID(), 'ink_solids_factors', true ) ); $pr_rate = floatval( $perfect_fac + $large_fac + $ink_fac + 1 ); if ( $p2_require == 'Yes' ) { $to_qty = $p1_qty_1 + $p2_qty_1; $quantity_val = $to_qty * 1000; $sizegroup = get_post_meta( get_the_ID(), 'size_group', true ); $front_print_colours = get_post_meta( get_the_ID(), 'front_print_colours', true ); $query = "SELECT `item_number` FROM `wp_printcodes_pricing` WHERE `size_group` = '" . $sizegroup . "' AND `colours` = '" . $front_print_colours . "' AND $quantity_val BETWEEN coalesce(`qty_min`,{$quantity_val}) AND coalesce(`qty_max`,{$quantity_val})"; $printcode_result = $wpdb->get_row( $query ); $print_code = $printcode_result->item_number; } else { $to_qty = $p1_qty_1; } $pr_price = floatval( $pr_rate * $print_rate * $to_qty ); if ( $perfect_fac || $large_fac || $ink_fac ) { $print_rate = floatval( $pr_rate * $print_rate ); } $print_code_arr = explode( ',', $print_code ); foreach ( $print_code_arr as $print_code ) { $query = "SELECT * FROM `wp_printcodes_pricing` WHERE item_number = '{$print_code}'"; $print = $wpdb->get_row( $query ); $fright_price = 0; $gst_amt = ( $pr_price + $fright_price ) * 0.1; $tax_code = 'GST'; $delivery_status = 'E'; // print code product $item_arr = array( get_the_ID(), // todo: remove $company, $job_ref, $order_num, $date_despatched, $job_title, $pms_colours, $print_code, $to_qty, $print->item_name, $print_rate, $pr_price, $gst_amt, $tax_code, $fright_price, 'GST', $amount_paid, $delivery_status, $status ); $temp_array[] = $item_arr; fputcsv( $fh, $item_arr ); } } if ( $metalic_ink == 'yes' ) { $metalic_ink_price = get_post_meta( get_the_ID(), 'metalicink', true ); $gst_amt = ( $metalic_ink_price + $freight ) * 0.1; $tax_code = 'GST'; $delivery_status = 'E'; // metalic ink product $item_arr = array( get_the_ID(), // todo: remove $company, $job_ref, $order_num, $date_despatched, $job_title, $pms_colours, 'Metallic', '1', $product_name, $metalic_ink_price, $metalic_ink_price, $gst_amt, $tax_code, $freight, 'GST', $amount_paid, $delivery_status, $status ); $temp_array[] = $item_arr; fputcsv( $fh, $item_arr ); } $other_price = get_post_meta( get_the_ID(), 'other', true ); if ( $other_price > 0 ) { $other_desc = get_post_meta( get_the_ID(), 'other_cs', true ); $other_option = get_post_meta( get_the_ID(), 'other_option', true ); $gst_amt = ( $other_price + $freight ) * 0.1; $tax_code = 'GST'; $delivery_status = 'E'; // other price $item_arr = array( get_the_ID(), // todo: remove $company, $job_ref, $order_num, $date_despatched, $job_title, $pms_colours, $other_option, '1', $other_desc, $other_price, $other_price, $gst_amt, $tax_code, $freight, 'GST', $amount_paid, $delivery_status, $status ); $temp_array[] = $item_arr; fputcsv( $fh, $item_arr ); } $temp_array[] = array(); fputcsv( $fh, array() ); endwhile; wp_reset_postdata(); else : _e( 'Sorry, no orders found!' ); endif; fclose( $fh ); exit(); //} } get_header(); global $wpdb, $current_user; $allow = false; if ( is_super_admin() ) { $allow = true; } ?> <script> function movePlaceholder(e, ui) { if (ui.placeholder.prev().attr("id").length == 2) ui.placeholder.insertAfter(ui.placeholder.next()); } function hasChanged(e, ui) { var newPosition = ui.item.index(); var id = ui.item.attr("id"); } jQuery(function ($) { $('#endDate').datepicker({dateFormat: 'dd-mm-yy'}); $('#startDate').datepicker({dateFormat: 'dd-mm-yy'}); var ajaxurl = '/wp-admin/admin-ajax.php'; <?php if (isset( $_GET['order'] )) { ?> var itemList = $('#orders'); itemList.sortable({ helper: function (e, ui) { ui.children().each(function () { $(this).width($(this).width()); }); return ui; }, update: function (event, ui) { opts = { url: '<?php echo get_home_url(); ?>/wp-admin/admin-ajax.php', type: 'POST', async: true, cache: false, dataType: 'json', data: { action: 'sort_envelope_order', // Tell WordPress how to handle this ajax request order: itemList.sortable('toArray').toString() // Passes ID's of list items in 1,3,2 format }, success: function (response) { shared.eeSwal('Success!', 'Orders has been reordered successfully!', 'success'); return; }, error: function (xhr, textStatus, e) { // This can be expanded to provide more information alert(e); return; } }; $.ajax(opts); }, items: 'tr', }).disableSelection(); <?php } ?> $('.RequiredDate').datepicker({dateFormat: 'dd-mm-yy'}); $('.toggle-details').on('click', function () { $(this).parent().parent().next('tr').toggle(); $(this).toggleClass("fa-minus-square fa-plus-square"); }); $('.status').change(function () { var form = $(this).closest("form"); var formid = '#' + form.attr('id'); var ostatus = $(this).val(); var oid = $(this).parent().find('.oid').val(); var user_id = $(this).parent().find('.user_id').val(); console.log(user_id); $.ajax({ type: 'POST', url: "<?php echo get_home_url(); ?>/wp-admin/admin-ajax.php", data: { action: 'change_order_status', status: ostatus, order_id: oid, user_id: user_id }, success: function (data) { if (data.success) { } else { shared.eeSwal('Error', data, 'error'); window.location.href = url; } } }); }); $('.submitorder').click(function (e) { e.preventDefault(); var form = $(this).closest("form"); if (form.valid()) { $('body').ajaxloader(); var formData = new FormData(form[0]); $.ajax({ type: 'POST', url: "<?php echo get_home_url(); ?>/wp-admin/admin-ajax.php", data: formData, cache: false, contentType: false, processData: false, dataType: 'json', success: function (data) { $('body').ajaxloader('hide'); if (data.success) { shared.eeSwal('Success', 'The order has been updated successfully.', 'success'); //window.location.href = '<?php echo get_home_url(); ?>/orders'; } else { shared.eeSwal('Error', 'There are errors updating this order.\n' + data.error, 'error'); // window.location.href = url; } } }); } }); $('.addnew').click(function (e) { e.preventDefault(); var form = $(this).closest("form"); var formid = '#' + form.attr('id'); $('#cfid').val(formid); var cuid = $(formid + ' .user_id').val(); $('#cuid').val(cuid); var cpid = $(formid + ' .post_id').val(); $('#cpid').val(cpid); $('#contactModal').modal({ backdrop: '', keyboard: true }); }); $('#new_contact').validate({ rules: { cmName: {required: true}, cmBusinessName: {required: true}, cmAddress: {required: true}, cmComment: {required: false}, }, messages: {}, submitHandler: function (form) { var form_id = $('#cfid').val(); $('body').ajaxloader(); $.ajax({ type: 'POST', url: "<?php echo get_home_url(); ?>/wp-admin/admin-ajax.php", data: $(form).serialize(), dataType: 'json', success: function (data) { $(form_id + ' .DeliverClient option:selected').remove(); if (data.success) { $('body').ajaxloader('hide'); shared.eeSwal('Success', 'Client has been created successfully.', 'success'); $(form_id + ' .DeliverClient').append('<option value="' + data.client_id + '" address="' + data.client_address + '" selected="selected">' + data.client_name + '</option>'); $(form_id + ' .DeliverClient').select('data', { id: data.client_id, text: data.client_name }); $(form_id + ' .delivery_address').val(data.client_address); $('#contactModal').modal('hide'); } else { $('body').ajaxloader('hide'); shared.eeSwal('Error', 'Sorry there is error creating client.', 'error'); } } }); } }); $('.p1-quantity1').change(function () { var form = $(this).closest("form"); var formid = '#' + form.attr('id'); var qty = $(this).val(); var p2enabled = $(formid + ' .product2_require').val(); // todo: fix duplicate variable assignment. var quote_id = $(formid + ' .size_group').val(); var multiplier = $(formid + ' .multiplier').val(); var size_group = $(formid + ' .size_group').val(); var front_colour = $(formid + ' .print_colours').val(); var back_colour = $(formid + ' .back_print_colours').val(); var front_area = $(formid + ' .front_image_area').val(); var back_area = $(formid + ' .back_image_area').val(); var printrate = parseFloat($(formid + ' .print_rate').val()); var total = 0.00; var total1 = 0.00; var total2 = 0.00; var other = parseFloat($(formid + ' .other').val()); var p2enabled = $(formid + ' .p2_require').val(); // todo: fix duplicate variable assignment. var manual_delivery = $(formid + ' .manual_delivery').val(); if (qty != 'more' && qty != '') { // todo: fix type comparison to be more accurate if (p2enabled == 'Yes') { // todo: fix type comparison to be more accurate var p2qty = $(formid + ' .p2-quantity1').val(); if (p2qty != 'more' && p2qty != '') { // todo: fix type comparison to be more accurate var totalqty = parseInt(qty) + parseInt(p2qty); var en1price = parseFloat($(formid + ' .price').val()) * (parseInt(qty) / 1000); var en2price = parseFloat($(formid + ' .price2').val()) * (parseInt(p2qty) / 1000); total_stock = en1price + en2price; var delivery_fee = parseFloat($(formid + ' .deliveryfee').val()); if (manual_delivery == '0') { // todo: fix type comparison to be more accurate var delivery_fee = parseFloat($(formid + ' .delivery_fee').val()) * (parseInt(totalqty) / 1000); // todo: fix duplicate variable assignment. if (delivery_fee > 0 && delivery_fee <= 10) { delivery_fee = 10; } } if (front_colour == 'none' && back_colour == 'none') { // todo: fix type comparison to be more accurate var price = parseFloat($(formid + ' .price').val()); // todo: fix duplicate variable assignment. total = other + delivery_fee + total_stock; $(formid + ' .total_amount').val(total.toFixed(2)); $(formid + ' .deliveryfee').val(delivery_fee); } else { $.ajax({ type: 'post', url: "<?php echo get_home_url(); ?>/wp-admin/admin-ajax.php", data: { action: 'get_printrate', quoteid: quote_id, quantity: totalqty, sizegroup: size_group, frontarea: front_area, frontcolour: front_colour, backarea: back_area, backcolour: back_colour, multiplier: multiplier }, dataType: 'json', success: function (data) { if (parseFloat(data.print_rate) > 0) { var totalprintrate = data.print_rate; $(formid + ' .print_rate').val(data.print_rate); $(formid + ' .print_code').val(data.print_code); printtotal = parseFloat(totalqty / 1000) * totalprintrate; // todo: declare with let. total = delivery_fee + printtotal + total_stock; $(formid + ' .total_amount').val(total.toFixed(2)); $(formid + ' .deliveryfee').val(delivery_fee); calculate_total(formid); } } }); } } else { total2 = 0.00; if (front_colour == 'none' && back_colour == 'none') { // todo: fix type comparison to be more accurate var price = parseFloat($(formid + ' .price').val()); total = other + delivery_fee + total_stock; $(formid + ' .total_amount').val(total.toFixed(2)); $(formid + ' .deliveryfee').val(delivery_fee); } else { $.ajax({ type: 'post', url: "<?php echo get_home_url(); ?>/wp-admin/admin-ajax.php", data: { action: 'get_printrate', quoteid: quote_id, quantity: qty, sizegroup: size_group, frontarea: front_area, frontcolour: front_colour, backarea: back_area, backcolour: back_colour, multiplier: multiplier }, dataType: 'json', success: function (data) { if (parseFloat(data.print_rate) > 0) { printrate = data.print_rate; $(formid + ' .print_rate').val(data.print_rate); $(formid + ' .print_code').val(data.print_code); } } }); } var price = parseFloat($(formid + ' .price').val()) + parseFloat(printrate); var delivery_fee = parseFloat($(formid + ' .deliveryfee').val()); if (manual_delivery == '0') { var delivery_fee = parseFloat($(formid + ' .delivery_fee').val()) * (parseInt(qty) / 1000); if (delivery_fee > 0 && delivery_fee <= 10) { delivery_fee = 10; } } total = other + delivery_fee + parseFloat(parseInt(qty) / 1000) * price; $(formid + ' .total_amount').val('$' + total.toFixed(2)); calculate_total(formid); } } else { if (front_colour == 'none' && back_colour == 'none') { var delivery_fee = parseFloat($(formid + ' .deliveryfee').val()); if (manual_delivery == '0') { var delivery_fee = parseFloat($(formid + ' .delivery_fee').val()) * (parseInt(qty) / 1000); if (delivery_fee > 0 && delivery_fee <= 10) { delivery_fee = 10; } } var price = parseFloat($(formid + ' .price').val()); total = other + delivery_fee + parseFloat(parseInt(qty) / 1000) * price; $(formid + ' .total_amount').val(total.toFixed(2)); $(formid + ' .deliveryfee').val(delivery_fee); } else { $.ajax({ type: 'post', url: "<?php echo get_home_url(); ?>/wp-admin/admin-ajax.php", data: { action: 'get_printrate', quoteid: quote_id, quantity: qty, sizegroup: size_group, frontarea: front_area, frontcolour: front_colour, backarea: back_area, backcolour: back_colour, multiplier: multiplier }, dataType: 'json', success: function (data) { if (parseFloat(data.print_rate) > 0) { printrate = data.print_rate; $(formid + ' .print_rate').val(data.print_rate); $(formid + ' .print_code').val(data.print_code); var price = parseFloat($(formid + ' .price').val()) + parseFloat(printrate); var delivery_fee = parseFloat($(formid + ' .deliveryfee').val()); if (manual_delivery == '0') { var delivery_fee = parseFloat($(formid + ' .delivery_fee').val()) * (parseInt(qty) / 1000); if (delivery_fee > 0 && delivery_fee <= 10) { delivery_fee = 10; } } total = delivery_fee + other + parseFloat(parseInt(qty) / 1000) * price; $(formid + ' .total_amount').val('$' + total.toFixed(2)); calculate_total(formid); } } }); } } } }); $('.p2-quantity1').change(function () { var form = $(this).closest("form"); var formid = '#' + form.attr('id'); var qty = $(this).val(); var p2enabled = $(formid + ' .product2_require').val(); var quote_id = $(formid + ' .post_id').val(); var multiplier = $(formid + ' .multiplier').val(); var size_group = $(formid + ' .size_group').val(); var front_colour = $(formid + ' .print_colours').val(); var back_colour = $(formid + ' .back_print_colours').val(); var front_area = $(formid + ' .front_image_area').val(); var back_area = $(formid + ' .back_image_area').val(); var printrate = parseFloat($(formid + ' .print_rate').val()); var total = 0.00; var total1 = 0.00; var total2 = 0.00; var p2enabled = $(formid + ' .p2_require').val(); var other = parseFloat($(formid + ' .other').val()); var manual_delivery = $(formid + ' .manual_delivery').val(); if (qty != 'more' && qty != '') { // todo: fix type comparison to be more accurate if (p2enabled == 'Yes') { // todo: fix type comparison to be more accurate var p2qty = $(formid + ' .p1-quantity1').val(); if (p2qty != 'more' && p2qty != '') { // todo: fix type comparison to be more accurate var totalqty = parseInt(qty) + parseInt(p2qty); var en1price = parseFloat($(formid + ' .price').val()) * (parseInt(qty) / 1000); var en2price = parseFloat($(formid + ' .price2').val()) * (parseInt(p2qty) / 1000); // todo: total_stock = en1price + en2price; // todo: var delivery_fee = parseFloat($(formid + ' .deliveryfee').val()); // todo: if (manual_delivery == '0') { // todo: fix type comparison to be more accurate var delivery_fee = parseFloat($(formid + ' .delivery_fee').val()) * (parseInt(totalqty) / 1000); // todo: if (delivery_fee > 0 && delivery_fee <= 10) { delivery_fee = 10; } } if (front_colour == 'none' && back_colour == 'none') { // todo: var price = parseFloat($(formid + ' .price').val()); // todo: total = other + delivery_fee + total_stock; $(formid + ' .total_amount').val(total.toFixed(2)); $(formid + ' .deliveryfee').val(delivery_fee); } else { $.ajax({ type: 'post', url: "<?php echo get_home_url(); ?>/wp-admin/admin-ajax.php", data: { action: 'get_printrate', quoteid: quote_id, quantity: totalqty, sizegroup: size_group, frontarea: front_area, frontcolour: front_colour, backarea: back_area, backcolour: back_colour, multiplier: multiplier }, dataType: 'json', success: function (data) { if (parseFloat(data.print_rate) > 0) { var totalprintrate = data.print_rate; $(formid + ' .print_rate').val(data.print_rate); $(formid + ' .print_code').val(data.print_code); printtotal = parseFloat(totalqty / 1000) * totalprintrate; // todo: total = delivery_fee + printtotal + total_stock; $(formid + ' .total_amount').val(total.toFixed(2)); $(formid + ' .deliveryfee').val(delivery_fee); calculate_total(formid); } } }); } } else { total2 = 0.00; if (front_colour == 'none' && back_colour == 'none') { // todo: } else { $.ajax({ type: 'post', url: "<?php echo get_home_url(); ?>/wp-admin/admin-ajax.php", data: { action: 'get_printrate', quoteid: quote_id, quantity: qty, sizegroup: size_group, frontarea: front_area, frontcolour: front_colour, backarea: back_area, backcolour: back_colour, multiplier: multiplier }, dataType: 'json', success: function (data) { if (parseFloat(data.print_rate) > 0) { printrate = data.print_rate; $(formid + ' .print_rate').val(data.print_rate); $(formid + ' .print_code').val(data.print_code); var price = parseFloat($(formid + ' .price').val()) + parseFloat(printrate); var delivery_fee = parseFloat($(formid + ' .deliveryfee').val()); // todo: if (manual_delivery == '0') { // todo: var delivery_fee = parseFloat($(formid + ' .delivery_fee').val()) * (parseInt(qty) / 1000); // todo: if (delivery_fee > 0 && delivery_fee <= 10) { delivery_fee = 10; } } total = delivery_fee + parseFloat(parseInt(qty) / 1000) * price; $(formid + ' .total_amount').val('$' + total.toFixed(2)); calculate_total(formid); } } }); } } } } }); $('.deliveryfee,.stock_rate,.stock_rate2,.print_rate,.perfecting_factor,.large_area_factor,.ink_solids_factors,.other').keyup(function () { var near = $(this); // todo: var form = $(this).closest("form"); // todo: var formid = '#' + form.attr('id'); // todo: calculate_total(formid); }); function calculate_total(formid) { var total = 0.00; // todo: var multiplier = 1.00; // todo: var stockrate = 0.00; // todo: var printRate = 0; // todo: var p2_require = $(formid + ' .p2_require').val(); // todo: /*total = parseFloat($(formid+' .itotal').val());*/ var stock = parseFloat($(formid + ' .stock_rate').val()); // todo: var stock2 = parseFloat($(formid + ' .stock_rate2').val()); // todo: printRate = parseFloat($(formid + ' .print_rate').val()); var perfect = parseFloat($(formid + ' .perfecting_factor').val()); // todo: var large_area_factor = parseFloat($(formid + ' .large_area_factor').val()); // todo: var ink_solids_factors = parseFloat($(formid + ' .ink_solids_factors').val()); // todo: var metalicink = parseFloat($(formid + ' .metalicink').val()); // todo: var other = parseFloat($(formid + ' .other').val()); // todo: var deliveryfee = parseFloat($(formid + ' .deliveryfee').val()); // todo: multiplier = multiplier + perfect + large_area_factor + ink_solids_factors; if (p2_require == 'Yes') { // todo: var qty = parseFloat($(formid + ' .p1-quantity1').val()) / 1000; // todo: var qty2 = parseFloat($(formid + ' .p2-quantity1').val()) / 1000; // todo: } else { var qty = parseFloat($(formid + ' .p1-quantity1').val()) / 1000; // todo: var qty2 = 0; // todo: } stockrate = parseFloat(stock * qty) + parseFloat(stock2 * qty2); // todo: var qtytotal = qty + qty2; // todo: total = parseFloat((stockrate + (printRate * multiplier * qtytotal)) + deliveryfee + other + metalicink); // todo: $(formid + ' .total_amount').val(total.toFixed(2)); } // delete order function was moved to dsbf-assets/js/orders.js }); </script> <div id="main" class="lpd-page ee-loggedin-background"> <div class="container"> <div class="row"> <div class="col-md-12 page-content alt-page-content"> <?php if ( ( function_exists( 'has_post_thumbnail' ) ) && ( has_post_thumbnail() ) ) { ?> <?php $post_thumbnail_id = get_post_thumbnail_id(); ?> <?php $alt = get_post_meta( $post_thumbnail_id, '_wp_attachment_image_alt', true ); ?> <img class="page-thumbnail img-responsive" alt="<?php echo $alt; ?>" src="<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'default-page' ); echo $image[0]; ?>"/> <?php } ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php the_content(); ?> <?php endwhile; else: ?> <p> <?php _e( 'Sorry, no posts matched your criteria.', GETTEXT_DOMAIN ) ?> </p> <?php endif; $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; if ( is_super_admin() ) { $user_meta_query = array(); } else { $customer_id = $current_user->ID; $user_meta_query = array( 'key' => 'user_id', 'value' => $customer_id, 'compare' => '=', ); } if ( isset( $_GET['findJob'] ) ) { $term = $_GET['job']; $args = array( 'post_type' => 'envelope_orders', 'post_status' => 'publish', 'order' => 'DESC', 'posts_per_page' => '10', 'paged' => $paged, 'meta_query' => array( 'relation' => 'AND', array( 'value' => $term, 'compare' => 'LIKE', ), $user_meta_query, ), ); } else if ( isset( $_GET['Go'] ) ) { $size = $_GET['size'] ?? ""; $customer = $_GET['customer'] ?? ""; $status = $_GET['status'] ?? ""; $archive_date = $_GET['month'] ?? ""; if ( $size != '' ) { $size_ar = array( 'key' => 'pa_size', 'value' => $size, 'compare' => '=', ); } else { $size_ar = array(); } if ( $customer != '' ) { $customer_ar = array( 'key' => 'user_id', 'value' => $customer, 'compare' => '=', ); } else { $customer_ar = array(); } if ( $status != '' ) { $status_ar = array( 'key' => 'status', 'value' => $status, 'compare' => '=', ); } else { $status_ar = array(); } if ( $archive_date != '' ) { $dates = explode( ' ', $archive_date ); $year = $dates[1]; $month = date( 'm', strtotime( $archive_date ) ); $date_ar = array( 'after' => $year . '-' . $month . '-1 0:0:0', 'before' => $year . '-' . $month . '-31 23:59:59', ); } else { $date_ar = array(); } $args = array( 'post_type' => 'envelope_orders', 'post_status' => 'publish', 'order' => 'DESC', 'posts_per_page' => '10', 'paged' => $paged, 'meta_query' => array( 'relation' => 'AND', $size_ar, $customer_ar, $status_ar, $user_meta_query, ), 'date_query' => array( $date_ar, ), ); } else if ( isset( $_GET['order'] ) ) { $args = array( 'post_type' => 'envelope_orders', 'post_status' => 'publish', 'orderby' => 'menu_order', 'order' => 'ASC', 'showposts' => '-1', ); } else { $args = array( 'post_type' => 'envelope_orders', 'post_status' => 'publish', 'posts_per_page' => '10', 'paged' => $paged, 'meta_query' => array( 'relation' => 'AND', $user_meta_query, ), ); } $quotes = new WP_Query( $args ); $size = $_GET['size'] ?? ""; $customer = $_GET['customer'] ?? ""; $status = $_GET['status'] ?? ""; $archive_date = $_GET['month'] ?? ""; if ( isset( $_GET['order'] ) ) { $action = $_GET['order']; if ( $action == 'sort' ) { ?> <div class="container" style="margin-top: 15px;"> <div class="row"> <div class="col-md-12"> <h3 style="color:#00885c;"> Sort Orders </h3> <hr> </div> <div class="col-md-12"> <div class="panel background-green"> <div class="panel-body" style="padding:0"><a class="btn btn-normal btn-danger pull-right" style="margin-left: 30px;" href="<?php echo get_home_url(); ?>/orders">Back to Orders</a> <table id="orders" class="table table-striped table-bordered table-hover " style="margin-top: 20px;float:left;"> <thead> <tr style="background-color:#00472F; border-color:#00472F; color:#FFFFFF"> <th>InvoiceNo</th> <th>Customer</th> <th>Job Description</th> <th>Product Code</th> <th>PMS Colour</th> <th>Quantity</th> <th>Date Ordered</th> <th>Date Required</th> <th>Progress Status</th> </tr> </thead> <tbody> <?php if ( $quotes->have_posts() ) : while ( $quotes->have_posts() ) : $quotes->the_post(); $user_id = get_post_meta( get_the_ID(), 'user_id', true ); ?> <tr id="<?php echo get_the_ID(); ?>" class="mainrow"> <td><?php if ( get_post_meta( get_the_ID(), 'invoice_number', true ) ) { echo get_post_meta( get_the_ID(), 'invoice_number', true ); } else { echo get_the_title(); }; ?></td> <?php if ( is_super_admin() ) { echo '<td>' . get_post_meta( get_the_ID(), 'business_name', true ) . '</td>'; } ?> <td><?php echo get_post_meta( get_the_ID(), 'job_title', true ) . ' / ' . get_post_meta( get_the_ID(), 'job_reference', true ) . '<br/>'; $pa_size_term = get_term_by( 'slug', get_post_meta( get_the_ID(), 'pa_size', true ), 'pa_size' ); $pa_size_val = $pa_size_term->name; $pa_face_term = get_term_by( 'slug', get_post_meta( get_the_ID(), 'pa_face', true ), 'pa_face' ); $pa_face_val = $pa_face_term->name; $pa_seal_term = get_term_by( 'slug', get_post_meta( get_the_ID(), 'pa_seal', true ), 'pa_seal' ); $pa_seal_val = $pa_seal_term->name; $pa_stock_term = get_term_by( 'slug', get_post_meta( get_the_ID(), 'pa_stock', true ), 'pa_stock' ); $pa_stock_val = $pa_stock_term->name; echo $pa_size_val . ', ' . $pa_face_val . ', ' . $pa_seal_val . ', ' . $pa_stock_val; ?></td> <td><?php echo get_post_meta( get_the_ID(), 'product_code', true ); ?> <?php $p2_require = get_post_meta( get_the_ID(), 'product2_require', true ); if ( $p2_require == 'Yes' ) { echo '<br/>' . get_post_meta( get_the_ID(), 'product_code2', true ); ?> <?php } ?></td> <td><?php echo get_post_meta( get_the_ID(), 'front_colours_desc', true ); ?> <?php if ( get_post_meta( get_the_ID(), 'back_colours_desc', true ) ) { ?> <br/> <?php echo get_post_meta( get_the_ID(), 'back_colours_desc', true ); } ?></td> <td><?php echo get_post_meta( get_the_ID(), 'p1_quantity1', true ); if ( $p2_require == 'Yes' ) { ?> <br/> <?php echo get_post_meta( get_the_ID(), 'p2_quantity1', true ); } ?></td> <td><?php echo get_the_time( 'd/m/y g:i a', get_the_ID() ); ?></td> <td><?php echo get_post_meta( get_the_ID(), 'delivery_date', true ); ?></td> <td><?php if ( ! is_super_admin() ) { echo get_post_meta( get_the_ID(), 'status', true ); } else { ?> <?php $status = get_post_meta( get_the_ID(), 'status', true ); ?> <select class="form-control status" name="status"> <option value="">Progress Status</option> <option value="NEW" <?php if ( $status == 'NEW' ) { echo 'selected="selected"'; } ?>>NEW </option> <option value="ART-APPROVAL" <?php if ( $status == 'ART-APPROVAL' ) { echo 'selected="selected"'; } ?>>ART-APPROVAL </option> <option value="PRE-PRESS" <?php if ( $status == 'PRE-PRESS' ) { echo 'selected="selected"'; } ?>>PRE-PRESS </option> <option value="WAITING STOCK" <?php if ( $status == 'WAITING STOCK' ) { echo 'selected="selected"'; } ?>>WAITING STOCK </option> <option value="ON-HOLD" <?php if ( $status == 'ON-HOLD' ) { echo 'selected="selected"'; } ?>>ON-HOLD </option> <option value="PRODUCTION" <?php if ( $status == 'PRODUCTION' ) { echo 'selected="selected"'; } ?>>PRODUCTION </option> <option value="PAYMENT-REQ" <?php if ( $status == 'PAYMENT-REQ' ) { echo 'selected="selected"'; } ?>>PAYMENT-REQ </option> <option value="DISPATCHED" <?php if ( $status == 'DISPATCHED' ) { echo 'selected="selected"'; } ?>>DISPATCHED </option> </select> <input type="hidden" class="oid" value="<?php echo get_the_ID(); ?>"/> <input type="hidden" name="user_id_order_list" class="user_id" value="<?php echo $user_id; ?>"/> <?php } ?></td> </tr> <?php endwhile; ?> <?php wp_reset_postdata(); ?> <?php else : ?> <p> <?php _e( 'Sorry, no orders found!' ); ?> </p> <?php endif; ?> </tbody> </table> </div> </div> </div> </div> </div> <?php } ?> <?php } else { ?> <div class="container"> <div class="row"> <div class="col-md-12"> <div class="ee-order-stats-dashboard"> <div class="ee-your-orders-heading"> <span class="ee-heading" style="color:#00885c;font-size: 24px;"><?php if ( is_super_admin() ) { echo 'Client\'s'; } else { echo 'Your'; } ?> Orders</span> </div> <?php if ( ! is_super_admin() ) { ?> <div class="ee-your-orders-description"> <span class="ee-heading">These are the current and completed jobs in our system.</span> <span class="ee-column-separator"> </span> </div> <?php } if ( is_super_admin() ) { ?> <div class="ee-total-unprinted-orders"> <span class="ee-heading">Total Unprinted Orders: </span> <span class="ee-indicator"><?php echo $wip_orders_count; ?></span> <span class="ee-column-separator"> </span> </div> <div class="ee-average-turnaround"> <span class="ee-heading">Prod Turnaround: </span> <span class="ee-indicator"><?php echo $percent_within_target . "% < 2 days, Avg " . number_format( $average_turnaround, 1 ); ?></span> <span class="ee-column-separator"> </span> </div> <div class="ee-cod-orders"> <span class="ee-heading">COD Orders: </span> <span class="ee-indicator"><?php echo $cod_orders_count; ?></span> <span class="ee-column-separator"> </span> </div> <div class="ee-total_sales_mtd"> <span class="ee-heading">Total Sales MTD: </span> <span class="ee-indicator">$<?php echo $total_sales_mtd; echo " (1-" . $last_day . "/" . $month . "/" . $year . ")"; ?></span> <span class="ee-column-separator"> </span> </div> </div> <?php } ?> <hr> </div> <div class="col-md-12 nopadding"> <div class="col-md-9"> <form method="get" id="search" class="form-horizontal"> <label class="col-md-1 nopadding">Filter:</label> <div class="col-md-9 nopadding"> <?php if ( is_super_admin() ) { ?> <div class="col-sm-3"> <select name="customer" class="form-control" id="customer"> <option value="">Select Customer</option> <?php $args = array( 'role' => 'subscriber', 'meta_key' => 'business_name', 'meta_value' => '', 'orderby' => 'business_name', 'order' => 'ASC' ); $contacts = get_users( $args ); ?> <?php foreach ( $contacts as $contact ) { ?> <option value="<?php echo $contact->id; ?>" <?php if ( $contact->id == $customer ) { echo 'selected=selected'; } ?>><?php echo get_user_meta( $contact->id, 'business_name', true ); ?></option> <?php } ?> </select> </div> <?php } ?> <div class=" col-sm-3"> <?php $pa_size = $_GET['size'] ?? ""; ?> <select id="pa_size" class="form-control" name="size"> <option value="">Envelope Size</option> <?php $terms = get_terms( 'pa_size', array( 'order' => 'ASC', 'orderby' => 'pa_size' ) ); foreach ( $terms as $term ) { ?> <option value="<?php echo $term->slug; ?>" <?php if ( $term->name == $pa_size ) { echo 'selected=selected'; } ?>><?php echo $term->name; ?></option> <?php } ?> </select> </div> <div class="col-sm-3"> <?php $values = wp_get_archives( array( 'echo' => 0, 'type' => 'monthly', 'post_type' => 'envelope_orders', 'show_post_count' => 0 ) ); $archi = explode( '</li>', $values ); $links = array(); foreach ( $archi as $link ) { $link1 = str_replace( array( '<li>', "\n", "\t", "\s" ), '', $link ); $link2 = preg_replace( '/<[^>]*>/', '', $link1 ); if ( '' != $link2 ) { $links[] = $link2; } else { continue; } } ?> <select name="month" class="form-control"> <option value=""><?php echo esc_attr( __( 'Select Month' ) ); ?></option> <?php foreach ( $links as $arc ) { ?> <option value="<?php echo $arc; ?>" <?php if ( $arc == $archive_date ) { echo 'selected=selected'; } ?>><?php echo $arc; ?></option> <?php } ?> </select> </div> <div class=" col-sm-3"> <?php $status = $_GET['status'] ?? ""; ?> <select class="form-control" name="status"> <option value="">Progess Status</option> <option value="NEW" <?php if ( $status == 'NEW' ) { echo 'selected="selected"'; } ?>>NEW </option> <option value="ART-APPROVAL" <?php if ( $status == 'ART-APPROVAL' ) { echo 'selected="selected"'; } ?>>ART-APPROVAL </option> <option value="PRE-PRESS" <?php if ( $status == 'PRE-PRESS' ) { echo 'selected="selected"'; } ?>>PRE-PRESS </option> <option value="WAITING STOCK" <?php if ( $status == 'WAITING STOCK' ) { echo 'selected="selected"'; } ?>>ON-HOLD </option> <option value="WAITING STOCK" <?php if ( $status == 'ON-HOLD' ) { echo 'selected="selected"'; } ?>>ON-HOLD </option> <option value="PRODUCTION" <?php if ( $status == 'PRODUCTION' ) { echo 'selected="selected"'; } ?>>PRODUCTION </option> <option value="PAYMENT-REQ" <?php if ( $status == 'PAYMENT-REQ' ) { echo 'selected="selected"'; } ?>>PAYMENT-REQ </option> <option value="DISPATCHED" <?php if ( $status == 'DISPATCHED' ) { echo 'selected="selected"'; } ?>>DISPATCHED </option> </select> </div> </div> <div class="col-md-2 nopading"> <input type="submit" class="btn btn-normal btn-success" value="Go" name="Go"/> </div> </form> </div> <div class="col-md-3 nopadding"> <form action="" method="get" id="search"> <div class="col-md-7"> <input type="text" class="form-control" value="" name="job" placeholder="Find Job"/> </div> <div class="col-md-5"> <input type="submit" class="btn btn-normal btn-success" value="Find job" name="findJob"/> </div> </form> </div> </div> </div> </div> <div class="container" style="margin-top: 15px;"> <div class="row"> <div class="col-md-12"> <div class="panel background-green"> <div class="panel-body" style="padding:0"> <?php if ( is_super_admin() ) { ?> <a class="btn btn-normal btn-danger pull-right" style="margin-left: 30px;" href="./?order=sort">Sort Orders</a> <form id="myobExport" method="get" action=""> <input type="submit" class="btn btn-normal btn-danger pull-right" name="download" value="Download MYOB Export"> <input id="endDate" type="text" name="end_date" value="" class="pull-right" style="margin-right:10px;"> <span class="pull-right">End Date:</span> <input id="startDate" type="text" name="start_date" value="" class="pull-right" style="margin-right:10px;"> <span class="pull-right">Start Date:</span> </form> <?php } ?> <table id="orders" class="table table-striped table-bordered table-hover " style="margin-top: 20px;float:left;"> <thead> <tr style="background-color:#00472F; border-color:#00472F; color:#FFFFFF"> <th></th> <th>InvoiceNo</th> <?php if ( is_super_admin() ) { echo '<th>Customer</th>'; } ?> <th>Job Description</th> <th>Product Code</th> <th>PMS Colour</th> <th>Quantity</th> <th style="min-width:90px;">Date Ord</th> <th style="min-width:90px;">Date Desp</th> <th>Date Required</th> <th style="min-width:130px;">Progress Status</th> <?php if ( is_super_admin() ) { ?> <th>Delete</th> <?php } ?> </tr> </thead> <tbody> <?php if ( $quotes->have_posts() ) : ?> <?php while ( $quotes->have_posts() ) : $quotes->the_post(); $user_id = get_post_meta( get_the_ID(), 'user_id', true ); ?> <tr id="<?php echo get_the_ID(); ?>" class="mainrow"> <td width="30" class="handle"><a data-row-id="<?php echo get_the_ID(); ?>" href="#" class="toggle-details fas fa-plus-square"></a> </td> <td><?php if ( get_post_meta( get_the_ID(), 'invoice_number', true ) ) { echo get_post_meta( get_the_ID(), 'invoice_number', true ); } else { echo get_the_title(); }; ?></td> <?php if ( is_super_admin() ) { echo '<td>' . get_post_meta( get_the_ID(), 'business_name', true ) . '</td>'; } ?> <td><?php echo get_post_meta( get_the_ID(), 'job_title', true ) . ' / ' . get_post_meta( get_the_ID(), 'job_reference', true ) . '<br/>'; $pa_size_term = get_term_by( 'slug', get_post_meta( get_the_ID(), 'pa_size', true ), 'pa_size' ); $pa_size_val = $pa_size_term->name; $pa_face_term = get_term_by( 'slug', get_post_meta( get_the_ID(), 'pa_face', true ), 'pa_face' ); $pa_face_val = $pa_face_term->name; $pa_seal_term = get_term_by( 'slug', get_post_meta( get_the_ID(), 'pa_seal', true ), 'pa_seal' ); $pa_seal_val = $pa_seal_term->name; $pa_stock_term = get_term_by( 'slug', get_post_meta( get_the_ID(), 'pa_stock', true ), 'pa_stock' ); $pa_stock_val = $pa_stock_term->name; echo $pa_size_val . ', ' . $pa_face_val . ', ' . $pa_seal_val . ', ' . $pa_stock_val; ?></td> <td><?php echo get_post_meta( get_the_ID(), 'product_code', true ); ?> <?php $p2_require = get_post_meta( get_the_ID(), 'product2_require', true ); if ( $p2_require == 'Yes' ) { echo '<br/>' . get_post_meta( get_the_ID(), 'product_code2', true ); ?> <?php } ?></td> <td><?php echo get_post_meta( get_the_ID(), 'front_colours_desc', true ); ?> <?php if ( get_post_meta( get_the_ID(), 'back_colours_desc', true ) ) { ?> <br/> <?php echo get_post_meta( get_the_ID(), 'back_colours_desc', true ); } ?></td> <td><?php echo get_post_meta( get_the_ID(), 'p1_quantity1', true ); if ( $p2_require == 'Yes' ) { ?> <br/> <?php echo get_post_meta( get_the_ID(), 'p2_quantity1', true ); } ?></td> <td><?php echo get_the_time( 'd-m-y g:i a' ); ?></td> <td><?php if ( get_post_meta( get_the_ID(), 'status', true ) == 'DISPATCHED' ) { echo date( 'd-m-y g:i a', get_post_meta( get_the_ID(), 'date_dispatched', true ) ); } ?></td> <td><?php if ( get_post_meta( get_the_ID(), 'delivery_date', true ) ) { echo date( 'd/m/y', strtotime( get_post_meta( get_the_ID(), 'delivery_date', true ) ) ); } ?></td> <td><?php if ( ! is_super_admin() ) { echo get_post_meta( get_the_ID(), 'status', true ); } else { ?> <?php $status = get_post_meta( get_the_ID(), 'status', true ); ?> <select class="form-control status" name="status" <?php if ( $status == 'NEW' ) { echo 'style="color:red;"'; } ?>> <option value="">Progress Status</option> <option value="NEW" <?php if ( $status == 'NEW' ) { echo 'selected="selected"'; } ?>>NEW </option> <option value="ART-APPROVAL" <?php if ( $status == 'ART-APPROVAL' ) { echo 'selected="selected"'; } ?>>ART-APPROVAL </option> <option value="PRE-PRESS" <?php if ( $status == 'PRE-PRESS' ) { echo 'selected="selected"'; } ?>>PRE-PRESS </option> <option value="WAITING STOCK" <?php if ( $status == 'WAITING STOCK' ) { echo 'selected="selected"'; } ?>>WAITING STOCK </option> <option value="ON-HOLD" <?php if ( $status == 'ON-HOLD' ) { echo 'selected="selected"'; } ?>>ON-HOLD </option> <option value="PRODUCTION" <?php if ( $status == 'PRODUCTION' ) { echo 'selected="selected"'; } ?>>PRODUCTION </option> <option value="PAYMENT-REQ" <?php if ( $status == 'PAYMENT-REQ' ) { echo 'selected="selected"'; } ?>>PAYMENT-REQ </option> <option value="DISPATCHED" <?php if ( $status == 'DISPATCHED' ) { echo 'selected="selected"'; } ?>>DISPATCHED </option> </select> <input type="hidden" class="oid" value="<?php echo get_the_ID(); ?>"/> <input type="hidden" class="user_id" value="<?php echo $user_id; ?>"/> <?php } ?></td> <?php if ( is_super_admin() ) { ?> <td><a href="#" class="del">Delete </a> <input type="hidden" value="<?php echo get_the_ID(); ?>" class="pid"/></td> <?php } ?> </tr> <tr style="display: none;"> <td colspan="<?php if ( is_super_admin() ) { ?>11<?php } else { ?>10<?php } ?>" id="<?php echo get_the_ID(); ?>"> <div id="homeBody"> <div class="container nopadding"> <form action="" role="form" id="form-<?php echo get_the_ID(); ?>" class="form-horizontal quoteform" enctype="multipart/form-data" method="post" novalidate="novalidate"> <input type="hidden" id="actions" name="action" value="saveorder"> <input type="hidden" name="product_id" class="pid" value="<?php echo get_post_meta( get_the_ID(), 'product_id', true ); ?>"> <input type="hidden" name="price" class="price" value="<?php echo get_post_meta( get_the_ID(), 'price', true ); ?>"> <input type="hidden" name="product_name" class="pname" value="<?php echo get_post_meta( get_the_ID(), 'product_name', true ); ?>"> <input type="hidden" name="product_code" class="pcode" value="<?php echo get_post_meta( get_the_ID(), 'product_code', true ); ?>"> <input type="hidden" name="size_group" class="size_group" value="<?php echo get_post_meta( get_the_ID(), 'size_group', true ); ?>"> <input type="hidden" name="product2_require" class="p2_require" value="<?php echo get_post_meta( get_the_ID(), 'product2_require', true ); ?>"> <input type="hidden" name="product_id2" class="pid2" value="<?php echo get_post_meta( get_the_ID(), 'product_id2', true ); ?>"> <input type="hidden" name="price2" class="price2" value="<?php echo get_post_meta( get_the_ID(), 'price2', true ); ?>"> <input type="hidden" name="product_name2" class="pname2" value="<?php echo get_post_meta( get_the_ID(), 'product_name2', true ); ?>"> <input type="hidden" name="product_code2" class="pcode2" value="<?php echo get_post_meta( get_the_ID(), 'product_code2', true ); ?>"> <input type="hidden" name="product_env2" class="p_env2" value="<?php echo get_post_meta( get_the_ID(), 'product_env2', true ); ?>"> <input type="hidden" name="delivery_fee" class="delivery_fee" value="<?php echo get_post_meta( get_the_ID(), 'delivery_fee', true ); ?>"> <input type="hidden" name="manual_delivery" class="manual_delivery" value="<?php echo get_post_meta( get_the_ID(), 'manual_delivery', true ); ?>"> <input type="hidden" name="quotetotal" class="itotal" value="<?php echo get_post_meta( get_the_ID(), 'quotetotal', true ); ?>"> <input type="hidden" class="user_id" name="user_id" value="<?php echo get_post_meta( get_the_ID(), 'user_id', true ); ?>"> <input type="hidden" class="business_name" name="business_name" value="<?php echo get_post_meta( get_the_ID(), 'business_name', true ); ?>"> <input type="hidden" class="f_name_l_name" name="f_name_l_name" value="<?php echo get_post_meta( get_the_ID(), 'f_name_l_name', true ); ?>"> <input type="hidden" class="client_address" name="client_address" value="<?php echo get_post_meta( get_the_ID(), 'client_address', true ); ?>"> <input type="hidden" class="email_address" name="email_address" value="<?php echo get_post_meta( get_the_ID(), 'email_address', true ); ?>"> <input type="hidden" class="phone_number" name="phone_number" value="<?php echo get_post_meta( get_the_ID(), 'phone_number', true ); ?>"> <input type="hidden" class="quote_number" name="quote_number" value="<?php echo get_post_meta( get_the_ID(), 'quote_number', true ); ?>"> <input type="hidden" class="multiplier" name="multiplier" value="<?php echo get_post_meta( get_the_ID(), 'multiplier', true ); ?>" placeholder="Multiplier"> <input type="hidden" class="post_id" name="post_id" value="<?php echo get_the_ID(); ?>" placeholder="post id"> <!-- ============= Start of D S Bailey Freelancer Addition 1 ============= --> <?php // Panel header with CSS Grid layout ?> <div class="panel-container"> <div class="orders-button-grid"> <!-- Column 1: Order Management --> <div class="button-column"> <?php if (is_super_admin()) : ?> <button class="action-btn submitorder"> <span>Update Order</span> <i class="fas fa-arrow-circle-right"></i> </button> <?php endif; ?> <button class="action-btn re-order"> <span>Re-Order</span> <i class="fas fa-arrow-circle-right"></i> </button> </div> <!-- Column 2: Export and Email --> <div class="button-column"> <?php if (is_super_admin()) : ?> <button class="action-btn export-to-word"> <span>Export To Word</span> <i class="fas fa-arrow-circle-right"></i> </button> <a href="mailto:<?php echo esc_attr(get_post_meta(get_the_ID(), 'email_address', true)); ?>" class="action-btn email_client"> <span>Email Client</span> <i class="fas fa-envelope-open"></i> </a> <?php endif; ?> </div> <!-- Column 3: Invoice Management --> <div class="button-column"> <?php if (is_super_admin()) : ?> <div class="checkbox-card"> <div class="checkbox-wrapper"> <input type="checkbox" id="email-invoices-on" name="email-invoices-on" checked> <label style="color: white; font-size: 1.4rem; text-transform: capitalize;" for="email-invoices-on">EMAIL INVOICE ON?</label> </div> </div> <button class="action-btn create-xero-invoice"> <span>Create Xero Invoice</span> <i class="fas fa-arrow-circle-right"></i> </button> <?php endif; ?> </div> </div> </div> <!-- =============== End of D S Bailey Freelancer Addition =============== 1--> <div class="panel background-green"> <h3 class="panel-title" style="font-size: 30px;margin-bottom: 15px;color:#00885c"> Job Details -- <?php echo get_post_meta( get_the_ID(), 'invoice_number', true ); ?></h3> <div class="panel-heading"> <h3 class="panel-title tp"> DETAILS</h3> </div> <div class="panel-body zp nopadding"> <div class="col-md-12 strp"> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Customer:</strong></label> <div class="col-sm-9"><?php echo get_post_meta( get_the_ID(), 'business_name', true ); ?></div> </div> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Contact:</strong></label> <div class="col-sm-9"><?php echo get_post_meta( get_the_ID(), 'f_name_l_name', true ); ?></div> </div> </div> <div class="col-md-12 strp"> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Client Address:</strong></label> <div class="col-sm-9"><?php echo get_post_meta( get_the_ID(), 'client_address', true ); ?></div> </div> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Phone Number:</strong></label> <div class="col-sm-9"><?php echo get_post_meta( get_the_ID(), 'phone_number', true ); ?></div> </div> </div> <div class="col-sm-12 strp"> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Email Address:</strong></label> <div class="col-sm-9"><?php echo get_post_meta( get_the_ID(), 'email_address', true ); ?></div> </div> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Date Created:</strong></label> <div class="col-sm-9"><?php echo get_the_date( 'd/m/y', get_the_ID() ); ?></div> </div> </div> <div class="col-sm-12 strp"> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Job Title:</strong></label> <div class="col-sm-9"> <input name="job_title" id="JobTitle" class="form-control" value="<?php echo get_post_meta( get_the_ID(), 'job_title', true ); ?>" required="" aria-required="true" <?php if ( is_super_admin() == false ) { echo $disabled; } ?> ></div> </div> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Job Reference: </strong></label> <div class="col-sm-9"> <input name="job_reference" id="job_reference" class="form-control" value="<?php echo get_post_meta( get_the_ID(), 'job_reference', true ); ?>" required="" aria-required="true"> </div> </div> </div> <div class="col-sm-12 strp"> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Special Instructions:</strong></label> <div class="col-sm-9"> <textarea class="form-control" name="special_instructions"><?php echo get_post_meta( get_the_ID(), 'special_instructions', true ); ?></textarea> </div> </div> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Order No:</strong></label> <div class="col-sm-9"><?php echo get_post_meta( get_the_ID(), 'invoice_number', true ); ?></div> </div> </div> </div> </div> <div class="panel background-green"> <div class="panel-heading"> <h3 class="panel-title tp">PRODUCT 1 </h3> </div> <div class="panel-body zp nopadding"> <div class="col-md-12 strp"> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Product Code:</strong></label> <div class="col-sm-9"><?php echo get_post_meta( get_the_ID(), 'product_code', true ); ?></div> </div> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Quantity Ordered:</strong></label> <div class="col-sm-9"> <?php $sizegroup = get_post_meta( get_the_ID(), 'size_group', true ); $paqty1 = get_post_meta( get_the_ID(), 'p1_quantity1', true ); if ( $sizegroup == 'A' ) { $size = get_post_meta( get_the_ID(), 'pa_size', true ); if ( strpos( $size, 'Pocket' ) !== false ) { $groupname = 'Grp A Pkts'; } else { $groupname = 'Grp A Wallets'; } $soptions = $wpdb->get_results( "Select * from `wp_size_group` where `group_name` ='{$groupname}'" ); } else if ( $sizegroup == 'B' || $sizegroup == 'B4' ) { $groupname = 'Group B'; $soptions = $wpdb->get_results( "Select * from `wp_size_group` where `group_name` = '{$groupname}'" ); } else if ( $sizegroup == 'C' ) { $groupname = 'Grp C&D'; $soptions = $wpdb->get_results( "Select * from `wp_size_group` where `group_name` ='{$groupname}'" ); } else if ( $sizegroup == 'D' ) { $groupname = 'Grp C&D'; $soptions = $wpdb->get_results( "Select * from `wp_size_group` where `group_name` ='{$groupname}'" ); } ?> <?php $quote_status = get_post_meta( get_the_ID(), 'quote_status', true ); if ( $status == 'DISPATCHED' ) { $disabled = 'disabled'; } ?> <!------Start Stu modification for admin able to change Qty--> <?php if ( is_super_admin() ) { ?> <?php if ( $quote_status == 'CUSTOM QUOTE REQUEST' ) { ?> <input type="text" name="p1_quantity1" value="<?php echo get_post_meta( get_the_ID(), 'quantity_1_custom', true ); ?>" class="form-control p1-quantity1 required"/> <?php } else { ?> <input type="text" name="p1_quantity1" value="<?php echo get_post_meta( get_the_ID(), 'p1_quantity1', true ); ?>" class="form-control p1-quantity1 required"/> <?php } ?> <?php } else { ?> <?php if ( $quote_status == 'CUSTOM QUOTE REQUEST' ) { ?> <input type="text" name="p1_quantity1" value="<?php echo get_post_meta( get_the_ID(), 'quantity_1_custom', true ); ?>" class="form-control p1-quantity1 required" <?php echo 'disabled'; ?> /> <?php } else { ?> <input type="text" name="p1_quantity1" value="<?php echo get_post_meta( get_the_ID(), 'p1_quantity1', true ); ?>" class="form-control p1-quantity1 required" <?php echo 'disabled'; ?> /> <?php } } ?> <!----------END Stu Modification---------> </div> </div> </div> <div class="col-md-12 strp"> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Size:</strong></label> <div class="col-sm-9"> <?php $pasize = get_post_meta( get_the_ID(), 'pa_size', true ); ?> <select class="form-control pa_size" name="pa_size" <?php echo 'disabled'; ?>> <?php $terms = get_terms( 'pa_size', array( 'orderby' => 'DESC' ) ); foreach ( $terms as $term ) { ?> <option value="<?php echo $term->name; ?>" <?php if ( $pasize == $term->slug ) { echo 'selected="selected"'; } ?> ><?php echo $term->name; ?> </option> <?php } ?> </select> </div> </div> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Face Type:</strong></label> <div class="col-sm-9"> <?php $pa_face = get_post_meta( get_the_ID(), 'pa_face', true ); $term = get_term_by( 'slug', $pa_face, 'pa_face' ); ?> <select class="pa_face form-control" name="pa_face" <?php echo 'disabled'; ?>> <option value="<?php echo $pa_face; ?>"><?php echo $term->name; ?></option> </select> </div> </div> </div> <div class="col-md-12 strp"> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Seal Type:</strong></label> <div class="col-sm-9"> <?php $pa_seal = get_post_meta( get_the_ID(), 'pa_seal', true ); $term = get_term_by( 'slug', $pa_seal, 'pa_seal' ); ?> <select class="form-control pa_seal" name="pa_seal" <?php echo 'disabled'; ?>> <option value="<?php echo $pa_seal; ?>"><?php echo $term->name; ?></option> </select> </div> </div> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Stock:</strong></label> <div class="col-sm-9"> <?php $pa_stock = get_post_meta( get_the_ID(), 'pa_stock', true ); $term = get_term_by( 'slug', $pa_stock, 'pa_stock' ); ?> <select class="form-control pa_stock" name="pa_stock" <?php echo 'disabled'; ?>> <option value="<?php echo $pa_stock; ?>"><?php echo $term->name; ?></option> </select> </div> </div> </div> <div class="col-md-12 strp"> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Front Print Colours:</strong></label> <div class="col-sm-9"> <?php $frontcolor = get_post_meta( get_the_ID(), 'front_print_colours', true ); ?> <div class="col-sm-4 nopaddingleft"> <select class="form-control print_colours" name="front_print_colours" <?php if ( is_super_admin() ) { } else { echo 'disabled'; } ?> > <option value=""> Select </option> <?php $pricing_table = $wpdb->prefix . "printcodes_pricing"; $query = 'SELECT DISTINCT `colours` FROM `' . $pricing_table . '`'; $colours_list = $wpdb->get_results( $query ); foreach ( $colours_list as $colour ) { ?> <option value="<?php echo $colour->colours; ?>" <?php if ( $frontcolor == $colour->colours ) { echo 'selected="selected"'; } ?>><?php echo $colour->colours; ?></option> <?php } ?> <option value="none" <?php if ( $frontcolor == 'none' ) { echo 'selected="selected"'; } ?>>None </option> </select> </div> <?php $front_print_colours = get_post_meta( get_the_ID(), 'front_print_colours', true ); if ( is_super_admin() ) { if ( $front_print_colours == 'none' ) { $disabled = 'disabled'; $required = ''; } elseif ( $front_print_colours == 'CMYK' ) { $required = ''; } else { $disabled = ''; $required = 'required'; } } else { $disabled = 'disabled'; } ?> <div class="col-sm-8 front_colour_desc nopaddingright"> <input name="front_colours_desc" id="front_colours_desc" value="<?php echo get_post_meta( get_the_ID(), 'front_colours_desc', true ); ?>" class="form-control conditional-required <?php echo $required; ?>" placeholder="List PMS Col - eg. 021, 485" <?php if ( is_super_admin() == false ) { echo $disabled; } ?>> </div> </div> </div> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Front Image Area:</strong></label> <div class="col-sm-9"> <?php $fimagearea = get_post_meta( get_the_ID(), 'front_image_area', true ); ?> <select class="form-control front_image_area" name="front_image_area" <?php echo 'disabled'; ?>> <option value=""> Select </option> <option value="front_std" <?php if ( $fimagearea == 'front_std' ) { echo 'selected="selected"'; } ?>>Artwork fits within top left Quadrant </option> <option value="front_large" <?php if ( $fimagearea == 'front_large' ) { echo 'selected="selected"'; } ?>>Artwork larger than top left Quadrant </option> </select> </div> </div> </div> <div class="col-md-12 strp"> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Back Print Colours:</strong></label> <div class="col-sm-9"> <?php $backcolor = get_post_meta( get_the_ID(), 'back_print_colours', true ); ?> <div class="col-sm-4 nopaddingleft"> <select class="form-control back_print_colours" name="back_print_colours" <?php if ( is_super_admin() ) { } else { echo 'disabled'; } ?> > <option value=""> Select </option> <?php $pricing_table = $wpdb->prefix . "printcodes_pricing"; $query = 'SELECT DISTINCT `colours` FROM `' . $pricing_table . '`'; $colours_list = $wpdb->get_results( $query ); foreach ( $colours_list as $colour ) { ?> <option value="<?php echo $colour->colours; ?>" <?php if ( $backcolor == $colour->colours ) { echo 'selected="selected"'; } ?>><?php echo $colour->colours; ?></option> <?php } ?> <option value="none" <?php if ( $backcolor == 'none' ) { echo 'selected="selected"'; } ?>>None </option> </select> </div> <?php $back_print_colours = get_post_meta( get_the_ID(), 'back_print_colours', true ); $required = ''; if ( is_super_admin() ) { if ( $back_print_colours == 'none' ) { $disabled = 'disabled'; $required = ''; } elseif ( $back_print_colours == 'CMYK' ) { $required = ''; } else { $disabled = ''; $required = 'required'; } } else { $disabled = 'disabled'; } ?> <div class="col-sm-8 front_colour_desc nopaddingright"> <input name="back_colours_desc" value="<?php echo get_post_meta( get_the_ID(), 'back_colours_desc', true ); ?>" id="back_colours_desc" class="form-control conditional-required <?php echo $required; ?>" placeholder="List PMS Col - eg. 021, 485" <?php if ( is_super_admin() == false ) { echo $disabled; } ?>> </div> </div> </div> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Back Image Area:</strong></label> <div class="col-sm-9"> <?php $bimagearea = get_post_meta( get_the_ID(), 'back_image_area', true ); ?> <select class="form-control back_image_area" name="back_image_area" <?php echo 'disabled'; ?>> <option value=""> Select </option> <option value="back_std" <?php if ( $bimagearea == 'back_std' ) { echo 'selected="selected"'; } ?>>Artwork fits within top left Quadrant </option> <option value="back_large" <?php if ( $bimagearea == 'back_large' ) { echo 'selected="selected"'; } ?>>Artwork larger than top left Quadrant </option> </select> </div> </div> </div> <div class="col-md-12 strp"> <div class="col-md-4 form-group"> <label class="col-sm-4"><strong>Metallic Ink:</strong></label> <div class="col-sm-4"> <?php $metalic_ink = get_post_meta( get_the_ID(), 'metalic_ink', true ); ?> <select class="form-control metalic_ink" name="metalic_ink" <?php if ( ! $allow ) { echo 'disabled'; } ?>> <option value="no" <?php if ( $metalic_ink == 'no' ) { echo 'selected="selected"'; } ?>>No </option> <option value="yes" <?php if ( $metalic_ink == 'yes' ) { echo 'selected="selected"'; } ?>>Yes </option> </select> </div> </div> <div class="col-md-4 form-group"> <label class="col-sm-8"><strong>Artwork have Bleeds?:</strong></label> <div class="col-sm-4"> <?php $bleeds = get_post_meta( get_the_ID(), 'bleeds', true ); ?> <select class="form-control bleeds" name="bleeds" <?php if ( ! $allow ) { echo 'disabled'; } ?>> <option value="no" <?php if ( $bleeds == 'no' ) { echo 'selected="selected"'; } ?>>No </option> <option value="yes" <?php if ( $bleeds == 'yes' ) { echo 'selected="selected"'; } ?>>Yes </option> </select> </div> </div> <div class="col-md-4 form-group"> <label class="col-sm-8"><strong>More than 25% Solid Ink Coverage?:</strong></label> <div class="col-sm-4"> <?php $solid_ink = get_post_meta( get_the_ID(), 'solid_ink', true ); ?> <select class="form-control solid_ink" name="solid_ink" <?php if ( ! $allow ) { echo 'disabled'; } ?>> <option value="no" <?php if ( $solid_ink == 'no' ) { echo 'selected="selected"'; } ?>>No </option> <option value="yes" <?php if ( $solid_ink == 'yes' ) { echo 'selected="selected"'; } ?>>Yes </option> </select> </div> </div> </div> </div> </div> <div class="panel background-green"> <div class="panel-heading"> <h3 class="panel-title tp">PRODUCT 2 </h3> </div> <div class="panel-body zp nopadding"> <div class="col-md-12 strp"> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Product Code:</strong></label> <div class="col-sm-9"><?php echo get_post_meta( get_the_ID(), 'product_code2', true ); ?></div> </div> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Quantilty Ordered:</strong></label> <div class="col-sm-9"> <?php $paqty2 = get_post_meta( get_the_ID(), 'p2_quantity1', true ); ?> <?php $status = get_post_meta( get_the_ID(), 'status', true ); $quote_status = get_post_meta( get_the_ID(), 'quote_status', true ); if ( $status == 'DISPATCHED' ) { $disabled = 'disabled'; } ?> <!--Stu - Allow admin to change Qty, but not clients--> <?php if ( is_super_admin() ) { ?> <?php if ( $quote_status == 'CUSTOM QUOTE REQUEST' ) { ?> <input type="text" name="p2_quantity1" value="<?php echo get_post_meta( get_the_ID(), 'quantity_2_custom', true ); ?>" class="form-control p2-quantity1"/> <?php } else { ?> <input type="text" name="p2_quantity1" value="<?php echo get_post_meta( get_the_ID(), 'p2_quantity1', true ); ?>" class="form-control p2-quantity1"/> <?php } ?> <?php } else { ?> <?php if ( $quote_status == 'CUSTOM QUOTE REQUEST' ) { ?> <input type="text" name="p2_quantity1" value="<?php echo get_post_meta( get_the_ID(), 'quantity_2_custom', true ); ?>" class="form-control p2-quantity1" <?php echo 'disabled'; ?> /> <?php } else { $getPostP2Quantity1 = get_post_meta( get_the_ID(), 'p2_quantity1', true ) ?? ""; ?> <input type="text" name="p2_quantity1" value="<?php echo $getPostP2Quantity1; ?>" class="form-control p2-quantity1" <?php echo 'disabled'; ?> /> <?php } ?> <?php /*<select name="p2_quantity1" class="form-control required p2-quantity1" <?php echo $disabled; ?>> <option value="0"> Select Quantity </option> <?php foreach ($soptions as $option) { ?> <option value="<?php echo $option ->qty; ?>" <?php if ($paqty2 == $option->qty) { echo 'selected="selected"'; } ?>> <?php echo $option->qty; ?></option> <?php } ?> </select> */ ?> <?php } ?> <!----------END Stu Modification---------> </div> </div> </div> <div class="col-md-12 strp"> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Size:</strong></label> <div class="col-sm-9"> <?php $pasize = get_post_meta( get_the_ID(), 'product2_pa_size', true ); ?> <select class="form-control product2_pa_size" name="product2_pa_size" <?php if ( ! $allow ) { echo 'disabled'; } ?>> <?php $terms = get_terms( 'pa_size', array( 'orderby' => 'DESC' ) ); foreach ( $terms as $term ) { ?> <option value="<?php echo $term->name; ?>" <?php if ( $pasize == $term->name ) { echo 'selected="selected"'; } ?> ><?php echo $term->name; ?> </option> <?php } ?> </select> </div> </div> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Face Type:</strong></label> <div class="col-sm-9"> <?php $pa_face = get_post_meta( get_the_ID(), 'product2_pa_face', true ); $term = get_term_by( 'slug', $pa_face, 'pa_face' ); ?> <select class="form-control product2_pa_face" name="product2_pa_face" <?php if ( ! $allow ) { echo 'disabled'; } ?>> <option value="<?php echo $pa_face ?? ""; ?>"><?php echo $term->name ?? ""; ?></option> </select> </div> </div> </div> <div class="col-md-12 strp"> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Seal Type:</strong></label> <div class="col-sm-9"> <?php $pa_seal = get_post_meta( get_the_ID(), 'product2_pa_seal', true ); $term = get_term_by( 'slug', $pa_seal, 'pa_seal' ); ?> <select class="form-control product2_pa_seal" name="product2_pa_seal" <?php if ( ! $allow ) { echo 'disabled'; } ?>> <option value="<?php echo $pa_seal ?? ""; ?>"><?php echo $term->name ?? ""; ?></option> </select> </div> </div> <div class="col-md-6 form-group"> <label class="col-sm-3"><strong>Stock:</strong></label> <div class="col-sm-9"> <?php $pa_stock = get_post_meta( get_the_ID(), 'product2_pa_stock', true ); $term = get_term_by( 'slug', $pa_stock, 'pa_stock' ); ?> <select class="form-control product2_pa_stock" name="product2_pa_stock" <?php if ( ! $allow ) { echo 'disabled'; } ?>> <option value="<?php echo $pa_stock ?? ""; ?>"><?php echo $term->name ?? ""; ?></option> </select> </div> </div> </div> </div> </div> <div class="panel background-green"> <div class="panel-heading"> <h3 class="panel-title tp"> PRICE </h3> </div> <div class="panel-body zp nopadding"> <?php if ( is_super_admin() ) { ?> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Stock /m:</label> <?php $stock_rate = get_post_meta( get_the_ID(), 'stock_rate', true ); $stock_rate2 = get_post_meta( get_the_ID(), 'stock_rate2', true ); ?> <div class="col-sm-9"> <div class="col-sm-6 nopaddingleft"> <input type="text" class="form-control stock_rate" value="<?php echo $stock_rate; ?>" name="stock_rate" placeholder="$xxx.xx ex GST"/> (product-1 $ per thousand) </div> <div class="col-sm-6"> <input type="text" class="form-control stock_rate2" value="<?php echo $stock_rate2; ?>" name="stock_rate2" placeholder="$xxx.xx ex GST"/> (product-2 $ per thousand) </div> </div> </div> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Print Rate /m:</label> <?php $printrate = get_post_meta( get_the_ID(), 'print_rate', true ); ?> <div class="col-sm-9"> <div class="col-sm-6 nopaddingleft"> <input type="text" class="form-control print_rate" value="<?php echo $printrate; ?>" name="print_rate" placeholder="$xxx.xx ex GST"/> </div> <div class="col-sm-6"> ($ per thousand) </div> </div> </div> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Perfecting Factor:</label> <?php $perfecting_factor = get_post_meta( get_the_ID(), 'perfecting_factor', true ); ?> <div class="col-sm-9"> <div class="col-sm-6 nopaddingleft"> <input type="text" class="form-control perfecting_factor" value="<?php echo $perfecting_factor; ?>" name="perfecting_factor" placeholder="eg. 0.50"/> </div> </div> </div> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Large Area Factor:</label> <?php $large_area_factor = get_post_meta( get_the_ID(), 'large_area_factor', true ); ?> <div class="col-sm-9"> <div class="col-sm-6 nopaddingleft"> <input type="text" class="form-control large_area_factor" value="<?php echo $large_area_factor; ?>" name="large_area_factor" placeholder="eg. 0.30"/> </div> </div> </div> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Ink Solids Factor:</label> <?php $ink_solids_factors = get_post_meta( get_the_ID(), 'ink_solids_factors', true ); ?> <div class="col-sm-9"> <div class="col-sm-6 nopaddingleft"> <input type="text" class="form-control ink_solids_factors" value="<?php echo $ink_solids_factors; ?>" name="ink_solids_factors" placeholder="eg. 0.20"/> </div> </div> </div> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Metalic Ink:</label> <?php $metalic_ink = get_post_meta( get_the_ID(), 'metalicink', true ); ?> <div class="col-sm-9"> <div class="col-sm-6 nopaddingleft"> <input type="text" class="form-control metalicink" value="<?php echo $metalic_ink; ?>" name="metalicink" placeholder="$xxx.xx ex GST"/> </div> </div> </div> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Other:</label> <?php $other = get_post_meta( get_the_ID(), 'other', true ); $other_desc = get_post_meta( get_the_ID(), 'other_cs', true ); $other_option = get_post_meta( get_the_ID(), 'other_option', true ); ?> <div class="col-sm-9"> <div class="col-sm-3 nopaddingleft"> <input type="text" class="form-control other" value="<?php echo $other; ?>" name="other" placeholder="$xxx.xx ex GST"/> </div> <div class="col-sm-6"> <input type="text" class="form-control" value="<?php echo $other_desc; ?>" name="other_cs" placeholder="Other Description"/> </div> <div class="col-sm-3"> <select class="form-control" name="other_option"> <option value> Select </option> <option value="Artwork" <?php if ( $other_option == 'Artwork' ) { echo 'selected=selected'; } ?>>Artwork </option> <option value="Plate" <?php if ( $other_option == 'Plate' ) { echo 'selected=selected'; } ?>>Plate </option> <option value="EEStorage-Skid" <?php if ( $other_option == 'EEStorage-Skid' ) { echo 'selected=selected'; } ?>>Storage </option> <option value="EENSI" <?php if ( $other_option == 'EENSI' ) { echo 'selected=selected'; } ?>>Env Stock </option> <option value="Mail-Address" <?php if ( $other_option == 'Mail-Address' ) { echo 'selected=selected'; } ?>>Mail Address/Insert </option> <option value="Setup-PP1" <?php if ( $other_option == 'Setup-PP1' ) { echo 'selected=selected'; } ?>>Pad Print 1Col </option> <option value="Setup-PP2" <?php if ( $other_option == 'Setup-PP2' ) { echo 'selected=selected'; } ?>>Pad Print 2Col </option> <option value="Setup-PP3" <?php if ( $other_option == 'Setup-PP3' ) { echo 'selected=selected'; } ?>>Pad Print 3Col+ </option> <option value="Setup-SP1" <?php if ( $other_option == 'Setup-SP1' ) { echo 'selected=selected'; } ?>>Screen Print </option> <option value="Setup-Other" <?php if ( $other_option == 'Setup-Other' ) { echo 'selected=selected'; } ?>>Other Promo Decorating </option> </select> </div> </div> </div> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Delivery:</label> <?php $delivery_fee = get_post_meta( get_the_ID(), 'deliveryfee', true ); ?> <div class="col-sm-9"> <div class="col-sm-6 nopaddingleft"> <input type="text" class="form-control deliveryfee" value="<?php echo $delivery_fee; ?>" name="deliveryfee"/> </div> </div> </div> <?php } ?> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Total Price:</label> <?php $price = get_post_meta( get_the_ID(), 'total_amount', true ); ?> <div class="col-sm-9"> <div class="col-sm-6 nopaddingleft"> <span id="total_price"> <?php if ( ! $price ) { $price = '$0.00'; } ?> <input type="text" class="form-control total_amount" value="<?php echo $price; ?>" name="total_amount" <?php if ( ! $allow ) { echo 'disabled'; } ?> /> </span> <input type="hidden" name="q_price" id="price1" value="<?php echo get_post_meta( get_the_ID(), 'price', true ); ?>"> </div> </div> </div> </div> </div> <div class="panel background-green"> <div class="panel-heading"> <h3 class="panel-title tp"> DELIVERY</h3> </div> <div class="panel-body zp nopadding"> <div class="rows" style=""> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Deliver To:</label> <div class="col-sm-7"> <?php $deliver_to = get_post_meta( get_the_ID(), 'deliver_to', true ); ?> <select name="deliver_to" class="form-control DeliverTo" <?php if ( is_super_admin() == false ) { echo $disabled; } ?>> <option value="deliver_to_me" <?php if ( $deliver_to == 'deliver_to_me' ) { echo 'selected=selected'; } ?>>Deliver to me </option> <option value="deliver_to_client" <?php if ( $deliver_to == 'deliver_to_client' ) { echo 'selected=selected'; } ?>>Blind Ship direct to my Client </option> <option value="pickup" <?php if ( $deliver_to == 'pickup' ) { echo 'selected=selected'; } ?>>PICKUP from Env Experts </option> </select> </div> </div> <!-- <div class="col-md-12 form-group strp contact_del" <?php if ( $deliver_to == 'deliver_to_me' ) { ?>style="display:none" ;<?php } ?>> <label class="col-sm-3 control-label">Deliver Contact:</label> <div class="col-sm-7"> <?php $deliver_contact = get_post_meta( get_the_ID(), 'deliver_contact', true ); ?> <select name="deliver_contact" class="form-control required DeliverClient"> <option value=""> Select Below </option> <?php $user_id = get_post_meta( get_the_ID(), 'user_id', true ); $contacts = $wpdb->get_results( "select * from `wp_user_customer` where `user_id` = '{$user_id}'" ); ?> <?php foreach ( $contacts as $contact ) { ?> <option value="<?php echo $contact->id; ?>" address="<?php echo $contact->address; ?>" <?php if ( $deliver_contact == $contact->id ) { echo 'selected="selected"'; } ?>><?php echo $contact->name; ?></option> <?php } ?> </select> <a href="#" class="btn btn-primary addnew" data-toggle="modal" data-target="#contactModal">Add Customer</a> </div> </div> --> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Delivery Address:</label> <div class="col-sm-7"> <input name="delivery_address" class="form-control del_check delivery_address" value="<?php echo get_post_meta( get_the_ID(), 'delivery_address', true ); ?>" <?php if ( is_super_admin() == false ) { echo $disabled; } ?>> </div> </div> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Required Date:</label> <div class="col-sm-7"> <input name="delivery_date" class="form-control RequiredDate" value="<?php echo get_post_meta( get_the_ID(), 'delivery_date', true ); ?>" <?php if ( is_super_admin() == false ) { echo $disabled; } ?>> </div> </div> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Delivery Instructions:</label> <div class="col-sm-7"> <textarea name="delivery_instructions_" class="form-control" <?php if ( is_super_admin() == false ) { echo $disabled; } ?>><?php echo get_post_meta( get_the_ID(), 'delivery_instructions_', true ); ?></textarea> </div> </div> </div> <div class="col-md-12" style=""><b>Standard jobs are typically dispatched within approx. 3-4 working days....but we will try very hard to meet your deadline</b></div> </div> </div> <div class="panel background-green"> <div class="panel-heading"> <h3 class="panel-title tp">PDF DOCUMENTS <font size="3"> (Must be attached PRIOR to submitting Order - or email to <u>info@envelopeexperts.com.au)</u></font> </h3> </div> <div class="panel-body zp nopadding"> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Deliver Docket <?php echo FILE_SIZE_MESSAGE; ?> :</label> <div class="col-sm-3"> <?php if ( is_super_admin() ) { ?> <input name="delivery_docket" type="file" class="delivery_docket"> <?php } else { ?> <input name="delivery_docket" type="file" class="delivery_docket" <?php echo 'disabled'; ?> > <?php } ?> <?php $docket = get_field( 'delivery_docket', get_the_ID() ); if ( $docket ) { echo wp_get_attachment_link( $docket ); } ?> </div> </div> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Artwork <?php echo FILE_COUNT_MESSAGE . ', ' . FILE_SIZE_MESSAGE; ?> : </label> <div class="col-sm-4"> <?php if ( is_super_admin() ) { ?> <input name="upload_artwork_print_ready[]" type="file" class="artwork" multiple="" id="upload_artwork_print_ready"> <?php } else { ?> <input name="upload_artwork_print_ready[]" type="file" class="artwork" multiple="" id="upload_artwork_print_ready" <?php echo 'disabled'; ?> > <?php } ?> <i class="fas fa-times-circle" id="reset_upload_artwork_print_ready"></i> <?php $artwork = get_post_meta( get_the_ID(), 'upload_artwork_print_ready', true ); $data = @unserialize( $artwork ); if ( $data !== false ) { foreach ( $data as $artwork ) { echo wp_get_attachment_link( $artwork ); } } else { echo wp_get_attachment_link( $artwork ); } /* if ($artwork) { echo wp_get_attachment_link($artwork); } */ ?> </div> </div> <div class="col-md-12 form-group strp"> <label class="col-sm-3 control-label">Supporting Documents <?php echo FILE_SIZE_MESSAGE; ?> :</label> <div class="col-sm-3"> <?php if ( is_super_admin() ) { ?> <input name="upload_po" type="file" class="suppDocs"> <?php } else { ?> <input name="upload_po" type="file" class="suppDocs" <?php echo 'disabled'; ?> > <?php } ?> <?php $suppdoc = get_post_meta( get_the_ID(), 'upload_po', true ); if ( $suppdoc ) { echo wp_get_attachment_link( $suppdoc ); } ?> </div> </div> <?php $status = get_post_meta( get_the_ID(), 'status', true ); if ( is_super_admin() ) { ?> <div class="col-md-12 form-group strp"> <input id="oid" type="hidden" value="<?php echo get_the_ID(); ?>"> <label class="col-sm-3 control-label">Tax invoice:</label> <div class="col-sm-3"> <button class="download-invoice btn btn-normal btn-success"> Download Invoice </button> </div> </div> <?php } ?> </div> </div> <?php if ( is_super_admin() ) { ?> <div class="panel background-green"> <div class="panel-heading"> <h3 class="panel-title tp"> Comments</h3> </div> <div class="panel-body"> <div class="rowd"> <div class="form-group"> <label class="col-sm-3 control-label">Job Comments:</label> <div class="col-sm-3"> <textarea name="job_comments" class="form-control"><?php echo get_post_meta( get_the_ID(), 'job_comments', true ); ?></textarea> </div> </div> </div> </div> </div> <?php } ?> <div class="panel stage5"> <div class="panel-container"> <div class="orders-button-grid"> <!-- Column 1: Order Management --> <div class="button-column"> <?php if (is_super_admin()) : ?> <button class="action-btn submitorder"> <span>Update Order</span> <i class="fas fa-arrow-circle-right"></i> </button> <?php endif; ?> <button class="action-btn re-order"> <span>Re-Order</span> <i class="fas fa-arrow-circle-right"></i> </button> </div> <!-- Column 2: Empty --> <div class="button-column"> </div> <!-- Column 3: Export and Email --> <div class="button-column"> <?php if (is_super_admin()) : ?> <button id="export-to-word2" class="action-btn export-to-word"> <span>Export To Word</span> <i class="fas fa-arrow-circle-right"></i> </button> <a href="mailto:<?php echo esc_attr(get_post_meta(get_the_ID(), 'email_address', true)); ?>" class="action-btn email_client"> <span>Email Client</span> <i class="fas fa-envelope-open"></i> </a> <?php endif; ?> </div> </div> </div> </div> </form> </div> </div> </td> </tr> <?php endwhile; ?> <?php wp_reset_postdata(); ?> <?php else : ?> <p> <?php _e( 'Sorry, no orders found!' ); ?> </p> <?php endif; ?> </tbody> </table> </div> <?php wp_pagenavi( array( 'query' => $quotes ) ); ?> </div> </div> </div> </div> <?php } ?> </div> </div> </div> </div> <script> jQuery(document).ready(function ($) { $('#upload_artwork_print_ready').change(function () { jQuery('#reset_upload_artwork_print_ready').show(); }); $('#reset_upload_artwork_print_ready').click(function (e) { e.preventDefault(); $('form').find('#upload_artwork_print_ready').val(''); $('#reset_upload_artwork_print_ready').hide(); }); // ========== Start of D S Bailey Freelancer Addition Javascript =========== $('.download-invoice').click(function (e) { e.preventDefault(); $('body').ajaxloader('show'); var form = $(this).closest("form"); var formid = '#' + form.attr('id'); var oid = $(formid + ' .post_id').val(); $.ajax({ type: 'POST', url: "<?php echo get_home_url(); ?>/wp-admin/admin-ajax.php", data: {action: 'download_invoice', order_id: oid}, success: function (data) { $('body').ajaxloader('hide'); var result = JSON.parse(data); if (result.success) { window.open('<?php echo get_stylesheet_directory_uri(); ?>/temp-invoices/invoice-' + result.invoice_number + '.pdf', '_blank'); } else { shared.eeSwal('Error', data, 'There isn\'t an invoice number for this order.','error'); window.location.href = url; } } }); }); $('.export-to-word').click(function (e) { e.preventDefault(); $('body').ajaxloader(); var oid = $(e.target).closest('tr > td').attr('id'); $.ajax({ type: 'POST', url: "<?php echo get_home_url(); ?>/wp-admin/admin-ajax.php", data: { action: 'process_word_export', order_id: oid, }, success: function (data) { $('body').ajaxloader('hide'); window.location.href = '<?php echo get_theme_root_uri() ?>/456ecology-child/order-exports/order' + oid + '.docx'; // window.location.href = '<?php // echo get_template_directory(); ?>/456ecology-child'; }, fail: function (data) { alert('There was an error in the Export to Word:'); window.location.href = "<?php echo get_home_url(); ?>/orders"; } }); }); }); // ========== End of D S Bailey Freelancer Addition Javascript =========== </script> <?php } else { get_header(); ?> <div class="container" style="margin-top: 15px;"> <div class="row"> <div class="col-md-12"> <h3 style="color:#ff0000; background-color: white;padding: 20px; text-transform: uppercase"> You're not logged in</h3> </div> </div> </div> <?php } get_footer(); ?>
Save