function init() { parent::init(); $order_dispatch_m = $this->add('xepan\\commerce\\Model_Store_OrderItemDispatch'); $order_dispatch_m->addCondition('due_quantity', '>', 0); $order_dispatch_m->setOrder('id', 'desc'); $grid = $this->add('xepan\\hr\\Grid', null, null, ['view/store/dispatch']); $grid->setModel($order_dispatch_m); $grid->js('click')->_selector('.do-dispatch-order-detail-view')->univ()->frameURL('Sale Order', [$this->api->url('xepan_commerce_salesorderdetail'), 'document_id' => $this->js()->_selectorThis()->closest('[data-related-document-id]')->data('related-document-id')]); $grid->addHook('formatRow', function ($g) { // custom field $array = json_decode($g->model['extra_info'] ?: "[]", true); $cf_html = " "; foreach ($array as $department_id => &$details) { $department_name = $details['department_name']; $cf_list = $g->add('CompleteLister', null, 'extra_info', ['view\\qsp\\extrainfo']); $cf_list->template->trySet('department_name', $department_name); $cf_list->template->trySet('narration', $details['narration']); unset($details['department_name']); $cf_list->setSource($details); $cf_html .= $cf_list->getHtml(); } if ($cf_html != " ") { $cf_html = "<br/>" . $cf_html; } $g->current_row_html['extra_info'] = $cf_html; // $item_model = $g->add('xepan\commerce\Model_Item')->load($g->model['item_id']); // $spec_array = $item_model->getSpecification('exact'); }); $grid->add('xepan\\hr\\Controller_ACL'); $grid->addPaginator(30); }
function init() { parent::init(); $dispatch = $this->add('xepan\\commerce\\Model_Store_DispatchRequest'); $dispatch->addCondition('status', 'ToReceived'); $dispatch->setOrder('related_document_id', 'desc'); $dispatch->setOrder('id', 'desc'); $grid = $this->add('xepan\\hr\\Grid', null, null, ['view/store/dispatch-request-grid']); $grid->setModel($dispatch); $grid->add('xepan\\hr\\Controller_ACL'); $grid->addQuickSearch(['jobcard']); $grid->js('click')->_selector('.do-dispatch-item-jobcard-view')->univ()->frameURL('Item Jobcard Details', [$this->api->url('xepan_production_jobcarddetail'), 'document_id' => $this->js()->_selectorThis()->closest('[data-jobcard-id]')->data('jobcard-id')]); $grid->js('click')->_selector('.do-dispatch-order-item-view')->univ()->frameURL('Order Item Details', [$this->api->url('xepan_commerce_salesorderdetail'), 'document_id' => $this->js()->_selectorThis()->closest('[data-related-document-id]')->data('related-document-id')]); $grid->addHook('formatRow', function ($g) { if ($g->model['status'] == "Received") { $g->current_row_html['item_dispatch_qty'] = $g->model['received']; } elseif ($g->model['status'] == "ToReceived") { $g->current_row_html['item_dispatch_qty'] = $g->model['toreceived']; } else { $g->current_row_html['item_dispatch_qty'] = $g->model['item_quantity']; } }); $grid->addPaginator($ipp = 30); }