loadDatePicker(); // get listings assigned to the current operator (no listings equals to all listings) $listings = array_filter( array_map('intval', (array) $permissions->get('rooms', [])) ); // get the name of all listings, if not all $listing_names = []; if ($listings) { foreach (VikBooking::getAvailabilityInstance()->loadRooms() as $room_id => $room_data) { if (in_array($room_id, $listings)) { // push listing name $listing_names[] = $room_data['name']; } } } // access one report object $report = VikBooking::getReportInstance('rates_flow'); // access the finance helper object $finance = VBOTaxonomyFinance::getInstance(); // currency symbol $currencysymb = VikBooking::getCurrencySymb(); // get date format $df = $report->getDateFormat(); // get dates from filters $from_date = $app->getUserStateFromRequest('vbo.operators.tools.finance.fromdt', 'from_date', date($df, mktime(0, 0, 0, date('n'), 1, date('Y'))), 'string'); $to_date = $app->getUserStateFromRequest('vbo.operators.tools.finance.todt', 'to_date', date($df), 'string'); // get calculation type from filters ("stay_dates" or "booking_dates") $calc_type = $app->getUserStateFromRequest('vbo.operators.tools.finance.type', 'calc_type', 'stay_dates', 'string'); // get the financial stats for the requested dates try { $stats = $finance->getStats($from_date, $to_date, $listings, $calc_type); } catch (Exception $e) { // propagate the error VBOHttpDocument::getInstance()->close($e->getCode(), $e->getMessage()); } ?>