示例#1
0
 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']));
         }
     }
 }
示例#2
0
 public function __construct($serviceLocator, $options = null)
 {
     parent::__construct('fTransaction');
     $this->setServiceLocator($serviceLocator);
     $this->setAttribute('method', 'post');
     $filter = $this->getInputFilter();
     $basicGroup = new DisplayGroup('basicGroup');
     $this->add($basicGroup);
     $companyId = $this->addElementCompany('companyId', $basicGroup, ['required' => true]);
     $applyDate = new Text('applyDate');
     $applyDate->setLabel('Ngày hạch toán:');
     $applyDate->setAttribute('class', 'datepicker');
     $this->add($applyDate);
     $basicGroup->addElement($applyDate);
     $applyDate->setValue(DateBase::toDisplayDate(DateBase::getCurrentDate()));
     $filter->add(array('name' => 'applyDate', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập ngày hạch toán'))))));
     $description = new Text('description');
     $description->setLabel('Nội dung:');
     $this->add($description);
     $basicGroup->addElement($description);
     $filter->add(array('name' => 'description', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập nội dung phiếu thu'))))));
     $accountId = new Select('accountId');
     $accountId->setLabel('Quỹ thu:');
     $accountId->setValueOptions(['' => '- Quỹ thu -']);
     $this->loadAccountingAccount($accountId, $companyId);
     $this->add($accountId);
     $basicGroup->addElement($accountId);
     $filter->add(array('name' => 'accountId', 'required' => true, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập quỹ thu'))), array('name' => 'InArray', 'break_chain_on_failure' => true, 'options' => array('haystack' => array_keys($accountId->getValueOptions()), 'messages' => array('notInArray' => 'Bạn chưa nhập quỹ thu'))))));
     $items = new Hidden('items');
     $this->add($items);
     $filter->add(array('name' => 'items', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập chi tiết các khoản thu'))))));
     $this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/accounting/transaction/addreqrecieve'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/accounting/transaction/addreqrecieve' => 'Tiếp tục nhập', '/accounting/transaction/index' => 'Hiện danh sách vừa nhập'))));
     $this->add(array('name' => 'btnSubmit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'button', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary')));
 }
示例#3
0
 public function toFormValues()
 {
     $data = array('id' => $this->getId(), 'username' => $this->getUsername(), 'email' => $this->getEmail(), 'fullName' => $this->getFullName(), 'gender' => $this->getGender(), 'cityId' => $this->getCityId(), 'districtId' => $this->getDistrictId(), 'address' => $this->getAddress(), 'mobile' => $this->getMobile(), 'role' => $this->getRole());
     if ($this->getBirthdate()) {
         $data['birthdate'] = DateBase::toDisplayDate($this->getBirthdate());
     }
     return $data;
 }
示例#4
0
 public function toFormValues()
 {
     $data = array('id' => $this->getId(), 'companyId' => $this->getCompanyId(), 'type' => $this->getType(), 'applyDate' => DateBase::toDisplayDate($this->getApplyDate()) ?: null, 'amount' => $this->getAmount() ?: null, 'description' => $this->getDescription() ?: null, 'status' => $this->getStatus(), 'itemType' => $this->getItemType() ?: null, 'itemId' => $this->getItemId() ?: null);
     $items = [];
     if ($this->getOption('items')) {
         foreach ($this->getOption('items') as $item) {
             /*@var  $item \Accounting\Model\Transaction\Item */
             $items[] = $item->toFormValues();
         }
     }
     $data['items'] = $items;
     return $data;
 }
示例#5
0
 /**
  */
 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']));
     }
 }