Example #1
0
function upcoming_transaction_dashboard_widget()
{
    $args = array('meta_key' => 'is_expired', 'meta_value' => '0', 'post_status' => 'publish', 'post_type' => CUSTOM_POST_TYPE1, 'orderby' => 'DESC');
    $live_posts = get_posts($args);
    if ($live_posts) {
        echo '<link href="' . get_template_directory_uri() . '/monetize/admin.css" rel="stylesheet" type="text/css" />';
        echo '<table class="widefat"  width="100%" >
			<thead>	
			<tr>
				<th valign="top" align="left">ID</th>
				<th valign="top" align="left">Deal Title</th>
				<th valign="top" align="left">Total Transaction</th>
				<th valign="top" align="left">Original Price</th>
				<th valign="top" align="left">Discounted Price</th>
				<th valign="top" align="left">Status</th>
			</tr>';
        foreach ($live_posts as $post) {
            if (get_post_meta($post->ID, 'status', true) == '1' || get_post_meta($post->ID, 'status', true) == '2') {
                $status = ifetch_status(get_post_meta($post->ID, 'status', true), get_post_meta($post->ID, 'is_expired', true));
                if ($status == 'Pending') {
                    $status_dis = "<span class='color_pending'>Pending</span>";
                } else {
                    if ($status == 'Expired') {
                        $status_dis = "<span class='color_expire'>Expired</span>";
                    } else {
                        if ($status == 'Accepted') {
                            $status_dis = "<span class='color_active'>Accepted</span>";
                        } else {
                            if ($status == 'Active') {
                                $status_dis = "<span class='color_active'>Active</span>";
                            } else {
                                if ($status == 'Rejected') {
                                    $status_dis = "<span class='color_reject'><strong>Rejected</strong></span>";
                                } else {
                                    $status_dis = "<span class='color_terminate'><strong>Terminated</strong></span>";
                                }
                            }
                        }
                    }
                }
                echo '<tr>
				<td valign="top" align="left">' . $post->ID . '</td>
				<td valign="top" align="left"><a href="' . site_url() . '/wp-admin/admin.php?page=report&deal_id=' . $post->ID . '#option_deal_report">' . $post->post_title . '</a></td>
				<td valign="top" align="left">' . deal_transaction($post->ID) . '</td>
				<td valign="top" align="left">' . get_currency_sym() . get_post_meta($post->ID, 'current_price', true) . '</td>
				<td valign="top" align="left">' . get_currency_sym() . get_post_meta($post->ID, 'our_price', true) . '</td>
				<td valign="top" align="left">' . $status_dis . '</td>';
            }
        }
        echo '</thead>	</table>';
    }
}
Example #2
0
    $authorsql_conditions .= " and p.post_author = '" . $_REQUEST['id'] . "'";
}
$authorinfo = $wpdb->get_results($authorsql_select . $authorsql_from . $authorsql_conditions);
if ($authorinfo) {
    foreach ($authorinfo as $authorObj) {
        echo "ID,Seller,Deal,Sale,Customer\r ";
        echo "{$authorObj->ID},{$authorObj->user_nicename}," . deal_count_post($authorObj->ID) . "," . deal_salecount_post($authorObj->ID) . "," . deal_salecount_post($authorObj->ID) . " \r\n\r\n";
        $deal_cnt = $wpdb->get_results("select ID,post_title from {$post_table} where post_author = '" . $authorObj->ID . "' and post_type='seller' and post_status = 'publish'");
        if ($deal_cnt) {
            $cnt = 0;
            $count = count($deal_cnt);
            echo "Post ID,Title,Original Price,Discounted Price,Start Time,End Time,Status\r\n";
            foreach ($deal_cnt as $postObj) {
                $cnt++;
                $post_title = str_replace(',', ' ', $postObj->post_title);
                $status = ifetch_status(get_post_meta($postObj->ID, 'status', true), get_post_meta($postObj->ID, 'is_expired', true));
                if (get_post_meta($postObj->ID, 'coupon_start_date_time', true) != '') {
                    $start_date = date("Y-m-d H:i:s", get_post_meta($postObj->ID, 'coupon_start_date_time', true));
                }
                if (get_post_meta($postObj->ID, 'coupon_end_date_time', true) != '') {
                    $end_date = date("Y-m-d H:i:s", get_post_meta($postObj->ID, 'coupon_start_date_time', true));
                }
                echo "{$postObj->ID},{$post_title}," . get_post_meta($postObj->ID, 'current_price', true) . "," . get_post_meta($postObj->ID, 'our_price', true) . ",{$start_date},{$end_date},{$status}\r\n";
                if ($cnt == $count) {
                    echo "\r\n";
                }
            }
        }
    }
} else {
    echo "No record available";
Example #3
0
$trans_table = $wpdb->prefix . "deal_transaction";
$post_table = $wpdb->prefix . "posts";
$ordersql_select = "select t.*,p.ID ";
$ordersql_from = " from {$trans_table} t,{$post_table} p ";
$ordersql_conditions = " where p.ID = t.post_id and t.status = '1'";
if ($_REQUEST['deal_id'] != '') {
    $id = $_REQUEST['deal_id'];
    $ordersql_conditions .= " and t.post_id = {$id}";
}
$ordersql_conditions .= " group by p.ID";
$priceinfo_count = $wpdb->get_results($ordersql_select . $ordersql_from . $ordersql_conditions);
if ($priceinfo_count > 0) {
    foreach ($priceinfo_count as $priceinfoObj) {
        $post_title = str_replace(',', ' ', $priceinfoObj->post_title);
        echo "ID,Title,Total Transaction,Status\r ";
        echo "{$priceinfoObj->ID},{$post_title}," . deal_transaction($priceinfoObj->ID) . "," . ($status = ifetch_status(get_post_meta($post->ID, 'status', true), get_post_meta($post->ID, 'is_expired', true)) . " \r\n \r\n");
        $deal_cnt = $wpdb->get_results("select * from {$trans_table} where post_id = '" . $priceinfoObj->ID . "' and status = '1'");
        if (count($deal_cnt) > 0) {
            echo "Title,Deal Coupon,Pay Date,Billing name,Billing address,Shipping name, Shipping address,Pay Method,Amount\r\n";
            $trans_table = $wpdb->prefix . "deal_transaction";
            foreach ($deal_cnt as $postObj) {
                $sub_post_title = str_replace(',', ' ', $postObj->post_title);
                $billing_add = str_replace(array(',', '<br />'), ' ', $postObj->billing_add);
                $shipping_add = str_replace(array(',', '<br />'), ' ', $postObj->shipping_add);
                echo "{$sub_post_title},{$postObj->deal_coupon}," . date('d/m/Y', strtotime($postObj->payment_date)) . ",{$postObj->billing_name},{$billing_add},{$postObj->shipping_name},{$shipping_add},{$postObj->payment_method}," . get_currency_sym() . number_format($postObj->payable_amt, 2) . " \r";
            }
        }
        echo "\r\n";
    }
} else {
    echo "No record available";