The only way is to break each ingredient down to cost per unit . . . sauce cost per ounce . . . cheese cost per ounce . . . dough cost per skin . . . pepperoni cost per ounce . . . etc. I use Excel to break it out. Dough is broken down by cost to run a batch (flour, yeast, salt, sugar, oil, etc), then per ounce, then per skin.
Then you build you pizza and on each ingredient line you put number of units used . . . price per unit . . .then multiply the two together. Spreadsheet, again, makes this WAYYYY simple. But, you gotta sit down with invoices and case prices and do lots of math, or setting up the spreadsheets. Once you do it one time, you can just change the case price as it changes, and the whole thing automatically calculates for you.