In Dynamics NAV MOD and DIV Part One I looked at the Operators MOD and DIV, I will attempt to offer a more Practical Example in this post, if I use a soft drink manufacturer one of the steps of bringing the product “Cronus Cola” to market is the production, the purified water will have a syrup, sugar, additives and be Carbonated as part of the production process before being bottled.
There are two elements of Packaging that I will have to calculate and report on, firstly how much packaging I will need in order to bring my product to market, secondly how much Incoming and Outgoing Packaging is related to my product.
I am having the syrup manufactured off site and I will be receiving the syrup on pallets and in packaging, under Packaging Waste Regulations for each Item unit I dispatch I should report on this packaging waste, I can offset and reuse some of the packaging Materials I receive, however to get the product to market I have to package it.
Primary or Inner
The Primary Packaging often referred to as an ‘Inner’ for each my soft drinks, Glass or Plastic Bottle, Lid ,Label, I could also use a Sealed Plastic Cup or Drinks Carton.
Secondary or Outer
The Secondary Packaging often referred to as an ‘Outer’ combines a number of Primary Units into a manageable unit, like a box of 10, these may also use display packs, Tray, labels, Vacuum Wrap Plastic, Multi-Pack box or case.
The Tertiary Packaging, I might pack ‘Outer Units’ into Boxes, Cases, then onto a Pallet with, Corner Protectors, Tray, Shrink Wrap, labels, Strapping.
Using MOD and DIV
If I produce any number of 1 Litre bottles of a particular soft drink a month I can use MOD and DIV to help me Calculate, Manufacturing Consumables, Warehouse Space, Transportation Costs, Labour, Overheads, Packaging I need to Purchase.
As I am looking at the Packaging for a given number of Units I want to know how many Primary, Secondary and Tertiary units I need. My “Cronus Cola” has three Units of Measure, the Base or Primary is a Bottle, I then pack these into Secondary Units (Case) of six in a tray and shrink wrap these, each Tertiary Unit (Pallet), holds 6 layers of 8 Outer Units, which equals 288 Bottles.
If I produce 150000 Bottles of Cola:
- Primary Packaging I will need 150000 Bottles, Labels.
- Secondary Packaging will be 25000 Six Pack Trays, Barcode Labels and Vacuum Pack Material.
- Tertiary Packaging of 520 Pallets and Pallet Shrink Wrap.
- UOMCode[i] (1-3) is an Array of the field Item Unit of Measure Code.
- Result[i] (1-4) to output the Different Quantities.
- i = 1 to 3 this just divides the total Quantity by the “Qty. per Unit of Measure”.
- Result Uses Mod to Calculate the Surplus Units that will not fit onto the Last Unit of Measure.
- Result := 150000 DIV 1; (Bottles 150000)
- Result := 150000 DIV 6; (Cases 25000)
- Result := 150000 DIV 288; (Pallets 520)
- Result := 150000 MOD 288; (Surplus 240)
You can download the Report I used in my Example Here: