示例#1
0
function ExtraProductsInOrder($Order_Id, $shipp_add_id, $short_msg)
{
    $sql_order_id_mail = mysql_query("SELECT id,order_id,created_date,order_number,customer_name,customer_company,deleivery_date,order_comment FROM sohorepro_order_master WHERE id = '" . $Order_Id . "' ORDER BY id DESC LIMIT 1");
    $object = mysql_fetch_assoc($sql_order_id_mail);
    $user_mail_id_txt = UserMail($object['customer_name']);
    $user_mail = array('email_id' => UserMail($object['customer_name']));
    $user_name = UserName($object['customer_name']);
    $company_name = companyName($object['customer_company']);
    $phone = companyphone($object['customer_company']);
    $billing_address = BillingAddressShippId($object['customer_company']);
    $shipp_address = CompanyAddressMail($billing_address);
    $prop = PropTest($shipping_id);
    $id = $Order_Id;
    $Order_id = $object['order_id'];
    $Order_number = $object['order_number'];
    $deleivery_date = $object['deleivery_date'];
    $comp_id = $object['customer_company'];
    $order_comm = $object['order_comment'];
    //$current_time           = date("Y-m-d h:i:s");
    $current_time = $object['created_date'];
    $datew = new DateTime($current_time, new DateTimeZone('America/New_York'));
    date_default_timezone_set('America/New_York');
    $temp_times = date("Y-m-d h:iA", $datew->format('U'));
    //$Date = date("m-d-Y", strtotime(date('Y-m-d h:i:s', time()))). ' ' .date("h:iA",strtotime("-0 minutes",strtotime($temp_times)));
    $Date = date('Y-m-d h:i A', time());
    $view_orders = viewOrders($id);
    $pick_up = $view_orders[0]['shipping_add_id'];
    $mail_id = getActiveEmail();
    $returnValue = html_entity_decode('Your Soho Repro graphics order has been received and will be processed promptly.', ENT_COMPAT, 'ISO-8859-1');
    $customer_email = array('email_id' => CompanyMail($comp_id));
    array_push($mail_id, $user_mail, $customer_email);
    $comment = 'Comment :';
    $address_3 = $shipp_address['address_3'] != '' ? $shipp_address['address_3'] . '<br>' : '';
    $mail = new PHPMailer();
    $message = '<html>';
    $message .= '<head>';
    $message .= '<title></title>';
    $message .= '<meta content="text/html;charset=iso-8859-1" http-equiv="Content-Type">';
    $message .= '</head>';
    $message .= '<body>';
    $message .= '<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">';
    $message .= '<table width="780" border="0" cellspacing="0" cellpadding="0" class="padd">';
    $message .= '<tr><td>' . $short_msg . '</td></tr>';
    $message .= '</table>';
    $message .= '<table width="780" border="0" cellspacing="0" cellpadding="0" class="padd">';
    $message .= '<tr bgcolor="#ff7e00">';
    $message .= '<td width="10" height="10" align="left" valign="top"></td>';
    $message .= '<td height="10" align="left" valign="top"></td>';
    $message .= '<td width="10" height="10" align="left" valign="top"></td>';
    $message .= '</tr>';
    $message .= '<tr>';
    $message .= '<td width="10" align="left" valign="top" bgcolor="#ff7e00"></td>';
    $message .= '<td align="left" valign="top"><table width="760" border="0" cellspacing="0" cellpadding="0">';
    $message .= '<tr>';
    $message .= '<td width="20" height="20" align="left" valign="top"></td>';
    $message .= '<td height="20" align="left" valign="top"></td>';
    $message .= '<td width="20" height="20" align="left" valign="top"></td>';
    $message .= '</tr>';
    $message .= '<tr>';
    $message .= '<td width="20" align="left" valign="top"></td>';
    $message .= '<td align="left" valign="top"><table width="740" border="0" cellspacing="0" cellpadding="0">';
    $message .= '<tr>';
    $message .= '<td>' . $returnValue . '</br></td>';
    $message .= '</tr>';
    $message .= '<tr>';
    $message .= '<td>&nbsp;</td>';
    $message .= '</tr>';
    $message .= '<tr height="30px">';
    $message .= '<td><span style="font-weight:bold;">Customer Reference :</span> ' . $Order_id . '</td>';
    $message .= '</tr>';
    $message .= '<tr height="25px">';
    $message .= '<td><span style="font-weight:bold;">Date :</span> ' . $Date . '</td>';
    $message .= '</tr>';
    $message .= '<tr height="25px">';
    $message .= '<td><span style="font-weight:bold;">Name :</span> ' . $user_name . '</td>';
    $message .= '</tr>';
    $message .= '<tr height="25px">';
    $message .= '<td><span style="font-weight:bold;">Company :</span> ' . $company_name . '</td>';
    $message .= '</tr>';
    $message .= '<tr height="25px">';
    $message .= '<td><span style="font-weight:bold;">Email :</span> ' . $user_mail_id_txt . '</td>';
    $message .= '</tr>';
    $message .= '<tr height="25px">';
    $message .= '<td><span style="font-weight:bold;">Phone :</span> ' . $phone . '</td>';
    $message .= '</tr>';
    if ($pick_up == 'P') {
        $message .= '<tr height="30px">';
        $message .= '<td><span style="font-weight:bold;">Pickup Address: </span></td>';
        $message .= '</tr>';
        $message .= '<tr>';
        $message .= '<td style="padding-bottom:7px;">Soho Reprographics<br>381 Broome Street<br>New York, NY 10013</td>';
        $message .= '</tr>';
    } else {
        $message .= '<tr height="30px">';
        $message .= '<td><span style="font-weight:bold;">Billing Address: </span></td>';
        $message .= '</tr>';
        $message .= '<tr>';
        $message .= '<td style="padding-bottom:7px;">' . $shipp_address['company_name'] . '<br>' . $shipp_address['address_1'] . '<br>' . $shipp_address['address_2'] . '<br>' . $address_3 . $shipp_address['city'] . ',&nbsp;' . StateName($shipp_address['state']) . '&nbsp;' . $shipp_address['zip'] . '</td>';
        $message .= '</tr>';
        $message .= '<tr height="25px">';
        $message .= '<td><span style="font-weight:bold;">Multiple Shipping Addresses: </span></td>';
        $message .= '</tr>';
        $multi = MultiShippingAddress($Order_Id);
        $pick_up_multi = Pickup();
        foreach ($multi as $multi_shipp) {
            $address_multi_pre = SelectIdAddress($multi_shipp['shipping_id']);
            $address_multi_1 = $address_multi_pre[0]['address_1'] != '' ? $address_multi_pre[0]['address_1'] . '<br>' : '';
            $address_multi_2 = $address_multi_pre[0]['address_2'] != '' ? $address_multi_pre[0]['address_2'] . '<br>' : '';
            $address_multi_3 = $address_multi_pre[0]['address_3'] != '' ? $address_multi_pre[0]['address_3'] . '<br>' : '';
            $check_item_id = explode(",", $multi_shipp['item_id']);
            $items_tag = $check_item_id[1] != '' ? '<span style="font-weight:bold;">Items&nbsp;:&nbsp;' . $multi_shipp['item_id'] . '<br>' : '<span style="font-weight:bold;">Item&nbsp;:&nbsp;' . $multi_shipp['item_id'] . '<br>';
            $address_for_items_pre[] = $multi_shipp['shipping_id'] != 'P' ? $items_tag . '</span><span style="font-weight:bold;">Shipping Address: </span><br>' . $address_multi_pre[0]['company_name'] . '<br>' . $address_multi_1 . $address_multi_2 . $address_multi_pre[0]['city'] . ',&nbsp;' . StateName($address_multi_pre[0]['state']) . '&nbsp;' . $address_multi_pre[0]['zip'] . '<br><br><span style="font-weight:bold;">Delivery Date :</span>' . $deleivery_date : $items_tag . '</span><span style="font-weight:bold;">Pickup Address: </span><br>' . $pick_up_multi . '<br><br><br><span style="font-weight:bold;">Delivery Date :</span>' . $deleivery_date;
        }
        $message .= '<tr><td>';
        $message .= '<table align="left">';
        for ($m = 0; $m < count($address_for_items_pre); $m += 3) {
            $message .= '<tr>
                <td>' . $address_for_items_pre[$m] . '</td>
                <td>' . $address_for_items_pre[$m + 1] . '</td>
                <td>' . $address_for_items_pre[$m + 2] . '</td>
            </tr>';
            $message .= '<tr><td>&nbsp;</td></tr>';
        }
        $message .= '</table>';
        $message .= '</td></tr>';
    }
    $message .= '</table></td>';
    $message .= '<td height="25" width="20" align="left" valign="top"></td>';
    $message .= '</tr>';
    $message .= '<tr>';
    $message .= '<td width="20" align="left" valign="top"></td>';
    $message .= '<td align="left" valign="top">';
    $message .= '<table width="740" border="0" cellspacing="0" cellpadding="0" style="margin-right:-1px;">';
    $message .= '<tr style="color:#fff; text-transform:uppercase;">';
    $message .= '<td width="40" align="center" valign="middle" bgcolor="#f68210" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;">Item</td>';
    $message .= '<td width="400" align="center" valign="middle" bgcolor="#f68210" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;">Description</td>';
    $message .= '<td width="80" align="center" valign="middle" bgcolor="#f68210" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;">Quantity</td>';
    $message .= '<td width="100" align="center" valign="middle" bgcolor="#f68210" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;">Unit Price</td>';
    $message .= '<td width="110" align="center" valign="middle" bgcolor="#f68210" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;">Total</td>';
    $message .= '</tr>';
    $total = 0;
    $i = 1;
    foreach ($view_orders as $ord) {
        $rowColor = $i % 2 != 0 ? '#dfdfdf' : '#eeeeee';
        $rowColor1 = $i % 2 != 0 ? '#eeeeee' : '#f6f2f2';
        $prod_id = $ord['product_id'];
        $shipping = SelectAllAddress($ord['shipping_add_id']);
        $id = $ord['id'];
        $message .= '<tr>';
        $message .= '<td width="40" align="left" valign="middle" bgcolor="' . $rowColor1 . '" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;padding-left:20px;">' . $i . '</td>';
        $message .= '<td width="400" align="center" valign="middle" bgcolor="' . $rowColor . '" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;">' . getorderProd($prod_id) . '</td>';
        $message .= '<td width="80" align="right" valign="middle" bgcolor="' . $rowColor1 . '" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;padding-right:15px;">' . $ord['product_quantity'] . '</td>';
        $message .= '<td width="100" align="right" valign="middle" bgcolor="' . $rowColor . '" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;padding-right:15px;">' . '$' . $ord['product_price'] . '</td>';
        $message .= '<td width="110" align="right" valign="middle" bgcolor="' . $rowColor1 . '" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;padding-right:15px;">' . '$' . number_format($ord['product_quantity'] * $ord['product_price'], 2, '.', '') . '</td>';
        $message .= '</tr>';
        $sub_tot = $ord['product_quantity'] * $ord['product_price'];
        $tax_status = getTaxStatusChk($comp_id);
        $tax_value = TaxValue();
        if ($tax_status == '1') {
            $tax_line = '0';
        } else {
            $tax_line = $tax_value;
        }
        $total = $total + $sub_tot;
        $tax = $tax_line * ($total / 100);
        $i++;
    }
    $message .= '<tr>';
    $message .= '<td colspan="2" rowspan="3" bgcolor="#eeeeee" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;padding-right:15px;"><span style="font-weight:bold;">Comment:</span><br>' . $order_comm . '</td>';
    $message .= '<td colspan="2" align="right" bgcolor="#eeeeee" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;padding-right:15px;"><span style="font-weight:bold;">Subtotal</span></td>';
    $message .= '<td bgcolor="#eeeeee" align="right" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;padding-right:15px;">' . '$' . number_format($total, 2, '.', '') . '</td>';
    $message .= '</tr>';
    $message .= '<tr>';
    $message .= '<td colspan="2" align="right" bgcolor="#dfdfdf" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;padding-right:15px;"><span style="font-weight:bold;">Tax</span></td>';
    $message .= '<td bgcolor="#dfdfdf" align="right" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;padding-right:15px;">' . '$' . number_format($tax, 2, '.', '') . '</td>';
    $message .= '</tr>';
    $message .= '<tr>';
    $message .= '<td colspan="2" align="right" bgcolor="#eeeeee" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;padding-right:15px;"><span style="font-weight:bold;">Total*</span></td>';
    $message .= '<td bgcolor="#eeeeee" align="right" style="border-right:1px solid #fff; border-bottom:1px solid #fff; padding:7px 0px;padding-right:15px;">' . '$' . number_format($total + $tax, 2, '.', '') . '</td>';
    $message .= '</tr>';
    $message .= '</table></td>';
    $message .= '<td width="20" align="left" valign="top"></td>';
    $message .= '</tr>';
    $message .= '<tr>';
    $message .= '<td width="20" height="20" align="left" valign="top"></td>';
    $message .= '<td height="20" align="left" valign="top"></td>';
    $message .= '<td width="20" height="20" align="left" valign="top"></td>';
    $message .= '</tr>';
    $message .= '<tr>';
    $message .= '<td height="20" align="left" valign="top"></td>';
    $message .= '<td height="20" align="left" valign="top" style="padding-bottom:5px;font-size:12px;">*Delivery charges to be applied as necessary</td>';
    $message .= '<td height="20" align="left" valign="top"></td>';
    $message .= ' </tr>';
    $message .= '</table></td>';
    $message .= '<td width="10" align="left" valign="top" bgcolor="#ff7e00"></td>';
    $message .= '</tr>';
    $message .= '<tr bgcolor="#ff7e00">';
    $message .= '<td width="10" height="10" align="left" valign="top"></td>';
    $message .= '<td height="10" align="left" valign="top"></td>';
    $message .= '<td width="10" height="10" align="left" valign="top"></td>';
    $message .= ' </tr>';
    $message .= '</table>';
    $message .= '</table>';
    $message .= '</body>';
    $message .= '</html>';
    $final_html = html_entity_decode($message);
    //        foreach ($mail_id as $to){
    //        $subject    = "Soho Reprographic Order Acknowledgement with Extra Products";
    //        $headers    = 'From: "SohoRepro" <*****@*****.**>' . "\r\n";
    //        $headers   .= 'MIME-Version: 1.0' . "\n";
    //        $headers   .= 'Content-Type: text/html; charset=utf-8\r\n';
    //        $headers   .= 'Content-Transfer-Encoding: 8bit\r\n\r\n';
    //        $to         = $to['email_id'];
    //        //echo $to, $subject, $message, $headers;
    //        $result = mail($to, $subject, $message, $headers);
    //        }
    foreach ($mail_id as $mails_sent) {
        $pre_filt[] = $mails_sent['email_id'];
    }
    $final_list = array_unique($pre_filt);
    //        foreach ($final_list as $to){
    //        $subject  = "Order Changed by Admin for Job:".$Order_id;
    //        $headers  = 'From: "SohoRepro" <*****@*****.**>' . "\r\n";
    //        $headers .= 'MIME-Version: 1.0' . "\n";
    //        $headers .= 'Content-Type: text/html; charset=utf-8\r\n'."X-Mailer: PHP";
    //        $headers .= 'Content-Transfer-Encoding: 8bit\r\n\r\n';
    //        //$to       = $to['email_id'];
    //        //echo $to, $subject, $message, $headers;
    //        $result = mail($to, $subject, $final_html, $headers);
    //        }
    $subject = "Order Changed by Admin for Job:" . $Order_id;
    $headers = 'From: "SohoRepro" <*****@*****.**>' . "\r\n";
    $headers .= 'MIME-Version: 1.0' . "\n";
    $headers .= 'Content-Type: text/html; charset=utf-8\\r\\n' . "X-Mailer: PHP";
    $headers .= 'Content-Transfer-Encoding: 8bit\\r\\n\\r\\n';
    $to = "*****@*****.**";
    //echo $to, $subject, $message, $headers;
    $result = mail($to, $subject, $final_html, $headers);
    if ($result) {
        return '1';
    } else {
        return '0';
    }
}
示例#2
0
} else {
    ?>
                                    <tr height="30px">
                                        <td><span style="font-weight:bold;">Billing Address: </span></td>
                                    </tr>
                                    <tr>
                                        <td style="padding-bottom:7px;"><?php 
    echo $shipp_address['company_name'] . '<br>' . $shipp_address['address_1'] . '<br>' . $shipp_address['address_2'] . '<br>' . $address_3 . $shipp_address['city'] . ',&nbsp;' . StateName($shipp_address['state']) . '&nbsp;' . $shipp_address['zip'];
    ?>
</td>
                                    </tr>
                                    <tr height="25px">
                                        <td><span style="font-weight:bold;">Multiple Shipping Addresses: </span></td>
                                    </tr>
                                    <?php 
    $multi = MultiShippingAddress($Order_Id);
    $pick_up_multi = Pickup();
    foreach ($multi as $multi_shipp) {
        $address_multi_pre = SelectIdAddress($multi_shipp['shipping_id']);
        $address_multi_1 = $address_multi_pre[0]['address_1'] != '' ? $address_multi_pre[0]['address_1'] . '<br>' : '';
        $address_multi_2 = $address_multi_pre[0]['address_2'] != '' ? $address_multi_pre[0]['address_2'] . '<br>' : '';
        $address_multi_3 = $address_multi_pre[0]['address_3'] != '' ? $address_multi_pre[0]['address_3'] . '<br>' : '';
        $check_item_id = explode(",", $multi_shipp['item_id']);
        $items_tag = $check_item_id[1] != '' ? '<span style="font-weight:bold;">Items&nbsp;:&nbsp;' . $multi_shipp['item_id'] . '<br>' : '<span style="font-weight:bold;">Item&nbsp;:&nbsp;' . $multi_shipp['item_id'] . '<br>';
        $address_for_items_pre[] = $multi_shipp['shipping_id'] != 'P' ? '<div style="float:left;width:100%;">' . $items_tag . '</span><span style="font-weight:bold;">Shipping Address: </span><br>' . $address_multi_pre[0]['company_name'] . '<br>' . $address_multi_1 . $address_multi_2 . $address_multi_3 . $address_multi_pre[0]['city'] . ',&nbsp;' . StateName($address_multi_pre[0]['state']) . '&nbsp;' . $address_multi_pre[0]['zip'] . '<br><br><span style="font-weight:bold;">Delivery Date :</span></div><div style="float:left;width:100%;">' . $deleivery_date . '</div>' : '<div style="float:left;width:100%;">' . $items_tag . '</span><span style="font-weight:bold;">Pickup Address: </span><br>' . $pick_up_multi . '<br><br><span style="font-weight:bold;">Delivery Date :</span></div><div style="float:left;width:100%;">' . $deleivery_date . '</div>';
    }
    ?>
                                    <tr>
                                        
                                        <td>
                                            <table align="left" border="0">
示例#3
0
    endwhile;
    return $value;
}


function MultiShippingAddress($Order_id) {
    $select_orders = "SELECT * FROM sohorepro_multi_shipping WHERE order_id = '".$Order_id."' " ;
    $details       = mysql_query($select_orders);
    while ($object = mysql_fetch_assoc($details)):
        $value[] = $object;
    endwhile;
    return $value;
}


$multi      = MultiShippingAddress(25);


foreach ($multi as $multi_shipp){

$address_multi_pre    = SelectIdAddress($multi_shipp['shipping_id']);

$address_multi_1    =  ($address_multi_pre[0]['address_1'] != '')  ? $address_multi_pre[0]['address_1'].'<br>' : '';
$address_multi_2    =  ($address_multi_pre[0]['address_2'] != '')  ? $address_multi_pre[0]['address_2'].'<br>' : '';
$address_multi_3    =  ($address_multi_pre[0]['address_3'] != '')  ? $address_multi_pre[0]['address_3'].'<br>' : '';
    
$address_for_items_pre[] = '<span style="font-weight:bold;">Item&nbsp;:&nbsp;'.$multi_shipp['item_id'].'<br></span><span style="font-weight:bold;">Shipping Address: </span><br>'.$address_multi_pre[0]['company_name'].'<br>'.$address_multi_1.$address_multi_2.$address_multi_3.$address_multi_pre[0]['city'].',&nbsp;'.StateName($address_multi_pre[0]['state']).'&nbsp;'.$address_multi_pre[0]['zip'].'<br><br><span style="font-weight:bold;">Delivery Date :</span>' . $deleivery_date;
    
}

$message .= '<table align="left">';