$value)
{
$sql = "UPDATE tb_order_list SET mailtimes = mailtimes +1 WHERE `id` = '".$value."'";
$db->query($sql);
$sql = "SELECT tb_order_list.*, tb_order_product.id as encatname, tb_order_list.id as sccatname FROM tb_order_list left outer join tb_order_product on tb_order_product.order_id=tb_order_list.id where tb_order_list.id='".$value."'";
$row = $db->getrow($sql); foreach($row as $_key=>$_item){ ${$_key} = $_item; }
if (1) {
if ( $shippingmethod==1 ) $tempshippingmethod="平邮";
if ( $shippingmethod==2 ) $tempshippingmethod="掛號";
if ( $shippingmethod==3 ) $tempshippingmethod="本地速递";
if ( $country==1 ) $tempcountry="中国";
if ( $country==2 ) $tempcountry="香港";
if ( $country==3 ) $tempcountry="台湾";
$print_fav = '';
$sql = "SELECT * FROM `tb_order_list` WHERE `id` = '".escapeit($id)."'";
$row = $db->getrow($sql);
$sql_item = "SELECT * FROM `tb_order_product` WHERE `order_id` = '".$row['id']."' ORDER BY `id` ASC";
$rs_item = $db->query($sql_item);
while ( $row_item = $db->fetch_array($rs_item) ){
$print_fav.='
| #'.($k+1).' |
| Name | '.$row_item["en_name"].' |
| Item No. | '.$row_item["model_no"].' |
| Qty | '.$row_item["quantity"].' |
| Unit Price | '.$row_item['curr_unit'].' '.number_format($row_item['unit_price'],2).' |
';
$k++;
}
$email_head="Smartinfo eshop";
$body='

| Email | '.$row["member_id"].' |
| Shipdate | '.$row["shipdate"].' |
| Shipping method | '.$row["shippingmethod"].' |
| Order Detail |
'.($print_fav).'
|
| Shipping | '.$row_item['curr_unit'].' '.number_format($row['shipping_charge'],2).' |
| Order Total | '.$row_item['curr_unit'].' '.number_format($row['total'],2).' |
|
';
if (1) {
$email=$member_id;
$Sendername= "Smartinfo EShop";
$EmailTitle= "Smartinfo Eshop Invoice";
try {
// require($INCLUDE_DIR . "../../include/class.phpmailer.php");
$mail = new PHPMailer();
$mail->AddReplyTo( $email );
// $mail->SetFrom("jason22@smartinfo.com.hk");
$mail->FromName = $Sendername;
$mail->Sender = $email;
$mail->Subject = $EmailTitle;
$mail->Body = $body;
$mail->isHTML(true);
clearstatcache();
$mail->AddAddress($email);
$mail->AddBCC("jason@smartinfo.com.hk");
$result = $mail->Send();
} catch (phpmailerException $e) {
echo $e->errorMessage();
} catch (Exception $e) {
echo $e->getMessage();
}
}
//echo $body;
$count++;
}
}
}
$updated = 6;
}
if ($bthSendMailReceipt) {
$count = 1;
if (!empty($selectRecord)) {
foreach($selectRecord as $theid => $value)
{
$sql = "UPDATE tb_order_list SET mailreceipt = mailreceipt +1 WHERE `id` = '".$value."'";
$db->query($sql);
$sql = "SELECT tb_order_list.*, tb_order_product.id as encatname, tb_order_list.id as sccatname FROM tb_order_list left outer join tb_order_product on tb_order_product.order_id=tb_order_list.id where tb_order_list.id='".$value."'";
$row = $db->getrow($sql); foreach($row as $_key=>$_item){ ${$_key} = $_item; }
if (1) {
if ( $shippingmethod==1 ) $tempshippingmethod="平邮";
if ( $shippingmethod==2 ) $tempshippingmethod="掛號";
if ( $shippingmethod==3 ) $tempshippingmethod="本地速递";
if ( $country==1 ) $tempcountry="中国";
if ( $country==2 ) $tempcountry="香港";
if ( $country==3 ) $tempcountry="台湾";
$print_fav = '';
$sql = "SELECT * FROM `tb_order_list` WHERE `id` = '".escapeit($id)."'";
$row = $db->getrow($sql);
$sql_item = "SELECT * FROM `tb_order_product` WHERE `order_id` = '".$row['id']."' ORDER BY `id` ASC";
$rs_item = $db->query($sql_item);
while ( $row_item = $db->fetch_array($rs_item) ){
$print_fav.='
| #'.($k+1).' |
| Name | '.$row_item["en_name"].' |
| Item No. | '.$row_item["model_no"].' |
| Qty | '.$row_item["quantity"].' |
| Unit Price | '.$row_item['curr_unit'].' '.number_format($row_item['unit_price'],2).' |
';
$k++;
}
$email_head="Smartinfo eshop";
$body='

| Email | '.$row["member_id"].' |
| Shipdate | '.$row["shipdate"].' |
| Shipping method | '.$row["shippingmethod"].' |
| Order Detail |
'.($print_fav).'
|
| Shipping | '.$row_item['curr_unit'].' '.number_format($row['shipping_charge'],2).' |
| Order Total | '.$row_item['curr_unit'].' '.number_format($row['total'],2).' |
|
';
if (1) {
$email=$member_id;
$Sendername= "Smartinfo EShop";
$EmailTitle= "Smartinfo Eshop Receipt";
try {
// require($INCLUDE_DIR . "../../include/class.phpmailer.php");
$mail = new PHPMailer();
$mail->AddReplyTo( $email );
// $mail->SetFrom("jason22@smartinfo.com.hk");
$mail->FromName = $Sendername;
$mail->Sender = $email;
$mail->Subject = $EmailTitle;
$mail->Body = $body;
$mail->isHTML(true);
clearstatcache();
$mail->AddAddress($email);
$mail->AddBCC("jason@smartinfo.com.hk");
$result = $mail->Send();
} catch (phpmailerException $e) {
echo $e->errorMessage();
} catch (Exception $e) {
echo $e->getMessage();
}
}
//echo $body;
$count++;
}
}
}
$updated = 6;
}
if ($bthUpdate) {
$count = 1;
if (!empty($sorting_id)) {
foreach($sorting_id as $theid)
{
$thesorting = ${"sorting_".$count};
$sql = "UPDATE `payment` SET `sorting` = '".escapeit($thesorting)."' WHERE `id`='".$theid."'";
$db->query($sql);
$count++;
}
}
$updated = 1;
}
if ($bthDelete)
{
if (!empty($selectRecord)) {
foreach ($selectRecord as $key => $value) {
$sql = "DELETE FROM `".$page_tbname."` WHERE `id` = '$value'";
//$sql = "DELETE FROM `payment` WHERE `id` = '".$value."'";
$db->query($sql);
del_all_attachment($page_tbname,$value);
}
}
$updated = 2;
}
if ($bthImport)
{
if ( !empty($_FILES["file"]) && !empty($_FILES["file"]["name"]) ) {
if($clear_member==1){
$sql = "TRUNCATE TABLE `member`";
$db->query($sql);
}
$temp = explode(".", $_FILES["file"]["name"]);
$ext = $temp[count($temp)-1];
if ( strtolower($ext) == "xls" || strtolower($ext) == "xlsx" )
{
$file = "../../upload/import/".date("YmdHis").".".$ext;
move_uploaded_file( $_FILES["file"]["tmp_name"], $file );
chmod ( $file, 0777 );
}
}
header("Location: import-xls.php?file=".$file );
exit;
}
if ($bthExport)
{
header("Location: download-xls.php?export_keyword=".$export_keyword."&export_levelone=".$export_levelone );
exit;
}
header("Location: ".$page_address_list."?keepSession=1&page=$page&updated=".$updated);
exit;
?>