GHJ Sales Report -- Royalty Fees (?)
<mvt:item name="inline_css" />
<mvt:assign name="g.retailOrders" value="0" />
<mvt:assign name="g.wholesaleOrders" value="0" />
<mvt:assign name="g.retailDiscounts" value="0" />
<mvt:assign name="g.wholesaleDiscounts" value="0" />
<mvt:assign name="g.retailShipping" value="0" />
<mvt:assign name="g.wholesaleShipping" value="0" />
<mvt:assign name="g.retailTax" value="0" />
<mvt:assign name="g.wholesaleTax" value="0" />
<mvt:assign name="g.retailTotal" value="0" />
<mvt:assign name="g.wholesaleTotal" value="0" />
<mvt:assign name="ordercounter" value="0" />
<mvt:foreach iterator="order" array="admin_order:orders">
<mvt:comment>
| Exclude GHJDropship
</mvt:comment>
<mvt:if expr="l.settings:order:cust_id NE '1135'">
<mvt:assign name="ordercounter" value="g.ordercounter + 1" />
<mvt:if expr="g.ordercounter EQ 1">
<mvt:assign name="endingDate" value="l.settings:order:date" />
<mvt:else>
<mvt:assign name="startingDate" value="l.settings:order:date" />
</mvt:if>
</mvt:if>
</mvt:foreach>
<strong>Guy Harvey Royalty for guyharveyjewelry.com</strong><br />
For &mvt:global:startingDate; - &mvt:global:endingDate;<br/><br />
<table cellspacing="0" cellpadding="0">
<tr>
<th>Item ID</th>
<th>Item Name</th>
<th>In Stock</th>
<th>Total Sold</th>
<th width="70">Unit Price</th>
<th width="70">Total Amount</th>
<th>Group</th>
</tr>
<mvt:foreach iterator="order" array="admin_order:orders">
<mvt:comment>
| Exclude GHJDropship
</mvt:comment>
<mvt:if expr="l.settings:order:cust_id NE '1135'">
<mvt:assign name="cleanDiscount" value="0" />
<mvt:comment>
| Check if Customer is in Wholesale group
</mvt:comment>
<mvt:do name="l.settings:checkcust" file="g.Module_Feature_PGR_DB" value="PriceGroupAndModuleList_Load_Customer(l.settings:order:cust_id, l.settings:order:customerpgs)" />
<mvt:foreach iterator="pg" array="order:customerpgs">
<mvt:if expr="'Wholesale' CIN l.settings:pg:name OR 'Washington Jewelers' CIN l.settings:pg:name ">
<mvt:assign name="wholesale" value="1" />
</mvt:if>
</mvt:foreach>
<mvt:if expr="g.wholesale EQ 1">
<mvt:assign name="l.settings:order:grouptype" value="'Wholesale'" />
<mvt:assign name="g.wholesaleOrders" value="g.wholesaleOrders + 1" />
<mvt:foreach iterator="charge" array="order:charges">
<mvt:if expr="l.settings:charge:type EQ 'SHIPPING'">
<mvt:assign name="wholesaleShipping" value="g.wholesaleShipping + l.settings:charge:amount" />
</mvt:if>
<mvt:if expr="l.settings:charge:type EQ 'TAX'">
<mvt:assign name="wholesaleTax" value="g.wholesaleTax + l.settings:charge:amount" />
</mvt:if>
</mvt:foreach>
<mvt:assign name="wholesaleTotal" value="g.wholesaleTotal + l.settings:order:total" />
<mvt:else>
<mvt:assign name="l.settings:order:grouptype" value="'Retail'" />
<mvt:assign name="g.retailOrders" value="g.retailOrders + 1" />
<mvt:foreach iterator="charge" array="order:charges">
<mvt:if expr="l.settings:charge:type EQ 'SHIPPING'">
<mvt:assign name="retailShipping" value="g.retailShipping + l.settings:charge:amount" />
</mvt:if>
<mvt:if expr="l.settings:charge:type EQ 'TAX'">
<mvt:assign name="retailTax" value="g.retailTax + l.settings:charge:amount" />
</mvt:if>
</mvt:foreach>
<mvt:assign name="retailTotal" value="g.retailTotal + l.settings:order:total" />
</mvt:if>
<mvt:foreach iterator="item" array="order:groups">
<mvt:comment>
| Check if Item was returned
</mvt:comment>
<tr>
<td>
<mvt:if expr="l.settings:item:product:sku">
&mvt:item:product:sku;
<mvt:else>
&mvt:item:code;
</mvt:if>
</td>
<td>&mvt:item:name;
<mvt:foreach iterator="option" array="item:options">
<mvt:if expr="l.settings:option:option_id">
<br /><strong>&mvt:option:attr_prompt;: &mvt:option:opt_prompt;</strong>
</mvt:if>
</mvt:foreach>
</td>
<td> </td>
<td align="center">&mvt:item:quantity;</td>
<mvt:if expr="'Returned' CIN l.settings:item:formatted_status">
<td align="right" width="70">-&mvt:item:formatted_price;</td>
<td align="right" width="70">-&mvt:item:formatted_subtotal;</td>
<mvt:else>
<td align="right" width="70">&mvt:item:formatted_price;</td>
<td align="right" width="70">&mvt:item:formatted_subtotal;</td>
</mvt:if>
<td>&mvt:order:grouptype;</td>
</tr>
<mvt:if expr="g.wholesale">
<mvt:foreach iterator="discount" array="item:discounts">
<mvt:assign name="cleanDiscount" value="glosub( '(', l.settings:discount:discount, '' )" />
<mvt:assign name="cleanDiscount" value="glosub( ')', l.settings:discount:discount, '' )" />
<mvt:assign name="g.wholesaleDiscounts" value="g.wholesaleDiscounts + g.cleanDiscount" />
</mvt:foreach>
<mvt:if expr="'Returned' CIN l.settings:item:formatted_status">
<mvt:assign name="g.wholesaleTotal" value="g.wholesaleTotal - l.settings:item:subtotal" />
</mvt:if>
<mvt:else>
<mvt:foreach iterator="discount" array="item:discounts">
<mvt:assign name="cleanDiscount" value="glosub( '(', l.settings:discount:discount, '' )" />
<mvt:assign name="cleanDiscount" value="glosub( ')', l.settings:discount:discount, '' )" />
<mvt:assign name="g.retailDiscounts" value="g.retailDiscounts + g.cleanDiscount" />
</mvt:foreach>
<mvt:if expr="'Returned' CIN l.settings:item:formatted_status">
<mvt:assign name="g.retailTotal" value="g.retailTotal - l.settings:item:subtotal" />
</mvt:if>
</mvt:if>
</mvt:foreach>
</mvt:if>
</mvt:foreach>
</table>
<div style="height: 20px;"></div>
<mvt:item name="toolkit" param="currencyformat|fretailDiscounts|retailDiscounts" />
<mvt:item name="toolkit" param="currencyformat|fretailShipping|retailShipping" />
<mvt:item name="toolkit" param="currencyformat|fretailTax|retailTax" />
<mvt:item name="toolkit" param="currencyformat|fretailTotal|retailTotal" />
<mvt:item name="toolkit" param="currencyformat|fwholesaleDiscounts|wholesaleDiscounts" />
<mvt:item name="toolkit" param="currencyformat|fwholesaleShipping|wholesaleShipping" />
<mvt:item name="toolkit" param="currencyformat|fwholesaleTax|wholesaleTax" />
<mvt:item name="toolkit" param="currencyformat|fwholesaleTotal|wholesaleTotal" />
<table cellspacing="0" cellpadding="0">
<tr>
<th>Group</th>
<th># of Orders</th>
<th align="right">Discount</th>
<th align="right">Shipping</th>
<th align="right">Tax Amount</th>
<th align="right">Total</th>
</tr>
<mvt:if expr="g.retailOrders GT 0">
<tr>
<td><strong>Retail</strong></td>
<td align="center">&mvt:global:retailOrders;</td>
<td align="right">&mvt:global:fretailDiscounts;</td>
<td align="right">&mvt:global:fretailShipping;</td>
<td align="right">&mvt:global:fretailTax;</td>
<td align="right">&mvt:global:fretailTotal;</td>
</tr>
</mvt:if>
<mvt:if expr="g.wholesaleOrders GT 0">
<tr>
<td><strong>Wholesale</strong></td>
<td align="center">&mvt:global:wholesaleOrders;</td>
<td align="right">&mvt:global:fwholesaleDiscounts;</td>
<td align="right">&mvt:global:fwholesaleShipping;</td>
<td align="right">&mvt:global:fwholesaleTax;</td>
<td align="right">&mvt:global:fwholesaleTotal;</td>
</tr>
</mvt:if>
<mvt:assign name="totalDiscounts" value="g.wholesaleDiscounts + g.retailDiscounts" />
<mvt:item name="toolkit" param="currencyformat|totalDiscounts|totalDiscounts" />
<mvt:assign name="totalShipping" value="g.wholesaleShipping + g.retailShipping" />
<mvt:item name="toolkit" param="currencyformat|totalShipping|totalShipping" />
<mvt:assign name="totalTax" value="g.wholesaleTax + g.retailTax" />
<mvt:item name="toolkit" param="currencyformat|totalTax|totalTax" />
<mvt:assign name="totalTotal" value="g.wholesaleTotal + g.retailTotal" />
<mvt:item name="toolkit" param="currencyformat|totalTotal|totalTotal" />
<tr>
<td><strong>Total</strong></td>
<td align="center"><mvt:eval expr="g.wholesaleOrders + g.retailOrders" /></td>
<td align="right">&mvt:global:totalDiscounts;</td>
<td align="right">&mvt:global:totalShipping;</td>
<td align="right">&mvt:global:totalTax;</td>
<td align="right">&mvt:global:totalTotal;</td>
</tr>
</table>