function init() { parent::init(); $this->app->side_menu->addItem(['Social Configuration', 'icon' => 'fa fa-globe'], 'xepan_marketing_socialconfiguration')->setAttr(['title' => 'Social Configuration']); $this->app->side_menu->addItem(['Lead Source', 'icon' => 'fa fa-user'], 'xepan_marketing_leadsource')->setAttr(['title' => 'Lead Source']); $this->app->side_menu->addItem(['External Configuration', 'icon' => 'fa fa-gears'], 'xepan_marketing_externalconfiguration')->setAttr(['title' => 'External Configuration']); }
function init() { parent::init(); $contact = $this->add('xepan\\base\\Model_Contact')->load($this->api->stickyGET('contact_id')); $contact_view = $this->add('xepan\\base\\View_Contact'); $contact_view->setModel($contact); }
function init() { parent::init(); $tra = $this->add('xepan\\accounts\\Model_Transaction')->load(17); $this->form = $form = $this->add('xepan\\accounts\\Form_EntryRunner'); $form->setModel($tra); }
function init() { parent::init(); $m = $this->add('xepan/marketing/Model_Content'); $m->load($_GET['content_id']); $this->add('View')->setHtml($m['message_blog']); }
function init() { parent::init(); $config_m = $this->add('xepan\\base\\Model_ConfigJsonModel', ['fields' => ['subject' => 'Line', 'body' => 'xepan\\base\\RichText', 'master' => 'xepan\\base\\RichText'], 'config_key' => 'PRODUCTION_JOBCARD_SYSTEM_CONFIG', 'application' => 'production']); $config_m->add('xepan\\hr\\Controller_ACL'); $config_m->tryLoadAny(); $form = $this->add('Form', null, 'jobcard-received'); $form->setModel($config_m, ['subject', 'body', 'master']); $form->getElement('subject')->set($config_m['subject'])->setFieldHint(' ')->setCaption('Subject'); $form->getElement('body')->set($config_m['body'])->setFieldHint(' ')->setCaption('Message'); $form->getElement('master')->set($config_m['master'])->setFieldHint('{$status},{$next_department},{$id},{$order_no},{$created_at},{$order_created_at},{$due_date},{$order_item},{$extra_info},{$order_item_quantity},{$extra_notes}')->setCaption('Master'); $save = $form->addSubmit('Save')->addClass('btn btn-primary'); $reset = $form->addSubmit('Reset')->addClass('btn btn-primary'); if ($form->isSubmitted()) { if ($form->isClicked($save)) { $form->save(); $form->js(null, $form->js()->reload())->univ()->successMessage('Information Updated')->execute(); } if ($form->isClicked($reset)) { $temp = file_get_contents(realpath("../vendor/xepan/production/templates/default/jobcard-received-subject.html")); $temp1 = file_get_contents(realpath("../vendor/xepan/production/templates/default/jobcard-received-body.html")); $temp2 = file_get_contents(realpath("../vendor/xepan/production/templates/default/jobcard-received-print.html")); $config_m['subject'] = $temp; $config_m['body'] = $temp1; $config_m['master'] = $temp2; $config_m->save(); $form->js(null, $form->js()->reload())->univ()->successMessage('Information Resetted')->execute(); } } }
function init() { parent::init(); $emp_emails = $this->app->employee->getAllowSupportEmail(); $email_setting = $this->add('xepan\\communication\\Model_Communication_EmailSetting'); $email_setting->addCondition('is_active', true); $email_setting->addCondition('id', $emp_emails); $allow_email = []; foreach ($emp_emails as $email) { $allow_email[] = $email; } // var_dump($allow_email); $st = $this->add('xepan\\crm\\Model_SupportTicket'); $st->addCondition('to_id', array_merge([0], $allow_email)); $st->addCondition('status', '<>', 'Draft'); $icon_array = $this->app->status_icon; $model_class = get_class($st); // throw new \Exception($model_class, 1); unset($st->status[0]); $counts = $st->_dsql()->del('fields')->field('status')->field('count(*) counts')->group('Status')->get(); $counts_redefined = []; $total = 0; foreach ($counts as $cnt) { $counts_redefined[$cnt['status']] = $cnt['counts']; $total += $cnt['counts']; } if ($this->add_all) { $this->app->side_menu->addItem(['All', 'icon' => $icon_array[$model_class]['All'], 'badge' => [$total, 'swatch' => ' label label-primary label-circle pull-right']], $this->api->url(null, ['status' => null]), ['status'])->setAttr(['title' => 'All']); } foreach ($st->status as $s) { // echo $s."</br>"; $this->app->side_menu->addItem([$s, 'icon' => $icon_array[$model_class][$s], 'badge' => [$counts_redefined[$s], 'swatch' => ' label label-primary label-circle pull-right']], $this->api->url(null, ['status' => $s]), ['status'])->setAttr(['title' => $s]); } }
function init() { parent::init(); $department = $this->add('xepan\\hr\\Model_Department'); $department->add('xepan\\hr\\Controller_SideBarStatusFilter'); if ($status = $this->app->stickyGET('status')) { $department->addCondition('status', $status); } $department->setOrder('production_level', 'asc'); $crud = $this->add('xepan\\hr\\CRUD', null, null, ['view/department/department-grid']); $crud->grid->addPaginator(50); if (!$crud->isEditing()) { $crud->grid->template->trySet('dept-url', $this->app->url('xepan_hr_structurechart')); } $crud->setModel($department); $crud->add('xepan\\base\\Controller_MultiDelete'); if ($crud->form->model['is_system']) { $crud->form->getElement('production_level')->destroy(); } $crud->grid->addHook('formatRow', function ($g) { if ($g->model['is_system']) { $g->current_row_html['edit'] = '<span class="fa-stack table-link"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-pencil fa-stack-1x fa-inverse"></i></span>'; $g->current_row_html['delete'] = '<span class="table-link fa-stack"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-trash-o fa-stack-1x fa-inverse"></i></span>'; $g->current_row_html['action'] = ''; } }); $f = $crud->grid->addQuickSearch(['name']); if (!$crud->isEditing()) { $crud->grid->js('click')->_selector('.do-view-department-post')->univ()->frameURL('Department Post', [$this->api->url('xepan_hr_post'), 'department_id' => $this->js()->_selectorThis()->closest('[data-id]')->data('id')]); $crud->grid->js('click')->_selector('.do-view-department-employee')->univ()->frameURL('Department Employee', [$this->api->url('xepan_hr_employee'), 'department_id' => $this->js()->_selectorThis()->closest('[data-id]')->data('id'), 'status' => '']); } }
function init() { parent::init(); $department_id = $this->app->stickyGET('dept_id'); $attendances = $this->add('xepan\\hr\\Model_Employee_Attandance'); $emp_j = $attendances->join('employee.contact_id', 'employee_id'); $emp_j->addField('department_id'); $attendances->addExpression('emp_status')->set(function ($m, $q) { $emp = $this->add('xepan\\hr\\Model_Employee'); $emp->addCondition('id', $m->getElement('employee_id')); $emp->setLimit(1); return $emp->fieldQuery('status'); }); $attendances->addExpression('department_name')->set(function ($m, $q) { $emp = $this->add('xepan\\hr\\Model_Department'); $emp->addCondition('id', $m->getElement('department_id')); $emp->setLimit(1); return $emp->fieldQuery('name'); }); $attendances->addCondition('emp_status', 'Active'); $attendances->addCondition('department_id', $department_id); $attendances->addExpression('avg_late')->set($attendances->dsql()->expr('AVG([0])/60', [$attendances->getElement('late_coming')])); $attendances->addExpression('avg_extra_work')->set($attendances->dsql()->expr('AVG([0])/60', [$attendances->getElement('extra_work')])); $attendances->_dsql()->group('employee_id'); $this->grid = $this->add('xepan\\hr\\Grid', null, null, ['page\\widget\\employeeperformance']); $this->grid->setModel($attendances, ['employee', 'avg_late', 'avg_extra_work']); $this->grid->addQuickSearch(['employee']); $this->grid->addPaginator(10); $this->grid->addFormatter('avg_late', 'gmdate'); $this->grid->addFormatter('avg_extra_work', 'gmdate'); }
function init() { parent::init(); $attendances = $this->add('xepan\\hr\\Model_Employee_Attandance'); $emp_j = $attendances->join('employee.contact_id', 'employee_id'); $emp_j->addField('department_id'); $attendances->addExpression('emp_status')->set(function ($m, $q) { $emp = $this->add('xepan\\hr\\Model_Employee'); $emp->addCondition('id', $m->getElement('employee_id')); $emp->setLimit(1); return $emp->fieldQuery('status'); }); $attendances->addExpression('department_name')->set(function ($m, $q) { $emp = $this->add('xepan\\hr\\Model_Department'); $emp->addCondition('id', $m->getElement('department_id')); $emp->setLimit(1); return $emp->fieldQuery('name'); }); $attendances->addCondition('emp_status', 'Active'); $attendances->addExpression('avg_late')->set($attendances->dsql()->expr('AVG([0])/60', [$attendances->getElement('late_coming')])); $attendances->addExpression('avg_extra_work')->set($attendances->dsql()->expr('AVG([0])/60', [$attendances->getElement('extra_work')])); $attendances->_dsql()->group('department_id'); $this->grid = $this->add('xepan\\hr\\Grid', null, null, ['page\\widget\\averageperformance']); $this->grid->setModel($attendances, ['department_name', 'department_id', 'avg_late', 'avg_extra_work']); $this->grid->addQuickSearch(['department_name']); $this->grid->addPaginator(10); $this->grid->addFormatter('avg_late', 'gmdate'); $this->grid->addFormatter('avg_extra_work', 'gmdate'); $this->grid->js('click')->_selector('.average-performance-digging')->univ()->frameURL('Employee Average Performance', [$this->api->url('xepan_hr_widget_employeeperformance'), 'dept_id' => $this->js()->_selectorThis()->closest('[data-id]')->data('id')]); }
function init() { parent::init(); // $emp->addCondition('status','Active'); $emp = $this->add('xepan\\hr\\Model_Employee'); $emp->addCondition('status', 'Active'); $emp_nav = $this->add('xepan\\communication\\View_InternalMessageEmployeeList', null, 'message_navigation'); $emp_nav->setModel($emp, ['name']); $emp_id = $this->app->stickyGET('employee_id'); $msg_m = $this->add('xepan\\communication\\Model_Communication_AbstractMessage'); $msg_m->addCondition([['from_raw', 'like', '%"' . $this->app->employee->id . '"%'], ['to_raw', 'like', '%"' . $this->app->employee->id . '"%']]); if ($emp_id) { $employee = $this->add('xepan\\hr\\Model_Employee'); $employee->load($emp_id); $msg_m->addCondition([['from_raw', 'like', '%"' . $employee->id . '"%'], ['to_raw', 'like', '%"' . $employee->id . '"%']]); } // $msg_m->setOrder('id','desc'); $msg_list = $this->add('xepan\\communication\\View_Lister_InternalMSGList', null, 'message_lister'); $msg_list->setModel($msg_m); $msg_list->add('xepan\\base\\Controller_Avatar', ['options' => ['size' => 50, 'border' => ['width' => 0]], 'name_field' => 'contact']); $paginator = $msg_list->add('xepan\\base\\Paginator', ['ipp' => 10]); $paginator->setRowsPerPage(10); //trigger reload $msg_list->addClass('xepan-internal-message-trigger-reload'); // $msg_list->js('reload')->reload(); $compose_msg = $this->add('xepan\\communication\\View_ComposeMessagePopup', ['employee_id' => $emp_id], 'message_compose_view'); $emp_nav->js('click', [$compose_msg->js()->html(' ')->reload(['employee_id' => $this->js()->_selectorThis()->data('id')]), $msg_list->js()->html('<div style="width:100%"><img style="width:20%;display:block;margin:auto;" src="vendor\\xepan\\communication\\templates\\images\\email-loader.gif"/></div>')->reload(['employee_id' => $this->js()->_selectorThis()->data('id')])])->_selector('.internal-conversion-emp-list'); }
function init() { parent::init(); $action = $this->api->stickyGET('action') ?: 'view'; $purchase_inv_dtl = $this->add('xepan\\commerce\\Model_PurchaseInvoice')->tryLoadBy('id', $this->api->stickyGET('document_id')); $view_field = ['contact_id', 'document_no', 'type', 'billing_address', 'billing_city', 'billing_pincode', 'shipping_address', 'shipping_city', 'shipping_pincode', 'gross_amount', 'discount_amount', 'net_amount', 'delivery_date', 'tnc_text', 'narration', 'exchange_rate', 'currency']; $form_field = ['contact_id', 'document_no', 'created_at', 'due_date', 'billing_address', 'billing_country_id', 'billing_state_id', 'billing_city', 'billing_pincode', 'shipping_address', 'shipping_country_id', 'shipping_state_id', 'shipping_city', 'shipping_pincode', 'discount_amount', 'narration', 'exchange_rate', 'currency_id', 'tnc_id']; $dv = $this->add('xepan\\commerce\\View_QSPAddressJS')->set(''); $view = $this->add('xepan\\commerce\\View_QSP', ['qsp_model' => $purchase_inv_dtl, 'qsp_view_field' => $view_field, 'qsp_form_field' => $form_field]); $view->js(true)->_selector('#shipping-hide')->hide(); $view->js('click')->_selector('a.new-qsp')->univ()->location($this->app->url(null, ['action' => 'add', 'document_id' => false])); if ($action != 'view') { $contact_field = $view->document->form->getElement('contact_id'); $contact_field->model->addCondition('type', 'Supplier'); $contact_field->js('change', $dv->js()->reload(['changed_contact_id' => $contact_field->js()->val()])); } if ($action == 'edit' && !$view->document_item->isEditing()) { $view->app->addHook('post-submit', function ($f) use($purchase_inv_dtl) { if ($_POST) { $purchase_inv_dtl->addHook('afterSave', function ($m) { $m->updateTransaction(); }); } }); $m = $view->document_item->model; $m->addHook('afterSave', function ($m) { $m->purchaseInvoice()->updateTransaction(); }); } }
function init() { parent::init(); $task = $this->add('xepan\\projects\\Model_Task'); $task->addCondition($task->dsql()->orExpr()->where('assign_to_id', $this->app->employee->id)->where('created_by_id', $this->app->employee->id)); $task->addCondition('status', 'not in', ['Assigned', 'Completed']); $form = $this->add('Form')->addClass('main-box'); $col = $form->add('Columns'); $col1 = $col->addColumn(6)->addClass('col-md-6')->setStyle('height', '80px'); $col2 = $col->addColumn(3)->addClass('col-md-3')->setStyle('height', '80px'); $col3 = $col->addColumn(3)->addClass('col-md-3')->setStyle('height', '80px'); $task_field = $col1->addField('xepan\\base\\DropDown', 'task'); $task_field->setEmptyText('Please select a task or add new by typing'); $task_field->setModel($task); $task_field->validate_values = false; $task_field->select_menu_options = ['tags' => true]; $starttime_field = $col2->addField('TimePicker', 'starttime'); $endtime_field = $col3->addField('TimePicker', 'endtime'); $starttime_field->setOption('showMeridian', false)->setOption('minuteStep', 1)->setOption('showSeconds', true); $endtime_field->setOption('showMeridian', false)->setOption('minuteStep', 1)->setOption('showSeconds', true); $form->addSubmit('Save')->addClass('btn btn-primary')->setStyle('text-align', 'center'); $timesheet_m = $this->add('xepan\\projects\\Model_Timesheet'); $timesheet_m->addCondition('employee_id', $this->app->employee->id); $timesheet_m->addCondition('starttime', '>=', $this->app->today); $timesheet_m->acl = 'xepan\\projects\\Model_Task'; $timesheet_m->setOrder('starttime', 'asc'); $grid = $this->add('xepan\\hr\\CRUD'); $grid->setModel($timesheet_m, ['task', 'starttime', 'endtime', 'duration']); $grid->grid->removeColumn('action'); $grid->grid->removeColumn('attachment_icon'); if ($form->isSubmitted()) { $timestamp = $this->app->today; $timestamp .= ' ' . $form['starttime']; $starting_time = date('Y-m-d H:i:s', strtotime($timestamp)); $timestamp = $this->app->today; $timestamp .= ' ' . $form['endtime']; $ending_time = date('Y-m-d H:i:s', strtotime($timestamp)); $model_task = $this->add('xepan\\projects\\Model_Task'); $model_task->addCondition($model_task->dsql()->orExpr()->where('assign_to_id', $this->app->employee->id)->where('created_by_id', $this->app->employee->id)); $model_task->tryLoadBy('id', $form['task']); if (!$model_task->loaded()) { if (!$form['task']) { $form->displayError('task', 'Add a new task or select from old'); } $model_task['task_name'] = $form['task']; $model_task['assign_to_id'] = $this->app->employee->id; $model_task['created_by_id'] = $this->app->employee->id; $model_task['status'] = 'Pending'; $model_task['created_at'] = $this->app->now; $model_task->save(); } $model_timesheet = $this->add('xepan\\projects\\Model_Timesheet'); $model_timesheet['employee_id'] = $this->app->employee->id; $model_timesheet['task_id'] = $model_task->id; $model_timesheet['starttime'] = $starting_time; $model_timesheet['endtime'] = $ending_time; $model_timesheet->save(); $form->js('true', $grid->js()->reload())->univ()->successMessage('Saved')->execute(); } }
function init() { parent::init(); $tabs = $this->add('Tabs'); $permitted_dashboards = $tabs->addTab('Permitted Dashboards'); $default_permitted_list = []; switch ($this->app->employee->ref('post_id')->get('permission_level')) { case 'Global': $default_permitted_list = ['Global', 'Sibling', 'Department', 'Individual']; break; case 'Sibling': $default_permitted_list = ['Sibling', 'Department', 'Individual']; break; case 'Department': $default_permitted_list = ['Department', 'Individual']; break; default: $default_permitted_list = ['Individual']; } $permitted_reports_model = $this->add('xepan\\base\\Model_GraphicalReport'); $permitted_reports_model->addCondition([['name', 'in', $default_permitted_list], ['permitted_post', 'like', '%"' . $this->app->employee['post_id'] . '"%'], ['created_by_id', $this->app->employee->id]]); $form = $permitted_dashboards->add('Form'); $form->addField('DropDown', 'permitted_dashboards')->setModel($permitted_reports_model); $form->addSubmit('Save')->addClass('btn btn-primary'); if ($form->isSubmitted()) { $employee_m = $this->add('xepan\\hr\\Model_Employee'); $employee_m->load($this->app->employee->id); $employee_m['graphical_report_id'] = $form['']; } }
function init() { parent::init(); $action = $this->api->stickyGET('action') ?: 'view'; $document_id = $this->app->stickyGET('document_id'); $sale_odr_dtl = $this->add('xepan\\commerce\\Model_SalesOrder')->tryLoadBy('id', $this->api->stickyGET('document_id')); $view_field = ['contact_id', 'document_no', 'type', 'billing_address', 'billing_city', 'billing_pincode', 'shipping_address', 'shipping_city', 'shipping_pincode', 'gross_amount', 'discount_amount', 'net_amount', 'delivery_date', 'tnc_text', 'narration', 'exchange_rate', 'currency']; $form_field = ['contact_id', 'document_no', 'created_at', 'due_date', 'billing_address', 'billing_country_id', 'billing_state_id', 'billing_city', 'billing_pincode', 'shipping_address', 'shipping_country_id', 'shipping_state_id', 'shipping_city', 'shipping_pincode', 'discount_amount', 'narration', 'exchange_rate', 'currency_id', 'tnc_id']; $dv = $this->add('xepan\\commerce\\View_QSPAddressJS')->set(''); $view = $this->add('xepan\\commerce\\View_QSP', ['qsp_model' => $sale_odr_dtl, 'qsp_view_field' => $view_field, 'qsp_form_field' => $form_field]); $consumable_view = $this->add('xepan\\commerce\\View_StockAvailibility', ['sale_order_id' => $sale_odr_dtl->id]); if ($document_id) { $consumable_view->setModel($sale_odr_dtl->orderItems()); } // $view->document->effective_template->setHTML('consumable_item_view',$consumable_view->getHtml()); $view->document_item->js('reload', $consumable_view->js()->reload(null, null, [$this->app->url(null, ['cut_object' => $consumable_view->name])])); $view->js('click')->_selector('a.new-qsp')->univ()->location($this->app->url(null, ['action' => 'add', 'document_id' => false])); $vp = $this->add('VirtualPage'); $vp->set(function ($p) { $order_id = $p->app->stickyGET('order_id'); $attachments = $p->add('xepan\\commerce\\Model_QSP_DetailAttachment'); $attachments->addCondition('qsp_detail_id', $order_id); $grid = $p->add('xepan\\base\\Grid', null, null, ['view\\qsp\\attachments']); $grid->setModel($attachments); }); $view->on('click', '.order-export-attachments', function ($js, $data) use($vp) { return $js->univ()->dialogURL("EXPORT ATTACHMENTS", $this->api->url($vp->getURL(), ['order_id' => $data['id']])); }); if ($action != 'view') { $contact_field = $view->document->form->getElement('contact_id'); $contact_field->model->addCondition('type', 'Customer'); $contact_field->js('change', $dv->js()->reload(['changed_contact_id' => $contact_field->js()->val()])); } }
function render() { // $this->js(true)->_load('masonry.pkgd.min')->masonry(['itemSelector'=>'.widget'])->_selector('.widget-grid'); $this->app->js('chart_rendered', 'console.log(123)'); //->masonry(['itemSelector'=>'.widget'])->_selector('.widget-grid'); return parent::render(); }
function init() { parent::init(); $bs_id = $this->api->stickyGET('bs_id'); $from_date = $this->api->stickyGET('from_date'); $to_date = $this->api->stickyGET('to_date'); $bs_group = $this->add('xepan\\accounts\\Model_BSGroup', ['from_date' => $from_date, 'to_date' => $to_date]); $bs_group->addCondition('balance_sheet_id', $bs_id); $bs_group->addCondition('parent_group_id', null); $grid = $this->add('xepan\\hr\\Grid', null, null, ['view\\grid\\bstogroup']); $grid->setModel($bs_group); $grid->addColumn('balance'); $grid->addMethod('format_balance', function ($g, $f) { $side = $g->model['ClosingBalanceDr'] > $this->model['ClosingBalanceCr'] ? "Dr" : "Cr"; $amount = abs($g->model['ClosingBalanceDr'] - $g->model['ClosingBalanceCr']); if ($amount) { $g->current_row_html[$f] = '<span style="float:right">' . $side . '</span> ' . $amount; } else { $g->current_row_html[$f] = ''; } }); $grid->addFormatter('balance', 'balance'); $bs = $this->add('xepan\\accounts\\Model_BSBalanceSheet')->load($bs_id); $grid->template->trySet('head', $bs['name']); $grid->template->trySet('from_date', $from_date); $grid->template->trySet('to_date', $to_date); $grid->addTotals(['ClosingBalanceDr', 'ClosingBalanceCr', 'balance']); $this->js('click')->_selector('.xepan-accounts-bs-subgroup')->univ()->frameURL('Groups And Ledger', [$this->api->url('xepan_accounts_groupdig'), 'group_id' => $this->js()->_selectorThis()->closest('[data-id]')->data('id'), 'from_date' => $from_date, 'to_date' => $to_date]); }
function init() { parent::init(); if (!$this->app->getConfig('developer_mode')) { throw $this->exception('Testing can conly be executed in develoepr mode'); } if (!$this->auto_test) { $this->setVariance(array('test')); return; // used for multi-page testing } $this->grid = $this->add('Grid'); $this->grid->addColumn('template', 'name')->setTemplate('<a href="' . $this->api->url(null, array('testonly' => '')) . '<?$name?>"><?$name?></a>'); $this->setVariance(array('test')); //$this->setVariance(array('GiTemplate','SMlite')); $this->runTests(); if (!$_GET['testonly']) { $f = $this->add('Form'); $ff = $f->addField('Text', 'responses'); $this->responses = ' public $proper_responses=array( ' . join(', ', $this->responses) . ' );'; $ff->set($this->responses); $ff->js('click')->select(); } }
function init() { parent::init(); $post_id = $this->app->stickyGET('post_id'); $social = $this->add('xepan\\marketing\\Model_SocialPosters_Base_SocialPosting'); $social->addCondition('post_id', $post_id); $social->tryLoadAny(); $grid = $this->add('xepan\\hr\\Grid', null, 'grid', ['grid/total-posting-grid']); $grid->setModel($social); $grid->add('xepan\\hr\\Controller_ACL'); $model_post = $this->add('xepan\\marketing\\Model_SocialPost')->load($post_id); $grid->template->trySet('post_title', $model_post['title']); $grid->template->trySetHtml('post_content', $model_post['message_blog']); $grid->template->trySet('post_url', $model_post['url']); $grid->addHook('formatRow', function ($g) { $g->current_row['monitoring'] = $g->model['is_monitoring']; $g->current_row['forcemonitoring'] = $g->model['force_monitor']; }); $comment_view = $this->add('xepan\\marketing\\View_PostComments', null, 'view', ['view\\postcomments']); $comment_view_url = $this->api->url(null, ['cut_object' => $comment_view->name]); $grid->js('click', $comment_view->js()->reload(['posting_id' => $this->js()->_selectorThis()->closest('[data-id]')->data('id')], null, $comment_view_url))->_selector('.post-comments'); $grid->on('click', '.update-activity-button', function ($js, $data) use($grid, $post_id) { $model_post = $this->add('xepan\\marketing\\Model_SocialPost')->load($post_id); if (!$model_post->loaded()) { throw new \Exception("No posts to update"); } $model_post->updateActivity(); return $this->js()->univ()->successMessage('Updated'); }); }
function render() { $this->js(true)->_load('wizard')->_Selector('.wizard')->wizard(); $this->js('finished', $this->form->js()->submit())->_selector('.wizard'); $this->app->jui->addStylesheet('compiled/wizard'); parent::render(); }
function init() { parent::init(); $employee_id = $this->app->stickyGET('employee_id'); $m = $this->add('xepan\\hr\\Model_Employee_Movement'); $m->addCondition('employee_id', $employee_id); $m->addCondition('movement_at', '>=', $this->app->today); $m->addCondition('movement_at', '<', $this->app->nextDate($this->app->today)); $m->addExpression('next_movement_time')->set(function ($m, $q) { $next_movement = $this->add('xepan\\hr\\Model_Employee_Movement', ['table_alias' => 'next_movement'])->addCondition('employee_id', $m->getElement('employee_id'))->addCondition('movement_at', '>', $m->getElement('movement_at'))->addCondition('date', $m->getElement('date'))->setLimit(1); return $q->expr('IFNULL([0],CONCAT([1]," ",[2]))', [$next_movement->fieldQuery('movement_at'), $m->getElement('date'), $m->getElement('employee_out_time')]); }); $m->addExpression('next_movement_direction')->set(function ($m, $q) { $next_movement = $this->add('xepan\\hr\\Model_Employee_Movement', ['table_alias' => 'next_movement'])->addCondition('employee_id', $m->getElement('employee_id'))->addCondition('movement_at', '>', $m->getElement('movement_at'))->addCondition('date', $m->getElement('date'))->setLimit(1); return $next_movement->fieldQuery('direction'); }); $m->addExpression('duration')->set(function ($m, $q) { return $q->expr('(TIMEDIFF([0],[1]))', [$m->getElement('next_movement_time'), $m->getElement('movement_at')]); }); $grid = $this->add('xepan\\hr\\Grid', null, null, ['view\\employee\\movementdetail']); $grid->setModel($m); $grid->addPaginator(10); $grid->addQuickSearch(['direction']); $employee = $this->add('xepan\\hr\\Model_Employee')->load($employee_id); $grid->template->trySet('employee_name', $employee['name']); $grid->addColumn('Duration'); $grid->addMethod('format_timeduration', function ($grid, $field) { $grid->current_row_html['duration'] = $grid->model['duration']; }); $grid->addFormatter('Duration', 'timeduration'); }
function init() { parent::init(); $this->app->hook('logout_page', [$this]); $movement = $this->add('xepan\\hr\\Model_Employee_Movement'); $form = $this->add('Form'); $form->setModel($movement, ['reason', 'narration']); $form->addSubmit('Logout')->addClass('btn btn-primary'); if ($form->isSubmitted()) { $movement->addCondition('employee_id', $this->app->employee->id); $movement->addCondition('movement_at', $this->app->now); $movement->addCondition('direction', 'Out'); $movement->addCondition('reason', $form['reason']); $movement->addCondition('narration', $form['narration']); $movement->save(); $attan_m = $this->add("xepan\\hr\\Model_Employee_Attandance"); $attan_m->addCondition('employee_id', $this->app->employee->id); $attan_m->addCondition('fdate', $this->app->today); $attan_m->setOrder('id', 'desc'); $attan_m->tryLoadAny(); if ($movement['reason'] != 'Official Outing') { $attan_m['to_date'] = $this->app->now; $attan_m->save(); } $this->app->hook('user_loggedout', [$this->app->auth->model, $this->app->employee]); $this->app->auth->logout(); $this->app->redirect('/'); } }
function init() { parent::init(); $this->app->side_menu->addItem(['Customer', 'icon' => 'fa fa-user'], 'xepan_production_reports_customer')->setAttr(['title' => 'Customer Report']); $this->app->side_menu->addItem(['Outsource Party', 'icon' => 'fa fa-user'], 'xepan_production_reports_outsourceparty')->setAttr(['title' => 'Outsource Party Report']); $this->app->side_menu->addItem(['Department', 'icon' => 'fa fa-sliders'], 'xepan_production_reports_department')->setAttr(['title' => 'Department Report']); }
function init() { parent::init(); $this->department_id = $this->api->stickyGET('department_id'); $this->customer_id = $this->api->stickyGET('customer_id'); $this->outsource_party_id = $this->api->stickyGET('outsource_party_id'); $jobcard_model = $this->add('xepan\\production\\Model_Jobcard')->setOrder('id', 'desc'); $jobcard_model->add('xepan\\production\\Controller_SideBarStatusFilter'); $jobcard_model->addExpression('department_name')->set($jobcard_model->refSQL('department_id')->fieldQuery('name')); if ($this->department_id) { $jobcard_model->addCondition('department_id', $this->department_id); $jobcard_model->tryLoadAny(); $this->title = "Jobcard / Department :: " . $jobcard_model['department_name']; } if ($this->customer_id) { $jobcard_model->addCondition('customer_id', $this->customer_id); } if ($this->outsource_party_id) { $jobcard_model->addCondition('outsourceparty_id', $this->outsource_party_id); } $crud = $this->add('xepan\\hr\\CRUD', null, null, ['view/grid/jobcard']); $crud->grid->addColumn('departmental_status'); $crud->setModel($jobcard_model); $crud->grid->addQuickSearch(['customer_name', 'order_no', 'order_item_name']); $crud->grid->addMethod('format_department123', function ($grid, $field) { $m = $grid->add('xepan\\production\\Model_Jobcard')->load($grid->model->id); $m = $m->orderItem()->deptartmentalStatus(); $v = $grid->add('xepan\\production\\View_Department', null, 'department123'); $v->setModel($m); $grid->current_row_html[$field] = $v->getHtml(); }); $crud->grid->addPaginator($ipp = 30); //$crud->grid->addFormatter('departmental_status','departmental_status'); }
function init() { parent::init(); $fy = $this->app->getFinancialYear(); $from_date = $this->api->stickyGET('from_date') ?: $fy['start_date']; $to_date = $this->api->stickyGET('to_date') ?: $fy['end_date']; $f = $this->add('Form', null, null, ['form/stacked']); $c = $f->add('Columns')->addClass('row xepan-push'); $l = $c->addColumn(6)->addClass('col-md-6'); $r = $c->addColumn(6)->addClass('col-md-6'); $l->addField('DatePicker', 'from_date')->set($from_date); $r->addField('DatePicker', 'to_date')->set($to_date); $f->addSubmit('Filter')->addClass('btn btn-primary btn-block'); $view = $this->add('View', null, null, ['page/balancesheet']); if ($f->isSubmitted()) { return $view->js()->reload(['from_date' => $f['from_date'] ?: 0, 'to_date' => $f['to_date'] ?: 0])->execute(); } $bsbalancesheet = $view->add('xepan\\accounts\\Model_BSBalanceSheet'); $report = $bsbalancesheet->getTradingBalance($from_date, $to_date); $left = $report['left']; $right = $report['right']; $left_sum = $report['left_sum']; $right_sum = $report['right_sum']; $grid_l = $view->add('xepan\\hr\\Grid', null, 'balancesheet_liablity', ['view\\grid\\balancesheet']); $grid_l->setSource($left); $grid_l->template->trySet('lheading', 'Expenditure'); $grid_a = $view->add('xepan\\hr\\Grid', null, 'balancesheet_assets', ['view\\grid\\balancesheet']); $grid_a->template->trySet('rheading', 'Income'); $grid_a->setSource($right); $view->template->trySet('ltotal', $left_sum); $view->template->trySet('atotal', $right_sum); $view->js('click')->_selector('.xepan-accounts-bs-group.tradingrow')->univ()->frameURL('BalanceSheet Head Groups', [$this->api->url('xepan_accounts_bstogroup'), 'bs_id' => $this->js()->_selectorThis()->closest('[data-id]')->data('id'), 'from_date' => $from_date, 'to_date' => $to_date]); }
function init() { parent::init(); $x_axis = $this->app->stickyGet('x_axis'); $details = $this->app->stickyGet('details'); $details = json_decode($details, true); $start_date = $this->app->stickyGet('start_date'); $end_date = $this->app->stickyGet('end_date'); $model_employee = $this->add('xepan\\hr\\Model_Employee'); $model_employee->loadBy('name', $x_axis); $contact_id = $model_employee->id; $type = $details['name']; $view_conversation = $this->add('xepan\\communication\\View_Lister_Communication', ['contact_id' => $contact_id]); $model_communication = $this->add('xepan\\communication\\Model_Communication'); $model_communication->addCondition('created_at', '>', $start_date); $model_communication->addCondition('created_at', '<', $this->app->nextDate($end_date)); $model_communication->addCondition([['from_id', $contact_id], ['to_id', $contact_id]]); if ($type == 'Meeting') { $model_communication->addCondition('communication_type', 'Personal'); } else { $model_communication->addCondition('communication_type', $type); } $view_conversation->setModel($model_communication)->setOrder('created_at', 'desc'); $view_conversation->add('Paginator', ['ipp' => 10]); }
function init() { parent::init(); $this->app->side_menu->addItem(['Project Report', 'icon' => 'fa fa-sitemap'], 'xepan_projects_projectreport')->setAttr(['title' => 'Project Report']); $this->app->side_menu->addItem(['Project & Task Report', 'icon' => 'fa fa-tasks'], 'xepan_projects_projectandtaskreport')->setAttr(['title' => 'Project And Task Report']); $this->app->side_menu->addItem(['Task & Employee Report', 'icon' => 'fa fa-user'], 'xepan_projects_taskandemployeereport')->setAttr(['title' => 'Task And Employee Report']); }
function init() { parent::init(); $employee_id = $this->app->stickyGET('emp_id'); $from_date = $this->app->stickyGET('from_date'); $to_date = $this->app->stickyGET('to_date'); $attendance_m = $this->add('xepan\\hr\\Model_Employee_Attandance'); $attendance_m->addCondition('employee_id', $employee_id); $attendance_m->setOrder('fdate', 'desc'); if ($from_date) { $attendance_m->addCondition('fdate', '>=', $from_date); $attendance_m->addCondition('fdate', '<', $this->app->nextDate($to_date)); } $grid = $this->add('xepan\\hr\\Grid', null, null, ['page/widget/attendance']); $grid->setModel($attendance_m, ['fdate', 'late_coming', 'extra_work']); $grid->addPaginator(20); $grid->addQuickSearch('fdate'); $grid->addFormatter('extra_work', 'gmdate'); $grid->addFormatter('late_coming', 'gmdate'); $form = $grid->add('Form', null, 'grid_buttons', ['form\\horizontal']); $date_range_field = $form->addField('DateRangePicker', 'date_range', '')->setStartDate($this->app->now)->setEndDate($this->app->now)->getBackDatesSet(); $form->addSubmit('Filter')->addClass('btn btn-sm btn-primary btn-block'); if ($form->isSubmitted()) { $form->js(null, $grid->js()->reload(['from_date' => $date_range_field->getStartDate(), 'to_date' => $date_range_field->getEndDate()]))->univ()->successMessage('wait ... ')->execute(); } $grid->js('click')->_selector('.digging-employee-attendance')->univ()->frameURL('Employee Movement', [$this->api->url('xepan_hr_widget_movement'), 'emp_id' => $employee_id, 'on_date' => $this->js()->_selectorThis()->closest('[data-id]')->data('id')]); }
function init() { parent::init(); $email_id = $this->api->stickyGET('email_id'); // throw new \Exception($email_id, 1); $email_model = $this->add('xepan\\communication\\Model_Communication_Email'); $email_model->load($_GET['email_id']); // $email_model->ref('extra_info')->set('seen_by',$this->app->employee->id)->save(); if (!isset($email_model['extra_info']['seen_by'])) { $email_model['extra_info'] = ['seen_by' => $this->app->employee->id]; $email_model->save(); } $email_detail = $this->add('xepan\\communication\\View_EmailDetail'); $email_detail->setModel($email_model); if ($email_model['direction'] == "In") { $email_detail->add('xepan\\base\\Controller_Avatar', ['options' => ['size' => 50, 'border' => ['width' => 0]], 'name_field' => 'from', 'default_value' => '']); } else { $email_detail->add('xepan\\base\\Controller_Avatar', ['options' => ['size' => 50, 'border' => ['width' => 0]], 'name_field' => 'to', 'default_value' => '']); } // $email_detail->on('click','.reply',function($js,$data)use($email_model){ // return $js->univ()->location($this->api->url('xepan_communication_composeemail',['reply_email'=>true,'communication_id'=>$email_model->id])); // }); // $email_detail->on('click','li.reply-all',function($js,$data)use($email_model){ // return $js->univ()->location($this->api->url( // 'xepan_communication_composeemail',['reply_email_all'=>true,'communication_id'=>$email_model->id])); // }); // $email_detail->on('click','li.forward',function($js,$data)use($email_model){ // // $this->app->memorize('subject',$email_model['title']); // // $this->app->memorize('message',$email_model['description']); // return $js->univ()->location($this->api->url('xepan_communication_composeemail',['fwd_email'=>true,'communication_id'=>$email_model->id])); // }); }
function init() { parent::init(); $x_axis = $this->app->stickyGET('x_axis'); $details = $this->app->stickyGET('details'); $from_date = $this->app->stickyGET('from_date'); $to_date = $this->app->stickyGET('to_date'); $attendances = $this->add('xepan\\hr\\Model_Employee_Attandance'); $attendances->addCondition('employee', $x_axis); $attendances->setOrder('fdate', 'desc'); if ($from_date) { $attendances->addCondition('fdate', '>=', $from_date); $attendances->addCondition('fdate', '<', $this->app->nextDate($to_date)); } $grid = $this->add('xepan\\hr\\Grid', null, null, ['page\\widget\\averagework']); $grid->setModel($attendances, ['employee', 'fdate', 'working_hours']); $grid->addQuickSearch(['fdate']); $grid->addPaginator(20); $form = $grid->add('Form', null, 'grid_buttons', ['form\\horizontal']); $date_range_field = $form->addField('DateRangePicker', 'date_range', '')->setStartDate($this->app->now)->setEndDate($this->app->now)->getBackDatesSet(); $form->addSubmit('Filter')->addClass('btn btn-sm btn-primary btn-block'); if ($form->isSubmitted()) { $form->js(null, $grid->js()->reload(['from_date' => $date_range_field->getStartDate(), 'to_date' => $date_range_field->getEndDate()]))->univ()->successMessage('wait ... ')->execute(); } }
function init() { parent::init(); $item = $this->add('xepan\\commerce\\Model_Item'); $form = $this->add('Form', null, null, ['form/empty']); $form->addField('Dropdown', 'item_id')->setModel($item); $transaction = $this->add('xepan\\commerce\\Model_Store_TransactionRow'); $grid = $this->add('xepan\\hr\\Grid'); $form->addSubmit('Get Report'); if ($_GET['filter']) { $item = $this->app->stickyGET('item_id'); $transaction->addCondition('item_id', $_GET['item_id']); // throw new \Exception($transaction->count()->getOne(), 1); } /*else{ $transaction->addCondition('id',-1); }*/ $transaction->addExpression('sum_qty')->set(function ($m, $q) { return $m->_dsql()->group('from_warehouse')->sum($m->getElement('quantity')); })->caption('quantity'); $grid->setModel($transaction, ['from_warehouse', 'item_name', 'sum_qty']); $grid->addQuickSearch(['from_warehouse', 'item_name']); if ($form->isSubmitted()) { $grid->js()->reload(['item_id' => $form['item_id'], 'filter' => 1])->execute(); } }