def index(request): """ Some description here. """ if not request.user.is_authenticated: return redirect('/') context = {} context['resource_url'] = request.session.get('resource') token_manager = TokenManager( resource=request.session.get('resource'), tenant=request.session.get('tenant'), client_id=request.session.get('client_id'), client_secret=request.session.get('client_secret'), username=request.session.get('username'), password=request.session.get('password')) data_fetcher = DataFetcher(token_manager) batch_job_error = BatchJobErrorSummary(data_fetcher) batch_job_error.fetch_data() batch_job_executing = BatchJobExecutingSummary(data_fetcher) batch_job_executing.fetch_data() batch_job_waiting = BatchJobWaitingSummary(data_fetcher) batch_job_waiting.fetch_data() batch_job_withhold = BatchJobWithholdSummary(data_fetcher) batch_job_withhold.fetch_data() print('=========================================> SQL ANALYSES: Comecou', ) sql_blocking = SqlBlocking(data_fetcher) sql_blocking.fetch_data() sql_lock_info = SqlLockInfo(data_fetcher) sql_lock_info.fetch_data() sql_info = SqlInfo(data_fetcher) sql_info.fetch_data() print('=========================================> BLOCKING: ', len(sql_blocking.get_context_value())) print('=========================================> LOCK: ', len(sql_lock_info.get_context_value())) print('=========================================> INFO: ', sql_info.get_context_value()) context[batch_job_error.get_context_key( )] = batch_job_error.get_context_value() context[batch_job_executing.get_context_key( )] = batch_job_executing.get_context_value() context[batch_job_waiting.get_context_key( )] = batch_job_waiting.get_context_value() context[batch_job_withhold.get_context_key( )] = batch_job_withhold.get_context_value() return render(request, 'sysadmin/index.html', context)
def index(request): """ Some description here. """ if not request.user.is_authenticated: return redirect('/') context = {} context['resource_url'] = request.session.get('resource') token_manager = TokenManager( resource=request.session.get('resource'), tenant=request.session.get('tenant'), client_id=request.session.get('client_id'), client_secret=request.session.get('client_secret'), username=request.session.get('username'), password=request.session.get('password')) data_fetcher = DataFetcher(token_manager) legak_entities = LegalEntities(data_fetcher) legak_entities.fetch_data() open_cases_summary = OpenCasesSummary(data_fetcher) open_cases_summary.fetch_data() open_leads_summary = OpenLeadsSummary(data_fetcher) open_leads_summary.fetch_data() active_opportunities_summary = ActiveOpportunitiesSummary(data_fetcher) active_opportunities_summary.fetch_data() backend_sales_order_summary = BackendSalesOrdersSummary(data_fetcher) backend_sales_order_summary.fetch_data() latest_sales_order_summary = LatestSalesOrders(data_fetcher) latest_sales_order_summary.fetch_data() latest_won_opportunities_summary = LatestWonOpportunities(data_fetcher) latest_won_opportunities_summary.fetch_data() context[ legak_entities.get_context_key()] = legak_entities.get_context_value() context[open_cases_summary.get_context_key( )] = open_cases_summary.get_context_value() context[open_leads_summary.get_context_key( )] = open_leads_summary.get_context_value() context[active_opportunities_summary.get_context_key( )] = active_opportunities_summary.get_context_value() context[backend_sales_order_summary.get_context_key( )] = backend_sales_order_summary.get_context_value() context[latest_sales_order_summary.get_context_key( )] = latest_sales_order_summary.get_context_value() context[latest_won_opportunities_summary.get_context_key( )] = latest_won_opportunities_summary.get_context_value() return render(request, 'sales/index.html', context)
def change_company(request, company): token_manager = TokenManager() token_manager.unpack(request.session['token_pack']) data_fetcher = DataFetcher(token_manager) legal_entities = LegalEntities(data_fetcher) legal_entities.fetch_data() entity_ids = [] for entity in legal_entities.get_context_value(): entity_ids.append(entity['LegalEntityId']) if company in entity_ids: request.session['cur_ext'] = company else: messages.add_message(request, messages.ERROR, 'Company {0} does not exist.'.format(company)) return redirect('/operations')
def sales_orders(request): token_manager = TokenManager() token_manager.unpack(request.session['token_pack']) data_fetcher = DataFetcher(token_manager) user_info_service = UserInfoService(data_fetcher) user_info_service.fetch_data() legal_entities = LegalEntities(data_fetcher) legal_entities.fetch_data() context = {} context['cur_ext'] = request.session['cur_ext'] context[ legal_entities.get_context_key()] = legal_entities.get_context_value() context[user_info_service.get_context_key( )] = user_info_service.get_context_value() return render(request, 'operations/sales_orders.html', {})
def index(request): """ Some description here. """ if not request.user.is_authenticated: return redirect('/login') context = {} context['resource_url'] = request.session.get('resource') token_manager = TokenManager() token_manager.unpack(request.session['token_pack']) data_fetcher = DataFetcher(token_manager) user_info_service = UserInfoService(data_fetcher) user_info_service.fetch_data() legal_entities = LegalEntities(data_fetcher) legal_entities.fetch_data() if not request.session.get('cur_ext'): request.session['cur_ext'] = user_info_service.get_context_value( )['Company'] sales_orders_summary = SalesOrdersSummary(data_fetcher) sales_orders_summary.extra_filters(dataAreaId=request.session['cur_ext']) sales_orders_summary.fetch_data() purch_orders_summary = PurchOrdersSummary(data_fetcher) purch_orders_summary.extra_filters(dataAreaId=request.session['cur_ext']) purch_orders_summary.fetch_data() free_text_invoice_summary = FreeTextInvoiceSummary(data_fetcher) free_text_invoice_summary.extra_filters( dataAreaId=request.session['cur_ext']) free_text_invoice_summary.fetch_data() latest_sales_order = LatestSalesOrders(data_fetcher) latest_sales_order.extra_filters(dataAreaId=request.session['cur_ext']) latest_sales_order.fetch_data() latest_sales_invoice = LatestSalesInvoices(data_fetcher) latest_sales_invoice.extra_filters(dataAreaId=request.session['cur_ext']) latest_sales_invoice.fetch_data() context[sales_orders_summary.get_context_key( )] = sales_orders_summary.get_context_value() context[purch_orders_summary.get_context_key( )] = purch_orders_summary.get_context_value() context[free_text_invoice_summary.get_context_key( )] = free_text_invoice_summary.get_context_value() context[latest_sales_order.get_context_key( )] = latest_sales_order.get_context_value() context[latest_sales_invoice.get_context_key( )] = latest_sales_invoice.get_context_value() context[ legal_entities.get_context_key()] = legal_entities.get_context_value() context[user_info_service.get_context_key( )] = user_info_service.get_context_value() context['cur_ext'] = request.session['cur_ext'] return render(request, 'operations/index.html', context)