예제 #1
0
    $d_next_month = gmdate("Y-m-d H:i:s", $t_next_month);
    $sql = "UPDATE subscription_invoices SET subscr_end='" . jb_escape_sql($d_next_month) . "' WHERE invoice_id = '" . jb_escape_sql($_REQUEST['invoice_id']) . "' ";
    jb_mysql_query($sql);
    $JBMarkup->ok_msg('Subtracted 1 month');
}
if ($_REQUEST['expire'] != '') {
    $invoice_row = JB_get_subscription_invoice_row($_REQUEST['invoice_id']);
    JB_expire_subscription($invoice_row, $send_email = false);
    $JBMarkup->ok_msg('Subscription expired');
}
if ($_REQUEST['reactivate'] != '') {
    $invoice_row = JB_get_subscription_invoice_row($_REQUEST['invoice_id']);
    $now = gmdate("Y-m-d H:i:s");
    $sql = "UPDATE subscription_invoices SET `status`='Completed', `processed_date`='{$now}' WHERE invoice_id='" . $_REQUEST['invoice_id'] . "'";
    $result = JB_mysql_query($sql) or JB_mail_error("[{$sql}]" . mysql_error());
    JB_start_employer_subscription($invoice_row);
    $JBMarkup->ok_msg('Subscription reactivated');
}
if ($_REQUEST['save'] != '') {
    $invoice_row = JB_get_subscription_invoice_row($_REQUEST['invoice_id']);
    if ($_REQUEST['can_view_resumes'] == 'Y') {
        $can_view_resumes = ", can_view_resumes='Y'";
    } else {
        $can_view_resumes = ", can_view_resumes='N'";
    }
    if ($_REQUEST['can_post'] == 'Y') {
        $can_post = ", can_post='Y'";
    } else {
        $can_post = ", can_post='N'";
    }
    if ($_REQUEST['can_post_premium'] == 'Y') {
예제 #2
0
function JB_complete_subscription_invoice($invoice_id, $payment_method)
{
    $invoice_row = JB_get_subscription_invoice_row($invoice_id);
    if ($payment_method == '') {
        $payment_method = $invoice_row['payment_method'];
    }
    if ($invoice_row['status'] == 'Confirmed' || $invoice_row['status'] == 'Pending') {
        $now = gmdate("Y-m-d H:i:s");
        $sql = "UPDATE subscription_invoices SET `status`='Completed', `payment_method`='" . jb_escape_sql($payment_method) . "', `processed_date`='{$now}' WHERE invoice_id='" . jb_escape_sql($invoice_id) . "'";
        $result = JB_mysql_query($sql) or JB_mail_error("[{$sql}]" . mysql_error());
        if ($invoice_row['reason'] != 'jb_credit_advanced') {
            // bank and check modules have the option to advance credits. If the credit was given in advance, then this invoice would have a jb_credit_advanced reason
            JB_start_employer_subscription($invoice_row);
        }
        if (JB_EMAIL_ORDER_COMPLETED_SWITCH == 'YES') {
            // send conformation.
            // get the user's record to send to
            $sql = "Select * from employers WHERE ID='" . jb_escape_sql($invoice_row['employer_id']) . "'";
            $result = JB_mysql_query($sql) or die(mysql_error());
            $e_row = mysql_fetch_array($result, MYSQL_ASSOC);
            $invoice_row = JB_get_subscription_invoice_row($invoice_id);
            // reload invoice
            $template_r = JB_get_email_template(90, $e_row['lang']);
            $template = mysql_fetch_array($template_r);
            $msg = $template['EmailText'];
            $from = $template['EmailFromAddress'];
            $from_name = $template['EmailFromName'];
            $subject = $template['EmailSubject'];
            $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
            $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
            $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
            $msg = str_replace("%INVOICE_CODE%", "S" . $invoice_row['invoice_id'], $msg);
            $msg = str_replace("%ITEM_NAME%", $invoice_row['item_name'], $msg);
            $msg = str_replace("%SUB_START%", JB_get_formatted_time(JB_get_local_time($invoice_row['subscr_date'])), $msg);
            $msg = str_replace("%SUB_END%", JB_get_formatted_time(JB_get_local_time($invoice_row['subscr_end'])), $msg);
            $msg = str_replace("%SUB_DURATION%", $invoice_row['months_duration'], $msg);
            $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($invoice_row['currency_code'], $invoice_row['amount']), $msg);
            $msg = str_replace("%PAYMENT_METHOD%", $payment_method, $msg);
            $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
            $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
            preg_match('#%INVOICE_TAX=\\[(.+?)\\]%#', $msg, $m);
            $tax_rate = $m[1];
            $invoice_tax = $invoice_row['amount'] - $invoice_row['amount'] / (1.0 + $tax_rate);
            $invoice_tax = JB_convert_to_default_currency_formatted($invoice_row['currency_code'], $invoice_tax);
            $msg = str_replace($m[0], $invoice_tax, $msg);
            $to = $e_row['Email'];
            $to_name = JB_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
            $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 90);
            JB_process_mail_queue(1, $email_id);
        }
    }
}
예제 #3
0
    function process_payment_return()
    {
        global $label;
        if ($_REQUEST['order_id'] != '' && $_REQUEST['nhezk5'] != '') {
            $invoice_id = jb_strip_order_id($_REQUEST['order_id']);
            $product_type = substr($invoice_id, 0, 1);
            // 'P' or 'S'
            $invoice_id = substr($invoice_id, 1);
            if ($_SESSION['JB_ID'] == '') {
                echo "Error: You must be logged in to view this page";
                JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type);
            } else {
                JBPLUG_do_callback('pay_trn_verification_passed', $invoice_id, $product_type);
                ?>
				
				<div style='background-color: #ffffff; border-color:#C0C0C0; border-style:solid;padding:10px'>
				<p align="center"><center>
				<?php 
                if ($product_type == 'P') {
                    $sql = "SELECT * from package_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } elseif ($product_type == 'S') {
                    $sql = "SELECT * from subscription_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } elseif ($product_type == 'M') {
                    $sql = "SELECT * from membership_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                }
                $result = JB_mysql_query($sql) or die(mysql_error() . $sql);
                $order_row = mysql_fetch_array($result, MYSQL_ASSOC);
                if (BANK_TAX_RATE > 0) {
                    if (BANK_ADD_TAX != 'Y') {
                        // taxes included in prices
                        // work out the tax paid in the amount
                        $tax = $order_row['amount'] - $order_row['amount'] / (1.0 + BANK_TAX_RATE);
                    } else {
                        $tax = $order_row['amount'] * BANK_TAX_RATE;
                        $order_row['amount'] = $order_row['amount'] + $tax;
                        // update the amount on the invoice row
                        if (!does_field_exist("package_invoices", "invoice_tax")) {
                            $sql = "ALTER TABLE `package_invoices` ADD `invoice_tax` FLOAT NOT NULL DEFAULT '0';";
                            mysql_query($sql) or die($sql . mysql_error());
                            $sql = "ALTER TABLE `subscription_invoices` ADD `invoice_tax` FLOAT NOT NULL DEFAULT '0';";
                            mysql_query($sql) or die($sql . mysql_error());
                            $sql = "ALTER TABLE `membership_invoices` ADD `invoice_tax` FLOAT NOT NULL DEFAULT '0';";
                            mysql_query($sql) or die($sql . mysql_error());
                        }
                        if ($product_type == 'P') {
                            $sql = "UPDATE package_invoices SET invoice_tax='" . (0 - $tax) . "', amount = amount + '" . jb_escape_sql($order_row['amount']) . "' WHERE invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' AND invoice_tax != '' ";
                        } elseif ($product_type == 'S') {
                            $sql = "UPDATE subscription_invoices SET invoice_tax='" . (0 - $tax) . "', amount = amount + '" . jb_escape_sql($order_row['amount']) . "' WHERE invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' AND invoice_tax != ''";
                        } elseif ($product_type == 'M') {
                            $sql = "UPDATE membership_invoices SET invoice_tax='" . (0 - $tax) . "', amount = amount + '" . jb_escape_sql($order_row['amount']) . "' WHERE invoice_id='" . jb_escape_sql($invoice_id) . "' and user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' AND invoice_tax != ''";
                        }
                    }
                }
                if (BANK_ADVANCE_CREDIT == 'YES' && strtolower($order_row['status']) != 'pending') {
                    // place the order as 'pending' and advance the credits
                    if ($product_type == 'P') {
                        // posting credits
                        $order_row = JB_pend_package_invoice($invoice_id, $payment_method = 'bank', $pending_reason = 'jb_credit_advanced');
                        // credit the points to the customer's account
                        JB_add_posting_credits($order_row);
                    }
                    if ($product_type == 'S') {
                        // subscription to view resumes
                        $order_row = JB_pend_subscription_invoice($invoice_id, $payment_method = 'bank', $pending_reason = 'jb_credit_advanced');
                        JB_start_employer_subscription($order_row);
                    }
                    if ($product_type == 'M') {
                        // membership
                        $order_row = JB_pend_membership_invoice($invoice_id, $payment_method = 'bank', $pending_reason = 'jb_credit_advanced');
                        JB_start_membership($order_row);
                    }
                    JBPLUG_do_callback('pay_trn_pending', $invoice_id, $product_type);
                }
                $bank_amount = JB_convert_to_currency($order_row['amount'], $order_row['currency_code'], BANK_CURRENCY);
                $bank_amount = JB_format_currency($bank_amount, BANK_CURRENCY, true);
                $label['payment_bank_heading'] = str_replace("%INVOICE_AMOUNT%", $bank_amount, $label['payment_bank_heading']);
                $label['payment_bank_note'] = str_replace("%CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $label['payment_bank_note']);
                $label['payment_bank_note'] = str_replace("%INVOICE_CODE%", $product_type . $invoice_id, $label['payment_bank_note']);
                $label['payment_bank_tax'] = str_replace("%INVOICE_TAX%", JB_format_currency($tax, BANK_CURRENCY, true), $label['payment_bank_tax']);
                if (JB_get_default_currency() != BANK_CURRENCY) {
                    echo JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']) . " = " . $bank_amount;
                    echo "<br>";
                }
                ?>
				
				<table width="70%"><tr><td>
				<?php 
                if (BANK_TAX_RATE > 0) {
                    ?>
				<b><?php 
                    echo $label['payment_bank_tax'];
                    ?>
</b><br>
				<?php 
                }
                ?>
				<b><?php 
                echo $label['payment_bank_heading'];
                ?>
</b><br>
				
				<?php 
                if (BANK_NAME != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_name'];
                    ?>
</b> <?php 
                    echo BANK_NAME;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_ADDRESS != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_addr'];
                    ?>
</b> <?php 
                    echo BANK_ADDRESS;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_ACCOUNT_NAME != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_ac_name'];
                    ?>
</b> <?php 
                    echo BANK_ACCOUNT_NAME;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_ACCOUNT_NUMBER != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_ac_number'];
                    ?>
</b> <?php 
                    echo BANK_ACCOUNT_NUMBER;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_BRANCH_NUMBER != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_branch_number'];
                    ?>
</b> <?php 
                    echo BANK_BRANCH_NUMBER;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_SWIFT != '') {
                    ?>

				<b><?php 
                    echo $label['payment_bank_swift'];
                    ?>
</b> <?php 
                    echo BANK_SWIFT;
                    ?>
<br>

				<?php 
                }
                ?>
				<?php 
                echo $label['payment_bank_note'];
                ?>
				</td></tr>
				</table>
				
				</p>
				</center>
				
				</div>
				<?php 
                if ($order_row['user_type'] == 'C') {
                    $sql = "Select * from users where ID='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } else {
                    $sql = "Select * from employers where ID='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                }
                $result = JB_mysql_query($sql) or die(mysql_error());
                $e_row = mysql_fetch_array($result, MYSQL_ASSOC);
                if ($product_type == 'P') {
                    $template_r = JB_get_email_template(60, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, BANK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "P" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%QUANTITY%", $order_row['posts_quantity'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%BANK_NAME%", BANK_NAME, $msg);
                    $msg = str_replace("%BANK_ADDRESS%", BANK_ADDRESS, $msg);
                    $msg = str_replace("%BANK_AC_SWIFT%", BANK_SWIFT, $msg);
                    $msg = str_replace("%BANK_AC_CURRENCY%", BANK_CURRENCY, $msg);
                    $msg = str_replace("%BANK_AC_BRANCH%", BANK_AC_BRANCH, $msg);
                    $msg = str_replace("%AC_NAME%", BANK_ACCOUNT_NAME, $msg);
                    $msg = str_replace("%AC_NUMBER%", BANK_ACCOUNT_NUMBER, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    if (BANK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 60);
                        JB_process_mail_queue(1, $email_id);
                    }
                } elseif ($product_type == 'S') {
                    // subscription invoice confirmed (id 80)
                    $template_r = JB_get_email_template(80, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, BANK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "S" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%QUANTITY%", $order_row['posts_quantity'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%BANK_NAME%", BANK_NAME, $msg);
                    $msg = str_replace("%BANK_ADDRESS%", BANK_ADDRESS, $msg);
                    $msg = str_replace("%BANK_AC_SWIFT%", BANK_SWIFT, $msg);
                    $msg = str_replace("%BANK_AC_CURRENCY%", BANK_CURRENCY, $msg);
                    $msg = str_replace("%BANK_AC_BRANCH%", BANK_AC_BRANCH, $msg);
                    $msg = str_replace("%AC_NAME%", BANK_ACCOUNT_NAME, $msg);
                    $msg = str_replace("%AC_NUMBER%", BANK_ACCOUNT_NUMBER, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SUB_DURATION%", $order_row['months_duration'], $msg);
                    if (BANK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 80);
                        JB_process_mail_queue(1, $email_id);
                    }
                } elseif ($product_type == 'M') {
                    // membership invoice confirmed (id 100)
                    $template_r = JB_get_email_template(100, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, BANK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "M" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%INVOICE_CODE%", "M" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%BANK_NAME%", BANK_NAME, $msg);
                    $msg = str_replace("%BANK_ADDRESS%", BANK_ADDRESS, $msg);
                    $msg = str_replace("%BANK_AC_SWIFT%", BANK_SWIFT, $msg);
                    $msg = str_replace("%BANK_AC_CURRENCY%", BANK_CURRENCY, $msg);
                    $msg = str_replace("%BANK_AC_BRANCH%", BANK_AC_BRANCH, $msg);
                    $msg = str_replace("%AC_NAME%", BANK_ACCOUNT_NAME, $msg);
                    $msg = str_replace("%AC_NUMBER%", BANK_ACCOUNT_NUMBER, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    if ($order_row['months_duration'] == '0') {
                        $order_row['months_duration'] = $label['member_not_expire'];
                    }
                    $msg = str_replace("%MEM_DURATION%", $order_row['months_duration'], $msg);
                    if (BANK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 100);
                        JB_process_mail_queue(1, $email_id);
                    }
                }
                JB_update_payment_method($product_type, $order_row['invoice_id'], "bank");
            }
        } else {
            JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type);
        }
    }
예제 #4
0
    function process_payment_return()
    {
        global $label;
        if ($_REQUEST['order_id'] != '' && $_REQUEST['nhezk5'] != '') {
            $invoice_id = jb_strip_order_id($_REQUEST['order_id']);
            $product_type = substr($invoice_id, 0, 1);
            // 'P' or 'S'
            $invoice_id = substr($invoice_id, 1);
            if ($_SESSION['JB_ID'] == '') {
                JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type);
                echo "Error: You must be logged in to view this page";
            } else {
                JBPLUG_do_callback('pay_trn_verification_passed', $invoice_id, $product_type);
                ?>
		

			<div style='background-color: #ffffff; border-color:#C0C0C0; border-style:solid;padding:10px'>
		<p align="center"><center>
				<?php 
                if ($product_type == 'P') {
                    $sql = "SELECT * from package_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } elseif ($product_type == 'S') {
                    $sql = "SELECT * from subscription_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } elseif ($product_type == 'M') {
                    $sql = "SELECT * from membership_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                }
                $result = JB_mysql_query($sql) or die(mysql_error() . $sql);
                $order_row = mysql_fetch_array($result, MYSQL_ASSOC);
                if (CHECK_TAX_RATE > 0) {
                    if (CHECK_ADD_TAX != 'Y') {
                        // work out the tax paid in the amount
                        $tax = $order_row['amount'] - $order_row['amount'] / (1.0 + CHECK_TAX_RATE);
                    } else {
                        $tax = $order_row['amount'] * CHECK_TAX_RATE;
                        $order_row['amount'] = $order_row['amount'] + $tax;
                    }
                }
                if (CHECK_ADVANCE_CREDIT == 'YES' && strtolower($order_row['status']) != 'pending') {
                    // place the order as 'pending' and advance the credits
                    if ($product_type == 'P') {
                        // posting credits
                        $order_row = JB_pend_package_invoice($invoice_id, $payment_method = 'check', $pending_reason = 'jb_credit_advanced');
                        // credit the points to the customer's account
                        JB_add_posting_credits($order_row);
                    }
                    if ($product_type == 'S') {
                        // subscription to view resumes
                        $order_row = JB_pend_subscription_invoice($invoice_id, $payment_method = 'check', $pending_reason = 'jb_credit_advanced');
                        JB_start_employer_subscription($order_row);
                    }
                    if ($product_type == 'M') {
                        // membership
                        $order_row = JB_pend_membership_invoice($invoice_id, $payment_method = 'check', $pending_reason = 'jb_credit_advanced');
                        JB_start_membership($order_row);
                    }
                    JBPLUG_do_callback('pay_trn_pending', $invoice_id, $product_type);
                }
                $check_amount = JB_convert_to_currency($order_row['amount'], $order_row['currency_code'], CHECK_CURRENCY);
                $check_amount = JB_format_currency($check_amount, CHECK_CURRENCY, true);
                $label['payment_check_sub_head'] = str_replace("%INVOICE_CODE%", $product_type . $_REQUEST['order_id'], $label['payment_check_sub_head']);
                echo $label['payment_check_sub_head'];
                $label['payment_check_heading'] = str_replace("%INVOICE_AMOUNT%", $check_amount, $label['payment_check_heading']);
                $label['payment_check_tax'] = str_replace("%INVOICE_TAX%", JB_format_currency($tax, CHECK_CURRENCY, true), $label['payment_check_tax']);
                if (JB_get_default_currency() != CHECK_CURRENCY) {
                    echo JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']) . " = " . $check_amount;
                    echo "<br>";
                }
                ?>
				
				<table width="70%"><tr><td>
				<?php 
                if (CHECK_TAX_RATE > 0) {
                    ?>
				<b><?php 
                    echo $label['payment_check_tax'];
                    ?>
</b><br>
				<?php 
                }
                ?>
				<b><?php 
                echo $label['payment_check_heading'];
                ?>
</b><br>
				<?php 
                if (CHECK_NAME != '') {
                    ?>
				<b><?php 
                    echo $label['payment_check_payable'];
                    ?>
</b><pre><?php 
                    echo CHECK_PAYABLE;
                    ?>
</pre><br>
				<?php 
                }
                ?>
				<?php 
                if (CHECK_ADDRESS != '') {
                    ?>
				<b><?php 
                    echo $label['payment_check_address'];
                    ?>
</b><pre><?php 
                    echo CHECK_ADDRESS;
                    ?>
</pre><br>
				<?php 
                }
                ?>
				<?php 
                /*if ( CHECK_ACCOUNT_NAME != '') { ?>
                		<b><?php echo $label['payment_check_currency'];?></b><pre><?php echo CHECK_CURRENCY; ?></pre><br>
                		<?php } */
                ?>
				
				</td></tr>
				</table>
				
				</p>
				</center>
				
				</div>
				<?php 
                if ($order_row['user_type'] == 'C') {
                    $sql = "Select * from users where ID='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } else {
                    $sql = "Select * from employers where ID='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                }
                $result = JB_mysql_query($sql) or die(mysql_error());
                $e_row = mysql_fetch_array($result, MYSQL_ASSOC);
                if ($product_type == 'S') {
                    $template_r = JB_get_email_template(81, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, CHECK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "S" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%SUB_DURATION%", $order_row['months_duration'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%PAYEE_NAME%", CHECK_PAYABLE, $msg);
                    $msg = str_replace("%PAYEE_ADDRESS%", CHECK_ADDRESS, $msg);
                    $msg = str_replace("%CHECK_CURRENCY%", CHECK_CURRENCY, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    //echo $msg;
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    if (CHECK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 81);
                        JB_process_mail_queue(1, $email_id);
                    }
                } elseif ($product_type == 'M') {
                    $template_r = JB_get_email_template(101, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, CHECK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "S" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    if ($order_row['months_duration'] == '0') {
                        $order_row['months_duration'] = $label['member_not_expire'];
                    }
                    $msg = str_replace("%MEM_DURATION%", $order_row['months_duration'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%PAYEE_NAME%", CHECK_PAYABLE, $msg);
                    $msg = str_replace("%PAYEE_ADDRESS%", CHECK_ADDRESS, $msg);
                    $msg = str_replace("%CHECK_CURRENCY%", CHECK_CURRENCY, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    //echo $msg;
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    if (CHECK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 101);
                        JB_process_mail_queue(1, $email_id);
                    }
                } elseif ($product_type == 'P') {
                    $template_r = JB_get_email_template(61, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, CHECK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "P" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%QUANTITY%", $order_row['posts_quantity'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%PAYEE_NAME%", CHECK_PAYABLE, $msg);
                    $msg = str_replace("%PAYEE_ADDRESS%", CHECK_ADDRESS, $msg);
                    $msg = str_replace("%CHECK_CURRENCY%", CHECK_CURRENCY, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    //echo $msg;
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    if (CHECK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 61);
                        JB_process_mail_queue(1, $email_id);
                    }
                }
                JB_update_payment_method($product_type, $order_row['invoice_id'], "check");
            }
        } else {
            JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type);
        }
    }