Learn how to use the Browser's dev tools to debug the JavaScript. The following link is for Chrome but all browser's have dev tools.
Your original code is missing quotes around a string assignment which causes a JavaScript error when the page loads. The error is visible in the "Console" view within dev tools.
var scheduleState = "@ViewBag.ScheduleDetailState" //Was missing quotes
Once this bug is fixed the next error is "Uncaught ReferenceError: e is not defined" which Bruce explained above.
I think you want the following logic which reads the select when the page loads.
var alreadyCalled = false;
var receiptName = '';
var scheduleAlreadyCalled = false;
var lastScheduleID = "";
var scheduleState = "@ViewBag.ScheduleDetailState" //Missing quotes
var currentDropdown = "";
$(document).ready(function () {
//get data-id attribute of the clicked element
//var currentDropdown = $(e.relatedTarget).data('id');
currentDropdown = $('#PolicyCode').val();
console.log(currentDropdown);
});
The two bug fixes above should get you to a point where the Modal shows. Hopefully, this will get you past these bugs and you can work on the others.