public function getDetail($id)
 {
     $_id = new MongoId($id);
     $history = History::where('historyObject._id', $_id)->where('historyObjectType', 'asset')->orderBy('historyTimestamp', 'desc')->orderBy('historySequence', 'desc')->get();
     $diffs = array();
     foreach ($history as $h) {
         $h->date = date('Y-m-d H:i:s', $h->historyTimestamp->sec);
         $diffs[$h->date][$h->historySequence] = $h->historyObject;
     }
     $history = History::where('historyObject._id', $_id)->where('historyObjectType', 'asset')->where('historySequence', 0)->orderBy('historyTimestamp', 'desc')->get();
     $tab_data = array();
     foreach ($history as $h) {
         $apv_status = Assets::getApprovalStatus($h->approvalTicket);
         if ($apv_status == 'pending') {
             $bt_apv = '<span class="btn btn-info change-approval ' . $h->approvalTicket . '" data-id="' . $h->approvalTicket . '" >' . $apv_status . '</span>';
         } else {
             if ($apv_status == 'verified') {
                 $bt_apv = '<span class="btn btn-success" >' . $apv_status . '</span>';
             } else {
                 $bt_apv = '';
             }
         }
         $d = date('Y-m-d H:i:s', $h->historyTimestamp->sec);
         $tab_data[] = array($d, $h->historyAction, $h->historyObject['itemDescription'], $h->historyAction == 'new' ? 'NA' : $this->objdiff($diffs[$d]), $bt_apv);
     }
     $header = array('Modified', 'Event', 'Name', 'Diff', 'Approval');
     $attr = array('class' => 'table', 'id' => 'transTab', 'style' => 'width:100%;', 'border' => '0');
     $t = new HtmlTable($tab_data, $attr, $header);
     $itemtable = $t->build();
     $asset = Asset::find($id);
     Breadcrumbs::addCrumb('Ad Assets', URL::to(strtolower($this->controller_name)));
     Breadcrumbs::addCrumb('Detail', URL::to(strtolower($this->controller_name) . '/detail/' . $asset->_id));
     Breadcrumbs::addCrumb($asset->SKU, URL::to(strtolower($this->controller_name)));
     return View::make('history.table')->with('a', $asset)->with('title', 'Asset Detail ' . $asset->itemDescription)->with('table', $itemtable);
 }
Exemple #2
0
 protected function build(PageBody &$body, SubMenu &$submenu)
 {
     $this->pageName = "Event List";
     $submenu->addLink("Add new Event", "#");
     $submenu->addLink("Show Event", "#");
     $submenu->addLink("Edit", "#");
     $submenu->addLink("Delete", "#");
     // show a list of events on a table
     $events = Database::get("Event");
     if (isset($events)) {
         $table = new HtmlTable();
         $table->setHead(["#", "Name", "Info"]);
         foreach ($events as $id => $event) {
             $table->addRow([$id, '<a href="?page=Event&event=' . $id . '">' . $event->name . '</a>', $event->address]);
         }
         $body->addToCenter($table);
     } else {
         $body->addToCenter(new Message("There is no event to show", Message::INFO));
     }
 }
Exemple #3
0
function Generate_Picker($channel)
{
    $html = "<div class=filter>\n";
    $html .= "  <b>Filter:</b><br>\n";
    $html .= "  <form>\n";
    $StartDate = date("m/d/Y");
    if (isset($_GET["start"])) {
        $StartDate = $_GET["start"];
    }
    $FinishDate = date("m/d/Y");
    if (isset($_GET["end"])) {
        $FinishDate = $_GET["end"];
    }
    $picker = new HtmlTable();
    $picker->InsertRow(array("Start date", "<input id='datepicker' value=\"{$StartDate}\" name='start'>"));
    $picker->BorderSize = 0;
    $picker->InsertRow(array("End date", "<input id='datepicker2' value=\"{$FinishDate}\" name='end'>"));
    $show = "";
    if (isset($_GET['data'])) {
        $show = "checked=on ";
    }
    $checked = "";
    if (isset($_GET['wiki'])) {
        $checked = "checked=on ";
    }
    $picker->InsertRow(array("", "<label><input " . $checked . "type='checkbox' value='true' name='wiki'>Convert to wiki text</label>"));
    $picker->InsertRow(array("", "<label><input " . $show . "type='checkbox' value='true' name='data'>Show part / join / quit / kick / nick</label>"));
    $html .= HtmlPage::IndentText($picker->ToHtml(), 4);
    $html .= "<input type='submit' value='Display'><input type='hidden' name='display' value=\"{$channel}\"></form>\n</div>\n";
    return $html;
}
Exemple #4
0
 /**
  * Add cell by specifying column key and value
  * 
  * @param string $columnKey
  * @param string|HtmlElement $value
  * @return HtmlElement
  * @throws Exception
  */
 public function addCell($columnKey, $value = null)
 {
     if ($this->existsCell($columnKey)) {
         throw new Exception('cell "' . $columnKey . '" already exists.');
     }
     $cell = new HtmlElement($this->_cellTagName);
     $cell->setIsReturnInner(false);
     $attrs = $this->_parentTable->getColumnAttributes($columnKey);
     if ($attrs) {
         $cell->setAttributes($attrs);
     }
     if ($value !== null) {
         $nodes = $value;
         if (!is_array($value)) {
             $nodes = array($value);
         }
         $cell->addNodes($nodes);
     }
     $this->_addCellElement($columnKey, $cell);
     return $cell;
 }
 public function getPrint($session_id)
 {
     $trx = Transaction::where('sessionId', $session_id)->get()->toArray();
     $pay = Payment::where('sessionId', $session_id)->get()->toArray();
     $tab = array();
     foreach ($trx as $t) {
         $tab[$t['SKU']]['description'] = $t['productDetail']['itemDescription'];
         $tab[$t['SKU']]['qty'] = isset($tab[$t['SKU']]['qty']) ? $tab[$t['SKU']]['qty'] + 1 : 1;
         $tab[$t['SKU']]['tagprice'] = $t['productDetail']['priceRegular'];
         $tab[$t['SKU']]['total'] = isset($tab[$t['SKU']]['total']) ? $tab[$t['SKU']]['total'] + $t['productDetail']['priceRegular'] : $t['productDetail']['priceRegular'];
     }
     $tab_data = array();
     $gt = 0;
     foreach ($tab as $k => $v) {
         $tab_data[] = array(array('value' => $v['description'], 'attr' => 'class="left"'), array('value' => $v['qty'], 'attr' => 'class="center"'), array('value' => Ks::idr($v['tagprice']), 'attr' => 'class="right"'), array('value' => Ks::idr($v['total']), 'attr' => 'class="right"'));
         $gt += $v['tagprice'];
     }
     $tab_data[] = array('', '', '', Ks::idr($gt));
     $header = array('things to buy', 'unit', 'tagprice', array('value' => 'price to pay', 'attr' => 'style="text-align:right"'));
     $attr = array('class' => 'table', 'id' => 'transTab', 'style' => 'width:100%;', 'border' => '0');
     $t = new HtmlTable($tab_data, $attr, $header);
     $tr_tab = $t->build();
     $viewmodel = Template::where('type', 'invoice')->where('status', 'active')->first();
     return DbView::make($viewmodel)->field('body')->with('transtab', $tr_tab)->with('trx', $trx)->with('pay', $pay);
 }
Exemple #6
0
             admStrIsValidFileName($file, true);
             $existingBackupFiles[] = $file;
         } catch (AdmException $e) {
             $temp = 1;
         }
     }
     closedir($handle);
 }
 // sort files (filename/date)
 sort($existingBackupFiles);
 // get module menu
 $backupMenu = $page->getMenu();
 // show link to create new backup
 $backupMenu->addItem('admMenuItemNewBackup', $g_root_path . '/adm_program/modules/backup/backup.php?mode=create_backup', $gL10n->get('BAC_START_BACKUP'), 'database_save.png');
 // Define table
 $table = new HtmlTable('tableList', $page, true);
 $table->setMessageIfNoRowsFound('BAC_NO_BACKUP_FILE_EXISTS');
 // create array with all column heading values
 $columnHeading = array($gL10n->get('BAC_BACKUP_FILE'), $gL10n->get('BAC_CREATION_DATE'), $gL10n->get('SYS_SIZE'), $gL10n->get('SYS_DELETE'));
 $table->setColumnAlignByArray(array('left', 'left', 'right', 'center'));
 $table->addRowHeadingByArray($columnHeading);
 $backup_size_sum = 0;
 foreach ($existingBackupFiles as $key => $old_backup_file) {
     // create array with all column values
     $columnValues = array('<a href="' . $g_root_path . '/adm_program/modules/backup/backup_file_function.php?job=get_file&amp;filename=' . $old_backup_file . '"><img
             src="' . THEME_PATH . '/icons/page_white_compressed.png" alt="' . $old_backup_file . '" title="' . $old_backup_file . '" />' . $old_backup_file . '</a>', date($gPreferences['system_date'] . ' ' . $gPreferences['system_time'], filemtime($backupabsolutepath . $old_backup_file)), round(filesize($backupabsolutepath . $old_backup_file) / 1024) . ' kB', '<a class="admidio-icon-link" data-toggle="modal" data-target="#admidio_modal"
             href="' . $g_root_path . '/adm_program/system/popup_message.php?type=bac&amp;element_id=row_file_' . $key . '&amp;name=' . urlencode($old_backup_file) . '&amp;database_id=' . $old_backup_file . '"><img
             src="' . THEME_PATH . '/icons/delete.png" alt="' . $gL10n->get('SYS_DELETE') . '" title="' . $gL10n->get('SYS_DELETE') . '" /></a>');
     $table->addRowByArray($columnValues, 'row_file_' . $key);
     $backup_size_sum = $backup_size_sum + round(filesize($backupabsolutepath . $old_backup_file) / 1024);
 }
Exemple #7
0
// create html page object
$page = new HtmlPage($headline);
$page->addJavascript('
        $(".admidio-icon-link-popup").colorbox({rel:\'nofollow\', scrolling:false, onComplete:function() { $("#admButtonNo").focus(); }});
        ', true);
// get module menu
$itemsAdministrationMenu = $page->getMenu();
$itemsAdministrationMenu->addItem('menu_item_create_user', $g_root_path . '/adm_program/modules/inventory/item_new.php', $gL10n->get('INV_CREATE_ITEM'), 'add.png');
// show link to room management
$itemsAdministrationMenu->addItem('menu_item_manage_rooms', $g_root_path . '/adm_program/modules/rooms/rooms.php', $gL10n->get('DAT_SWITCH_TO_ROOM_ADMINISTRATION'), 'home.png');
if ($gCurrentUser->isWebmaster()) {
    // show link to maintain profile fields
    $itemsAdministrationMenu->addItem('menu_item_maintain_inventory_fields', $g_root_path . '/adm_program/modules/inventory/fields.php', $gL10n->get('PRO_MAINTAIN_ITEM_FIELDS'), 'application_form_edit.png');
}
// Create table object
$itemsTable = new HtmlTable('tbl_invent', $page, true, true, 'table table-condensed');
// create array with all column heading values
$columnHeading = array($gL10n->get('SYS_ABR_NO'), $gL10n->get('SYS_NAME'), $gL10n->get('SYS_ROOM'), $gL10n->get('MEM_UPDATED_ON'), '&nbsp;');
$itemsTable->setColumnAlignByArray(array('left', 'left', 'left', 'left', 'right'));
$itemsTable->disableDatatablesColumnsSort(5);
$itemsTable->addRowHeadingByArray($columnHeading);
$itemsTable->setDatatablesRowsPerPage($gPreferences['members_users_per_page']);
$itemsTable->setMessageIfNoRowsFound('SYS_NO_ENTRIES');
$irow = 1;
// count for line in table
while ($row = $mglStatement->fetch()) {
    $timestampChange = new DateTimeExtended($row['timestamp'], 'Y-m-d H:i:s');
    $room = new TableRooms($gDb, $row['room_id']);
    $roomLink = $g_root_path . '/adm_program/system/msg_window.php?message_id=room_detail&amp;message_title=DAT_ROOM_INFORMATIONS&amp;message_var1=' . $row['room_id'] . '&amp;inline=true';
    // create array with all column values
    $columnValues = array($irow, '<a href="' . $g_root_path . '/adm_program/modules/inventory/item.php?item_id=' . $row['inv_id'] . '">' . $row['item_name'] . '</a>', '<a class="admidio-icon-link-popup" href="' . $roomLink . '">' . $room->getValue('room_name') . '</a>');
 if ($gCurrentUser->editUsers()) {
     $membersAssignmentMenu->addItem('menu_item_create_user', $g_root_path . '/adm_program/modules/members/members_new.php', $gL10n->get('MEM_CREATE_USER'), 'add.png');
 }
 $navbarForm = new HtmlForm('navbar_show_all_users_form', '', $page, array('type' => 'navbar', 'setFocus' => false));
 $sql = 'SELECT rol_id, rol_name, cat_name FROM ' . TBL_ROLES . ', ' . TBL_CATEGORIES . '
          WHERE rol_valid   = 1
            AND rol_visible = 1
            AND rol_cat_id  = cat_id
            AND (  cat_org_id  = ' . $gCurrentOrganization->getValue('org_id') . '
                OR cat_org_id IS NULL )
          ORDER BY cat_sequence, rol_name';
 $navbarForm->addSelectBoxFromSql('filter_rol_id', $gL10n->get('SYS_ROLE'), $gDb, $sql, array('defaultValue' => $getFilterRoleId, 'firstEntry' => $gL10n->get('SYS_ALL')));
 $navbarForm->addCheckbox('mem_show_all', $gL10n->get('MEM_SHOW_ALL_USERS'), 0, array('helpTextIdLabel' => 'MEM_SHOW_USERS_DESC'));
 $membersAssignmentMenu->addForm($navbarForm->show(false));
 // create table object
 $table = new HtmlTable('tbl_assign_role_membership', $page, true, true, 'table table-condensed');
 $table->setMessageIfNoRowsFound('SYS_NO_ENTRIES_FOUND');
 // create column header to assign role leaders
 $htmlLeaderColumn = $gL10n->get('SYS_LEADER');
 // show icon that leaders have no additional rights
 if ($role->getValue('rol_leader_rights') == ROLE_LEADER_NO_RIGHTS) {
     $htmlLeaderColumn .= '<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/info.png"
         alt="' . $gL10n->get('ROL_LEADER_NO_ADDITIONAL_RIGHTS') . '" title="' . $gL10n->get('ROL_LEADER_NO_ADDITIONAL_RIGHTS') . '" />';
 }
 // show icon with edit user right if leader has this right
 if ($role->getValue('rol_leader_rights') == ROLE_LEADER_MEMBERS_EDIT || $role->getValue('rol_leader_rights') == ROLE_LEADER_MEMBERS_ASSIGN_EDIT) {
     $htmlLeaderColumn .= '<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/profile_edit.png"
         alt="' . $gL10n->get('ROL_LEADER_EDIT_MEMBERS') . '" title="' . $gL10n->get('ROL_LEADER_EDIT_MEMBERS') . '" />';
 }
 // show icon with assign role right if leader has this right
 if ($role->getValue('rol_leader_rights') == ROLE_LEADER_MEMBERS_ASSIGN || $role->getValue('rol_leader_rights') == ROLE_LEADER_MEMBERS_ASSIGN_EDIT) {
 public function getIndex()
 {
     $this->title = 'Manifest Pengiriman Harian - Retur';
     $this->place_action = 'none';
     $this->show_select = false;
     $this->can_add = false;
     $this->is_report = true;
     Breadcrumbs::addCrumb('Manifest', URL::to(strtolower($this->controller_name)));
     $this->additional_filter = View::make(strtolower($this->controller_name) . '.addfilter')->with('submit_url', 'manifest')->render();
     $db = Config::get('lundin.main_db');
     $company = Input::get('acc-company');
     //device=&courier=&logistic=&date-from=2015-10-24
     $period_from = Input::get('date-from');
     $period_to = Input::get('date-to');
     $device = Input::get('device');
     $courier = Input::get('courier');
     $logistic = Input::get('logistic');
     $position = Input::get('position');
     $trip = Input::get('trip');
     $status = Input::get('status');
     $courierstatus = Input::get('courier-status');
     if ($period_to == '' || is_null($period_to)) {
         $period_to = date('Y0m', time());
     }
     $this->def_order_by = 'TRANS_DATETIME';
     $this->def_order_dir = 'DESC';
     $this->place_action = 'none';
     $this->show_select = false;
     /* Start custom queries */
     $model = $this->model;
     if ($status == '' || is_null($status)) {
         $status = Config::get('jayon.manifest_default_status');
         $status[] = Config::get('jayon.trans_status_mobile_return');
     } else {
         $status = explode(',', $status);
     }
     if (empty($status)) {
         $exstatus = Config::get('jayon.manifest_default_excl_status');
         if (!empty($exstatus)) {
             $model = $model->whereNotIn('status', $exstatus);
         }
     } else {
         $model = $model->whereIn('status', $status);
     }
     if ($courierstatus == '' || is_null($courierstatus)) {
         $courierstatus = Config::get('jayon.manifest_default_courier_status');
     } else {
         $courierstatus = explode(',', $courierstatus);
     }
     if (empty($courierstatus)) {
         $excrstatus = Config::get('jayon.manifest_default_excl_courier_status');
         if (!empty($excrstatus)) {
             $model = $model->whereNotIn('courier_status', $excrstatus);
         }
     } else {
         $model = $model->whereIn('courier_status', $courierstatus);
     }
     if ($period_from == '' || is_null($period_from)) {
         $def_from = date('Y-m-d', time());
         $model = $model->where('pick_up_date', '=', new MongoDate(strtotime($def_from)));
     } else {
         $model = $model->where('pick_up_date', '=', new MongoDate(strtotime($period_from)));
     }
     if ($device == '' || is_null($device)) {
     } else {
         $model = $model->where('device_key', '=', $device);
     }
     if ($courier == '' || is_null($courier)) {
     } else {
         $model = $model->where('courier_id', '=', $courier);
     }
     if ($logistic == '' || is_null($logistic)) {
     } else {
         $model = $model->where('logistic', '=', $logistic);
     }
     if ($position == '' || is_null($position)) {
     } else {
         $model = $model->where('position', '=', $position);
     }
     if ($trip == '' || is_null($trip)) {
     } else {
         $model = $model->where(function ($t) use($trip) {
             $t->where('trip', '=', intval($trip))->orWhere('trip', '=', strval($trip));
         });
     }
     $actualresult = $model->get();
     $tattrs = array('width' => '100%', 'class' => 'table table-bordered table-striped');
     $thead = array();
     //No. Kota Type Status  KEPADA  ALAMAT  Phone   Order ID Fulfillment ID Jumlah Box PENERIMA PAKET
     //TANDA TANGAN    NAMA
     $thead[] = array(array('value' => '#', 'attr' => 'rowspan=2'), array('value' => 'Delivery Date', 'attr' => 'rowspan="2" '), array('value' => 'Kota', 'attr' => 'rowspan="2" class="center"'), array('value' => 'Type', 'attr' => 'rowspan="2" '), array('value' => 'Logistic', 'attr' => 'rowspan="2" '), array('value' => 'Device', 'attr' => 'rowspan="2" '), array('value' => 'Status', 'attr' => 'rowspan="2" '), array('value' => 'KEPADA / CUSTOMER', 'attr' => 'rowspan="2" '), array('value' => 'ALAMAT', 'attr' => 'rowspan="2" style="min-width:200px;"'), array('value' => 'Telepon', 'attr' => 'rowspan="2" '), array('value' => 'Order ID', 'attr' => 'rowspan="2" '), array('value' => 'Fulfillment ID', 'attr' => 'rowspan="2" '), array('value' => 'Nilai COD', 'attr' => 'rowspan="2" '), array('value' => 'Jumlah Paket', 'attr' => 'rowspan="2" '), array('value' => 'PENERIMA', 'attr' => 'colspan="4"'));
     $thead[] = array(array('value' => 'JUMLAH DITERIMA DI HUB', 'attr' => ''), array('value' => 'TANGGAL / JAM TERIMA', 'attr' => ''), array('value' => 'TANDA TANGAN', 'attr' => ''), array('value' => 'NAMA', 'attr' => 'class="bold center" style="width:50px" '));
     $seq = 1;
     $tabdata = array();
     foreach ($actualresult as $m) {
         if ($m->pick_up_date instanceof MongoDate) {
             $pick_up_date = date('Y-m-d H:i:s', $m->pick_up_date->sec);
             $dattr = '';
         } else {
             $pick_up_date = $m->pick_up_date;
             $dattr = 'class="red"';
         }
         $tabdata[] = array(array('value' => $seq, 'attr' => ''), array('value' => $pick_up_date, 'attr' => $dattr), array('value' => $m->consignee_olshop_city, 'attr' => ''), array('value' => $m->delivery_type, 'attr' => ''), array('value' => $m->logistic, 'attr' => ''), array('value' => $m->device_name, 'attr' => ''), array('value' => Prefs::translatestatus($m->status, 'delivery'), 'attr' => ''), array('value' => $m->consignee_olshop_name, 'attr' => ''), array('value' => $m->consignee_olshop_addr, 'attr' => ''), array('value' => $m->consignee_olshop_phone, 'attr' => ''), array('value' => $m->no_sales_order, 'attr' => ''), array('value' => $m->consignee_olshop_orderid, 'attr' => ''), array('value' => Ks::idr($m->cod), 'attr' => 'style="text-align:right;"'), array('value' => $m->number_of_package, 'attr' => ''), array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''));
         $seq++;
     }
     $mtable = new HtmlTable($tabdata, $tattrs, $thead);
     $tables[] = $mtable->build();
     $this->table_raw = $tables;
     if ($this->print == true || $this->pdf == true || $this->xls == true) {
         return $tables;
     } else {
         return parent::reportPageGenerator();
     }
 }
}
// link to write new PM
if ($gPreferences['enable_pm_module'] == 1) {
    $EmailMenu->addItem('admMenuItemNewPm', $g_root_path . '/adm_program/modules/messages/messages_write.php?msg_type=PM', $gL10n->get('PMS_SEND_PM'), '/pm.png');
}
// link to Chat
// @ptabaden: hide chat!
// if ($gPreferences['enable_chat_module'] == 1)
// {
//    $EmailMenu->addItem('admMenuItemNewChat', $g_root_path.'/adm_program/modules/messages/messages_chat.php', $gL10n->get('MSG_CHAT'), '/chat.png');
// }
if ($gCurrentUser->isWebmaster()) {
    // @ptabaden: Changed Icon & renamed to menu_item_preferences
    $EmailMenu->addItem('admMenuItemPreferences', $g_root_path . '/adm_program/modules/preferences/preferences.php?show_option=messages', '<i class="fa fa-cog" alt="' . $gL10n->get('SYS_MODULE_PREFERENCES') . '" title="' . $gL10n->get('SYS_MODULE_PREFERENCES') . '"></i><div class="iconDescription">' . $gL10n->get('SYS_MODULE_PREFERENCES') . '</div>', '', 'right');
}
$table = new HtmlTable('adm_lists_table', $page, true, true);
// @ptabaden deleted two cols #possibleError delete one left more?
$table->setColumnAlignByArray(array('left', 'left', 'right'));
// @ptabaden: deleted category row and changed order
// @ptabaden: deleted two cols
$table->addRowHeadingByArray(array($gL10n->get('MSG_OPPOSITE'), $gL10n->get('MAI_SUBJECT'), ''));
$table->disableDatatablesColumnsSort(5);
$key = 0;
$part1 = '<a class="admidio-icon-link" data-toggle="modal" data-target="#admidio_modal" href="' . $g_root_path . '/adm_program/system/popup_message.php?type=msg&amp;element_id=row_message_';
// @ptabaden: Changed Icon
$part2 = '"><i class="fa fa-times" alt="' . $gL10n->get('MSG_REMOVE') . '" title="' . $gL10n->get('MSG_REMOVE') . '" /></a>';
$href = 'href="' . $g_root_path . '/adm_program/modules/messages/messages_write.php?msg_id=';
// open some additonal functions for messages
$modulemessages = new ModuleMessages();
// find all own Email messages
$statement = $modulemessages->msgGetUserEmails($gCurrentUser->getValue('usr_id'));
 public function getIndex()
 {
     $this->title = 'Delivery Time';
     $this->place_action = 'none';
     $this->show_select = false;
     $this->can_add = false;
     $this->is_report = true;
     Breadcrumbs::addCrumb('Manifest', URL::to(strtolower($this->controller_name)));
     $this->additional_filter = View::make('shared.addfilter')->with('submit_url', 'deliverybydate')->render();
     $db = Config::get('lundin.main_db');
     $company = Input::get('acc-company');
     //device=&courier=&logistic=&date-from=2015-10-24
     $period_from = Input::get('date-from');
     $period_to = Input::get('date-to');
     $device = Input::get('device');
     $courier = Input::get('courier');
     $merchant = Input::get('merchant');
     $logistic = Input::get('logistic');
     $status = Input::get('status');
     $courierstatus = Input::get('courier-status');
     if ($period_to == '' || is_null($period_to)) {
         $period_to = date('Y-m-d', time());
     }
     if ($period_from == '' || is_null($period_from)) {
         $period_from = date('Y-m-d', time());
     }
     $this->def_order_by = 'TRANS_DATETIME';
     $this->def_order_dir = 'DESC';
     $this->place_action = 'none';
     $this->show_select = false;
     /* Start custom queries */
     $mtab = Config::get('jayon.assigned_delivery_table');
     $model = $this->model;
     $model = $model->select('assignment_date', 'ordertime', 'deliverytime', 'delivery_note', 'pending_count', 'recipient_name', 'delivery_id', $mtab . '.merchant_id as merchant_id', 'cod_bearer', 'delivery_bearer', 'buyer_name', 'buyerdeliverycity', 'buyerdeliveryzone', 'c.fullname as courier_name', 'd.identifier as device_name', $mtab . '.phone', $mtab . '.mobile1', $mtab . '.mobile2', 'application_id', 'weight', 'merchant_trans_id', 'm.merchantname as merchant_name', 'm.fullname as fullname', 'a.application_name as app_name', 'a.domain as domain ', 'delivery_type', 'shipping_address', 'status', 'pickup_status', 'warehouse_status', 'cod_cost', 'delivery_cost', 'total_price', 'total_tax', 'total_discount', 'box_count')->leftJoin('members as m', Config::get('jayon.incoming_delivery_table') . '.merchant_id', '=', 'm.id')->leftJoin('applications as a', Config::get('jayon.assigned_delivery_table') . '.application_id', '=', 'a.id')->leftJoin('devices as d', Config::get('jayon.assigned_delivery_table') . '.device_id', '=', 'd.id')->leftJoin('couriers as c', Config::get('jayon.assigned_delivery_table') . '.courier_id', '=', 'c.id');
     /*
     $model = $model
         ->where(function($query){
             $query->where('status','=', Config::get('jayon.trans_status_admin_courierassigned') )
                 ->orWhere('status','=', Config::get('jayon.trans_status_mobile_pickedup') )
                 ->orWhere('status','=', Config::get('jayon.trans_status_mobile_enroute') )
                 ->orWhere(function($q){
                         $q->where('status', Config::get('jayon.trans_status_new'))
                             ->where(Config::get('jayon.incoming_delivery_table').'.pending_count', '>', 0);
                 });
     
         });
     */
     if ($status == '' || is_null($status)) {
         $status = Config::get('jayon.devmanifest_default_status');
     } else {
         $status = explode(',', $status);
     }
     if (empty($status)) {
         $exstatus = Config::get('jayon.devmanifest_default_excl_status');
         if (!empty($exstatus)) {
             //$model = $model->whereNotIn('status', $exstatus);
         }
     } else {
         //$model = $model->whereIn('status', $status);
     }
     /*
     if($courierstatus == '' || is_null($courierstatus) ){
         $courierstatus = Config::get('jayon.devmanifest_default_courier_status');
     }else{
         $courierstatus = explode(',', $courierstatus);
     }
     
     if(empty($courierstatus)){
         $excrstatus = Config::get('jayon.devmanifest_default_excl_courier_status');
     
         if(!empty($excrstatus)){
             $model = $model->whereNotIn('courier_status', $excrstatus);
         }
     }else{
         $model = $model->whereIn('courier_status', $courierstatus);
     }
     */
     if ($period_from == '' || is_null($period_from)) {
         $datefrom = date('Y-m-d 00:00:00', strtotime($period_from));
         $dateto = date('Y-m-d 23:59:59', strtotime($period_to));
     } else {
         $datefrom = date('Y-m-d 00:00:00', strtotime($period_from));
         $dateto = date('Y-m-d 23:59:59', strtotime($period_to));
         $model = $model->where(function ($q) use($datefrom, $dateto) {
             $q->whereBetween('assignment_date', array($datefrom, $dateto));
         });
     }
     if ($merchant == '' || is_null($merchant)) {
     } else {
         $model = $model->where(Config::get('jayon.incoming_delivery_table') . '.merchant_id', '=', $merchant);
     }
     if ($device == '' || is_null($device)) {
     } else {
         $model = $model->where('device_id', '=', $device);
     }
     if ($courier == '' || is_null($courier)) {
     } else {
         $model = $model->where('courier_id', '=', $courier);
     }
     if ($logistic == '' || is_null($logistic)) {
     } else {
         $model = $model->where('logistic', '=', $logistic);
     }
     $model = $model->where(function ($qr) {
         $qr->where('status', Config::get('jayon.trans_status_admin_courierassigned'))->orWhere('status', Config::get('jayon.trans_status_mobile_pickedup'))->orWhere('status', Config::get('jayon.trans_status_mobile_enroute'))->orWhere(function ($q) {
             $q->where('status', Config::get('jayon.trans_status_new'))->where('pending_count', '>', 0);
         });
     });
     $model->orderBy('device_name', 'asc')->orderBy('buyerdeliverycity', 'asc')->orderBy('buyerdeliveryzone', 'asc')->orderBy('merchant_name', 'asc');
     $actualresult = $model->get();
     $tattrs = array('width' => '100%', 'class' => 'table table-bordered table-striped');
     $bymc = array();
     foreach ($actualresult as $mc) {
         $bymc[$mc->merchant_name][] = $mc;
     }
     //print_r($bymc);
     $bydc = array();
     $tpd = array();
     $bpd = array();
     $wpd = array();
     foreach ($actualresult as $dc) {
         $bydc[$dc->device_name][$dc->buyerdeliverycity][$dc->buyerdeliveryzone][] = $dc;
         if (is_null($dc->actual_weight) || $dc->actual_weight == '') {
             $actual_weight = Prefs::getWeightNominal($dc->weight, $dc->application_id);
         } else {
             $actual_weight = $dc->actual_weight;
         }
         //print $dc->weight."\r\n";
         //print $dc->application_id."\r\n";
         //print $actual_weight."\r\n";
         if (isset($tpd[$dc->device_name])) {
             $tpd[$dc->device_name] += 1;
             $bpd[$dc->device_name] += $dc->box_count;
             $wpd[$dc->device_name] += $actual_weight;
         } else {
             $tpd[$dc->device_name] = 1;
             $bpd[$dc->device_name] = $dc->box_count;
             $wpd[$dc->device_name] = $actual_weight;
         }
     }
     $dtotal = array();
     $btotal = array();
     $wtotal = array();
     foreach ($tpd as $dk => $dv) {
         $dtotal[] = $dv;
     }
     foreach ($bpd as $dk => $dv) {
         $btotal[] = $dv;
     }
     foreach ($wpd as $dk => $dv) {
         $wtotal[] = $dv;
     }
     if (count($dtotal) > 0) {
         $dmax = max($dtotal);
     } else {
         $dmax = 1;
     }
     if (count($btotal) > 0) {
         $bmax = max($btotal);
     } else {
         $bmax = 1;
     }
     if (count($wtotal) > 0) {
         $wmax = max($wtotal);
     } else {
         $wmax = 1;
     }
     $headvar1 = array(array('value' => 'No.', 'attr' => ''), array('value' => 'Device', 'attr' => ''), array('value' => 'Total per Device', 'attr' => ''), array('value' => 'Jumlah Box', 'attr' => ''), array('value' => 'Berat', 'attr' => ''), array('value' => 'Kota', 'attr' => ''), array('value' => 'Kecamatan', 'attr' => ''), array('value' => 'Total', 'attr' => ''));
     $headvar2 = array(array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''));
     foreach (array_keys($bymc) as $mctitle) {
         $headvar1[] = array('value' => $mctitle, 'attr' => 'colspan="3" class="vtext" style="min-height:100px;"');
         $headvar2[] = array('value' => 'COD', 'attr' => '');
         $headvar2[] = array('value' => 'DO', 'attr' => '');
         $headvar2[] = array('value' => 'P', 'attr' => '');
     }
     $thead = array();
     $thead[] = $headvar1;
     $thead[] = $headvar2;
     $seq = 1;
     $total_billing = 0;
     $total_delivery = 0;
     $total_cod = 0;
     $d = 0;
     $gt = 0;
     $lastdate = '';
     $courier_name = '';
     $order2assigndays = 0;
     $assign2deliverydays = 0;
     $order2deliverydays = 0;
     $csv_data = array();
     $dids = array();
     foreach ($actualresult as $ar) {
         $dids[] = $ar->delivery_id;
     }
     /*
     $details = Deliverylog::whereIn('delivery_id',$dids)
     
                     ->where(function($q){
                         $q->where('status',Config::get('jayon.trans_status_mobile_delivered'))
                             ->orWhere('status',Config::get('jayon.trans_status_admin_courierassigned'))
                             ->orWhere('status',Config::get('jayon.trans_status_new'))
                             ->orWhere('status',Config::get('jayon.trans_status_rescheduled'))
                             ->orWhere('status',Config::get('jayon.trans_status_mobile_return'));
                     })
     
                     ->orderBy('timestamp','desc')
                     ->get()->toArray();
     
     $dlist = array();
     foreach ($details as $dt) {
         $dlist[$dt['delivery_id']][] = $dt;
     }
     */
     //print_r($dlist);
     $tabdata = array();
     $cntcod = 0;
     $cntccod = 0;
     $cntdo = 0;
     $cntps = 0;
     $cntreturn = 0;
     $box_count = 0;
     $weight_sum = 0;
     //total per columns
     $tcod = 0;
     $tccod = 0;
     $tdo = 0;
     $tps = 0;
     $treturn = 0;
     $tbox = 0;
     $tweight = 0;
     $totalrow = array();
     $mname = '';
     $cd = '';
     foreach ($bydc as $d => $c) {
         foreach ($c as $ct => $zn) {
             foreach ($zn as $z => $o) {
                 if ($d == $cd) {
                     $currddev = '';
                     $currdtotal = '';
                     $box_count = '';
                     $weight_sum = '';
                 } else {
                     $currddev = $d;
                     $currdtotal = $tpd[$d];
                     $box_count = $bpd[$d];
                     $weight_sum = $wpd[$d];
                 }
                 $tbox += $box_count;
                 $tweight += $weight_sum;
                 $cd = $d;
                 $row = array(array('value' => $seq, 'attr' => ''), array('value' => $currddev, 'attr' => ''));
                 $maxattr = $dmax == $currdtotal ? 'style="background-color:red;"' : '';
                 $row[] = array('value' => $currdtotal, 'attr' => $maxattr);
                 $maxattr = $bmax == $box_count ? 'style="background-color:red;"' : '';
                 $row[] = array('value' => $box_count, 'attr' => $maxattr);
                 $maxattr = $wmax == $weight_sum ? 'style="background-color:red;"' : '';
                 $row[] = array('value' => $weight_sum, 'attr' => $maxattr);
                 $row[] = array('value' => $ct, 'attr' => '');
                 $row[] = array('value' => $z, 'attr' => '');
                 $row[] = array('value' => count($o), 'attr' => '');
                 if (isset($bydc[$d][$ct][$z])) {
                     $mv = $bydc[$d][$ct][$z];
                     foreach ($bymc as $mcx => $mcv) {
                         $cod = 0;
                         $do = 0;
                         $p = 0;
                         foreach ($mv as $mo) {
                             //print $mo->merchant_name.' '.$mcx."/r/n";
                             if ($mo->merchant_name == $mcx) {
                                 if ($mo->delivery_type == 'COD' || $mo->delivery_type == 'CCOD') {
                                     $cod++;
                                 }
                                 if ($mo->delivery_type == 'Delivery Only' || $mo->delivery_type == 'DO') {
                                     $do++;
                                 }
                                 if ($mo->status == 'pending') {
                                     $p++;
                                 }
                             }
                         }
                         $row[] = array('value' => $cod, 'attr' => '');
                         $row[] = array('value' => $do, 'attr' => '');
                         $row[] = array('value' => $p, 'attr' => '');
                     }
                 }
                 $tabdata[] = $row;
                 $seq++;
             }
         }
     }
     $totalrow = array(array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''), array('value' => $tbox, 'attr' => ''), array('value' => $tweight, 'attr' => ''), array('value' => '', 'attr' => ''));
     $coloffset = 6;
     $colc = 0;
     foreach ($tabdata as $td) {
         //print_r($td);
         for ($ci = 0; $ci < count($td) - $coloffset; $ci++) {
             if (isset($totalrow[$coloffset + $ci])) {
                 $totalrow[$coloffset + $ci] += $td[$coloffset + $ci]['value'];
             } else {
                 $totalrow[$coloffset + $ci] = $td[$coloffset + $ci]['value'];
             }
         }
     }
     array_unshift($tabdata, $totalrow);
     $avgdata = array(array('value' => 'Rata-rata<br />( dlm satuan hari )', 'attr' => 'colspan="6"'), array('value' => number_format($assign2deliverydays / $seq, 2, ',', '.'), 'attr' => 'style="font-size:18px;font-weight:bold;"'), array('value' => '', 'attr' => 'colspan="7"'));
     //array_unshift($tabdata, $avgdata);
     //array_push($tabdata, $avgdata);
     $mtable = new HtmlTable($tabdata, $tattrs, $thead);
     $tables[] = $mtable->build();
     $this->table_raw = $tables;
     $report_header_data = array('cod' => $cntcod, 'ccod' => $cntccod, 'do' => $cntdo, 'ps' => $cntps, 'return' => $cntreturn, 'avg' => number_format($assign2deliverydays / $seq, 2, ',', '.'));
     if ($this->print == true || $this->pdf == true) {
         return array('tables' => $tables, 'report_header_data' => $report_header_data);
     } else {
         return parent::reportPageGenerator();
     }
 }
Exemple #12
0
 public function __construct($attr)
 {
     parent::__construct($attr);
     $this->css_class = 'domstor_table';
     if ($this->in_region) {
         $this->addCssClass('region');
     }
     $code_field = new Domstor_List_Field_Code(array('name' => 'code', 'title' => 'Код', 'css_class' => 'domstor_code', 'position' => 0, 'object_href' => $this->object_href, 'id_placeholder' => $this->id_placeholder, 'sort_name' => 'sort-code'));
     $type_field = new HtmlTableField(array('name' => 'type', 'title' => 'Тип', 'css_class' => 'domstor_type', 'position' => 100, 'sort_name' => 'sort-type'));
     $contact_field = new Domstor_List_Field_Contact(array('name' => 'contact_phone', 'title' => 'Контактный телефон', 'css_class' => 'domstor_contact', 'position' => 'last', 'position' => 300));
     $note_web_field = new Domstor_List_Field_Comment(array('name' => 'note_web', 'title' => 'Комментарий', 'css_class' => 'domstor_note_web', 'position' => 'last', 'position' => 400));
     $this->addField($code_field)->addField($type_field)->addField($contact_field)->addField($note_web_field);
 }
Exemple #13
0
// link to write new email
if ($gPreferences['enable_mail_module'] == 1) {
    $EmailMenu->addItem('admMenuItemNewEmail', $g_root_path . '/adm_program/modules/messages/messages_write.php', $gL10n->get('MAI_SEND_EMAIL'), '/email.png');
}
// link to write new PM
if ($gPreferences['enable_pm_module'] == 1) {
    $EmailMenu->addItem('admMenuItemNewPm', $g_root_path . '/adm_program/modules/messages/messages_write.php?msg_type=PM', $gL10n->get('PMS_SEND_PM'), '/pm.png');
}
// link to Chat
if ($gPreferences['enable_chat_module'] == 1) {
    $EmailMenu->addItem('admMenuItemNewChat', $g_root_path . '/adm_program/modules/messages/messages_chat.php', $gL10n->get('MSG_CHAT'), '/chat.png');
}
if ($gCurrentUser->isWebmaster()) {
    $EmailMenu->addItem('admMenuItemPreferences', $g_root_path . '/adm_program/modules/preferences/preferences.php?show_option=messages', $gL10n->get('SYS_MODULE_PREFERENCES'), 'options.png', 'right');
}
$table = new HtmlTable('adm_lists_table', $page, true, true);
$table->setColumnAlignByArray(array('left', 'left', 'left', 'left', 'right'));
$table->addRowHeadingByArray(array('<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/email.png" alt="' . $gL10n->get('SYS_CATEGORY') . '" title="' . $gL10n->get('SYS_CATEGORY') . '" />', $gL10n->get('MAI_SUBJECT'), $gL10n->get('MSG_OPPOSITE'), $gL10n->get('SYS_DATE'), ''));
$table->disableDatatablesColumnsSort(5);
$key = 0;
$part1 = '<a class="admidio-icon-link" data-toggle="modal" data-target="#admidio_modal" href="' . $g_root_path . '/adm_program/system/popup_message.php?type=msg&amp;element_id=row_message_';
$part2 = '"><img src="' . THEME_PATH . '/icons/delete.png" alt="' . $gL10n->get('MSG_REMOVE') . '" title="' . $gL10n->get('MSG_REMOVE') . '" /></a>';
$href = 'href="' . $g_root_path . '/adm_program/modules/messages/messages_write.php?msg_id=';
// open some additonal functions for messages
$modulemessages = new ModuleMessages();
// find all own Email messages
$statement = $modulemessages->msgGetUserEmails($gCurrentUser->getValue('usr_id'));
if (isset($result)) {
    while ($row = $statement->fetch()) {
        $ReceiverName = '';
        if (strpos($row['user'], '|') > 0) {
Exemple #14
0
 function render($data = null, $frh = null)
 {
     if (strtolower(get_class($this)) != 'htmltable') {
         $ht = new HtmlTable($data);
         $ht->firstRowHeaders($frh);
         return $ht->render();
     }
     if (!is_null($data)) {
         $this->setData($data);
     }
     if (!is_null($frh)) {
         $this->firstRowHeaders($frh);
     }
     $o = '<table';
     if ($this->border !== false) {
         $o .= ' border="' . $this->border . '"';
     }
     if ($this->padding !== false) {
         $o .= ' cellpadding="' . $this->padding . '"';
     }
     if ($this->spacing !== false) {
         $o .= ' cellspacing="' . $this->spacing . '"';
     }
     if ($this->width !== false) {
         $o .= ' width="' . $this->width . '"';
     }
     if ($this->class !== false) {
         $o .= ' class="' . $this->class . '"';
     }
     if ($this->style !== false) {
         $o .= ' style="' . $this->style . '"';
     }
     if ($this->id !== false) {
         $o .= ' id="' . $this->id . '"';
     }
     $o .= ">\n";
     $first = true;
     foreach ($this->data as $key => $row) {
         $o .= "\t<tr>\n";
         $col = 0;
         foreach ($row as $k => $v) {
             if ($first && $this->frh) {
                 $o .= "\t\t<th";
                 if (isset($this->widths[$col])) {
                     $o .= ' width="' . $this->widths[$col] . '"';
                 }
                 $o .= '>' . $v . "</th>\n";
             } else {
                 $o .= "\t\t<td";
                 if (isset($this->widths[$col])) {
                     $o .= ' width="' . $this->widths[$col] . '"';
                 }
                 $o .= '>' . $v . "</td>\n";
             }
             $col++;
         }
         $o .= "\t</tr>\n";
         $first = false;
     }
     $o .= "</table>\n";
     return $o;
 }
Exemple #15
0
        <h4 class="modal-title">' . $headline . '</h4>
    </div>
    <div class="modal-body">';
} else {
    // create html page object
    $page = new HtmlPage($headline);
    $page->addJavascriptFile($g_root_path . '/adm_program/modules/profile/profile.js');
    $page->addJavascript('var profileJS = new profileJSClass();');
    // add back link to module menu
    $rolesMenu = $page->getMenu();
    $rolesMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png');
}
// show headline of module
$html .= '<form id="roles_assignment_form" action="' . $g_root_path . '/adm_program/modules/profile/roles_save.php?usr_id=' . $getUserId . '&amp;new_user='******'&amp;inline=' . $getInline . '" method="post">';
// Create table
$table = new HtmlTable('role_assignment_table');
$columnHeading = array('&nbsp;', $gL10n->get('ROL_ROLE'), $gL10n->get('SYS_DESCRIPTION'), $gL10n->get('SYS_LEADER'));
$table->addRowHeadingByArray($columnHeading);
$table->setColumnAlignByArray(array('center', 'left', 'left', 'left'));
if ($gCurrentUser->manageRoles()) {
    // Benutzer mit Rollenrechten darf ALLE Rollen zuordnen
    $sql = 'SELECT cat_id, cat_name, rol_name, rol_description, rol_id, rol_visible, rol_leader_rights,
                     mem_rol_id, mem_usr_id, mem_leader
                 FROM ' . TBL_CATEGORIES . ', ' . TBL_ROLES . '
                 LEFT JOIN ' . TBL_MEMBERS . '
                 ON rol_id      = mem_rol_id
                 AND mem_usr_id  = ' . $getUserId . '
                 AND mem_begin  <= \'' . DATE_NOW . '\'
                 AND mem_end     > \'' . DATE_NOW . '\'
             WHERE rol_valid   = 1
                 AND rol_visible = 1
Exemple #16
0
        if ($numberRoles === 1) {
            // link to assign or remove members if you are allowed to do it
            if ($role->allowedToAssignMembers($gCurrentUser)) {
                $listsMenu->addItem('menu_item_assign_members', $g_root_path . '/adm_program/modules/lists/members_assignment.php?rol_id=' . $role->getValue('rol_id'), $gL10n->get('SYS_ASSIGN_MEMBERS'), 'add.png');
            }
        }
        // link to print overlay and exports
        $listsMenu->addItem('menu_item_print_view', '#', $gL10n->get('LST_PRINT_PREVIEW'), 'print.png');
        $form = new HtmlForm('navbar_export_to_form', '', $page, array('type' => 'navbar', 'setFocus' => false));
        $selectBoxEntries = array('' => $gL10n->get('LST_EXPORT_TO') . ' ...', 'csv-ms' => $gL10n->get('LST_MICROSOFT_EXCEL') . ' (' . $gL10n->get('SYS_ISO_8859_1') . ')', 'pdf' => $gL10n->get('SYS_PDF') . ' (' . $gL10n->get('SYS_PORTRAIT') . ')', 'pdfl' => $gL10n->get('SYS_PDF') . ' (' . $gL10n->get('SYS_LANDSCAPE') . ')', 'csv-oo' => $gL10n->get('SYS_CSV') . ' (' . $gL10n->get('SYS_UTF8') . ')');
        $form->addSelectBox('export_list_to', null, $selectBoxEntries, array('showContextDependentFirstEntry' => false));
        $listsMenu->addForm($form->show(false));
        $table = new HtmlTable('adm_lists_table', $page, $hoverRows, $datatable, $classTable);
        $table->setDatatablesRowsPerPage($gPreferences['lists_members_per_page']);
    } else {
        $table = new HtmlTable('adm_lists_table', $page, $hoverRows, $datatable, $classTable);
    }
}
// initialize array parameters for table and set the first column for the counter
if ($getMode === 'html') {
    // in html mode we group leaders. Therefore we need a special hidden column.
    $columnAlign = array('left', 'left');
    $columnValues = array($gL10n->get('SYS_ABR_NO'), $gL10n->get('INS_GROUPS'));
} else {
    $columnAlign = array('left');
    $columnValues = array($gL10n->get('SYS_ABR_NO'));
}
// headlines for columns
for ($columnNumber = 1; $columnNumber <= $list->countColumns(); ++$columnNumber) {
    $column = $list->getColumnObject($columnNumber);
    // Find name of the field
Exemple #17
0
    }
}
// Create download table
$downloadOverview->setDatatablesColumnsHide(array(1));
$downloadOverview->setDatatablesOrderColumns(array(1, 3));
$htmlDownloadOverview = $downloadOverview->show(false);
/**************************************************************************/
// Add Admin table to html page
/**************************************************************************/
// If user is download Admin show further files contained in this folder.
if ($gCurrentUser->editDownloadRight()) {
    // Check whether additional content was found in the folder
    if (isset($folderContent['additionalFolders']) || isset($folderContent['additionalFiles'])) {
        $htmlAdminTableHeadline = '<h2>' . $gL10n->get('DOW_UNMANAGED_FILES') . HtmlForm::getHelpTextIcon('DOW_ADDITIONAL_FILES') . '</h2>';
        // Create table object
        $adminTable = new HtmlTable('tbl_downloads', $page, true);
        $adminTable->setColumnAlignByArray(array('left', 'left', 'left', 'right'));
        // create array with all column heading values
        $columnHeading = array('<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/download.png" alt="' . $gL10n->get('SYS_FOLDER') . ' / ' . $gL10n->get('DOW_FILE_TYPE') . '" title="' . $gL10n->get('SYS_FOLDER') . ' / ' . $gL10n->get('DOW_FILE_TYPE') . '" />', $gL10n->get('SYS_NAME'), $gL10n->get('SYS_SIZE'), '&nbsp;');
        $adminTable->addRowHeadingByArray($columnHeading);
        // Get folders
        if (isset($folderContent['additionalFolders'])) {
            for ($i = 0; $i < count($folderContent['additionalFolders']); ++$i) {
                $nextFolder = $folderContent['additionalFolders'][$i];
                $columnValues = array('<img src="' . THEME_PATH . '/icons/download.png" alt="' . $gL10n->get('SYS_FOLDER') . '" title="' . $gL10n->get('SYS_FOLDER') . '" />', $nextFolder['fol_name'], '', '<a class="admidio-icon-link" href="' . $g_root_path . '/adm_program/modules/downloads/download_function.php?mode=6&amp;folder_id=' . $getFolderId . '&amp;name=' . urlencode($nextFolder['fol_name']) . '">
                                          <img src="' . THEME_PATH . '/icons/database_in.png" alt="' . $gL10n->get('DOW_ADD_TO_DATABASE') . '" title="' . $gL10n->get('DOW_ADD_TO_DATABASE') . '" /></a>');
                $adminTable->addRowByArray($columnValues);
            }
        }
        // Get files
        if (isset($folderContent['additionalFiles'])) {
 public function getIndex()
 {
     $this->title = 'Delivery Report';
     $this->place_action = 'none';
     $this->show_select = false;
     $this->can_add = false;
     $this->is_report = true;
     Breadcrumbs::addCrumb('Manifest', URL::to(strtolower($this->controller_name)));
     $this->additional_filter = View::make('shared.addfilter')->with('submit_url', 'deliveryreport')->render();
     //device=&courier=&logistic=&date-from=2015-10-24
     $period_from = Input::get('date-from');
     $period_to = Input::get('date-to');
     $device = Input::get('device');
     $courier = Input::get('courier');
     $merchant = Input::get('merchant');
     $logistic = Input::get('logistic');
     $status = Input::get('status');
     $courierstatus = Input::get('courier-status');
     if ($period_to == '' || is_null($period_to)) {
         $period_to = date('Y-m-d', time());
     }
     if ($period_from == '' || is_null($period_from)) {
         $period_from = date('Y-m-d', time());
     }
     $this->def_order_by = 'TRANS_DATETIME';
     $this->def_order_dir = 'DESC';
     $this->place_action = 'none';
     $this->show_select = false;
     $mtab = Config::get('jayon.assigned_delivery_table');
     $model = new Shipment();
     $model = $model->select(DB::raw('count(*) as count, year(ordertime) as orderyear,weekofyear(ordertime) as orderweek, date(ordertime) as orderdate, m.merchantname as merchant_name, delivery_type'))->leftJoin('members as m', $mtab . '.merchant_id', '=', 'm.id')->orderBy('m.merchantname', 'asc');
     if ($period_from == '' || is_null($period_from)) {
         $datefrom = date('Y-m-d 00:00:00', strtotime($period_from));
         $dateto = date('Y-m-d 23:59:59', strtotime($period_to));
     } else {
         $datefrom = date('Y-m-d 00:00:00', strtotime($period_from));
         $dateto = date('Y-m-d 23:59:59', strtotime($period_to));
         $model = $model->where(function ($q) use($datefrom, $dateto) {
             $q->whereBetween('ordertime', array($datefrom, $dateto));
         });
     }
     $model->orderBy('ordertime', 'asc')->groupBy('orderdate')->groupBy('orderyear')->groupBy('merchant_id')->groupBy('delivery_type');
     $actualresult = $model->get();
     /* Start custom queries */
     $tattrs = array('width' => '100%', 'class' => 'table table-bordered table-striped');
     $bymc = array();
     $effdates = array();
     foreach ($actualresult as $mc) {
         if (isset($bymc[$mc->delivery_type][$mc->merchant_name][$mc->orderyear][$mc->orderweek][$mc->orderdate])) {
             $bymc[$mc->delivery_type][$mc->merchant_name][$mc->orderyear][$mc->orderweek][$mc->orderdate] += $mc->count;
         } else {
             $bymc[$mc->delivery_type][$mc->merchant_name][$mc->orderyear][$mc->orderweek][$mc->orderdate] = $mc->count;
         }
         $effdates[$mc->orderyear][$mc->orderweek][] = $mc->orderdate;
     }
     $effdates2 = array();
     foreach ($effdates as $yr => $wk) {
         ksort($wk);
         foreach ($wk as $k => $v) {
             $dts = array_unique($v);
             $effdates2[$yr][$k][] = array_shift($dts);
             $effdates2[$yr][$k][] = array_pop($dts);
         }
     }
     //print_r($effdates2);
     //print_r($bymc);
     $bydc = array();
     $tpd = array();
     $bpd = array();
     $wpd = array();
     $dtotal = array();
     $btotal = array();
     $wtotal = array();
     $headvar1 = array(array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''));
     $headvar2 = array(array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''));
     $headvar3 = array(array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''));
     $headvar4 = array(array('value' => 'No.', 'attr' => ''), array('value' => 'Merchant', 'attr' => ''), array('value' => 'Total', 'attr' => ''));
     $weekspan = 0;
     foreach ($effdates2 as $y => $w) {
         $cy = '';
         foreach ($w as $wk => $v) {
             $headvar1[] = array('value' => '', 'attr' => '');
             if ($cy != $y) {
                 $headvar2[] = array('value' => $y, 'attr' => '');
             } else {
                 $headvar2[] = array('value' => '', 'attr' => '');
             }
             $headvar3[] = array('value' => $wk, 'attr' => '');
             $headvar4[] = array('value' => $v[0] . ' - ' . $v[1], 'attr' => '');
             $cy = $y;
             $weekspan++;
         }
     }
     //print $weekspan;
     $tabdata = array();
     $weekspan++;
     $tarr = array();
     $tharr = array();
     $thval = array();
     foreach ($bymc as $t => $m) {
         //$weekspan += 1;
         //$tabdata[] = $head;
         $seq = 1;
         $totaltype = 0;
         foreach ($m as $mc => $yr) {
             $row = array();
             $row[] = array('value' => $seq, 'attr' => '');
             $row[] = array('value' => $mc, 'attr' => '');
             $valrows = array();
             $totalrows = 0;
             foreach ($effdates2 as $yr => $w) {
                 foreach ($w as $wk => $dt) {
                     $val = 0;
                     if (isset($bymc[$t][$mc][$yr][$wk])) {
                         //print_r($bymc[$t][$mc][$yr][$wk]);
                         $vr = $bymc[$t][$mc][$yr][$wk];
                         foreach ($vr as $k => $v) {
                             $val += $v;
                         }
                     } else {
                         $val = 0;
                     }
                     $valrows[] = array('value' => $val, 'attr' => '');
                     $totalrows += $val;
                 }
                 $totaltype += $totalrows;
             }
             $row[] = array('value' => $totalrows, 'attr' => '');
             $mrow = array_merge($row, $valrows);
             $tarr[$t][] = $mrow;
             $seq++;
         }
         // subhead
         $head = array();
         $head[] = array('value' => '', 'attr' => '');
         $head[] = array('value' => strtoupper($t), 'attr' => 'style="text-align:right;"');
         $head[] = array('value' => $totaltype, 'attr' => '');
         for ($i = 1; $i < $weekspan; $i++) {
             $head[] = array('value' => '', 'attr' => '');
         }
         $tharr[$t] = $head;
         $thval[$t] = $totaltype;
     }
     $totalorder = 0;
     foreach ($tharr as $t => $v) {
         $tabdata[] = $tharr[$t];
         $totalorder += $thval[$t];
         foreach ($tarr[$t] as $tv) {
             $tabdata[] = $tv;
         }
     }
     $sumup[] = array('value' => '', 'attr' => '');
     $sumup[] = array('value' => '<b>TOTAL</b>', 'attr' => 'style="text-align:right;"');
     $sumup[] = array('value' => $totalorder, 'attr' => 'style="text-align:right;"');
     for ($i = 1; $i < $weekspan; $i++) {
         $sumup[] = array('value' => '', 'attr' => '');
     }
     $tabdata[] = $sumup;
     //die();
     $thead = array();
     //$thead[] = $headvar1;
     $thead[] = $headvar2;
     $thead[] = $headvar3;
     $thead[] = $headvar4;
     $seq = 1;
     $total_billing = 0;
     $total_delivery = 0;
     $total_cod = 0;
     $d = 0;
     $gt = 0;
     $lastdate = '';
     $courier_name = '';
     $csv_data = array();
     $dids = array();
     $cntcod = 0;
     $cntccod = 0;
     $cntdo = 0;
     $cntps = 0;
     $cntreturn = 0;
     $box_count = 0;
     $weight_sum = 0;
     //total per columns
     $tcod = 0;
     $tccod = 0;
     $tdo = 0;
     $tps = 0;
     $treturn = 0;
     $tbox = 0;
     $tweight = 0;
     $totalrow = array();
     $mname = '';
     $cd = '';
     $mtable = new HtmlTable($tabdata, $tattrs, $thead);
     $tables[] = $mtable->build();
     $this->table_raw = $tables;
     $report_header_data = array('cod' => $cntcod, 'ccod' => $cntccod, 'do' => $cntdo, 'ps' => $cntps, 'return' => $cntreturn, 'avg' => 0);
     if ($this->print == true || $this->pdf == true) {
         return array('tables' => $tables, 'report_header_data' => $report_header_data);
     } else {
         return parent::reportPageGenerator();
     }
 }
 public function getIndex()
 {
     $this->heads = array(array('Period', array('search' => true, 'sort' => true, 'style' => 'min-width:90px;', 'daterange' => true)), array('Date', array('search' => true, 'sort' => true, 'style' => 'min-width:100px;', 'daterange' => true)), array('JV Ref', array('search' => true, 'sort' => true, 'style' => 'min-width:120px;')), array('Account', array('search' => true, 'style' => 'min-width:100px;', 'sort' => true)), array('Account Description', array('search' => true, 'style' => 'min-width:125px;', 'sort' => true)), array('Reference Doc.', array('search' => true, 'sort' => true)), array('Orig. Currency', array('search' => true, 'sort' => true)), array('Orig. Amount', array('search' => true, 'sort' => true)), array('Conversion Rate', array('search' => true, 'sort' => true)), array('Base Amount', array('search' => true, 'sort' => true)), array('Transaction Description', array('search' => true, 'sort' => true)));
     //print $this->model->where('docFormat','picture')->get()->toJSON();
     $this->title = 'AFE Report - Lvl 3';
     $this->place_action = 'none';
     $this->show_select = false;
     Breadcrumbs::addCrumb('Cost Report', URL::to(strtolower($this->controller_name)));
     $this->additional_filter = View::make(strtolower($this->controller_name) . '.addfilter')->with('submit_url', 'afelvlthree')->render();
     $db = Config::get('lundin.main_db');
     $company = Input::get('acc-company');
     $period_from = Input::get('acc-period-from');
     $period_to = Input::get('acc-period-to');
     if ($period_from == '' || is_null($period_from)) {
         $period_from = date('Y0m', time());
     }
     if ($period_to == '' || is_null($period_to)) {
         $period_to = date('Y0m', time());
     }
     $company = strtolower($company);
     if ($company == '') {
         $company = Config::get('lundin.default_company');
     }
     $afe = Input::get('acc-afe');
     if ($afe == '' || is_null($afe)) {
         $afes = Prefs::getAfe($company)->AfeToArray();
         $afe = $afes[0]->ANL_CODE;
     }
     $company = strtolower($company);
     $this->def_order_by = 'TRANS_DATETIME';
     $this->def_order_dir = 'DESC';
     $this->place_action = 'none';
     $this->show_select = false;
     $this->sql_key = 'TRANS_DATETIME';
     $this->sql_table_name = $company . '_a_salfldg';
     $this->sql_connection = 'mysql2';
     /* Start custom queries */
     $model = DB::connection($this->sql_connection)->table($this->sql_table_name);
     $tables = array();
     //print_r($mresult);
     $actualresult = $model->select(DB::raw($company . '_a_salfldg.ACCNT_CODE,' . $company . '_acnt.DESCR AS ADESCR,' . 'SUM(' . $company . '_a_salfldg.AMOUNT) as AMT'))->where($company . '_a_salfldg.ACCNT_CODE', 'like', '2%')->where($company . '_a_salfldg.ANAL_T1', '=', $afe)->where($company . '_a_salfldg.PERIOD', '>=', $period_from)->where($company . '_a_salfldg.PERIOD', '<=', $period_to)->leftJoin($company . '_acnt', $company . '_a_salfldg.ACCNT_CODE', '=', $company . '_acnt.ACNT_CODE')->groupBy($company . '_a_salfldg.ACCNT_CODE')->get();
     $model = DB::connection($this->sql_connection)->table($company . '_a_salfldg');
     $prioritdresult = $model->select(DB::raw($company . '_a_salfldg.ACCNT_CODE,' . $company . '_acnt.DESCR AS ADESCR,' . 'SUM(' . $company . '_a_salfldg.AMOUNT) as AMT'))->where($company . '_a_salfldg.ACCNT_CODE', 'like', '2%')->where($company . '_a_salfldg.ANAL_T1', '=', $afe)->where($company . '_a_salfldg.PERIOD', '<', $period_from)->leftJoin($company . '_acnt', $company . '_a_salfldg.ACCNT_CODE', '=', $company . '_acnt.ACNT_CODE')->groupBy($company . '_a_salfldg.ACCNT_CODE')->get();
     $model = DB::connection($this->sql_connection)->table($company . '_a_salfldg');
     $currentitdresult = $model->select(DB::raw($company . '_a_salfldg.ACCNT_CODE,' . $company . '_acnt.DESCR AS ADESCR,' . 'SUM(' . $company . '_a_salfldg.AMOUNT) as AMT'))->where($company . '_a_salfldg.ACCNT_CODE', 'like', '2%')->where($company . '_a_salfldg.ANAL_T1', '=', $afe)->where($company . '_a_salfldg.PERIOD', '<=', $period_to)->leftJoin($company . '_acnt', $company . '_a_salfldg.ACCNT_CODE', '=', $company . '_acnt.ACNT_CODE')->groupBy($company . '_a_salfldg.ACCNT_CODE')->get();
     $model = DB::connection($this->sql_connection)->table($company . '_b_salfldg');
     $budgetresult = $model->select(DB::raw($company . '_b_salfldg.ACCNT_CODE,' . $company . '_acnt.DESCR AS ADESCR,' . 'SUM(' . $company . '_b_salfldg.AMOUNT) as AMT'))->where($company . '_b_salfldg.ACCNT_CODE', 'like', '2%')->where($company . '_b_salfldg.ANAL_T1', '=', $afe)->where($company . '_b_salfldg.PERIOD', '>=', $period_from)->where($company . '_b_salfldg.PERIOD', '<=', $period_to)->leftJoin($company . '_acnt', $company . '_b_salfldg.ACCNT_CODE', '=', $company . '_acnt.ACNT_CODE')->groupBy($company . '_b_salfldg.ACCNT_CODE')->get();
     $model = DB::connection($this->sql_connection)->table($company . '_d_salfldg');
     $revbudgetresult = $model->select(DB::raw($company . '_d_salfldg.ACCNT_CODE,' . $company . '_acnt.DESCR AS ADESCR,' . 'SUM(' . $company . '_d_salfldg.AMOUNT) as AMT'))->where($company . '_d_salfldg.ACCNT_CODE', 'like', '2%')->where($company . '_d_salfldg.ANAL_T1', '=', $afe)->where($company . '_d_salfldg.PERIOD', '>=', $period_from)->where($company . '_d_salfldg.PERIOD', '<=', $period_to)->leftJoin($company . '_acnt', $company . '_d_salfldg.ACCNT_CODE', '=', $company . '_acnt.ACNT_CODE')->groupBy($company . '_d_salfldg.ACCNT_CODE')->get();
     $tabdata = array();
     foreach ($actualresult as $a) {
         $tabdata[$a->ACCNT_CODE] = $a;
         $tabdata[$a->ACCNT_CODE]->BAMT = 0;
         $tabdata[$a->ACCNT_CODE]->DAMT = 0;
         $tabdata[$a->ACCNT_CODE]->PITDAMT = 0;
         $tabdata[$a->ACCNT_CODE]->CITDAMT = 0;
     }
     foreach ($prioritdresult as $p) {
         if (isset($tabdata[$p->ACCNT_CODE])) {
             $tabdata[$p->ACCNT_CODE]->PITDAMT = $p->AMT;
         }
     }
     foreach ($currentitdresult as $c) {
         if (isset($tabdata[$c->ACCNT_CODE])) {
             $tabdata[$c->ACCNT_CODE]->CITDAMT = $c->AMT;
         }
     }
     foreach ($budgetresult as $b) {
         if (isset($tabdata[$b->ACCNT_CODE])) {
             $tabdata[$b->ACCNT_CODE]->BAMT = $b->AMT;
         } else {
             $tabdata[$b->ACCNT_CODE] = $b;
             $tabdata[$b->ACCNT_CODE]->BAMT = $b->AMT;
             $tabdata[$b->ACCNT_CODE]->AMT = 0;
             $tabdata[$b->ACCNT_CODE]->DAMT = 0;
             $tabdata[$b->ACCNT_CODE]->PITDAMT = 0;
             $tabdata[$b->ACCNT_CODE]->CITDAMT = 0;
         }
     }
     foreach ($revbudgetresult as $d) {
         if (isset($tabdata[$d->ACCNT_CODE])) {
             $tabdata[$d->ACCNT_CODE]->DAMT = $d->AMT;
         } else {
             $tabdata[$d->ACCNT_CODE] = $d;
             $tabdata[$d->ACCNT_CODE]->DAMT = $d->AMT;
             $tabdata[$d->ACCNT_CODE]->AMT = 0;
             $tabdata[$d->ACCNT_CODE]->BAMT = 0;
             $tabdata[$d->ACCNT_CODE]->PITDAMT = 0;
             $tabdata[$d->ACCNT_CODE]->CITDAMT = 0;
         }
     }
     ksort($tabdata);
     $tattrs = array('width' => '100%', 'class' => 'table table-bordered');
     $thead = array();
     $tdataclr = array();
     $tdataexp = array();
     $thead[] = array(array('value' => '#', 'attr' => 'rowspan=2'), array('value' => 'Account', 'attr' => 'colspan=2 rowspan=2 class="center"'), array('value' => 'Budget', 'attr' => 'colspan=2'), array('value' => 'Actual', 'attr' => 'colspan=3'), array('value' => 'Variance', 'attr' => 'colspan=2'));
     $thead[] = array(array('value' => 'Original'), array('value' => 'Revised'), array('value' => 'Prior ITD'), array('value' => 'Current Month'), array('value' => 'Current Month ITD'), array('value' => '$'), array('value' => '%'));
     $seq = 1;
     $sumexp = new stdClass();
     $sumclr = new stdClass();
     $sumexp->BAMT = 0;
     $sumexp->DAMT = 0;
     $sumexp->BREV = 0;
     $sumexp->PITDAMT = 0;
     $sumexp->AMT = 0;
     $sumexp->CITDAMT = 0;
     $sumexp->VARIANCE = 0;
     $sumexp->PCT = 0;
     $sumclr->BAMT = 0;
     $sumclr->DAMT = 0;
     $sumclr->BREV = 0;
     $sumclr->PITDAMT = 0;
     $sumclr->AMT = 0;
     $sumclr->CITDAMT = 0;
     $sumclr->VARIANCE = 0;
     $sumclr->PCT = 0;
     foreach ($tabdata as $m) {
         if ($m->DAMT > 0) {
             $variance = $m->CITDAMT - $m->BAMT;
             $pct = $variance / $m->BAMT * 100;
             $brev = $m->DAMT - $m->BAMT;
         } else {
             $variance = 0;
             $pct = 0;
             $brev = 0;
         }
         if (preg_match('/^2009.*/', $m->ACCNT_CODE)) {
             $tdataclr[] = array(array('value' => $seq), array('value' => $m->ACCNT_CODE), array('value' => $m->ADESCR), array('value' => '', 'attr' => 'class="column-amt"'), array('value' => '', 'attr' => 'class="column-amt"'), array('value' => $m->PITDAMT, 'attr' => 'class="column-amt"'), array('value' => $m->AMT, 'attr' => 'class="column-amt"'), array('value' => $m->CITDAMT, 'attr' => 'class="column-amt"'), array('value' => '', 'attr' => 'class="column-amt"'), array('value' => '', 'attr' => 'class="column-amt"'));
             $sumclr->BAMT = '';
             $sumclr->DAMT = '';
             $sumclr->BREV = '';
             $sumclr->PITDAMT += $m->PITDAMT;
             $sumclr->AMT += $m->AMT;
             $sumclr->CITDAMT += $m->CITDAMT;
             $sumclr->VARIANCE = '';
             $sumclr->PCT = '';
         } else {
             $tdataexp[] = array(array('value' => $seq), array('value' => $m->ACCNT_CODE), array('value' => $m->ADESCR), array('value' => $m->BAMT, 'attr' => 'class="column-amt"'), array('value' => $m->DAMT, 'attr' => 'class="column-amt"'), array('value' => $m->PITDAMT, 'attr' => 'class="column-amt"'), array('value' => $m->AMT, 'attr' => 'class="column-amt"'), array('value' => $m->CITDAMT, 'attr' => 'class="column-amt"'), array('value' => $variance, 'attr' => 'class="column-amt"'), array('value' => $pct, 'attr' => 'class="column-amt"'));
             $sumexp->BAMT += $m->BAMT;
             $sumexp->DAMT += $m->DAMT;
             $sumexp->BREV += $brev;
             $sumexp->PITDAMT += $m->PITDAMT;
             $sumexp->AMT += $m->AMT;
             $sumexp->CITDAMT += $m->CITDAMT;
             $sumexp->VARIANCE += $variance;
             $sumexp->PCT += $pct;
         }
         $seq++;
     }
     $tdataclr[] = array(array('value' => 'Total After Clearing', 'attr' => 'colspan=3 style="text-align:center;font-weight:bold;" '), array('value' => $sumclr->BAMT, 'attr' => 'class="column-amt"'), array('value' => $sumclr->DAMT, 'attr' => 'class="column-amt"'), array('value' => $sumclr->PITDAMT, 'attr' => 'class="column-amt"'), array('value' => $sumclr->AMT, 'attr' => 'class="column-amt"'), array('value' => $sumclr->CITDAMT, 'attr' => 'class="column-amt"'), array('value' => $sumclr->VARIANCE, 'attr' => 'class="column-amt"'), array('value' => $sumclr->PCT, 'attr' => 'class="column-amt"'));
     $tdataexp[] = array(array('value' => 'Total Expenditure', 'attr' => 'colspan=3 style="text-align:center;font-weight:bold;" '), array('value' => $sumexp->BAMT, 'attr' => 'class="column-amt"'), array('value' => $sumexp->DAMT, 'attr' => 'class="column-amt"'), array('value' => $sumexp->PITDAMT, 'attr' => 'class="column-amt"'), array('value' => $sumexp->AMT, 'attr' => 'class="column-amt"'), array('value' => $sumexp->CITDAMT, 'attr' => 'class="column-amt"'), array('value' => $sumexp->VARIANCE, 'attr' => 'class="column-amt"'), array('value' => $sumexp->PCT, 'attr' => 'class="column-amt"'));
     $tdata = array_merge($tdataexp, $tdataclr);
     $mtable = new HtmlTable($tdata, $tattrs, $thead);
     $tables[] = $mtable->build();
     $this->sql_table_name = $company . '_b_salfldg';
     $model = DB::connection($this->sql_connection)->table($this->sql_table_name);
     $bresult = $model->where('ACCNT_CODE', 'like', '200%')->leftJoin($company . '_acnt', $company . '_b_salfldg.ACCNT_CODE', '=', $company . '_acnt.ACNT_CODE')->groupBy('ACCNT_CODE')->get(array('ACCNT_CODE', DB::raw($company . '_acnt.DESCR AS ADESCR'), DB::raw('SUM(AMOUNT) as AMT')));
     //print_r($bresult);
     $this->table_raw = $tables;
     if ($this->print == true) {
         return $tables;
     } else {
         return parent::reportPageGenerator();
     }
 }
$usrStatement = $gDb->query($sql);
$members_found = $usrStatement->rowCount();
if ($members_found === 0) {
    $gMessage->setForwardUrl($gHomepage);
    $gMessage->show($gL10n->get('NWU_NO_REGISTRATIONS'), $gL10n->get('SYS_REGISTRATION'));
}
// create html page object
$page = new HtmlPage($headline);
$page->enableModal();
if ($gCurrentUser->isWebmaster()) {
    // get module menu
    $registrationMenu = $page->getMenu();
    // show link to system preferences of announcements
    $registrationMenu->addItem('menu_item_preferences', $g_root_path . '/adm_program/modules/preferences/preferences.php?show_option=registration', $gL10n->get('SYS_MODULE_PREFERENCES'), 'options.png', 'right');
}
$table = new HtmlTable('new_user_table', $page, true);
// create array with all column heading values
$columnHeading = array($gL10n->get('SYS_NAME'), $gL10n->get('SYS_REGISTRATION'), $gL10n->get('SYS_USERNAME'), $gL10n->get('SYS_EMAIL'), '&nbsp;');
$table->setColumnAlignByArray(array('left', 'left', 'left', 'left', 'right'));
$table->setDatatablesOrderColumns(1);
$table->addRowHeadingByArray($columnHeading);
while ($row = $usrStatement->fetch()) {
    $timestampCreate = new DateTimeExtended($row['reg_timestamp'], 'Y-m-d H:i:s');
    $datetimeCreate = $timestampCreate->format($gPreferences['system_date'] . ' ' . $gPreferences['system_time']);
    if ($gPreferences['enable_mail_module'] == 1) {
        $mailLink = '<a href="' . $g_root_path . '/adm_program/modules/messages/messages_write.php?usr_id=' . $row['usr_id'] . '">' . $row['email'] . '</a>';
    } else {
        $mailLink = '<a href="mailto:' . $row['email'] . '">' . $row['email'] . '</a>';
    }
    // create array with all column values
    $columnValues = array('<a href="' . $g_root_path . '/adm_program/modules/profile/profile.php?user_id=' . $row['usr_id'] . '">' . $row['last_name'] . ', ' . $row['first_name'] . '</a>', $datetimeCreate, $row['usr_login_name'], $mailLink, '<a class="admidio-icon-link" href="' . $g_root_path . '/adm_program/modules/registration/registration_assign.php?new_user_id=' . $row['usr_id'] . '"><img
Exemple #21
0
$htmlDownloadOverview = $downloadOverview->show(false);
/**************************************************************************/
// Add Admin table to html page
/**************************************************************************/
//If user is download Admin show further files contained in this folder.
if ($gCurrentUser->editDownloadRight()) {
    // Check whether additional content was found in the folder
    if (isset($folderContent['additionalFolders']) || isset($folderContent['additionalFiles'])) {
        $htmlAdminTableHeadline = '<h2>
                                    ' . $gL10n->get('DOW_UNMANAGED_FILES') . '
                                    <a class="admidio-icon-link" data-toggle="modal" data-target="#admidio_modal"
                                        href="' . $g_root_path . '/adm_program/system/msg_window.php?message_id=DOW_ADDITIONAL_FILES&amp;inline=true"><img 
                                        src="' . THEME_PATH . '/icons/help.png" alt="Help" /></a>            
                                </h2>';
        //Create table object
        $adminTable = new HtmlTable('tbl_downloads', $page, true);
        // create array with all column heading values
        $columnHeading = array('<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/download.png" alt="' . $gL10n->get('SYS_FOLDER') . ' / ' . $gL10n->get('DOW_FILE_TYPE') . '" title="' . $gL10n->get('SYS_FOLDER') . ' / ' . $gL10n->get('DOW_FILE_TYPE') . '" />', $gL10n->get('SYS_NAME'), $gL10n->get('SYS_FEATURES'));
        $adminTable->addRowHeadingByArray($columnHeading);
        // Get folders
        if (isset($folderContent['additionalFolders'])) {
            for ($i = 0; $i < count($folderContent['additionalFolders']); $i++) {
                $nextFolder = $folderContent['additionalFolders'][$i];
                $columnValues = array('<img src="' . THEME_PATH . '/icons/download.png" alt="' . $gL10n->get('SYS_FOLDER') . '" title="' . $gL10n->get('SYS_FOLDER') . '" />', $nextFolder['fol_name'], '<a class="admidio-icon-link" href="' . $g_root_path . '/adm_program/modules/downloads/download_function.php?mode=6&amp;folder_id=' . $getFolderId . '&amp;name=' . urlencode($nextFolder['fol_name']) . '">
                                          <img src="' . THEME_PATH . '/icons/database_in.png" alt="' . $gL10n->get('DOW_ADD_TO_DATABASE') . '" title="' . $gL10n->get('DOW_ADD_TO_DATABASE') . '" /></a>');
                $adminTable->addRowByArray($columnValues);
            }
        }
        // Get files
        if (isset($folderContent['additionalFiles'])) {
            for ($i = 0; $i < count($folderContent['additionalFiles']); $i++) {
Exemple #22
0
     $form->addInput('date_to', $gL10n->get('SYS_END'), $dates->getParameter('dateEndFormatAdmidio'), array('type' => 'date', 'maxLength' => 10));
     $form->addSubmitButton('btn_send', $gL10n->get('SYS_OK'));
     $FilterNavbar->addForm($form->show(false));
     $page->addHtml($FilterNavbar->show(false));
 }
 if ($datesTotalCount == 0) {
     // No events found
     if ($getId > 0) {
         $page->addHtml('<p>' . $gL10n->get('SYS_NO_ENTRY') . '</p>');
     } else {
         $page->addHtml('<p>' . $gL10n->get('SYS_NO_ENTRIES') . '</p>');
     }
 } else {
     // Output table header for compact view
     if ($getViewMode === 'compact') {
         $compactTable = new HtmlTable('events_compact_table', $page, true, true);
         $columnHeading = array('&nbsp;', $gL10n->get('SYS_START'), $gL10n->get('DAT_DATE'), $gL10n->get('SYS_PARTICIPANTS'), $gL10n->get('DAT_LOCATION'));
         $compactTable->addRowHeadingByArray($columnHeading);
     }
     foreach ($datesResult['recordset'] as $row) {
         // Initialize object and write new data
         $date->readDataById($row['dat_id']);
         $endDate = '';
         if ($date->getValue('dat_begin', $gPreferences['system_date']) != $date->getValue('dat_end', $gPreferences['system_date'])) {
             $endDate = ' - ' . $date->getValue('dat_end', $gPreferences['system_date']);
         }
         //ical Download
         $icalIcon = '';
         if ($gPreferences['enable_dates_ical'] == 1) {
             $icalIcon = '
                 <a class="admidio-icon-link" href="' . $g_root_path . '/adm_program/modules/dates/dates_function.php?dat_id=' . $date->getValue('dat_id') . '&amp;mode=6">
Exemple #23
0
    $page->hideThemeHtml();
    $page->hideMenu();
    $page->setPrintMode();
    $page->addHtml('<h3>' . $gL10n->get('DAT_PERIOD_FROM_TO', $dates->getParameter('dateStartFormatAdmidio'), $dates->getParameter('dateEndFormatAdmidio')) . '</h3>');
}
if ($datesTotalCount == 0) {
    // No events found
    if ($getId > 0) {
        $page->addHtml('<p>' . $gL10n->get('SYS_NO_ENTRY') . '</p>');
    } else {
        $page->addHtml('<p>' . $gL10n->get('SYS_NO_ENTRIES') . '</p>');
    }
} else {
    // Output table header for compact view
    if ($getView === 'compact' || $getView === 'room' || $getView === 'participants' || $getView === 'description') {
        $compactTable = new HtmlTable('events_compact_table', $page, $hoverRows, $datatable, $classTable);
        switch ($getView) {
            case 'compact':
                $columnHeading = array('&nbsp;', $gL10n->get('SYS_PERIOD'), $gL10n->get('DAT_DATE'), $gL10n->get('SYS_PARTICIPANTS'), $gL10n->get('DAT_LOCATION'));
                $columnAlign = array('center', 'left', 'left', 'left', 'left');
                $compactTable->disableDatatablesColumnsSort(6);
                break;
            case 'room':
                $columnHeading = array('&nbsp;', $gL10n->get('SYS_PERIOD'), $gL10n->get('DAT_DATE'), $gL10n->get('SYS_ROOM'), $gL10n->get('SYS_LEADERS'), $gL10n->get('SYS_PARTICIPANTS'));
                $columnAlign = array('center', 'left', 'left', 'left', 'left', 'left');
                $compactTable->disableDatatablesColumnsSort(7);
                break;
            case 'participants':
                $columnHeading = array('&nbsp;', $gL10n->get('SYS_PERIOD'), $gL10n->get('DAT_DATE'), $gL10n->get('SYS_PARTICIPANTS'));
                $columnAlign = array('center', 'left', 'left', 'left');
                $compactTable->disableDatatablesColumnsSort(5);
Exemple #24
0
$fieldsMenu = $page->getMenu();
// show back link
$fieldsMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png');
// define link to create new profile field
$fieldsMenu->addItem('menu_item_new_field', $g_root_path . '/adm_program/modules/preferences/fields_new.php', $gL10n->get('ORG_CREATE_PROFILE_FIELD'), 'add.png');
// define link to maintain categories
$fieldsMenu->addItem('menu_item_maintain_category', $g_root_path . '/adm_program/modules/categories/categories.php?type=USF', $gL10n->get('SYS_MAINTAIN_CATEGORIES'), 'application_double.png');
$sql = 'SELECT * FROM ' . TBL_CATEGORIES . ', ' . TBL_USER_FIELDS . '
         WHERE cat_type   = \'USF\'
           AND usf_cat_id = cat_id
           AND (  cat_org_id = ' . $gCurrentOrganization->getValue('org_id') . '
               OR cat_org_id IS NULL )
         ORDER BY cat_sequence ASC, usf_sequence ASC ';
$statement = $gDb->query($sql);
// Create table
$table = new HtmlTable('tbl_profile_fields', $page, true);
$table->setMessageIfNoRowsFound('ORG_NO_FIELD_CREATED');
// create array with all column heading values
$columnHeading = array($gL10n->get('SYS_FIELD') . HtmlForm::getHelpTextIcon('ORG_FIELD_DESCRIPTION'), '&nbsp;', $gL10n->get('SYS_DESCRIPTION'), '<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/eye.png" alt="' . $gL10n->get('ORG_FIELD_NOT_HIDDEN') . '" title="' . $gL10n->get('ORG_FIELD_NOT_HIDDEN') . '" />', '<img class="admidio-icon-info" data-html="true" src="' . THEME_PATH . '/icons/textfield_key.png" alt="' . $gL10n->get('ORG_FIELD_DISABLED', $gL10n->get('ROL_RIGHT_EDIT_USER')) . '" title="' . $gL10n->get('ORG_FIELD_DISABLED', $gL10n->get('ROL_RIGHT_EDIT_USER')) . '" />', '<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/asterisk_yellow.png" alt="' . $gL10n->get('ORG_FIELD_REQUIRED') . '" title="' . $gL10n->get('ORG_FIELD_REQUIRED') . '" />', $gL10n->get('ORG_DATATYPE'), '&nbsp;');
$table->addRowHeadingByArray($columnHeading);
$categoryId = 0;
$userField = new TableUserField($gDb);
// Intialize variables
$description = '';
$hidden = '';
$disable = '';
$mandatory = '';
$usfSystem = '';
while ($row = $statement->fetch()) {
    $userField->clear();
    $userField->setArray($row);
 public function getIndex()
 {
     $this->title = 'Manifest Pengiriman Harian - To Device / Logistic';
     $this->place_action = 'none';
     $this->show_select = false;
     $this->can_add = false;
     $this->is_report = true;
     Breadcrumbs::addCrumb('Manifest', URL::to(strtolower($this->controller_name)));
     $this->additional_filter = View::make('shared.addfilter')->with('submit_url', 'devmanifest')->render();
     $db = Config::get('lundin.main_db');
     $company = Input::get('acc-company');
     //device=&courier=&logistic=&date-from=2015-10-24
     $period_from = Input::get('date-from');
     $period_to = Input::get('acc-period-to');
     $device = Input::get('device');
     $courier = Input::get('courier');
     $logistic = Input::get('logistic');
     $status = Input::get('status');
     $courierstatus = Input::get('courier-status');
     if ($period_to == '' || is_null($period_to)) {
         $period_to = date('Y-m-d', time());
     }
     if ($period_from == '' || is_null($period_from)) {
         $period_from = date('Y-m-d', time());
     }
     $this->def_order_by = 'TRANS_DATETIME';
     $this->def_order_dir = 'DESC';
     $this->place_action = 'none';
     $this->show_select = false;
     /* Start custom queries */
     $model = $this->model;
     if ($status == '' || is_null($status)) {
         $status = Config::get('jayon.devmanifest_default_status');
     } else {
         $status = explode(',', $status);
     }
     if (empty($status)) {
         $exstatus = Config::get('jayon.devmanifest_default_excl_status');
         if (!empty($exstatus)) {
             //$model = $model->whereNotIn('status', $exstatus);
         }
     } else {
         //$model = $model->whereIn('status', $status);
     }
     /*
     if($courierstatus == '' || is_null($courierstatus) ){
         $courierstatus = Config::get('jayon.devmanifest_default_courier_status');
     }else{
         $courierstatus = explode(',', $courierstatus);
     }
     
     if(empty($courierstatus)){
         $excrstatus = Config::get('jayon.devmanifest_default_excl_courier_status');
     
         if(!empty($excrstatus)){
             $model = $model->whereNotIn('courier_status', $excrstatus);
         }
     }else{
         $model = $model->whereIn('courier_status', $courierstatus);
     }
     */
     if ($period_from == '' || is_null($period_from)) {
         $datefrom = date('Y-m-d 00:00:00', strtotime($period_from));
         $dateto = date('Y-m-d 23:59:59', strtotime($period_to));
     } else {
         $datefrom = date('Y-m-d 00:00:00', strtotime($period_from));
         $dateto = date('Y-m-d 23:59:59', strtotime($period_to));
         $model = $model->where(function ($q) use($datefrom, $dateto) {
             $q->whereBetween('assignment_date', array($datefrom, $dateto));
         });
     }
     if ($device == '' || is_null($device)) {
     } else {
         $model = $model->where('device_id', '=', $device);
     }
     if ($courier == '' || is_null($courier)) {
     } else {
         $model = $model->where('courier_id', '=', $courier);
     }
     if ($logistic == '' || is_null($logistic)) {
     } else {
         $model = $model->where('logistic', '=', $logistic);
     }
     /*
     ->where('status',$this->config->item('trans_status_admin_courierassigned'))
     ->or_where('status',$this->config->item('trans_status_mobile_pickedup'))
     ->or_where('status',$this->config->item('trans_status_mobile_enroute'))
     ->or_()
         ->group_start()
             ->where('status',$this->config->item('trans_status_new'))
             ->where('pending_count >', 0)
         ->group_end()
     */
     $model = $model->where(function ($qr) {
         $qr->where('status', Config::get('jayon.trans_status_admin_courierassigned'))->orWhere('status', Config::get('jayon.trans_status_mobile_pickedup'))->orWhere('status', Config::get('jayon.trans_status_mobile_enroute'))->orWhere(function ($q) {
             $q->where('status', Config::get('jayon.trans_status_new'))->where('pending_count', '>', 0);
         });
     });
     $actualresult = $model->get();
     $tattrs = array('width' => '100%', 'class' => 'table table-bordered table-striped');
     $thead = array();
     $thead[] = array(array('value' => 'No.', 'attr' => ''), array('value' => 'Zone', 'attr' => ''), array('value' => 'TOKO ONLINE', 'attr' => ''), array('value' => 'Type', 'attr' => ''), array('value' => 'Status', 'attr' => ''), array('value' => 'KEPADA', 'attr' => ''), array('value' => 'Total Price', 'attr' => ''), array('value' => 'Delivery Charge', 'attr' => ''), array('value' => 'COD Surcharge', 'attr' => ''), array('value' => 'Total Charge', 'attr' => ''), array('value' => 'ALAMAT', 'attr' => ''), array('value' => 'Phone', 'attr' => ''), array('value' => 'No Kode Penjualan Toko', 'attr' => ''), array('value' => 'PENERIMA PAKET', 'attr' => 'colspan="2"'));
     $thead[] = array(array('value' => 'Mohon tunjukkan kartu identitas untuk di foto sebagai bagian bukti penerimaan', 'attr' => 'style="text-align:center;" colspan="13"'), array('value' => 'TANDA TANGAN', 'attr' => ''), array('value' => 'NAMA', 'attr' => 'class="bold center" style="width:50px" '));
     $tabdata = array();
     $seq = 1;
     $total_billing = 0;
     $total_delivery = 0;
     $total_cod = 0;
     $d = 0;
     $gt = 0;
     $lastdate = '';
     $courier_name = '';
     $counts = array('Delivery Only' => 0, 'COD' => 0, 'CCOD' => 0, 'PS' => 0, 'pending' => 0);
     foreach ($actualresult as $r) {
         $counts[$r->delivery_type] += 1;
         if ($r->pending_count > 0) {
             $counts['pending'] += 1;
         }
         $courier_name = $r->courier_name;
         //$total = str_replace(array(',','.'), '', $r->total_price);
         //$dsc = str_replace(array(',','.'), '', $r->total_discount);
         //$tax = str_replace(array(',','.'), '',$r->total_tax);
         //$dc = str_replace(array(',','.'), '',$r->delivery_cost);
         //$cod = str_replace(array(',','.'), '',$r->cod_cost);
         $total = $r->total_price;
         $dsc = $r->total_discount;
         $tax = $r->total_tax;
         $dc = $r->delivery_cost;
         $cod = $r->cod_cost;
         $total = is_nan((double) $total) ? 0 : (double) $total;
         $dsc = is_nan((double) $dsc) ? 0 : (double) $dsc;
         $tax = is_nan((double) $tax) ? 0 : (double) $tax;
         $dc = is_nan((double) $dc) ? 0 : (double) $dc;
         $cod = is_nan((double) $cod) ? 0 : (double) $cod;
         $payable = 0;
         //$details = $this->db->
         //where('delivery_id',$r->delivery_id)->order_by('unit_sequence','asc')->get($this->config->item('delivery_details_table'));
         //$details = $details->result_array();
         $details = Deliverydetail::where('delivery_id', '=', $r->delivery_id)->orderBy('unit_sequence', 'asc')->get()->toArray();
         $d = 0;
         $gt = 0;
         foreach ($details as $value => $key) {
             $u_total = $key['unit_total'];
             $u_discount = $key['unit_discount'];
             $gt += is_nan((double) $u_total) ? 0 : (double) $u_total;
             $d += is_nan((double) $u_discount) ? 0 : (double) $u_discount;
         }
         if ($gt == 0) {
             if ($total > 0 && $payable) {
                 $gt = $total;
             }
         }
         $payable = $gt;
         $total_delivery += (double) $dc;
         $total_cod += (double) $cod;
         $total_billing += (double) $payable;
         $db = '';
         if ($r->delivery_bearer == 'merchant') {
             $dc = 0;
             $db = 'M';
         } else {
             $db = 'B';
         }
         //force all DO to zero
         $cb = '';
         if ($r->cod_bearer == 'merchant') {
             $cod = 0;
             $cb = 'M';
         } else {
             $cb = 'B';
         }
         $codclass = '';
         if ($r->delivery_type == 'COD' || $r->delivery_type == 'CCOD') {
             $chg = $gt - $dsc + $tax + $dc + $cod;
             //$chg = $gt + $dc + $cod;
             $codclass = 'cod';
         } else {
             $dc = 0;
             $cod = 0;
             $chg = $dc;
         }
         $fcode = $r->fulfillment_code == '' ? '' : '<hr />' . $r->fulfillment_code;
         $phone_dupe = $r->same_phone == 1 ? 'class="dupe"' : '';
         $email_dupe = $r->same_email == 1 ? 'class="dupe"' : '';
         $tabdata[] = array(array('value' => $seq, 'attr' => ''), array('value' => $r->buyerdeliveryzone, 'attr' => ''), array('value' => $r->merchant_name, 'attr' => ''), array('value' => $r->delivery_type, 'attr' => 'class="currency ' . $codclass . '" '), array('value' => $r->status . '<br /><br />' . $r->pickup_status . '<br /><br />' . $r->warehouse_status, 'attr' => ''), array('value' => $r->buyer_name, 'attr' => ''), array('value' => $payable == 0 ? 0 : Ks::idr($payable), 'attr' => 'class="currency ' . $codclass . '" '), array('value' => $dc == 0 ? 0 : Ks::idr($dc), 'attr' => 'class="currency ' . $codclass . '" style="position:relative;"'), array('value' => $cod == 0 ? 0 : Ks::idr($cod), 'attr' => 'class="currency ' . $codclass . '" style="position:relative;"'), array('value' => $chg == 0 ? 0 : Ks::idr($chg), 'attr' => 'class="currency ' . $codclass . '" '), array('value' => $r->shipping_address, 'attr' => ''), array('value' => '<span ' . $phone_dupe . ' >' . $this->split_phone($r->phone) . '<br />' . $this->split_phone($r->mobile1) . '<br />' . $this->split_phone($r->mobile2) . '</span>', 'attr' => ''), array('value' => $this->hide_trx($r->merchant_trans_id) . $fcode . '<br/>' . $this->date_did($r->delivery_id), 'attr' => 'class="currency cod"'), array('value' => '', 'attr' => ''), array('value' => '', 'attr' => ''));
         $seq++;
     }
     $mtable = new HtmlTable($tabdata, $tattrs, $thead);
     $tables[] = $mtable->build();
     $this->table_raw = $tables;
     if ($this->print == true || $this->pdf == true) {
         return $tables;
     } else {
         return parent::reportPageGenerator();
     }
 }
Exemple #26
0
 /**
  * create Table
  *
  * @param array $attributes
  * @return HtmlTable
  */
 public static function table($attributes = array())
 {
     return HtmlTable::create($attributes);
 }
Exemple #27
0
        if ($numberRoles === 1) {
            // link to assign or remove members if you are allowed to do it
            if ($role->allowedToAssignMembers($gCurrentUser)) {
                $listsMenu->addItem('menu_item_assign_members', $g_root_path . '/adm_program/modules/lists/members_assignment.php?rol_id=' . $role->getValue('rol_id'), $gL10n->get('SYS_ASSIGN_MEMBERS'), 'add.png');
            }
        }
        // link to print overlay and exports
        $listsMenu->addItem('menu_item_print_view', '#', $gL10n->get('LST_PRINT_PREVIEW'), 'print.png');
        $form = new HtmlForm('navbar_export_to_form', '', $page, array('type' => 'navbar', 'setFocus' => false));
        $selectBoxEntries = array('' => $gL10n->get('LST_EXPORT_TO') . ' ...', 'csv-ms' => $gL10n->get('LST_MICROSOFT_EXCEL') . ' (' . $gL10n->get('SYS_ISO_8859_1') . ')', 'pdf' => $gL10n->get('SYS_PDF') . ' (' . $gL10n->get('SYS_PORTRAIT') . ')', 'pdfl' => $gL10n->get('SYS_PDF') . ' (' . $gL10n->get('SYS_LANDSCAPE') . ')', 'csv-oo' => $gL10n->get('SYS_CSV') . ' (' . $gL10n->get('SYS_UTF8') . ')');
        $form->addSelectBox('export_list_to', null, $selectBoxEntries, array('showContextDependentFirstEntry' => false));
        $listsMenu->addForm($form->show(false));
        $table = new HtmlTable('adm_lists_table', $page, $hoverRows, $datatable, $classTable);
        $table->setDatatablesRowsPerPage($gPreferences['lists_members_per_page']);
    } else {
        $table = new HtmlTable('adm_lists_table', $page, $hoverRows, $datatable, $classTable);
    }
}
// initialize array parameters for table and set the first column for the counter
if ($getMode === 'html') {
    // in html mode we group leaders. Therefore we need a special hidden column.
    $columnAlign = array('left', 'left');
    $columnValues = array($gL10n->get('SYS_ABR_NO'), $gL10n->get('INS_GROUPS'));
} else {
    $columnAlign = array('left');
    $columnValues = array($gL10n->get('SYS_ABR_NO'));
}
// headlines for columns
for ($columnNumber = 1; $columnNumber <= $list->countColumns(); ++$columnNumber) {
    $column = $list->getColumnObject($columnNumber);
    // Find name of the field
    }
}
// create html page object
$page = new HtmlPage($headline);
// add back link to module menu
$profileFieldHistoryMenu = $page->getMenu();
$profileFieldHistoryMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png');
// create filter menu with input elements for Startdate and Enddate
$FilterNavbar = new HtmlNavbar('menu_profile_field_history_filter', null, null, 'filter');
$form = new HtmlForm('navbar_filter_form', $g_root_path . '/adm_program/modules/members/profile_field_history.php?usr_id=' . $getUserId, $page, array('type' => 'navbar', 'setFocus' => false));
$form->addInput('filter_date_from', $gL10n->get('SYS_START'), $dateFromHtml, array('type' => 'date', 'maxLength' => 10));
$form->addInput('filter_date_to', $gL10n->get('SYS_END'), $dateToHtml, array('type' => 'date', 'maxLength' => 10));
$form->addSubmitButton('btn_send', $gL10n->get('SYS_OK'));
$FilterNavbar->addForm($form->show(false));
$page->addHtml($FilterNavbar->show(false));
$table = new HtmlTable('profile_field_history_table', $page, true, true);
$columnHeading = array();
if ($getUserId === 0) {
    $table->setDatatablesOrderColumns(array(array(6, 'desc')));
    $columnHeading[] = $gL10n->get('SYS_NAME');
} else {
    $table->setDatatablesOrderColumns(array(array(5, 'desc')));
}
$columnHeading[] = $gL10n->get('SYS_FIELD');
$columnHeading[] = $gL10n->get('SYS_NEW_VALUE');
$columnHeading[] = $gL10n->get('SYS_PREVIOUS_VALUE');
$columnHeading[] = $gL10n->get('SYS_EDITED_BY');
$columnHeading[] = $gL10n->get('SYS_CHANGED_AT');
$table->addRowHeadingByArray($columnHeading);
while ($row = $fieldHistoryStatement->fetch()) {
    $timestampCreate = new DateTimeExtended($row['usl_timestamp_create'], 'Y-m-d H:i:s');
Exemple #29
0
            // Nun erst mal die neue Position von der gewaehlten Kategorie aktualisieren
            $.get(gRootPath + "/adm_program/modules/categories/categories_function.php?cat_id=" + catID + "&type=' . $getType . '&mode=4&sequence=" + direction);
        }
    }');
$htmlIconLoginUser = '******';
if ($getType !== 'USF') {
    $htmlIconLoginUser = '******' . THEME_PATH . '/icons/user_key.png" alt="' . $gL10n->get('SYS_VISIBLE_TO_USERS', $getTitle) . '" title="' . $gL10n->get('SYS_VISIBLE_TO_USERS', $getTitle) . '" />';
}
// get module menu
$categoriesMenu = $page->getMenu();
// show back link
$categoriesMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png');
// define link to create new category
$categoriesMenu->addItem('admMenuItemNewCategory', $g_root_path . '/adm_program/modules/categories/categories_new.php?type=' . $getType . '&amp;title=' . $getTitle, $gL10n->get('SYS_CREATE_VAR', $addButtonText), 'add.png');
// Create table object
$categoriesOverview = new HtmlTable('tbl_categories', $page, true);
// create array with all column heading values
$columnHeading = array($gL10n->get('SYS_TITLE'), '&nbsp;', $htmlIconLoginUser, '<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/star.png" alt="' . $gL10n->get('CAT_DEFAULT_VAR', $getTitle) . '" title="' . $gL10n->get('CAT_DEFAULT_VAR', $getTitle) . '" />', '&nbsp;');
$categoriesOverview->setColumnAlignByArray(array('left', 'left', 'left', 'left', 'right'));
$categoriesOverview->addRowHeadingByArray($columnHeading);
$sql = 'SELECT *
          FROM ' . TBL_CATEGORIES . '
         WHERE (  cat_org_id  = ' . $gCurrentOrganization->getValue('org_id') . '
               OR cat_org_id IS NULL )
           AND cat_type   = \'' . $getType . '\'
      ORDER BY cat_sequence ASC';
$categoryStatement = $gDb->query($sql);
$flagTbodyWritten = false;
$flagTbodyAllOrgasWritten = false;
$category = new TableCategory($gDb);
// Get data
 public function getIndex()
 {
     $this->heads = array(array('Period', array('search' => true, 'sort' => true, 'style' => 'min-width:90px;', 'daterange' => true)), array('Date', array('search' => true, 'sort' => true, 'style' => 'min-width:100px;', 'daterange' => true)), array('JV Ref', array('search' => true, 'sort' => true, 'style' => 'min-width:120px;')), array('Account', array('search' => true, 'style' => 'min-width:100px;', 'sort' => true)), array('Account Description', array('search' => true, 'style' => 'min-width:125px;', 'sort' => true)), array('Reference Doc.', array('search' => true, 'sort' => true)), array('Orig. Currency', array('search' => true, 'sort' => true)), array('Orig. Amount', array('search' => true, 'sort' => true)), array('Conversion Rate', array('search' => true, 'sort' => true)), array('Base Amount', array('search' => true, 'sort' => true)), array('Transaction Description', array('search' => true, 'sort' => true)));
     //print $this->model->where('docFormat','picture')->get()->toJSON();
     $this->title = 'Statement of Operation Account Balance';
     $this->place_action = 'none';
     $this->can_add = false;
     $this->show_select = false;
     Breadcrumbs::addCrumb('Cost Report', URL::to(strtolower($this->controller_name)));
     $db = Config::get('lundin.main_db');
     $company = Input::get('acc-company');
     //print $prior_year;
     $company = strtolower($company);
     if ($company == '') {
         $company = Config::get('lundin.default_company');
     }
     $companylist = Prefs::getCompany(array('key' => 'DB_CODE', 'sign' => '=', 'value' => $company))->CompanyToArray()->toArray();
     if (count($companylist) > 0) {
         $companyname = $companylist[0]['DESCR'];
     } else {
         $companyname = '';
     }
     $afe = Input::get('acc-afe');
     if ($afe == '' || is_null($afe)) {
         $afes = Prefs::getAfe($company)->AfeToArray();
         $afe = $afes[0]->ANL_CODE;
     }
     $company = strtolower($company);
     $maxperiod = Prefs::latestPeriod($company . '_a_salfldg');
     $period_from = Input::get('acc-period-from');
     $period_to = Input::get('acc-period-to');
     if ($period_from == '' || is_null($period_from)) {
         $period_from = $maxperiod;
     }
     // test value
     //$period_from = '2015001';
     if ($period_to == '' || is_null($period_to)) {
         $period_to = date('Y0m', time());
     }
     $prior_year = substr($period_from, 0, 4);
     $prior_year = $prior_year - 1;
     $prior_year .= '012';
     $this->additional_filter = View::make(strtolower($this->controller_name) . '.addfilter')->with('maxperiod', $period_from)->with('submit_url', 'jvsoab')->render();
     $this->def_order_by = 'TRANS_DATETIME';
     $this->def_order_dir = 'DESC';
     $this->place_action = 'none';
     $this->show_select = false;
     $this->sql_key = 'TRANS_DATETIME';
     $this->sql_table_name = $company . '_a_salfldg';
     $this->sql_connection = 'mysql2';
     /* Start custom queries */
     $model = DB::connection($this->sql_connection)->table($this->sql_table_name);
     $tables = array();
     //current month
     $currentmonthset = array();
     $titlekeys = array();
     $sectiontitle = array();
     foreach (Config::get('accgroup.jvsoab') as $sec => $data) {
         $sectiontitle[$data['key']] = $sec;
         $section = $data['key'];
         foreach ($data['data'] as $h => $v) {
             if ($v['is_head']) {
             } else {
                 $titlekeys[$section][$v['key']] = $h;
             }
         }
         foreach ($data['data'] as $h => $v) {
             if ($v['is_head']) {
             } else {
                 $model = DB::connection($this->sql_connection)->table($this->sql_table_name);
                 $model = $model->select(DB::raw($company . '_a_salfldg.ACCNT_CODE,' . $company . '_acnt.DESCR AS ADESCR,' . 'SUM(' . $company . '_a_salfldg.AMOUNT) as AMT'));
                 if ($v['sql'] == 'in') {
                     $model = $model->whereIn($company . '_a_salfldg.ACCNT_CODE', explode(',', $v['val']));
                 } elseif ($v['sql'] == 'like') {
                     if (is_array($v['val'])) {
                         $vals = $v['val'];
                         $model = $model->where(function ($q) use($vals, $company) {
                             foreach ($vals as $nval) {
                                 $q = $q->whereOr($company . '_a_salfldg.ACCNT_CODE', 'like', $nval);
                             }
                         });
                     } else {
                         $model = $model->where($company . '_a_salfldg.ACCNT_CODE', 'like', $v['val']);
                     }
                 }
                 $res = $model->where($company . '_a_salfldg.PERIOD', '=', $period_from)->leftJoin($company . '_acnt', $company . '_a_salfldg.ACCNT_CODE', '=', $company . '_acnt.ACNT_CODE')->groupBy($company . '_a_salfldg.ACCNT_CODE')->get();
                 $currentmonthset[$section][$v['key']] = $res;
             }
         }
         //priormonth ITD
         $priormonthset = array();
         foreach ($data['data'] as $h => $v) {
             if ($v['is_head']) {
             } else {
                 $model = DB::connection($this->sql_connection)->table($this->sql_table_name);
                 $model = $model->select(DB::raw($company . '_a_salfldg.ACCNT_CODE,' . $company . '_acnt.DESCR AS ADESCR,' . 'SUM(' . $company . '_a_salfldg.AMOUNT) as AMT'));
                 if ($v['sql'] == 'in') {
                     $model = $model->whereIn($company . '_a_salfldg.ACCNT_CODE', explode(',', $v['val']));
                 } elseif ($v['sql'] == 'like') {
                     if (is_array($v['val'])) {
                         $vals = $v['val'];
                         $model = $model->where(function ($q) use($vals, $company) {
                             foreach ($vals as $nval) {
                                 $q = $q->whereOr($company . '_a_salfldg.ACCNT_CODE', 'like', $nval);
                             }
                         });
                     } else {
                         $model = $model->where($company . '_a_salfldg.ACCNT_CODE', 'like', $v['val']);
                     }
                 }
                 $res = $model->where($company . '_a_salfldg.PERIOD', '<', $period_from)->leftJoin($company . '_acnt', $company . '_a_salfldg.ACCNT_CODE', '=', $company . '_acnt.ACNT_CODE')->groupBy($company . '_a_salfldg.ACCNT_CODE')->get();
                 $priormonthset[$section][$v['key']] = $res;
             }
         }
         //print_r($priormonthset);
         //currentmonth ITD
         $currentmonthitdset = array();
         foreach ($data['data'] as $h => $v) {
             if ($v['is_head']) {
             } else {
                 $model = DB::connection($this->sql_connection)->table($this->sql_table_name);
                 $model = $model->select(DB::raw($company . '_a_salfldg.ACCNT_CODE,' . $company . '_acnt.DESCR AS ADESCR,' . 'SUM(' . $company . '_a_salfldg.AMOUNT) as AMT'));
                 if ($v['sql'] == 'in') {
                     $model = $model->whereIn($company . '_a_salfldg.ACCNT_CODE', explode(',', $v['val']));
                 } elseif ($v['sql'] == 'like') {
                     if (is_array($v['val'])) {
                         $vals = $v['val'];
                         $model = $model->where(function ($q) use($vals, $company) {
                             foreach ($vals as $nval) {
                                 $q = $q->whereOr($company . '_a_salfldg.ACCNT_CODE', 'like', $nval);
                             }
                         });
                     } else {
                         $model = $model->where($company . '_a_salfldg.ACCNT_CODE', 'like', $v['val']);
                     }
                 }
                 $res = $model->where($company . '_a_salfldg.PERIOD', '<=', $period_from)->leftJoin($company . '_acnt', $company . '_a_salfldg.ACCNT_CODE', '=', $company . '_acnt.ACNT_CODE')->groupBy($company . '_a_salfldg.ACCNT_CODE')->get();
                 $currentmonthitdset[$section][$v['key']] = $res;
             }
         }
         //print_r($currentmonthitdset);
         //prioryear ITD
         $prioryearset = array();
         foreach ($data['data'] as $h => $v) {
             if ($v['is_head']) {
             } else {
                 $model = DB::connection($this->sql_connection)->table($this->sql_table_name);
                 $model = $model->select(DB::raw($company . '_a_salfldg.ACCNT_CODE,' . $company . '_acnt.DESCR AS ADESCR,' . 'SUM(' . $company . '_a_salfldg.AMOUNT) as AMT'));
                 if ($v['sql'] == 'in') {
                     $model = $model->whereIn($company . '_a_salfldg.ACCNT_CODE', explode(',', $v['val']));
                 } elseif ($v['sql'] == 'like') {
                     if (is_array($v['val'])) {
                         $vals = $v['val'];
                         $model = $model->where(function ($q) use($vals, $company) {
                             foreach ($vals as $nval) {
                                 $q = $q->whereOr($company . '_a_salfldg.ACCNT_CODE', 'like', $nval);
                             }
                         });
                     } else {
                         $model = $model->where($company . '_a_salfldg.ACCNT_CODE', 'like', $v['val']);
                     }
                 }
                 $res = $model->where($company . '_a_salfldg.PERIOD', '<', $period_from)->leftJoin($company . '_acnt', $company . '_a_salfldg.ACCNT_CODE', '=', $company . '_acnt.ACNT_CODE')->groupBy($company . '_a_salfldg.ACCNT_CODE')->get();
                 $prioryearset[$section][$v['key']] = $res;
             }
         }
         //print_r($prioryearset);
     }
     //die();
     $tabdata = array();
     foreach (Config::get('accgroup.jvsoab') as $sec => $data) {
         $section = $data['key'];
         foreach ($data['data'] as $h => $v) {
             $key = $v['key'];
             $dt = array();
             foreach ($currentmonthset[$section][$key] as $data) {
                 $data->PMAMT = 0;
                 $data->CMITDAMT = 0;
                 $data->PYAMT = 0;
                 $tabdata[$section][$key][$data->ACCNT_CODE] = $data;
             }
             //$tabdata[$section] = $dt;
             if (isset($priormonthset[$section][$key])) {
                 foreach ($priormonthset[$section][$key] as $data) {
                     if (isset($tabdata[$section][$key][$data->ACCNT_CODE])) {
                         $tabdata[$section][$key][$data->ACCNT_CODE]->PMAMT = $data->AMT;
                     } else {
                         $ndt = new stdClass();
                         $ndt->ADESCR = $data->ADESCR;
                         $ndt->AMT = 0;
                         $ndt->PMAMT = $data->AMT;
                         $ndt->CMITDAMT = 0;
                         $ndt->PYAMT = 0;
                         $tabdata[$section][$key][$data->ACCNT_CODE] = $ndt;
                     }
                 }
             }
             if (isset($currentmonthitdset[$section][$key])) {
                 foreach ($currentmonthitdset[$section][$key] as $data) {
                     if (isset($tabdata[$section][$key][$data->ACCNT_CODE])) {
                         $tabdata[$section][$key][$data->ACCNT_CODE]->CMITDAMT = $data->AMT;
                     } else {
                         $ndt = new stdClass();
                         $ndt->ADESCR = $data->ADESCR;
                         $ndt->AMT = 0;
                         $ndt->PMAMT = 0;
                         $ndt->CMITDAMT = $data->AMT;
                         $ndt->PYAMT = 0;
                         $tabdata[$section][$key][$data->ACCNT_CODE] = $ndt;
                     }
                 }
             }
             if (isset($prioryearset[$section][$key])) {
                 foreach ($prioryearset[$section][$key] as $data) {
                     if (isset($tabdata[$section][$key][$data->ACCNT_CODE])) {
                         $tabdata[$section][$key][$data->ACCNT_CODE]->PYAMT = $data->AMT;
                     } else {
                         $ndt = new stdClass();
                         $ndt->ADESCR = $data->ADESCR;
                         $ndt->AMT = 0;
                         $ndt->PMAMT = 0;
                         $ndt->CMITDAMT = $data->AMT;
                         $ndt->PYAMT = 0;
                         $tabdata[$section][$key][$data->ACCNT_CODE] = $ndt;
                     }
                 }
             }
         }
     }
     //print_r($tabdata);
     //die();
     //ksort($tabdata);
     $period_year = substr($period_from, 0, 4);
     $period_month = substr($period_from, 5, 2);
     $period_month = date('F', strtotime($period_year . '-' . $period_month));
     $tattrs = array('width' => '100%', 'class' => 'table table-bordered');
     $thead = array();
     $thead[] = array(array('value' => '<h2>' . $companyname . '<h2>', 'attr' => 'colspan="9"'));
     $thead[] = array(array('value' => '<h2>' . $this->title . '<h2>', 'attr' => 'colspan="9"'));
     $thead[] = array(array('value' => '<h2>' . $period_month . ' ' . $period_year . '<h2>', 'attr' => 'colspan="9"'));
     $thead[] = array(array('value' => '', 'attr' => 'colspan=4'), array('value' => 'Prior Month ITD'), array('value' => 'Current Month'), array('value' => 'Current Month ITD'), array('value' => 'Prior Year ITD'), array('value' => 'Current YTD'));
     /*
     $thead[] = array(
             array('value'=>'','attr'=>'colspan=4'),
             array('value'=>'ITD'),
             array('value'=>''),
             array('value'=>'ITD'),
             array('value'=>'ITD'),
             array('value'=>'Movement')
         );
     */
     $seq = 1;
     $tdata = array();
     $ck = '';
     //print_r($titlekeys);
     //print_r($sectiontitle);
     //print_r($tabdata);
     //die();
     foreach ($tabdata as $k => $dm) {
         //print($k);
         //print $k;
         //if($ck != $k){
         $tdata[] = array(array('value' => '<h2>' . $sectiontitle[$k] . '</h2>', 'attr' => 'colspan="4"'), array('value' => '', 'attr' => 'class="column-amt"'), array('value' => '', 'attr' => 'class="column-amt"'), array('value' => '', 'attr' => 'class="column-amt"'), array('value' => '', 'attr' => 'class="column-amt"'), array('value' => '', 'attr' => 'class="column-amt"'));
         //}
         foreach ($dm as $ac => $md) {
             $tdata[] = array(array('value' => '&nbsp;'), array('value' => '<h3>' . $titlekeys[$k][$ac] . '</h3>', 'attr' => 'colspan="3"'), array('value' => '', 'attr' => 'class="column-amt"'), array('value' => '', 'attr' => 'class="column-amt"'), array('value' => '', 'attr' => 'class="column-amt"'), array('value' => '', 'attr' => 'class="column-amt"'), array('value' => '', 'attr' => 'class="column-amt"'));
             /*
             $tdata[] = array(
                     array('value'=> $titlekeys[$k][$dm['key']], 'attr'=>'colspan="3"'),
                     array('value'=>'', 'attr'=>'class="column-amt"' ),
                     array('value'=>'', 'attr'=>'class="column-amt"' ),
                     array('value'=>'', 'attr'=>'class="column-amt"' ),
                     array('value'=>'', 'attr'=>'class="column-amt"' ),
                     array('value'=>'', 'attr'=>'class="column-amt"' )
                 );
             */
             //print_r($md);
             $sum = new stdClass();
             $sum->PMAMT = 0;
             $sum->AMT = 0;
             $sum->CMITDAMT = 0;
             $sum->PYAMT = 0;
             $sum->movement = 0;
             foreach ($md as $mk => $m) {
                 $movement = $m->CMITDAMT - $m->PYAMT;
                 $sum->PMAMT += (double) $m->PMAMT;
                 $sum->AMT += (double) $m->AMT;
                 $sum->CMITDAMT += (double) $m->CMITDAMT;
                 $sum->PYAMT += (double) $m->PYAMT;
                 $sum->movement += (double) $movement;
                 $movement = 0;
                 $tdata[] = array(array('value' => '&nbsp;'), array('value' => '&nbsp;'), array('value' => $mk), array('value' => $m->ADESCR), array('value' => $m->PMAMT, 'attr' => 'class="column-amt"'), array('value' => $m->AMT, 'attr' => 'class="column-amt"'), array('value' => $m->CMITDAMT, 'attr' => 'class="column-amt"'), array('value' => $m->PYAMT, 'attr' => 'class="column-amt"'), array('value' => $movement, 'attr' => 'class="column-amt"'));
                 $seq++;
             }
         }
         $tdata[] = array(array('value' => '<h3> TOTAL ' . $sectiontitle[$k] . '</h3>', 'attr' => 'colspan="4"'), array('value' => $sum->PMAMT, 'attr' => 'class="column-amt total"'), array('value' => floatval($sum->AMT), 'attr' => 'class="column-amt total"'), array('value' => $sum->CMITDAMT, 'attr' => 'class="column-amt total"'), array('value' => $sum->PYAMT, 'attr' => 'class="column-amt total"'), array('value' => $sum->movement, 'attr' => 'class="column-amt total"'));
         $tdata[] = array(array('value' => '', 'attr' => 'colspan="4"'), array('value' => '', 'attr' => 'class="column-amt total"'), array('value' => '', 'attr' => 'class="column-amt total"'), array('value' => '', 'attr' => 'class="column-amt total"'), array('value' => '', 'attr' => 'class="column-amt total"'), array('value' => '', 'attr' => 'class="column-amt total"'));
     }
     //print_r($tdata);
     //die();
     $mtable = new HtmlTable($tdata, $tattrs, $thead);
     $tables[] = $mtable->build();
     $this->table_raw = $tables;
     if ($this->print == true) {
         return $tables;
     } else {
         return parent::reportPageGenerator();
     }
 }