public function init() { $this->addHeader(['attributes' => array(), 'options' => array(), 'columns' => array(array('name' => 'id', 'content' => 'ID'), array('name' => 'fullName', 'content' => 'Họ tên'), array('name' => 'email', 'content' => 'Email'), array('name' => 'description', 'content' => 'Mô tả'), array('name' => 'birthdate', 'content' => 'Ngày sinh'), array('name' => 'createdDateTime', 'content' => 'Ngày đăng kí'))]); if (!is_array($this->getDataSource()) && !$this->getDataSource() instanceof \Zend\Paginator\Paginator) { return; } if ($this->getDataSource() > 0) { /** @var $item \Expert\Model\Expert */ foreach ($this->getDataSource() as $item) { $row = new Row(); $this->addRow($row); // Add $item to row $row->addColumn(array('name' => 'id', 'content' => $item->getId(), 'attributes' => [])); // name $row->addColumn(array('name' => 'name', 'content' => $item->getFullName(), 'attributes' => [])); $row->addColumn(array('name' => 'email', 'content' => $item->getEmail(), 'attributes' => [])); $row->addColumn(array('name' => 'description', 'content' => $item->getDescription(), 'attributes' => [])); $row->addColumn(array('name' => 'birthdate', 'content' => DateBase::toDisplayDate($item->getBirthdate()), 'attributes' => [])); // Status // if($item->getStatus()==1){ // $status = '<i style="color:green;font-size:14px;" class="fa fa-check-circle"></i>'; // }else{ // $status = '<div class="label label-warning">Khóa</div>'; // } $row->addColumn(array('name' => 'createdDateTime', 'content' => DateBase::toDisplayDateTime($item->getCreatedDateTime()), 'attributes' => ['style' => 'position: relative'])); } } }
/** * @param $mess \Admin\Model\MessagesMG */ public function reportdetail($mess) { $dm = $this->getServiceLocator()->get('doctrine.documentmanager.odm_default'); $select = $this->getDbSql()->select(['ca' => self::TABLE_NAME]); $predicateSet = new PredicateSet(); $predicateSet->addPredicate(new Operator('ca.callcenter', Operator::OPERATOR_EQUAL_TO, $mess->getSender()), $predicateSet::OP_OR); $predicateSet->addPredicate(new Operator('ca.mentor', Operator::OPERATOR_EQUAL_TO, $mess->getSender()), $predicateSet::OP_OR); $select->where($predicateSet); $select->where(['ca.endedDate' => DateBase::toCommonDate($mess->getCreated())]); $query = $this->getDbSql()->buildSqlString($select); $rows = $this->getDbAdapter()->query($query, Adapter::QUERY_MODE_EXECUTE); $result = []; $time = ''; foreach ($rows as $r) { $result[DateBase::toDisplayDateTime($r['createdDateTime']) . ' - ' . DateBase::toDisplayDateTime($r['endedDateTime'])] = ['rating' => $r['rating'], 'comment' => $r['note']]; $createdDatetime = new \DateTime($r['createdDateTime']); $endDatetime = new \DateTime($r['endedDateTime']); $timediff = date_diff($createdDatetime, $endDatetime); $result[DateBase::toDisplayDateTime($r['createdDateTime']) . ' - ' . DateBase::toDisplayDateTime($r['endedDateTime'])]['time'] += $timediff->format('%i'); $qb = $dm->createQueryBuilder('Admin\\Model\\MessagesMG'); $qb->field('receiver')->equals($r['room']); $qb->field('created')->range($createdDatetime, $endDatetime); $querymg = $qb->getQuery(); $resultmg = $querymg->execute(); $i = 0; /** @var \Admin\Model\MessagesMG $m */ foreach ($resultmg as $m) { $i++; $result[DateBase::toDisplayDateTime($r['createdDateTime']) . ' - ' . DateBase::toDisplayDateTime($r['endedDateTime'])]['messages'][] = ['sender' => $m->getSender(), 'room' => $m->getReceiver(), 'msg' => $m->getMsg(), 'imgPath' => $m->getImgPath(), 'created' => $m->getCreated()->format(DateBase::DISPLAY_DATETIME_FORMAT)]; // vdump($i.'. Sender: '.$m->getSender().'|| Receiver: '.$m->getReceiver().' || Msg: '.$m->getMsg().' || Created: '.$m->getCreated()->format(DateBase::DISPLAY_DATETIME_FORMAT)); } } return $result; // if($mess->getSender()){ // $qb->field('sender')->equals($mess->getSender()); // } }
/** */ public function init() { $loginUserId = $this->getOption('loginUserId'); $this->setAttributes(array('id' => 'dgTransaction')); $this->addHeader(array('columns' => array(array('name' => 'id', 'content' => 'ID'), array('name' => 'company', 'content' => 'Công ty'), array('name' => 'applyDate', 'content' => 'Ngày hạch toán'), array('name' => 'type', 'content' => 'Loại phiếu'), array('name' => 'totalItems', 'content' => 'Số hạng mục'), array('name' => 'valueBeforeTax', 'content' => 'Giá trị'), array('name' => 'createdBy', 'content' => 'Người tạo'), array('name' => 'approveBy', 'content' => 'Duyệt'), array('name' => 'accountingBy', 'content' => 'Hạch toán'), array('name' => 'action', 'content' => '<i class="fa fa-edit icon"></i>')))); if (!$this->getDataSource() instanceof \Zend\Paginator\Paginator || !$this->getDataSource()->getCurrentModels()) { return; } foreach ($this->getDataSource()->getCurrentModels() as $transaction) { /*@var $transaction \Accounting\Model\Transaction */ $row = new Row(); $this->addRow($row); $row->addColumn(array('name' => 'id', 'content' => $transaction->getId())); $row->addColumn(array('name' => 'company', 'content' => $transaction->getOption('companyName'))); $row->addColumn(array('name' => 'applyDate', 'content' => DateBase::toDisplayDate($transaction->getApplyDate()))); $content = ''; if ($transaction->getType() == \Accounting\Model\Transaction::TYPE_PAYMENT) { $content = '<b class="text-danger">' . $transaction->getTypeName() . '</b>'; } else { $content = '<b class="text-info">' . $transaction->getTypeName() . '</b>'; } $row->addColumn(array('name' => 'type', 'content' => $content)); $row->addColumn(array('name' => 'totalItem', 'content' => $transaction->getOption('totalItems'), 'attributes' => ['class' => 'colNumber'])); $row->addColumn(array('name' => 'valueBeforeTax', 'content' => \Home\Model\Format::toNumber($transaction->getOption('valueBeforeTax')), 'attributes' => ['class' => 'colNumber'])); $content = []; if ($transaction->getOption('createdBy')) { $content[] = '<div>' . ($transaction->getOption('createdBy')->getFullName() ?: $transaction->getOption('createdBy')->getEmail()) . '</div>'; } $content[] = '<div><i class="date">' . DateBase::toDisplayDateTime($transaction->getCreatedDateTime()) . '</i></div>'; $row->addColumn(array('name' => 'createdBy', 'content' => implode('', $content))); $content = []; if ($transaction->getApprovedById()) { if ($transaction->getStatus() == \Accounting\Model\Transaction::STATUS_APPROVED) { if ($transaction->getOption('approvedBy')) { $content[] = '<div class="text-success"><b>Duyệt: </b>' . ($transaction->getOption('approvedBy')->getFullName() ?: $transaction->getOption('approvedBy')->getEmail()) . '</div>'; } if ($transaction->getApprovedDateTime()) { $content[] = '<div class="text-success"><i class="date">' . DateBase::toDisplayDateTime($transaction->getApprovedDateTime()) . '</i></div>'; } $content[] = '<a href="/accounting/transaction/approvereq?id=' . $transaction->getId() . '">Hủy duyệt</a>'; } elseif ($transaction->getStatus() == \Accounting\Model\Transaction::STATUS_INAPPROVED) { if ($transaction->getOption('approvedBy')) { $content[] = '<div class="text-danger"><b>Hủy: </b>' . ($transaction->getOption('approvedBy')->getFullName() ?: $transaction->getOption('approvedBy')->getEmail()) . '</div>'; } if ($transaction->getApprovedDateTime()) { $content[] = '<div class="text-danger"><i class="date">' . DateBase::toDisplayDateTime($transaction->getApprovedDateTime()) . '</i></div>'; } $content[] = '<a href="/accounting/transaction/approvereq?id=' . $transaction->getId() . '">Duyệt</a>'; } else { if ($transaction->getOption('approvedBy')) { $content[] = '<div class="text-success"><b>Duyệt: </b>' . ($transaction->getOption('approvedBy')->getFullName() ?: $transaction->getOption('approvedBy')->getEmail()) . '</div>'; } if ($transaction->getApprovedDateTime()) { $content[] = '<div class="text-success"><i class="date">' . DateBase::toDisplayDateTime($transaction->getApprovedDateTime()) . '</i></div>'; } } } else { $content[] = '<a href="/accounting/transaction/approvereq?id=' . $transaction->getId() . '">Duyệt</a>'; } $row->addColumn(array('name' => 'approvedBy', 'content' => implode('', $content), 'attributes' => ['class' => 'colControls'])); $content = []; if ($transaction->getAccountingById()) { if ($transaction->getOption('accountingBy')) { $content[] = '<div>' . ($transaction->getOption('accountingBy')->getFullName() ?: $transaction->getOption('accountingBy')->getEmail()) . '</div>'; } if ($transaction->getAccountingDateTime()) { $content[] = '<div><i class="date">' . DateBase::toDisplayDateTime($transaction->getAccountingDateTime()) . '</i></div>'; } } else { $content[] = '<a href="/accounting/transaction/accountingreq?id=' . $transaction->getId() . '">Duyệt</a>'; } $row->addColumn(array('name' => 'accountingBy', 'content' => implode('', $content), 'attributes' => ['class' => 'colControls'])); /** @todo: đang đợi chỉ thị để làm nốt $content = []; if($transaction->getPaymentById()){ if($transaction->getOption('paymentBy')){ $content[] = '<div>'.($transaction->getOption('paymentBy')->getFullName() ?:$transaction->getOption('paymentBy')->getEmail()).'</div>'; } if($transaction->getPaymentDateTime()){ $content[] = '<div><i class="date">'.DateBase::toDisplayDateTime($transaction->getPaymentDateTime()).'</i></div>'; } } else { $content[] = '<a href="/accounting/transaction/payment?id='.$transaction->getId().'">Duyệt</a>'; } $row->addColumn(array( 'name' => 'paymentBy', 'content' => implode('', $content), 'attributes' => ['class' => 'colControls'] )); */ $content = []; if ($transaction->getStatus() == \Accounting\Model\Transaction::STATUS_NEW) { if ($transaction->getCreatedById() == $loginUserId) { $content[] = '<a class="fa fa-edit icon" href="/accounting/transaction/editreq?id=' . $transaction->getId() . '"></a>'; } } $row->addColumn(array('name' => 'action', 'content' => implode('', $content), 'attributes' => ['class' => 'colControls'])); } }