The sales order form can have linked cash sale and invoice preferred forms but when I looked at this awhile ago it appeared to me the paymentmethod/terms fields and possibly the presence of a customer deposit were what determined if the billing transaction type should be an invoice or cash sale. If you're scripting the billing process and you get it wrong say transform from sales order to an invoice when it should be a cash sale I've seen the system throw an invalid transformation type.