To determine the capital gain and how it should be treated from tax prospective - we need to know how the sale of the business was structured.
Do you sell the business as shares of your corporation or that is an asset sale?
In case of shares sale - the capital gain is (selling price) - (basis you had in your shares).
In case of asset sale - the capital gain should be determined for each asset separately. Please also be aware that not all assets are qualified for long term capital gain rate.
The loan outstanding would be irrelevant for determine the capital gain.
Account payable (the amount that your business owes to suppliers - and part or all of that
were paid) should be part of business evaluation. Was that amount paid as part of selling transaction? - if so it should be added to the basis.
In case of sole proprietorship - you are not selling shares - but you are selling separate assets that all together constitute your business.
The capital gain should be determined separately for each asset.
Please also be aware that not all assets are qualified for long term capital gain rate.
Please take a look at this sample contract to purchase a business - http://www.lectlaw.com/forms/f048.htm - the purchase price must be allocated among the assets acquired - both a buyer and a seller should agree on such allocation. The allocation would significant affect taxes for both the seller, who might seeks to maximize capital gains, and the buyer who might looking for better tax deductions. Use the form 8594 - http://www.irs.gov/pub/irs-pdf/f8594.pdf instructions - http://www.irs.gov/instructions/i8594/index.html and have both a buyer and a seller to agree on cost allocation - you will attach the form to your tax return
Your taxable income is calculated for each asset = (selling price) - (basis); If you purchase the the asset - the basis is its purchase price; The basis should be adjusted by any improvement expenses and depreciation.The business is a collection of assets, some tangible (real estate, inventory, etc) and some intangible (goodwill, accounts receivable, a trade name, etc). According to IRS rules, the buyer and seller must use the same allocation, so the allocation will have to be negotiated and put in writing as part of the sales contract.
Before Aug 11, 1993, goodwill was not depreciable at all, and other section 197 intangible assets of the business (patents, trademarks, trade names, copyrights, a trained workforce, business records, customer or supplier relationships, licenses or permits) were depreciated only if the taxpayer could demonstrate that they had a limited useful life. Therefore, if you started your business from scratch or purchased it before 1993, it's likely that you were unable to depreciate your goodwill. Intangibles acquired after Aug 11, 1993 must amortize them over a 15 years. Self-created intangibles still may not be depreciated.
Any gains on inventory, or accounts receivable are treated as ordinary income.
The gain on depreciable property is treated as ordinary income to the extent of depreciation you've already claimed on that property - this way the depreciation is "recaptured."