function getMessages($user, $reverse, $last) { // get messages $time = date("F d Y H:i:s.", filemtime("msg/" . $user)); $time = prettyDate($time) . "."; if ($time == "46 years ago.") { $time = "Never ago."; } $curtime = date("F d Y H:i:s.", time()); if (!isset($last)) { echo "Message last receieved: " . $time . " Current time: " . $curtime . "<br>\n"; } echo "Messages, sorted by recent:<br>\n"; if (!$reverse) { $messages = file("msg/" . $user); } else { $messages = array_reverse(file("msg/" . $user)); } echo "<div class='scrolls'>"; foreach ($messages as $message) { highlight_string($message) . "<br>"; } echo "</div>"; if (isset($_POST["api"])) { die; } }
function _pel_cmsList_messageColumn($displayValue, $tableName, $fieldname, $record = array()) { if ($tableName != '_error_log') { return $displayValue; } // skip all by our table // if ($fieldname == 'dateLogged') { if (!$record) { return str_replace(' ', ' ', t("Date / When")); } // header - we detect the header hook by checking if the 4th argument is set $displayValue = "<div title='" . htmlencode($record['dateLogged']) . "'>"; $displayValue .= str_replace(' ', ' ', prettyDate($record['dateLogged'])); // row cell - we detect the row cell by checking if $record is set $displayValue .= "</div>"; } // if ($fieldname == '_error_summary_') { if (!$record) { return t("Error Details"); } // header - we detect the header hook by checking if the 4th argument is set // row cell - we detect the row cell by checking if $record is set // get truncated url $truncatedUrl = $record['url']; $maxLength = 90; if (preg_match("/^(.{0,{$maxLength}})(\\s|\$)/s", $truncatedUrl, $matches)) { $truncatedUrl = $matches[1]; } else { $truncatedUrl = mb_substr($truncatedUrl, 0, $maxLength); } // otherwise force cut at maxlength (for content with no whitespace such as malicious or non-english) if (strlen($truncatedUrl) < strlen($record['url'])) { $truncatedUrl .= " ..."; } // $displayValue = "<div style='line-height:1.5em'>\n"; $displayValue .= nl2br(htmlencode("{$record['error']}\n{$record['filepath']} (line {$record['line_num']})\n{$truncatedUrl}")); $displayValue .= "</div>"; //$displayValue = "<table border='0' cellspacing='0' cellpadding='0' class='spacedTable'>\n"; // $displayValue .= " <tr><td>" .t('Error'). "</td><td> : </td><td>" .htmlencode($record['error']). "</div></td></tr>\n"; //if ($record['url']) { $displayValue .= " <tr><td>" .t('URL'). "</td><td> : </td><td>" .htmlencode($record['url']). "</div></td></tr>\n"; } //if ($record['filepath']) { $displayValue .= " <tr><td>" .t('Filepath'). "</td><td> : </td><td>" .htmlencode($record['filepath']). "</div></td></tr>\n"; } //$displayValue .= " </table>\n"; } return $displayValue; }
function render_mobile($rows = 10) { $json = apc_fetch(self::$forumKey); if (!$json) { return ""; } $items = json_decode($json, 1); foreach ($items as $i) { if ($rows-- == 0) { break; } $text = str_replace("/", "/<wbr>", $i["text"]); $time = prettyDate($i["time"]); $str .= "<li><a target=\"_self\" href=\"{$i['link']}\">{$text}</a><span class=\"when\">{$time}</span></li>"; } return $str; }
function render_search_mobile($search, $rows = 10) { // note that data is stored in apc via a cron job $json = apc_fetch(self::$searchKey . $search); if (!$json) { return ""; } $tweets = json_decode($json); $str = ""; foreach ($tweets->results as $t) { if ($t->from_user == $search) { continue; } if ($rows-- == 0) { break; } $time = prettyDate(strtotime($t->created_at)); $str .= "<div class=\"row\"><a href=\"http://twitter.com/{$t->from_user}\">{$t->from_user}</a>: " . $this->hyperlinkit($t->text) . " <span class=\"when\">{$time}<span></div>"; } return $str; }
</td> <td><?php $date = prettyDate($val['membership_expired']); echo $date = Yii::app()->functions->translateDate($date); ?> </td> <td><?php echo strtoupper($val['payment_type']); ?> </td> <td><?php echo Yii::t("default", $val['status']); ?> </td> <td><?php $date = prettyDate($val['date_created'], true); echo $date = Yii::app()->functions->translateDate($date); ?> </td> </tr> <?php } ?> </tbody> </table> <?php } else { ?> <p class="uk-text-warning"><?php
</div> <?php if ($data['trans_type'] == "delivery") { ?> <?php if (isset($data['delivery_date'])) { ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Delivery Date"); ?> :</div> <div class="value"><?php $date = prettyDate($data['delivery_date']); echo $date = Yii::app()->functions->translateDate($date); ?> </div> <div class="clear"></div> </div> <?php } ?> <?php if (isset($data['delivery_time'])) { ?> <?php if (!empty($data['delivery_time'])) { ?>
$account = $val['bank_account_number']; $method = "Bank account to {$account}"; } ?> <tr> <td><?php echo displayPrice(adminCurrencySymbol(), normalPrettyPrice($val['amount'])); ?> </td> <td><?php echo $method; ?> </td> <td><?php echo prettyDate($val['date_process']); ?> </td> <td><?php echo $val['status']; ?> </td> </tr> <?php } ?> </thead> <tbody> </tbody> </table>
<?php if ($merchant_preorder == 1) { ?> <a href="javascript:;" class="uk-button checkout"><?php echo Yii::t("default", "Pre-Order"); ?> </a> <?php } else { ?> <p class="uk-alert uk-alert-warning"><?php echo Yii::t("default", "Sorry merchant is closed."); ?> </p> <p><?php echo prettyDate(date('c'), true); ?> </p> <?php } ?> <?php } ?> <?php } else { ?> <?php $msg = Yii::t("default", "This merchant is not currently accepting orders."); ?> <p class="uk-text-danger"><?php
?> </a> </div> <div style="height:20px;"></div> <h3 style="text-align:center;"><?php echo t("Merchant Sales Summary Report"); ?> </h3> <?php if (isset($_GET['start_date']) || isset($_GET['end_date'])) { ?> <p style="text-align:center;"><?php echo prettyDate($_GET['start_date']) . " " . t("and") . " " . prettyDate($_GET['end_date']); ?> </p> <?php } else { ?> <p style="text-align:center;"><?php echo t("As Of"); ?> <?php echo date("F d Y"); ?> </p> <?php } ?>
function render_mobile($num = 10) { $json = $this->get_cached_data(); $s = ""; if ($json && ($issues = json_decode($json, 1))) { foreach ($issues as $i) { if ($num-- == 0) { break; } $s .= "<li><a target=\"_self\" href=\"{$i['url']}\"><b>{$i['state']}</b>: {$i['title']} <span class=\"when\">" . prettyDate($i['updated']) . "</span></a></li>"; } } return $s; }
?> <tr class="listRow <?php echo @++$cronTaskCounter % 2 ? 'listRowOdd' : 'listRowEven'; ?> "> <td><?php echo htmlencode($record['function']); ?> </td> <td><?php echo htmlencode($record['activity']); ?> </td> <td><?php $latestLog = mysql_get('_cron_log', null, ' function = "' . mysql_escape($record['function']) . '" ORDER BY num DESC'); echo prettyDate($latestLog['createdDate']); ?> </td> <td><?php echo htmlencode($record['expression']); ?> </td> </tr> <?php } ?> <?php } else { ?> <tr> <td colspan="4"><?php
/<?php echo $ROOTPATH; ?> /Sales/NewSale.php?order_id=<?php echo $order["details"]["order_id"]; ?> ">#<?php echo $order["details"]["order_id"]; ?> </a></td> <td colspan="2" style="font-weight: bold"><?php echo $order["details"]["contact_DisplayName"]; ?> </td> <td colspan="2" style="font-weight: bold; text-align: right;">Date Sold: <?php echo preg_replace("/\\s+\\S+\\s\\S+\$/", "", prettyDate($order["details"]["DateCompleted"])); ?> </td> <td colspan="3" style="font-weight: bold; text-align: right; whitespace: normal">Payment Types: <?php $paymentDisplay = array(); foreach ($order["PaymentMethods"] as $method) { $output = ucwords($method["paymentType"]); if ($method["paymentType"] == "finance") { $output = $output . " ("; $companies = array(); # $firephp->log($method["paymentType"]); # $firephp->log($method); # $firephp->log($method["companies"]); foreach ($method["companies"] as $company) { $companies[] = $company["company"] . " - " . $company["option"];
public function getCalendar($event = NULL) { if (is_null($event)) { return FALSE; } function prettyDate($time) { return date('n/j', $time); } $this->load->model('day_model'); $DAY = 86400; $date_start = strtotime($event['date_start']); $date_end = strtotime($event['date_end']); // first Sunday <= $date_start $calendar_start = $date_start - date('w', $date_start) * $DAY; // Saturday >= $date_end $calendar_end = $date_end + (6 - date('w', $date_end)) * $DAY; // load an array of times between calendar's start and end $days = array(); for ($i = $calendar_start; $i <= $calendar_end; $i += $DAY) { $this_day['date'] = $i; $this_day['pretty_date'] = prettyDate($i); $this_day['event_day'] = ''; // if this is a day of the event, check to see if it has been submitted yet if ($date_start <= $i && $i <= $date_end) { $this_day['event_day'] = 'event_day'; $this_day['submitted'] = $this->day_model->daySubmitted($event['id'], $i) ? 'submitted' : ''; } array_push($days, $this_day); unset($this_day); } return $days; }
if (count($productType) === 0) { continue; } $product = $productType[0]; $contents = $product['contents']; // TODO :: Do we want to do this? if (!isset($contents['contents.xml'])) { continue; } // Skip if product does not specify links (other than contents.xml) if (count($contents) === 0) { continue; } print '<dt>' . $product['type'] . ' (' . strtoupper($product['source']) . ') ' . $product['properties']['eventsource'] . $product['properties']['eventsourcecode'] . '</dt>' . '<dd><ul>'; foreach ($contents as $file) { if (strpos($file['url'], 'contents.xml') !== false) { continue; } print '<li>' . '<a href="' . $file['url'] . '" title="Size: ' . prettySize($file['length']) . ' Last Modified: ' . prettyDate($file['lastModified']) . '">' . basename($file['url']) . ' (' . prettySize($file['length']) . ')</a>' . '</li>'; } print '</ul></dd>'; } ?> </dl> </div> </section> <footer class="event-footer"> <!-- TODO :: ??? --> </footer>
<?php include 'header.php'; include 'connect.php'; include 'fun.php'; session_start(); $uid = $_SESSION['user']['id']; $notes_html = ''; $row = $db->select('notes', "uid='{$uid}'"); for ($i = 0; $i < count($row); $i++) { $notes_html .= '<li><a data-transition="slide" href="view_note.php?id=' . $row[$i]['id'] . '">' . $row[$i]['title'] . '</a> <p class="ui-li-aside">' . prettyDate($row[$i]['time']) . '</p> </li>'; } ?> <div id="notes" data-role="page"> <!--LOGO--> <div data-role="header" data-theme="a" > <a href="index.php" class="ui-nodisc-icon ui-alt-icon" data-ajax="false" data-icon="carat-l" data-iconpos="notext">back</a> <h1>Notes</h1> <a data-type="button" data-icon="plus" data-transition="slideup" class="ui-nodisc-icon ui-alt-icon" href="#add_note">ADD</a> </div> <!--CONTAINER--> <div role="main" class="ui-content"> <ul class="ui-nodisc-icon ui-alt-icon" data-role="listview"> <?php echo $notes_html;
function get_posts($limit = null, $id = null, $lid = null, $oid = null) { $this->check_login(); $table = 'posts'; $oid_q = ''; $lid_q = ''; $id_q = ''; $limit_q = ''; //get user info $uid = $this->uid; $row = $this->db->select('members', "id='{$uid}'"); $user = $row[0]; //<--load posts if ($oid) { $oid_q = "AND id<{$oid}"; } if ($lid) { $lid_q = "AND id>{$lid}"; } if ($limit) { $limit_q = "LIMIT {$limit}"; } if ($id) { $id_q = "uid='{$id}'"; } else { //make values for sql query $v = array(); //check if fid is not empty if ($user['f_list'] != '') { //convert fid to array $u_list = to_array(add_array($uid, $user['f_list'])); for ($i = 0; $i < count($u_list); $i++) { array_push($v, "'" . $u_list[$i] . "'"); } } array_push($v, "'" . $uid . "'"); $va = implode(',', $v); $id_q = "uid IN ({$va})"; } //get posts $posts = array(); $row = $this->db->select($table, "{$id_q} {$oid_q} {$lid_q}", '*', "time DESC {$limit_q}"); for ($i = 0; $i < count($row); $i++) { $uid = $row[$i]['uid']; $ur = $this->db->select('members', "id='{$uid}'"); $row[$i]['name'] = $ur[0]['fname'] . ' ' . $ur[0]['lname']; $row[$i]['username'] = $ur[0]['username']; $row[$i]['time'] = prettyDate($row[$i]['time']); //convert fid to array $like = to_array($row[$i]['lid']); $row[$i]['c_like'] = count($like); if (in_array($user['id'], $like)) { $row[$i]['liked'] = 1; } else { $row[$i]['liked'] = 0; } array_push($posts, $row[$i]); } return $posts; }
public function receipt() { $data = ''; $ok = false; if ($data = Yii::app()->functions->getOrder2($_GET['id'])) { $merchant_id = $data['merchant_id']; $json_details = !empty($data['json_details']) ? json_decode($data['json_details'], true) : false; if ($json_details != false) { Yii::app()->functions->displayOrderHTML(array('merchant_id' => $data['merchant_id']), $json_details, true); if (Yii::app()->functions->code == 1) { $ok = true; } } } unset($_SESSION['kr_item']); unset($_SESSION['kr_merchant_id']); unset($_SESSION['voucher_code']); unset($_SESSION['less_voucher']); $print = ''; ?> <div class="page"> <div class="main"> <div class="inner"> <?php if ($ok == TRUE) { ?> <div class="receipt-main-wrap"> <h3><?php echo Yii::t("default", "Thank You"); ?> </h3> <p><?php echo Yii::t("default", "Your order has been placed."); ?> </p> <div class="receipt-wrap order-list-wrap"> <h4><?php echo Yii::t("default", "Order Details"); ?> </h4> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Name"); ?> :</div> <div class="value"><?php echo $data['full_name']; ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Name"), 'value' => $data['full_name']); ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Merchant Name"); ?> :</div> <div class="value"><?php echo $data['merchant_name']; ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Merchant Name"), 'value' => $data['merchant_name']); ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "TRN Type"); ?> :</div> <div class="value"><?php echo Yii::t("default", $data['trans_type']); ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "TRN Type"), 'value' => $data['trans_type']); ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Payment Type"); ?> :</div> <div class="value"><?php echo strtoupper(Yii::t("default", $data['payment_type'])); ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Payment Type"), 'value' => strtoupper($data['payment_type'])); ?> <?php if ($data['payment_type'] == "pyp") { ?> <?php $paypal_info = Yii::app()->functions->getPaypalOrderPayment($data['order_id']); ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Paypal Transaction ID"); ?> :</div> <div class="value"><?php echo isset($paypal_info['TRANSACTIONID']) ? $paypal_info['TRANSACTIONID'] : ''; ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Paypal Transaction ID"), 'value' => isset($paypal_info['TRANSACTIONID']) ? $paypal_info['TRANSACTIONID'] : ''); ?> <?php } ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Reference #"); ?> :</div> <div class="value"><?php echo Yii::app()->functions->formatOrderNumber($data['order_id']); ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Reference #"), 'value' => Yii::app()->functions->formatOrderNumber($data['order_id'])); ?> <?php if (!empty($data['payment_reference'])) { ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Payment Ref"); ?> :</div> <div class="value"><?php echo $data['payment_reference']; ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Payment Ref"), 'value' => Yii::app()->functions->formatOrderNumber($data['order_id'])); ?> <?php } ?> <?php if ($data['payment_type'] == "ccr") { ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Card #"); ?> :</div> <div class="value"><?php echo $card = Yii::app()->functions->maskCardnumber($data['credit_card_number']); ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Card #"), 'value' => $card); ?> <?php } ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "TRN Date"); ?> :</div> <div class="value"><?php $trn_date = date('M d,Y G:i:s', strtotime($data['date_created'])); echo Yii::app()->functions->translateDate($trn_date); ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "TRN Date"), 'value' => $trn_date); ?> <?php if ($data['trans_type'] == "delivery") { ?> <?php if (isset($_SESSION['kr_delivery_options']['delivery_date'])) { ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Delivery Date"); ?> :</div> <div class="value"><?php $deliver_date = prettyDate($_SESSION['kr_delivery_options']['delivery_date']); echo Yii::app()->functions->translateDate($deliver_date); ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Delivery Date"), 'value' => $deliver_date); ?> <?php } ?> <?php if (isset($_SESSION['kr_delivery_options']['delivery_time'])) { ?> <?php if (!empty($_SESSION['kr_delivery_options']['delivery_time'])) { ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Delivery Time"); ?> :</div> <div class="value"><?php echo $_SESSION['kr_delivery_options']['delivery_time']; ?> </div> <div class="clear"></div> </div> <?php } ?> <?php } ?> <?php if (isset($_SESSION['kr_delivery_options']['delivery_asap'])) { ?> <?php if (!empty($_SESSION['kr_delivery_options']['delivery_asap'])) { ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Deliver ASAP"); ?> :</div> <div class="value"><?php echo $delivery_asap = $_SESSION['kr_delivery_options']['delivery_asap'] == 1 ? "Yes" : ''; ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Deliver ASAP"), 'value' => $delivery_asap); ?> <?php } ?> <?php } ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Deliver to"); ?> :</div> <div class="value"><?php echo $data['full_address']; ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Deliver to"), 'value' => $data['full_address']); ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Delivery Instruction"); ?> :</div> <div class="value"><?php echo $data['delivery_instruction']; ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Delivery Instruction"), 'value' => $data['delivery_instruction']); ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Location Name"); ?> :</div> <div class="value"><?php echo $data['location_name']; ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Location Name"), 'value' => $data['location_name']); ?> <?php } else { ?> <?php if (isset($_SESSION['kr_delivery_options']['delivery_date'])) { ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Pickup Date"); ?> :</div> <div class="value"><?php echo $_SESSION['kr_delivery_options']['delivery_date']; ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Pickup Date"), 'value' => $_SESSION['kr_delivery_options']['delivery_date']); ?> <?php } ?> <?php if (isset($_SESSION['kr_delivery_options']['delivery_time'])) { ?> <?php if (!empty($_SESSION['kr_delivery_options']['delivery_time'])) { ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Pickup Time"); ?> :</div> <div class="value"><?php echo $_SESSION['kr_delivery_options']['delivery_time']; ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Pickup Time"), 'value' => $_SESSION['kr_delivery_options']['delivery_time']); ?> <?php } ?> <?php } ?> <?php } ?> <div class="spacer-small"></div> <?php echo $item_details = Yii::app()->functions->details['html']; ?> </div> <!--receipt-wrap--> <div class="print_wrap"> <a class="print_element left" href="javascript:;"><i class="fa fa-print"></i> <?php echo Yii::t("default", "Click here to print"); ?> </a> <div class="clear"></div> </div> </div> <?php } else { ?> <p class="uk-alert uk-alert-warning"><?php echo Yii::t("default", "Sorry but we cannot find what you are looking for."); ?> </p> <?php } ?> </div> </div> <!--main--> </div> <!--page--> <?php $receipt = EmailTPL::salesReceipt($print, Yii::app()->functions->details['raw']); $tpl = Yii::app()->functions->getOption("receipt_content", $merchant_id); if (empty($tpl)) { $tpl = EmailTPL::receiptTPL(); } $tpl = Yii::app()->functions->smarty('receipt', $receipt, $tpl); $tpl = Yii::app()->functions->smarty('customer-name', $data['full_name'], $tpl); $tpl = Yii::app()->functions->smarty('receipt-number', Yii::app()->functions->formatOrderNumber($data['order_id']), $tpl); $receipt_sender = Yii::app()->functions->getOption("receipt_sender", $merchant_id); $receipt_subject = Yii::app()->functions->getOption("receipt_subject", $merchant_id); if (empty($receipt_subject)) { $receipt_subject = "Your Karenderia order is confirmed"; } if (empty($receipt_sender)) { $receipt_sender = 'no-reply@' . $_SERVER['HTTP_HOST']; } $to = isset($data['email_address']) ? $data['email_address'] : ''; if (!in_array($data['order_id'], (array) $_SESSION['kr_receipt'])) { sendEmail($to, $receipt_sender, $receipt_subject, $tpl); /*send email to merchant address*/ $merchant_notify_email = Yii::app()->functions->getOption("merchant_notify_email", $merchant_id); $enabled_alert_notification = Yii::app()->functions->getOption("enabled_alert_notification", $merchant_id); /*dump($merchant_notify_email); dump($enabled_alert_notification); */ if ($enabled_alert_notification == "") { sendEmail($merchant_notify_email, $receipt_sender, Yii::t("default", "New Order From ") . $data['full_name'], $tpl); } // send SMS Yii::app()->functions->SMSnotificationMerchant($merchant_id, $data); } $_SESSION['kr_receipt'] = array($data['order_id']); die; }
<tr class="even"> <td class="iconCell"><img src="/<?php echo $ROOTPATH; ?> /images/calcIcon.png" /></td> <td class="linksCell">T<span class="fakecaps">ax Rates</span><br /> <a style="padding: 4px 0px 0px 0px" href="/<?php echo $ROOTPATH; ?> /Admin/ManageTaxRates.php">M<span class="fakecaps">anage</span></a></td> <td class="countCell"><?php echo $taxratecount; ?> </td> <td class="dateCell"><?php echo prettyDate($taxrates_date); ?> <br>by <?php echo $taxrates_firstname; ?> <?php echo $taxrates_lastname; ?> (<?php echo $taxrates_username; ?> )</td> </tr> </tbody> </table>
public function export() { $merchant_id = Yii::app()->functions->getMerchantID(); $db_ext = new DbExt(); if (!empty($_SESSION['kr_export_stmt'])) { $stmt = $_SESSION['kr_export_stmt']; $pos = strpos($stmt, "LIMIT"); $stmt = substr($stmt, 0, $pos); switch ($this->data['rpt']) { case 'sales-report': if ($res = $db_ext->rst($stmt)) { $csvdata = array(); $datas = array(); foreach ($res as $val) { $item = ''; $date = date('m-d-Y G:i:s', strtotime($val['date_created'])); $latestdata[] = array($val['order_id'], $val['client_name'], $val['item'], $val['trans_type'], $val['payment_type'], prettyFormat($val['sub_total'], $merchant_id), prettyFormat($val['tax'], $merchant_id), prettyFormat($val['total_w_tax'], $merchant_id), $val['status'], $date); } unset($data); $data = $latestdata; } if (is_array($data) && count($data) >= 1) { $csvdata = array(); $datas = array(); foreach ($data as $val) { foreach ($val as $key => $vals) { $datas[] = $vals; } $csvdata[] = $datas; unset($datas); } } $header = array(Yii::t("default", "Ref#"), Yii::t("default", "Client Name"), Yii::t("default", "Item"), Yii::t("default", "Trans Type"), Yii::t("default", "Payment Type"), Yii::t("default", "Total"), Yii::t("default", "Tax"), Yii::t("default", "Total W/Tax"), Yii::t("default", "Status"), Yii::t("default", "Date")); $filename = $this->data['rpt'] . '-' . date('c') . '.csv'; $excel = new ExcelFormat($filename); $excel->addHeaders($header); $excel->setData($csvdata); $excel->prepareExcel(); exit; break; case "sales-summary-report": $has_date_range = false; if (isset($_SESSION['rpt_date_range'])) { if (is_array($_SESSION['rpt_date_range'])) { $has_date_range = true; } } if ($res = $db_ext->rst($stmt)) { foreach ($res as $val) { $total_amt = ''; if ($has_date_range == true) { $data[] = array($val['item_id'], $val['item_name'], $val['size'], prettyFormat($val['discounted_price'], $merchant_id), prettyFormat($val['total_qty'], $merchant_id), prettyFormat($val['total_qty'] * $val['discounted_price'], $merchant_id), $_SESSION['rpt_date_range']['start_date'], $_SESSION['rpt_date_range']['end_date']); } else { $data[] = array($val['item_id'], $val['item_name'], $val['size'], prettyFormat($val['discounted_price'], $merchant_id), prettyFormat($val['total_qty'], $merchant_id), prettyFormat($val['total_qty'] * $val['discounted_price'], $merchant_id)); } } } $header = array(Yii::t("default", "Item"), Yii::t("default", "Item Name"), Yii::t("default", "Size"), Yii::t("default", "Item Price"), Yii::t("default", "Total Qty"), Yii::t("default", "Total Amount")); if ($has_date_range == true) { $header[] = t("Start Date"); $header[] = t("End Date"); } $filename = $this->data['rpt'] . '-' . date('c') . '.csv'; $excel = new ExcelFormat($filename); $excel->addHeaders($header); $excel->setData($data); $excel->prepareExcel(); exit; break; case "rptSalesMerchant": if ($res = $db_ext->rst($stmt)) { foreach ($res as $val) { $data[] = array($val['merchant_id'], $val['restaurant_name'], $val['contact_name'], $val['contact_phone'] . " / " . $val['contact_email'], $val['street'] . " " . $val['city'] . " " . $val['state'] . " " . $val['country_code'] . " " . $val['post_code'], ucwords($val['package_name']), $val['status'], Yii::app()->functions->prettyDate($val['date_created'], true)); } } $header = array(Yii::t("default", "MerchantID"), Yii::t("default", "MerchantName"), Yii::t("default", "ContactName"), Yii::t("default", "Contact"), Yii::t("default", "Address"), Yii::t("default", "Package"), Yii::t("default", "Status"), Yii::t("default", "Date")); $filename = $this->data['rpt'] . '-' . date('c') . '.csv'; $excel = new ExcelFormat($filename); $excel->addHeaders($header); $excel->setData($data); $excel->prepareExcel(); exit; break; break; case 'rptAdminSalesMerchant': if ($res = $db_ext->rst($stmt)) { foreach ($res as $val) { $date = prettyDate($val['date_created'], true); $date = Yii::app()->functions->translateDate($date); $data[] = array($val['order_id'], ucwords($val['client_name']), $val['item'], ucwords(Yii::t("default", $val['trans_type'])), strtoupper(Yii::t("default", $val['payment_type'])), standardPrettyFormat($val['sub_total'], $merchant_id), standardPrettyFormat($val['tax'], $merchant_id), standardPrettyFormat($val['total_w_tax'], $merchant_id), ucwords($val['status']), $date); } } $header = array(Yii::t("default", "Ref#"), Yii::t("default", "Name"), Yii::t("default", "Item"), Yii::t("default", "TransType"), Yii::t("default", "Payment Type"), Yii::t("default", "Total"), Yii::t("default", "Tax"), Yii::t("default", "Total W/Tax"), Yii::t("default", "Status"), Yii::t("default", "Date")); $filename = $this->data['rpt'] . '-' . date('c') . '.csv'; $excel = new ExcelFormat($filename); $excel->addHeaders($header); $excel->setData($data); $excel->prepareExcel(); exit; break; case "rptCustomerList": if ($res = $db_ext->rst($_SESSION['kr_export_stmt'])) { foreach ($res as $val) { $data[] = array($val['email_address'], $val['first_name'], $val['last_name']); } } $header = array(t("Email"), t("firstname"), t("lastname")); $filename = $this->data['rpt'] . '-' . date('c') . '.csv'; $excel = new ExcelFormat($filename); $excel->addHeaders($header); $excel->setData($data); $excel->prepareExcel(); exit; break; case "rptSubriberList": if ($res = $db_ext->rst($_SESSION['kr_export_stmt'])) { foreach ($res as $val) { $date = prettyDate($val['date_created'], true); $date = Yii::app()->functions->translateDate($date); $data[] = array($val['id'], $val['email_address'], $date, $val['ip_address']); } } $header = array(t("ID"), t("Email address"), t("Date Created"), t("I.P Address")); $filename = $this->data['rpt'] . '-' . date('c') . '.csv'; $excel = new ExcelFormat($filename); $excel->addHeaders($header); $excel->setData($data); $excel->prepareExcel(); exit; break; case "rptmerchantcommission": if ($res = $db_ext->rst($_SESSION['kr_export_stmt'])) { foreach ($res as $val) { $date = prettyDate($val['date_created'], true); $date = Yii::app()->functions->translateDate($date); $data[] = array($val['merchant_id'], $val['merchant_name'], normalPrettyPrice($val['total_order']), normalPrettyPrice($val['total_commission'])); } } $header = array(t("ID"), t("Merchant Name"), t("Total Price"), t("Commission Price")); $filename = $this->data['rpt'] . '-' . date('c') . '.csv'; $excel = new ExcelFormat($filename); $excel->addHeaders($header); $excel->setData($data); $excel->prepareExcel(); exit; break; case "rptmerchantcommissiondetails": $total_order = 0; $total_commission = 0; if ($res = $db_ext->rst($_SESSION['kr_export_stmt'])) { foreach ($res as $val) { $date = prettyDate($val['date_created'], true); $date = Yii::app()->functions->translateDate($date); $total_order = $total_order + $val['total_order']; $total_commission = $total_commission + $val['total_commission']; $data[] = array($val['order_id'], normalPrettyPrice($val['total_w_tax']), normalPrettyPrice($val['percent_commision']), normalPrettyPrice($val['total_commission']), $date); } } $header = array(t("Reference #"), t("Total Price"), t("Commission (%)"), t("Commission price"), t("Date")); $filename = $this->data['rpt'] . '-' . date('c') . '.csv'; $excel = new ExcelFormat($filename); $excel->addHeaders($header); $excel->setData($data); $excel->prepareExcel(); exit; break; case "rptmerchantstatement": if ($res = $db_ext->rst($_SESSION['kr_export_stmt'])) { foreach ($res as $val) { $date = prettyDate($val['date_created'], true); $date = Yii::app()->functions->translateDate($date); $total = $val['total_w_tax']; if ($val['commision_ontop'] == 1) { $total = $val['sub_total']; } $total_commission = $val['total_commission']; $amount = $total - $total_commission; $data[] = array($val['order_id'], strtoupper($val['payment_type']), normalPrettyPrice($total), normalPrettyPrice($val['percent_commision']), normalPrettyPrice($total_commission), normalPrettyPrice($amount), $date); } } $header = array(t("Reference #"), t("Payment Type"), t("Total Price"), t("Commission (%)"), t("Commission"), t("Net Amount"), t("Date")); $filename = $this->data['rpt'] . '-' . date('c') . '.csv'; $excel = new ExcelFormat($filename); $excel->addHeaders($header); $excel->setData($data); $excel->prepareExcel(); exit; break; case "rptmerchantsalesummary": $has_date_range = false; if (isset($_SESSION['rpt_date_range'])) { if (is_array($_SESSION['rpt_date_range'])) { $has_date_range = true; } } if ($res = $db_ext->rst($_SESSION['kr_export_stmt'])) { foreach ($res as $val) { if ($has_date_range == true) { $data[] = array($val['restaurant_name'], normalPrettyPrice($val['total_sales'] + 0), normalPrettyPrice($val['total_commission'] + 0), normalPrettyPrice($val['total_earnings'] + 0), $_SESSION['rpt_date_range']['start_date'], $_SESSION['rpt_date_range']['end_date']); } else { $data[] = array($val['restaurant_name'], normalPrettyPrice($val['total_sales'] + 0), normalPrettyPrice($val['total_commission'] + 0), normalPrettyPrice($val['total_earnings'] + 0)); } } } $header = array(t("Merchant Name"), t("Total Sales"), t("Total Commission"), t("Merchant Earnings")); if ($has_date_range == true) { $header[] = t("Start Date"); $header[] = t("End Date"); } $filename = $this->data['rpt'] . '-' . date('c') . '.csv'; $excel = new ExcelFormat($filename); $excel->addHeaders($header); $excel->setData($data); $excel->prepareExcel(); exit; break; case "booking-summary-report": $has_date_range = false; if (isset($_SESSION['rpt_date_range'])) { if (is_array($_SESSION['rpt_date_range'])) { $has_date_range = true; } } if ($res = $db_ext->rst($_SESSION['kr_export_stmt'])) { foreach ($res as $val) { if ($has_date_range == true) { $data[] = array($val['total_approved'] + 0, $val['total_denied'] + 0, $val['total_pending'] + 0, $_SESSION['rpt_date_range']['start_date'], $_SESSION['rpt_date_range']['end_date']); } else { $data[] = array($val['total_approved'] + 0, $val['total_denied'] + 0, $val['total_pending'] + 0); } } } $header = array(t("Total Approved"), t("Total Denied"), t("Total Pending")); if ($has_date_range == true) { $header[] = t("Start Date"); $header[] = t("End Date"); } $filename = $this->data['rpt'] . '-' . date('c') . '.csv'; $excel = new ExcelFormat($filename); $excel->addHeaders($header); $excel->setData($data); $excel->prepareExcel(); exit; break; case "merchanBbookingSummaryReport": $has_date_range = false; if (isset($_SESSION['rpt_date_range'])) { if (is_array($_SESSION['rpt_date_range'])) { $has_date_range = true; } } if ($res = $db_ext->rst($_SESSION['kr_export_stmt'])) { foreach ($res as $val) { if ($has_date_range == true) { $data[] = array(ucwords($val['merchant_name']), $val['total_approved'] + 0, $val['total_denied'] + 0, $val['total_pending'] + 0, $_SESSION['rpt_date_range']['start_date'], $_SESSION['rpt_date_range']['end_date']); } else { $data[] = array(ucwords($val['merchant_name']), $val['total_approved'] + 0, $val['total_denied'] + 0, $val['total_pending'] + 0); } } } $header = array(t("Merchant Name"), t("Total Approved"), t("Total Denied"), t("Total Pending")); if ($has_date_range == true) { $header[] = t("Start Date"); $header[] = t("End Date"); } $filename = $this->data['rpt'] . '-' . date('c') . '.csv'; $excel = new ExcelFormat($filename); $excel->addHeaders($header); $excel->setData($data); $excel->prepareExcel(); exit; break; case "rpt_incomingwithdrawal": if ($res = $db_ext->rst($_SESSION['kr_export_stmt'])) { foreach ($res as $val) { $date = date('M d,Y G:i:s', strtotime($val['date_created'])); $date = Yii::app()->functions->translateDate($date); $date_created = displayDate($val['date_created']); $date_to_process = displayDate($val['date_to_process']); $method = t("Paypal to") . " " . $val['account']; if ($val['payment_method'] == "bank") { $method = t("Bank to") . " " . $val['bank_account_number']; } $data[] = array($val['withdrawal_id'], $val['merchant_name'], $method, normalPrettyPrice($val['amount']), normalPrettyPrice($val['current_balance']), $val['status'], $date_created, $date_to_process); } } $header = array(t("ID"), t("Merchant Name"), t("Payment Method"), t("Amount"), t("From Balance"), t("Status"), t("Date Of Request"), t("Date to process")); $filename = $this->data['rpt'] . '-' . date('c') . '.csv'; $excel = new ExcelFormat($filename); $excel->addHeaders($header); $excel->setData($data); $excel->prepareExcel(); exit; break; default: break; } } else { echo Yii::t("default", "Error: Something went wrong. please try again."); } }
<?php foreach ($res as $val) { ?> <li> <div> <a class="add-to-cart" href="javascript:;" data-id="<?php echo $val['order_id']; ?> " > <i class="fa fa-calendar-o"></i> <?php echo ucwords($val['merchant_name']); ?> - <?php echo prettyDate($val['date_created']); ?> </a> <a href="javascript:;" class="view-receipt" data-id="<?php echo $val['order_id']; ?> " > <i class="fa fa-file-text-o"></i> <?php echo Yii::t("default", "View Receipt"); ?> </a> <span><i class="fa fa-square-o"></i> <?php echo ucwords($val['status']); ?> </span>
?> <?php if ($data['trans_type'] == "delivery") { ?> <?php if (isset($_SESSION['kr_delivery_options']['delivery_date'])) { ?> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Delivery Date"); ?> :</div> <div class="value"><?php $deliver_date = prettyDate($_SESSION['kr_delivery_options']['delivery_date']); echo Yii::app()->functions->translateDate($deliver_date); ?> </div> <div class="clear"></div> </div> <?php $print[] = array('label' => Yii::t("default", "Delivery Date"), 'value' => $deliver_date); ?> <?php } ?> <?php if (isset($_SESSION['kr_delivery_options']['delivery_time'])) { ?>
public function merchantCommission() { $and = ''; $and_date = ''; if (isset($this->data['start_date']) && isset($this->data['end_date'])) { if (!empty($this->data['start_date']) && !empty($this->data['end_date'])) { $and = " AND a.date_created BETWEEN '" . $this->data['start_date'] . " 00:00:00' AND \n\t \t\t '" . $this->data['end_date'] . " 23:59:00'\n\t \t\t "; $and_date = " AND date_created BETWEEN '" . $this->data['start_date'] . " 00:00:00' AND \n\t \t\t '" . $this->data['end_date'] . " 23:59:00'\n\t \t\t "; } } if ($this->data['query'] == "last15") { $start_date = date("Y-m-d", strtotime('-15 days')); $end_date = date("Y-m-d"); $and = " AND a.date_created BETWEEN '" . $start_date . " 00:00:00' AND \n\t\t \t\t '" . $end_date . " 23:59:00'\n\t\t \t\t "; $and_date = " AND date_created BETWEEN '" . $start_date . " 00:00:00' AND \n\t\t \t\t '" . $end_date . " 23:59:00'\n\t\t \t\t "; } elseif ($this->data['query'] == "last30") { $start_date = date("Y-m-d", strtotime('-30 days')); $end_date = date("Y-m-d"); $and = " AND a.date_created BETWEEN '" . $start_date . " 00:00:00' AND \n\t\t \t\t '" . $end_date . " 23:59:00'\n\t\t \t\t "; $and_date = " AND date_created BETWEEN '" . $start_date . " 00:00:00' AND \n\t\t \t\t '" . $end_date . " 23:59:00'\n\t\t \t\t "; } elseif ($this->data['query'] == "month") { $query_date = $this->data['query_date']; $start_date = date('Y-m-01', strtotime($query_date)); $end_date = date('Y-m-t', strtotime($query_date)); $and = " AND a.date_created BETWEEN '" . $start_date . " 00:00:00' AND \n\t\t \t\t '" . $end_date . " 23:59:00'\n\t\t \t\t "; $and_date = " AND date_created BETWEEN '" . $start_date . " 00:00:00' AND \n\t\t \t\t '" . $end_date . " 23:59:00'\n\t\t \t\t "; } $order_status_id = ''; $or = ''; if (isset($this->data['stats_id'])) { if (is_array($this->data['stats_id']) && count($this->data['stats_id']) >= 1) { foreach ($this->data['stats_id'] as $stats_id) { $order_status_id .= "'{$stats_id}',"; } if (!empty($order_status_id)) { $order_status_id = substr($order_status_id, 0, -1); } } } if (!empty($order_status_id)) { $where = " WHERE a.status IN ({$order_status_id})"; $and_date .= " AND status IN ({$order_status_id})"; } else { $where = " WHERE a.status NOT IN ('" . initialStatus() . "')"; $and_date .= "AND status NOT IN ('" . initialStatus() . "')"; } if ($this->data['merchant_id'] >= 1) { $and .= " AND a.merchant_id='" . $this->data['merchant_id'] . "' "; } if (isset($this->data['payment_type'])) { if ($this->data['payment_type'] == 2) { // cash $and_date .= " AND payment_type IN ('cod','pyr','ccr') "; $and .= " AND payment_type IN ('cod','pyr','ccr') "; } else { if ($this->data['payment_type'] == 3) { // card $and_date .= " AND payment_type NOT IN ('cod','pyr','ccr') "; $and .= " AND payment_type NOT IN ('cod','pyr','ccr') "; } } } $DbExt = new DbExt(); $stmt = "SELECT a.*,b.is_commission,\n\t \t(\n\t \tselect restaurant_name \n\t \tfrom\n\t \t{{merchant}}\n\t \twhere merchant_id = a.merchant_id \n\t \t) as merchant_name,\n\t \t\n\t \t(\n\t \tselect sum(total_w_tax) \n\t \tfrom\n\t \t{{order}}\n\t \twhere merchant_id = a.merchant_id \t \n\t \t{$and_date} \t\t \n\t \t) as total_order,\n\t \t\n\t \t(\n\t \tselect sum(total_commission)\n\t \tfrom\n\t \t{{order}}\n\t \twhere merchant_id = a.merchant_id \t \n\t \t{$and_date} \t\t \n\t \t) as total_commission\n\t \t\n\t \tFROM\n\t \t{{order}} a\t \t \n\t \tleft join {{merchant}} b\n\t\t\tOn\n\t\t\ta.merchant_id=b.merchant_id\n\t \t \t \n\t \t{$where}\n\t \t{$and}\t \t\n\t \tAND b.is_commission='2'\n\t \t\n\t \tGROUP BY merchant_id\n\t \tORDER BY order_id DESC\n\t \tLIMIT 0,2000\n\t \t"; if (isset($_GET['debug'])) { dump($this->data); dump($stmt); } $_SESSION['kr_export_stmt'] = $stmt; if ($res = $DbExt->rst($stmt)) { if (isset($_GET['debug'])) { dump($res); } $total_commission = 0; foreach ($res as $val) { $link = websiteUrl() . "/admin/merchantcommissiondetails"; $link .= "/mtid/" . $val['merchant_id']; $link .= "/where/" . $where; $link .= "/and/" . $and; /*$action="<a class=\"view-details\" data-id=\"$val[merchant_id]\" href=\"javascript:;\" data-where=\"$where\" data-and=\"$and\">". Yii::t("default","Details"). "</a>";*/ $total_commission += $val['total_commission']; $action = "<a href=\"{$link}\" >" . Yii::t("default", "Details") . "</a>"; $date = prettyDate($val['date_created'], true); $date = Yii::app()->functions->translateDate($date); $feed_data['aaData'][] = array($val['merchant_id'], $val['merchant_name'], displayPrice(adminCurrencySymbol(), normalPrettyPrice($val['total_order'])), displayPrice(adminCurrencySymbol(), normalPrettyPrice($val['total_commission'])), $action); } $feed_data['total_commission'] = displayPrice(adminCurrencySymbol(), normalPrettyPrice($total_commission)); $this->otableOutput($feed_data); } $this->otableNodata(); }