FANDOM


This Script adds a Deposit function for items such as Bottles and Cans that are returnable

It adds a unique line for each type of item and when you add more of the same product it updates the line.

Add a Product AttributeEdit

Add this code to the properties tab to each product that you want to have a deposit taken - edit to the amount of the deposit before tax.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>  
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">

<properties>
    <entry key="Bottle">.3</entry>
</properties>


Add this to your Addline scriptEdit

This script will not work unless you add these lines right before the first line below starting with " if ": import com.openbravo.pos.ticket.TicketLineInfo;

import com.openbravo.pos.ticket.TicketInfo;

if (line.getProperty("Bottle") != null){
    bottlename = line.getProductName()+ " Deposit";
    bottle = line.getProperty("Bottle");
    Double newprice = new Double(bottle);
    NewMultiple = line.getMultiply();
    boolean bottlea = false;
    boolean bottleb = false;
    index = sales.getSelectedIndex();
    if (index >= 0) {
        for(int i= 0; i < ticket.getLinesCount(); i++){  
            line = ticket.getLine(i); 
            if (line.getProductName().equals(bottlename)){
                line = ticket.getLine(i);
                ticket.setLine(i,
                new TicketLineInfo(
                line.getProductID(),
                line.getProductName(),
                line.getProductTaxCategoryID(),
                line.getMultiply() + NewMultiple,
                line.getPrice (),
                line.getTaxInfo()));
                return;
            }else {
                bottlea = true;
            }
        }
    } else {
        bottleb = true;
    }
    if (bottlea){
        ticket.insertLine(index + 1,
        new TicketLineInfo(
        bottlename,
        line.getProductTaxCategoryID(),
        line.getMultiply(),
        newprice,
        line.getTaxInfo()));
    }
    if (bottleb){
        ticket.insertLine(0,
        new TicketLineInfo(
        bottlename,
        line.getProductTaxCategoryID(),
        line.getMultiply(),
        newprice,
        line.getTaxInfo()));
    }
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.