View Categories

Using Saleculator for subscription based billing

1 min read

This howto explains using Saleculator for subscription based billing

This method makes use of advance payment for tracking active subscriptions.
1. Accept advance payment from customers.
2. Make a sale choosing the right subscription package for the advance paid. Use Advance for payment.
Administrator Menu > Maintenance > Resources
3. Use below section in Printer.Ticket to print subscription expiry date. Change the value 30 to desired value for subscription validity in days.

#if (($ticket.getCustomer() && $ticket.getCustomer().getAdvanceDate())
       #set($y = $ticket.getCustomer().getAdvanceDate().getYear() + 1900)
           #set($m = $ticket.getCustomer().getAdvanceDate().getMonth() + 1)
           #set($d = $ticket.getCustomer().getAdvanceDate().getDate())

           #set($d = $d + 30)
           #if ((($m ==4) || ($m ==6) || ($m ==9) || ($m ==11)) && ($d > 30))
               #set($m = $m + 1)
               #set($d = $d - 30)
           #elseif (($m ==2) && ($d > 28))
               #set($m = $m + 1)
               #set($d = $d - 28)
           #elseif ($d > 31)
               #set($m = $m + 1)
               #set($d = $d - 31)
           #end

           #if($m > 12)
               #set($m = 1)
               #set($y = $y + 1)
           #end
           
        <line>
        <text align ="center" length="48" bold="true">Expires On: $d/$m/$y</text>
        </line>
       #end

4. Use below script in event.total to cancel billing for inactive subscribers. Change the value 30 to desired value for subscription validity in days.

if(ticket.getCustomer()!=null)
{
    if(ticket.getCustomer().getAdvanceDate()!=null)
    {
        long diff = ticket.getDate().getTime() - ticket.getCustomer().getAdvanceDate().getTime();
        int diffDays = (int) (diff / (24 * 60 * 60 * 1000));
        javax.swing.JOptionPane.showMessageDialog(null, diffDays);
        if(diffDays>30)
        {
        return "Cancel";
        }
    }
}

Save

0 Comments

Leave a Reply

Arrow-up