<Rules>
	<Variables>
		<Variable id="CustomerTypeDiscount">0</Variable>
		<Variable id="CustomerTypeDiscountAmount">0</Variable>
		<Variable id="GoldPrice">75</Variable>
		<Variable id="GoldQty">0</Variable>
		<Variable id="GoldQtyDiscount">0</Variable>
		<Variable id="GoldTotalPrice">0</Variable>
		<Variable id="GoldTotalWeight">0</Variable>
		<Variable id="GoldWeight">75</Variable>
		<Variable id="InvoiceTotal">0</Variable>
		<Variable id="PriceSubTotal">0</Variable>
		<Variable id="SalesTaxRate">.07</Variable>
		<Variable id="SalesTaxTotal">0</Variable>
		<Variable id="ShipperName">None</Variable>
		<Variable id="ShippingRate">0.02</Variable>
		<Variable id="ShippingTotal">0</Variable>
		<Variable id="SilverPrice">50</Variable>
		<Variable id="SilverQty">0</Variable>
		<Variable id="SilverQtyDiscount">0</Variable>
		<Variable id="SilverTotalPrice">0</Variable>
		<Variable id="SilverTotalWeight">0</Variable>
		<Variable id="SilverWeight">50</Variable>
		<Variable id="StarPrice">100</Variable>
		<Variable id="StarQty">0</Variable>
		<Variable id="StarQtyDiscount">0</Variable>
		<Variable id="StarTotalPrice">0</Variable>
		<Variable id="StarTotalWeight">0</Variable>
		<Variable id="StarWeight">100</Variable>
		<Variable id="WeightTotal">0</Variable>
	</Variables>
	<Rule id="CalculateInvoice" useInferencing="False">
		<Expression>
    </Expression>
		<Actions>
			<Action actionId="Calculations.CalculateWeights" type="run">
				<Match>
        </Match>
				<Assign>
        </Assign>
			</Action>
			<Action actionId="Discounts" type="run">
				<Match>
        </Match>
				<Assign>
        </Assign>
			</Action>
			<Action actionId="SetShipper" type="run">
				<Match>
        </Match>
				<Assign>
        </Assign>
			</Action>
			<Action actionId="Calculations.CalculateTotalPricing" type="run">
				<Match>
        </Match>
				<Assign>
        </Assign>
			</Action>
		</Actions>
		<SubRules/>
	</Rule>
	<Rule id="Calculations" useInferencing="False">
		<Expression>
    </Expression>
		<Actions/>
		<SubRules>
			<Rule id="CalculateWeights">
				<Expression/>
				<Actions>
					<Action type="var" actionId="StarTotalWeight">
						<Match/>
						<Assign>StarQty * StarWeight</Assign>
					</Action>
					<Action type="var" actionId="GoldTotalWeight">
						<Match/>
						<Assign>GoldQty * GoldWeight</Assign>
					</Action>
					<Action type="var" actionId="SilverTotalWeight">
						<Match/>
						<Assign>SilverQty * SilverWeight</Assign>
					</Action>
					<Action type="var" actionId="WeightTotal">
						<Match/>
						<Assign>StarTotalWeight + GoldTotalWeight + SilverTotalWeight</Assign>
					</Action>
				</Actions>
				<SubRules/>
			</Rule>
			<Rule id="CalculateTotalPricing" useInferencing="False">
				<Expression>
        </Expression>
				<Actions>
					<Action actionId="StarTotalPrice" type="var">
						<Match>
            </Match>
						<Assign>(StarQty * StarPrice) - ((StarQty * StarPrice) * StarQtyDiscount)</Assign>
					</Action>
					<Action actionId="GoldTotalPrice" type="var">
						<Match>
            </Match>
						<Assign>(GoldQty * GoldPrice) - ((GoldQty * GoldPrice) * GoldQtyDiscount)</Assign>
					</Action>
					<Action actionId="SilverTotalPrice" type="var">
						<Match>
            </Match>
						<Assign>(SilverQty * SilverPrice) - ((SilverQty * SilverPrice) * SilverQtyDiscount)</Assign>
					</Action>
					<Action actionId="PriceSubTotal" type="var">
						<Match>
            </Match>
						<Assign>StarTotalPrice + GoldTotalPrice + SilverTotalPrice</Assign>
					</Action>
					<Action actionId="SalesTaxTotal" type="makeVar">
						<Match>
            </Match>
						<Assign>SalesTaxRate * PriceSubTotal </Assign>
					</Action>
					<Action actionId="ShippingTotal" type="var">
						<Match>
            </Match>
						<Assign>ShippingRate * WeightTotal</Assign>
					</Action>
					<Action actionId="CustomerTypeDiscountAmount" type="var">
						<Match>
            </Match>
						<Assign>PriceSubTotal * CustomerTypeDiscount</Assign>
					</Action>
					<Action actionId="InvoiceTotal" type="var">
						<Match>
            </Match>
						<Assign>(PriceSubTotal - CustomerTypeDiscountAmount)+ SalesTaxTotal + ShippingTotal</Assign>
					</Action>
				</Actions>
				<SubRules/>
			</Rule>
		</SubRules>
	</Rule>
	<Rule id="Discounts" useInferencing="False">
		<Expression>True</Expression>
		<Actions>
			<Action actionId="StarQtyDiscount" type="var">
				<Match>StarQty &lt;= 10</Match>
				<Assign>0</Assign>
			</Action>
			<Action actionId="StarQtyDiscount" type="var">
				<Match>StarQty &gt; 10 and StarQty &lt;= 25</Match>
				<Assign>.1</Assign>
			</Action>
			<Action actionId="StarQtyDiscount" type="var">
				<Match>StarQty &gt; 25 and StarQty &lt;= 50</Match>
				<Assign>.2</Assign>
			</Action>
			<Action actionId="StarQtyDiscount" type="var">
				<Match>StarQty &gt; 50</Match>
				<Assign>.3</Assign>
			</Action>
			<Action actionId="GoldQtyDiscount" type="var">
				<Match>GoldQty &lt;= 10</Match>
				<Assign>0</Assign>
			</Action>
			<Action actionId="GoldQtyDiscount" type="var">
				<Match>GoldQty &gt; 10 and GoldQty &lt;= 25</Match>
				<Assign>.2</Assign>
			</Action>
			<Action actionId="GoldQtyDiscount" type="var">
				<Match>GoldQty &gt; 25 and StarQty &lt;= 50</Match>
				<Assign>.3</Assign>
			</Action>
			<Action actionId="GoldQtyDiscount" type="var">
				<Match>GoldQty &gt; 50</Match>
				<Assign>.4</Assign>
			</Action>
			<Action actionId="SilverQtyDiscount" type="var">
				<Match>SilverQty &lt;= 10</Match>
				<Assign>0</Assign>
			</Action>
			<Action actionId="SilverQtyDiscount" type="var">
				<Match>SilverQty &gt; 10 and SilverQty &lt;= 10</Match>
				<Assign>.1</Assign>
			</Action>
			<Action actionId="SilverQtyDiscount" type="var">
				<Match>SilverQty &gt; 25 and StarQty &lt;= 50</Match>
				<Assign>.2</Assign>
			</Action>
			<Action actionId="SilverQtyDiscount" type="var">
				<Match>SilverQty &gt; 50</Match>
				<Assign>.3</Assign>
			</Action>
		</Actions>
		<SubRules>
			<Rule id="DetermineCustomerTypeDiscount" useInferencing="False">
				<Expression>True</Expression>
				<Actions>
					<Action actionId="Discounts.SetStandardDiscount" type="run">
						<Match>CustomerType isa Standard</Match>
						<Assign>
            </Assign>
					</Action>
					<Action actionId="Discounts.SetPartnerDiscount" type="run">
						<Match>CustomerType isa Partner</Match>
						<Assign>
            </Assign>
					</Action>
					<Action actionId="Discounts.SetPremierDiscount" type="run">
						<Match>CustomerType isa Premier</Match>
						<Assign>
            </Assign>
					</Action>
				</Actions>
				<SubRules/>
			</Rule>
			<Rule id="SetPartnerDiscount" useInferencing="False">
				<Expression>True</Expression>
				<Actions>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &lt; -200</Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &gt;= -200 and CustomerBalance &lt; 0</Match>
						<Assign>.02</Assign>
					</Action>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &gt;= 0 and CustomerBalance &lt; 200</Match>
						<Assign>.03</Assign>
					</Action>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &gt;= 200 and CustomerBalance &lt; 500</Match>
						<Assign>.04</Assign>
					</Action>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &gt;= 500</Match>
						<Assign>.05</Assign>
					</Action>
				</Actions>
				<SubRules/>
			</Rule>
			<Rule id="SetPremierDiscount" useInferencing="False">
				<Expression>True</Expression>
				<Actions>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &lt; -200</Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &gt;= -200 and CustomerBalance &lt; 0</Match>
						<Assign>.03</Assign>
					</Action>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &gt;= 0 and CustomerBalance &lt; 200</Match>
						<Assign>.04</Assign>
					</Action>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &gt;= 200 and CustomerBalance &lt; 500</Match>
						<Assign>.05</Assign>
					</Action>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &gt;= 500</Match>
						<Assign>.06</Assign>
					</Action>
				</Actions>
				<SubRules/>
			</Rule>
			<Rule id="SetStandardDiscount" useInferencing="False">
				<Expression>True</Expression>
				<Actions>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &lt; -200</Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &gt;= -200 and CustomerBalance &lt; 0</Match>
						<Assign>.01</Assign>
					</Action>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &gt;= 0 and CustomerBalance &lt; 200</Match>
						<Assign>.02</Assign>
					</Action>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &gt;= 200 and CustomerBalance &lt; 500</Match>
						<Assign>.03</Assign>
					</Action>
					<Action actionId="CustomerTypeDiscount" type="var">
						<Match>CustomerBalance &gt;= 500</Match>
						<Assign>.04</Assign>
					</Action>
				</Actions>
				<SubRules/>
			</Rule>
		</SubRules>
	</Rule>
	<Rule id="SetShipper" useInferencing="False">
		<Expression>True</Expression>
		<Actions>
			<Action actionId="ShipperName" type="var">
				<Match>WeightTotal &lt;= 2000</Match>
				<Assign>Puddle Jumpers</Assign>
			</Action>
			<Action actionId="ShippingRate" type="var">
				<Match>WeightTotal &lt;= 1000</Match>
				<Assign>.25</Assign>
			</Action>
			<Action actionId="ShippingRate" type="var">
				<Match>WeightTotal &lt;= 2000</Match>
				<Assign>.30</Assign>
			</Action>
			<Action actionId="ShipperName" type="var">
				<Match>WeightTotal &gt; 2000 and WeightTotal &lt;= 6000</Match>
				<Assign>Regional Services</Assign>
			</Action>
			<Action actionId="ShippingRate" type="var">
				<Match>WeightTotal &gt; 2000 and WeightTotal &lt;= 3000</Match>
				<Assign>.35</Assign>
			</Action>
			<Action actionId="ShippingRate" type="var">
				<Match>WeightTotal &gt; 3000 and WeightTotal &lt;= 6000</Match>
				<Assign>.40</Assign>
			</Action>
			<Action actionId="ShipperName" type="var">
				<Match>WeightTotal &gt; 6000</Match>
				<Assign>EarthShakers Delivery</Assign>
			</Action>
			<Action actionId="ShippingRate" type="var">
				<Match>WeightTotal &gt; 6000 and WeightTotal &lt;= 10000</Match>
				<Assign>.45</Assign>
			</Action>
			<Action actionId="ShippingRate" type="var">
				<Match>WeightTotal &gt; 10000</Match>
				<Assign>.50</Assign>
			</Action>
		</Actions>
		<SubRules/>
	</Rule>
	<Rule id="SetupRules" useInferencing="False">
		<Expression>
    </Expression>
		<Actions>
			<Action actionId="CustomerTypeDiscount" type="makeVar">
				<Match>
        </Match>
				<Assign>0</Assign>
			</Action>
			<Action actionId="CustomerTypeDiscountAmount" type="makeVar">
				<Match>
        </Match>
				<Assign>0</Assign>
			</Action>
		</Actions>
		<SubRules>
			<Rule id="SetupGoldValues" useInferencing="False">
				<Expression>
        </Expression>
				<Actions>
					<Action actionId="GoldQty" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="GoldWeight" type="makeVar">
						<Match>
            </Match>
						<Assign>75</Assign>
					</Action>
					<Action actionId="GoldPrice" type="makeVar">
						<Match>
            </Match>
						<Assign>75</Assign>
					</Action>
					<Action actionId="GoldQtyDiscount" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="GoldTotalPrice" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="GoldTotalWeight" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="GoldTotalPrice" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
				</Actions>
				<SubRules/>
			</Rule>
			<Rule id="SetupSilverValues" useInferencing="False">
				<Expression>
        </Expression>
				<Actions>
					<Action actionId="SilverQty" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="SilverWeight" type="makeVar">
						<Match>
            </Match>
						<Assign>50</Assign>
					</Action>
					<Action actionId="SilverPrice" type="makeVar">
						<Match>
            </Match>
						<Assign>50</Assign>
					</Action>
					<Action actionId="SilverQtyDiscount" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="SilverTotalPrice" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="SilverTotalWeight" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="SilverTotalPrice" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
				</Actions>
				<SubRules/>
			</Rule>
			<Rule id="SetupStarValues" useInferencing="False">
				<Expression>
        </Expression>
				<Actions>
					<Action actionId="StarQty" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="StarWeight" type="makeVar">
						<Match>
            </Match>
						<Assign>100</Assign>
					</Action>
					<Action actionId="StarPrice" type="makeVar">
						<Match>
            </Match>
						<Assign>100</Assign>
					</Action>
					<Action actionId="StarQtyDiscount" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="StarTotalPrice" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="StarTotalWeight" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="StarTotalPrice" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
				</Actions>
				<SubRules/>
			</Rule>
			<Rule id="SetupTotalValues" useInferencing="False">
				<Expression>
        </Expression>
				<Actions>
					<Action actionId="PriceSubTotal" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="ShippingTotal" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="SalesTaxTotal" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="InvoiceTotal" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="WeightTotal" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="SalesTaxRate" type="makeVar">
						<Match>
            </Match>
						<Assign>0</Assign>
					</Action>
					<Action actionId="ShippingRate" type="makeVar">
						<Match>
            </Match>
						<Assign>.02</Assign>
					</Action>
					<Action actionId="ShipperName" type="makeVar">
						<Match>
            </Match>
						<Assign>None</Assign>
					</Action>
				</Actions>
				<SubRules/>
			</Rule>
		</SubRules>
	</Rule>
	<Rule id="SubRuleCheck" useInferencing="False">
		<Expression>
    </Expression>
		<Actions>
			<Action actionId="TriggerTest.SubTest" type="run">
				<Match>
        </Match>
				<Assign>
        </Assign>
			</Action>
		</Actions>
		<SubRules/>
	</Rule>
	<Rule id="TriggerTest" useInferencing="False">
		<Expression>True</Expression>
		<Actions>
			<Action actionId="TriggerCheck" type="makeVar">
				<Match>InvoiceTotal &gt; 5000</Match>
				<Assign>Hurray! Trigger Worked</Assign>
			</Action>
		</Actions>
		<SubRules>
			<Rule id="SubTest" useInferencing="False">
				<Expression>
        </Expression>
				<Actions>
					<Action actionId="SubTest" type="makeVar">
						<Match>
            </Match>
						<Assign>Hurray! SubTest Worked</Assign>
					</Action>
				</Actions>
				<SubRules/>
			</Rule>
		</SubRules>
	</Rule>
	<Triggers>
		<Trigger id="TriggerOne" varID="GoldQty" ruleID="CalculateInvoice"/>
		<Trigger id="TriggerTwo" varID="SilverQty" ruleID="CalculateInvoice"/>
		<Trigger id="Triggerthree" varID="StarQty" ruleID="CalculateInvoice"/>
		<Trigger id="Triggerfour" varID="CustomerType" ruleID="CalculateInvoice"/>
	</Triggers>
</Rules>

