function recursiveRender() { $descendants = $this->app->employee->ref('post_id')->descendantPosts(); $activity = $this->add('xepan\\base\\Model_Activity'); $activity->addExpression('post')->set(function ($m, $q) { $employee = $this->add('xepan\\hr\\Model_Employee'); $employee->addCondition('id', $m->getElement('contact_id')); $employee->setLimit(1); return $employee->fieldQuery('post_id'); }); $activity->addCondition('post', array_unique($descendants)); if (isset($this->report->employee)) { $activity->addCondition('related_contact_id', $this->report->employee); } if (isset($this->report->start_date)) { $activity->addCondition('created_at', '>', $this->report->start_date); } if (isset($this->report->end_date)) { $activity->addCondition('created_at', '<', $this->app->nextDate($this->report->end_date)); } $this->grid->setModel($activity, ['activity', 'created_at']); $this->grid->addPaginator(10); $this->grid->add('H2', null, 'grid_buttons')->set('Subordinates Activities')->addClass('text-muted'); $this->grid->removeSearchIcon(); return parent::recursiveRender(); }
function recursiveRender() { $attan_m = $this->add("xepan\\hr\\Model_Employee_Attandance"); $attan_m->addCondition('fdate', $this->app->today); $emp_model = $this->add('xepan\\hr\\Model_Employee'); if (isset($this->report->employee)) { $attan_m->tryLoadBy('employee_id', $this->report->employee); $emp_model->load($this->report->employee); } else { $attan_m->tryLoadBy('employee_id', $this->app->employee->id); $emp_model->load($this->app->employee->id); } $emp_name = $emp_model['name']; $view = $this->add('xepan\\base\\View_Widget_SingleInfo'); if (!$attan_m->loaded()) { $view->setIcon('fa fa-thumbs-down')->setHeading(strtoupper($emp_name) . ' IS NOT PRESENT')->setValue('-')->makeDanger(); } else { if ($attan_m['late_coming'] > 0) { $view->setIcon('fa fa-thumbs-down')->setHeading(date('h:i A', strtotime($attan_m['from_date'])) . ' ! ' . strtoupper($emp_name) . ' IS LATE BY ')->setValue($attan_m['late_coming'] . ' Minutes')->makeDanger(); } else { $view->setIcon('fa fa-thumbs-up')->setHeading(date('h:i A', strtotime($attan_m['from_date'])) . ' ! ' . strtoupper($emp_name) . ' IS EARLY BY ')->setValue(abs($attan_m['late_coming']) . ' Minutes')->makeSuccess(); } } return parent::recursiveRender(); }
function recursiveRender() { $this->grid->template->trySet('task_view_title', 'Followups'); $this->grid->js('reload')->reload(); if (!$this->grid->isEditing()) { $this->grid->grid->template->trySet('task_view_title', 'DepartmentFollowUps'); $this->grid->grid->addPaginator(10); } $this->grid->add('xepan\\base\\Controller_Avatar', ['name_field' => 'created_by', 'image_field' => 'created_by_image', 'extra_classes' => 'profile-img center-block', 'options' => ['size' => 50, 'display' => 'block', 'margin' => 'auto'], 'float' => null, 'model' => $this->model]); $followups_model = $this->add('xepan\\projects\\Model_Formatted_Task'); $followups_model->addCondition('status', ['Pending', 'Inprogress'])->addCondition('type', 'Followup'); $department_employees = $this->add('xepan\\hr\\Model_Employee')->addCondition('department_id', $this->app->employee['department_id']); if (isset($this->report->employee)) { $followups_model->addCondition($followups_model->dsql()->orExpr()->where('assign_to_id', $this->report->employee)->where($followups_model->dsql()->andExpr()->where('created_by_id', $this->report->employee)->where('assign_to_id', null))); } else { $followups_model->addCondition($followups_model->dsql()->orExpr()->where('assign_to_id', 'in', $department_employees->fieldQuery('id'))->where($followups_model->dsql()->andExpr()->where('created_by_id', 'in', $department_employees->fieldQuery('id'))->where('assign_to_id', null))); } if (isset($this->report->start_date)) { $followups_model->addCondition('starting_date', '>', $this->report->start_date); } if (isset($this->report->end_date)) { $followups_model->addCondition('starting_date', '<', $this->app->nextDate($this->report->end_date)); } $this->grid->setModel($followups_model)->setOrder('updated_at', 'desc'); return parent::recursiveRender(); }
function recursiveRender() { $communication_graph = $this->add('xepan\\communication\\Model_Communication'); $communication_graph->addExpression('date', 'date(created_at)'); $communication_graph->addExpression('score', 'count(*)'); if (isset($this->report->employee)) { $communication_graph->addCondition([['from_id', $this->report->employee], ['to_id', $this->report->employee]]); } if (isset($this->report->start_date)) { $communication_graph->addCondition('created_at', '>', $this->report->start_date); } if (isset($this->report->end_date)) { $communication_graph->addCondition('created_at', '<', $this->app->nextDate($this->report->end_date)); } $communication_graph->addCondition('status', '<>', 'Outbox'); $communication_graph->setOrder('date', 'asc')->_dsql()->group(['communication_type', $communication_graph->_dsql()->expr('[0]', [$communication_graph->getElement('date')])]); // $grid->setModel($communication_graph,['communication_type','status','date','employee_id','employee','score']); $data_array = []; foreach ($communication_graph as $model) { if (!isset($data_array[$model['date']])) { $data_array[$model['date']] = []; } $data_array[$model['date']] = array_merge($data_array[$model['date']], ['date' => $model['date'], $model['communication_type'] => $model['score']]); } $data_array = array_values($data_array); // echo "<pre>"; // var_dump($data_array); // exit; $this->chart = $this->add('xepan\\base\\View_Chart')->setType('bar')->setData(['json' => $data_array])->setGroup(['Email', 'Newsletter', 'Call', 'Personal', 'Comment', 'TeleMarketing'])->setXAxis('date')->setYAxises(['Email', 'Newsletter', 'Call', 'Personal', 'Comment', 'TeleMarketing'])->addClass('col-md-12')->setTitle('Communication'); return parent::recursiveRender(); }
function recursiveRender() { $employee = []; $task_performance = $this->add('xepan\\projects\\Model_Widget_TaskPerformance', ['employee' => $employee, 'start_date' => $this->report->start_date, 'end_date' => $this->app->nextDate($this->report->end_date)]); $view_info = $this->add('xepan\\projects\\View_infoBoxes'); $view_info->setModel($task_performance); return parent::recursiveRender(); }
function recursiveRender() { $attendances = $this->add('xepan\\hr\\Model_Employee_Attandance'); $attendances->addExpression('avg_work_hours')->set($attendances->dsql()->expr('AVG([0])', [$attendances->getElement('working_hours')])); $attendances->_dsql()->group('employee_id'); $this->chart->setType('bar')->setModel($attendances, 'employee', ['avg_work_hours'])->rotateAxis()->setTitle('Employee Avg Work Hour'); return parent::recursiveRender(); }
function recursiveRender() { $task_assigned_to_me_model = $this->add('xepan\\projects\\Model_Formatted_Task', null, null, ['widget\\tasktoreceive']); $task_assigned_to_me_model->addCondition('status', 'Assigned')->addCondition($task_assigned_to_me_model->dsql()->orExpr()->where('assign_to_id', $this->app->employee->id)->where($task_assigned_to_me_model->dsql()->andExpr()->where('created_by_id', $this->app->employee->id)->where('assign_to_id', null)))->addCondition('type', 'Task'); $this->view->template->trySet('t_count', $task_assigned_to_me_model->count()->getOne()); $this->view->template->trySet('url', $this->app->url('xepan_projects_mytasks')); return parent::recursiveRender(); }
function recursiveRender() { $attendances = $this->add('xepan\\hr\\Model_Employee_Attandance'); $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->chart->setType('bar')->setModel($attendances, 'employee', ['avg_late', 'avg_extra_work'])->rotateAxis()->setTitle('Employee Avg Late Coming & Extra Work'); return parent::recursiveRender(); }
function recursiveRender() { $model = $this->add('xepan\\marketing\\Model_Opportunity'); $model->addExpression('fund_sum')->set('sum(fund)'); $model->_dsql()->group('status'); $model->addCondition('created_at', '>', $this->report->start_date); $model->addCondition('created_at', '<', $this->app->nextDate($this->report->end_date)); $this->chart->setType('pie')->setLabelToValue(true)->setModel($model, 'status', ['fund_sum'])->setTitle('Opportunities Pipeline'); return parent::recursiveRender(); }
function recursiveRender() { $contact = $this->add('xepan\\base\\Model_Contact'); $contact->setOrder('created_at', 'desc'); $this->grid->setModel($contact, ['name', 'created_at', 'created_by', 'type']); $this->grid->addPaginator(10); $this->grid->add('H2', null, 'grid_buttons')->set('Recent Contacts')->addClass('text-muted'); $this->grid->removeSearchIcon(); return parent::recursiveRender(); }
function recursiveRender() { $model = $this->add('xepan\\marketing\\Model_Opportunity'); $model->addExpression('fund_sum')->set('sum(fund)'); $model->addExpression('source_filled')->set($model->dsql()->expr('IFNULL([0],"unknown")', [$model->getElement('source')])); $model->_dsql()->group('source_filled'); $model->addCondition('created_at', '>', $this->report->start_date); $model->addCondition('created_at', '<', $this->app->nextDate($this->report->end_date)); $this->chart->setType('pie')->setLabelToValue(true)->setModel($model, 'source_filled', ['fund_sum'])->setTitle('Opportunities From Sources'); return parent::recursiveRender(); }
function recursiveRender() { if (isset($this->report->department)) { $dept_id = $this->report->department; } else { $dept_id = ''; } $accountablity = $this->add('xepan\\projects\\Model_Widget_AccountableSystemUse', ['dept_id' => $dept_id, 'entity' => 'Department', 'start_date' => $this->report->start_date, 'end_date' => $this->app->nextDate($this->report->end_date)]); $this->chart->setType('bar')->setModel($accountablity, 'name', ['pending_works', 'please_receive', 'received_so_far', 'total_tasks_assigned', 'take_report_on_pending', 'check_submitted'])->setGroup([['received_so_far', 'total_tasks_assigned'], ['pending_works', 'take_report_on_pending']])->setTitle('Staff Accountable System Use')->openOnClick('xepan_projects_widget_accountablesystemuse'); return parent::recursiveRender(); }
function recursiveRender() { $post_employees = $this->add('xepan\\hr\\Model_Employee'); $post_employees->addCondition('post_id', $this->app->employee['post_id']); $employee = []; foreach ($post_employees as $emp) { $employee[] = $emp->id; } $task_performance = $this->add('xepan\\projects\\Model_Widget_TaskPerformance', ['employee' => $employee, 'start_date' => $this->report->start_date, 'end_date' => $this->app->nextDate($this->report->end_date)]); $view_info = $this->add('xepan\\projects\\View_infoBoxes'); $view_info->setModel($task_performance); return parent::recursiveRender(); }
function recursiveRender() { $employee = $this->add('xepan\\hr\\Model_Employee_Active'); $total_employees = $employee->count()->getOne(); $employee = $this->add('xepan\\hr\\Model_Employee'); $employee->addExpression('present_today')->set(function ($m, $q) { return $m->refSQL('Attendances')->addCondition('employee_id', $q->getField('id'))->addCondition('from_date', '>=', $this->app->today)->count(); })->type('boolean'); $employee->addCondition('present_today', true); $present_employees = $employee->count()->getOne(); $this->chart->setData(['columns' => [['present', $present_employees / $total_employees * 100]], 'type' => 'gauge'])->setTitle('Work Force Available')->setOption('color', ['pattern' => ['#FF0000', '#F97600', '#F6C600', '#60B044'], 'threshold' => ['values' => [30, 60, 90, 100]]])->openOnClick('xepan_hr_widget_todaysattendance'); return parent::recursiveRender(); }
function recursiveRender() { $this->grid->template->trySet('task_view_title', 'Overdue Tasks'); $this->grid->js('reload')->reload(); if (!$this->grid->isEditing()) { $this->grid->grid->template->trySet('task_view_title', 'Overdue Tasks'); $this->grid->grid->template->trySet('title_url', $this->app->url('xepan_projects_mytasks')); $this->grid->grid->addPaginator(10); } $this->grid->add('xepan\\base\\Controller_Avatar', ['name_field' => 'created_by', 'image_field' => 'created_by_image', 'extra_classes' => 'profile-img center-block', 'options' => ['size' => 50, 'display' => 'block', 'margin' => 'auto'], 'float' => null, 'model' => $this->model]); $task_assigned_to_me_model = $this->add('xepan\\projects\\Model_Formatted_Task'); $task_assigned_to_me_model->addCondition('status', ['Pending', 'Inprogress', 'Assigned'])->addCondition($task_assigned_to_me_model->dsql()->orExpr()->where('assign_to_id', $this->app->employee->id)->where($task_assigned_to_me_model->dsql()->andExpr()->where('created_by_id', $this->app->employee->id)->where('assign_to_id', null)))->addCondition('deadline', '<', $this->app->now)->addCondition('type', 'Task'); $this->grid->setModel($task_assigned_to_me_model)->setOrder('updated_at', 'desc'); return parent::recursiveRender(); }
function init() { parent::init(); $this->view = $this->add('View', null, null, ['view\\dashboard\\smallbox']); $this->view->setStyle('cursor', 'pointer'); $this->customer_v_page = $this->add('VirtualPage'); $this->customer_v_page->set(function ($vp) { $customer = $vp->add('xepan\\commerce\\Model_Customer'); $customer->addExpression('online_unpaid_order')->set($customer->refSQL('QSPMaster')->addCondition('status', 'OnlineUnpaid')->count()); $customer->addCondition('online_unpaid_order', '>', 0); $crud = $vp->add('xepan\\hr\\CRUD', ['action_page' => 'xepan_commerce_customerdetail', 'allow_add' => false], null, ['view/customer/grid']); $crud->setModel($customer)->setOrder('created_at', 'desc'); $crud->grid->addPaginator(20); }); }
function recursiveRender() { $this->start_date = $this->report->start_date; $this->end_date = $this->app->nextDate($this->report->end_date); $model = $this->add('xepan\\hr\\Model_Employee'); $model->addExpression('Newsletter')->set(function ($m, $q) { return $this->add('xepan\\communication\\Model_Communication')->addCondition('from_id', $q->getField('id'))->addCondition('communication_type', 'Newsletter')->addCondition('status', '<>', 'Outbox')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->count(); }); $model->addExpression('TeleMarketing')->set(function ($m, $q) { return $this->add('xepan\\communication\\Model_Communication')->addCondition('from_id', $q->getField('id'))->addCondition('communication_type', 'TeleMarketing')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->count(); }); $model->addCondition([['TeleMarketing', '>', 0], ['Newsletter', '>', 0]]); $model->addCondition('status', 'Active'); $this->chart->setType('bar')->setModel($model, 'name', ['Newsletter', 'TeleMarketing'])->setGroup(['Newsletter', 'TeleMarketing'])->setTitle('Mass Communication')->rotateAxis()->openOnClick('xepan_marketing_widget_masscommunication'); return parent::recursiveRender(); }
function recursiveRender() { $attendances = $this->add('xepan\\hr\\Model_Employee_Attandance'); $attendances->addExpression('employee_department')->set(function ($m, $q) { return $this->add('xepan\\hr\\Model_Employee')->addCondition('id', $m->getElement('employee_id'))->setLimit(1)->fieldQuery('department_id'); }); if (isset($this->report->department)) { $attendances->addCondition('employee_department', $this->report->department); } else { $attendances->addCondition('employee_department', $this->app->employee['department_id']); } $attendances->addExpression('avg_work_hours')->set($attendances->dsql()->expr('AVG([0])', [$attendances->getElement('working_hours')])); $attendances->_dsql()->group('employee_id'); $this->chart->setType('bar')->setModel($attendances, 'employee', ['avg_work_hours'])->rotateAxis()->setTitle('Employee Avg Work Hour')->openOnClick('xepan_hr_widget_averageworkhour'); return parent::recursiveRender(); }
function recursiveRender() { $ledgrofdebtor_m = $this->add('xepan\\accounts\\Model_Ledger'); $ledgrofdebtor_m->addCondition('group', 'Sundry Debtor'); $trans_row_m = $this->add('xepan\\accounts\\Model_TransactionRow'); if (isset($this->report->ledger)) { $ledgrofdebtor_m->addCondition('id', $this->report->ledger); $trans_row_m->addCondition('ledger_id', $this->report->ledger); } $ledgrofdebtor_m->getElement('created_at')->destroy(); $trow_j = $ledgrofdebtor_m->join('account_transaction_row.ledger_id'); $trow_j->addField('ledger_id'); $trow_j->addField('transaction_id'); $trow_j->addField('original_amount_dr', '_amountDr'); $trow_j->addField('original_amount_cr', '_amountCr'); $trow_j->addField('exchange_rate'); $trns = $trow_j->join('account_transaction', 'transaction_id'); $trns->addField('transaction_type_id'); $trns->addField('created_at'); $ledgrofdebtor_m->addExpression('type_of_trans')->set(function ($m, $q) { $trans_type = $this->add('xepan\\accounts\\Model_TransactionType'); $trans_type->addCondition('id', $m->getElement('transaction_type_id')); return $trans_type->fieldQuery('name'); }); $ledgrofdebtor_m->_dsql()->group('type_of_trans'); $ledgrofdebtor_m->addExpression('amountDr')->set($ledgrofdebtor_m->dsql()->expr('round(([0]*[1]),2)', [$ledgrofdebtor_m->getElement('original_amount_dr'), $ledgrofdebtor_m->getElement('exchange_rate')])); $ledgrofdebtor_m->addExpression('amountCr')->set($ledgrofdebtor_m->dsql()->expr('round(([0]*[1]),2)', [$ledgrofdebtor_m->getElement('original_amount_cr'), $ledgrofdebtor_m->getElement('exchange_rate')])); $ledgrofdebtor_m->addExpression('total_amount_cr')->set(function ($m, $q) { return $q->sum($m->getElement('amountCr')); })->type('money'); $ledgrofdebtor_m->addExpression('total_amount_dr')->set(function ($m, $q) { return $q->sum($m->getElement('amountDr')); })->type('money'); if (isset($this->report->start_date)) { $ledgrofdebtor_m->addCondition('created_at', '>', $this->report->start_date); } if (isset($this->report->end_date)) { $ledgrofdebtor_m->addCondition('created_at', '<', $this->app->nextDate($this->report->end_date)); } $this->grid->setModel($ledgrofdebtor_m, ['ledger_id', 'transaction_id', 'type_of_trans', 'amountDr', 'amountCr', 'total_amount_cr', 'total_amount_dr']); // $this->chart->setType('bar') // ->setModel($ledgrofdebtor_m,'trans_type',['type_of_trans']) // ->setGroup(['trans_type','type_of_trans']) // ->setTitle('Ledger Info'); return parent::recursiveRender(); }
function recursiveRender() { $model = $this->add('xepan\\marketing\\Model_Lead'); $model->addExpression('lead_count')->set('count(*)'); $model->addExpression('score_sum')->set(function ($m, $q) { return $q->expr('IFNULL([0],0)', [$this->add('xepan\\base\\Model_PointSystem')->addCondition('contact_id', $q->getField('id'))->sum('score')]); }); $model->addExpression('Date', 'DATE(created_at)'); $model->addExpression('Month', 'DATE_FORMAT(created_at,"%Y %M")'); $model->addExpression('Year', 'YEAR(created_at)'); $model->addExpression('Week', 'WEEK(created_at)'); $model->_dsql()->group('Date'); $model->addCondition('created_at', '>', $this->report->start_date); $model->addCondition('created_at', '<', $this->app->nextDate($this->report->end_date)); $this->chart->setType('line')->setModel($model, 'Date', ['lead_count', 'score_sum'])->setTitle('Lead Count Vs Score'); return parent::recursiveRender(); }
function recursiveRender() { $this->start_date = $this->report->start_date; $this->end_date = $this->app->nextDate($this->report->end_date); $model = $this->add('xepan\\hr\\Model_Employee'); $model->hasMany('xepan\\marketing\\Opportunity', 'assign_to_id', null, 'Oppertunities'); $model->addExpression('Open')->set($model->refSQL('Oppertunities')->addCondition('status', 'Open')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->sum('fund')); $model->addExpression('Qualified')->set($model->refSQL('Oppertunities')->addCondition('status', 'Qualified')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->sum('fund')); $model->addExpression('NeedsAnalysis')->set($model->refSQL('Oppertunities')->addCondition('status', 'NeedsAnalysis')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->sum('fund')); $model->addExpression('Quoted')->set($model->refSQL('Oppertunities')->addCondition('status', 'Quoted')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->sum('fund')); $model->addExpression('Negotiated')->set($model->refSQL('Oppertunities')->addCondition('status', 'Negotiated')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->sum('fund')); $model->addExpression('Won')->set($model->refSQL('Oppertunities')->addCondition('status', 'Won')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->sum('fund')); $model->addExpression('Lost')->set($model->refSQL('Oppertunities')->addCondition('status', 'Lost')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->sum('fund')); $model->addCondition([['Open', '>', 0], ['Qualified', '>', 0], ['NeedsAnalysis', '>', 0], ['Quoted', '>', 0], ['Negotiated', '>', 0]]); $model->addCondition('status', 'Active'); $this->chart->setType('bar')->setModel($model, 'name', ['Open', 'Qualified', 'NeedsAnalysis', 'Quoted', 'Negotiated'])->setGroup(['Open', 'Qualified', 'NeedsAnalysis', 'Quoted', 'Negotiated'])->setTitle('Sales Staff Status')->rotateAxis()->openOnClick('xepan_marketing_widget_salesstaffstatus'); return parent::recursiveRender(); }
function recursiveRender() { $communication_model = $this->add('xepan\\communication\\Model_Communication'); $communication_model->addExpression('date', 'date(created_at)'); $communication_model->addCondition([['from_id', $this->app->employee->id], ['to_id', $this->app->employee->id]]); $communication_model->addCondition('communication_type', '<>', ['Newsletter', 'ReminderEmail']); if (isset($this->report->start_date)) { $communication_model->addCondition('created_at', '>', $this->report->start_date); } if (isset($this->report->end_date)) { $communication_model->addCondition('created_at', '<', $this->app->nextDate($this->report->end_date)); } $this->grid->setModel($communication_model, ['to', 'title', 'communication_type', 'created_at']); $this->grid->addPaginator(10); $this->grid->add('H2', null, 'grid_buttons')->set('My Communications')->addClass('text-muted'); $this->grid->removeSearchIcon(); return parent::recursiveRender(); }
function recursiveRender() { $detail = $this->add('xepan\\commerce\\Model_QSP_Detail'); $detail->addExpression('doc_type')->set(function ($m, $q) { return $m->refSQL('qsp_master_id')->fieldQuery('type'); }); $detail->addExpression('from')->set(function ($m, $q) { return $m->refSQL('qsp_master_id')->fieldQuery('from'); }); $detail->addCondition('doc_type', 'SalesOrder'); $detail->addCondition('from', 'Online'); $detail->addExpression('count', 'count(*)'); $detail->_dsql()->group('item_id'); $detail->setOrder('count', 'desc'); $detail->setLimit(5); $this->grid->setModel($detail, ['item', 'count']); return parent::recursiveRender(); }
function recursiveRender() { $emp = $this->add('xepan\\hr\\Model_Employee'); $emp->load($this->app->employee->id); $allowed_emails = $emp->getAllowEmails(); $count = 0; foreach ($allowed_emails as $email) { $email_setting = $this->add('xepan\\communication\\Model_Communication_EmailSetting'); $email_setting->load($email); $allow_email = $this->add('xepan\\communication\\Model_Communication_Email_Received'); $allow_email->addCondition('mailbox', $email_setting['email_username'] . '#INBOX'); $allow_email->addCondition('extra_info', 'not like', '%' . $this->app->employee->id . '%'); $count += $allow_email->count()->getOne(); } $this->view->template->trySet('count', $count); $this->view->template->trySet('url', $this->app->url('xepan_communication_emails')); return parent::recursiveRender(); }
function recursiveRender() { $attendance_m = $this->add('xepan\\hr\\Model_Employee'); if (isset($this->report->department)) { $attendance_m->addCondition('department_id', $this->report->department); } else { $attendance_m->addCondition('department_id', $this->app->employee->id); } $attendance_m->addExpression('from_date')->set(function ($m, $q) { $att = $this->add('xepan\\hr\\Model_Employee_Attandance'); $att->addCondition('employee_id', $m->getElement('id'))->addCondition('fdate', $this->app->today)->setLimit(1); return $att->fieldQuery('from_date'); }); $attendance_m->addExpression('late_coming')->set(function ($m, $q) { $att = $this->add('xepan\\hr\\Model_Employee_Attandance'); $att->addCondition('employee_id', $m->getElement('id'))->addCondition('fdate', $this->app->today)->setLimit(1); return $att->fieldQuery('late_coming'); }); $attendance_m->setOrder('late_coming', 'desc'); $this->grid->setModel($attendance_m, ['name', 'from_date', 'late_coming']); $this->grid->addPaginator(50); $this->grid->addHook('formatRow', function ($g) { if ($g->model['from_date'] == null) { $g->current_row_html['in_at'] = 'Not In'; } else { $g->current_row_html['in_at'] = date('h:i A', strtotime($g->model['from_date'])); } if ($g->model['late_coming'] > 0) { $g->current_row_html['icon-class'] = 'fa fa-thumbs-o-down'; $g->current_row_html['text-class'] = 'red'; } else { $g->current_row_html['icon-class'] = 'fa fa-thumbs-o-up'; $g->current_row_html['text-class'] = 'green'; } if ($g->model['from_date'] == null) { $g->current_row_html['text-class'] = 'gray'; } else { $g->current_row_html['dummy'] = ' '; } }); $this->grid->js('click')->_selector('.xepan-widget-employee-attendance')->univ()->frameURL('Attendance Detail', [$this->api->url('xepan_hr_widget_attendance'), 'emp_id' => $this->js()->_selectorThis()->closest('[data-id]')->data('id')]); return parent::recursiveRender(); }
function recursiveRender() { $activity = $this->add('xepan\\base\\Model_Activity'); if (isset($this->report->employee)) { $activity->addCondition('related_contact_id', $this->report->employee); } if (isset($this->report->start_date)) { $activity->addCondition('created_at', '>', $this->report->start_date); } if (isset($this->report->end_date)) { $activity->addCondition('created_at', '<', $this->app->nextDate($this->report->end_date)); } $this->grid->setModel($activity, ['activity', 'created_at']); $this->grid->addPaginator(10); $this->grid->add('H2', null, 'grid_buttons')->set('Global Activities')->addClass('text-muted'); $this->grid->removeSearchIcon(); $this->js(true)->univ()->setInterval($this->grid->js()->reload()->_enclose(), 200000); return parent::recursiveRender(); }
function recursiveRender() { $this->start_date = $this->report->start_date; $this->end_date = $this->app->nextDate($this->report->end_date); $model = $this->add('xepan\\hr\\Model_Employee'); $model->addExpression('Email')->set(function ($m, $q) { return $this->add('xepan\\communication\\Model_Communication')->addCondition([['from_id', $q->getField('id')], ['to_id', $q->getField('id')]])->addCondition('communication_type', 'Email')->addCondition('status', '<>', 'Outbox')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->count(); }); $model->addExpression('Call')->set(function ($m, $q) { return $this->add('xepan\\communication\\Model_Communication')->addCondition([['from_id', $q->getField('id')], ['to_id', $q->getField('id')]])->addCondition('communication_type', 'Call')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->count(); }); $model->addExpression('Meeting')->set(function ($m, $q) { return $this->add('xepan\\communication\\Model_Communication')->addCondition([['from_id', $q->getField('id')], ['to_id', $q->getField('id')]])->addCondition('communication_type', 'Personal')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->count(); }); $model->addCondition([['Email', '>', 0], ['Call', '>', 0], ['Meeting', '>', 0]]); $model->addCondition('status', 'Active'); $this->chart->setType('bar')->setModel($model, 'name', ['Email', 'Call', 'Meeting'])->setGroup(['Email', 'Call', 'Meeting'])->setTitle('Sales Staff Communication')->rotateAxis()->openOnClick('xepan_marketing_widget_salesstaffcommunication'); return parent::recursiveRender(); }
function recursiveRender() { $this->start_date = $this->report->start_date; $this->end_date = $this->app->nextDate($this->report->end_date); $model = $this->add('xepan\\hr\\Model_Employee'); if (isset($this->report->department)) { $model->addCondition('department_id', $this->report->department); } else { $model->addCondition('department_id', $this->app->employee->id); } $model->addExpression('Email')->set(function ($m, $q) { return $this->add('xepan\\communication\\Model_Communication')->addCondition([['from_id', $q->getField('id')], ['to_id', $q->getField('id')]])->addCondition('communication_type', 'Email')->addCondition('status', '<>', 'Outbox')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->count(); }); // $model->addExpression('Newsletter')->set(function($m,$q){ // return $this->add('xepan\communication\Model_Communication') // ->addCondition([['from_id',$q->getField('id')],['to_id',$q->getField('id')]]) // ->addCondition('communication_type','Newsletter') // ->addCondition('status','<>','Outbox') // ->addCondition('created_at','>',$this->start_date) // ->addCondition('created_at','<',$this->end_date) // ->count(); // }); $model->addExpression('Call')->set(function ($m, $q) { return $this->add('xepan\\communication\\Model_Communication')->addCondition([['from_id', $q->getField('id')], ['to_id', $q->getField('id')]])->addCondition('communication_type', 'Call')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->count(); }); // $model->addExpression('TeleMarketing')->set(function($m,$q){ // return $this->add('xepan\communication\Model_Communication') // ->addCondition([['from_id',$q->getField('id')],['to_id',$q->getField('id')]]) // ->addCondition('communication_type','TeleMarketing') // ->addCondition('created_at','>',$this->start_date) // ->addCondition('created_at','<',$this->end_date) // ->count(); // }); // ,['TeleMarketing','>',0],['Newsletter','>',0] $model->addExpression('Meeting')->set(function ($m, $q) { return $this->add('xepan\\communication\\Model_Communication')->addCondition([['from_id', $q->getField('id')], ['to_id', $q->getField('id')]])->addCondition('communication_type', 'Personal')->addCondition('created_at', '>', $this->start_date)->addCondition('created_at', '<', $this->end_date)->count(); }); $model->addCondition([['Email', '>', 0], ['Call', '>', 0], ['Meeting', '>', 0]]); $model->addCondition('status', 'Active'); $this->chart->setType('bar')->setModel($model, 'name', ['Email', 'Call', 'Meeting'])->setGroup(['Email', 'Call', 'Meeting'])->setTitle('Department Communication')->rotateAxis()->openOnClick('xepan_marketing_widget_daybydaycommunication'); return parent::recursiveRender(); }
function recursiveRender() { $bsbalancesheet = $this->add('xepan\\accounts\\Model_BSBalanceSheet'); $bsbalancesheet->addCondition('report_name', 'Profit & Loss'); if (isset($this->report->start_date)) { $from_date = $this->report->start_date; } if (isset($this->report->end_date)) { $to_date = $this->report->end_date; } // $report = $bsbalancesheet->getPandL($from_date,$to_date); // $left=$report['left']; // var_dump($left); // $right=$report['right']; // $left_sum = $report['left_sum']; // $right_sum = $report['right_sum']; // $this->grid->setModel($report,['left','right','left_sum','right_sum']); $this->chart->setType('bar')->setModel($bsbalancesheet, 'name', ['left', 'right'])->setGroup(['left_sum', 'right_sum'])->setTitle('Pandl Report')->rotateAxis(); return parent::recursiveRender(); }
function recursiveRender() { $timesheet = $this->add('xepan\\projects\\Model_Timesheet'); if (isset($this->report->project)) { $timesheet->addCondition('project_id', $this->report->project); } if (isset($this->report->start_date)) { $timesheet->addCondition('starttime', '>', $this->report->start_date); } if (isset($this->report->end_date)) { $timesheet->addCondition('endtime', '<', $this->app->nextDate($this->report->end_date)); } if (isset($this->report->employee)) { $timesheet->addCondition('employee_id', $this->report->employee); } $this->grid->setModel($timesheet, ['task', 'starttime', 'endtime', 'duration', 'project']); $this->grid->addPaginator(10); $this->grid->add('H2', null, 'grid_buttons')->set('Employee Timesheet')->addClass('text-muted'); $this->grid->removeSearchIcon(); return parent::recursiveRender(); }