TMT Fleet Maintenance External Functions

PMs Due with Last PM Repair Order

This function will show you the PMs that are due, plus the last repair order that the PM was performed on.

TMWAMSEXTF_PMSDUE_LASTORDER

Input Parameters

Parameter Name

Parameter Information

Parameter Description

@UNITNUMBER

VARCHAR (24)

The Unit ID displayed in Masters Units

@CUSTOMERNAME

VARCHAR (12)

Customer name associated with unit

@SHOPID

VARCHAR (12)

Shop Identification Number

@CUSTOMERID

INT

Identification number for the customer.

@CURRENTDATE

DATETIME

The current date

@PHYLOCATION

VARCHAR (12)

The physical location of unit as found in Masters > Units > Misc

@PHYSHOPLOCATION

VARCHAR (12)

Current shop for unit as found on Masters > Units > Misc

@COSTCENTER

VARCHAR (12)

Units Cost Center

@MAKE

VARCHAR (12)

Units Make

@MODEL

VARCHAR (12)

Units Model

@DIVISIONCD

VARCHAR (12)

Company Division a unit belongs to

@STATUS

VARCHAR (12)

Whether Order is Open, Closed, Complete, etc.

@DEPTCODE

VARCHAR (12)

Department within the company Division

@ACTIVITY

VARCHAR (12)

Units activity Delivery, Tractor, Service, etc.

@UNITTYPE

VARCHAR (12)

Tractor. Trailer, Tanker, etc.

@FLEETID

VARCHAR (12)

ID used to identify Year, Make, Model, Capacity, Unit Type, Engine & Wheelbase of Unit. Any combination of these can be used.

@MODELYEAR

INT

Units Model Year

@PMCOMPCODE

VARCHAR (12)

Component Code that represents a PM.

@PMTYPE

VARCHAR (12)

Independent or Dependent

@UNITUSERFLD1

VARCHAR (12)

Used to track specific information for a unit

@UNITUSERFLD2

VARCHAR (12)

Used to track specific information for a unit

@UNITUSERFLD3

VARCHAR (12)

Used to track specific information for a unit

@UNITUSERFLD4

VARCHAR (12)

Used to track specific information for a unit

@UNITUSERFLD5

VARCHAR (12)

Used to track specific information for a unit

@UNITUSERFLD6

VARCHAR (12)

Used to track specific information for a unit

@UNITUSERFLD7

VARCHAR (12)

Used to track specific information for a unit

@UNITUSERFLD8

VARCHAR (12)

Used to track specific information for a unit

@STARTDATE

DATETIME

The starting date of your search

@ENDDATE

DATETIME

The ending date of your search

@PMPERCENT

NUMERIC (15,6)

Percentage of time before PM is due (if under 100%, if over 100% PM is past due)

@COMPANYID

VARCHAR (12)

The ID assigned to a company

@ACTIVEONLY

CHAR (1)

Y or N for include active units only

TMWAMSEXTF_PMSDUE_LASTORDER Example:
DECLARE @UNITNUMBER VARCHAR (24), @CUSTOMERNAME VARCHAR (12), @SHOPID VARCHAR (12), @CUSTOMERID INT VARCHAR (12), @CURRENTDATE DATETIME VARCHAR (12), @PHYLOCATION VARCHAR (12), @PHYSHOPLOCATION VARCHAR (12), @COSTCENTER VARCHAR (12), @MAKE VARCHAR (12), @MODEL VARCHAR (12), @DIVISIONCD VARCHAR (12), @STATUS VARCHAR (12), @DEPTCODE VARCHAR (12), @ACTIVITY VARCHAR (12), @UNITTYPE VARCHAR (12), @FLEETID VARCHAR (12), @MODELYEAR INT, @PMCOMPCODE VARCHAR (12), @PMTYPE VARCHAR (12), @UNITUSERFLD1 VARCHAR (12), @UNITUSERFLD2 VARCHAR (12), @UNITUSERFLD3 VARCHAR (12), @UNITUSERFLD4 VARCHAR (12), @UNITUSERFLD5 VARCHAR (12), @UNITUSERFLD6 VARCHAR (12), @UNITUSERFLD7 VARCHAR (12), @UNITUSERFLD8 VARCHAR (12), @STARTDATE DATETIME, @ENDDATE DATETIME, @PMPERCENT NUMERIC (15,6), @COMPANYID VARCHAR (12), @ACTIVEONLY CHAR (1)

 — Set parameter values
SET @PMPERCENT = 0
SET @CURRENTDATE = getdate()

 — Example of customer unit
SET @CUSTOMERNAME = 'Johnson and Johnson'
SET @UNITNUMBER = '1011'

 — Example of TMT Fleet Maintenance UNIT
SET @UNITNUMBER = '1010'

SELECT PM.TEMPID, PM.UNITID, PM.UNITNUMBER, PM.[DESCRIPTION], PM.SCHEDTYPE, PM.LASTDONE, PM.LASTRDING, PM.DUEPERCENT, PM.DEPRANK, PM.INTERVAL, PM.UTILIZATION, PM.METERTYPE, PM.METERDEFID, PM.COMPCDKEY, PM.COMPCODE, PM.LASTRDINGDATE, PM.PMLASTDONEMETER, PM.FLEETID, PM.DOMICILE, PM.COSTCTCODE, PM.DEPTCODE, PM.ACTIVCODE, PM.DIVISIONCD, PM.STATUS, PM.UNITTYPE, PM.MAKE, PM.MODEL, PM.MODELYEAR, PM.CUSTOMERNAME, PM.CUSTID, PM.INSERVICE, PM.VENDOR, PM.UNITUSERFLD1, PM.UNITUSERFLD2, PM.UNITUSERFLD3, PM.UNITUSERFLD4, PM.UNITUSERFLD5, PM.UNITUSERFLD6, PM.UNITUSERFLD7, PM.UNITUSERFLD8, PM.PHYLOCATION, PM.PHYSHOPLOCATION, PM.UNITDESCRIP, PM.DUEDATE, PM.NEXTDUEMETER, PM.ORDERID, PM.ORDERNUM, PM.CLOSED FROM [dbo].[TMWAMSEXTF_PMSDUE_LASTORDER] (@UNITNUMBER, @CUSTOMERNAME, @SHOPID, @CUSTOMERID, @CURRENTDATE, @PHYLOCATION, @PHYSHOPLOCATION, @COSTCENTER, @MAKE, @MODEL, @DIVISIONCD, @STATUS, @DEPTCODE, @ACTIVITY, @UNITTYPE, @FLEETID, @MODELYEAR, @PMCOMPCODE, @PMTYPE, @UNITUSERFLD1, @UNITUSERFLD2, @UNITUSERFLD3, @UNITUSERFLD4, @UNITUSERFLD5, @UNITUSERFLD6, @UNITUSERFLD7, @UNITUSERFLD8, @STARTDATE, @ENDDATE, @PMPERCENT) PM

Purchase Order Accrual Report

This function will allow you to return a list of received purchase orders by shop and or vendor in a given period of time. The purchase order total must be greater than $0, and it uses the received date of the purchase order for the start and end dates. The vendoridlist must be the vendor ID and shopidlist must be the shop ID from TMT Fleet Maintenance, not the description. The vendor ID’s and shop ID’s should be separated by a comma with no spaces if listing more than 1 shop or vendor in the search criteria.

TMWAMSEXTF_PO_ACCRUAL

Input Parameters

Parameter Name

Parameter Information

Parameter Description

@STARTDATE

DATETIME, Optional

Beginning date for search

@ENDDATE

DATETIME, Optional

Ending date for search

@VENDORIDLIST

VARCHAR, (8000), Optional

List of vendors to use in search

@SHOPIDLIST

VARCHAR, (8000), Optional

List of shops to use in search

TMWAMSEXTF_PO_ACCRUAL Example:
DECLARE @STARTDATE [DATETIME], @ENDDATE [DATETIME],@VENDORIDLIST [VARCHAR](8000), @SHOPIDLIST [VARCHAR](8000)

 — Set parameter values
SET @STARTDATE = '01/01/2010'
SET @ENDDATE = '04/28/2010'
SET @SHOPIDLIST = '01,02,03'
SET @VENDORIDLIST = 'FRGHT,FORDX'

SELECT * FROM [dbo].[TMWAMSEXTF_PO_ACCRUAL] (@STARTDATE,@ENDDATE,@VENDORIDLIST,@SHOPIDLIST)

Vendor Repair Order Purchase Order Accrual Report

This function will allow you to return a list of completed vendor repair order purchase orders by shop and or vendor in a given period of time. The date search is based on the completed date of the vendor repair order. The vendoridlist must be the vendor ID and shopidlist must be the shop ID from TMT Fleet Maintenance, not the description. The vendor ID’s and shop ID’s should be separated by a comma with no spaces if listing more than 1 shop or vendor in the search criteria.

TMWAMSEXTF_VRO_ACCRUAL

Input Parameters

Parameter Name

Parameter Information

Parameter Description

@STARTDATE

DATETIME, Optional

Beginning date for search

@ENDDATE

DATETIME, Optional

Ending date for search

@VENDORIDLIST

VARCHAR, (8000), Optional

List of vendors to use in search

@SHOPIDLIST

VARCHAR, (8000), Optional

List of shops to use in search

TMWAMSEXTF_VRO_ACCRUAL Example:
DECLARE @STARTDATE [DATETIME], @ENDDATE [DATETIME], @VENDORIDLIST [VARCHAR](8000), @SHOPIDLIST [VARCHAR](8000)

 — Set parameter values
SET @SHOPIDLIST = '01,02,Speedco'
SET @VENDORIDLIST = 'SPEEDCO,NAPA,CARQUEST'

SELECT * FROM [dbo].[TMWAMSEXTF_VRO_ACCRUAL] (@STARTDATE, @ENDDATE, @VENDORIDLIST, @SHOPIDLIST)