generate bill function