Print category wise sales report in Close Cash

This template can be used to print category wise sales report.

Maintenance > Resources
Use this template in Printer.CloseCash or Printer.PartialCash or Printer.CloseCashMail

<!-- CATEGORY SALE REPORT START -->
        <line>
            <text bold="true">Category Sales Report</text>
        </line>
        <line>
            <text align ="left" length="23">Name</text>
            <text align ="left" length="10">Units</text>
            <text align ="right" length="15">Total</text>
        </line>
        <line>
            <text>------------------------------------------------</text>
        </line>

#set($cat = "@")
#set($catTotal = 0)
#set($catUnits = 0)
#set($catNetTotal = 0)
#set($catNetUnits = 0)
#set($flag = 0)

#foreach ($line in $payments.getProductSalesLines())

#if($cat.equals("@"))
#set($cat=$line.printCategoryName())
#end

#if (!$cat.equals($line.printCategoryName()))
        <line>
            <text align ="left" length="23">${cat}</text>
            <text align ="left" length="10">${catUnits}</text>
            <text align ="right" length="15">${catTotal}</text>
        </line>

 #set($cat=$line.printCategoryName())
 #set($catTotal = $line.getProductPrice())
 #set($catUnits = $line.getProductUnits())

#else
 $flag=1
        #set($catTotal = $catTotal + $line.getProductPrice())
        #set($catUnits = $catUnits + $line.getProductUnits())
#end
 #set($catNetTotal = $catNetTotal + $line.getProductPrice())
 #set($catNetUnits = $catNetUnits + $line.getProductUnits())
#end
 <line>
            <text align ="left" length="23">${cat}</text>
            <text align ="left" length="10">${catUnits}</text>
            <text align ="right" length="15">${catTotal}</text>
        </line>

        <line>
            <text>------------------------------------------------</text>
        </line>
        <line size="1">
            <text align ="left" length="23" bold="true">Total</text>
            <text align ="left" length="10" bold="true">${catNetUnits}</text>
            <text align ="right" length="15" bold="true">${catNetTotal}</text>
        </line>
<!-- CATEGORY SALE REPORT END -->

Save & restart

0 Comments

Leave a Reply

Arrow-up