0){ while($row = mssql_fetch_assoc($result)){ $arrayOfCustomerInformation[] = $row; } return $arrayOfCustomerInformation; } else { return 0; } } //generic query to pull top 100 values from the Installed Product table // where is_active = 1 (Currently Active) // in this query, we are JOINING with the account table to provide a // meaningful link between assets and accounts. We are using a LEFT // Join to show any assets without a 'Vendor Name' // (to show only assets with vendor names, change LEFT to INNER //This query shows all assets assigned to the '0' account. // (your internal Autotask account) $query = "select top(100) wh_installed_product.reference_title, wh_installed_product.serial_number, wh_installed_product.installed_product_id, wh_installed_product.warranty_expiration_date, wh_installed_product.notes, wh_installed_product.vendor_name, wh_installed_product.account_id, wh_account.account_name, wh_account.phone_number, wh_account.web_url from wh_installed_product LEFT JOIN wh_account ON wh_installed_product.vendor_name = wh_account.account_name where wh_installed_product.is_active = '1' AND wh_installed_product.account_id = '0' order by wh_installed_product.warranty_expiration_date "; /* //uncomment this query to show All Assets for All accounts. $query = "select top(100) wh_installed_product.reference_title, wh_installed_product.serial_number, wh_installed_product.installed_product_id, wh_installed_product.warranty_expiration_date, wh_installed_product.notes, wh_installed_product.vendor_name, wh_installed_product.account_id, wh_account.account_name, wh_account.phone_number, wh_account.web_url from wh_installed_product LEFT JOIN wh_account ON wh_installed_product.vendor_name = wh_account.account_name where wh_installed_product.is_active = '1' order by wh_installed_product.warranty_expiration_date "; */ //create an array of values that are returned by the query $myAssetArray = queryToArray($query); //If there are results from the query, print them out to the //screen. // Brief explanation of this array: // $myAssetArray stores a multi-indexed array of accounts. // each index ($k) is a unique customer asset / Installed Product. // each index ($k) has an associative array of key, value pairs // that can be referenced by name like this // // $myAssetArray[$k]["reference_title"] // //NOTE: These may change over time! /* [installed_product_id] => 29683402 [product_id] => 29683401 [account_id] => 29683321 [start_date] => Mar 27 2009 12:00AM [warranty_expiration_date] => Mar 27 2010 12:00AM [serial_number] => 26hcgs1234567 [reference_number] => [reference_title] => Guest Wireless Internet [number_of_users] => 0.0000 [hourly_cost] => 0.0000 [monthly_cost] => 0.0000 [daily_cost] => 0.0000 [per_use_cost] => 0.0000 [setup_fee] => 0.0000 [account_link] => [notes] => [project_cost_id] => [quote_item_id] => [is_active] => 1 [create_time] => Mar 27 2009 11:32PM [installed_product_type] => [location] => [contact_first_name] => [contact_last_name] => [vendor_name] => [contract_id] => [service_id] => [service_bundle_id] => [installed_by_resource_id] => 29682885 [is_swapped_out] => 0 [inventory_transfer_id] => */ echo "
| Vendor | ". "Vendor Phone | ". "Reference Title | ". "Serial Number | ". "Warranty Exp Date | ". "Notes | ". "Product ID | ". "". $myAssetArray[$k]["account_name"]." | ". "". $myAssetArray[$k]["phone_number"] ." | ". "". $myAssetArray[$k]["reference_title"]." | ". "". $myAssetArray[$k]["serial_number"] ." | ". "". $myAssetArray[$k]["warranty_expiration_date"]. " | ". "". $myAssetArray[$k]["notes"] ." | ". "". $myAssetArray[$k]["installed_product_id"] ." | ". "\n
\n"; print_r($myAssetArray); echo "\n"; ?>