From: http://www.icc.illinois.gov/mc/EOSSssrs.aspx (Credentials information updated by communications with Brad Smith)
Thirty-eight states, including Illinois, require interstate for-hire motor carriers of property and passengers to provide information on the carrier's Federal Motor Carrier Safety Administration (FMCSA) operating authority. Regulated interstate motor carriers file the information on an annual basis so the carrier's operations can be monitored. For each state they operate in, regulated carriers are responsible for applying for the right to operate, to pay appropriate vehicle fees, to provide continuous proof of insurance, and to identify a designated resident agent. To make the administration of regulating these carriers more efficient for the states and regulated carriers, the 38 states have entered into a cooperative agreement to administer an operating authority program. Through this program, the Single State Registration System (SSRS), carriers may obtain operating authority (for any of the participating states in which they will be active) with a single request to the carrier's base State. SSRS issues a receipt that documents the States in which that carrier is authorized to operate. The Illinois Commerce Commission (ILCC) administers the Single State Registration System in Illinois.
The SSRS registration cycle is January to December and the renewal period is from October through December each year. In 2006, the Commerce Commission issued approximately 86,100 SSRS credentials to Illinois-based carriers.
The Commerce Commission provides a simple 38 field application form and mails it to the SSRS registrants. The carrier completes the application and either mails or faxes the application to the SSRS Unit. The carrier also remits the proper payment for SSRS credentials to the SSRS Unit.
Upon receipt of the renewal application, which may be submitted via e-mail, the SSRS Unit reviews the contents of the renewal application. The application's contents are evaluated to determine whether all required information has been submitted. If any omissions are discovered, the carrier is contacted, either by telephone or mail, to rectify the omission. Complete applications are input into the Commerce Commission system where online edits are performed. Upon notification that the appropriate funds have been received by the State, the SSRS Unit issues new credentials for the carrier's vehicles.
Microsoft SQL Server 2005 in a clustered environment.
While the ILCC appears to have a fairly complete database on motor carriers, the purpose of this analysis is limited to the SSRS system. The process for motor carriers to register in the SSRS system includes the following areas:
The SAFER database already contains both Federal Highway Administration authority and insurance information. The resident agents is also a federal form which is filed with the Federal Motor Carrier Safety Administration (FMCSA) but does not appear to be part of the SAFER database. Dave Lazarides indicated that this was not in the scope of the SSRS system.
The SSRS data primarily is concerned with the registration of the carrier to the SSRS system along with payment for each state and number of vehicles operated in these states. The SSRS generates receipts and sends these receipts to the carrier on successful completion of the SSRS application. The carrier retains the original receipts at its office and makes copies for the vehicles which are paid for. Some carriers transport interstate commodities, which are exempt from fees, in which case they receive an exempt authority from the FMCSA. These carriers are also documented in the SSRS system.
The legacy data are primarily kept in three tables, with several assisting coding (lookup) tables. The carrier ID in these three tables is a state ID number. Since SAFER/CVIEW are keyed by the federal US DOT identities, the CARRIER table is of interest since it relates to federal US DOT identities, FMCSA identities and state identities.
The three primary tables are:
Normally a carrier would have a row in BASEREG and either rows in RECEIPT or a single row in REGSTRAT but if a carrier moved to or from exempt status, it might have rows in both RECEIPT or REGSTRAT tables.
The RECEIPT table may have several rows for a carrier in a particular state and year because the carrier may need to add vehicles after the regular registration period.
The CARRIER table has the following mapping fields:
Column Name | Information |
---|---|
MC_NBR | state ID |
DOT_NBR | federal US DOT ID |
FMCSA_NBR | federal motor carrier safety administration ID |
There are presumably other fields in the CARRIER table.
Unless more than one primary table uses the coding table, its name is associated with the primary table name. See detailed coding tables below for values in these tables.
Coding Table Name | Information Coded |
---|---|
BASEREG_TAB | Indicates special type of registration (new/temporary/emergency) |
REC_TAB | Indicates type of vehicles (Route Bus, Charter Bus, Truck, None) |
REG_TAB | Type of exemption (Authorized, Bus, Charter 0, Exempt, Truck ...) |
STAT_TAB | Status code in both REGSTRAT and RECEIPT (Active, Suspended ...) |
ER_TAB | Error code used in processing in both REGSTRAT and RECEIPT (None, Missing US DOT Number ...) |
Field | Type | Key | Foreign Key Table | Comment |
---|---|---|---|---|
BASEREG_ID | bigint | primary key | internal use only | |
MC_NBR | bigint | candidate key | state ID (probably should be primary key) | |
BASEREG_CD | nvarcar(2) | BASEREG_TAB | special type of registration | |
SERVICE_DATE | datetime | date the service was performed | ||
AGENT_LIST_IND | bit | have agent residency list | ||
FMCSA_ORDER_IND | bit | have FMCSA authority | ||
SELF_INS_IND | bit | carrier is self insured | ||
REQ_INS_AMT | money | required insurance for this carrier | ||
EMPCODE | nvarchar(32) | employee who processed this carrier | ||
DATESTAMP | datetime | time of last change |
Field | Type | Key | Foreign Key Table | Comment |
---|---|---|---|---|
RECEIPT_ID | bigint | primary key | internal use only | |
FEE_CHG_ID | bigint | candidate key (part) | order number | |
MC_NBR | bigint | candidate key (part) | state ID | |
VOUCHER_ID | bigint | VOUCHER |
related to fees due to/from other states | |
CARRIER_STATE_CD | nvarchar(2) | base state | ||
TRAVEL_STATE_CD | nvarchar(2) | candidate key (part) | state traveled in | |
VEHICLES | int | number of vehicles for this state for this order | ||
FEE_AMT | money | amount paid | ||
REC_CD | nvarchar(2) | REC_TAB | type of vehicles | |
RECEIPT_YEAR | int | candidate key (part) | year this receipt is for | |
PRINTED_DTE | datetime | timestamp receipt printed | ||
PRINTED_BY | nvarchar(32) | employee who printed receipt | ||
ENTERED_DTE | datetime | time receipt entered | ||
ENTERED_BY | nvarchar(32) | employee who entered receipt | ||
STAT_CD | nvarchar(32) | STAT_TAB | status code of receipt | |
STAT_DTE | datetime | time of STAT_CD entered | ||
ER_CD_DISP | nvarchar(32) | from ER_TAB | Error message to track down problems | |
EMPCODE | nvarchar(32) | employee last worked on receipt | ||
DATESTAMP | datetime | time of last change |
Field | Type | Key | Foreign Key Table | Comments |
---|---|---|---|---|
REGSTRAT_ID | bigint | Primary Key | internal use only | |
FEE_CHG_ID | bigint | order number | ||
MC_NBR | bigint | Candidate key | state ID | |
REG_CD | nvarchar(2) | REG_TAB | Type of Exemption | |
ISSUE_DTE | datetime | date exemption issued | ||
WARN_DTE | date | optional - warning about problems of exemption sent | ||
SUSP_DTE | date | optional - suspension of exemption date | ||
REV_DTE | date | optional - revocation of exemption date | ||
STAT_CD | nvarchar(32) | status code of receipt | ||
STAT_DTE | datetime | time of STAT_CD entered | ||
ER_CD_DISP | nvarchar(32) | ER_TAB | Error code to track down problems | |
MESSAGE | nvarchar(150) | Optional message associated with order | ||
EMPCODE | nvarchar(32) | Employee last worked on REGISTAT | ||
DATESTAMP | datetime | time of last update |
Field | Type | Primary Key | Comments | Values |
---|---|---|---|---|
BASEREG_CD | nvarchar(2) | Primary Key | ||
BASEREG_NAM | nvarchar(50) | Special Nature | New, Temporary, Emergency | |
RETIRED_IND | bit | This code is no longer active | ||
EMPCODE | nvarchar(32) | Employee code | ||
DATESTAMP | datetime | time of last update |
Field | Type | Primary Key | Comments | Values |
---|---|---|---|---|
REC_CD | nvarchar(2) | Primary Key | ||
REC_NAM | nvarchar(50) | Route Bus, Charter Bus, Truck, None | ||
RETIRED_IND | bit | this code is no longer active | ||
EMPCODE | nvarchar(32) | Employee code | ||
DATESTAMP | datetime | time of last update |
Field | Type | Primary Key | Comments | Values |
---|---|---|---|---|
REG_CD | nvarchar(2) | Primary Key | ||
REG_NAM | nvarchar(50) | Authorized, Bus, Exempt, ... (see below) | ||
RETIRED_IND | bit | no longer active | ||
EMPCODE | nvarchar(32) | Employee code | ||
DATESTAMP | datetime | time of last update |
Field | Type | Primary Key | Comment | Values |
---|---|---|---|---|
STAT_CD | nvarchar(2) | primary key | ||
STAT_NAM | nvarchar(50) | Name | Active, Revoked, Inactive ... (see below) | |
RETIRED_IND | bit | this code no longer active | ||
EMPCODE | nvarchar(32) | Employee code | ||
DATESTAMP | datetime | time of last update |
Field | Type | Primary Key | Comment | Values |
---|---|---|---|---|
ER_CD | nvarchar(2) | Primary Key | ||
ER_NAM | nvarchar(50) | Name | None, Missing DOT Number ... (see below) | |
RETURN_IND | bit | this application is returned to the carrier | ||
RETIRED_IND | bit | this code no longer active | ||
EMPCODE | nvarchar(32) | Employee code | ||
DATESTAMP | datetime | time of last update |
Since SAFER/CVIEW has no current facility for SSRS information and CVIEW is designed for extensions like SSRS, we need to specify the organization in CVIEW as part of a mapping of legacy SSRS to CVIEW data.
To simplify the mapping, the organization of the CVIEW data should be similar to the organization of the legacy SSRS data. Discussed below are the motivations for alterations from that organization.
Field | Type | Primary Key | Foreign Key Table | Comment |
---|---|---|---|---|
CARRIER_ID_NUMBER | bigint | primary key | US DOT | |
STATE_MC_NBR | bigint | state ID | ||
FMCSA_NBR | bigint | federal motor carrier safety administration ID | ||
CARRIER_STATE_CD | nvarchar(2) | base state | ||
BASEREG_CD | nvarcar(2) | BASEREG_TAB | special type of registration | |
SERVICE_DATE | datetime | date the service was performed | ||
AGENT_LIST_IND | bit | have agent residency list | ||
FMCSA_ORDER_IND | bit | have FMCSA authority | ||
SELF_INS_IND | bit | carrier is self insured | ||
REQ_INS_AMT | money | required insurance for this carrier | ||
DATESTAMP | datetime | time of last change |
Field | Type | Primary Key | Foreign Key | Comment |
---|---|---|---|---|
CARRIER_ID_NUMBER | bigint | Primary Key (part) | US DOT | |
TRAVEL_STATE_CD | nvarchar(2) | Primary Key (part) | state traveled in | |
FEE_CHG_ID | bigint | Primary Key (part) | order number | |
RECEIPT_YEAR | int | Primary Key (part) | year this receipt is for | |
VEHICLES | int | number of vehicles for this state for this order | ||
FEE_AMT | money | amount paid | ||
REC_CD | nvarchar(2) | REC_TAB | type of vehicles | |
PRINTED_DTE | datetime | time receipt printed | ||
ENTERED_DTE | datetime | time receipt entered | ||
STAT_CD | nvarchar(2) | STAT_TAB | status code of receipt | |
STAT_DTE | datetime | time of STAT_CD entered | ||
ER_CD_DISP | nvarchar(32) | Error code to track down problems | ||
DATESTAMP | datetime | time of last update |
Contains Exempt information for carriers who are exempt
Field | Type | Primary Key | Foreign Key | Comment |
---|---|---|---|---|
CARRIER_ID_NUMBER | bigint | primary key | US DOT | |
FEE_CHG_ID | bigint | order number | ||
REG_CD | nvarchar(2) | REG_TAB | Type of Exemption | |
ISSUE_DTE | date | date exemption issued | ||
WARN_DTE | date (optional) | warning about problems of exemption sent | ||
SUSP_DTE | date (optional) | suspension of exemption date | ||
REV_DTE | date (optional) | revocation of exemption date | ||
STAT_CD | nvarchar(32) | status code of receipt | ||
STAT_DTE | datetime | time of STAT_CD entered | ||
ER_CD_DISP | nvarchar(32) | Error code to track down problems | ||
MESSAGE | nvarchar(150) | Optional message associated with order | ||
DATESTAMP | datetime | time of last update |
The coding tables can be left as they are - with the following changes:
To | From | Notes |
---|---|---|
CARRIER_ID_NUMBER | CARRIER.DOT_NBR | |
STATE_MC_NBR | BASEREG.MC_NBR | |
FMCSA_NBR | CARRIER.FMCSA_NBR | |
CARRIER_STATE_CD | NULL initially | updated with RECEIPT rows |
BASEREG_CD | BASEREG.BASEREG_CD | Validation required |
SERVICE_DATE | BASEREG.SERVICE_DATE | |
AGENT_LIST_IND | BASEREG.AGENT_LIST_IND | |
FMCSA_ORDER_IND | BASEREG.FMCSA_ORDER_IND | |
SELF_INS_IND | BASEREG.SELF_INS_IND | |
REQ_INS_AMT | BASEREG.REQ_INS_AMT | |
DATESTAMP | BASEREG.DATESTAMP |
To | From | Notes |
---|---|---|
CARRIER_ID_NUMBER | CARRIER.DOT_NBR | |
TRAVEL_STATE_CD | RECEIPT.TRAVEL_STATE_CD | |
FEE_CHG_ID | RECEIPT.FEE_CHG_ID | |
RECEIPT_YEAR | RECEIPT.RECEIPT_YEAR | Validation required |
VEHICLES | RECEIPT.VEHICLES | |
FEE_AMT | RECEIPT.FEE_AMT | |
REC_CD | RECEIPT.REC_CD | Validation required |
PRINTED_DTE | RECEIPT.PRINTED_DTE | |
ENTERED_DTE | RECEIPT.ENTERED_DTE | |
STAT_CD | RECEIPT.STAT_CD | Validation required |
STAT_DTE | RECEIPT.STAT_DTE | |
ER_CD_DISP | RECEIPT.ER_CD_DISP | |
DATESTAMP | RECEIPT.DATESTAMP |
To | From | Notes |
---|---|---|
CARRIER_ID_NUMBER | CARRIER.DOT_NBR | |
FEE_CHG_ID | REGSTRAT.FEE_CHG_ID | |
REG_CD | REGSTRAT.REG_CD | Validation required |
ISSUE_DTE | REGSTRAT.ISSUE_DTE | |
WARN_DTE | REGSTRAT.WARN_DTE | |
SUSP_DTE | REGSTRAT.SUSP_DTE | |
REV_DTE | REGSTRAT.REV_DTE | |
STAT_CD | REGSTRAT.STAT_CD | Validation required |
STAT_DTE | REGSTRAT.STAT_DTE | |
ER_CD_DISP | REGSTRAT.ER_CD_DISP | |
MESSAGE | REGSTRAT.MESSAGE | |
DATESTAMP | REGSTRAT.DATESTAMP |
Since DATESTAMP in BASEREG, RECEIPT and REGSTRAT are updated when changes are made to those respective tables they can serve as a trigger field for including them in a transaction to update the SSRS_CARRIER, SSRS_RECEIPT, SSRS_EXEMPT tables respectively.
The US_DOT Carrier ID mapping to state ID in the SSRS system is contained in the following table:
Records Category | Count |
---|---|
Total SSRS | 12763 |
Have US_DOT Carrier ID | 12434 |
Missing US_DOT Carrier ID | 329 |
Missing US_DOT Have FMCSA | 254 |
Missing US_DOT Missing FMCSA | 75 |
The data in this table was effective as of 10/25/2006 based on queries run by Brad Smith.
The FMCSA is the Federal Motor Carrier Safety Administration ID. This identifier may be helpful in determining US_DOT Carrier IDs.
BASEREG_CD | BASEREG_NAM | RETIRED_IND |
---|---|---|
E | Emergency Temporary Authority | 0 |
N | New Certificate/Permit | 0 |
T | Temporary Authority | 0 |
ER_CD | ER_NAM | RETURN_IND | RETIRED_IND |
---|---|---|---|
00 | None | 0 | 0 |
01 | Document not Properly Signed | 1 | 0 |
02 | Missing DOT Number | 0 | 0 |
03 | Principle Names / Titles Missing | 1 | 0 |
04 | Invalid Fee Code | 0 | 0 |
05 | Underpayment $______.__, Correct Amount is $______ | 1 | 0 |
06 | Missing Full Legal Name | 1 | 0 |
07 | Incomplete Business Address / Telephone Number | 0 | 0 |
08 | Business Address Contains P.O. Box Number Only | 0 | 0 |
09 | Duplicate Motor Carrier on File | 1 | 0 |
10 | Insufficient Funds to Cover Payment | 1 | 0 |
11 | Invalid Motor Carrier Number Specified | 1 | 0 |
12 | Payment not Received | 1 | 0 |
13 | Authority / Registration Revoked | 1 | 0 |
14 | Current Annual Report not on File | 0 | 0 |
15 | Invalid FEIN/SSN Code or Number | 0 | 0 |
16 | Invalid Zip Code | 0 | 0 |
17 | Invalid State Abbreviation | 0 | 0 |
40 | ICC Motor Carrier Number Missing | 1 | 0 |
41 | Process Agent not Specified | 0 | 0 |
42 | Type of Business not Specified | 0 | 0 |
43 | Registration Type (A or E) Missing | 0 | 0 |
44 | No Authority to Operate in Illinois | 1 | 0 |
45 | Business State Changed, No Proof Provided | 1 | 0 |
46 | Prior Application Revoked or Suspended | 0 | 0 |
47 | Pending Application Already on File | 1 | 0 |
48 | Revoked: Sec. of State Corporation Fees Not Paid | 1 | 0 |
49 | State of Incorporation Missing | 0 | 0 |
50 | Shipper Support Statement not Filed | 0 | 0 |
51 | County Code/Name Missing | 0 | 0 |
52 | < |
0 | 0 |
53 | < |
0 | 0 |
54 | < |
0 | 0 |
55 | < |
0 | 0 |
56 | < |
0 | 0 |
57 | Compensation type not given / amount invalid | 1 | 0 |
58 | Letters of Office / Probate Court Order Missing | 0 | 0 |
59 | Small Estate / Heirship Affidavit Missing | 0 | 0 |
60 | Identification of Equipment Section Incomplete | 1 | 0 |
61 | Lease Eff / Exp Date Missing or Incorrect | 1 | 0 |
62 | Lessee Control Indicator should be 'Y' | 1 | 0 |
63 | Lease Term is Greater Than 3 Years | 1 | 0 |
64 | Abstract of Shipments Missing | 0 | 0 |
65 | Contract For Transfer Missing | 0 | 0 |
66 | Operator / Dispatcher Indicator Not Present | 0 | 0 |
67 | No Response Present / Invalid Response | 0 | 0 |
68 | Driver's License Not Present / Invalid | 0 | 0 |
70 | No Insurance FORM-E on File | 1 | 0 |
71 | Duplicate Insurance Form/Policy | 1 | 0 |
72 | Insurance Company/Policy Number Missing or Invalid | 1 | 0 |
73 | COD Affidavit or Bond Already on File | 1 | 0 |
74 | No Active Insurance FORM/POLICY to Cancel | 1 | 0 |
75 | Invalid Insurance FORM/POLICY Type | 0 | 0 |
76 | No Insurance POLICY/BOND Effective Date | 1 | 0 |
77 | "ILLINOIS COMMERCE COMMISSION" name not on Form | 1 | 0 |
78 | Insurance Company Inactive | 1 | 0 |
80 | Stamp Ordering Fee Not Paid | 1 | 0 |
81 | Stamps Not ordered with Application | 1 | 0 |
82 | Missing Expiration Date for Stamps | 0 | 0 |
83 | Missing Quantity for Stamps | 1 | 0 |
84 | Total Fees for Stamps not Specified or Incorrect | 1 | 0 |
85 | Incomplete Stamp Mailing Address | 0 | 0 |
86 | Invalid Re-Issued/Re-Printed Stamp Serial Numbers | 1 | 0 |
90 | Other | 1 | 0 |
91 | Docket Sub Number Missing | 0 | 0 |
99 | Overpayment - Check amount reduced | 0 | 0 |
REC_CD | REC_NAM | RETIRED_IND |
---|---|---|
B | Regular-Route Bus | 0 |
C | Charter Bus | 0 |
X | None | 0 |
REG_CD | REG_NAM | RETIRED_IND |
---|---|---|
A | Authorized | 0 |
B | Bus | 0 |
C | Charter | 0 |
E | Exempt | 0 |
N | None | 0 |
S | S: Unknown | 0 |
T | Truck | 0 |
U | U: Unknown | 0 |
V | V: Unknown | 0 |
X | X: Unknown | 0 |
Y | Y: Unknown | 0 |
STAT_CD | STAT_NAM | RETIRED_IND |
---|---|---|
00 | Active | 0 |
01 | Permanent Pending | 0 |
02 | Temporary Pending | 0 |
03 | Registration / Authority Issued | 0 |
04 | Suspension - Insurance Canceled | 0 |
05 | Suspension - Voluntary Request | 0 |
06 | Suspension - Bankruptcy | 0 |
07 | Revoked | 0 |
08 | Inactive | 0 |
10 | Stp Order - Inter. Canceled / Intra. Okay | 0 |
11 | Stp Order - Inter. Okay / Intra. Canceled | 0 |
12 | Stp Order - Inter. Canceled / Intra. Canceled | 0 |
13 | Stp Order - Inter. Canceled / Intra. Compliance | 0 |
14 | Stp Order - Inter. Okay / Intra. Compliance | 0 |
15 | Stp Order - Inter. Acceptbl. / Intra. Okay | 0 |
16 | Stp Order - Inter. Acceptbl. / Intra. Canceled | 0 |
17 | Stp Order - Inter. Acceptbl. / Intra. Compliance | 0 |
18 | Stp Order - Don't Print This Order Yet! | 0 |
99 | Process Not Completed | 0 |
Below is a php script which was used to generate X0011 and X0012 transactions which were then applied to XCVIEW implementation of CVIEW. A database was created and minimally populated with test data. The application of the test cases were successful and the scripts could be used as the basis for an implementation of a XML creation script for the SSRS system.
The $Host, $Username, $Password, "LSI_SSRS" database would need to be adjusted to reflect the actual SSRS database. This script assumes the database is a MS-SQL 2005 database server which is true in the case of SSRS information.
<?php
$Host = "lsissrshost";
// This script will open up the SSRS database and produce a transaction
// file for processing in the augmented cview tasks
/* Connecting, selecting database */
$Username = "username";
$Password = "password";
$link = mssql_connect($Host, $Username, $Password)
or die('Could not connect\n');
if (!mssql_select_db("LSI_SSRS"))
die("Could not select LSI_SSRS\n");
// open output file
$FileNameOut = ($argc > 1) ? $argv[1] : "CVIEWX0011V1.xml";
($fhout = fopen($FileNameOut, "w")) || die("Cannot open output file $FileNameOut\n");
$QryStr = "SELECT *, RECEIPT.DATESTAMP RECEIPT_DATESTAMP,
BASEREG.DATESTAMP BASEREG_DATESTAMP
FROM CARRIER, BASEREG, RECEIPT WHERE CARRIER.MC_NBR = BASEREG.MC_NBR
AND CARRIER.MC_NBR = RECEIPT.MC_NBR";
$Results = mssql_query($QryStr);
if ($Results === FALSE)
die("Failed Query - $QryStr\n");
if ($Results === TRUE) die("no rows");
$SnapDate = date("Y-m-d\Th:i:s");
// output XML heading
$XMLHeader = "<?xml version=\"1.0\"?>
<X0011 xmlns=\"http://www.safersys.org/namespaces/X0011V1\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xsi:schemaLocation=\"http://www.safersys.org/namespaces/X0011V1 X0011V1.xsd\">
<INTERFACE>
<NAME>SAFER</NAME>
<VERSION>04.02</VERSION>
</INTERFACE>
<TRANSACTION>
<VERSION>01.00</VERSION>
<OPERATION>REPLACE</OPERATION>
<DATE_TIME>$SnapDate</DATE_TIME>
<TZ>CD</TZ>
</TRANSACTION>\n";
fwrite($fhout,$XMLHeader);
$Last_MC_NBR = "";
while ($Row = mssql_fetch_object($Results)){
if ($Row->MC_NBR != $Last_MC_NBR){ // new Carrier
if ($Last_MC_NBR != ""){ // Finish last Carrier with Receit
$XMLReceipt =
" </SSRS_BASE>\n";
fwrite($fhout, $XMLReceipt);
}
$Last_MC_NBR = $Row->MC_NBR;
$XMLReceipt =
" <SSRS_BASE>\n";
// SSRS_CARRIER info
$Piece = $Row->DOT_NBR;
$CARRIER_ID_NUMBER = $Piece != "" ? $Piece : $Row->MC_NBR;
// Map state ID if required
$STATE_MC_NBR = $Row->MC_NBR;
$FMCSA_NBR = $Row->FMCSA_NBR;
$CARRIER_STATE_CD = $Row->CARRIER_STATE_CD;
$BASEREG_CD = $Row->BASEREG_CD;
$SERVICE_DATE = date("Y-m-d",strtotime($Row->SERVICE_DATE));
$AGENT_LIST_IND = $Row->AGENT_LIST_IND;
$FMCSA_ORDER_IND = $Row->FMCSA_ORDER_IND;
$SELF_INS_IND = $Row->SELF_INS_IND;
$REQ_INS_AMT = $Row->REQ_INS_AMT;
$DATESTAMP = date("Y-m-d\Th:i:s",strtotime($Row->BASEREG_DATESTAMP));
$XMLReceipt .=
" <CARRIER_ID_NUMBER>$CARRIER_ID_NUMBER</CARRIER_ID_NUMBER>
<STATE_MC_NBR>$STATE_MC_NBR</STATE_MC_NBR>
<FMCSA_NBR>$FMCSA_NBR</FMCSA_NBR>
<CARRIER_STATE_CD>$CARRIER_STATE_CD</CARRIER_STATE_CD>
<BASEREG_CD>$BASEREG_CD</BASEREG_CD>
<SERVICE_DATE>$SERVICE_DATE</SERVICE_DATE>
<AGENT_LIST_IND>$AGENT_LIST_IND</AGENT_LIST_IND>
<FMCSA_ORDER_IND>$FMCSA_ORDER_IND</FMCSA_ORDER_IND>
<SELF_INS_IND>$SELF_INS_IND</SELF_INS_IND>
<REQ_INS_AMT>$REQ_INS_AMT</REQ_INS_AMT>
<DATESTAMP>$DATESTAMP</DATESTAMP>\n";
fwrite($fhout, $XMLReceipt);
}
// SSRS_RECEIPT info
//CARRIER_ID already set
$TRAVEL_STATE_CD = $Row->TRAVEL_STATE_CD;
$FEE_CHG_ID = $Row->FEE_CHG_ID;
$RECEIPT_YEAR = $Row->RECEIPT_YEAR;
$VEHICLES = $Row->VEHICLES;
$FEE_AMT = $Row->FEE_AMT;
$REC_CD = $Row->REC_CD;
$PRINTED_DTE = date("Y-m-d",strtotime($Row->PRINTED_DTE));
$ENTERED_DTE = date("Y-m-d",strtotime($Row->ENTERED_DTE));
$STAT_CD = $Row->STAT_CD;
$STAT_DTE = date("Y-m-d",strtotime($Row->STAT_DTE));
$ER_CD_DISP = $Row->ER_CD_DISP;
$DATESTAMP = date("Y-m-d\Th:i:s",strtotime($Row->RECEIPT_DATESTAMP));
$XMLReceipt =
" <SSRS_RECEIPT>
<CARRIER_ID_NUMBER>$CARRIER_ID_NUMBER</CARRIER_ID_NUMBER>
<TRAVEL_STATE_CD>$TRAVEL_STATE_CD</TRAVEL_STATE_CD>
<FEE_CHG_ID>$FEE_CHG_ID</FEE_CHG_ID>
<RECEIPT_YEAR>$RECEIPT_YEAR</RECEIPT_YEAR>
<VEHICLES>$VEHICLES</VEHICLES>
<FEE_AMT>$FEE_AMT</FEE_AMT>
<REC_CD>$REC_CD</REC_CD>
<PRINTED_DTE>$PRINTED_DTE</PRINTED_DTE>
<ENTERED_DTE>$ENTERED_DTE</ENTERED_DTE>
<STAT_CD>$STAT_CD</STAT_CD>
<STAT_DTE>$STAT_DTE</STAT_DTE>
<ER_CD_DISP>$ER_CD_DISP</ER_CD_DISP>
<DATESTAMP>$DATESTAMP</DATESTAMP>
</SSRS_RECEIPT>\n";
fwrite($fhout,$XMLReceipt);
}
XMLReceipt =
" </SSRS_BASE>
</X0011>\n";
fwrite($fhout,$XMLReceipt);
fclose($fhout);
// open output file
$FileNameOut = ($argc > 2) ? $argv[2] : "CVIEWX0012V1.xml";
($fhout = fopen($FileNameOut, "w")) || die("Cannot open output file $FileNameOut\n");
$QryStr = "SELECT *, REGSTRAT.DATESTAMP REGSTRAT_DATESTAMP,
BASEREG.DATESTAMP BASEREG_DATESTAMP FROM CARRIER, BASEREG, REGSTRAT WHERE
CARRIER.MC_NBR = BASEREG.MC_NBR AND CARRIER.MC_NBR = REGSTRAT.MC_NBR";
$Results = mssql_query($QryStr);
if ($Results === FALSE)
die("Failed Query - $QryStr\n");
if ($Results === TRUE) die("no rows");
$SnapDate = date("Y-m-d\Th:i:s");
// output XML heading
$XMLHeader = "<?xml version=\"1.0\"?>
<X0012 xmlns=\"http://www.safersys.org/namespaces/X0012V1\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xsi:schemaLocation=\"http://www.safersys.org/namespaces/X0012V1 X0012V1.xsd\">
<INTERFACE>
<NAME>SAFER</NAME>
<VERSION>04.02</VERSION>
</INTERFACE>
<TRANSACTION>
<VERSION>01.00</VERSION>
<OPERATION>REPLACE</OPERATION>
<DATE_TIME>$SnapDate</DATE_TIME>
<TZ>CD</TZ>
</TRANSACTION>\n";
fwrite($fhout,$XMLHeader);
while ($Row = mssql_fetch_object($Results)){
$XMLExempt=
" <SSRS_EXEMPT>
<SSRS_BASE>\n";
// SSRS_CARRIER info
$Piece = $Row->DOT_NBR;
$CARRIER_ID_NUMBER = $Piece != "" ? $Piece : $Row->MC_NBR;
// Map state ID if required
$STATE_MC_NBR = $Row->MC_NBR;
$FMCSA_NBR = $Row->FMCSA_NBR;
$BASEREG_CD = $Row->BASEREG_CD;
$SERVICE_DATE = date("Y-m-d",strtotime($Row->SERVICE_DATE));
$AGENT_LIST_IND = $Row->AGENT_LIST_IND;
$FMCSA_ORDER_IND = $Row->FMCSA_ORDER_IND;
$SELF_INS_IND = $Row->SELF_INS_IND;
$REQ_INS_AMT = $Row->REQ_INS_AMT;
$DATESTAMP = date("Y-m-d\Th:i:s",strtotime($Row->BASEREG_DATESTAMP));
$XMLExempt .=
" <CARRIER_ID_NUMBER>$CARRIER_ID_NUMBER</CARRIER_ID_NUMBER>
<STATE_MC_NBR>$STATE_MC_NBR</STATE_MC_NBR>
<FMCSA_NBR>$FMCSA_NBR</FMCSA_NBR>
<BASEREG_CD>$BASEREG_CD</BASEREG_CD>
<SERVICE_DATE>$SERVICE_DATE</SERVICE_DATE>
<AGENT_LIST_IND>$AGENT_LIST_IND</AGENT_LIST_IND>
<FMCSA_ORDER_IND>$FMCSA_ORDER_IND</FMCSA_ORDER_IND>
<SELF_INS_IND>$SELF_INS_IND</SELF_INS_IND>
<REQ_INS_AMT>$REQ_INS_AMT</REQ_INS_AMT>
<DATESTAMP>$DATESTAMP</DATESTAMP>
</SSRS_BASE>\n";
fwrite($fhout, $XMLExempt);
// SSRS_EXEMPT info
//CARRIER_ID already set
$FEE_CHG_ID = $Row->FEE_CHG_ID;
$REG_CD = $Row->REG_CD;
$ISSUE_DTE = date("Y-m-d",strtotime($Row->ISSUE_DTE));
$PieceWarn = $Row->WARN_DTE;
$WARN_DTE = $PieceWarn != "" ? date("Y-m-d",strtotime($PieceWarn)) : "";
$PieceSusp = $Row->SUSP_DTE;
$SUSP_DTE = $PieceSusp != "" ? date("Y-m-d",strtotime($PieceSusp)) : "";
$PieceRev = $Row->REV_DTE;
$REV_DTE = $PieceRev != "" ? date("Y-m-d",strtotime($PieceRev)) : "";
$STAT_CD = $Row->STAT_CD;
$STAT_DTE = date("Y-m-d",strtotime($Row->STAT_DTE));
$ER_CD_DISP = $Row->ER_CD_DISP;
$MESSAGE = $Row->MESSAGE;
$DATESTAMP = date("Y-m-d\Th:i:s",strtotime($Row->REGSTRAT_DATESTAMP));
$XMLExempt =
" <SSRS_EXEMPT>
<CARRIER_ID_NUMBER>$CARRIER_ID_NUMBER</CARRIER_ID_NUMBER>
<FEE_CHG_ID>$FEE_CHG_ID</FEE_CHG_ID>
<REG_CD>$REG_CD</REG_CD>
<ISSUE_DTE>$ISSUE_DTE</ISSUE_DTE>\n";
if ($PieceWarn != "") $XMLExempt .=
" <WARN_DTE>$WARN_DTE</WARN_DTE>\n";
if ($PieceSusp != "") $XMLExempt .=
" <SUSP_DTE>$SUSP_DTE</SUSP_DTE>\n";
if ($PieceRev != "") $XMLExempt .=
" <REV_DTE>$SUSP_DTE</REV_DTE>\n";
$XMLExempt .=
" <STAT_CD>$STAT_CD</STAT_CD>
<STAT_DTE>$STAT_DTE</STAT_DTE>
<ER_CD_DISP>$ER_CD_DISP</ER_CD_DISP>
<MESSAGE>$MESSAGE</MESSAGE>
<DATESTAMP>$DATESTAMP</DATESTAMP>
</SSRS_EXEMPT>\n";
fwrite($fhout,$XMLExempt);
}
$XMLExempt =
" </SSRS_EXEMPT>
</X0012>\n";
fwrite($fhout,$XMLExempt);
fclose($fhout);
?>
There are no XML transactions in the regular CVISN CVIEW/SAFER system. The CVIEW system is designed so it can be augmented to include additional state systems such as SSRS. Below are the state XML transactions to accommodate SSRS systems. The two transactions are Receipt and Exempt input transactions.