示例#1
0
        function orderCreate($orderId)
        {

            $systemSetting = new systemSetting();
            $order = new order();
            $customer = new customer();
            $currency_object = new CurrencyWord();
            $currency = new currency();
            $orderProduct = new orderProduct();
            $payment = new payment();
            $country = new country();

            $order->setOrderId($orderId);
            $order->extractor($order->getOrderById());

            $orderProduct->setOrderPOrderId($order->orderId());
            $orderProduct_rows = $orderProduct->getProductsByOrderId();

            $payment->setPaymentOrderId($order->orderId());
            $result = $orderProduct->getTotalDetailByOrderId();

            $systemSetting->extractor($systemSetting->getSettings());

            $customer->setCustomerId($order->orderCustomerId());
            $customer->extractor($customer->getCustomerById());

            $currency->setCurrId(1);
            $currencyName = $currency->getCurrencyNameById();

            $country->setCountryId($order->orderDeliveryCity());
            $countryName = $country->getCountryNameById();

            $filename = $systemSetting->sySettingDocumentName() . 'Invoice_' . $order->orderInvoiceRefNumber() . '.pdf';

            $subject = $systemSetting->sySettingCompanyName() . " -  New Order Place....!";
            $strContent = '
<table width="800" border="0" style="font-family:Arial, Helvetica, sans-serif; background:#eee; font-size:12px; color:#333333;">
<tr>
<td colspan="3" rowspan="8" align="left" valign="top">
<img src="' . DOC_ROOT . 'uplode-img/company-logo/' . $systemSetting->sySettingCompanyLogo() . '"  />
</br>

<div style="padding-left:20px;font-size:16px; font-weight:bold; margin-bottom:8px;margin-top:20px;">' . $systemSetting->sySettingCompanyName() . ' </div>
<div style="padding-left:30px;margin-bottom:5px;font-size:10px;font-size:13px;">' . $systemSetting->sySettingCompanyAddress() . '</div>
<div style="padding-left:30px;margin-bottom:5px;font-size:10px;font-size:13px;">Telephone &nbsp; : &nbsp;&nbsp;' . $systemSetting->sySettingCompanyPhon() . '</div>
<div style="padding-left:30px;margin-bottom:5px;font-size:10px;font-size:13px;">Email &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : &nbsp;&nbsp; ' . $systemSetting->sySettingCompanyEmail() . '</div>



</td>

<td colspan="3" bgcolor="#CC0000" style="color:#FFF; font-size:14px; padding:5px; text-align:right; font-weight:700; letter-spacing:1px;">C u s t o m e r &nbsp; I n v o i c e</td>
</tr>

<tr>
<td >&nbsp;</td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td >&nbsp;</td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td style="padding:3px; border-bottom:1px #484848 dotted;"><div style=" width:80px;background-color:#ddd; float:left; margin-top:2px; padding:2px 5px;">Date</div></td>
<td colspan="2" style="padding:3px; border-bottom:1px #484848 dotted;text-align:right;">' . date('l jS \of F Y ', strtotime($order->orderCreatedDate())) . '</td>
</tr>
<tr>
<td style="padding:3px; border-bottom:1px #484848 dotted;"><div style=" width:80px;background-color:#ddd; float:left; margin-top:2px; padding:2px 5px;">Invoice No</div></td>
<td colspan="2" style="padding:3px; border-bottom:1px #484848 dotted;text-align:right;">' . $order->orderInvoiceRefNumber() . '</td>
</tr>
<tr>
<td style="padding:3px; border-bottom:1px #484848 dotted;"><div style=" width:80px;background-color:#ddd; float:left; margin-top:2px; padding:2px 5px;">Order No</div></td>
<td colspan="2" style="padding:3px; border-bottom:1px #484848 dotted;text-align:right;">' . $order->orderRefNumber() . '</td>
</tr>



<tr>
<td colspan="3" >&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="6" bgcolor="#333333" style="color:#fff; padding:3px 0 3px 8px; font-weight:bold; font-size:13px;">To</td>
</tr>
<tr>
  <td colspan="6" style="padding:3px; border-bottom:1px #484848 dotted;">
    <div style="margin-bottom:5px; margin-top:5px; font-weight:700;">' . $customer->customerName() . ' </div>
    <div style="font-size:10px;font-size:10px;">' . $customer->customerAddress() . '</div></td>
  </tr>
<tr>
  <td colspan="6">&nbsp;</td>
</tr>
<tr>
<td width="19%" align="center" bgcolor="#333333" style="color:#fff; padding:3px 0 3px 8px; font-weight:bold; font-size:13px; width:5%;">No</td>
<td width="11%" align="center" bgcolor="#333333" style="color:#fff; padding:3px 0 3px 8px; font-weight:bold; font-size:13px; width:15%">Item Code</td>
<td width="11%" align="center" bgcolor="#333333" style="color:#fff; padding:3px 0 3px 8px; font-weight:bold; font-size:13px; width:35%">Description</td>
<td align="center" bgcolor="#333333" style="color:#fff; padding:3px 0 3px 8px; font-weight:bold; font-size:13px; width:10%">Quantity</td>
<td width="22%" align="center" bgcolor="#333333" style="color:#fff; padding:3px 0 3px 8px; font-weight:bold; font-size:13px; width:15%">Unit Price</td>
<td width="23%" align="center" bgcolor="#333333" style="color:#fff; padding:3px 0 3px 8px; font-weight:bold; font-size:13px; width:20%">Total Price</td>
</tr>';
            $count = 1;
            for ($i = 0; $i < count($orderProduct_rows); $i++) {
                $orderProduct->extractor($orderProduct_rows, $i);
                $strContent .= '
<tr>
<td align="center" style="padding:3px; border-bottom:1px #484848 dotted;">' . $count . '</td>
<td align="center" style="padding:3px; border-bottom:1px #484848 dotted;">' . $orderProduct->orderPProductCode() . '</td>
<td align="center" style="padding:3px; border-bottom:1px #484848 dotted;">' . $orderProduct->orderPProductName() . '</td>
<td align="center" valign="bottom" style="padding:3px; border-bottom:1px #484848 dotted;">' . $orderProduct->orderPProductQuantity() . '</td>
<td align="right" valign="bottom" style="padding:3px; border-bottom:1px #484848 dotted;">' . $currency->convetNumberFormatDefault($orderProduct->orderPProductUnitPrice()) . '</td>
<td align="right" valign="bottom" style="padding:3px; border-bottom:1px #484848 dotted;">' . $currency->convetNumberFormatDefault($orderProduct->orderPProductTotalPrice()) . '</td>
</tr>
';
                $count++;
            }
            $strContent .= '
<tr>
<td colspan="5" style="padding:3px; border-bottom:1px #484848 dotted;">';
            $TOTAL_VAL = $result[0]['PRI'];
            $strContent .=
                $currency_object->get_bd_amount_in_text($result[0]['PRI'], 'Say &nbsp;&nbsp; &nbsp; ' . $currencyName . '&nbsp;&nbsp;&nbsp;', '&nbsp;Cents&nbsp;');
            $strContent .= '
</td>
<td style="padding:3px; border-bottom:2px #000 double;" align="right"><span style="border-bottom:1px #909090 dashed; float:right; text-align:right;">
' . $currency->convetNumberFormatDefault($TOTAL_VAL) . '</span></td>
</tr>



<tr>
<td>&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="6" bgcolor="#333333" style="font-size:12px; color:#FFF; padding:5px;" >General Terms And Conditions</td>
</tr>
<tr>
<td colspan="2" style="padding:3px; border-bottom:1px #484848 dotted;"><div style="padding:3px 10px; width:200px; float:left; font-weight:700;">Invoice Price Currency</div></td>
<td colspan="4" style="padding:3px; border-bottom:1px #484848 dotted;">' . $currencyName . '</td>
</tr>
<tr>
<td colspan="2" style="padding:3px; border-bottom:1px #484848 dotted;"><div style="padding:3px 10px; width:200px; float:left; font-weight:700;">Validity of Price Till</div></td>
<td colspan="4" style="padding:3px; border-bottom:1px #484848 dotted;">&nbsp;</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td colspan="4">&nbsp;</td>
</tr>
<tr>
<td colspan="6">&nbsp;</td>
</tr>

<tr>
<td colspan="6" bgcolor="#333333" style="font-size:12px; color:#FFF; padding:5px;" >Product Preferences</td>
</tr>
<tr>
<td colspan="6" style="padding:3px; border-bottom:1px #484848 dotted;">' . $order->orderClientNote() . '</td>

</tr>

<tr>
<td colspan="2">&nbsp;</td>
<td colspan="4">&nbsp;</td>
</tr>


<tr>
<td colspan="6" bgcolor="#333333" style="font-size:12px; color:#FFF; padding:5px;" >Delivery Details</td>
</tr>
<tr>
<td colspan="2" style="padding:3px; border-bottom:1px #484848 dotted;"><div style="padding:3px 10px; width:200px; float:left; font-weight:700;">Delivery Address</div></td>
<td colspan="4" style="padding:3px; border-bottom:1px #484848 dotted;">' . $order->orderDeliveryAddress() . '</td>
</tr>
<tr>
<td colspan="2" style="padding:3px; border-bottom:1px #484848 dotted;"><div style="padding:3px 10px; width:200px; float:left; font-weight:700;">Delivery Note</div></td>
<td colspan="4" style="padding:3px; border-bottom:1px #484848 dotted;">' . $order->orderDeliveryNote() . '</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td colspan="4">&nbsp;</td>
</tr>
<tr>
<td colspan="6">&nbsp;</td>
</tr>
<tr>
<td colspan="6"> <br>
<p>
Looking forward to see you online<br/>
' . $systemSetting->sySettingCompanyName() . '<br/><br/>
Best Regards,<br/>
Web Admin Team<br/>
<strong>' . $systemSetting->sySettingCompanyName() . ' - on ' . date('Y-m-d h:i a') . '</strong><br/>
</p>
<hr/>
<span style="color:#666; font-size:11px; font-family:Arial, Helvetica, sans-serif;">You are receiving this email, because an account has been registered at the ' . $systemSetting->sySettingCompanyName() . ' Online Shoping cart portal. If you have not made any registration or unaware of the same, please email administrator at ' . $systemSetting->sySettingCompanyEmail() . ' to remove you from this panel.</span></td>
</tr>
</table>
';

            $mail = new PHPMailer();
            $mail->IsSMTP();
            $mail->SMTPAuth = true; // enable SMTP authentication
            $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
            $mail->Host = $systemSetting->sySettingHost(); // sets GMAIL as the SMTP server
            $mail->Port = $systemSetting->sySettingPort(); // set the SMTP port

            $mail->Username = $systemSetting->sySettingSmtpUsername(); // GMAIL username
            $mail->Password = $systemSetting->sySettingSmtpPassword(); // GMAIL password

            $mail->From = $systemSetting->sySettingSmtpUsername();
            $mail->FromName = $systemSetting->sySettingFromName();
            $mail->Subject = $subject;
            $mail->WordWrap = 50; // set word wrap

            $mail->MsgHTML($strContent);
            $mail->AddAddress($customer->customerEmail(), $systemSetting->sySettingCompanyName());
            $mail->AddCC($systemSetting->sySettingCompanyEmail(), $systemSetting->sySettingCompanyName());
            $mail->IsHTML(true); // send as HTML
            $mail->AddAttachment(DOC_ROOT . "my-account/invoice-pdf/" . $filename);
            $mail->Send();
            unlink(DOC_ROOT . "my-account/invoice-pdf/" . $filename);
            return true;

        }