Ejemplo n.º 1
0
    $host = $options["host"];
}
if ($options["user"]) {
    $user = $options["user"];
}
if ($options["pass"]) {
    $pass = $options["pass"];
}
if ($options["database"]) {
    $database = $options["database"];
}
$db = EasyConnect::getInstance($host, $user, $pass, $database);
$query = "Describe `{$table}`";
$results = $db->fetchAssoc($query);
$table_new_name = str_replace("_", " ", $table);
$table_new_name = Ucwords($table_new_name);
$table_new_name = str_replace(" ", "", $table_new_name);
$file_content = '<?php
namespace TModel\\Base;
use TaysORM\\TaysORMBase;

class ' . $table_new_name . 'Base extends TaysORMBase {

    public $table_name="' . $table . '";
    public $primary_keys = ' . get_primary_key($results) . ';
    
    public $columns=array( 
    ';
foreach ($results as $column) {
    $field = $column['Field'];
    $datatype = $column['Type'];
        function init()
        {
            global $last_days_orders, $wpdb;
            if (!isset($_REQUEST['page'])) {
                return false;
            }
            if (!current_user_can($this->constants['plugin_role'])) {
                wp_die(__('You do not have sufficient permissions to access this page.', 'icwoocommerce_textdomains'));
            }
            if (isset($_REQUEST['unknown_product'])) {
                $sql = "SELECT * FROM `{$wpdb->prefix}woocommerce_order_items` WHERE `order_item_name` LIKE 'Unknown Product' GROUP BY order_id ORDER BY order_id DESC";
                $items = $wpdb->get_results($sql);
                echo "<h3><strong>SQL Query</strong></h3>";
                $this->print_sql($sql);
                echo "<h3><strong>Results Query</strong></h3>";
                $this->print_array($items);
                return;
            }
            $order_date_field_key = $this->get_setting('order_date_field_key', $this->constants['plugin_options'], 'post_date');
            $shop_order_status = $this->get_set_status_ids();
            $hide_order_status = $this->constants['hide_order_status'];
            $hide_order_status = implode(",", $hide_order_status);
            $order_status_id = "";
            $order_status = "";
            if ($this->constants['post_order_status_found'] == 0) {
                $order_status_id = implode(",", $shop_order_status);
            } else {
                $order_status_id = "";
                $order_status = implode(",", $shop_order_status);
            }
            $order_status = strlen($order_status) > 0 ? $order_status : '-1';
            $order_status_id = strlen($order_status_id) > 0 ? $order_status_id : '-1';
            $hide_order_status = strlen($hide_order_status) > 0 ? $hide_order_status : '-1';
            $default_view = apply_filters('ic_commerce_detail_page_default_view', "yes");
            $detail_view = $this->get_request('detail_view', $default_view, true);
            $start_date = apply_filters('ic_commerce_detail_page_start_date', $this->constants['start_date'], $detail_view);
            $end_date = apply_filters('ic_commerce_detail_page_end_date', $this->constants['end_date'], $detail_view);
            $order_status = apply_filters('ic_commerce_detail_page_selected_order_status', $order_status, $detail_view);
            $onload_search = apply_filters('ic_commerce_detail_page_onload_search', "yes", $detail_view);
            $page_title = apply_filters('ic_commerce_detail_page_page_default_title', __("Detail Search", 'icwoocommerce_textdomains'));
            $previous_day = apply_filters('ic_commerce_detail_page_number_of_previous_day', "0");
            //-1,-2,-3,-4,-5
            $order_date_field_key = apply_filters('ic_commerce_detail_page_order_date_field_key', $order_date_field_key);
            //-1,-2,-3,-4,-5
            $publish_order = "no";
            $optionsid = "per_row_details_page";
            $per_page = $this->get_number_only($optionsid, $this->per_page_default);
            $sales_order = $this->get_request('sales_order', false);
            $ToDate = $this->get_request('end_date', false);
            $FromDate = $this->get_request('start_date', false);
            $order_status_id = $this->get_request('order_status_id', $order_status_id, true);
            //New Change ID 20140918
            $order_status = $this->get_request('order_status', $order_status, true);
            //New Change ID 20140918
            $publish_order = $this->get_request('publish_order', $publish_order, true);
            //New Change ID 20140918
            $hide_order_status = $this->get_request('hide_order_status', $hide_order_status, true);
            //New Change ID 20140918
            $detail_view = $this->get_request('detail_view', $detail_view, true);
            $product_id = $this->get_request('product_id', '-1', true);
            $category_id = $this->get_request('category_id', '-1', true);
            $adjacents = $this->get_request('adjacents', 3, true);
            $page = $this->get_request('page', NULL);
            $page_title = $this->get_request('page_title', $page_title);
            $order_id = $this->get_request('order_id', NULL, true);
            $txtFirstName = $this->get_request('txtFirstName', NULL, true);
            $txtEmail = $this->get_request('txtEmail', NULL, true);
            $payment_method = $this->get_request('payment_method', NULL, true);
            $order_item_name = $this->get_request('order_item_name', NULL, true);
            //for coupon
            $coupon_code = $this->get_request('coupon_code', NULL, true);
            $coupon_codes = $this->get_request('coupon_codes', NULL, true);
            $sort_by = $this->get_request('sort_by', 'order_id', true);
            $order_by = $this->get_request('order_by', 'DESC', true);
            $paid_customer = $this->get_request('paid_customer', '-1', true);
            $coupon_used = $this->get_request('coupon_used', 'no', true);
            $month_key = $this->get_request('month_key', false);
            $order_meta_key = $this->get_request('order_meta_key', '-1', true);
            $count_generated = $this->get_request('count_generated', 0, true);
            $country_code = '-1';
            $state_code = '-1';
            $country_state_code = $this->get_request('country_state_code', NULL, true);
            if ($country_state_code and strlen($country_state_code) > 0) {
                $country_state_codes = explode("-", $country_state_code);
                $_REQUEST['country_code'] = $country_code = isset($country_state_codes[0]) ? $country_state_codes[0] : NULL;
                $_REQUEST['state_code'] = $state_code = isset($country_state_codes[1]) ? $country_state_codes[1] : NULL;
            }
            $country_code = $this->get_request('country_code', $country_code, true);
            $state_code = $this->get_request('state_code', $state_code, true);
            if ($product_id == "all") {
                $product_id = $_REQUEST['product_id'] = "-1";
            }
            if ($txtFirstName == "all") {
                $txtFirstName = $_REQUEST['txtFirstName'] = "-1";
            }
            if ($order_status_id == "all") {
                $order_status_id = $_REQUEST['order_status_id'] = "-1";
            }
            if ($page_title) {
                $page_title = str_replace("_", " ", $page_title);
                $page_title = str_replace("-", " ", $page_title);
                $page_title = Ucwords($page_title);
            }
            if ($month_key && strlen($month_key) > 0) {
                $month_key = strtotime($month_key);
                $ToDate = date('Y-m-t', $month_key);
                $FromDate = date('Y-m-01', $month_key);
                $page_title = date('M Y', $month_key) . " detail reports";
            }
            if ($sales_order && strlen($sales_order) > 0) {
                if ($sales_order == "today") {
                    $_REQUEST['end_date'] = date_i18n('Y-m-d');
                    $_REQUEST['start_date'] = date_i18n('Y-m-d');
                    $page_title = __("Today's detail reports", 'icwoocommerce_textdomains');
                }
                if ($sales_order == "yesterday") {
                    $_REQUEST['end_date'] = date('Y-m-d', strtotime('-1 day', strtotime(date_i18n("Y-m-d"))));
                    $_REQUEST['start_date'] = date('Y-m-d', strtotime('-1 day', strtotime(date_i18n("Y-m-d"))));
                    $page_title = __("Yesterday's detail reports", 'icwoocommerce_textdomains');
                }
                $timestamp = time();
                if ($sales_order == "week") {
                    $current_dayname = date("l");
                    $_REQUEST['end_date'] = date('Y-m-d', $timestamp);
                    $_REQUEST['start_date'] = date("Y-m-d", strtotime("last sunday", $timestamp));
                    $page_title = __("This week detail reports", 'icwoocommerce_textdomains');
                }
                if ($sales_order == "month") {
                    $_REQUEST['end_date'] = date('Y-m-d', $timestamp);
                    $_REQUEST['start_date'] = date('Y-m-01', strtotime('this month'));
                    $page_title = __("This month detail reports", 'icwoocommerce_textdomains');
                }
                if ($sales_order == "year") {
                    $_REQUEST['end_date'] = date('Y-m-d', $timestamp);
                    $_REQUEST['start_date'] = date('Y-01-01', strtotime('this month'));
                    $page_title = __("This year detail reports", 'icwoocommerce_textdomains');
                }
                if ($sales_order == "all") {
                    $_REQUEST['end_date'] = $this->constants['end_date'];
                    $_REQUEST['start_date'] = $this->constants['start_date'];
                    //$page_title = __("This year detail reports",'icwoocommerce_textdomains');
                }
                $ToDate = $this->get_request('end_date', false);
                $FromDate = $this->get_request('start_date', false);
            }
            if (!$ToDate) {
                $ToDate = date_i18n('Y-m-d');
            }
            if (!$FromDate) {
                $last_days_orders = $previous_day;
                //-1,-2,-3,-4,-5
                $FromDate = date('Y-m-d', strtotime($last_days_orders . ' day', strtotime(date_i18n("Y-m-d"))));
                //echo $page.'_back_day';
            }
            $_REQUEST['end_date'] = $ToDate;
            $_REQUEST['start_date'] = $FromDate;
            if ($order_status_id && $order_status_id > 0) {
                //$page_title = $this->get_order_status_name($order_status_id)." Orders";
                //$page_title = "Product detail of ". $page_title. " category";
            }
            if ($product_id && $product_id > 0) {
                $page_title = sprintf(__('Product detail of %s', 'icwoocommerce_textdomains'), $this->get_product_name($product_id));
            }
            if ($country_code && $country_code != '-1' && strlen($country_code) > 1) {
                $page_title = sprintf(__('Product detail of %s country', 'icwoocommerce_textdomains'), $this->ic_cr_get_country_name($country_code));
            }
            if ($state_code && $state_code != '-1' && strlen($state_code) > 1) {
                $page_title = sprintf(__('Product detail of %s from %s country', 'icwoocommerce_textdomains'), $this->get_state($country_code, $state_code), $this->ic_cr_get_country_name($country_code));
            }
            if ($txtEmail && strlen($txtEmail) > 1) {
                $customer = $this->get_client_name($txtEmail, NULL);
                $page_title = sprintf(__('Product detail of %s', 'icwoocommerce_textdomains'), Ucwords($customer->billing_name));
            }
            if ($order_id && strlen($order_id) > 1) {
                $page_title = sprintf(__('Product detail of %s order ID', 'icwoocommerce_textdomains'), $order_id);
            }
            if ($payment_method && strlen($payment_method) > 1) {
                $page_title = sprintf(__('Product detail of %s payment method', 'icwoocommerce_textdomains'), $this->get_payment_method_name($payment_method));
            }
            if ($coupon_code && strlen($coupon_code) > 1) {
                $page_title = sprintf(__('Coupon detail of %s', 'icwoocommerce_textdomains'), $coupon_code);
            }
            if ($coupon_codes && strlen($coupon_codes) > 1) {
                $page_title = sprintf(__('Coupons detail of %s', 'icwoocommerce_textdomains'), $coupon_codes);
            }
            $_REQUEST['page_title'] = $page_title;
            $this->delete_column_option();
            ?>
					
                    <h2 class="hide_for_print"><?php 
            _e($page_title, 'icwoocommerce_textdomains');
            ?>
</h2>
                    <div id="navigation" class="hide_for_print">
                        <div class="collapsible" id="section1"><?php 
            _e('Custom Search', 'icwoocommerce_textdomains');
            ?>
<span></span></div>
                        <div class="container">
                            <div class="content">
                                <div class="search_report_form">
                                    <div class="form_process"></div>
                                    <form action="" name="Report" id="search_order_report" method="post">
                                        <div class="form-table">
                                            <div class="form-group">
                                                <div class="FormRow FirstRow">
                                                    <div class="label-text"><label for="start_date"><?php 
            _e('From Date:', 'icwoocommerce_textdomains');
            ?>
</label></div>
                                                    <div class="input-text"><input type="text" value="<?php 
            echo $FromDate;
            ?>
" id="start_date" name="start_date" readonly maxlength="10" /></div>
                                                </div>
                                                <div class="FormRow">
                                                    <div class="label-text"><label for="end_date"><?php 
            _e('To Date:', 'icwoocommerce_textdomains');
            ?>
</label></div>
                                                    <div class="input-text"><input type="text" value="<?php 
            echo $ToDate;
            ?>
" id="end_date" name="end_date" readonly maxlength="10" /></div>
                                                </div>
                                            </div>
                                            
                                            <div class="form-group">
                                                <div class="FormRow FirstRow">
                                                    <div class="label-text"><label for="order_id"><?php 
            _e('Order ID:', 'icwoocommerce_textdomains');
            ?>
</label></div>
                                                    <div class="input-text"><input type="text" id="order_id" name="order_id" class="numberonly" maxlength="20" value="<?php 
            echo $this->get_request('order_id', NULL, true);
            ?>
" /></div>
                                                </div>
                                                <div class="FormRow">
                                                    <div class="label-text"><label for="txtFirstName"><?php 
            _e('Customer:', 'icwoocommerce_textdomains');
            ?>
</label></div>
                                                    <div class="input-text"><input type="text" id="txtFirstName" name="txtFirstName" maxlength="20" value="<?php 
            echo $this->get_request('txtFirstName', NULL, true);
            ?>
" /></div>
                                                </div>
                                            </div>
                                            
                                            <div class="form-group">
                                                <div class="FormRow FirstRow">
                                                    <div class="label-text"><label for="category_id"><?php 
            _e('Category:', 'icwoocommerce_textdomains');
            ?>
</label></div>
                                                    <div class="input-text">
                                                        <?php 
            $category_data = $this->get_category_data();
            $this->create_dropdown($category_data, "category_id[]", "category_id", "Select All", "product_id", '-1', 'object', true, 5);
            ?>
                                                        
                                                    </div>
                                                    <span class="detail_view_seciton detail_view_seciton_note"><?php 
            _e("Enable product selection by clicking 'Show Order Item Details'", 'icwoocommerce_textdomains');
            ?>
</span>
                                                </div>
                                                <div class="FormRow">
                                                    <div class="label-text"><label for="product_id"><?php 
            _e('Product:', 'icwoocommerce_textdomains');
            ?>
</label></div>
                                                    <div class="input-text">
                                                        <?php 
            $product_data = $this->get_product_data('all');
            $this->create_dropdown($product_data, "product_id[]", "product_id", "Select All", "product_id", $product_id, 'object', true, 5);
            ?>
                                                    </div>
                                                    <span class="detail_view_seciton detail_view_seciton_note"><?php 
            _e("Enable product selection by clicking 'Show Order Item Details'", 'icwoocommerce_textdomains');
            ?>
</span>
                                                </div>
                                            </div>
                                            
                                            <div class="form-group">
                                                <div class="FormRow FirstRow">
                                                    <div class="label-text"><label for="paid_customer"><?php 
            _e('Customer:', 'icwoocommerce_textdomains');
            ?>
</label></div>
                                                    <div class="input-text">
                                                        <?php 
            $data = $this->get_order_customer();
            $this->create_dropdown($data, "paid_customer[]", "paid_customer", "Select All", "product_id", $paid_customer, 'object', true, 5);
            ?>
                                                    </div>
                                                </div>
                                                <div class="FormRow">
                                                    <div class="label-text"><label for="order_status_id"><?php 
            _e('Status:', 'icwoocommerce_textdomains');
            ?>
</label></div>
                                                    <div class="input-text">
                                                        <?php 
            //New Change ID 20140918
            if ($this->constants['post_order_status_found'] == 0) {
                $data = $this->ic_get_order_statuses_slug_id('shop_order_status');
                $this->create_dropdown($data, "order_status_id[]", "order_status_id", "Select All", "product_id", $order_status_id, 'object', true, 5);
                echo '<input type="hidden" name="order_status[]" id="order_status" value="' . $order_status . '">';
            } else {
                $order_statuses = $this->ic_get_order_statuses();
                if (in_array('trash', $this->constants['hide_order_status'])) {
                    unset($order_statuses['trash']);
                }
                $this->create_dropdown($order_statuses, "order_status[]", "order_status", "Select All", "product_id", $order_status, 'array', true, 5);
                echo '<input type="hidden" name="order_status_id[]" id="order_status_id" value="' . $order_status_id . '">';
            }
            ?>
                                                    </div>
                                                </div>
                                            </div>
                                            
                                           
                                             
                                            
                                             
                                            <?php 
            do_action("ic_commerce_detail_page_search_form_before_order_by", $this, $page);
            ?>
                                            
                                            <div class="form-group">
                                                <div class="FormRow FirstRow">
                                                    <div class="label-text"><label for="txtEmail"><?php 
            _e('Email:', 'icwoocommerce_textdomains');
            ?>
</label></div>
                                                    <div class="input-text"><input type="text" id="txtEmail" name="txtEmail" class="regular-text" maxlength="100" value="<?php 
            echo $txtEmail;
            ?>
" /></div>
                                                </div>
                                                
                                                <div class="FormRow">
                                                    <div class="label-text" style="padding-top:0px;"><label for="sort_by"><?php 
            _e('Order By:', 'icwoocommerce_textdomains');
            ?>
</label></div>
                                                    <div style="padding-top:0px;">
                                                    	 <?php 
            $data = array("order_id" => __("Order ID", 'icwoocommerce_textdomains'), "billing_name" => __("Name", 'icwoocommerce_textdomains'), 'billing_email' => __('Email', 'icwoocommerce_textdomains'), "order_date" => __("Date", 'icwoocommerce_textdomains'), "status" => __("Status", 'icwoocommerce_textdomains'));
            $this->create_dropdown($data, "sort_by", "sort_by", NULL, "sort_by", $sort_by, 'array');
            $data = array("ASC" => __("Ascending", 'icwoocommerce_textdomains'), "DESC" => __("Descending", 'icwoocommerce_textdomains'));
            $this->create_dropdown($data, "order_by", "order_by", NULL, "order_by", $order_by, 'array');
            ?>
                                                    </div>
                                                    
                                                </div>
                                                
                                            </div>
                                            
                                            <?php 
            do_action("ic_commerce_detail_page_search_form_after_order_by", $this);
            ?>
                                           
                                            <div class="form-group">
                                                <div class="FormRow FirstRow checkbox">
                                                    <div class="label-text" style="padding-top:0px;"><label for="detail_view"><?php 
            _e('Show Order Item Details:', 'icwoocommerce_textdomains');
            ?>
</label></div>
                                                    <div style="padding-top:0px;"><input type="checkbox" name="detail_view" id="detail_view" value="yes" <?php 
            if ($detail_view == "yes") {
                echo ' checked="checked"';
            }
            ?>
 /></div>
                                                </div>
                                                
                                                <div class="FormRow checkbox">
                                                    <div class="label-text" style="padding-top:0px;"><label for="coupon_used"><?php 
            _e('Coupon Used Only:', 'icwoocommerce_textdomains');
            ?>
</label></div>
                                                    <div style="padding-top:0px;"><input type="checkbox" name="coupon_used" id="coupon_used" value="yes" <?php 
            if ($coupon_used == "yes") {
                echo ' checked="checked"';
            }
            ?>
 /></div>
                                                </div>
                                            </div>
                                            
                                            <div class="form-group">
                                                <div class="FormRow" style="width:100%">
                                                    <input type="hidden" name="hide_order_status" 		id="hide_order_status" 	value="<?php 
            echo $hide_order_status;
            ?>
" /><!--//New Change ID 20140918-->
                                                    <input type="hidden" name="publish_order" 			id="publish_order" 		value="<?php 
            echo $publish_order;
            ?>
" />
                                                    <input type="hidden" name="order_item_name" 		id="order_item_name" 	value="<?php 
            echo $order_item_name;
            ?>
" />
                                                    <input type="hidden" name="coupon_code" 			id="coupon_code" 		value="<?php 
            echo $coupon_code;
            ?>
" />
                                                    <input type="hidden" name="coupon_codes" 			id="coupon_codes" 		value="<?php 
            echo $coupon_codes;
            ?>
" />
                                                    <input type="hidden" name="payment_method" 			id="payment_method" 	value="<?php 
            echo $payment_method;
            ?>
" />
                                                    <!--<input type="hidden" name="country_code" 			id="country_code" 		value="<?php 
            echo $country_code;
            ?>
" />
                                                    <input type="hidden" name="state_code" 				id="state_code" 		value="<?php 
            echo $state_code;
            ?>
" />-->
													<input type="hidden" name="limit"  					id="limit" 				value="<?php 
            echo $this->get_request('limit', $per_page, true);
            ?>
" />
                                                    <input type="hidden" name="p"  						id="p" 					value="<?php 
            echo $this->get_request('p', 1, true);
            ?>
" />
                                                    <input type="hidden" name="action" 					id="action" 			value="<?php 
            echo $this->get_request('action', $this->constants['plugin_key'] . '_wp_ajax_action', true);
            ?>
" />
                                                    <input type="hidden" name="page"  					id="page" 				value="<?php 
            echo $this->get_request('page', $page, true);
            ?>
" />
                                                    <input type="hidden" name="admin_page"  			id="admin_page" 		value="<?php 
            echo $this->get_request('admin_page', $page, true);
            ?>
" />
                                                    <input type="hidden" name="ic_admin_page" 			id="ic_admin_page" 		value="<?php 
            echo $this->get_request('ic_admin_page', $page, true);
            ?>
" />
                                                    <input type="hidden" name="adjacents"  				id="adjacents" 			value="<?php 
            echo $adjacents;
            ?>
" />
                                                    <input type="hidden" name="purchased_product_id"  	id="purchased_product_id" value="-1" />
                                                   	<input type="hidden" name="do_action_type" 			id="do_action_type" 	value="<?php 
            echo $this->get_request('do_action_type', 'detail_page', true);
            ?>
" />
                                                    <input type="hidden" name="page_title"  			id="page_title" 		value="<?php 
            echo $page_title;
            ?>
" />
                                                    <input type="hidden" name="total_pages"  			id="total_pages" 		value="<?php 
            echo $this->get_request('total_pages', 0, true);
            ?>
" />
                                                    <input type="hidden" name="variation_id"  			id="variation_id" 		value="<?php 
            echo $this->get_request('variation_id', '-1', true);
            ?>
" />
                                                    <input type="hidden" name="variation_only" 			id="variation_only_2"   value="<?php 
            echo $this->get_request('variation_only', '-1', true);
            ?>
" />
                                                    <!--<input type="hidden" name="order_meta_key" 		id="order_meta_key"		value="<?php 
            //echo $this->get_request('order_meta_key','-1',true);
            ?>
" />-->
                                                    <input type="hidden" name="amount_greater_zero" 	id="amount_greater_zero" value="<?php 
            echo $this->get_request('amount_greater_zero', $order_meta_key, true);
            ?>
" />
                                                    
													<input type="hidden" name="count_generated"  		id="count_generated" 	value="<?php 
            echo $count_generated;
            ?>
" />
                                                    <input type="hidden" name="date_format" 			id="date_format" 	value="<?php 
            echo $this->get_request('date_format', get_option('date_format'), true);
            ?>
" />
                                                    <input type="hidden" name="page_name"  				id="page_name" 			value="<?php 
            echo $this->get_request('page_name', 'all_detail', true);
            ?>
" />
                                                    <input type="hidden" name="onload_search" 			id="onload_search" 		value="<?php 
            echo $this->get_request('onload_search', $onload_search, true);
            ?>
" />
                                                    <input type="hidden" name="order_item_id" 			id="order_item_id" 		value="<?php 
            echo $this->get_request('order_item_id', '-1', true);
            ?>
" />
                                                    <input type="hidden" name="order_date_field_key" 	id="order_date_field_key" value="<?php 
            echo $this->get_request('order_date_field_key', $order_date_field_key, true);
            ?>
" />
                                                    
                                                    <input type="hidden" name="query_created" 			id="query_created" value="1" />
                                                    
                                                    <span class="submit_buttons">
                                                    	<input name="ResetForm" id="ResetForm" class="onformprocess" value="<?php 
            _e("Reset", 'icwoocommerce_textdomains');
            ?>
" type="reset"> 
                                                    	<input name="button_customize_columns" id="button_customize_columns" class="onformprocess" value="<?php 
            _e("Customize Column", 'icwoocommerce_textdomains');
            ?>
" type="button"> 
														<input name="SearchOrder" id="SearchOrder" class="onformprocess searchbtn btn_margin" value="<?php 
            _e("Search", 'icwoocommerce_textdomains');
            ?>
" type="submit"> &nbsp; &nbsp; &nbsp; <span class="ajax_progress"></span>
													</span>
                                                </div>
                                            </div>                                                
                                        </div>
                                    </form>
                                    <div class="form-group">
                                        <div class="tr_customize_column search_by_normal_fields" <?php 
            if ($detail_view == "yes") {
                echo ' style="display:none"';
            }
            ?>
> 
                                            <p><?php 
            _e("Normal View Column: ", 'icwoocommerce_textdomains');
            ?>
<span class="select_all_checkbox" data-type="save_normal_column" data-table="widefat_normal_table"><?php 
            _e("Select All", 'icwoocommerce_textdomains');
            ?>
</span></span></p>
                                            <?php 
            $this->create_checkbox("save_normal_column", "normal_view", "_order_checkbox");
            ?>
                                        </div>
                                        
                                        <div class="tr_customize_column search_by_details_fields" <?php 
            if ($detail_view == "no") {
                echo ' style="display:none"';
            }
            ?>
>
                                            <p><?php 
            _e("Order Item Details Column: ", 'icwoocommerce_textdomains');
            ?>
<span class="select_all_checkbox" data-type="save_detail_column" data-table="widefat_detial_table"><?php 
            _e("Select All", 'icwoocommerce_textdomains');
            ?>
</span></span></p>
                                            <?php 
            $this->create_checkbox("save_detail_column", "details_view", "order_checkbox");
            ?>
                                        </div>
                                    </div>
                                    <?php 
            //echo json_encode($product_data);
            ?>
                                    <script type="text/javascript">
                                    	jQuery(document).ready(function($) {
											<?php 
            /*
            $order_columns = $this->details_view_columns("order_columns");
            unset($order_columns['order_id_checkbox']);
            foreach($order_columns as $key => $value){
            	$label_key = "label.label_{$key}_save_detail_column";
            	echo "$(\"{$label_key}\").addClass('order_checkbox');\n";
            }
            
            $product_columns = $this->details_view_columns("product_columns");
            unset($product_columns['invoice_action']);
            foreach($product_columns as $key => $value){
            	$label_key = "label.label_{$key}_save_detail_column";
            	echo "$(\"{$label_key}\").addClass('product_checkbox');\n";
            }
            
            
            $_order_columns = $this->grid_columns("normal_view");
            unset($_order_columns['invoice_action']);
            foreach($_order_columns as $key => $value){
            	$label_key = "label.label_{$key}_save_normal_column";
            	echo "$(\"{$label_key}\").addClass('_order_checkbox');\n";
            }
            */
            $product_category = $this->get_product_category();
            $json_product_category = json_encode($product_category);
            $json_all_product = json_encode($product_data);
            ?>
											
											ic_commerce_vars['json_product_category'] 	= <?php 
            echo $json_product_category;
            ?>
;
											ic_commerce_vars['json_all_product'] 		= <?php 
            echo $json_all_product;
            ?>
;
											
											ic_commerce_vars['product_id'] 				= "<?php 
            echo $product_id == '-1' ? '-2' : $product_id;
            ?>
";
											ic_commerce_vars['category_id'] 			= "<?php 
            echo $category_id == '-1' ? '-2' : $category_id;
            ?>
";											
											
											create_dropdown(ic_commerce_vars['json_product_category'],ic_commerce_vars['json_all_product'],"product_id",Array(ic_commerce_vars['category_id']),Array(ic_commerce_vars['product_id']),'array');
											$('#category_id').change(function(){
												var parent_id = $(this).val();
												if(parent_id == null) parent_id = Array("-1");
												create_dropdown(ic_commerce_vars['json_product_category'],ic_commerce_vars['json_all_product'],"product_id",parent_id,Array('-2'),"array");
											});
											
											$('#ResetForm').click(function(){
												create_dropdown(ic_commerce_vars['json_product_category'],ic_commerce_vars['json_all_product'],"product_id",Array(ic_commerce_vars['category_id']),Array(ic_commerce_vars['product_id']),'array');
												
											});
										});
                                    </script>
                                    <style type="text/css">
                                    	th.invoice_action{
											width:100px;
										}
										
										td.invoice_action{
											text-align:center;
										}
										.widefat.summary_table{
											width:auto;
										}
										.widefat.summary_table td, .widefat.summary_table th{
											text-align:right;
										}
										.iccommercepluginwrap .form-group.dynamic_fields{
											margin-bottom:0;
										}						
										.iccommercepluginwrap .form-group.dynamic_fields .FirstRow{
											margin-bottom:15px;
										}
										.iccommercepluginwrap .form-group.dynamic_fields .SecondRow{
											margin-bottom:15px;
										}										
										<?php 
            $report_name = $this->get_request('report_name', '');
            $columns = $this->grid_columns("normal_view");
            echo $this->get_pdf_style_align($columns, 'right', '.iccommercepluginwrap ', '', "normal_view");
            $columns = $this->grid_columns("details_view");
            echo $this->get_pdf_style_align($columns, 'right', '.iccommercepluginwrap ', '', "details_view");
            ?>
                                    </style>
                                </div>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="table table_shop_content search_report_content hide_for_print">
						<?php 
            if ($onload_search == "no") {
                echo "<div class=\"order_not_found\">" . __("In order to view the results please hit \"<strong>Search</strong>\" button.", 'icwoocommerce_textdomains') . "</div>";
            }
            ?>
                    </div>
                    <div id="search_for_print_block" class="search_for_print_block">
                    	<?php 
            /*if($detail_view == "yes"){
                 	$this->ic_commerce_custom_report_detail('all_row', $columns);
              }else{
                 $this->ic_commerce_custom_report_normal('all_row', $columns);
              }*/
            ?>
                    </div>
                       <?php 
            $admin_page = $this->get_request('admin_page');
            //$admin_page_url 		= get_option('siteurl').'/wp-admin/admin.php';//Commented not work SSL admin site 20150212
            $admin_page_url = $this->constants['admin_page_url'];
            //Added SSL fix 20150212
            $mngpg = $admin_page_url . '?page=' . $admin_page;
            $billing_information = $this->get_setting('billing_information', $this->constants['plugin_options'], 0);
            $shipping_information = $this->get_setting('shipping_information', $this->constants['plugin_options'], 0);
            $logo_image = $this->get_setting('logo_image', $this->constants['plugin_options'], '');
            $report_title = $this->get_setting('report_title', $this->constants['plugin_options'], '');
            $company_name = $this->get_setting('company_name', $this->constants['plugin_options'], '');
            $page_title = $this->get_request('page_title', NULL, true);
            $set_report_title = $report_title;
            if ($page_title) {
                $page_title = " (" . $page_title . ")";
            }
            $report_title = $report_title . $page_title;
            ?>
                        <div id="export_csv_popup" class="popup_box">
                            <h4><?php 
            _e("Export to CSV - Additional Information", 'icwoocommerce_textdomains');
            ?>
</h4>
                            <a class="popup_close" title="Close popup"></a>
                            <div class="popup_content">                        	
                            <form id="<?php 
            echo $admin_page;
            ?>
_csv_popup_form" class="<?php 
            echo $admin_page;
            ?>
_csv_popup_form" action="<?php 
            echo $mngpg;
            ?>
" method="post">
                                <div class="popup_csv_hidden_fields popup_hidden_fields"></div>
                                
                                 <table class="popup_form_table">
                                    <tr>
                                        <th><label for="billing_information"><?php 
            _e("Billing Information:", 'icwoocommerce_textdomains');
            ?>
</label></th>
                                        <td><input id="billing_information" name="billing_information" value="1" type="checkbox"<?php 
            if ($billing_information == 1) {
                echo ' checked="checked"';
            }
            ?>
 /></td>
                                    </tr>
                                    <tr>
                                        <th><label for="shipping_information"><?php 
            _e("Shipping Information:", 'icwoocommerce_textdomains');
            ?>
</label></th>
                                        <td><input id="shipping_information" name="shipping_information" value="1" type="checkbox"<?php 
            if ($shipping_information == 1) {
                echo ' checked="checked"';
            }
            ?>
></td>
                                    </tr>
                                   	<?php 
            do_action('ic_commerce_export_csv_popup_extra_option', $page);
            ?>
                                    <tr>
                                        <td colspan="2"><input type="submit" name="<?php 
            echo $admin_page;
            ?>
_export_csv" class="onformprocess button_popup_close" value="<?php 
            _e("Export to CSV", 'icwoocommerce_textdomains');
            ?>
" /></td>
                                    </tr>                                
                                </table>
                            </form>
                            <div class="clear"></div>
                            </div>
                        </div>
                        <div id="export_pdf_popup" class="popup_box export_pdf_popup">
                            <a class="popup_close" title="Close popup"></a>
                            <h4><?php 
            _e("Export to PDF", 'icwoocommerce_textdomains');
            ?>
</h4>
                            <div class="popup_content">
                            <form id="<?php 
            echo $admin_page;
            ?>
_pdf_popup_form" class="<?php 
            echo $admin_page;
            ?>
_pdf_popup_form" action="<?php 
            echo $mngpg;
            ?>
" method="post">
                                <div class="popup_pdf_hidden_fields popup_hidden_fields"></div>
                                 <table class="form-table">
                                    <tr>
                                        <th><label for="company_name_pdf"><?php 
            _e("Company Name:", 'icwoocommerce_textdomains');
            ?>
</label></th>
                                        <td><input id="company_name_pdf" name="company_name" value="<?php 
            echo $company_name;
            ?>
" type="text" class="textbox"></td>
                                    </tr>
                                    <tr>
                                        <th><label for="report_title_pdf"><?php 
            _e("Report Title:", 'icwoocommerce_textdomains');
            ?>
</label></th>
                                        <td><input id="report_title_pdf" name="report_title" value="<?php 
            echo $report_title;
            ?>
" data-report_title="<?php 
            echo $set_report_title;
            ?>
" type="text" class="textbox"></td>
                                    </tr>
                                    <?php 
            if ($logo_image) {
                ?>
                                    <tr>
                                        <th><label for="display_logo_pdf"><?php 
                _e("Show Logo:", 'icwoocommerce_textdomains');
                ?>
</label></th>
                                        <td class="inputfield"><input id="display_logo_pdf" name="display_logo" value="1" type="checkbox"<?php 
                if ($logo_image) {
                    echo ' checked="checked"';
                }
                ?>
></td>
                                    </tr>
                                    <?php 
            }
            ?>
                                     <tr>
                                        <th><label for="display_date_pdf"><?php 
            _e("Show Date:", 'icwoocommerce_textdomains');
            ?>
</label></th>
                                        <td class="inputfield"><input id="display_date_pdf" name="display_date" value="1" type="checkbox" checked="checked"></td>
                                    </tr>
                                    <?php 
            do_action('ic_commerce_export_pdf_popup_extra_option', $page);
            ?>
                                    <tr>
									<th><label for="orientation_portrait_pdf"><?php 
            _e("PDF Orientation:", 'icwoocommerce_textdomains');
            ?>
</label></th>
									<td class="inputfield">
                                    <label for="orientation_portrait_pdf"><input id="orientation_portrait_pdf" name="orientation_pdf" value="portrait" type="radio"> <?php 
            _e("Portrait", 'icwoocommerce_textdomains');
            ?>
</label>
                                    <label for="orientation_landscape_pdf"><input id="orientation_landscape_pdf" name="orientation_pdf" value="landscape" type="radio" checked="checked"> <?php 
            _e("Landscape", 'icwoocommerce_textdomains');
            ?>
</label>
                                    
                                    </td>
                                    </tr>
                                    <tr>
                                        <th><label for="paper_size_pdf"><?php 
            _e("Paper Size:", 'icwoocommerce_textdomains');
            ?>
</label></th>
                                        <td class="inputfield">
                                        <?php 
            $paper_sizes = $this->get_pdf_paper_size();
            $this->create_dropdown($paper_sizes, "paper_size", "paper_size2", "", "paper_size2", 'letter', 'array', false, 5);
            ?>
                                    
                                    </tr>
                                    <tr>
                                        <td colspan="2">                                                                                
                                        <input type="submit" name="<?php 
            echo $admin_page;
            ?>
_export_pdf" class="onformprocess button_popup_close" value="<?php 
            _e("Export to PDF:", 'icwoocommerce_textdomains');
            ?>
" /></td>
                                    </tr>                                
                                </table>
                                <input type="hidden" name="display_center" value="center_header" />
                                <input type="hidden" name="pdf_keywords" value="" />
                                <input type="hidden" name="pdf_description" value="" />
                            </form>
                            <div class="clear"></div>
                            </div>
                        </div>						
                        <div id="export_print_popup" class="popup_box export_pdf_popup export_print_popup">
                            <a class="popup_close" title="Close popup"></a>
                            <h4>Export to PDF</h4>
                            <div class="popup_content">
                            <form id="<?php 
            echo $admin_page;
            ?>
_print_popup_form" class="<?php 
            echo $admin_page;
            ?>
_pdf_popup_form" action="<?php 
            echo $mngpg;
            ?>
" method="post">
                                <div class="popup_print_hidden_fields popup_hidden_fields2"></div>
                                 <table class="form-table">
                                    <tr>
                                        <th><label for="company_name_print"><?php 
            _e("Company Name:", 'icwoocommerce_textdomains');
            ?>
</label></th>
                                        <td><input id="company_name_print" name="company_name" value="<?php 
            echo $company_name;
            ?>
" type="text" class="textbox"></td>
                                    </tr>
                                    <tr>
                                        <th><label for="report_title_print"><?php 
            _e("Report Title:", 'icwoocommerce_textdomains');
            ?>
</label></th>
                                        <td><input id="report_title_print" name="report_title" value="<?php 
            echo $report_title;
            ?>
" data-report_title="<?php 
            echo $set_report_title;
            ?>
" type="text" class="textbox"></td>
                                    </tr>
                                    <?php 
            if ($logo_image) {
                ?>
                                    <tr>
                                        <th><label for="display_logo_print"><?php 
                _e("Print Logo:", 'icwoocommerce_textdomains');
                ?>
</label></th>
                                        <td class="inputfield"><input id="display_logo_print" name="display_logo" value="1" type="checkbox"<?php 
                if ($logo_image) {
                    echo ' checked="checked"';
                }
                ?>
></td>
                                    </tr>
                                    <?php 
            }
            ?>
                                     <tr>
                                        <th><label for="display_date_print"><?php 
            _e("Print Date:", 'icwoocommerce_textdomains');
            ?>
</label></th>
                                        <td class="inputfield"><input id="display_date_print" name="display_date" value="1" type="checkbox" checked="checked"></td>
                                    </tr>
                                    <?php 
            do_action('ic_commerce_export_print_popup_extra_option', $page);
            ?>
                                    <tr>
                                        <td colspan="2"><input type="button" name="<?php 
            echo $admin_page;
            ?>
_export_print" class="onformprocess button_popup_close search_for_print" value="<?php 
            _e("Print", 'icwoocommerce_textdomains');
            ?>
" data-form="popup"  data-do_action_type="detail_page_for_print" /></td>
                                    </tr>                                
                                </table>
                                <input type="hidden" name="display_center" value="1" />
                            </form>
                            <div class="clear"></div>
                            </div>
                        </div>
                        <div class="popup_mask"></div>                   
						<?php 
            do_action("ic_commerce_details_page_footer_area", $page);
            echo $this->delete_ic_commerce();
            ?>
                        
						<?php 
        }