reports is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with reports. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ $USEDBREPLICATE = 1; $DBCONNECTION_REQUIRED = 0; include "../../../../inc/includes.php"; //TRANS: The name of the report = Applications by locations and versions $report = new PluginReportsAutoReport(__('applicationsbylocation_report_title', 'reports')); $softwarecategories = new PluginReportsSoftwareCategoriesCriteria($report, 'softwarecategories', __('Software category')); $softwarecategories->setSqlField("`glpi_softwarecategories`.`id`"); $software = new PluginReportsSoftwareCriteria($report, 'software', __('Applications', 'reports')); $software->setSqlField("`glpi_softwares`.`id`"); $statecpt = new PluginReportsStatusCriteria($report, 'statecpt', __('Computer status', 'reports')); $statecpt->setSqlField("`glpi_computers`.`states_id`"); $location = new PluginReportsLocationCriteria($report, 'location', _n('Location', 'Locations', 2)); $location->setSqlField("`glpi_computers`.`locations_id`"); $report->displayCriteriasForm(); // Form validate and only one software with license if ($report->criteriasValidated()) { $report->setSubNameAuto(); $report->setColumns(array(new PluginReportsColumnLink('soft', _n('Software', 'Software', 1), 'Software', array('sorton' => 'soft,version')), new PluginReportsColumnLink('locat', _n('Location', 'Locations', 1), 'Location', array('sorton' => 'glpi_locations.name')), new PluginReportsColumnLink('computer', _n('Computer', 'Computers', 1), 'Computer', array('sorton' => 'glpi_computers.name')), new PluginReportsColumn('statecpt', _n('Status', 'Statuses', 1)), new PluginReportsColumnLink('version', __('Version name'), 'SoftwareVersion'), new PluginReportsColumnLink('user', _n('User', 'Users', 1), 'User', array('sorton' => 'glpi_users.name')))); $query = "SELECT `glpi_softwareversions`.`softwares_id` AS soft,\n `glpi_softwareversions`.`name` AS software,\n `glpi_locations`.`id` AS locat,\n `glpi_computers`.`id` AS computer,\n `state_ver`.`name` AS statever,\n `state_cpt`.`name` AS statecpt,\n `glpi_locations`.`name` as location,\n `glpi_softwareversions`.`id` AS version,\n `glpi_computers`.`users_id` AS user\n FROM `glpi_softwareversions`\n INNER JOIN `glpi_computers_softwareversions`\n ON (`glpi_computers_softwareversions`.`softwareversions_id` = `glpi_softwareversions`.`id`)\n INNER JOIN `glpi_computers`\n ON (`glpi_computers_softwareversions`.`computers_id` = `glpi_computers`.`id`)\n INNER JOIN `glpi_softwares`\n ON (`glpi_softwares`.`id` = `glpi_softwareversions`.`softwares_id`)\n LEFT JOIN `glpi_softwarecategories`\n ON (`glpi_softwares`.`softwarecategories_id` = `glpi_softwarecategories`.`id`)\n LEFT JOIN `glpi_locations`\n ON (`glpi_locations`.`id` = `glpi_computers`.`locations_id`)\n LEFT JOIN `glpi_states` state_ver\n ON (`state_ver`.`id` = `glpi_softwareversions`.`states_id`)\n LEFT JOIN `glpi_states` state_cpt\n ON (`state_cpt`.`id` = `glpi_computers`.`states_id`) " . getEntitiesRestrictRequest('WHERE', 'glpi_softwareversions') . $report->addSqlCriteriasRestriction() . "ORDER BY soft ASC, locat ASC"; $report->setSqlRequest($query); $report->execute(); }
$DBCONNECTION_REQUIRED = 0; include "../../../../inc/includes.php"; //TRANS: The name of the report = Search in the financial information (plural) $report = new PluginReportsAutoReport(__('searchinfocom_report_title', 'reports')); //Report's search criterias new PluginReportsDateIntervalCriteria($report, 'order_date', __('Order date')); new PluginReportsDateIntervalCriteria($report, 'buy_date', __('Date of purchase')); new PluginReportsDateIntervalCriteria($report, 'delivery_date', __('Delivery date')); new PluginReportsDateIntervalCriteria($report, 'use_date', __('Startup date')); new PluginReportsDateIntervalCriteria($report, 'inventory_date', __('Date of last physical inventory')); new PluginReportsTextCriteria($report, 'immo_number', __('Immobilization number')); new PluginReportsTextCriteria($report, 'order_number', __('Order number')); new PluginReportsTextCriteria($report, 'delivery_number', __('Delivery form')); new PluginReportsDropdownCriteria($report, 'budgets_id', 'glpi_budgets', __('Budget')); //Display criterias form is needed $report->displayCriteriasForm(); //If criterias have been validated if ($report->criteriasValidated()) { // Report title $report->setSubNameAuto(); // Report Columns $cols = array(new PluginReportsColumnType('itemtype', __('Type')), new PluginReportsColumnTypeLink('items_id', __('Item'), 'itemtype', array('with_comment' => 1)), new PluginReportsColumnDate('order_date', __('Order date')), new PluginReportsColumn('order_number', __('Order number')), new PluginReportsColumnDate('buy_date', __('Date of purchase')), new PluginReportsColumn('delivery_date', __('Delivery date')), new PluginReportsColumn('delivery_number', __('Delivery form')), new PluginReportsColumn('immo_number', __('Immobilization number')), new PluginReportsColumnDate('use_date', __('Startup date')), new PluginReportsColumnDate('inventory_date', __('Date of last physical inventory')), new PluginReportsColumnLink('budgets_id', __('Budget'), 'Budget')); $report->setColumns($cols); // Build SQL request $sql = "SELECT *\n FROM `glpi_infocoms`\n WHERE `itemtype` NOT IN ('Software', 'CartridgeItem', 'ConsumableItem')" . $report->addSqlCriteriasRestriction() . getEntitiesRestrictRequest('AND', 'glpi_infocoms') . "ORDER BY `itemtype`"; $report->setGroupBy('itemtype'); $report->setSqlRequest($sql); $report->execute(); } else { Html::footer(); }