This is covered under ASC 350-40.
All early-phase costs, called, "preliminary project stage" costs, must be expensed. These are akin to R&D costs and include things like costs related to project alternatives.
Costs incurred subsequent to this stage can be capitalized when management concludes that it is probable that the project will be completed and that the software will be used as intended. Without that, all internal use software must be expensed no matter what.
More specifically, coding, testing and various implementation costs can be capitalized. These include:
1. External direct costs of material and services (this is kind of a DUH! specification...you don't even need ASC 350-40 in order to capitalize costs like this...)
2. Payroll and payroll related costs for employees who are directly associated with and who devote time to the internal-use computer software project to the extent of the time spent directly on the project (this is typically where the majority of the capitalized costs come from)
3. Interest cost incurred while developing the software (see ASC 835-20--I didn't even waste my time with this, but technically, it can/should be considered)
G&A, overhead, and training costs are expensed as incurred.
Hope that helps