CyberStore Ecommerce 2023 Documentation
SORQOV

See the example of SORQOV code below:

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="CustRequestDate" />
  <xsl:param name="OrderDate" />
  <xsl:param name="RequestedShipDate" />
  <xsl:param name="InvoiceDateEntered" />
  <xsl:param name="Discount1" />
  <xsl:param name="Discount2" />
  <xsl:param name="Discount3" />
  <xsl:param name="MiscTax" />
  <xsl:param name="TaxShipping" />
  <xsl:param name="FSTTaxShipping" />
  <xsl:param name="ShippingCost" />

  <!--
Main Loop
-->
  <xsl:template match="/" >
    <Query xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="SORQOV.XSD">
      <Option>
        <OrderHeader>
          <Customer>
            <xsl:value-of select="/SalesOrder/OrderHeader/CustomerNumber" />
          </Customer>
          <OrderDiscountBreaks>Y</OrderDiscountBreaks>
          <Area>
            <xsl:value-of select="/SalesOrder/OrderHeader/TaxArea" />
          </Area>
          <State>
            <xsl:value-of select="/SalesOrder/OrderHeader/TaxState" />
          </State>
          <CountyZip>
            <xsl:value-of select="/SalesOrder/OrderHeader/TaxCountyZip" />
          </CountyZip>
          <ExtendedTaxCode>
            <xsl:value-of select="/SalesOrder/OrderHeader/TaxCity" />
          </ExtendedTaxCode>
          <DiscPct1>
            <xsl:value-of select="$Discount1" />
          </DiscPct1>
          <DiscPct2>
            <xsl:value-of select="$Discount2" />
          </DiscPct2>
          <DiscPct3>
            <xsl:value-of select="$Discount3" />
          </DiscPct3>
        </OrderHeader>
        <!-- get Line Items -->
        <xsl:call-template name="detail" >
          <xsl:with-param name="i" select="0" />
        </xsl:call-template>
        <!-- get Shipping, Provide it the current line item-->
        <xsl:if test="$ShippingCost &gt; 0" >
          <xsl:call-template name="Freight" >
            <xsl:with-param name="LnNum" select="count(//OrderDetails)" />
          </xsl:call-template>
        </xsl:if>
        <xsl:variable name="gifcertificateValue" select="/SalesOrder/OrderHeader/GiftCertificateValue" />
        <xsl:if test="$gifcertificateValue &lt; 0" >
          <xsl:call-template name="MisItems" >
            <xsl:with-param name="LnNum" select="count(//OrderDetails)+1" />
            <xsl:with-param name="Misvalue" select="$gifcertificateValue" />
          </xsl:call-template>
        </xsl:if>
      </Option>
    </Query>
  </xsl:template>


  <!--
OrderDetails Loop Builds Order Detail, tracking its Line #
-->
  <xsl:template match="//OrderDetails" name="detail">
    <xsl:for-each select="//OrderDetails">
      <xsl:variable name ="UnitPrice" select="UnitPrice"  />
      <xsl:variable name ="LinePrice" select="LinePrice"  />
            <xsl:variable name ="ItemType" select="ItemType" />
            <xsl:if test="$ItemType='A' or $ItemType='B' or $ItemType='C'  or $ItemType='P' or $ItemType='F'">
                <MerchandiseLine>
                    <!-- Force that no Conversions are done on MPrice value -->
                    <MConvFactOrdUm>1</MConvFactOrdUm>
                    <LineType>1</LineType>
                    <!-- In Stock Items-->
                    <MStockCode>
                        <xsl:value-of select="StockCode" />
                    </MStockCode>
                    <MOrderQty>
                        <xsl:value-of select="Quantity" />
                    </MOrderQty>
                    <MOrderUom>
                        <xsl:value-of select="Unit" />
                    </MOrderUom>
                    <MPrice>
                        <xsl:value-of select="format-number($LinePrice,'#.#####')" />
                    </MPrice>
                    <MPriceUom>
                        <xsl:value-of select="Unit" />
                    </MPriceUom>

                    <xsl:variable name="StockCode" select="StockCode"></xsl:variable>

                    <MDiscPct1>
                        <xsl:value-of select="//SalesOrder/Discounts[@StockCode=$StockCode]/DiscountPct1" />
                    </MDiscPct1>
                    <MDiscPct2>
                        <xsl:value-of select="//SalesOrder/Discounts[@StockCode=$StockCode]/DiscountPct2" />
                    </MDiscPct2>
                    <MDiscPct3>
                        <xsl:value-of select="//SalesOrder/Discounts[@StockCode=$StockCode]/DiscountPct3" />
                    </MDiscPct3>
                    <MDiscValFlag />
                    <xsl:variable name="GSTTax" select="//SalesOrder/Discounts[@StockCode=$StockCode]/GSTTaxCode" />
                    <xsl:if test="$GSTTax!=''">
                        <MFstTaxCode>
                            <xsl:value-of select="//SalesOrder/Discounts[@StockCode=$StockCode]/GSTTaxCode" />
                        </MFstTaxCode>
                    </xsl:if>
                </MerchandiseLine>
            </xsl:if>
            <xsl:if test="$ItemType='M'">
                <MiscellaneousLine>
                    <NMscChargeValue>
                        <xsl:value-of select="format-number($LinePrice,'#.##')" />
                    </NMscChargeValue>
                    <NMscTaxCode></NMscTaxCode>
                    <NMscFstCode></NMscFstCode>
                    <NMscProductCls>_OTH</NMscProductCls>
                    <NMscChargeCost />
                    <NSrvIncTotal>Y</NSrvIncTotal>
                </MiscellaneousLine>
            </xsl:if>
    </xsl:for-each>
  </xsl:template>

  <!--
    FreightLine for shipping called after line items after
    -->
  <xsl:template  name="Freight">
    <xsl:if test="$ShippingCost!=''">
      <FreightLine>
        <NMscChargeValue>
          <xsl:value-of select="format-number($ShippingCost,'0.00###')" />
        </NMscChargeValue>
          <xsl:if test="$TaxShipping != 'Y'">
            <NMscTaxCode></NMscTaxCode>
          </xsl:if>
          <xsl:if test="$FSTTaxShipping != 'Y'">
            <NMscFstCode></NMscFstCode>
          </xsl:if>
        <NMscProductCls>_FRT</NMscProductCls>
        <NMscChargeCost>
          <xsl:value-of select="format-number($ShippingCost,'0.00###')" />
        </NMscChargeCost>
        <NSrvIncTotal>
          <xsl:value-of select="$TaxShipping" />
        </NSrvIncTotal>
      </FreightLine>
    </xsl:if>
  </xsl:template>
  <!--
Mis for shipping called after Line items and Freight duplicate calls for diffrent charges. 
LnNum 
-->
  <xsl:template  name="MisItems">
    <xsl:param name="LnNum" />
    <xsl:param name="Misvalue" />
    <xsl:param name="MisDesc" />
    <MiscellaneousLine>
      <NMscChargeValue>
        <xsl:value-of select="format-number($Misvalue,'#.#####')" />
      </NMscChargeValue>
      <NMscTaxCode></NMscTaxCode>
      <NMscFstCode></NMscFstCode>
      <NMscProductCls>_OTH</NMscProductCls>
      <NMscChargeCost>
        <xsl:value-of select="format-number($Misvalue,'#.#####')" />
      </NMscChargeCost>
      <NSrvIncTotal>
        <xsl:value-of select="$MiscTax" />
      </NSrvIncTotal>
    </MiscellaneousLine>
  </xsl:template>
</xsl:stylesheet>