restrictions through phased re-openings, although some states have halted re-openings as described above. In addition, during this time, as the initial impact of Covid-19 was ascertained and operations were adjusted accordingly, salaries were reinstituted with the exception of corporate staff, whose salaries were reinstituted at the end of July 2020.
Income (loss) from operations. Our operating loss was $3.8 million for the three months ended July 3, 2020 as a result of the factors noted above. As a percentage of contract revenue, operating loss was 4.6% for the three months ended July 3, 2020 compared to an operating income of 2.7% for the three months ended June 28, 2019. The decrease in operating margin was primarily attributable to decreases in contract revenue as a result of Covid-19 combined with increases in stock-based compensation and intangible asset amortization from acquisitions, partially offset by increases in governmental contract revenue.
Total other expense, net. Total other expense, net was flat for the three months ended July 3, 2020 compared to the three months ended June 28, 2019.
Income tax expense (benefit). Income tax benefit was flat for the three months ended July 3, 2020 compared to the three months ended June 28, 2019. Changes within the tax benefit amount were primarily attributable to fluctuations within various tax deductions and tax credits.
Net income (loss). As a result of the above factors, our net loss was $5.0 million for the three months ended July 3, 2020, as compared to a net income of $1.6 million for the three months ended June 28, 2019.
Six Months Ended July 3, 2020 Compared to Six Months Ended June 28, 2019
Contract revenue. Consolidated contract revenue decreased $6.6 million, or 3.4%, in the six months ended July 3, 2020 compared to the six months ended June 28, 2019, primarily due to decreased contract revenues from our direct install programs for small businesses in our Energy segment, partially offset by an increase in contract revenue generated from government projects in our Energy segment and incremental contract revenue from the acquisitions of Onsite Energy and E3, Inc. Contract revenues for our direct install programs for small businesses decreased as a result of the business shutdowns resulting from the Covid-19 pandemic and efforts to limit its spread that started in March 2020, and continued through substantially all of the second quarter.
Contract revenue in our Energy segment decreased $5.5 million, or 3.4%, in the six months ended July 3, 2020 compared to the six months ended June 28, 2019. Contract revenue for the Energy segment primarily decreased as a result of decreased contract revenues from our direct install programs for small businesses, partially offset by an increase in revenue generated from the acquisitions of Onsite Energy and E3, Inc. Contract revenues for our direct install programs for small businesses decreased as a result of the effects of Covid-19.
Contract revenue in our Engineering and Consulting segment decreased $1.1 million, or 3.2%, in the six months ended July 3, 2020 compared to the six months ended June 28, 2019. Contract revenue for the Engineering and Consulting segment decreased primarily due to decreased subcontractor revenues combined with a reduction of scope of work related to one of our customers. As described above, our revenues in this segment have been minimally affected by Covid-19 as the services in this segment have generally been deemed “essential” by the government and continue to operate while abiding social distancing measures.
Direct costs of contract revenue. Direct costs of consolidated contract revenue decreased $9.8 million, or 7.0%, in the six months ended July 3, 2020 compared to the six months ended June 28, 2019, primarily as a result of decreased contract revenues from our direct install programs for small businesses in our Energy segment, partially offset by an increase in contract revenue generated from government projects in our Energy segment, combined with additional direct costs of contract revenue related to our acquisitions of Onsite Energy and E3., Inc.
Direct cost of contract revenue in our Energy segment decreased $8.2 million, or 7.0%, to $110.1 million for the six months ended July 3, 2020 compared to the six months ended June 28, 2019, primarily as a result of the decrease in our contract revenues related to direct install programs for small businesses as described above, partially offset by increases in contract revenues related to government projects combined with the acquisitions of Onsite Energy and E3, Inc. in the Energy segment mentioned above which collectively contributed $6.5 million in direct costs of contract