→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !
‎08-07-2020 10:37 PM
‎08-10-2020 10:08 PM
‎08-10-2020 06:08 PM
Select Top 1000000
tblAssets.AssetID,
tblAssets.AssetName As [Printer Name],
tblAssetCustom.Custom11 As [MT Asset Tag],
tblAssets.IPAddress As [IP Address],
tsysIPLocations.IPLocation As [Facility Location],
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
Cast(Floor(c.TonerRemaining / (Case
When c.TonerMaximum = 0
Then 1
Else c.TonerMaximum
End) * 100) As nvarchar) + '%' As Cyan,
Cast(Floor(m.TonerRemaining / (Case
When m.TonerMaximum = 0
Then 1
Else m.TonerMaximum
End) * 100) As nvarchar) + '%' As Magenta,
Cast(Floor(y.TonerRemaining / (Case
When y.TonerMaximum = 0
Then 1
Else y.TonerMaximum
End) * 100) As nvarchar) + '%' As Yellow,
Cast(Floor(k.TonerRemaining / (Case
When k.TonerMaximum = 0
Then 1
Else k.TonerMaximum
End) * 100) As nvarchar) + '%' As Black
From
tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tsysIPLocations On tsysIPLocations.LocationID = tblAssets.LocationID
Inner Join tblState On tblState.State = tblAssetCustom.State
Left Join tsysOS On tsysOS.OScode = tblAssets.OScode
LEFT JOIN tblCustDevPrinter AS c ON c.AssetID = tblAssets.AssetID
AND (c.TonerColorName LIKE '%cyan%'
OR c.Tonername LIKE '%cyan%')
AND c.Tonername NOT LIKE '%fuser%'
AND c.Tonername NOT LIKE '%drum%'
AND c.Tonername NOT LIKE '%image%'
AND c.Tonername NOT LIKE '%maintenance%'
AND c.Tonername NOT LIKE '%transfer%'
AND c.Tonername NOT LIKE '%waste%'
AND c.Tonername NOT LIKE '%feed roller%'
AND c.Tonername NOT LIKE '%filter%'
And c.TonerMaximum <> 0
And c.TonerMaximum > 0
And c.TonerRemaining <> 0
AND Floor(c.TonerRemaining / (Case
When c.TonerMaximum = 0
Then 1
Else c.TonerMaximum
End) * 100) <= 30
AND Floor(c.TonerRemaining / (Case
When c.TonerMaximum = 0
Then 1
Else c.TonerMaximum
End) * 100) >= 0
LEFT JOIN tblCustDevPrinter AS M ON m.AssetID = tblAssets.AssetID
AND (m.TonerColorName LIKE '%magenta%'
OR m.Tonername LIKE '%magenta%')
AND m.Tonername NOT LIKE '%fuser%'
AND m.Tonername NOT LIKE '%drum%'
AND m.Tonername NOT LIKE '%image%'
AND m.Tonername NOT LIKE '%maintenance%'
AND m.Tonername NOT LIKE '%transfer%'
AND m.Tonername NOT LIKE '%waste%'
AND m.Tonername NOT LIKE '%feed roller%'
AND m.Tonername NOT LIKE '%filter%'
And m.TonerMaximum <> 0
And m.TonerMaximum > 0
And m.TonerRemaining <> 0
AND Floor(m.TonerRemaining / (Case
When m.TonerMaximum = 0
Then 1
Else m.TonerMaximum
End) * 100) <= 30
AND Floor(m.TonerRemaining / (Case
When m.TonerMaximum = 0
Then 1
Else m.TonerMaximum
End) * 100) >= 0
LEFT JOIN tblCustDevPrinter AS Y ON y.AssetID = tblAssets.AssetID
AND (y.TonerColorName LIKE '%yellow%'
OR y.Tonername LIKE '%yellow%')
AND y.Tonername NOT LIKE '%fuser%'
AND y.Tonername NOT LIKE '%drum%'
AND y.Tonername NOT LIKE '%image%'
AND y.Tonername NOT LIKE '%maintenance%'
AND y.Tonername NOT LIKE '%transfer%'
AND y.Tonername NOT LIKE '%waste%'
AND y.Tonername NOT LIKE '%feed roller%'
AND y.Tonername NOT LIKE '%filter%'
And y.TonerMaximum <> 0
And y.TonerMaximum > 0
And y.TonerRemaining <> 0
AND Floor(y.TonerRemaining / (Case
When y.TonerMaximum = 0
Then 1
Else y.TonerMaximum
End) * 100) <= 30
AND Floor(y.TonerRemaining / (Case
When y.TonerMaximum = 0
Then 1
Else y.TonerMaximum
End) * 100) >= 0
LEFT JOIN tblCustDevPrinter AS K ON k.AssetID = tblAssets.AssetID
AND (k.TonerColorName LIKE '%black%'
OR k.Tonername LIKE '%black%'
OR (k.TonerColorName = 'Toner' AND k.Tonername = 'Toner') )
AND k.Tonername NOT LIKE '%fuser%'
AND k.Tonername NOT LIKE '%drum%'
AND k.Tonername NOT LIKE '%image%'
AND k.Tonername NOT LIKE '%maintenance%'
AND k.Tonername NOT LIKE '%transfer%'
AND k.Tonername NOT LIKE '%waste%'
AND k.Tonername NOT LIKE '%feed roller%'
AND k.Tonername NOT LIKE '%filter%'
And k.TonerMaximum <> 0
And k.TonerMaximum > 0
And k.TonerRemaining <> 0
AND Floor(k.TonerRemaining / (Case
When k.TonerMaximum = 0
Then 1
Else k.TonerMaximum
End) * 100) <= 30
AND Floor(k.TonerRemaining / (Case
When k.TonerMaximum = 0
Then 1
Else k.TonerMaximum
End) * 100) >= 0
Where
( tblAssets.IPAddress Like '10.1.2.%'
And tsysAssetTypes.AssetTypename = 'Printer'
-- only records with at least one low toner/ink
AND ( c.AssetID IS NOT NULL
OR m.AssetID IS NOT NULL
OR y.AssetID IS NOT NULL
OR k.AssetID IS NOT NULL)
And tblState.Statename = 'Active')
Or (tblAssets.IPAddress Like '10.2.2.%')
Or (tblAssets.IPAddress Like '10.6.2.%')
Order By
[Facility Location],
[Printer Name]
‎08-10-2020 05:36 PM
Where
( tblAssets.IPAddress Like '10.1.2.%'
And tsysAssetTypes.AssetTypename = 'Printer'
And tblCustDevPrinter.TonerMaximum <> 0
And tblCustDevPrinter.TonerMaximum > 0
And tblCustDevPrinter.TonerRemaining <> 0
And Floor(tblCustDevPrinter.TonerRemaining / (Case
When tblCustDevPrinter.TonerMaximum = 0
Then 1
Else tblCustDevPrinter.TonerMaximum
End) * 100) <= 30
And Floor(tblCustDevPrinter.TonerRemaining / (Case
When tblCustDevPrinter.TonerMaximum = 0
Then 1
Else tblCustDevPrinter.TonerMaximum
End) * 100) >= 0
-- include explicitly-named toner/ink
AND ( tblCustDevPrinter.TonerColorName LIKE '%cyan%'
OR tblCustDevPrinter.TonerColorName LIKE '%magenta%'
OR tblCustDevPrinter.TonerColorName LIKE '%yellow%'
OR tblCustDevPrinter.TonerColorName LIKE '%black%'
OR tblCustDevPrinter.Tonername LIKE '%cyan%'
OR tblCustDevPrinter.Tonername LIKE '%magenta%'
OR tblCustDevPrinter.Tonername LIKE '%yellow%'
OR tblCustDevPrinter.Tonername LIKE '%black%'
)
-- exclude things that aren't toner/ink
AND tblCustDevPrinter.Tonername NOT LIKE '%fuser%'
AND tblCustDevPrinter.Tonername NOT LIKE '%drum%'
AND tblCustDevPrinter.Tonername NOT LIKE '%image%'
AND tblCustDevPrinter.Tonername NOT LIKE '%maintenance%'
AND tblCustDevPrinter.Tonername NOT LIKE '%transfer%'
AND tblCustDevPrinter.Tonername NOT LIKE '%waste%'
AND tblCustDevPrinter.Tonername NOT LIKE '%feed roller%'
AND tblCustDevPrinter.Tonername NOT LIKE '%filter%'
And tblState.Statename = 'Active')
‎08-10-2020 05:11 PM
‎08-10-2020 03:54 PM
Select Top 1000000
tblAssets.AssetID,
tblAssets.AssetName As [Printer Name],
tblAssetCustom.Custom11 As [MT Asset Tag],
tblAssets.IPAddress As [IP Address],
tsysIPLocations.IPLocation As [Facility Location],
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
Convert( VarChar(10),
Cast( Case
When tblCustDevPrinter.TonerMaximum > 0
Then tblCustDevPrinter.TonerRemaining / tblCustDevPrinter.TonerMaximum * 100
End
As Decimal(6,2))) + '%' As RemainingPercentage,
...
Select Top 1000000
tblAssets.AssetID,
tblAssets.AssetName As [Printer Name],
tblAssetCustom.Custom11 As [MT Asset Tag],
tblAssets.IPAddress As [IP Address],
tsysIPLocations.IPLocation As [Facility Location],
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
Cast(Floor(tblCustDevPrinter.TonerRemaining / (Case
When tblCustDevPrinter.TonerMaximum = 0
Then 1
Else tblCustDevPrinter.TonerMaximum
End) * 100) As nvarchar) + '%' As RemainingPercentage,
...
‎08-10-2020 03:10 PM
‎08-07-2020 10:54 PM
Convert( VarChar(10),
Cast( Case
When tblCustDevPrinter.TonerMaximum > 0
Then tblCustDevPrinter.TonerRemaining / tblCustDevPrinter.TonerMaximum * 100
End
As Decimal(6,2))) + '%' As Pct
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now