Following is information that I cut & pasted years ago from a developer post (might have been James, but I am uncertain as I didn't record who or when). Some details might have changed since then and perhaps some were just left out, but it will give you the gist of things. It talks a bit about the different passes that the code goes through, but you don't really need to remember that at all.
This talked about bases getting supply from other bases, but units get supply from bases in almost the same way. A couple of differences that I am aware of: 1) if a unit is in a base it can only get supply
from that base and no other base, and 2) unlike when sending supply to other bases, a base will give up all of its supply to units that need it (you will see below how a base must have 'enough' supply before it will send some supply to another base, but when sending supply to units a base will go right down to 0 if units need the supply).
The most important things to remember are the number of times per week a unit or base can get supply from a nearby base. Short range = 4/week, Medium range = 2 per week, and Long range = 1/week, and those are cumulative. That means that when in Short range you get Short (4) + Medium (2) + Long (1) = 7 days per week. At Medium range you get Medium (2) + Long (1) = 3 days per week. At Long range you get Long (1) = 1 day per week.
Remember that some bases have daily supply caps, which is the most supply they can receive
from other bases each day. Some daily supply caps are only applied during Monsoon Season (May 15th to October 15th).
Each receiving base that is in range of a base that has excess supplies and needs supplies will get them.
1st. every base that needs 1x requirement gets 1x. So this is one big loop through all bases so as to get maximum coverage and that every base gets at least 1x previously this was 3x only. Sending base will not send any supplies that would dip into its own 3x requirement and if add supply is being used then sending base guards up to 4x.
2nd every base that can get 3x or some portion there of will get it. So this is another big loop to see if we can get bases up to at least 3x requirement. Sending base will not send any supplies that would dip into its own 3x requirement.
3rd. every base that is eligible for excess normally this is big major bases or bases with the highest spoilage limit previously there was no check before sending supplies to small bases. Sending base will not send any supplies that would dip into its own 3x requirement.
4th. One final big loop through all bases to resupply LCUs and whatever base the LCU is at is the only base it can draw supplies from previously there was no restriction. If LCU is in non-base hex or enemy then no restriction. Sending base will guard up to 20 supply points meaning if a unit can be supplied and base has it then unit gets it, previously base had to have above 3x.
In each big loop except for the 4th the amount that can be sent is modified by Prim HQ of base (just like witp) and if present adds an extra 25k to requirement and we check for max draw and we check spoilage limit at base receiving base.
How far a base can receive supplies is determined by tracing a supply cost path starting value used is 100 just like witp. There are three different ranges used throughout each week 89 which is very short range and happens 4 times a week, 49 which is medium range and happens twice a week and 10 which is long range which happens once per week. These values are the minimum required trace value from sending base to receiving base and the trace value must be equal to or greater than this to receive supplies so you may notice that some bases only get supplies 3 times or in some cases once per week.
Using the add supply button means first the base will try and get 1x requirement then during the 3x loop it will try and get 3x whatever is in that field so a base has 1000 normal requirement and I press the add supply to 1000 making new requirement of 2000 thus 1x + 3x = 2000 + 6,000 = 8,000 that the base will try and get.
Short range is trace value of 89 - 100 and is used 4 times per week.
Medium range is trace value 49 - 100 and is used 2 times per week.
Long range is trace value 10 - 100 and is used 1 time per week.