Since crude oil purchasing accounts for the largest part of the total costs in the petroleum industry, improving the efficiency of the process is of great significance in economy. In this paper, a novel mixed integer linear programming model is formulated for a large typical oil refinery to determine the purchasing, inventory and transportation quantities over a multi-period horizon while taking into account all the practical features of crude oil purchasing. The objective of the model is to minimize the total costs attributed to crude oil purchasing, i.e. the sum of ordering, purchasing, inventory and transportation costs. The constraints related to bill of materials, different capacities and different transportation modes are considered. A numerical example indicates the extensive application of the presented model.