• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Infocom类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Infocom的典型用法代码示例。如果您正苦于以下问题:PHP Infocom类的具体用法?PHP Infocom怎么用?PHP Infocom使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Infocom类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: addInfocomsForComputer

 /**
  * @param $computers_id
  * @param $date
  * @param $computer_updates
  * @return array
  */
 static function addInfocomsForComputer($computers_id, $date, $computer_updates)
 {
     global $DB;
     $infocom = new Infocom();
     $use_date = substr($date, 0, 10);
     if ($infocom->getFromDBByQuery("WHERE `items_id` = {$computers_id} AND `itemtype` = 'Computer'")) {
         if (empty($infocom->fields['use_date']) || $infocom->fields['use_date'] == 'NULL') {
             //add use_date
             $infocom->update(array('id' => $infocom->fields['id'], 'use_date' => $use_date));
         }
     } else {
         //add infocom
         $infocom->add(array('items_id' => $computers_id, 'itemtype' => 'Computer', 'use_date' => $use_date));
     }
     //Add lock
     $ocslink = new PluginOcsinventoryngOcslink();
     if ($ocslink->getFromDBforComputer($computers_id)) {
         $cfg_ocs = PluginOcsinventoryngOcsServer::getConfig($ocslink->fields["plugin_ocsinventoryng_ocsservers_id"]);
         if ($cfg_ocs["use_locks"]) {
             $computer_updates[] = "use_date";
             $query = "UPDATE `glpi_plugin_ocsinventoryng_ocslinks`\n                         SET `computer_update` = '" . addslashes(exportArrayToDB($computer_updates)) . "'\n                         WHERE `computers_id` = '{$computers_id}'";
             $DB->query($query);
         }
     }
     return $computer_updates;
 }
开发者ID:pluginsGLPI,项目名称:ocsinventoryng,代码行数:32,代码来源:ocsadmininfoslink.class.php


示例2: post_addItem

 function post_addItem()
 {
     global $CFG_GLPI;
     $itemtype = 'Software';
     $dupid = $this->fields["softwares_id"];
     if (isset($this->input["_duplicate_license"])) {
         $itemtype = 'SoftwareLicense';
         $dupid = $this->input["_duplicate_license"];
     }
     // Add infocoms if exists for the licence
     $ic = new Infocom();
     $ic->cloneItem('Software', $dupid, $this->fields['id'], $this->getType());
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:13,代码来源:softwarelicense.class.php


示例3: pdfForItem

 static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item)
 {
     global $CFG_GLPI;
     $ID = $item->getField('id');
     if (!Session::haveRight("infocom", "r")) {
         return false;
     }
     $ic = new Infocom();
     $pdf->setColumnsSize(100);
     if ($ic->getFromDBforDevice(get_class($item), $ID)) {
         $pdf->displayTitle("<b>" . __('Financial and administrative information') . "</b>");
         $pdf->setColumnsSize(50, 50);
         $pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Supplier') . "</i></b>", Html::clean(Dropdown::getDropdownName("glpi_suppliers", $ic->fields["suppliers_id"]))), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Budget') . "</i></b>", Html::clean(Dropdown::getDropdownName("glpi_budgets", $ic->fields["budgets_id"]))));
         $pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Order number') . "</i></b>", $ic->fields["order_number"]), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Order date') . "</i></b>", Html::convDate($ic->fields["order_date"])));
         $pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Immobilization number') . "</i></b>", $ic->fields["immo_number"]), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Date of purchase') . "</i></b>", Html::convDate($ic->fields["buy_date"])));
         $pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Invoice number') . "</i></b>", $ic->fields["bill"]), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Delivery date') . "</i></b>", Html::convDate($ic->fields["delivery_date"])));
         $pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Delivery form') . "</i></b>", $ic->fields["delivery_number"]), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Startup date') . "</i></b>", Html::convDate($ic->fields["use_date"])));
         $pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Value') . "</i></b>", Html::clean(Html::formatNumber($ic->fields["value"]))), "<b><i>" . sprintf(__('%1$s: %2$s'), _('Date of last physical inventory') . "</i></b>", Html::convDate($ic->fields["inventory_date"])));
         $pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Warranty extension value') . "</i></b>", Html::clean(Html::formatNumber($ic->fields["warranty_value"]))), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Amortization duration') . "</i></b>", sprintf(__('%1$s (%2$s)'), sprintf(_n('%d year', '%d years', $ic->fields["sink_time"]), $ic->fields["sink_time"]), Infocom::getAmortTypeName($ic->fields["sink_type"]))));
         $pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Account net value') . "</i></b>", Infocom::Amort($ic->fields["sink_type"], $ic->fields["value"], $ic->fields["sink_time"], $ic->fields["sink_coeff"], $ic->fields["warranty_date"], $ic->fields["use_date"], $CFG_GLPI['date_tax'], "n")), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Amortization coefficient') . "</i></b>", $ic->fields["sink_coeff"]));
         $pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('TCO (value + tracking cost)') . "</i></b>", Html::clean(Infocom::showTco($item->getField('ticket_tco'), $ic->fields["value"]))), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Monthly TCO') . "</i></b>", Html::clean(Infocom::showTco($item->getField('ticket_tco'), $ic->fields["value"], $ic->fields["warranty_date"]))));
         PluginPdfCommon::mainLine($pdf, $ic, 'comment');
         $pdf->setColumnsSize(100);
         $pdf->displayTitle("<b>" . __('Warranty information') . "</b>");
         $pdf->setColumnsSize(50, 50);
         $pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Start date of warranty') . "</i></b>", Html::convDate($ic->fields["warranty_date"])), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Warranty duration') . "</i></b>", sprintf(__('%1$s - %2$s'), sprintf(_n('%d month', '%d months', $ic->fields["warranty_duration"]), $ic->fields["warranty_duration"]), sprintf(__('Valid to %s'), Infocom::getWarrantyExpir($ic->fields["buy_date"], $ic->fields["warranty_duration"])))));
         $col1 = "<b><i>" . __('Alarms on financial and administrative information') . "</i></b>";
         if ($ic->fields["alert"] == 0) {
             $col1 = sprintf(__('%1$s: %2$s'), $col1, __('No'));
         } else {
             if ($ic->fields["alert"] == 4) {
                 $col1 = sprintf(__('%1$s: %2$s'), $col1, __('Warranty expiration date'));
             }
         }
         $pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Warranty information') . "</i></b>", $ic->fields["warranty_info"]), $col1);
     } else {
         $pdf->displayTitle("<b>" . __('No financial information', 'pdf') . "</b>");
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:40,代码来源:infocom.class.php


示例4: transferInfocoms

 /**
  * Transfer infocoms of an item
  *
  * @param $itemtype type of the item to transfer
  * @param $ID original ID of the item
  * @param $newID new ID of the item
  **/
 function transferInfocoms($itemtype, $ID, $newID)
 {
     global $DB;
     $ic = new Infocom();
     if ($ic->getFromDBforDevice($itemtype, $ID)) {
         switch ($this->options['keep_infocom']) {
             // delete
             case 0:
                 // Same item -> delete
                 if ($ID == $newID) {
                     $query = "DELETE\n                            FROM `glpi_infocoms`\n                            WHERE `itemtype` = '{$itemtype}'\n                                  AND `items_id` = '{$ID}'";
                     $result = $DB->query($query);
                 }
                 // Copy : nothing to do
                 break;
                 // Keep
             // Keep
             default:
                 // Transfer enterprise
                 $suppliers_id = 0;
                 if ($ic->fields['suppliers_id'] > 0) {
                     $suppliers_id = $this->transferSingleSupplier($ic->fields['suppliers_id']);
                 }
                 // Copy : copy infocoms
                 if ($ID != $newID) {
                     // Copy items
                     $input = $ic->fields;
                     $input['items_id'] = $newID;
                     $input['suppliers_id'] = $suppliers_id;
                     unset($input['id']);
                     unset($ic->fields);
                     $ic->add($input);
                 } else {
                     // Same Item : manage only enterprise move
                     // Update enterprise
                     if ($suppliers_id > 0 && $suppliers_id != $ic->fields['suppliers_id']) {
                         $ic->update(array('id' => $ic->fields['id'], 'suppliers_id' => $suppliers_id));
                     }
                 }
                 break;
         }
     }
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:50,代码来源:transfer.class.php


示例5: saveInfocoms

 static function saveInfocoms($options)
 {
     //valeurs d'origine
     $warranty_date = "";
     $buy_date = "";
     $warranty_duration = "";
     $suppliers_id = "";
     $ic_comments = "";
     //nouvelles valeurs
     $input_infocom = array();
     if ($options["supplierId"] != 0) {
         $input_infocom["suppliers_id"] = $options["supplierId"];
     }
     $input_infocom["warranty_date"] = $options["maDate"];
     $input_infocom["warranty_duration"] = $options["warranty"];
     $input_infocom["buy_date"] = $options["maDate"];
     $input_infocom["items_id"] = $options["ID"];
     $input_infocom["itemtype"] = $options["itemtype"];
     //add new infocoms
     $ic = new infocom();
     if ($ic->getfromDBforDevice($options["itemtype"], $options["ID"])) {
         //valeurs d'origine
         $warranty_date = Html::convdate($ic->fields["warranty_date"]);
         $warranty_duration = $ic->fields["warranty_duration"];
         $buy_date = $ic->fields["buy_date"];
         $suppliers_id = Dropdown::getDropdownName("glpi_suppliers", $ic->fields["suppliers_id"]);
         $ic_comment = $ic->fields["comment"];
         //nouvelles valeurs
         $input_infocom["id"] = $ic->fields["id"];
         if ($options["addcomments"]) {
             $input_infocom["comment"] = $ic_comment . "\n" . __('Imported from web site', 'manufacturersimports') . " " . $options["suppliername"] . " " . __('With the manufacturersimports plugin', 'manufacturersimports') . " (" . Html::convdate($options["date"]) . ")";
         }
         $infocom = new Infocom();
         $infocom->update($input_infocom);
     } else {
         if ($options["addcomments"]) {
             $input_infocom["comment"] = __('Imported from web site', 'manufacturersimports') . " " . $options["suppliername"] . " " . __('With the manufacturersimports plugin', 'manufacturersimports') . " (" . Html::convdate($options["date"]) . ")";
         }
         $infocom = new Infocom();
         $infocom->add($input_infocom);
     }
     //post message
     echo "<td><span class='plugin_manufacturersimports_import_OK'>";
     echo __('Import OK', 'manufacturersimports') . " (" . Html::convdate($options["date"]) . ")";
     echo "</span></td>";
     echo "<td>";
     echo _n('Supplier', 'Suppliers', 1) . ": ";
     echo $suppliers_id . "->" . Dropdown::getDropdownName("glpi_suppliers", $options["supplierId"]) . "<br>";
     echo __('Date of purchase') . ": ";
     echo Html::convdate($buy_date) . "->" . Html::convdate($options["maDate"]) . "<br>";
     echo __('Start date of warranty') . ": ";
     echo $warranty_date . "->" . Html::convdate($options["maDate"]) . "<br>";
     if ($warranty_duration == -1) {
         $warranty_duration = __('Lifelong');
         $warranty = __('Lifelong');
     } else {
         $warranty = $options["warranty"];
     }
     echo __('Warranty duration') . ": " . $warranty_duration . "->" . $warranty . "<br>";
     echo "</td>";
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:61,代码来源:postimport.class.php


示例6: post_addItem

 function post_addItem()
 {
     global $DB, $CFG_GLPI;
     // Manage add from template
     if (isset($this->input["_oldID"])) {
         // ADD Devices
         Item_devices::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Infocoms
         Infocom::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Ports
         NetworkPort::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Contract
         Contract_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Documents
         Document_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Computers
         Computer_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:19,代码来源:phone.class.php


示例7: post_addItem

 function post_addItem()
 {
     global $DB;
     // Manage add from template
     if (isset($this->input["_oldID"])) {
         // ADD Devices
         Item_devices::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Infocoms
         Infocom::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD volumes
         ComputerDisk::cloneComputer($this->input["_oldID"], $this->fields['id']);
         // ADD software
         Computer_SoftwareVersion::cloneComputer($this->input["_oldID"], $this->fields['id']);
         Computer_SoftwareLicense::cloneComputer($this->input["_oldID"], $this->fields['id']);
         // ADD Contract
         Contract_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Documents
         Document_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Ports
         NetworkPort::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // Add connected devices
         Computer_Item::cloneComputer($this->input["_oldID"], $this->fields['id']);
     }
 }
开发者ID:pvasener,项目名称:glpi,代码行数:24,代码来源:computer.class.php


示例8: post_addItem

 function post_addItem()
 {
     // Manage add from template
     if (isset($this->input["_oldID"])) {
         // ADD Documents
         Document_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Infocoms
         Infocom::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:10,代码来源:rack.class.php


示例9: showDebugInfo

 /**
  * to list infos in debug tab
  **/
 function showDebugInfo()
 {
     global $CFG_GLPI;
     $class = $this->getType();
     if (method_exists($class, 'showDebug')) {
         $this->showDebug();
     }
     if (InfoCom::canApplyOn($class)) {
         $infocom = new Infocom();
         if ($infocom->getFromDBforDevice($class, $this->fields['id'])) {
             $infocom->showDebug();
         }
     }
     if (in_array($class, $CFG_GLPI["reservation_types"])) {
         $resitem = new ReservationItem();
         if ($resitem->getFromDBbyItem($class, $this->fields['id'])) {
             $resitem->showDebugResa();
         }
     }
 }
开发者ID:korial29,项目名称:glpi,代码行数:23,代码来源:commonglpi.class.php


示例10: addInfocoms

/** Generate bigdump : add infocoms to an item
 *
 * @param $type            item type
 * @param $ID              item ID
 * @param $ID_entity       entity ID
 * @param $is_recursive    (default 0)
**/
function addInfocoms($type, $ID, $ID_entity, $is_recursive=0) {
   global $DB, $FIRST, $LAST;

   $current_year = date('Y');

   $orderdate     = strtotime(mt_rand(2000,$current_year)."-".mt_rand(1,12)."-".mt_rand(1,28));
   $buydate       = $orderdate+mt_rand(0, 60)*DAY_TIMESTAMP;
   $deliverydate  = $orderdate+mt_rand(0, 60)*DAY_TIMESTAMP;
   $usedate       = $deliverydate+mt_rand(0, 60)*DAY_TIMESTAMP;
   $warrantydate  = $deliverydate;
   $inventorydate = $deliverydate;

   $orderdate     = date("Y-m-d", intval($orderdate));
   $buydate       = date("Y-m-d", intval($buydate));
   $deliverydate  = date("Y-m-d", intval($deliverydate));
   $usedate       = date("Y-m-d", intval($usedate));
   $warrantydate  = date("Y-m-d", intval($warrantydate));
   $inventorydate = date("Y-m-d", intval($inventorydate));

   $i = new Infocom();
   $i->add(toolbox::addslashes_deep(
           array('itemtype'           => $type,
                  'items_id'          => $ID,
                  'entities_id'       => $ID_entity,
                  'is_recursive'      => $is_recursive,
                  'buy_date'          => $buydate,
                  'use_date'          => $usedate,
                  'warranty_duration' => mt_rand(12,36),
                  'warranty_info'     => "infowar ' $type $ID",
                  'suppliers_id'      => mt_rand($FIRST["enterprises"], $LAST['enterprises']),
                  'order_number'      => "commande ' $type $ID",
                  'delivery_number'   => "BL ' $type $ID",
                  'immo_number'       => "immo ' $type $ID",
                  'value'             => mt_rand(0,5000),
                  'warranty_value'    => mt_rand(0,500),
                  'sink_time'         => mt_rand(1,7),
                  'sink_type'         => mt_rand(1,2),
                  'sink_coeff'        => mt_rand(2,5),
                  'comment'           => "comment ' $type $ID",
                  'bill'              => "bill ' $type $ID",
                  'budgets_id'        => mt_rand($FIRST['budget'], $LAST['budget']),
                  'order_date'        => $orderdate,
                  'delivery_date'     => $deliverydate,
                  'inventory_date'    => $inventorydate,
                  'warranty_date'     => $warrantydate)));
}
开发者ID:KaneoGmbH,项目名称:glpi,代码行数:53,代码来源:generate_bigdump.function.php


示例11: display_infocoms_report

/** Display an infocom report
 *
 * @param $itemtype item type
 * @param $begin begin date
 * @param $end end date
**/
function display_infocoms_report($itemtype, $begin, $end)
{
    global $DB, $valeurtot, $valeurnettetot, $valeurnettegraphtot, $valeurgraphtot, $LANG, $CFG_GLPI;
    $itemtable = getTableForItemType($itemtype);
    $query = "SELECT `glpi_infocoms`.*,\n                    `{$itemtable}`.`name` AS name,\n                    `{$itemtable}`.`ticket_tco`,\n                    `glpi_entities`.`completename` AS entname,\n                    `glpi_entities`.`id` AS entID\n             FROM `glpi_infocoms`\n             INNER JOIN `{$itemtable}` ON (`{$itemtable}`.`id` = `glpi_infocoms`.`items_id`\n                                         AND `glpi_infocoms`.`itemtype` = '{$itemtype}')\n             LEFT JOIN `glpi_entities` ON (`{$itemtable}`.`entities_id` = `glpi_entities`.`id`)\n             WHERE `{$itemtable}`.`is_template` = '0' " . getEntitiesRestrictRequest("AND", $itemtable);
    if (!empty($begin)) {
        $query .= " AND (`glpi_infocoms`.`buy_date` >= '{$begin}'\n                       OR `glpi_infocoms`.`use_date` >= '{$begin}') ";
    }
    if (!empty($end)) {
        $query .= " AND (`glpi_infocoms`.`buy_date` <= '{$end}'\n                       OR `glpi_infocoms`.`use_date` <= '{$end}') ";
    }
    $query .= " ORDER BY entname ASC, `buy_date`, `use_date`";
    $display_entity = isMultiEntitiesMode();
    $result = $DB->query($query);
    if ($DB->numrows($result) > 0) {
        $item = new $itemtype();
        echo "<h2>" . $item->getTypeName() . "</h2>";
        echo "<table class='tab_cadre'><tr><th>" . $LANG['common'][16] . "</th>";
        if ($display_entity) {
            echo "<th>" . $LANG['entity'][0] . "</th>";
        }
        echo "<th>" . $LANG['financial'][21] . "</th><th>" . $LANG['financial'][92] . "</th>";
        echo "<th>" . $LANG['financial'][91] . "</th><th>" . $LANG['financial'][14] . "</th>";
        echo "<th>" . $LANG['financial'][76] . "</th><th>" . $LANG['financial'][80] . "</th></tr>";
        $valeursoustot = 0;
        $valeurnettesoustot = 0;
        $valeurnettegraph = array();
        $valeurgraph = array();
        while ($line = $DB->fetch_array($result)) {
            if (isset($line["is_global"]) && $line["is_global"]) {
                $line["value"] *= Computer_Item::countForItem($itemtype, $line["items_id"]);
            }
            if ($line["value"] > 0) {
                $valeursoustot += $line["value"];
            }
            $valeurnette = Infocom::Amort($line["sink_type"], $line["value"], $line["sink_time"], $line["sink_coeff"], $line["buy_date"], $line["use_date"], $CFG_GLPI["date_tax"], "n");
            $tmp = Infocom::Amort($line["sink_type"], $line["value"], $line["sink_time"], $line["sink_coeff"], $line["buy_date"], $line["use_date"], $CFG_GLPI["date_tax"], "all");
            if (is_array($tmp) && count($tmp) > 0) {
                foreach ($tmp["annee"] as $key => $val) {
                    if ($tmp["vcnetfin"][$key] > 0) {
                        if (!isset($valeurnettegraph[$val])) {
                            $valeurnettegraph[$val] = 0;
                        }
                        $valeurnettegraph[$val] += $tmp["vcnetdeb"][$key];
                    }
                }
            }
            if (!empty($line["buy_date"])) {
                $year = substr($line["buy_date"], 0, 4);
                if ($line["value"] > 0) {
                    if (!isset($valeurgraph[$year])) {
                        $valeurgraph[$year] = 0;
                    }
                    $valeurgraph[$year] += $line["value"];
                }
            }
            $valeurnettesoustot += str_replace(" ", "", $valeurnette);
            echo "<tr class='tab_bg_1'><td>" . $line["name"] . "</td>";
            if ($display_entity) {
                if ($line['entID'] == 0) {
                    echo "<td>" . $LANG['entity'][2] . "</td>";
                } else {
                    echo "<td>" . $line['entname'] . "</td>";
                }
            }
            echo "<td class='right'>" . formatNumber($line["value"]) . "</td><td class='right'>" . formatNumber($valeurnette) . "</td><td class='right'>" . Infocom::showTco($line["ticket_tco"], $line["value"]) . "</td><td>" . convDate($line["buy_date"]) . "</td><td>" . convDate($line["use_date"]) . "</td><td>" . getWarrantyExpir($line["buy_date"], $line["warranty_duration"]) . "</td></tr>";
        }
        $valeurtot += $valeursoustot;
        $valeurnettetot += $valeurnettesoustot;
        echo "<tr><td colspan='6' class='center'><h3>" . $LANG['common'][33] . "&nbsp;: " . $LANG['financial'][21] . "=" . formatNumber($valeursoustot) . " - " . $LANG['financial'][81] . "=" . formatNumber($valeurnettesoustot) . "</h3></td></tr>";
        if (count($valeurnettegraph) > 0) {
            echo "<tr><td colspan='5' class='center'>";
            ksort($valeurnettegraph);
            $valeurnettegraphdisplay = array_map('round', $valeurnettegraph);
            foreach ($valeurnettegraph as $key => $val) {
                if (!isset($valeurnettegraphtot[$key])) {
                    $valeurnettegraphtot[$key] = 0;
                }
                $valeurnettegraphtot[$key] += $valeurnettegraph[$key];
            }
            Stat::showGraph(array($LANG['financial'][81] => $valeurnettegraphdisplay), array('title' => $LANG['financial'][81], 'width' => 400));
            echo "</td></tr>";
        }
        if (count($valeurgraph) > 0) {
            echo "<tr><td colspan='5' class='center'>";
            ksort($valeurgraph);
            $valeurgraphdisplay = array_map('round', $valeurgraph);
            foreach ($valeurgraph as $key => $val) {
                if (!isset($valeurgraphtot[$key])) {
                    $valeurgraphtot[$key] = 0;
                }
                $valeurgraphtot[$key] += $valeurgraph[$key];
            }
            Stat::showGraph(array($LANG['financial'][21] => $valeurgraphdisplay), array('title' => $LANG['financial'][21], 'width' => 400));
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:report.infocom.php


示例12: display_infocoms_report

/** Display an infocom report
 *
 * @param $itemtype  item type
 * @param $begin     begin date
 * @param $end       end date
**/
function display_infocoms_report($itemtype, $begin, $end)
{
    global $DB, $valeurtot, $valeurnettetot, $valeurnettegraphtot, $valeurgraphtot, $CFG_GLPI;
    $itemtable = getTableForItemType($itemtype);
    $query = "SELECT `glpi_infocoms`.*,\n                    `{$itemtable}`.`name` AS name,\n                    `{$itemtable}`.`ticket_tco`,\n                    `glpi_entities`.`completename` AS entname,\n                    `glpi_entities`.`id` AS entID\n             FROM `glpi_infocoms`\n             INNER JOIN `{$itemtable}` ON (`{$itemtable}`.`id` = `glpi_infocoms`.`items_id`\n                                         AND `glpi_infocoms`.`itemtype` = '{$itemtype}')\n             LEFT JOIN `glpi_entities` ON (`{$itemtable}`.`entities_id` = `glpi_entities`.`id`)\n             WHERE `{$itemtable}`.`is_template` = '0' " . getEntitiesRestrictRequest("AND", $itemtable);
    if (!empty($begin)) {
        $query .= " AND (`glpi_infocoms`.`buy_date` >= '{$begin}'\n                       OR `glpi_infocoms`.`use_date` >= '{$begin}') ";
    }
    if (!empty($end)) {
        $query .= " AND (`glpi_infocoms`.`buy_date` <= '{$end}'\n                       OR `glpi_infocoms`.`use_date` <= '{$end}') ";
    }
    $query .= " ORDER BY entname ASC, `buy_date`, `use_date`";
    $display_entity = Session::isMultiEntitiesMode();
    $result = $DB->query($query);
    if ($DB->numrows($result) > 0 && ($item = getItemForItemtype($itemtype))) {
        echo "<h2>" . $item->getTypeName(1) . "</h2>";
        echo "<table class='tab_cadre'><tr><th>" . __('Name') . "</th>";
        if ($display_entity) {
            echo "<th>" . __('Entity') . "</th>";
        }
        echo "<th>" . _x('price', 'Value') . "</th><th>" . __('ANV') . "</th>";
        echo "<th>" . __('TCO') . "</th><th>" . __('Date of purchase') . "</th>";
        echo "<th>" . __('Startup date') . "</th><th>" . __('Warranty expiration date') . "</th></tr>";
        $valeursoustot = 0;
        $valeurnettesoustot = 0;
        $valeurnettegraph = array();
        $valeurgraph = array();
        while ($line = $DB->fetch_assoc($result)) {
            if (isset($line["is_global"]) && $line["is_global"] && $item->getFromDB($line["items_id"])) {
                $line["value"] *= Computer_Item::countForItem($item);
            }
            if ($line["value"] > 0) {
                $valeursoustot += $line["value"];
            }
            $valeurnette = Infocom::Amort($line["sink_type"], $line["value"], $line["sink_time"], $line["sink_coeff"], $line["buy_date"], $line["use_date"], $CFG_GLPI["date_tax"], "n");
            $tmp = Infocom::Amort($line["sink_type"], $line["value"], $line["sink_time"], $line["sink_coeff"], $line["buy_date"], $line["use_date"], $CFG_GLPI["date_tax"], "all");
            if (is_array($tmp) && count($tmp) > 0) {
                foreach ($tmp["annee"] as $key => $val) {
                    if ($tmp["vcnetfin"][$key] > 0) {
                        if (!isset($valeurnettegraph[$val])) {
                            $valeurnettegraph[$val] = 0;
                        }
                        $valeurnettegraph[$val] += $tmp["vcnetdeb"][$key];
                    }
                }
            }
            if (!empty($line["buy_date"])) {
                $year = substr($line["buy_date"], 0, 4);
                if ($line["value"] > 0) {
                    if (!isset($valeurgraph[$year])) {
                        $valeurgraph[$year] = 0;
                    }
                    $valeurgraph[$year] += $line["value"];
                }
            }
            $valeurnettesoustot += str_replace(" ", "", $valeurnette);
            echo "<tr class='tab_bg_1'><td>" . $line["name"] . "</td>";
            if ($display_entity) {
                echo "<td>" . $line['entname'] . "</td>";
            }
            echo "<td class='right'>" . Html::formatNumber($line["value"]) . "</td>" . "<td class='right'>" . Html::formatNumber($valeurnette) . "</td>" . "<td class='right'>" . Infocom::showTco($line["ticket_tco"], $line["value"]) . "</td>" . "<td>" . Html::convDate($line["buy_date"]) . "</td>" . "<td>" . Html::convDate($line["use_date"]) . "</td>" . "<td>" . Infocom::getWarrantyExpir($line["buy_date"], $line["warranty_duration"]) . "</td></tr>";
        }
        $valeurtot += $valeursoustot;
        $valeurnettetot += $valeurnettesoustot;
        $tmpmsg = sprintf(__('Total: Value=%1$s - Account net value=%2$s'), Html::formatNumber($valeursoustot), Html::formatNumber($valeurnettesoustot));
        echo "<tr><td colspan='6' class='center'><h3>{$tmpmsg}</h3></td></tr>";
        if (count($valeurnettegraph) > 0) {
            echo "<tr><td colspan='5' class='center'>";
            ksort($valeurnettegraph);
            $valeurnettegraphdisplay = array_map('round', $valeurnettegraph);
            foreach ($valeurnettegraph as $key => $val) {
                if (!isset($valeurnettegraphtot[$key])) {
                    $valeurnettegraphtot[$key] = 0;
                }
                $valeurnettegraphtot[$key] += $valeurnettegraph[$key];
            }
            Stat::showGraph(array(__('Account net value') => $valeurnettegraphdisplay), array('title' => __('Account net value'), 'width' => 400));
            echo "</td></tr>";
        }
        if (count($valeurgraph) > 0) {
            echo "<tr><td colspan='5' class='center'>";
            ksort($valeurgraph);
            $valeurgraphdisplay = array_map('round', $valeurgraph);
            foreach ($valeurgraph as $key => $val) {
                if (!isset($valeurgraphtot[$key])) {
                    $valeurgraphtot[$key] = 0;
                }
                $valeurgraphtot[$key] += $valeurgraph[$key];
            }
            Stat::showGraph(array(_x('price', 'Value') => $valeurgraphdisplay), array('title' => _x('price', 'Value'), 'width' => 400));
            echo "</td></tr>";
        }
        echo "</table>";
        return true;
//.........这里部分代码省略.........
开发者ID:glpi-project,项目名称:glpi,代码行数:101,代码来源:report.infocom.php


示例13: showDisplayLink

 /**
  * Show infocom link to display modal
  *
  * @param $itemtype   integer  item type
  * @param $device_id  integer  item ID
  *
  * @return float
  **/
 static function showDisplayLink($itemtype, $device_id)
 {
     global $DB, $CFG_GLPI;
     if (!Session::haveRight(self::$rightname, READ) || !($item = getItemForItemtype($itemtype))) {
         return false;
     }
     $query = "SELECT COUNT(*)\n                FROM `glpi_infocoms`\n                WHERE `items_id` = '{$device_id}'\n                      AND `itemtype` = '{$itemtype}'";
     $add = "add";
     $text = __('Add');
     $result = $DB->query($query);
     if ($DB->result($result, 0, 0) > 0) {
         $add = "";
         $text = _x('button', 'Show');
     } else {
         if (!Infocom::canUpdate()) {
             return false;
         }
     }
     if ($item->canView()) {
         echo "<span onClick=\"" . Html::jsGetElementbyID('infocom' . $itemtype . $device_id) . ".\n                dialog('open');\" style='cursor:pointer'>\n               <img src=\"" . $CFG_GLPI["root_doc"] . "/pics/dollar{$add}.png\" alt=\"{$text}\" title=\"{$text}\">\n               </span>";
         Ajax::createIframeModalWindow('infocom' . $itemtype . $device_id, $CFG_GLPI["root_doc"] . "/front/infocom.form.php" . "?itemtype={$itemtype}&items_id={$device_id}", array('height' => 600));
     }
 }
开发者ID:GeorgeAlexandre,项目名称:glpi,代码行数:31,代码来源:infocom.class.php


示例14: showForCartridgeItem

 /**
  * Print out the cartridges of a defined type
  *
  * @param $cartitem  object   of CartridgeItem class
  * @param $show_old  boolean  show old cartridges or not (default 0)
  *
  * @return Nothing (displays)
  **/
 static function showForCartridgeItem(CartridgeItem $cartitem, $show_old = 0)
 {
     global $DB, $CFG_GLPI;
     $tID = $cartitem->getField('id');
     if (!$cartitem->can($tID, READ)) {
         return false;
     }
     $canedit = $cartitem->can($tID, UPDATE);
     $query = "SELECT COUNT(*) AS count\n                FROM `glpi_cartridges`\n                WHERE (`cartridgeitems_id` = '{$tID}')";
     if ($result = $DB->query($query)) {
         $total = $DB->result($result, 0, "count");
         if (!$show_old) {
             // NEW
             $where = " AND `glpi_cartridges`.`date_out` IS NULL";
         } else {
             //OLD
             $where = " AND `glpi_cartridges`.`date_out` IS NOT NULL";
         }
         $stock_time = 0;
         $use_time = 0;
         $pages_printed = 0;
         $nb_pages_printed = 0;
         $ORDER = " `glpi_cartridges`.`date_use` ASC,\n                    `glpi_cartridges`.`date_out` DESC,\n                    `glpi_cartridges`.`date_in`";
         if (!$show_old) {
             $ORDER = " `glpi_cartridges`.`date_out` ASC,\n                       `glpi_cartridges`.`date_use` ASC,\n                       `glpi_cartridges`.`date_in`";
         }
         $query = "SELECT `glpi_cartridges`.*,\n                        `glpi_printers`.`id` AS printID,\n                        `glpi_printers`.`name` AS printname,\n                        `glpi_printers`.`init_pages_counter`\n                   FROM `glpi_cartridges`\n                   LEFT JOIN `glpi_printers`\n                        ON (`glpi_cartridges`.`printers_id` = `glpi_printers`.`id`)\n                   WHERE `glpi_cartridges`.`cartridgeitems_id` = '{$tID}'\n                         {$where}\n                   ORDER BY {$ORDER}";
         $result = $DB->query($query);
         $number = $DB->numrows($result);
         echo "<div class='spaced'>";
         if ($canedit && $number) {
             $rand = mt_rand();
             Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
             $actions = array('purge' => _x('button', 'Delete permanently'), 'Infocom' . MassiveAction::CLASS_ACTION_SEPARATOR . 'activate' => __('Enable the financial and administrative information'));
             if ($show_old) {
                 $actions['Cartridge' . MassiveAction::CLASS_ACTION_SEPARATOR . 'backtostock'] = __('Back to stock');
             }
             $massiveactionparams = array('num_displayed' => $number, 'specific_actions' => $actions, 'container' => 'mass' . __CLASS__ . $rand, 'rand' => $rand);
             Html::showMassiveActions($massiveactionparams);
         }
         echo "<table class='tab_cadre_fixehov'>";
         if (!$show_old) {
             echo "<tr class='noHover'><th colspan='" . ($canedit ? '7' : '6') . "'>" . self::getCount($tID, -1) . "</th>";
             echo "</tr>";
         } else {
             // Old
             echo "<tr class='noHover'><th colspan='" . ($canedit ? '9' : '8') . "'>" . __('Worn cartridges');
             echo "</th></tr>";
         }
         $i = 0;
         $header_begin = "<tr>";
         $header_top = '';
         $header_bottom = '';
         $header_end = '';
         if ($canedit && $number) {
             $header_begin .= "<th width='10'>";
             $header_top = Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
             $header_bottom = Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
             $header_end .= "</th>";
         }
         $header_end .= "<th>" . __('ID') . "</th>";
         $header_end .= "<th>" . _x('item', 'State') . "</th>";
         $header_end .= "<th>" . __('Add date') . "</th><th>" . __('Use date') . "</th>";
         $header_end .= "<th>" . __('Used on') . "</th>";
         if ($show_old) {
             $header_end .= "<th>" . __('End date') . "</th>";
             $header_end .= "<th>" . __('Printer counter') . "</th>";
         }
         $header_end .= "<th width='18%'>" . __('Financial and administrative information') . "</th>";
         $header_end .= "</tr>";
         echo $header_begin . $header_top . $header_end;
     }
     $pages = array();
     if ($number) {
         while ($data = $DB->fetch_assoc($result)) {
             $date_in = Html::convDate($data["date_in"]);
             $date_use = Html::convDate($data["date_use"]);
             $date_out = Html::convDate($data["date_out"]);
             $printer = $data["printers_id"];
             $page = $data["pages"];
             echo "<tr class='tab_bg_1'>";
             if ($canedit) {
                 echo "<td width='10'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["id"]);
                 echo "</td>";
             }
             echo "<td>" . $data['id'] . '</td>';
             echo "<td class='center'>" . self::getStatus($data["date_use"], $data["date_out"]);
             echo "</td><td class='center'>" . $date_in . "</td>";
             echo "<td class='center'>" . $date_use . "</td>";
             echo "<td class='center'>";
             if (!is_null($date_use)) {
//.........这里部分代码省略.........
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:101,代码来源:cartridge.class.php


示例15: getItem


//.........这里部分代码省略.........
                 if ($result = $DB->query($query)) {
                     while ($data = $DB->fetch_assoc($result)) {
                         if (isset($data['netport_id'])) {
                             // append network name
                             $query_netn = "SELECT\n                              GROUP_CONCAT(CONCAT(ipadr.`id`, '" . Search::SHORTSEP . "' , ipadr.`name`)\n                                           SEPARATOR '" . Search::LONGSEP . "') as ipadresses,\n                              netn.`id` as networknames_id,\n                              netn.`name` as networkname,\n                              netn.`fqdns_id`,\n                              fqdn.`name` as 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Infusionsoft_Generated_Base类代码示例发布时间:2022-05-23
下一篇:
PHP Info类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap