File: /www/wwwroot/oa.sanjiangapp.com/app/crm/order/view/browse.html.php
<?php
/**
* The browse view file of order module of ZDOO.
*
* @copyright Copyright 2009-2018 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Tingting Dai <daitingting@xirangit.com>
* @package order
* @version $Id$
* @link http://www.zdoo.com
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('mode', $mode);?>
<?php js::set('currencySign', $currencySign);?>
<?php js::set('checkedSummary', $lang->order->checkedSummary);?>
<?php $canBatchAssign = commonModel::hasPriv('order', 'batchAssign');?>
<?php $extendFields = $this->order->getFlowExtendFields();?>
<li id='bysearchTab'><?php echo html::a('#', "<i class='icon-search icon'></i>" . $lang->search->common)?></li>
<div id='menuActions'>
<?php if(commonModel::hasPriv('order', 'export')):?>
<div class='btn-group'>
<button data-toggle='dropdown' class='btn btn-secondary dropdown-toggle' type='button'><?php echo $lang->exportIcon . $lang->export;?> <span class='caret'></span></button>
<ul id='exportActionMenu' class='dropdown-menu'>
<li><?php commonModel::printLink('order', 'export', "mode=all", $lang->exportAll, "class='iframe' data-width='700'");?></li>
<li><?php commonModel::printLink('order', 'export', "mode=thisPage", $lang->exportThisPage, "class='iframe' data-width='700'");?></li>
</ul>
</div>
<?php endif;?>
<?php commonModel::printLink('order', 'create', '', '<i class="icon-plus"></i> ' . $lang->order->create, 'class="btn btn-primary"');?>
</div>
<div class='panel main-table'>
<?php if($canBatchAssign):?>
<form id='ajaxForm' method='post'>
<?php endif;?>
<table class='table has-sort-head'>
<thead>
<tr class='text-center'>
<?php $vars = "mode={$mode}&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<th class='w-80px text-left'>
<?php if($orders):?>
<div class='checkbox-primary check-all' title='<?php echo $this->lang->selectAll;?>'><label></label></div>
<?php endif;?>
<?php commonModel::printOrderLink('o.id', $orderBy, $vars, $lang->order->id);?>
</th>
<th class='w-60px'><?php commonModel::printOrderLink('c.level', $orderBy, $vars, $lang->customer->level);?></th>
<th class='text-left'><?php commonModel::printOrderLink('o.customer', $orderBy, $vars, $lang->order->customer);?></th>
<th class='w-130px'><?php commonModel::printOrderLink('o.product', $orderBy, $vars, $lang->order->product);?></th>
<th class='w-90px'><?php commonModel::printOrderLink('o.plan', $orderBy, $vars, $lang->order->plan);?></th>
<th class='w-90px'><?php commonModel::printOrderLink('o.real', $orderBy, $vars, $lang->order->real);?></th>
<th class='w-90px'><?php commonModel::printOrderLink('o.assignedTo', $orderBy, $vars, $lang->order->assignedTo);?></th>
<th class='w-70px'><?php commonModel::printOrderLink('o.status', $orderBy, $vars, $lang->order->status);?></th>
<th class='w-90px'><?php commonModel::printOrderLink('o.contactedDate', $orderBy, $vars, $lang->order->contactedDate);?></th>
<?php
/* The next date is searched from the table crm_dating, so use date instead of nextDate to avoid occur errors when order by this field. */
$date = strpos(',past,today,tomorrow,thisweek,thismonth,', ",{$mode},") != false ? 'd.date' : 'o.nextDate';
?>
<th class='w-110px'><?php commonModel::printOrderLink($date, $orderBy, $vars, $lang->order->nextDate);?></th>
<?php foreach($extendFields as $extendField) echo "<th class='" . ($extendField->width != 'auto' ? "w-{$extendField->width}px" : '') . "'>{$extendField->name}</th>";?>
<th class='w-<?php echo $lang->order->actionWidth;?>px text-center'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
<?php if(!empty($orders)) foreach($orders as $order):?>
<?php $status = $order->status != 'closed' ? "order-{$order->status}" : "order-{$order->closedReason}"?>
<tr data-id='<?php echo $order->id;?>' data-plan='<?php echo $order->plan;?>' data-real='<?php echo $order->real;?>' data-currency='<?php echo $order->currency;?>' class='text-center'>
<?php $products = ''; foreach($order->products as $product) $products .= $product . ' ';?>
<td class='text-left'>
<div class='checkbox-primary'><input type='checkbox' name='orderIDList[]' value="<?php echo $order->id;?>" id="orderIDList<?php echo $order->id;?>">
<label for="orderIDList<?php echo $order->id;?>"></label>
</div>
<?php echo $order->id;?>
</td>
<td><?php echo zget($lang->customer->levelNameList, $order->level, $order->level);?></td>
<td class='c-name text-left' title='<?php echo $order->customerName;?>'><?php echo $order->customerName;?></td>
<td title='<?php echo $products;?>'><?php echo $products;?></td>
<td class='text-right'><?php echo zget($currencySign, $order->currency, '') . formatMoney($order->plan);?></td>
<td class='text-right'><?php echo zget($currencySign, $order->currency, '') . formatMoney($order->real);?></td>
<td><?php if(isset($users[$order->assignedTo])) echo $users[$order->assignedTo];?></td>
<td class="<?php echo $status;?>">
<?php if($order->status != 'closed') echo zget($lang->order->statusList, $order->status);?>
<?php if($order->status == 'closed') echo $order->closedReason ? $lang->order->closedReasonList[$order->closedReason] : $lang->order->statusList['closed'];?>
</td>
<td><?php echo formatTime($order->contactedDate, DT_DATE1);?></td>
<td><?php echo formatTime($order->nextDate, DT_DATE1);?></td>
<?php foreach($extendFields as $extendField) echo "<td>" . $this->loadModel('flow')->getFieldValue($extendField, $order) . "</td>";?>
<td class='actions'>
<?php commonModel::printLink('crm.order', 'view', "orderID=$order->id", $lang->view);?>
<?php commonModel::printLink('action', 'createRecord', "objectType=order&objectID={$order->id}&customer={$order->customer}", $lang->order->record, "data-toggle='modal' data-width='800'");?>
<?php commonModel::printLink('customer', 'contact', "customerID={$order->customer}", $lang->order->contact, "data-toggle='modal' data-width='950'");?>
<?php if($order->status == 'normal'):?>
<?php commonModel::printLink('crm.contract', 'create', "type=sale&customerID={$order->customer}&orderID={$order->id}", $this->lang->order->sign);?>
<?php else:?>
<?php echo html::a('javascript:;', $this->lang->order->sign, "class='disabled'");?>
<?php endif;?>
<?php echo $this->buildOperateMenu($order, 'browse');?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<div class='table-footer'>
<?php if($orders):?>
<div class='checkbox-primary check-all'><label><?php echo $lang->selectAll?></label></div>
<?php endif;?>
<?php if($canBatchAssign):?>
<div class='table-actions btn-toolbar'>
<div class="btn-group dropup no-margin search-box-float">
<button data-toggle="dropdown" type="button" class="btn"><?php echo $lang->order->assignedTo;?> <span class="caret"></span></button>
<?php echo html::hidden('assignedTo');?>
<?php $actionLink = inlink('batchAssign');?>
<?php $withSearch = count($users) > 10;?>
<div class="dropdown-menu search-list<?php if($withSearch) echo ' search-box-sink';?>" data-ride="searchList">
<?php if($withSearch):?>
<?php $usersPinYin = commonModel::convert2Pinyin($users);?>
<div class="input-control search-box has-icon-left has-icon-right search-example">
<input id="userSearchBox" type="search" autocomplete="off" class="form-control search-input">
<label for="userSearchBox" class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label>
<a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a>
</div>
<?php endif;?>
<div class="list-group">
<?php foreach($users as $key => $value):?>
<?php
if(empty($key) or $key == 'closed') continue;
$searchKey = $withSearch ? ('data-key="' . zget($usersPinYin, $value, '') . " @$key\"") : "data-key='@$key'";
echo html::a("javascript:$(\"#assignedTo\").val(\"$key\");setFormAction(\"$actionLink\");", $value, $searchKey);
?>
<?php endforeach;?>
</div>
</div>
</div>
</div>
<?php endif;?>
<?php if(isset($totalAmount)):?>
<div class='table-statistic'>
<?php if(!empty($totalAmount)) printf($lang->order->totalAmount, implode(',', $totalAmount['plan']), implode(',', $totalAmount['real']));?>
</div>
<?php endif;?>
<?php $pager->show();?>
</div>
<?php if($canBatchAssign):?>
</form>
<?php endif;?>
</div>
<?php include '../../common/view/footer.html.php';?>