示例#1
0
 public function __construct()
 {
     $config = Utility::getConfig();
     $this->sumOption = array('option' => array('curency' => $config['currency'], 'currency_before' => $config['currency_before'], 'number_decimal' => $config['number_decimal']));
     $this->sumColumn = array();
     parent::__construct();
 }
示例#2
0
 public function convertSingleToArray($data)
 {
     $tableInfo = Utility::getTableInfo($data->getTableid());
     $config = Utility::getConfig();
     $code = '';
     $value = '';
     $desc = '';
     if ($data->getCouponId() != -1) {
         $coupon = Utility::getCouponInfo($data->getCouponId());
         //            echo '<pre>';
         //            print_r($coupon);
         //            echo '</pre>';
         $code = $coupon->getCode();
         if ($coupon->getReuse() == 1) {
             $code = $coupon->getDescription();
         }
         $type = $coupon->getType();
         if ($type == 0) {
             $value = 'Reduce :' . number_format($coupon->getValue()) . ' ' . $config['currency'];
         } else {
             $value = 'Reduce :' . $coupon->getValue() . '%';
         }
         $desc = $coupon->getDescription();
     }
     $userInfo = Utility::getUserInfo($data->getUserId());
     $surtax = Utility::getSurTaxInfo($data->getSurtaxId());
     if ($surtax) {
         $surtaxType = $surtax->getType();
         $surtaxValue = $surtax->getValue();
     } else {
         $surtaxType = 'Cash';
         $surtaxValue = 0;
     }
     $taxType = Utility::convertSurtaxType($surtaxType);
     //print_r($coupon);
     $array = array();
     $array['id'] = $data->getId();
     $array['tableId'] = $tableInfo->getName();
     $array['createDate'] = date('d/m/Y h:i:s', $data->getCreateDate());
     $array['totalCost'] = number_format($data->getTotalCost());
     $array['totalRealCost'] = number_format($data->getTotalRealCost());
     $array['coupon'] = $code;
     $array['couponValue'] = $value;
     $array['couponDesc'] = $desc;
     $array['surtax'] = number_format($surtaxValue) . ' ' . $taxType;
     $array['userid'] = $userInfo->getUserName();
     $array['status'] = $data->getStatus();
     $array['customer_id'] = $data->getCustomerId();
     $array['newDate'] = $data->getNewDate();
     return $array;
 }
示例#3
0
 public static function sendMailAttachment($data, $fileName, $subject, $receiveEmail, $smtp = true)
 {
     // setup SMTP options
     $config = Utility::getConfig();
     $options = new Mail\Transport\SmtpOptions(array('name' => 'localhost', 'host' => 'smtp.gmail.com', 'port' => 587, 'connection_class' => 'login', 'connection_config' => array('username' => $config['emailId'], 'password' => $config['emailPassword'], 'ssl' => 'tls')));
     if ($smtp) {
         $senderEmail = $config['emailId'];
         $senderName = $config['emailId'];
     } else {
         $senderEmail = $config['emailId'];
         $senderName = 'Kaffa - Coffee & more';
     }
     //        $render = self::$servicelocator->get('ViewRenderer');
     //$content = $render->render('email/' . $templateName, array('data' => $data));
     $content = fopen($data, 'r');
     // make a header as html
     $html = new MimePart($content);
     $html->type = \Zend\Mime\Mime::TYPE_OCTETSTREAM;
     $html->filename = $fileName;
     $html->disposition = \Zend\Mime\Mime::DISPOSITION_INLINE;
     $body = new MimeMessage();
     $body->setParts(array($html));
     // instance mail
     $mail = new Mail\Message();
     $mail->setBody($body);
     // will generate our code html from template.phtml
     $mail->setFrom($senderEmail, $senderName);
     $mail->setTo($receiveEmail);
     $mail->setSubject($subject);
     if ($smtp) {
         $transport = new Mail\Transport\Smtp($options);
     } else {
         $transport = new Mail\Transport\Sendmail();
     }
     $transport->send($mail);
 }
示例#4
0
 static function translate($lang = null)
 {
     $lang = '';
     try {
         $config = Utility::getConfig();
         $lang = isset($config['lang']) ? $config['lang'] : '';
     } catch (\Exception $e) {
     }
     if ($lang == '') {
         $lang = 'en_us';
     }
     $type = 'Gettext';
     $pattern = $lang . '.mo';
     $base_dir = __DIR__ . '/../../../../../language/';
     $translator = new Translator();
     $translator->setLocale("en");
     $translator->addTranslationFilePattern($type, $base_dir, $pattern);
     return $translator;
 }
 public static function renderBestCostSupplier($costBetterSupplier)
 {
     $setting = Utility::getConfig();
     //        print_r($setting);
     $contactInfo = '';
     $checkExists = array();
     foreach ($costBetterSupplier as $supplierItem) {
         $supplierInfo = \Velacolib\Utility\Utility::getSupplierInfo($supplierItem['supplier_id']);
         if ($supplierInfo->getIsdelete() == 0) {
             if (!isset($checkExists[$supplierInfo->getId()])) {
                 $contactInfo .= '<b>' . $supplierInfo->getCompanyName() . ' - ' . $supplierItem['rating'] . ' ' . $setting['currency'] . '/' . $supplierItem['unit'] . ' </b><br/> - Phone: ' . $supplierInfo->getPhone() . '<br/> - Mobile: ' . $supplierInfo->getMobile() . '<br/> - Addr: ' . $supplierInfo->getAddr() . '<br/><br/>';
                 $checkExists[$supplierInfo->getId()] = $supplierInfo->getId();
             }
         }
         //}
     }
     return $contactInfo;
 }