The correct answer is D.

The cost of goods sold is the value of the goods that a company has sold during a period of time. It is calculated by taking the beginning inventory, adding the purchases, and subtracting the ending inventory.

The opening inventory is the value of the goods that a company has on hand at the beginning of a period of time. The closing inventory is the value of the goods that a company has on hand at the end of a period of time.

The purchases are the value of the goods that a company has bought during a period of time.

The equation $D - C - A = B$ is not correct because it does not take into account the opening inventory. The cost of goods sold should be equal to the beginning inventory plus the purchases minus the ending inventory.

The other equations are correct because they take into account the opening inventory. The equation $A + B - D = C$ is the basic equation for calculating the cost of goods sold. The equation $B + A - C = D$ is the equation for calculating the ending inventory. The equation $C + D - A = B$ is the equation for calculating the purchases.