Ejemplo n.º 1
0
        function VoucherInvoice($VoucherId)
        {

            $voucher = new voucher();
            $customer = new customer();
            $currency_object = new CurrencyWord();
            $currency = new currency();

            $voucher->setVoucherId($VoucherId);
            $voucher->extractor($voucher->getVoucherById());

            $systemSetting = new systemSetting();
            $common = new common();
            $systemSetting->extractor($systemSetting->getSettings());

            $customer->setCustomerId($voucher->voucherCustomerId());
            $customer->extractor($customer->getCustomerById());
            $filename = $systemSetting->sySettingDocumentName() . 'voucher_In_' . $voucher->voucherId() . '.pdf';

            $subject = $systemSetting->sySettingCompanyName() . ' - New Voucher Invoice!!!';
            $EmailMessage = '<table width="800" border="0" style="font-family:Arial, Helvetica, sans-serif; background:#eee; font-size:12px; color:#333333;">
<tr>
<td colspan="2" rowspan="7" align="left" valign="top"><img src="' . DOC_ROOT . 'uplode-img/company-logo/' . $systemSetting->sySettingCompanyLogo() . '"  /></td>
<td colspan="2" rowspan="7"> <div style="font-size:13px; font-weight:bold; margin-bottom:10px;">' . $systemSetting->sySettingCompanyName() . ' </div>
<div style="margin-bottom:5px;font-size:10px;">' . $systemSetting->sySettingCompanyAddress() . '</div>
<div style="margin-bottom:5px;font-size:10px;">Telephone &nbsp; : &nbsp;&nbsp;' . $systemSetting->sySettingCompanyPhon() . '</div>
<div style="margin-bottom:5px;font-size:10px;">Email &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : &nbsp;&nbsp; ' . $systemSetting->sySettingCompanyEmail() . '</div></td>
<td colspan="2" bgcolor="#CC0000" style="color:#FFF; font-size:14px; padding:5px; text-align:right; font-weight:700; letter-spacing:1px;">V o u c h e r &nbsp;&nbsp;&nbsp;I n v o i c e</td>
</tr>
<tr>
<td width="521">&nbsp;</td>
<td width="475">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="padding:3px; border-bottom:1px #484848 dotted;"><div style="width:55px; background-color:#ececec; font-size:10px; padding:3px 5px; float:left;">Date</div></td>
<td style="padding:3px; border-bottom:1px #484848 dotted;">' . date('l jS \of F Y ', strtotime($voucher->voucherCreatedDate())) . '</td>
</tr>
<tr>
<td style="padding:3px; border-bottom:1px #484848 dotted;"><div style="width:55px; background-color:#ececec; font-size:10px; padding:3px 5px; float:left;">Voucher Code</div></td>
<td style="padding:3px; border-bottom:1px #484848 dotted;">' . $voucher->voucherCode() . '</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="410">&nbsp;</td>
<td width="222">&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="3" bgcolor="#333333" style="color:#fff; padding:3px 0 3px 8px; font-weight:bold; font-size:13px;">From</td>
<td colspan="3" bgcolor="#333333" style="color:#fff; padding:3px 0 3px 8px; font-weight:bold; font-size:13px;">To</td>
</tr>
<tr>
<td  style="padding:3px; border-bottom:1px #484848 dotted;">
<div style=" width:60px;background-color:#ececec; float:left; margin-top:2px; padding:2px 5px;">Name</div></td>
<td  style="padding:3px; border-bottom:1px #484848 dotted;">
<div style="font-size:10px;">' . $voucher->voucherFromName() . '</div></td>
<td  style="padding:3px; border-bottom:1px #484848 dotted;"></td>

<td style="padding:3px; border-bottom:1px #484848 dotted;">
<div style=" width:60px;background-color:#ececec; float:left; margin-top:2px; padding:2px 5px;">Name</div></td>
<td style="padding:3px; border-bottom:1px #484848 dotted;">' . $voucher->voucherToName() . '</td>
<td  style="padding:3px; border-bottom:1px #484848 dotted;">3</td>
</tr>
<tr>
<td  style="padding:3px; border-bottom:1px #484848 dotted;"><div style=" width:60px;background-color:#ececec; float:left; margin-top:2px; padding:2px 5px;">Email</div></td>
<td  style="padding:3px; border-bottom:1px #484848 dotted;">' . $voucher->voucherFromEmail() . '</td>
<td  style="padding:3px; border-bottom:1px #484848 dotted;"></td>
<td style="padding:3px; border-bottom:1px #484848 dotted;">
<div style=" width:60px;background-color:#ececec; float:left; margin-top:2px; padding:2px 5px;">Email</div></td>
<td style="padding:3px; border-bottom:1px #484848 dotted;">' . $voucher->voucherToEmail() . '</td>
<td  style="padding:3px; border-bottom:1px #484848 dotted;">3</td>
</tr>


<tr>
<td colspan="8">&nbsp;</td>
</tr>
<tr>
<td align="center" bgcolor="#333333" style="color:#fff; padding:3px 0 3px 8px; font-weight:bold; font-size:13px;">Item Code</td>
<td colspan="4" align="center" bgcolor="#333333" style="color:#fff; padding:3px 0 3px 8px; font-weight:bold; font-size:13px;">Description</td>
<td align="center" bgcolor="#333333" style="color:#fff; padding:3px 0 3px 8px; font-weight:bold; font-size:13px;">Total Price</td>
</tr>
<tr>
<td height="30" align="center" style="padding:3px; border-bottom:1px #484848 dotted;"> 1 </td>
<td colspan="4" style="padding:3px; border-bottom:1px #484848 dotted;">Voucher Invoice</td>
<td align="right" valign="bottom" style="padding:3px; border-bottom:1px #484848 dotted;">' . $voucher->voucherAmount() . '</td>
</tr>
<tr>
<td colspan="5" style="padding:3px; border-bottom:1px #484848 dotted;">';
            $strContent .=
                $currency_object->get_bd_amount_in_text($voucher->voucherAmount(), '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;">' .
                $voucher->voucherAmount() . '
</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;"></td>
<td colspan="4" style="padding:3px; border-bottom:1px #484848 dotted;"></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"> <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($EmailMessage);
            $mail->AddAddress($customer->customerEmail(), $systemSetting->sySettingCompanyName());
            $mail->AddCC($customer->customerEmail(), $systemSetting->sySettingCompanyName());
            $mail->IsHTML(true); // send as HTML
            $mail->AddAttachment(DOC_ROOT . "gift-voucher/voucher-invoice/" . $filename);
            $mail->Send();
            unlink(DOC_ROOT . "gift-voucher/voucher-invoice/" . $filename);
            $mail->Send();
            return true;

        }