I am completely new to Solidity and would appreciate any help. I have a supply chain smart contract and it contains a function that is supposed to be called by customers and after the call, the function is supposed to return a uint256 purchase order number to the customer. The code for the function is as follows:
function initiatePurchaseOrder(string memory custName, string memory custLoc, uint volumeClass, uint materialClass) public onlyConsumer(msg.sender) returns (uint _purchaseOrder){
require(bytes(custName).length > 0 && bytes(custLoc).length > 0 && volumeClass > 0 && materialClass > 0, "either customer, or location sent as empty string or vol/material classes sent as 0.");
_purchaseOrder = uint256(keccak256(abi.encodePacked(custName, custLoc, volumeClass, materialClass, now)));
emit InitiatedPurchaseOrder(_purchaseOrder);
// update purchase order mappings
purchaseOrderToConsumerAddressMapping[_purchaseOrder] = msg.sender;
purchaseOrderToTimeStampMapping[_purchaseOrder] = now;
purchaseOrderToStatusMapping[_purchaseOrder] = true;
uint materialClassUnitPrice = materialClassToUnitPriceMapping[materialClass];
if (materialClassUnitPrice == 0 || volumeClass == 0) {
revert("invalid volume and material class meta info passed to smart contract. make sure they are non-zero/non-negative.");
}
// update more maps
purchaseOrderToCustomerDetails[_purchaseOrder]["custName"] = custName;
purchaseOrderToCustomerDetails[_purchaseOrder]["custLoc"] = custLoc;
purchaseOrderToVolMatDetails[_purchaseOrder]["volumeClass"] = volumeClass;
purchaseOrderToVolMatDetails[_purchaseOrder]["materialClass"] = materialClass;
// emit the required event
emit CreateQuoteForCustomer(_purchaseOrder);
// return purchase order number to customer
return _purchaseOrder;
}
I am compiling, deploying and testing the smart contract from Remix. I am deploying it on local Ethereum node (Ganache). I also tried it on Rinkeby. When I am calling the function above, I was expecting that it would return a uint256 purchase order. However, when I expand the transaction in Remix, the decoded output shows nothing as follows:

From this previous post, I have come to the following conclusion and I need your help into deciding whether I am correct or not:
(i) When a function changes the state of the blockchain (like mine does), it is called as a transaction and in those cases web3 does not return values. Ami I right? If thats the case, why does Web3 do that?
(ii)Now that i need to see what the function is returning (the purchase order number generated), how am I supposed to do that? Through emitting events?
Any help would be greatly appreciated. Thank you