UnicentaPOS Help Wiki
Advertisement

THIS MY EDITED VERSION OF ANOTHER SCRIPT POSTED HERE

It is available under the Creative Commons Share and Share Alike Licence

This code snippet is intented to implement a way to enter the price manually when selecting any product.

Add this code to the properties tab to each product that you want to have a manually price set.[]

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

<properties>
    <entry key="isVarPrice">Yes</entry>
</properties>


Add this to your Addline script[]

// Enter product price all times begin

newPrice = line.getPrice();

// javax.swing.JOptionPane.showMessageDialog(null, "price all times " + line.getProperty("isVarPrice"), "Send Check", JOptionPane.WARNING_MESSAGE);

if (line.getProperty("isVarPrice")!= null){
 if (line.getProperty("isVarPrice").equals("Yes")){
  do{
   value = javax.swing.JOptionPane.showInputDialog("Price", newPrice);
   if (value != null) {

try {
      Double newPrice = new Double(value);
      line.setPrice(newPrice);
//      line.setPriceTax(newPrice);

     } catch (NumberFormatException e) {
      JOptionPane.showMessageDialog(null, "Not valid number: " + value, "Error", JOptionPane.PLAIN_MESSAGE);

     }

} else {
    return "Cancel";
   }
  } while (value.equals("0.0"));
 }
}

// Enter product price all times einde
Advertisement