Merge idempiere development into trekglobal

This commit is contained in:
Carlos Ruiz 2013-08-27 10:04:35 -05:00
commit 94d5858c4c
57 changed files with 14674 additions and 387 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.model;
import java.util.Properties;
/**
* Address validation callout
* @author Elaine
*
*/
public class CalloutAddressValidation extends CalloutEngine
{
public String addressValidation(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
Integer C_AddressValidationCfg_ID = (Integer)value;
if (C_AddressValidationCfg_ID == null || C_AddressValidationCfg_ID.intValue() == 0)
return "";
X_C_AddressValidationCfg validation = new X_C_AddressValidationCfg(ctx, C_AddressValidationCfg_ID, null);
mTab.setValue(MAddressValidation.COLUMNNAME_Name, validation.getName());
return null;
}
}

View File

@ -0,0 +1,36 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.model;
import java.util.Properties;
/**
* Tax provider callout
* @author Elaine
*
*/
public class CalloutTaxProvider extends CalloutEngine
{
public String taxProvider(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
Integer C_TaxProviderCfg_ID = (Integer)value;
if (C_TaxProviderCfg_ID == null || C_TaxProviderCfg_ID.intValue() == 0)
return "";
X_C_TaxProviderCfg tp = new X_C_TaxProviderCfg(ctx, C_TaxProviderCfg_ID, null);
mTab.setValue(MTaxProvider.COLUMNNAME_Name, tp.getName());
return null;
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" configuration-policy="optional" name="org.adempiere.base.event.AddressValidationEventHandler">
<implementation class="org.adempiere.base.event.AddressValidationEventHandler"/>
<reference bind="bindEventManager" cardinality="1..1" interface="org.adempiere.base.event.IEventManager" name="IEventManager" policy="static" unbind="unbindEventManager"/>
</scr:component>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.base.DefaultAddressValidationFactory">
<implementation class="org.adempiere.base.DefaultAddressValidationFactory"/>
<service>
<provide interface="org.adempiere.base.IAddressValidationFactory"/>
</service>
</scr:component>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.base.DefaultTaxProviderFactory">
<implementation class="org.adempiere.base.DefaultTaxProviderFactory"/>
<service>
<provide interface="org.adempiere.base.ITaxProviderFactory"/>
</service>
</scr:component>

View File

@ -30,6 +30,9 @@ bin.includes = META-INF/,\
OSGI-INF/broadcastutil.xml,\
OSGI-INF/requesteventhandler.xml,\
OSGI-INF/requestpropertyservice.xml,\
OSGI-INF/defaultaddressvalidationfactory.xml,\
OSGI-INF/defaulttaxproviderfactory.xml,\
OSGI-INF/addressvalidationeventhandler.xml,\
schema/
output.base.jar = build/
src.includes = schema/

View File

@ -9,6 +9,8 @@
<extension-point id="org.compiere.model.PaymentProcessor" name="Payment Processor" schema="schema/org.compiere.model.PaymentProcessor.exsd"/>
<extension-point id="org.compiere.model.Callout" name="Callout" schema="schema/org.compiere.model.Callout.exsd"/>
<extension-point id="org.adempiere.model.IShipmentProcessor" name="Shipment Processor" schema="schema/org.adempiere.model.IShipmentProcessor.exsd"/>
<extension-point id="org.adempiere.model.IAddressValidation" name="Address Validation" schema="schema/org.adempiere.model.IAddressValidation.exsd"/>
<extension-point id="org.adempiere.model.ITaxProvider" name="Tax Provider" schema="schema/org.adempiere.model.ITaxProvider.exsd"/>
<extension
id="org.adempiere.impexp.GridTabXlsExporter"
name="Grid data excel exporter"
@ -92,5 +94,13 @@
tableName="AD_InfoColumn">
</callout>
</extension>
<extension
id="org.compiere.model.StandardTaxProvider"
name="Standard Tax Provider"
point="org.adempiere.model.ITaxProvider">
<provider
class="org.compiere.model.StandardTaxProvider"
priority="0">
</provider>
</extension>
</plugin>

View File

@ -0,0 +1,113 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.adempiere.base" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.adempiere.base" id="org.adempiere.model.IAddressValidation" name="Address Validation"/>
</appinfo>
<documentation>
Extension to provide address validation integration through specific address validation implementation
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<choice>
<element ref="validation"/>
</choice>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="validation">
<complexType>
<attribute name="priority" type="string">
<annotation>
<documentation>
numeric priority value, higher value is of higher priority
</documentation>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.adempiere.model.IAddressValidation"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
1.0.0
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
&lt;pre&gt;
&lt;extension
id=&quot;org.adempiere.model.FedexAddressValidation&quot;
name=&quot;FedEx&quot;
point=&quot;org.adempiere.model.IAddressValidation&quot;&gt;
&lt;validation
class=&quot;org.adempiere.model.FedexAddressValidation&quot;
priority=&quot;0&quot;&gt;
&lt;/validation&gt;
&lt;/extension&gt;
C_AddressValidationCfg.AddressValidationClass=&quot;org.adempiere.model.FedexAddressValidation&quot;
&lt;/pre&gt;
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
The class attribute must implement the org.adempiere.model.IAddressValidation class.
</documentation>
</annotation>
</schema>

View File

@ -0,0 +1,113 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.adempiere.base" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.adempiere.base" id="org.adempiere.model.ITaxProvider" name="Tax Provider"/>
</appinfo>
<documentation>
Extension to provide tax integration through specific tax provider implementation
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<choice>
<element ref="provider"/>
</choice>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="provider">
<complexType>
<attribute name="priority" type="string">
<annotation>
<documentation>
numeric priority value, higher value is of higher priority
</documentation>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.adempiere.model.ITaxProvider"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
1.0.0
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
&lt;pre&gt;
&lt;extension
id=&quot;org.adempiere.model.StandardTaxProvider&quot;
name=&quot;Standard Tax Provider&quot;
point=&quot;org.adempiere.model.ITaxProvider&quot;&gt;
&lt;provider
class=&quot;org.adempiere.model.StandardTaxProvider&quot;
priority=&quot;0&quot;&gt;
&lt;/provider&gt;
&lt;/extension&gt;
C_TaxProvider.TaxProviderClass=&quot;org.adempiere.model.StandardTaxProvider&quot;
&lt;/pre&gt;
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
The class attribute must implement the org.adempiere.model.ITaxProvider class.
</documentation>
</annotation>
</schema>

View File

@ -25,13 +25,18 @@ import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import org.adempiere.model.IAddressValidation;
import org.adempiere.model.IShipmentProcessor;
import org.adempiere.model.ITaxProvider;
import org.adempiere.model.MShipperFacade;
import org.compiere.model.MAddressValidation;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MPaymentProcessor;
import org.compiere.model.MTaxProvider;
import org.compiere.model.ModelValidator;
import org.compiere.model.PaymentInterface;
import org.compiere.model.PaymentProcessor;
import org.compiere.model.StandardTaxProvider;
import org.compiere.process.ProcessCall;
import org.compiere.util.CLogger;
@ -197,4 +202,65 @@ public class Core {
return null;
}
/**
* Get address validation instance
* @param validation
* @return address validation instance or null if not found
*/
public static IAddressValidation getAddressValidation(MAddressValidation validation)
{
String className = validation.getAddressValidationClass();
if (className == null || className.length() == 0)
{
s_log.log(Level.SEVERE, "Address validation class not defined: " + validation);
return null;
}
List<IAddressValidationFactory> factoryList = Service.locator().list(IAddressValidationFactory.class).getServices();
if (factoryList == null)
return null;
for (IAddressValidationFactory factory : factoryList)
{
IAddressValidation processor = factory.newAddressValidationInstance(className);
if (processor != null)
return processor;
}
return null;
}
/**
* Get tax provider instance
* @param provider
* @return tax provider instance or null if not found
*/
public static ITaxProvider getTaxProvider(MTaxProvider provider)
{
ITaxProvider calculator = null;
if (provider != null)
{
if (provider.getC_TaxProvider_ID() == 0)
return new StandardTaxProvider();
String className = provider.getTaxProviderClass();
if (className == null || className.length() == 0)
{
s_log.log(Level.SEVERE, "Tax provider class not defined: " + provider);
return null;
}
List<ITaxProviderFactory> factoryList = Service.locator().list(ITaxProviderFactory.class).getServices();
if (factoryList == null)
return null;
for (ITaxProviderFactory factory : factoryList)
{
calculator = factory.newTaxProviderInstance(className);
if (calculator != null)
return calculator;
}
}
return null;
}
}

View File

@ -0,0 +1,69 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.base;
import java.util.logging.Level;
import org.adempiere.base.equinox.EquinoxExtensionLocator;
import org.adempiere.model.IAddressValidation;
import org.compiere.util.CLogger;
/**
* Default address validation factory
* @author Elaine
*
*/
public class DefaultAddressValidationFactory implements IAddressValidationFactory {
private final static CLogger s_log = CLogger.getCLogger(DefaultAddressValidationFactory.class);
/**
* default constructor
*/
public DefaultAddressValidationFactory() {
}
@Override
public IAddressValidation newAddressValidationInstance(String className) {
IAddressValidation myProcessor = EquinoxExtensionLocator.instance().locate(IAddressValidation.class, className, null).getExtension();
if (myProcessor == null)
{
//fall back to dynamic java class loading
try
{
Class<?> ppClass = Class.forName(className);
if (ppClass != null)
myProcessor = (IAddressValidation) ppClass.newInstance();
}
catch (Error e1)
{ // NoClassDefFound
s_log.log(Level.SEVERE, className + " - Error=" + e1.getMessage());
return null;
}
catch (Exception e2)
{
s_log.log(Level.SEVERE, className, e2);
return null;
}
}
if (myProcessor == null)
{
s_log.log(Level.SEVERE, "Not found in extension registry and classpath");
return null;
}
return myProcessor;
}
}

View File

@ -0,0 +1,62 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.base;
import java.util.logging.Level;
import org.adempiere.base.equinox.EquinoxExtensionLocator;
import org.adempiere.model.ITaxProvider;
import org.compiere.util.CLogger;
/**
* Default tax provider factory
* @author Elaine
*
*/
public class DefaultTaxProviderFactory implements ITaxProviderFactory {
private final static CLogger s_log = CLogger.getCLogger(DefaultTaxProviderFactory.class);
@Override
public ITaxProvider newTaxProviderInstance(String className) {
ITaxProvider myCalculator = EquinoxExtensionLocator.instance().locate(ITaxProvider.class, className, null).getExtension();
if (myCalculator == null)
{
//fall back to dynamic java class loading
try
{
Class<?> ppClass = Class.forName(className);
if (ppClass != null)
myCalculator = (ITaxProvider) ppClass.newInstance();
}
catch (Error e1)
{ // NoClassDefFound
s_log.log(Level.SEVERE, className + " - Error=" + e1.getMessage());
return null;
}
catch (Exception e2)
{
s_log.log(Level.SEVERE, className, e2);
return null;
}
}
if (myCalculator == null)
{
s_log.log(Level.SEVERE, "Not found in extension registry and classpath");
return null;
}
return myCalculator;
}
}

View File

@ -0,0 +1,31 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.base;
import org.adempiere.model.IAddressValidation;
/**
* Address validation factory interface
* @author Elaine
*
*/
public interface IAddressValidationFactory {
/**
* Create new address validation instance
* @param className
* @return address validation instance
*/
public IAddressValidation newAddressValidationInstance(String className);
}

View File

@ -0,0 +1,31 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.base;
import org.adempiere.model.ITaxProvider;
/**
* Tax provider factory interface
* @author Elaine
*
*/
public interface ITaxProviderFactory {
/**
* Create new tax provider instance
* @param className
* @return tax provider instance
*/
public ITaxProvider newTaxProviderInstance(String className);
}

View File

@ -0,0 +1,59 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.base.event;
import org.compiere.model.I_C_Location;
import org.compiere.model.MAddressValidation;
import org.compiere.model.MLocation;
import org.compiere.model.MSysConfig;
import org.compiere.model.PO;
import org.osgi.service.event.Event;
/**
* Address validation event handler
* @author Elaine
*
*/
public class AddressValidationEventHandler extends AbstractEventHandler {
@Override
protected void doHandleEvent(Event event) {
String topic = event.getTopic();
if (topic.equals(IEventTopics.PO_BEFORE_NEW) || topic.equals(IEventTopics.PO_BEFORE_CHANGE))
{
PO po = getPO(event);
if (po.get_TableName().equals(I_C_Location.Table_Name))
{
MLocation location = (MLocation) po;
if (MSysConfig.getBooleanValue(MSysConfig.ADDRESS_VALIDATION, false, location.getAD_Client_ID()))
{
MAddressValidation validation = null;
if (location.getC_AddressValidation_ID() > 0)
validation = new MAddressValidation(location.getCtx(), location.getC_AddressValidation_ID(), location.get_TrxName());
if (validation == null)
validation = MAddressValidation.getDefaultAddressValidation(location.getCtx(), location.getAD_Client_ID(), location.getAD_Org_ID(), location.get_TrxName());
if (validation != null)
location.processOnline(validation.getC_AddressValidation_ID());
}
}
}
}
@Override
protected void initialize() {
registerTableEvent(IEventTopics.PO_BEFORE_NEW, I_C_Location.Table_Name);
registerTableEvent(IEventTopics.PO_BEFORE_CHANGE, I_C_Location.Table_Name);
}
}

View File

@ -0,0 +1,27 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.model;
import java.util.Properties;
import org.compiere.model.MAddressTransaction;
/**
* Address validation interface
* @author Elaine
*
*/
public interface IAddressValidation {
public boolean onlineValidate(Properties ctx, MAddressTransaction addressTransaction, String trxName);
}

View File

@ -0,0 +1,48 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.model;
import org.compiere.model.MInvoice;
import org.compiere.model.MInvoiceLine;
import org.compiere.model.MOrder;
import org.compiere.model.MOrderLine;
import org.compiere.model.MRMA;
import org.compiere.model.MRMALine;
import org.compiere.model.MTaxProvider;
import org.compiere.process.ProcessInfo;
/**
* Tax provider interface
* @author Elaine
*
*/
public interface ITaxProvider {
public boolean calculateOrderTaxTotal(MTaxProvider provider, MOrder order);
public boolean updateOrderTax(MTaxProvider provider, MOrderLine line);
public boolean calculateInvoiceTaxTotal(MTaxProvider provider, MInvoice invoice);
public boolean updateInvoiceTax(MTaxProvider provider, MInvoiceLine line);
public boolean recalculateTax(MTaxProvider provider, MInvoiceLine line, boolean newRecord);
public boolean calculateRMATaxTotal(MTaxProvider provider, MRMA rma);
public boolean updateRMATax(MTaxProvider provider, MRMALine line);
public String validateConnection(MTaxProvider provider, ProcessInfo pi) throws Exception;
}

View File

@ -0,0 +1,73 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.process;
import java.sql.Timestamp;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MAddressTransaction;
import org.compiere.model.MLocation;
import org.compiere.process.ProcessInfoLog;
import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.SvrProcess;
import org.compiere.util.Env;
import org.compiere.util.Msg;
/**
* Online validate address process
* @author Elaine
*
*/
public class ValidateAddressProcess extends SvrProcess
{
private int p_C_AddressValidation_ID;
@Override
protected void prepare()
{
ProcessInfoParameter[] para = getParameter();
for (int i = 0; i < para.length; i++)
{
String name = para[i].getParameterName();
if (para[i].getParameter() == null)
;
else if (name.equals(MAddressTransaction.COLUMNNAME_C_AddressValidation_ID))
p_C_AddressValidation_ID = para[i].getParameterAsInt();
else
log.log(Level.SEVERE, "prepare - Unknown Parameter: " + name);
}
}
@Override
protected String doIt() throws Exception
{
if (p_C_AddressValidation_ID == 0)
throw new AdempiereException(Msg.getMsg(Env.getCtx(), "FillMandatory") + Msg.getElement(Env.getCtx(), MAddressTransaction.COLUMNNAME_C_AddressValidation_ID));
MLocation m_location = new MLocation(getCtx(), getRecord_ID(), get_TrxName());
boolean ok = m_location.processOnline(p_C_AddressValidation_ID);
m_location.saveEx();
if (!ok)
{
getProcessInfo().setError(true);
getProcessInfo().addLog(new ProcessInfoLog(getProcessInfo().getAD_Process_ID(), new Timestamp(System.currentTimeMillis()), null, m_location.getErrorMessage()));
return m_location.getErrorMessage();
}
getProcessInfo().addLog(new ProcessInfoLog(getProcessInfo().getAD_Process_ID(), new Timestamp(System.currentTimeMillis()), null, m_location.getResult()));
return m_location.getResult();
}
}

View File

@ -0,0 +1,56 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.process;
import java.util.logging.Level;
import org.adempiere.base.Core;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.model.ITaxProvider;
import org.compiere.model.MTaxProvider;
import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.SvrProcess;
import org.compiere.util.Msg;
/**
* Online validate tax provider connection
* @author Elaine
*
*/
public class ValidateTaxProviderConnection extends SvrProcess
{
@Override
protected void prepare()
{
ProcessInfoParameter[] para = getParameter();
for (int i = 0; i < para.length; i++)
{
String name = para[i].getParameterName();
if (para[i].getParameter() == null)
;
else
log.log(Level.SEVERE, "prepare - Unknown Parameter: " + name);
}
}
@Override
protected String doIt() throws Exception
{
MTaxProvider provider = new MTaxProvider(getCtx(), getRecord_ID(), get_TrxName());
ITaxProvider calculator = Core.getTaxProvider(provider);
if (calculator == null)
throw new AdempiereException(Msg.getMsg(getCtx(), "TaxNoProvider"));
return calculator.validateConnection(provider, getProcessInfo());
}
}

View File

@ -0,0 +1,288 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for C_AddressTransaction
* @author iDempiere (generated)
* @version Release 1.0c
*/
public interface I_C_AddressTransaction
{
/** TableName=C_AddressTransaction */
public static final String Table_Name = "C_AddressTransaction";
/** AD_Table_ID=200102 */
public static final int Table_ID = 200102;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 3 - Client - Org
*/
BigDecimal accessLevel = BigDecimal.valueOf(3);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name Address1 */
public static final String COLUMNNAME_Address1 = "Address1";
/** Set Address 1.
* Address line 1 for this location
*/
public void setAddress1 (String Address1);
/** Get Address 1.
* Address line 1 for this location
*/
public String getAddress1();
/** Column name Address2 */
public static final String COLUMNNAME_Address2 = "Address2";
/** Set Address 2.
* Address line 2 for this location
*/
public void setAddress2 (String Address2);
/** Get Address 2.
* Address line 2 for this location
*/
public String getAddress2();
/** Column name Address3 */
public static final String COLUMNNAME_Address3 = "Address3";
/** Set Address 3.
* Address Line 3 for the location
*/
public void setAddress3 (String Address3);
/** Get Address 3.
* Address Line 3 for the location
*/
public String getAddress3();
/** Column name Address4 */
public static final String COLUMNNAME_Address4 = "Address4";
/** Set Address 4.
* Address Line 4 for the location
*/
public void setAddress4 (String Address4);
/** Get Address 4.
* Address Line 4 for the location
*/
public String getAddress4();
/** Column name C_AddressTransaction_ID */
public static final String COLUMNNAME_C_AddressTransaction_ID = "C_AddressTransaction_ID";
/** Set Address Transaction */
public void setC_AddressTransaction_ID (int C_AddressTransaction_ID);
/** Get Address Transaction */
public int getC_AddressTransaction_ID();
/** Column name C_AddressTransaction_UU */
public static final String COLUMNNAME_C_AddressTransaction_UU = "C_AddressTransaction_UU";
/** Set C_AddressTransaction_UU */
public void setC_AddressTransaction_UU (String C_AddressTransaction_UU);
/** Get C_AddressTransaction_UU */
public String getC_AddressTransaction_UU();
/** Column name C_AddressValidation_ID */
public static final String COLUMNNAME_C_AddressValidation_ID = "C_AddressValidation_ID";
/** Set Address Validation */
public void setC_AddressValidation_ID (int C_AddressValidation_ID);
/** Get Address Validation */
public int getC_AddressValidation_ID();
public org.compiere.model.I_C_AddressValidation getC_AddressValidation() throws RuntimeException;
/** Column name C_Location_ID */
public static final String COLUMNNAME_C_Location_ID = "C_Location_ID";
/** Set Address.
* Location or Address
*/
public void setC_Location_ID (int C_Location_ID);
/** Get Address.
* Location or Address
*/
public int getC_Location_ID();
public I_C_Location getC_Location() throws RuntimeException;
/** Column name City */
public static final String COLUMNNAME_City = "City";
/** Set City.
* Identifies a City
*/
public void setCity (String City);
/** Get City.
* Identifies a City
*/
public String getCity();
/** Column name Country */
public static final String COLUMNNAME_Country = "Country";
/** Set Country */
public void setCountry (String Country);
/** Get Country */
public String getCountry();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name IsValid */
public static final String COLUMNNAME_IsValid = "IsValid";
/** Set Valid.
* Element is valid
*/
public void setIsValid (boolean IsValid);
/** Get Valid.
* Element is valid
*/
public boolean isValid();
/** Column name Postal */
public static final String COLUMNNAME_Postal = "Postal";
/** Set ZIP.
* Postal code
*/
public void setPostal (String Postal);
/** Get ZIP.
* Postal code
*/
public String getPostal();
/** Column name Processed */
public static final String COLUMNNAME_Processed = "Processed";
/** Set Processed.
* The document has been processed
*/
public void setProcessed (boolean Processed);
/** Get Processed.
* The document has been processed
*/
public boolean isProcessed();
/** Column name Region */
public static final String COLUMNNAME_Region = "Region";
/** Set Region */
public void setRegion (String Region);
/** Get Region */
public String getRegion();
/** Column name Result */
public static final String COLUMNNAME_Result = "Result";
/** Set Result.
* Result of the action taken
*/
public void setResult (String Result);
/** Get Result.
* Result of the action taken
*/
public String getResult();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -0,0 +1,215 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for C_AddressValidation
* @author iDempiere (generated)
* @version Release 1.0c
*/
public interface I_C_AddressValidation
{
/** TableName=C_AddressValidation */
public static final String Table_Name = "C_AddressValidation";
/** AD_Table_ID=200101 */
public static final int Table_ID = 200101;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 3 - Client - Org
*/
BigDecimal accessLevel = BigDecimal.valueOf(3);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name C_AddressValidation_ID */
public static final String COLUMNNAME_C_AddressValidation_ID = "C_AddressValidation_ID";
/** Set Address Validation */
public void setC_AddressValidation_ID (int C_AddressValidation_ID);
/** Get Address Validation */
public int getC_AddressValidation_ID();
/** Column name C_AddressValidation_UU */
public static final String COLUMNNAME_C_AddressValidation_UU = "C_AddressValidation_UU";
/** Set C_AddressValidation_UU */
public void setC_AddressValidation_UU (String C_AddressValidation_UU);
/** Get C_AddressValidation_UU */
public String getC_AddressValidation_UU();
/** Column name C_AddressValidationCfg_ID */
public static final String COLUMNNAME_C_AddressValidationCfg_ID = "C_AddressValidationCfg_ID";
/** Set Address Validation Configuration */
public void setC_AddressValidationCfg_ID (int C_AddressValidationCfg_ID);
/** Get Address Validation Configuration */
public int getC_AddressValidationCfg_ID();
public org.compiere.model.I_C_AddressValidationCfg getC_AddressValidationCfg() throws RuntimeException;
/** Column name ConnectionKey */
public static final String COLUMNNAME_ConnectionKey = "ConnectionKey";
/** Set Connection Key */
public void setConnectionKey (String ConnectionKey);
/** Get Connection Key */
public String getConnectionKey();
/** Column name ConnectionPassword */
public static final String COLUMNNAME_ConnectionPassword = "ConnectionPassword";
/** Set Connection Password */
public void setConnectionPassword (String ConnectionPassword);
/** Get Connection Password */
public String getConnectionPassword();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name Name */
public static final String COLUMNNAME_Name = "Name";
/** Set Name.
* Alphanumeric identifier of the entity
*/
public void setName (String Name);
/** Get Name.
* Alphanumeric identifier of the entity
*/
public String getName();
/** Column name SeqNo */
public static final String COLUMNNAME_SeqNo = "SeqNo";
/** Set Sequence.
* Method of ordering records;
lowest number comes first
*/
public void setSeqNo (int SeqNo);
/** Get Sequence.
* Method of ordering records;
lowest number comes first
*/
public int getSeqNo();
/** Column name ShipperAccount */
public static final String COLUMNNAME_ShipperAccount = "ShipperAccount";
/** Set Shipper Account Number */
public void setShipperAccount (String ShipperAccount);
/** Get Shipper Account Number */
public String getShipperAccount();
/** Column name ShipperMeter */
public static final String COLUMNNAME_ShipperMeter = "ShipperMeter";
/** Set Shipper Meter */
public void setShipperMeter (String ShipperMeter);
/** Get Shipper Meter */
public String getShipperMeter();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
/** Column name UserID */
public static final String COLUMNNAME_UserID = "UserID";
/** Set User ID.
* User ID or account number
*/
public void setUserID (String UserID);
/** Get User ID.
* User ID or account number
*/
public String getUserID();
}

View File

@ -0,0 +1,249 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for C_AddressValidationCfg
* @author iDempiere (generated)
* @version Release 1.0c
*/
public interface I_C_AddressValidationCfg
{
/** TableName=C_AddressValidationCfg */
public static final String Table_Name = "C_AddressValidationCfg";
/** AD_Table_ID=200100 */
public static final int Table_ID = 200100;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 6 - System - Client
*/
BigDecimal accessLevel = BigDecimal.valueOf(6);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name AddressValidationClass */
public static final String COLUMNNAME_AddressValidationClass = "AddressValidationClass";
/** Set Address Validation Class */
public void setAddressValidationClass (String AddressValidationClass);
/** Get Address Validation Class */
public String getAddressValidationClass();
/** Column name C_AddressValidationCfg_ID */
public static final String COLUMNNAME_C_AddressValidationCfg_ID = "C_AddressValidationCfg_ID";
/** Set Address Validation Configuration */
public void setC_AddressValidationCfg_ID (int C_AddressValidationCfg_ID);
/** Get Address Validation Configuration */
public int getC_AddressValidationCfg_ID();
/** Column name C_AddressValidationCfg_UU */
public static final String COLUMNNAME_C_AddressValidationCfg_UU = "C_AddressValidationCfg_UU";
/** Set C_AddressValidationCfg_UU */
public void setC_AddressValidationCfg_UU (String C_AddressValidationCfg_UU);
/** Get C_AddressValidationCfg_UU */
public String getC_AddressValidationCfg_UU();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name Description */
public static final String COLUMNNAME_Description = "Description";
/** Set Description.
* Optional short description of the record
*/
public void setDescription (String Description);
/** Get Description.
* Optional short description of the record
*/
public String getDescription();
/** Column name HostAddress */
public static final String COLUMNNAME_HostAddress = "HostAddress";
/** Set Host Address.
* Host Address URL or DNS
*/
public void setHostAddress (String HostAddress);
/** Get Host Address.
* Host Address URL or DNS
*/
public String getHostAddress();
/** Column name HostPort */
public static final String COLUMNNAME_HostPort = "HostPort";
/** Set Host port.
* Host Communication Port
*/
public void setHostPort (int HostPort);
/** Get Host port.
* Host Communication Port
*/
public int getHostPort();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name Name */
public static final String COLUMNNAME_Name = "Name";
/** Set Name.
* Alphanumeric identifier of the entity
*/
public void setName (String Name);
/** Get Name.
* Alphanumeric identifier of the entity
*/
public String getName();
/** Column name ProxyAddress */
public static final String COLUMNNAME_ProxyAddress = "ProxyAddress";
/** Set Proxy address.
* Address of your proxy server
*/
public void setProxyAddress (String ProxyAddress);
/** Get Proxy address.
* Address of your proxy server
*/
public String getProxyAddress();
/** Column name ProxyLogon */
public static final String COLUMNNAME_ProxyLogon = "ProxyLogon";
/** Set Proxy logon.
* Logon of your proxy server
*/
public void setProxyLogon (String ProxyLogon);
/** Get Proxy logon.
* Logon of your proxy server
*/
public String getProxyLogon();
/** Column name ProxyPassword */
public static final String COLUMNNAME_ProxyPassword = "ProxyPassword";
/** Set Proxy password.
* Password of your proxy server
*/
public void setProxyPassword (String ProxyPassword);
/** Get Proxy password.
* Password of your proxy server
*/
public String getProxyPassword();
/** Column name ProxyPort */
public static final String COLUMNNAME_ProxyPort = "ProxyPort";
/** Set Proxy port.
* Port of your proxy server
*/
public void setProxyPort (int ProxyPort);
/** Get Proxy port.
* Port of your proxy server
*/
public int getProxyPort();
/** Column name ServicePath */
public static final String COLUMNNAME_ServicePath = "ServicePath";
/** Set Service Path */
public void setServicePath (String ServicePath);
/** Get Service Path */
public String getServicePath();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -86,6 +86,32 @@ public interface I_C_InvoiceTax
/** Get C_InvoiceTax_UU */
public String getC_InvoiceTax_UU();
/** Column name C_Tax_ID */
public static final String COLUMNNAME_C_Tax_ID = "C_Tax_ID";
/** Set Tax.
* Tax identifier
*/
public void setC_Tax_ID (int C_Tax_ID);
/** Get Tax.
* Tax identifier
*/
public int getC_Tax_ID();
public org.compiere.model.I_C_Tax getC_Tax() throws RuntimeException;
/** Column name C_TaxProvider_ID */
public static final String COLUMNNAME_C_TaxProvider_ID = "C_TaxProvider_ID";
/** Set Tax Provider */
public void setC_TaxProvider_ID (int C_TaxProvider_ID);
/** Get Tax Provider */
public int getC_TaxProvider_ID();
public org.compiere.model.I_C_TaxProvider getC_TaxProvider() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
@ -102,21 +128,6 @@ public interface I_C_InvoiceTax
*/
public int getCreatedBy();
/** Column name C_Tax_ID */
public static final String COLUMNNAME_C_Tax_ID = "C_Tax_ID";
/** Set Tax.
* Tax identifier
*/
public void setC_Tax_ID (int C_Tax_ID);
/** Get Tax.
* Tax identifier
*/
public int getC_Tax_ID();
public org.compiere.model.I_C_Tax getC_Tax() throws RuntimeException;
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";

View File

@ -49,6 +49,19 @@ public interface I_C_Location
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name Address1 */
public static final String COLUMNNAME_Address1 = "Address1";
@ -101,18 +114,16 @@ public interface I_C_Location
*/
public String getAddress4();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Column name C_AddressValidation_ID */
public static final String COLUMNNAME_C_AddressValidation_ID = "C_AddressValidation_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Set Address Validation */
public void setC_AddressValidation_ID (int C_AddressValidation_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Get Address Validation */
public int getC_AddressValidation_ID();
public org.compiere.model.I_C_AddressValidation getC_AddressValidation() throws RuntimeException;
/** Column name C_City_ID */
public static final String COLUMNNAME_C_City_ID = "C_City_ID";
@ -144,19 +155,6 @@ public interface I_C_Location
public org.compiere.model.I_C_Country getC_Country() throws RuntimeException;
/** Column name City */
public static final String COLUMNNAME_City = "City";
/** Set City.
* Identifies a City
*/
public void setCity (String City);
/** Get City.
* Identifies a City
*/
public String getCity();
/** Column name C_Location_ID */
public static final String COLUMNNAME_C_Location_ID = "C_Location_ID";
@ -179,6 +177,34 @@ public interface I_C_Location
/** Get C_Location_UU */
public String getC_Location_UU();
/** Column name C_Region_ID */
public static final String COLUMNNAME_C_Region_ID = "C_Region_ID";
/** Set Region.
* Identifies a geographical Region
*/
public void setC_Region_ID (int C_Region_ID);
/** Get Region.
* Identifies a geographical Region
*/
public int getC_Region_ID();
public org.compiere.model.I_C_Region getC_Region() throws RuntimeException;
/** Column name City */
public static final String COLUMNNAME_City = "City";
/** Set City.
* Identifies a City
*/
public void setCity (String City);
/** Get City.
* Identifies a City
*/
public String getCity();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
@ -195,21 +221,6 @@ public interface I_C_Location
*/
public int getCreatedBy();
/** Column name C_Region_ID */
public static final String COLUMNNAME_C_Region_ID = "C_Region_ID";
/** Set Region.
* Identifies a geographical Region
*/
public void setC_Region_ID (int C_Region_ID);
/** Get Region.
* Identifies a geographical Region
*/
public int getC_Region_ID();
public org.compiere.model.I_C_Region getC_Region() throws RuntimeException;
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
@ -223,6 +234,19 @@ public interface I_C_Location
*/
public boolean isActive();
/** Column name IsValid */
public static final String COLUMNNAME_IsValid = "IsValid";
/** Set Valid.
* Element is valid
*/
public void setIsValid (boolean IsValid);
/** Get Valid.
* Element is valid
*/
public boolean isValid();
/** Column name Postal */
public static final String COLUMNNAME_Postal = "Postal";
@ -262,6 +286,19 @@ public interface I_C_Location
*/
public String getRegionName();
/** Column name Result */
public static final String COLUMNNAME_Result = "Result";
/** Set Result.
* Result of the action taken
*/
public void setResult (String Result);
/** Get Result.
* Result of the action taken
*/
public String getResult();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
@ -277,4 +314,13 @@ public interface I_C_Location
* User who updated this records
*/
public int getUpdatedBy();
/** Column name ValidateAddress */
public static final String COLUMNNAME_ValidateAddress = "ValidateAddress";
/** Set Validate Address */
public void setValidateAddress (String ValidateAddress);
/** Get Validate Address */
public String getValidateAddress();
}

View File

@ -86,6 +86,32 @@ public interface I_C_OrderTax
/** Get C_OrderTax_UU */
public String getC_OrderTax_UU();
/** Column name C_Tax_ID */
public static final String COLUMNNAME_C_Tax_ID = "C_Tax_ID";
/** Set Tax.
* Tax identifier
*/
public void setC_Tax_ID (int C_Tax_ID);
/** Get Tax.
* Tax identifier
*/
public int getC_Tax_ID();
public org.compiere.model.I_C_Tax getC_Tax() throws RuntimeException;
/** Column name C_TaxProvider_ID */
public static final String COLUMNNAME_C_TaxProvider_ID = "C_TaxProvider_ID";
/** Set Tax Provider */
public void setC_TaxProvider_ID (int C_TaxProvider_ID);
/** Get Tax Provider */
public int getC_TaxProvider_ID();
public org.compiere.model.I_C_TaxProvider getC_TaxProvider() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
@ -102,21 +128,6 @@ public interface I_C_OrderTax
*/
public int getCreatedBy();
/** Column name C_Tax_ID */
public static final String COLUMNNAME_C_Tax_ID = "C_Tax_ID";
/** Set Tax.
* Tax identifier
*/
public void setC_Tax_ID (int C_Tax_ID);
/** Get Tax.
* Tax identifier
*/
public int getC_Tax_ID();
public org.compiere.model.I_C_Tax getC_Tax() throws RuntimeException;
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";

View File

@ -86,22 +86,6 @@ public interface I_C_Tax
*/
public int getC_Country_ID();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name C_Region_ID */
public static final String COLUMNNAME_C_Region_ID = "C_Region_ID";
@ -117,21 +101,6 @@ public interface I_C_Tax
public org.compiere.model.I_C_Region getC_Region() throws RuntimeException;
/** Column name C_TaxCategory_ID */
public static final String COLUMNNAME_C_TaxCategory_ID = "C_TaxCategory_ID";
/** Set Tax Category.
* Tax Category
*/
public void setC_TaxCategory_ID (int C_TaxCategory_ID);
/** Get Tax Category.
* Tax Category
*/
public int getC_TaxCategory_ID();
public org.compiere.model.I_C_TaxCategory getC_TaxCategory() throws RuntimeException;
/** Column name C_Tax_ID */
public static final String COLUMNNAME_C_Tax_ID = "C_Tax_ID";
@ -154,6 +123,48 @@ public interface I_C_Tax
/** Get C_Tax_UU */
public String getC_Tax_UU();
/** Column name C_TaxCategory_ID */
public static final String COLUMNNAME_C_TaxCategory_ID = "C_TaxCategory_ID";
/** Set Tax Category.
* Tax Category
*/
public void setC_TaxCategory_ID (int C_TaxCategory_ID);
/** Get Tax Category.
* Tax Category
*/
public int getC_TaxCategory_ID();
public org.compiere.model.I_C_TaxCategory getC_TaxCategory() throws RuntimeException;
/** Column name C_TaxProvider_ID */
public static final String COLUMNNAME_C_TaxProvider_ID = "C_TaxProvider_ID";
/** Set Tax Provider */
public void setC_TaxProvider_ID (int C_TaxProvider_ID);
/** Get Tax Provider */
public int getC_TaxProvider_ID();
public org.compiere.model.I_C_TaxProvider getC_TaxProvider() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name Description */
public static final String COLUMNNAME_Description = "Description";

View File

@ -0,0 +1,202 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for C_TaxProvider
* @author iDempiere (generated)
* @version Release 1.0c
*/
public interface I_C_TaxProvider
{
/** TableName=C_TaxProvider */
public static final String Table_Name = "C_TaxProvider";
/** AD_Table_ID=200099 */
public static final int Table_ID = 200099;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 3 - Client - Org
*/
BigDecimal accessLevel = BigDecimal.valueOf(3);
/** Load Meta Data */
/** Column name Account */
public static final String COLUMNNAME_Account = "Account";
/** Set Account */
public void setAccount (String Account);
/** Get Account */
public String getAccount();
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name C_TaxProvider_ID */
public static final String COLUMNNAME_C_TaxProvider_ID = "C_TaxProvider_ID";
/** Set Tax Provider */
public void setC_TaxProvider_ID (int C_TaxProvider_ID);
/** Get Tax Provider */
public int getC_TaxProvider_ID();
/** Column name C_TaxProvider_UU */
public static final String COLUMNNAME_C_TaxProvider_UU = "C_TaxProvider_UU";
/** Set C_TaxProvider_UU */
public void setC_TaxProvider_UU (String C_TaxProvider_UU);
/** Get C_TaxProvider_UU */
public String getC_TaxProvider_UU();
/** Column name C_TaxProviderCfg_ID */
public static final String COLUMNNAME_C_TaxProviderCfg_ID = "C_TaxProviderCfg_ID";
/** Set Tax Provider Configuration */
public void setC_TaxProviderCfg_ID (int C_TaxProviderCfg_ID);
/** Get Tax Provider Configuration */
public int getC_TaxProviderCfg_ID();
public org.compiere.model.I_C_TaxProviderCfg getC_TaxProviderCfg() throws RuntimeException;
/** Column name CompanyCode */
public static final String COLUMNNAME_CompanyCode = "CompanyCode";
/** Set Company Code */
public void setCompanyCode (String CompanyCode);
/** Get Company Code */
public String getCompanyCode();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name License */
public static final String COLUMNNAME_License = "License";
/** Set License */
public void setLicense (String License);
/** Get License */
public String getLicense();
/** Column name Name */
public static final String COLUMNNAME_Name = "Name";
/** Set Name.
* Alphanumeric identifier of the entity
*/
public void setName (String Name);
/** Get Name.
* Alphanumeric identifier of the entity
*/
public String getName();
/** Column name SeqNo */
public static final String COLUMNNAME_SeqNo = "SeqNo";
/** Set Sequence.
* Method of ordering records;
lowest number comes first
*/
public void setSeqNo (int SeqNo);
/** Get Sequence.
* Method of ordering records;
lowest number comes first
*/
public int getSeqNo();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
/** Column name ValidateConnection */
public static final String COLUMNNAME_ValidateConnection = "ValidateConnection";
/** Set Validate Connection */
public void setValidateConnection (String ValidateConnection);
/** Get Validate Connection */
public String getValidateConnection();
}

View File

@ -0,0 +1,175 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for C_TaxProviderCfg
* @author iDempiere (generated)
* @version Release 1.0c
*/
public interface I_C_TaxProviderCfg
{
/** TableName=C_TaxProviderCfg */
public static final String Table_Name = "C_TaxProviderCfg";
/** AD_Table_ID=200098 */
public static final int Table_ID = 200098;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 6 - System - Client
*/
BigDecimal accessLevel = BigDecimal.valueOf(6);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name C_TaxProviderCfg_ID */
public static final String COLUMNNAME_C_TaxProviderCfg_ID = "C_TaxProviderCfg_ID";
/** Set Tax Provider Configuration */
public void setC_TaxProviderCfg_ID (int C_TaxProviderCfg_ID);
/** Get Tax Provider Configuration */
public int getC_TaxProviderCfg_ID();
/** Column name C_TaxProviderCfg_UU */
public static final String COLUMNNAME_C_TaxProviderCfg_UU = "C_TaxProviderCfg_UU";
/** Set C_TaxProviderCfg_UU */
public void setC_TaxProviderCfg_UU (String C_TaxProviderCfg_UU);
/** Get C_TaxProviderCfg_UU */
public String getC_TaxProviderCfg_UU();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name Description */
public static final String COLUMNNAME_Description = "Description";
/** Set Description.
* Optional short description of the record
*/
public void setDescription (String Description);
/** Get Description.
* Optional short description of the record
*/
public String getDescription();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name Name */
public static final String COLUMNNAME_Name = "Name";
/** Set Name.
* Alphanumeric identifier of the entity
*/
public void setName (String Name);
/** Get Name.
* Alphanumeric identifier of the entity
*/
public String getName();
/** Column name TaxProviderClass */
public static final String COLUMNNAME_TaxProviderClass = "TaxProviderClass";
/** Set Tax Provider Class */
public void setTaxProviderClass (String TaxProviderClass);
/** Get Tax Provider Class */
public String getTaxProviderClass();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
/** Column name URL */
public static final String COLUMNNAME_URL = "URL";
/** Set URL.
* Full URL address - e.g. http://www.idempiere.org
*/
public void setURL (String URL);
/** Get URL.
* Full URL address - e.g. http://www.idempiere.org
*/
public String getURL();
}

View File

@ -62,6 +62,32 @@ public interface I_M_RMATax
*/
public int getAD_Org_ID();
/** Column name C_Tax_ID */
public static final String COLUMNNAME_C_Tax_ID = "C_Tax_ID";
/** Set Tax.
* Tax identifier
*/
public void setC_Tax_ID (int C_Tax_ID);
/** Get Tax.
* Tax identifier
*/
public int getC_Tax_ID();
public org.compiere.model.I_C_Tax getC_Tax() throws RuntimeException;
/** Column name C_TaxProvider_ID */
public static final String COLUMNNAME_C_TaxProvider_ID = "C_TaxProvider_ID";
/** Set Tax Provider */
public void setC_TaxProvider_ID (int C_TaxProvider_ID);
/** Get Tax Provider */
public int getC_TaxProvider_ID();
public org.compiere.model.I_C_TaxProvider getC_TaxProvider() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
@ -78,21 +104,6 @@ public interface I_M_RMATax
*/
public int getCreatedBy();
/** Column name C_Tax_ID */
public static final String COLUMNNAME_C_Tax_ID = "C_Tax_ID";
/** Set Tax.
* Tax identifier
*/
public void setC_Tax_ID (int C_Tax_ID);
/** Get Tax.
* Tax identifier
*/
public int getC_Tax_ID();
public org.compiere.model.I_C_Tax getC_Tax() throws RuntimeException;
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";

View File

@ -0,0 +1,122 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.base.Core;
import org.adempiere.model.IAddressValidation;
import org.compiere.util.Env;
import org.compiere.util.Msg;
/**
* Address transaction model
* @author Elaine
*
*/
public class MAddressTransaction extends X_C_AddressTransaction
{
/**
*
*/
private static final long serialVersionUID = 8572809249265680649L;
public MAddressTransaction(Properties ctx, int C_AddressTransaction_ID, String trxName)
{
super(ctx, C_AddressTransaction_ID, trxName);
}
public MAddressTransaction(Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
}
/** Error Message */
private String m_errorMessage = null;
/**
* Set error message
* @param errorMessage
*/
public void setErrorMessage(String errorMessage)
{
m_errorMessage = errorMessage;
}
/**
* Get error message
* @return error message
*/
public String getErrorMessage()
{
return m_errorMessage;
}
/**
* Get address validation
* @return address validation
*/
public MAddressValidation getMAddressValidation()
{
return new MAddressValidation(getCtx(), getC_AddressValidation_ID(), get_TrxName());
}
/**
* Online process address validation
* @return true if valid
*/
public boolean processOnline()
{
setErrorMessage(null);
boolean processed = false;
try
{
IAddressValidation validation = Core.getAddressValidation(getMAddressValidation());
if (validation == null)
setErrorMessage(Msg.getMsg(Env.getCtx(), "AddressNoValidation"));
else
{
processed = validation.onlineValidate(getCtx(), this, get_TrxName());
if (!processed)
setErrorMessage("From " + getMAddressValidation().getName() + ": " + getResult());
}
}
catch (Exception e)
{
log.log(Level.SEVERE, "processOnline", e);
setErrorMessage(Msg.getMsg(Env.getCtx(), "AddressNotProcessed") + ":\n" + e.getMessage());
}
MOnlineTrxHistory history = new MOnlineTrxHistory(getCtx(), 0, get_TrxName());
history.setAD_Table_ID(MAddressTransaction.Table_ID);
history.setRecord_ID(getC_AddressTransaction_ID());
history.setIsError(!processed);
history.setProcessed(processed);
StringBuilder msg = new StringBuilder();
if (processed)
msg.append(getResult());
else
msg.append("ERROR: " + getErrorMessage());
history.setTextMsg(msg.toString());
history.saveEx();
setProcessed(processed);
return processed;
}
}

View File

@ -0,0 +1,164 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.model;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
/**
* Address validation model
* @author Elaine
*
*/
public class MAddressValidation extends X_C_AddressValidation {
/**
*
*/
private static final long serialVersionUID = -6593449454853401744L;
/** Static Logger */
private static CLogger s_log = CLogger.getCLogger(MAddressValidation.class);
/**
* Get default address validation
* @param ctx
* @param AD_Client_ID
* @param AD_Org_ID
* @param trxName
* @return address validation
*/
public static MAddressValidation getDefaultAddressValidation(Properties ctx, int AD_Client_ID, int AD_Org_ID, String trxName)
{
MAddressValidation[] validations = getAddressValidation(ctx, AD_Client_ID, AD_Org_ID, trxName);
if (validations.length == 0)
return null;
return validations[0];
}
/**
* Get address validations
* @param ctx
* @param AD_Client_ID
* @param AD_Org_ID
* @param trxName
* @return array of address validation
*/
public static MAddressValidation[] getAddressValidation(Properties ctx, int AD_Client_ID, int AD_Org_ID, String trxName)
{
ArrayList<MAddressValidation> list = new ArrayList<MAddressValidation>();
StringBuilder sql = new StringBuilder();
sql.append("SELECT tp.* ");
sql.append("FROM C_AddressValidation tp, C_AddressValidationCfg tpc ");
sql.append("WHERE tp.C_AddressValidationCfg_ID = tpc.C_AddressValidationCfg_ID ");
sql.append("AND tpc.IsActive = 'Y' ");
sql.append("AND tp.IsActive = 'Y' ");
sql.append("AND tp.AD_Client_ID = ? ");
sql.append("AND tp.AD_Org_ID IN (0, ?) ");
sql.append("ORDER BY tp.AD_Org_ID DESC, tp.SeqNo");
//
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql.toString(), trxName);
pstmt.setInt(1, AD_Client_ID);
pstmt.setInt(2, AD_Org_ID);
rs = pstmt.executeQuery();
while (rs.next())
list.add(new MAddressValidation(ctx, rs, trxName));
}
catch (SQLException e)
{
s_log.log(Level.SEVERE, "find - " + sql, e);
return null;
}
finally
{
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
//
if (list.size() == 0)
s_log.warning("find - not found - AD_Client_ID=" + AD_Client_ID + ", AD_Org_ID=" + AD_Org_ID);
else
if (s_log.isLoggable(Level.FINE)) s_log.fine("find - #" + list.size() + " - AD_Client_ID=" + AD_Client_ID + ", AD_Org_ID=" + AD_Org_ID);
MAddressValidation[] retValue = new MAddressValidation[list.size()];
list.toArray(retValue);
return retValue;
}
public MAddressValidation(Properties ctx, int C_AddressValidation_ID, String trxName) {
super(ctx, C_AddressValidation_ID, trxName);
}
public MAddressValidation(Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
}
public String getAddressValidationClass()
{
return getC_AddressValidationCfg().getAddressValidationClass();
}
public String getHostAddress()
{
return getC_AddressValidationCfg().getHostAddress();
}
public int getHostPort()
{
return getC_AddressValidationCfg().getHostPort();
}
public String getProxyAddress()
{
return getC_AddressValidationCfg().getProxyAddress();
}
public int getProxyPort()
{
return getC_AddressValidationCfg().getProxyPort();
}
public String getProxyLogon()
{
return getC_AddressValidationCfg().getProxyLogon();
}
public String getProxyPassword()
{
return getC_AddressValidationCfg().getProxyPassword();
}
public String getServicePath()
{
return getC_AddressValidationCfg().getServicePath();
}
public String toString()
{
return getName();
}
}

View File

@ -23,14 +23,17 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.base.Core;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.BPartnerNoAddressException;
import org.adempiere.exceptions.DBException;
import org.adempiere.exceptions.PeriodClosedException;
import org.adempiere.model.ITaxProvider;
import org.compiere.print.MPrintFormat;
import org.compiere.print.ReportEngine;
import org.compiere.process.DocAction;
@ -66,7 +69,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
/**
*
*/
private static final long serialVersionUID = -1223767990636657474L;
private static final long serialVersionUID = -1061413366741817262L;
/**
* Get Payments Of BPartner
@ -1577,67 +1580,16 @@ public class MInvoice extends X_C_Invoice implements DocAction
DB.executeUpdateEx(msgdb.toString(), get_TrxName());
m_taxes = null;
// Lines
BigDecimal totalLines = Env.ZERO;
ArrayList<Integer> taxList = new ArrayList<Integer>();
MInvoiceLine[] lines = getLines(false);
for (int i = 0; i < lines.length; i++)
MTaxProvider[] providers = getTaxProviders();
for (MTaxProvider provider : providers)
{
MInvoiceLine line = lines[i];
if (!taxList.contains(line.getC_Tax_ID()))
{
MInvoiceTax iTax = MInvoiceTax.get (line, getPrecision(), false, get_TrxName()); // current Tax
if (iTax != null)
{
iTax.setIsTaxIncluded(isTaxIncluded());
if (!iTax.calculateTaxFromLines())
return false;
iTax.saveEx();
taxList.add(line.getC_Tax_ID());
}
}
totalLines = totalLines.add(line.getLineNetAmt());
}
ITaxProvider calculator = Core.getTaxProvider(provider);
if (calculator == null)
throw new AdempiereException(Msg.getMsg(getCtx(), "TaxNoProvider"));
// Taxes
BigDecimal grandTotal = totalLines;
MInvoiceTax[] taxes = getTaxes(true);
for (int i = 0; i < taxes.length; i++)
{
MInvoiceTax iTax = taxes[i];
MTax tax = iTax.getTax();
if (tax.isSummary())
{
MTax[] cTaxes = tax.getChildTaxes(false); // Multiple taxes
for (int j = 0; j < cTaxes.length; j++)
{
MTax cTax = cTaxes[j];
BigDecimal taxAmt = cTax.calculateTax(iTax.getTaxBaseAmt(), isTaxIncluded(), getPrecision());
//
MInvoiceTax newITax = new MInvoiceTax(getCtx(), 0, get_TrxName());
newITax.setClientOrg(this);
newITax.setC_Invoice_ID(getC_Invoice_ID());
newITax.setC_Tax_ID(cTax.getC_Tax_ID());
newITax.setPrecision(getPrecision());
newITax.setIsTaxIncluded(isTaxIncluded());
newITax.setTaxBaseAmt(iTax.getTaxBaseAmt());
newITax.setTaxAmt(taxAmt);
newITax.saveEx(get_TrxName());
//
if (!isTaxIncluded())
grandTotal = grandTotal.add(taxAmt);
if (!calculator.calculateInvoiceTaxTotal(provider, this))
return false;
}
iTax.deleteEx(true, get_TrxName());
}
else
{
if (!isTaxIncluded())
grandTotal = grandTotal.add(iTax.getTaxAmt());
}
}
//
setTotalLines(totalLines);
setGrandTotal(grandTotal);
return true;
} // calculateTaxTotal
@ -2681,4 +2633,59 @@ public class MInvoice extends X_C_Invoice implements DocAction
|| DOCSTATUS_Reversed.equals(ds);
} // isComplete
/**
* Get original order
* @return order
*/
public MOrder getOriginalOrder()
{
if (getM_RMA_ID() > 0)
{
MRMA rma = new MRMA(getCtx(), getM_RMA_ID(), get_TrxName());
MOrder originalOrder = rma.getOriginalOrder();
if (originalOrder != null)
return originalOrder;
MInvoice originalInvoice = rma.getOriginalInvoice();
if (originalInvoice.getC_Order_ID() > 0)
{
originalOrder = new MOrder(getCtx(), originalInvoice.getC_Order_ID(), get_TrxName());
if (originalOrder != null)
return originalOrder;
}
}
else if (getC_Order_ID() > 0)
return new MOrder(getCtx(), getC_Order_ID(), get_TrxName());
return null;
}
/**
* Set process message
* @param processMsg
*/
public void setProcessMessage(String processMsg)
{
m_processMsg = processMsg;
}
/**
* Get tax providers
* @return array of tax provider
*/
public MTaxProvider[] getTaxProviders()
{
Hashtable<Integer, MTaxProvider> providers = new Hashtable<Integer, MTaxProvider>();
MInvoiceLine[] lines = getLines();
for (MInvoiceLine line : lines)
{
MTax tax = new MTax(line.getCtx(), line.getC_Tax_ID(), line.get_TrxName());
MTaxProvider provider = providers.get(tax.getC_TaxProvider_ID());
if (provider == null)
providers.put(tax.getC_TaxProvider_ID(), new MTaxProvider(tax.getCtx(), tax.getC_TaxProvider_ID(), tax.get_TrxName()));
}
MTaxProvider[] retValue = new MTaxProvider[providers.size()];
providers.values().toArray(retValue);
return retValue;
}
} // MInvoice

View File

@ -25,7 +25,9 @@ import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.base.Core;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.model.ITaxProvider;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -52,7 +54,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
/**
*
*/
private static final long serialVersionUID = 6157080330492848409L;
private static final long serialVersionUID = -8065144330439104363L;
/**
* Get Invoice Line referencing InOut Line
@ -912,7 +914,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
*
* @author teo_sarca [ 1583825 ]
*/
private boolean updateInvoiceTax(boolean oldTax) {
protected boolean updateInvoiceTax(boolean oldTax) {
MInvoiceTax tax = MInvoiceTax.get (this, getPrecision(), oldTax, get_TrxName());
if (tax != null) {
if (!tax.calculateTaxFromLines())
@ -941,13 +943,12 @@ public class MInvoiceLine extends X_C_InvoiceLine
{
if (!success)
return success;
if (!newRecord && is_ValueChanged("C_Tax_ID"))
{
// Recalculate Tax for old Tax
if (!updateInvoiceTax(true))
return false;
}
return updateHeaderTax();
MTax tax = new MTax(getCtx(), getC_Tax_ID(), get_TrxName());
MTaxProvider provider = new MTaxProvider(tax.getCtx(), tax.getC_TaxProvider_ID(), tax.get_TrxName());
ITaxProvider calculator = Core.getTaxProvider(provider);
if (calculator == null)
throw new AdempiereException(Msg.getMsg(getCtx(), "TaxNoProvider"));
return calculator.recalculateTax(provider, this, newRecord);
} // afterSave
/**
@ -975,14 +976,19 @@ public class MInvoiceLine extends X_C_InvoiceLine
* Update Tax & Header
* @return true if header updated with tax
*/
private boolean updateHeaderTax()
protected boolean updateHeaderTax()
{
// Update header only if the document is not processed - teo_sarca BF [ 2317305 ]
if (isProcessed() && !is_ValueChanged(COLUMNNAME_Processed))
return true;
// Recalculate Tax for this Tax
if (!updateInvoiceTax(false))
MTax tax = new MTax(getCtx(), getC_Tax_ID(), get_TrxName());
MTaxProvider provider = new MTaxProvider(tax.getCtx(), tax.getC_TaxProvider_ID(), tax.get_TrxName());
ITaxProvider calculator = Core.getTaxProvider(provider);
if (calculator == null)
throw new AdempiereException(Msg.getMsg(getCtx(), "TaxNoProvider"));
if (!calculator.updateInvoiceTax(provider, this))
return false;
// Update Invoice Header
@ -1357,5 +1363,4 @@ public class MInvoiceLine extends X_C_InvoiceLine
+" AND "+MMatchInv.COLUMNNAME_Processed+"=?";
return DB.getSQLValueBDEx(get_TrxName(), sql, getC_InvoiceLine_ID(), true);
}
} // MInvoiceLine

View File

@ -28,6 +28,7 @@ import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Trx;
import org.compiere.util.Util;
/**
@ -49,7 +50,7 @@ public class MLocation extends X_C_Location implements Comparator<Object>
/**
*
*/
private static final long serialVersionUID = 8332515185354248079L;
private static final long serialVersionUID = -7522263181009070628L;
// http://jira.idempiere.com/browse/IDEMPIERE-147
public static String LOCATION_MAPS_URL_PREFIX = MSysConfig.getValue(MSysConfig.LOCATION_MAPS_URL_PREFIX);
@ -720,4 +721,97 @@ public class MLocation extends X_C_Location implements Comparator<Object>
return address.toString().replace(" ", "+");
}
/** Error Message */
private String m_errorMessage = null;
/**
* Set error message
* @param errorMessage
*/
public void setErrorMessage(String errorMessage)
{
m_errorMessage = errorMessage;
}
/**
* Get error message
* @return error message
*/
public String getErrorMessage()
{
return m_errorMessage;
}
/**
* Perform online address validation
* @param C_AddressValidation_ID
* @return true if valid
*/
public boolean processOnline(int C_AddressValidation_ID)
{
setErrorMessage(null);
Trx trx = Trx.get(Trx.createTrxName("avt-"), true);
boolean ok = false;
try
{
MAddressTransaction at = createAddressTransaction(getCtx(), this, C_AddressValidation_ID, trx.getTrxName());
ok = at.processOnline();
at.saveEx();
setC_AddressValidation_ID(at.getC_AddressValidation_ID());
setIsValid(at.isValid());
setResult(at.getResult());
if (!ok)
setErrorMessage(at.getErrorMessage());
}
catch (Exception e)
{
log.log(Level.SEVERE, "processOnline", e);
setErrorMessage(Msg.getMsg(Env.getCtx(), "AddressNotProcessed") + ": " + e.getMessage());
}
finally
{
if (trx != null)
{
trx.commit();
trx.close();
}
}
return ok;
}
/**
* Create address transaction instance
* @param ctx
* @param location
* @param C_AddressValidation_ID
* @param trxName
* @return address transaction instance
*/
private static MAddressTransaction createAddressTransaction(Properties ctx, MLocation location, int C_AddressValidation_ID, String trxName)
{
MAddressTransaction at = new MAddressTransaction(ctx, 0, trxName);
at.setAD_Org_ID(location.getAD_Org_ID());
at.setAddress1(location.getAddress1());
at.setAddress2(location.getAddress2());
at.setAddress3(location.getAddress3());
at.setAddress4(location.getAddress4());
at.setC_AddressValidation_ID(C_AddressValidation_ID);
at.setC_Location_ID(location.getC_Location_ID());
at.setCity(location.getCity());
if (location.getCountry() != null)
at.setCountry(location.getCountry().getCountryCode());
at.setIsActive(location.isActive());
at.setPostal(location.getPostal());
if (location.getRegion() != null)
at.setRegion(location.getRegion().getName());
else
at.setRegion(location.getRegionName());
at.saveEx();
return at;
}
} // MLocation

View File

@ -23,17 +23,19 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Properties;
import java.util.Vector;
import java.util.logging.Level;
import java.util.regex.Pattern;
import org.adempiere.base.Core;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.BPartnerNoBillToAddressException;
import org.adempiere.exceptions.BPartnerNoShipToAddressException;
import org.adempiere.exceptions.FillMandatoryException;
import org.adempiere.model.ITaxProvider;
import org.adempiere.process.SalesOrderRateInquiryProcess;
import org.compiere.print.MPrintFormat;
import org.compiere.print.ReportEngine;
@ -74,7 +76,7 @@ public class MOrder extends X_C_Order implements DocAction
/**
*
*/
private static final long serialVersionUID = -3958412751269036933L;
private static final long serialVersionUID = -5424713436299981736L;
/**
* Create new Order by copying
@ -1750,71 +1752,16 @@ public class MOrder extends X_C_Order implements DocAction
DB.executeUpdateEx("DELETE C_OrderTax WHERE C_Order_ID=" + getC_Order_ID(), get_TrxName());
m_taxes = null;
// Lines
BigDecimal totalLines = Env.ZERO;
ArrayList<Integer> taxList = new ArrayList<Integer>();
MOrderLine[] lines = getLines();
for (int i = 0; i < lines.length; i++)
MTaxProvider[] providers = getTaxProviders();
for (MTaxProvider provider : providers)
{
MOrderLine line = lines[i];
Integer taxID = new Integer(line.getC_Tax_ID());
if (!taxList.contains(taxID))
{
MOrderTax oTax = MOrderTax.get (line, getPrecision(),
false, get_TrxName()); // current Tax
oTax.setIsTaxIncluded(isTaxIncluded());
if (!oTax.calculateTaxFromLines())
return false;
if (!oTax.save(get_TrxName()))
return false;
taxList.add(taxID);
}
totalLines = totalLines.add(line.getLineNetAmt());
}
ITaxProvider calculator = Core.getTaxProvider(provider);
if (calculator == null)
throw new AdempiereException(Msg.getMsg(getCtx(), "TaxNoProvider"));
// Taxes
BigDecimal grandTotal = totalLines;
MOrderTax[] taxes = getTaxes(true);
for (int i = 0; i < taxes.length; i++)
{
MOrderTax oTax = taxes[i];
MTax tax = oTax.getTax();
if (tax.isSummary())
{
MTax[] cTaxes = tax.getChildTaxes(false);
for (int j = 0; j < cTaxes.length; j++)
{
MTax cTax = cTaxes[j];
BigDecimal taxAmt = cTax.calculateTax(oTax.getTaxBaseAmt(), isTaxIncluded(), getPrecision());
//
MOrderTax newOTax = new MOrderTax(getCtx(), 0, get_TrxName());
newOTax.setClientOrg(this);
newOTax.setC_Order_ID(getC_Order_ID());
newOTax.setC_Tax_ID(cTax.getC_Tax_ID());
newOTax.setPrecision(getPrecision());
newOTax.setIsTaxIncluded(isTaxIncluded());
newOTax.setTaxBaseAmt(oTax.getTaxBaseAmt());
newOTax.setTaxAmt(taxAmt);
if (!newOTax.save(get_TrxName()))
return false;
//
if (!isTaxIncluded())
grandTotal = grandTotal.add(taxAmt);
}
if (!oTax.delete(true, get_TrxName()))
return false;
if (!oTax.save(get_TrxName()))
if (!calculator.calculateOrderTaxTotal(provider, this))
return false;
}
else
{
if (!isTaxIncluded())
grandTotal = grandTotal.add(oTax.getTaxAmt());
}
}
//
setTotalLines(totalLines);
setGrandTotal(grandTotal);
return true;
} // calculateTaxTotal
@ -2961,4 +2908,34 @@ public class MOrder extends X_C_Order implements DocAction
public StockInfo() {}
}
/**
* Set process message
* @param processMsg
*/
public void setProcessMessage(String processMsg)
{
m_processMsg = processMsg;
}
/**
* Get tax providers
* @return array of tax provider
*/
public MTaxProvider[] getTaxProviders()
{
Hashtable<Integer, MTaxProvider> providers = new Hashtable<Integer, MTaxProvider>();
MOrderLine[] lines = getLines();
for (MOrderLine line : lines)
{
MTax tax = new MTax(line.getCtx(), line.getC_Tax_ID(), line.get_TrxName());
MTaxProvider provider = providers.get(tax.getC_TaxProvider_ID());
if (provider == null)
providers.put(tax.getC_TaxProvider_ID(), new MTaxProvider(tax.getCtx(), tax.getC_TaxProvider_ID(), tax.get_TrxName()));
}
MTaxProvider[] retValue = new MTaxProvider[providers.size()];
providers.values().toArray(retValue);
return retValue;
}
} // MOrder

View File

@ -22,7 +22,10 @@ import java.sql.ResultSet;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.base.Core;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.ProductNotOnPriceListException;
import org.adempiere.model.ITaxProvider;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -55,7 +58,7 @@ public class MOrderLine extends X_C_OrderLine
/**
*
*/
private static final long serialVersionUID = 7305265800857547603L;
private static final long serialVersionUID = -5740772832684028526L;
/**
* Get Order Unreserved Qty
@ -1038,7 +1041,7 @@ public class MOrderLine extends X_C_OrderLine
*
* @author teo_sarca [ 1583825 ]
*/
private boolean updateOrderTax(boolean oldTax) {
protected boolean updateOrderTax(boolean oldTax) {
MOrderTax tax = MOrderTax.get (this, getPrecision(), oldTax, get_TrxName());
if (tax != null) {
if (!tax.calculateTaxFromLines())
@ -1063,8 +1066,15 @@ public class MOrderLine extends X_C_OrderLine
{
// Recalculate Tax for this Tax
if (!getParent().isProcessed())
if (!updateOrderTax(false))
{
MTax tax = new MTax(getCtx(), getC_Tax_ID(), get_TrxName());
MTaxProvider provider = new MTaxProvider(tax.getCtx(), tax.getC_TaxProvider_ID(), tax.get_TrxName());
ITaxProvider calculator = Core.getTaxProvider(provider);
if (calculator == null)
throw new AdempiereException(Msg.getMsg(getCtx(), "TaxNoProvider"));
if (!calculator.updateOrderTax(provider, this))
return false;
}
// Update Order Header
String sql = "UPDATE C_Order i"

View File

@ -20,11 +20,14 @@ import java.io.File;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.base.Core;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.model.ITaxProvider;
import org.compiere.process.DocAction;
import org.compiere.process.DocumentEngine;
import org.compiere.util.DB;
@ -44,7 +47,7 @@ public class MRMA extends X_M_RMA implements DocAction
/**
*
*/
private static final long serialVersionUID = -3310525910645254261L;
private static final long serialVersionUID = -6449007672684459651L;
/**
* Standard Constructor
@ -378,70 +381,16 @@ public class MRMA extends X_M_RMA implements DocAction
DB.executeUpdateEx("DELETE M_RMATax WHERE M_RMA_ID=" + getM_RMA_ID(), get_TrxName());
m_taxes = null;
// Lines
BigDecimal totalLines = Env.ZERO;
ArrayList<Integer> taxList = new ArrayList<Integer>();
MRMALine[] lines = getLines(false);
for (int i = 0; i < lines.length; i++)
MTaxProvider[] providers = getTaxProviders();
for (MTaxProvider provider : providers)
{
MRMALine line = lines[i];
Integer taxID = new Integer(line.getC_Tax_ID());
if (!taxList.contains(taxID))
{
MRMATax oTax = MRMATax.get (line, getPrecision(),
false, get_TrxName()); // current Tax
oTax.setIsTaxIncluded(isTaxIncluded());
if (!oTax.calculateTaxFromLines())
return false;
if (!oTax.save(get_TrxName()))
return false;
taxList.add(taxID);
}
totalLines = totalLines.add(line.getLineNetAmt());
}
ITaxProvider calculator = Core.getTaxProvider(provider);
if (calculator == null)
throw new AdempiereException(Msg.getMsg(getCtx(), "TaxNoProvider"));
// Taxes
BigDecimal grandTotal = totalLines;
MRMATax[] taxes = getTaxes(true);
for (int i = 0; i < taxes.length; i++)
{
MRMATax oTax = taxes[i];
MTax tax = oTax.getTax();
if (tax.isSummary())
{
MTax[] cTaxes = tax.getChildTaxes(false);
for (int j = 0; j < cTaxes.length; j++)
{
MTax cTax = cTaxes[j];
BigDecimal taxAmt = cTax.calculateTax(oTax.getTaxBaseAmt(), isTaxIncluded(), getPrecision());
//
MRMATax newOTax = new MRMATax(getCtx(), 0, get_TrxName());
newOTax.setClientOrg(this);
newOTax.setM_RMA_ID(getM_RMA_ID());
newOTax.setC_Tax_ID(cTax.getC_Tax_ID());
newOTax.setPrecision(getPrecision());
newOTax.setIsTaxIncluded(isTaxIncluded());
newOTax.setTaxBaseAmt(oTax.getTaxBaseAmt());
newOTax.setTaxAmt(taxAmt);
if (!newOTax.save(get_TrxName()))
return false;
//
if (!isTaxIncluded())
grandTotal = grandTotal.add(taxAmt);
}
if (!oTax.delete(true, get_TrxName()))
return false;
if (!oTax.save(get_TrxName()))
if (!calculator.calculateRMATaxTotal(provider, this))
return false;
}
else
{
if (!isTaxIncluded())
grandTotal = grandTotal.add(oTax.getTaxAmt());
}
}
//
setAmt(grandTotal);
return true;
}
@ -996,4 +945,33 @@ public class MRMA extends X_M_RMA implements DocAction
|| DOCSTATUS_Reversed.equals(ds);
} // isComplete
/**
* Set process message
* @param processMsg
*/
public void setProcessMessage(String processMsg)
{
m_processMsg = processMsg;
}
/**
* Get tax providers
* @return array of tax provider
*/
public MTaxProvider[] getTaxProviders()
{
Hashtable<Integer, MTaxProvider> providers = new Hashtable<Integer, MTaxProvider>();
MRMALine[] lines = getLines(false);
for (MRMALine line : lines)
{
MTax tax = new MTax(line.getCtx(), line.getC_Tax_ID(), line.get_TrxName());
MTaxProvider provider = providers.get(tax.getC_TaxProvider_ID());
if (provider == null)
providers.put(tax.getC_TaxProvider_ID(), new MTaxProvider(tax.getCtx(), tax.getC_TaxProvider_ID(), tax.get_TrxName()));
}
MTaxProvider[] retValue = new MTaxProvider[providers.size()];
providers.values().toArray(retValue);
return retValue;
}
} // MRMA

View File

@ -21,6 +21,9 @@ import java.sql.ResultSet;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.base.Core;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.model.ITaxProvider;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
@ -37,7 +40,7 @@ public class MRMALine extends X_M_RMALine
/**
*
*/
private static final long serialVersionUID = 3540322234762687347L;
private static final long serialVersionUID = 4358572588500923170L;
/**
* Standard Constructor
@ -410,7 +413,7 @@ public class MRMALine extends X_M_RMALine
return true;
}
private boolean updateOrderTax(boolean oldTax)
protected boolean updateOrderTax(boolean oldTax)
{
MRMATax tax = MRMATax.get (this, getPrecision(), oldTax, get_TrxName());
if (tax != null)
@ -467,8 +470,15 @@ public class MRMALine extends X_M_RMALine
// Recalculate Tax for this Tax
if (!getParent().isProcessed())
if (!updateOrderTax(false))
{
MTax tax = new MTax(getCtx(), getC_Tax_ID(), get_TrxName());
MTaxProvider provider = new MTaxProvider(tax.getCtx(), tax.getC_TaxProvider_ID(), tax.get_TrxName());
ITaxProvider calculator = Core.getTaxProvider(provider);
if (calculator == null)
throw new AdempiereException(Msg.getMsg(getCtx(), "TaxNoProvider"));
if (!calculator.updateRMATax(provider, this))
return false;
}
// Update RMA Header
String sql = "UPDATE M_RMA "

View File

@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig
/**
*
*/
private static final long serialVersionUID = 1880114058462268002L;
private static final long serialVersionUID = 8880509641924823121L;
public final static String PDF_FONT_DIR = "PDF_FONT_DIR";
public final static String TWOPACK_HANDLE_TRANSLATIONS = "2PACK_HANDLE_TRANSLATIONS";
@ -118,6 +118,8 @@ public class MSysConfig extends X_AD_SysConfig
public static final String ZK_MAX_UPLOAD_SIZE = "ZK_MAX_UPLOAD_SIZE";
public static final String CALENDAR_ALTERNATE_TIMEZONE = "CALENDAR_ALTERNATE_TIMEZONE";
public static final String ZK_REPORT_JASPER_OUTPUT_TYPE = "ZK_REPORT_JASPER_OUTPUT_TYPE";
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
public static final String TAX_SAVE_REQUEST_RESPONSE_LOG = "TAX_SAVE_REQUEST_RESPONSE_LOG";
/**
* Standard Constructor

View File

@ -0,0 +1,50 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
/**
* Tax provider model
* @author Elaine
*
*/
public class MTaxProvider extends X_C_TaxProvider
{
/**
*
*/
private static final long serialVersionUID = 6621828279540899973L;
public MTaxProvider(Properties ctx, int C_TaxProvider_ID, String trxName)
{
super(ctx, C_TaxProvider_ID, trxName);
}
public MTaxProvider(Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
}
public String getTaxProviderClass()
{
return getC_TaxProviderCfg().getTaxProviderClass();
}
public String getURL()
{
return getC_TaxProviderCfg().getURL();
}
}

View File

@ -0,0 +1,301 @@
/******************************************************************************
* Copyright (C) 2013 Elaine Tan *
* Copyright (C) 2013 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.util.ArrayList;
import org.adempiere.model.ITaxProvider;
import org.compiere.process.ProcessInfo;
import org.compiere.util.Env;
import org.compiere.util.Msg;
/**
* Standard tax provider
* @author Elaine
*
*/
public class StandardTaxProvider implements ITaxProvider {
@Override
public boolean calculateOrderTaxTotal(MTaxProvider provider, MOrder order) {
// Lines
BigDecimal totalLines = Env.ZERO;
ArrayList<Integer> taxList = new ArrayList<Integer>();
MOrderLine[] lines = order.getLines();
for (int i = 0; i < lines.length; i++)
{
MOrderLine line = lines[i];
totalLines = totalLines.add(line.getLineNetAmt());
Integer taxID = new Integer(line.getC_Tax_ID());
if (!taxList.contains(taxID))
{
MOrderTax oTax = MOrderTax.get (line, order.getPrecision(),
false, order.get_TrxName()); // current Tax
if (oTax.getC_TaxProvider_ID() != 0) {
continue;
}
oTax.setIsTaxIncluded(order.isTaxIncluded());
if (!oTax.calculateTaxFromLines())
return false;
if (!oTax.save(order.get_TrxName()))
return false;
taxList.add(taxID);
}
}
// Taxes
BigDecimal grandTotal = totalLines;
MOrderTax[] taxes = order.getTaxes(true);
for (int i = 0; i < taxes.length; i++)
{
MOrderTax oTax = taxes[i];
if (oTax.getC_TaxProvider_ID() != 0) {
if (!order.isTaxIncluded())
grandTotal = grandTotal.add(oTax.getTaxAmt());
continue;
}
MTax tax = oTax.getTax();
if (tax.isSummary())
{
MTax[] cTaxes = tax.getChildTaxes(false);
for (int j = 0; j < cTaxes.length; j++)
{
MTax cTax = cTaxes[j];
BigDecimal taxAmt = cTax.calculateTax(oTax.getTaxBaseAmt(), order.isTaxIncluded(), order.getPrecision());
//
MOrderTax newOTax = new MOrderTax(order.getCtx(), 0, order.get_TrxName());
newOTax.setClientOrg(order);
newOTax.setC_Order_ID(order.getC_Order_ID());
newOTax.setC_Tax_ID(cTax.getC_Tax_ID());
newOTax.setPrecision(order.getPrecision());
newOTax.setIsTaxIncluded(order.isTaxIncluded());
newOTax.setTaxBaseAmt(oTax.getTaxBaseAmt());
newOTax.setTaxAmt(taxAmt);
if (!newOTax.save(order.get_TrxName()))
return false;
//
if (!order.isTaxIncluded())
grandTotal = grandTotal.add(taxAmt);
}
if (!oTax.delete(true, order.get_TrxName()))
return false;
if (!oTax.save(order.get_TrxName()))
return false;
}
else
{
if (!order.isTaxIncluded())
grandTotal = grandTotal.add(oTax.getTaxAmt());
}
}
//
order.setTotalLines(totalLines);
order.setGrandTotal(grandTotal);
return true;
}
@Override
public boolean updateOrderTax(MTaxProvider provider, MOrderLine line) {
MTax mtax = new MTax(line.getCtx(), line.getC_Tax_ID(), line.get_TrxName());
if (mtax.getC_TaxProvider_ID() == 0)
return line.updateOrderTax(false);
return true;
}
@Override
public boolean calculateInvoiceTaxTotal(MTaxProvider provider, MInvoice invoice) {
// Lines
BigDecimal totalLines = Env.ZERO;
ArrayList<Integer> taxList = new ArrayList<Integer>();
MInvoiceLine[] lines = invoice.getLines(false);
for (int i = 0; i < lines.length; i++)
{
MInvoiceLine line = lines[i];
totalLines = totalLines.add(line.getLineNetAmt());
if (!taxList.contains(line.getC_Tax_ID()))
{
MInvoiceTax iTax = MInvoiceTax.get (line, invoice.getPrecision(), false, invoice.get_TrxName()); // current Tax
if (iTax != null)
{
if (iTax.getC_TaxProvider_ID() != 0) {
continue;
}
iTax.setIsTaxIncluded(invoice.isTaxIncluded());
if (!iTax.calculateTaxFromLines())
return false;
iTax.saveEx();
taxList.add(line.getC_Tax_ID());
}
}
}
// Taxes
BigDecimal grandTotal = totalLines;
MInvoiceTax[] taxes = invoice.getTaxes(true);
for (int i = 0; i < taxes.length; i++)
{
MInvoiceTax iTax = taxes[i];
if (iTax.getC_TaxProvider_ID() != 0) {
if (!invoice.isTaxIncluded())
grandTotal = grandTotal.add(iTax.getTaxAmt());
continue;
}
MTax tax = iTax.getTax();
if (tax.isSummary())
{
MTax[] cTaxes = tax.getChildTaxes(false); // Multiple taxes
for (int j = 0; j < cTaxes.length; j++)
{
MTax cTax = cTaxes[j];
BigDecimal taxAmt = cTax.calculateTax(iTax.getTaxBaseAmt(), invoice.isTaxIncluded(), invoice.getPrecision());
//
MInvoiceTax newITax = new MInvoiceTax(invoice.getCtx(), 0, invoice.get_TrxName());
newITax.setClientOrg(invoice);
newITax.setAD_Org_ID(invoice.getAD_Org_ID());
newITax.setC_Invoice_ID(invoice.getC_Invoice_ID());
newITax.setC_Tax_ID(cTax.getC_Tax_ID());
newITax.setPrecision(invoice.getPrecision());
newITax.setIsTaxIncluded(invoice.isTaxIncluded());
newITax.setTaxBaseAmt(iTax.getTaxBaseAmt());
newITax.setTaxAmt(taxAmt);
newITax.saveEx(invoice.get_TrxName());
//
if (!invoice.isTaxIncluded())
grandTotal = grandTotal.add(taxAmt);
}
iTax.deleteEx(true, invoice.get_TrxName());
}
else
{
if (!invoice.isTaxIncluded())
grandTotal = grandTotal.add(iTax.getTaxAmt());
}
}
//
invoice.setTotalLines(totalLines);
invoice.setGrandTotal(grandTotal);
return true;
}
@Override
public boolean updateInvoiceTax(MTaxProvider provider, MInvoiceLine line) {
MTax mtax = new MTax(line.getCtx(), line.getC_Tax_ID(), line.get_TrxName());
if (mtax.getC_TaxProvider_ID() == 0)
return line.updateInvoiceTax(false);
return true;
}
@Override
public boolean recalculateTax(MTaxProvider provider, MInvoiceLine line, boolean newRecord) {
if (!newRecord && line.is_ValueChanged(MInvoiceLine.COLUMNNAME_C_Tax_ID))
{
// Recalculate Tax for old Tax
if (!line.updateInvoiceTax(true))
return false;
}
return line.updateHeaderTax();
}
@Override
public boolean calculateRMATaxTotal(MTaxProvider provider, MRMA rma) {
// Lines
BigDecimal totalLines = Env.ZERO;
ArrayList<Integer> taxList = new ArrayList<Integer>();
MRMALine[] lines = rma.getLines(false);
for (int i = 0; i < lines.length; i++)
{
MRMALine line = lines[i];
totalLines = totalLines.add(line.getLineNetAmt());
Integer taxID = new Integer(line.getC_Tax_ID());
if (!taxList.contains(taxID))
{
MRMATax oTax = MRMATax.get (line, rma.getPrecision(),
false, rma.get_TrxName()); // current Tax
if (oTax.getC_TaxProvider_ID() != 0) {
continue;
}
oTax.setIsTaxIncluded(rma.isTaxIncluded());
if (!oTax.calculateTaxFromLines())
return false;
if (!oTax.save(rma.get_TrxName()))
return false;
taxList.add(taxID);
}
}
// Taxes
BigDecimal grandTotal = totalLines;
MRMATax[] taxes = rma.getTaxes(true);
for (int i = 0; i < taxes.length; i++)
{
MRMATax oTax = taxes[i];
if (oTax.getC_TaxProvider_ID() != 0) {
if (!rma.isTaxIncluded())
grandTotal = grandTotal.add(oTax.getTaxAmt());
continue;
}
MTax tax = oTax.getTax();
if (tax.isSummary())
{
MTax[] cTaxes = tax.getChildTaxes(false);
for (int j = 0; j < cTaxes.length; j++)
{
MTax cTax = cTaxes[j];
BigDecimal taxAmt = cTax.calculateTax(oTax.getTaxBaseAmt(), rma.isTaxIncluded(), rma.getPrecision());
//
MRMATax newOTax = new MRMATax(rma.getCtx(), 0, rma.get_TrxName());
newOTax.setClientOrg(rma);
newOTax.setM_RMA_ID(rma.getM_RMA_ID());
newOTax.setC_Tax_ID(cTax.getC_Tax_ID());
newOTax.setPrecision(rma.getPrecision());
newOTax.setIsTaxIncluded(rma.isTaxIncluded());
newOTax.setTaxBaseAmt(oTax.getTaxBaseAmt());
newOTax.setTaxAmt(taxAmt);
if (!newOTax.save(rma.get_TrxName()))
return false;
//
if (!rma.isTaxIncluded())
grandTotal = grandTotal.add(taxAmt);
}
if (!oTax.delete(true, rma.get_TrxName()))
return false;
if (!oTax.save(rma.get_TrxName()))
return false;
}
else
{
if (!rma.isTaxIncluded())
grandTotal = grandTotal.add(oTax.getTaxAmt());
}
}
//
rma.setAmt(grandTotal);
return true;
}
@Override
public boolean updateRMATax(MTaxProvider provider, MRMALine line) {
MTax mtax = new MTax(line.getCtx(), line.getC_Tax_ID(), line.get_TrxName());
if (mtax.getC_TaxProvider_ID() == 0)
return line.updateOrderTax(false);
return true;
}
@Override
public String validateConnection(MTaxProvider provider, ProcessInfo pi) throws Exception {
throw new IllegalStateException(Msg.getMsg(provider.getCtx(), "ActionNotSupported"));
}
}

View File

@ -0,0 +1,367 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.KeyNamePair;
/** Generated Model for C_AddressTransaction
* @author iDempiere (generated)
* @version Release 1.0c - $Id$ */
public class X_C_AddressTransaction extends PO implements I_C_AddressTransaction, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20130819L;
/** Standard Constructor */
public X_C_AddressTransaction (Properties ctx, int C_AddressTransaction_ID, String trxName)
{
super (ctx, C_AddressTransaction_ID, trxName);
/** if (C_AddressTransaction_ID == 0)
{
setC_AddressTransaction_ID (0);
setC_AddressValidation_ID (0);
setIsValid (false);
// N
setProcessed (false);
// N
} */
}
/** Load Constructor */
public X_C_AddressTransaction (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 3 - Client - Org
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_C_AddressTransaction[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Address 1.
@param Address1
Address line 1 for this location
*/
public void setAddress1 (String Address1)
{
set_Value (COLUMNNAME_Address1, Address1);
}
/** Get Address 1.
@return Address line 1 for this location
*/
public String getAddress1 ()
{
return (String)get_Value(COLUMNNAME_Address1);
}
/** Set Address 2.
@param Address2
Address line 2 for this location
*/
public void setAddress2 (String Address2)
{
set_Value (COLUMNNAME_Address2, Address2);
}
/** Get Address 2.
@return Address line 2 for this location
*/
public String getAddress2 ()
{
return (String)get_Value(COLUMNNAME_Address2);
}
/** Set Address 3.
@param Address3
Address Line 3 for the location
*/
public void setAddress3 (String Address3)
{
set_Value (COLUMNNAME_Address3, Address3);
}
/** Get Address 3.
@return Address Line 3 for the location
*/
public String getAddress3 ()
{
return (String)get_Value(COLUMNNAME_Address3);
}
/** Set Address 4.
@param Address4
Address Line 4 for the location
*/
public void setAddress4 (String Address4)
{
set_Value (COLUMNNAME_Address4, Address4);
}
/** Get Address 4.
@return Address Line 4 for the location
*/
public String getAddress4 ()
{
return (String)get_Value(COLUMNNAME_Address4);
}
/** Set Address Transaction.
@param C_AddressTransaction_ID Address Transaction */
public void setC_AddressTransaction_ID (int C_AddressTransaction_ID)
{
if (C_AddressTransaction_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_AddressTransaction_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_AddressTransaction_ID, Integer.valueOf(C_AddressTransaction_ID));
}
/** Get Address Transaction.
@return Address Transaction */
public int getC_AddressTransaction_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_AddressTransaction_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set C_AddressTransaction_UU.
@param C_AddressTransaction_UU C_AddressTransaction_UU */
public void setC_AddressTransaction_UU (String C_AddressTransaction_UU)
{
set_Value (COLUMNNAME_C_AddressTransaction_UU, C_AddressTransaction_UU);
}
/** Get C_AddressTransaction_UU.
@return C_AddressTransaction_UU */
public String getC_AddressTransaction_UU ()
{
return (String)get_Value(COLUMNNAME_C_AddressTransaction_UU);
}
public org.compiere.model.I_C_AddressValidation getC_AddressValidation() throws RuntimeException
{
return (org.compiere.model.I_C_AddressValidation)MTable.get(getCtx(), org.compiere.model.I_C_AddressValidation.Table_Name)
.getPO(getC_AddressValidation_ID(), get_TrxName()); }
/** Set Address Validation.
@param C_AddressValidation_ID Address Validation */
public void setC_AddressValidation_ID (int C_AddressValidation_ID)
{
if (C_AddressValidation_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_AddressValidation_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_AddressValidation_ID, Integer.valueOf(C_AddressValidation_ID));
}
/** Get Address Validation.
@return Address Validation */
public int getC_AddressValidation_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_AddressValidation_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_C_Location getC_Location() throws RuntimeException
{
return (I_C_Location)MTable.get(getCtx(), I_C_Location.Table_Name)
.getPO(getC_Location_ID(), get_TrxName()); }
/** Set Address.
@param C_Location_ID
Location or Address
*/
public void setC_Location_ID (int C_Location_ID)
{
if (C_Location_ID < 1)
set_Value (COLUMNNAME_C_Location_ID, null);
else
set_Value (COLUMNNAME_C_Location_ID, Integer.valueOf(C_Location_ID));
}
/** Get Address.
@return Location or Address
*/
public int getC_Location_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Location_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set City.
@param City
Identifies a City
*/
public void setCity (String City)
{
set_Value (COLUMNNAME_City, City);
}
/** Get City.
@return Identifies a City
*/
public String getCity ()
{
return (String)get_Value(COLUMNNAME_City);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getCity());
}
/** Set Country.
@param Country Country */
public void setCountry (String Country)
{
set_ValueNoCheck (COLUMNNAME_Country, Country);
}
/** Get Country.
@return Country */
public String getCountry ()
{
return (String)get_Value(COLUMNNAME_Country);
}
/** Set Valid.
@param IsValid
Element is valid
*/
public void setIsValid (boolean IsValid)
{
set_Value (COLUMNNAME_IsValid, Boolean.valueOf(IsValid));
}
/** Get Valid.
@return Element is valid
*/
public boolean isValid ()
{
Object oo = get_Value(COLUMNNAME_IsValid);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set ZIP.
@param Postal
Postal code
*/
public void setPostal (String Postal)
{
set_Value (COLUMNNAME_Postal, Postal);
}
/** Get ZIP.
@return Postal code
*/
public String getPostal ()
{
return (String)get_Value(COLUMNNAME_Postal);
}
/** Set Processed.
@param Processed
The document has been processed
*/
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Processed.
@return The document has been processed
*/
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Region.
@param Region Region */
public void setRegion (String Region)
{
set_ValueNoCheck (COLUMNNAME_Region, Region);
}
/** Get Region.
@return Region */
public String getRegion ()
{
return (String)get_Value(COLUMNNAME_Region);
}
/** Set Result.
@param Result
Result of the action taken
*/
public void setResult (String Result)
{
set_ValueNoCheck (COLUMNNAME_Result, Result);
}
/** Get Result.
@return Result of the action taken
*/
public String getResult ()
{
return (String)get_Value(COLUMNNAME_Result);
}
}

View File

@ -0,0 +1,245 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
/** Generated Model for C_AddressValidation
* @author iDempiere (generated)
* @version Release 1.0c - $Id$ */
public class X_C_AddressValidation extends PO implements I_C_AddressValidation, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20130820L;
/** Standard Constructor */
public X_C_AddressValidation (Properties ctx, int C_AddressValidation_ID, String trxName)
{
super (ctx, C_AddressValidation_ID, trxName);
/** if (C_AddressValidation_ID == 0)
{
setC_AddressValidation_ID (0);
setC_AddressValidationCfg_ID (0);
setConnectionPassword (null);
setName (null);
setSeqNo (0);
setUserID (null);
} */
}
/** Load Constructor */
public X_C_AddressValidation (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 3 - Client - Org
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_C_AddressValidation[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Address Validation.
@param C_AddressValidation_ID Address Validation */
public void setC_AddressValidation_ID (int C_AddressValidation_ID)
{
if (C_AddressValidation_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_AddressValidation_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_AddressValidation_ID, Integer.valueOf(C_AddressValidation_ID));
}
/** Get Address Validation.
@return Address Validation */
public int getC_AddressValidation_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_AddressValidation_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set C_AddressValidation_UU.
@param C_AddressValidation_UU C_AddressValidation_UU */
public void setC_AddressValidation_UU (String C_AddressValidation_UU)
{
set_Value (COLUMNNAME_C_AddressValidation_UU, C_AddressValidation_UU);
}
/** Get C_AddressValidation_UU.
@return C_AddressValidation_UU */
public String getC_AddressValidation_UU ()
{
return (String)get_Value(COLUMNNAME_C_AddressValidation_UU);
}
public org.compiere.model.I_C_AddressValidationCfg getC_AddressValidationCfg() throws RuntimeException
{
return (org.compiere.model.I_C_AddressValidationCfg)MTable.get(getCtx(), org.compiere.model.I_C_AddressValidationCfg.Table_Name)
.getPO(getC_AddressValidationCfg_ID(), get_TrxName()); }
/** Set Address Validation Configuration.
@param C_AddressValidationCfg_ID Address Validation Configuration */
public void setC_AddressValidationCfg_ID (int C_AddressValidationCfg_ID)
{
if (C_AddressValidationCfg_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_AddressValidationCfg_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_AddressValidationCfg_ID, Integer.valueOf(C_AddressValidationCfg_ID));
}
/** Get Address Validation Configuration.
@return Address Validation Configuration */
public int getC_AddressValidationCfg_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_AddressValidationCfg_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Connection Key.
@param ConnectionKey Connection Key */
public void setConnectionKey (String ConnectionKey)
{
set_Value (COLUMNNAME_ConnectionKey, ConnectionKey);
}
/** Get Connection Key.
@return Connection Key */
public String getConnectionKey ()
{
return (String)get_Value(COLUMNNAME_ConnectionKey);
}
/** Set Connection Password.
@param ConnectionPassword Connection Password */
public void setConnectionPassword (String ConnectionPassword)
{
set_Value (COLUMNNAME_ConnectionPassword, ConnectionPassword);
}
/** Get Connection Password.
@return Connection Password */
public String getConnectionPassword ()
{
return (String)get_Value(COLUMNNAME_ConnectionPassword);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Set Sequence.
@param SeqNo
Method of ordering records; lowest number comes first
*/
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Sequence.
@return Method of ordering records; lowest number comes first
*/
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Shipper Account Number.
@param ShipperAccount Shipper Account Number */
public void setShipperAccount (String ShipperAccount)
{
set_Value (COLUMNNAME_ShipperAccount, ShipperAccount);
}
/** Get Shipper Account Number.
@return Shipper Account Number */
public String getShipperAccount ()
{
return (String)get_Value(COLUMNNAME_ShipperAccount);
}
/** Set Shipper Meter.
@param ShipperMeter Shipper Meter */
public void setShipperMeter (String ShipperMeter)
{
set_Value (COLUMNNAME_ShipperMeter, ShipperMeter);
}
/** Get Shipper Meter.
@return Shipper Meter */
public String getShipperMeter ()
{
return (String)get_Value(COLUMNNAME_ShipperMeter);
}
/** Set User ID.
@param UserID
User ID or account number
*/
public void setUserID (String UserID)
{
set_Value (COLUMNNAME_UserID, UserID);
}
/** Get User ID.
@return User ID or account number
*/
public String getUserID ()
{
return (String)get_Value(COLUMNNAME_UserID);
}
}

View File

@ -0,0 +1,287 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.KeyNamePair;
/** Generated Model for C_AddressValidationCfg
* @author iDempiere (generated)
* @version Release 1.0c - $Id$ */
public class X_C_AddressValidationCfg extends PO implements I_C_AddressValidationCfg, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20130820L;
/** Standard Constructor */
public X_C_AddressValidationCfg (Properties ctx, int C_AddressValidationCfg_ID, String trxName)
{
super (ctx, C_AddressValidationCfg_ID, trxName);
/** if (C_AddressValidationCfg_ID == 0)
{
setC_AddressValidationCfg_ID (0);
setHostAddress (null);
setHostPort (0);
setName (null);
} */
}
/** Load Constructor */
public X_C_AddressValidationCfg (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 6 - System - Client
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_C_AddressValidationCfg[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Address Validation Class.
@param AddressValidationClass Address Validation Class */
public void setAddressValidationClass (String AddressValidationClass)
{
set_Value (COLUMNNAME_AddressValidationClass, AddressValidationClass);
}
/** Get Address Validation Class.
@return Address Validation Class */
public String getAddressValidationClass ()
{
return (String)get_Value(COLUMNNAME_AddressValidationClass);
}
/** Set Address Validation Configuration.
@param C_AddressValidationCfg_ID Address Validation Configuration */
public void setC_AddressValidationCfg_ID (int C_AddressValidationCfg_ID)
{
if (C_AddressValidationCfg_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_AddressValidationCfg_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_AddressValidationCfg_ID, Integer.valueOf(C_AddressValidationCfg_ID));
}
/** Get Address Validation Configuration.
@return Address Validation Configuration */
public int getC_AddressValidationCfg_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_AddressValidationCfg_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set C_AddressValidationCfg_UU.
@param C_AddressValidationCfg_UU C_AddressValidationCfg_UU */
public void setC_AddressValidationCfg_UU (String C_AddressValidationCfg_UU)
{
set_Value (COLUMNNAME_C_AddressValidationCfg_UU, C_AddressValidationCfg_UU);
}
/** Get C_AddressValidationCfg_UU.
@return C_AddressValidationCfg_UU */
public String getC_AddressValidationCfg_UU ()
{
return (String)get_Value(COLUMNNAME_C_AddressValidationCfg_UU);
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Host Address.
@param HostAddress
Host Address URL or DNS
*/
public void setHostAddress (String HostAddress)
{
set_Value (COLUMNNAME_HostAddress, HostAddress);
}
/** Get Host Address.
@return Host Address URL or DNS
*/
public String getHostAddress ()
{
return (String)get_Value(COLUMNNAME_HostAddress);
}
/** Set Host port.
@param HostPort
Host Communication Port
*/
public void setHostPort (int HostPort)
{
set_Value (COLUMNNAME_HostPort, Integer.valueOf(HostPort));
}
/** Get Host port.
@return Host Communication Port
*/
public int getHostPort ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_HostPort);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Proxy address.
@param ProxyAddress
Address of your proxy server
*/
public void setProxyAddress (String ProxyAddress)
{
set_Value (COLUMNNAME_ProxyAddress, ProxyAddress);
}
/** Get Proxy address.
@return Address of your proxy server
*/
public String getProxyAddress ()
{
return (String)get_Value(COLUMNNAME_ProxyAddress);
}
/** Set Proxy logon.
@param ProxyLogon
Logon of your proxy server
*/
public void setProxyLogon (String ProxyLogon)
{
set_Value (COLUMNNAME_ProxyLogon, ProxyLogon);
}
/** Get Proxy logon.
@return Logon of your proxy server
*/
public String getProxyLogon ()
{
return (String)get_Value(COLUMNNAME_ProxyLogon);
}
/** Set Proxy password.
@param ProxyPassword
Password of your proxy server
*/
public void setProxyPassword (String ProxyPassword)
{
set_Value (COLUMNNAME_ProxyPassword, ProxyPassword);
}
/** Get Proxy password.
@return Password of your proxy server
*/
public String getProxyPassword ()
{
return (String)get_Value(COLUMNNAME_ProxyPassword);
}
/** Set Proxy port.
@param ProxyPort
Port of your proxy server
*/
public void setProxyPort (int ProxyPort)
{
set_Value (COLUMNNAME_ProxyPort, Integer.valueOf(ProxyPort));
}
/** Get Proxy port.
@return Port of your proxy server
*/
public int getProxyPort ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_ProxyPort);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Service Path.
@param ServicePath Service Path */
public void setServicePath (String ServicePath)
{
set_Value (COLUMNNAME_ServicePath, ServicePath);
}
/** Get Service Path.
@return Service Path */
public String getServicePath ()
{
return (String)get_Value(COLUMNNAME_ServicePath);
}
}

View File

@ -31,7 +31,7 @@ public class X_C_InvoiceTax extends PO implements I_C_InvoiceTax, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20130626L;
private static final long serialVersionUID = 20130820L;
/** Standard Constructor */
public X_C_InvoiceTax (Properties ctx, int C_InvoiceTax_ID, String trxName)
@ -146,6 +146,31 @@ public class X_C_InvoiceTax extends PO implements I_C_InvoiceTax, I_Persistent
return ii.intValue();
}
public org.compiere.model.I_C_TaxProvider getC_TaxProvider() throws RuntimeException
{
return (org.compiere.model.I_C_TaxProvider)MTable.get(getCtx(), org.compiere.model.I_C_TaxProvider.Table_Name)
.getPO(getC_TaxProvider_ID(), get_TrxName()); }
/** Set Tax Provider.
@param C_TaxProvider_ID Tax Provider */
public void setC_TaxProvider_ID (int C_TaxProvider_ID)
{
if (C_TaxProvider_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_TaxProvider_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_TaxProvider_ID, Integer.valueOf(C_TaxProvider_ID));
}
/** Get Tax Provider.
@return Tax Provider */
public int getC_TaxProvider_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_TaxProvider_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Price includes Tax.
@param IsTaxIncluded
Tax is included in the price

View File

@ -30,7 +30,7 @@ public class X_C_Location extends PO implements I_C_Location, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20130626L;
private static final long serialVersionUID = 20130819L;
/** Standard Constructor */
public X_C_Location (Properties ctx, int C_Location_ID, String trxName)
@ -139,6 +139,31 @@ public class X_C_Location extends PO implements I_C_Location, I_Persistent
return (String)get_Value(COLUMNNAME_Address4);
}
public org.compiere.model.I_C_AddressValidation getC_AddressValidation() throws RuntimeException
{
return (org.compiere.model.I_C_AddressValidation)MTable.get(getCtx(), org.compiere.model.I_C_AddressValidation.Table_Name)
.getPO(getC_AddressValidation_ID(), get_TrxName()); }
/** Set Address Validation.
@param C_AddressValidation_ID Address Validation */
public void setC_AddressValidation_ID (int C_AddressValidation_ID)
{
if (C_AddressValidation_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_AddressValidation_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_AddressValidation_ID, Integer.valueOf(C_AddressValidation_ID));
}
/** Get Address Validation.
@return Address Validation */
public int getC_AddressValidation_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_AddressValidation_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_City getC_City() throws RuntimeException
{
return (org.compiere.model.I_C_City)MTable.get(getCtx(), org.compiere.model.I_C_City.Table_Name)
@ -195,31 +220,6 @@ public class X_C_Location extends PO implements I_C_Location, I_Persistent
return ii.intValue();
}
/** Set City.
@param City
Identifies a City
*/
public void setCity (String City)
{
set_Value (COLUMNNAME_City, City);
}
/** Get City.
@return Identifies a City
*/
public String getCity ()
{
return (String)get_Value(COLUMNNAME_City);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getCity());
}
/** Set Address.
@param C_Location_ID
Location or Address
@ -285,6 +285,55 @@ public class X_C_Location extends PO implements I_C_Location, I_Persistent
return ii.intValue();
}
/** Set City.
@param City
Identifies a City
*/
public void setCity (String City)
{
set_Value (COLUMNNAME_City, City);
}
/** Get City.
@return Identifies a City
*/
public String getCity ()
{
return (String)get_Value(COLUMNNAME_City);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getCity());
}
/** Set Valid.
@param IsValid
Element is valid
*/
public void setIsValid (boolean IsValid)
{
set_ValueNoCheck (COLUMNNAME_IsValid, Boolean.valueOf(IsValid));
}
/** Get Valid.
@return Element is valid
*/
public boolean isValid ()
{
Object oo = get_Value(COLUMNNAME_IsValid);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set ZIP.
@param Postal
Postal code
@ -335,4 +384,35 @@ public class X_C_Location extends PO implements I_C_Location, I_Persistent
{
return (String)get_Value(COLUMNNAME_RegionName);
}
/** Set Result.
@param Result
Result of the action taken
*/
public void setResult (String Result)
{
set_ValueNoCheck (COLUMNNAME_Result, Result);
}
/** Get Result.
@return Result of the action taken
*/
public String getResult ()
{
return (String)get_Value(COLUMNNAME_Result);
}
/** Set Validate Address.
@param ValidateAddress Validate Address */
public void setValidateAddress (String ValidateAddress)
{
set_Value (COLUMNNAME_ValidateAddress, ValidateAddress);
}
/** Get Validate Address.
@return Validate Address */
public String getValidateAddress ()
{
return (String)get_Value(COLUMNNAME_ValidateAddress);
}
}

View File

@ -31,7 +31,7 @@ public class X_C_OrderTax extends PO implements I_C_OrderTax, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20130626L;
private static final long serialVersionUID = 20130820L;
/** Standard Constructor */
public X_C_OrderTax (Properties ctx, int C_OrderTax_ID, String trxName)
@ -146,6 +146,31 @@ public class X_C_OrderTax extends PO implements I_C_OrderTax, I_Persistent
return ii.intValue();
}
public org.compiere.model.I_C_TaxProvider getC_TaxProvider() throws RuntimeException
{
return (org.compiere.model.I_C_TaxProvider)MTable.get(getCtx(), org.compiere.model.I_C_TaxProvider.Table_Name)
.getPO(getC_TaxProvider_ID(), get_TrxName()); }
/** Set Tax Provider.
@param C_TaxProvider_ID Tax Provider */
public void setC_TaxProvider_ID (int C_TaxProvider_ID)
{
if (C_TaxProvider_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_TaxProvider_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_TaxProvider_ID, Integer.valueOf(C_TaxProvider_ID));
}
/** Get Tax Provider.
@return Tax Provider */
public int getC_TaxProvider_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_TaxProvider_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Price includes Tax.
@param IsTaxIncluded
Tax is included in the price

View File

@ -33,7 +33,7 @@ public class X_C_Tax extends PO implements I_C_Tax, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20130626L;
private static final long serialVersionUID = 20130820L;
/** Standard Constructor */
public X_C_Tax (Properties ctx, int C_Tax_ID, String trxName)
@ -41,8 +41,8 @@ public class X_C_Tax extends PO implements I_C_Tax, I_Persistent
super (ctx, C_Tax_ID, trxName);
/** if (C_Tax_ID == 0)
{
setC_TaxCategory_ID (0);
setC_Tax_ID (0);
setC_TaxCategory_ID (0);
setIsDefault (false);
setIsDocumentLevel (false);
setIsSalesTax (false);
@ -162,34 +162,6 @@ public class X_C_Tax extends PO implements I_C_Tax, I_Persistent
return ii.intValue();
}
public org.compiere.model.I_C_TaxCategory getC_TaxCategory() throws RuntimeException
{
return (org.compiere.model.I_C_TaxCategory)MTable.get(getCtx(), org.compiere.model.I_C_TaxCategory.Table_Name)
.getPO(getC_TaxCategory_ID(), get_TrxName()); }
/** Set Tax Category.
@param C_TaxCategory_ID
Tax Category
*/
public void setC_TaxCategory_ID (int C_TaxCategory_ID)
{
if (C_TaxCategory_ID < 1)
set_Value (COLUMNNAME_C_TaxCategory_ID, null);
else
set_Value (COLUMNNAME_C_TaxCategory_ID, Integer.valueOf(C_TaxCategory_ID));
}
/** Get Tax Category.
@return Tax Category
*/
public int getC_TaxCategory_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_TaxCategory_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Tax.
@param C_Tax_ID
Tax identifier
@ -227,6 +199,59 @@ public class X_C_Tax extends PO implements I_C_Tax, I_Persistent
return (String)get_Value(COLUMNNAME_C_Tax_UU);
}
public org.compiere.model.I_C_TaxCategory getC_TaxCategory() throws RuntimeException
{
return (org.compiere.model.I_C_TaxCategory)MTable.get(getCtx(), org.compiere.model.I_C_TaxCategory.Table_Name)
.getPO(getC_TaxCategory_ID(), get_TrxName()); }
/** Set Tax Category.
@param C_TaxCategory_ID
Tax Category
*/
public void setC_TaxCategory_ID (int C_TaxCategory_ID)
{
if (C_TaxCategory_ID < 1)
set_Value (COLUMNNAME_C_TaxCategory_ID, null);
else
set_Value (COLUMNNAME_C_TaxCategory_ID, Integer.valueOf(C_TaxCategory_ID));
}
/** Get Tax Category.
@return Tax Category
*/
public int getC_TaxCategory_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_TaxCategory_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_TaxProvider getC_TaxProvider() throws RuntimeException
{
return (org.compiere.model.I_C_TaxProvider)MTable.get(getCtx(), org.compiere.model.I_C_TaxProvider.Table_Name)
.getPO(getC_TaxProvider_ID(), get_TrxName()); }
/** Set Tax Provider.
@param C_TaxProvider_ID Tax Provider */
public void setC_TaxProvider_ID (int C_TaxProvider_ID)
{
if (C_TaxProvider_ID < 1)
set_Value (COLUMNNAME_C_TaxProvider_ID, null);
else
set_Value (COLUMNNAME_C_TaxProvider_ID, Integer.valueOf(C_TaxProvider_ID));
}
/** Get Tax Provider.
@return Tax Provider */
public int getC_TaxProvider_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_TaxProvider_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Description.
@param Description
Optional short description of the record

View File

@ -0,0 +1,227 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
/** Generated Model for C_TaxProvider
* @author iDempiere (generated)
* @version Release 1.0c - $Id$ */
public class X_C_TaxProvider extends PO implements I_C_TaxProvider, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20130820L;
/** Standard Constructor */
public X_C_TaxProvider (Properties ctx, int C_TaxProvider_ID, String trxName)
{
super (ctx, C_TaxProvider_ID, trxName);
/** if (C_TaxProvider_ID == 0)
{
setC_TaxProvider_ID (0);
setC_TaxProviderCfg_ID (0);
setName (null);
setSeqNo (0);
// 0
} */
}
/** Load Constructor */
public X_C_TaxProvider (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 3 - Client - Org
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_C_TaxProvider[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Account.
@param Account Account */
public void setAccount (String Account)
{
set_Value (COLUMNNAME_Account, Account);
}
/** Get Account.
@return Account */
public String getAccount ()
{
return (String)get_Value(COLUMNNAME_Account);
}
/** Set Tax Provider.
@param C_TaxProvider_ID Tax Provider */
public void setC_TaxProvider_ID (int C_TaxProvider_ID)
{
if (C_TaxProvider_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_TaxProvider_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_TaxProvider_ID, Integer.valueOf(C_TaxProvider_ID));
}
/** Get Tax Provider.
@return Tax Provider */
public int getC_TaxProvider_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_TaxProvider_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set C_TaxProvider_UU.
@param C_TaxProvider_UU C_TaxProvider_UU */
public void setC_TaxProvider_UU (String C_TaxProvider_UU)
{
set_Value (COLUMNNAME_C_TaxProvider_UU, C_TaxProvider_UU);
}
/** Get C_TaxProvider_UU.
@return C_TaxProvider_UU */
public String getC_TaxProvider_UU ()
{
return (String)get_Value(COLUMNNAME_C_TaxProvider_UU);
}
public org.compiere.model.I_C_TaxProviderCfg getC_TaxProviderCfg() throws RuntimeException
{
return (org.compiere.model.I_C_TaxProviderCfg)MTable.get(getCtx(), org.compiere.model.I_C_TaxProviderCfg.Table_Name)
.getPO(getC_TaxProviderCfg_ID(), get_TrxName()); }
/** Set Tax Provider Configuration.
@param C_TaxProviderCfg_ID Tax Provider Configuration */
public void setC_TaxProviderCfg_ID (int C_TaxProviderCfg_ID)
{
if (C_TaxProviderCfg_ID < 1)
set_Value (COLUMNNAME_C_TaxProviderCfg_ID, null);
else
set_Value (COLUMNNAME_C_TaxProviderCfg_ID, Integer.valueOf(C_TaxProviderCfg_ID));
}
/** Get Tax Provider Configuration.
@return Tax Provider Configuration */
public int getC_TaxProviderCfg_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_TaxProviderCfg_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Company Code.
@param CompanyCode Company Code */
public void setCompanyCode (String CompanyCode)
{
set_Value (COLUMNNAME_CompanyCode, CompanyCode);
}
/** Get Company Code.
@return Company Code */
public String getCompanyCode ()
{
return (String)get_Value(COLUMNNAME_CompanyCode);
}
/** Set License.
@param License License */
public void setLicense (String License)
{
set_Value (COLUMNNAME_License, License);
}
/** Get License.
@return License */
public String getLicense ()
{
return (String)get_Value(COLUMNNAME_License);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Set Sequence.
@param SeqNo
Method of ordering records; lowest number comes first
*/
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Sequence.
@return Method of ordering records; lowest number comes first
*/
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Validate Connection.
@param ValidateConnection Validate Connection */
public void setValidateConnection (String ValidateConnection)
{
set_Value (COLUMNNAME_ValidateConnection, ValidateConnection);
}
/** Get Validate Connection.
@return Validate Connection */
public String getValidateConnection ()
{
return (String)get_Value(COLUMNNAME_ValidateConnection);
}
}

View File

@ -0,0 +1,171 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
/** Generated Model for C_TaxProviderCfg
* @author iDempiere (generated)
* @version Release 1.0c - $Id$ */
public class X_C_TaxProviderCfg extends PO implements I_C_TaxProviderCfg, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20130820L;
/** Standard Constructor */
public X_C_TaxProviderCfg (Properties ctx, int C_TaxProviderCfg_ID, String trxName)
{
super (ctx, C_TaxProviderCfg_ID, trxName);
/** if (C_TaxProviderCfg_ID == 0)
{
setC_TaxProviderCfg_ID (0);
setName (null);
} */
}
/** Load Constructor */
public X_C_TaxProviderCfg (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 6 - System - Client
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_C_TaxProviderCfg[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Tax Provider Configuration.
@param C_TaxProviderCfg_ID Tax Provider Configuration */
public void setC_TaxProviderCfg_ID (int C_TaxProviderCfg_ID)
{
if (C_TaxProviderCfg_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_TaxProviderCfg_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_TaxProviderCfg_ID, Integer.valueOf(C_TaxProviderCfg_ID));
}
/** Get Tax Provider Configuration.
@return Tax Provider Configuration */
public int getC_TaxProviderCfg_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_TaxProviderCfg_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set C_TaxProviderCfg_UU.
@param C_TaxProviderCfg_UU C_TaxProviderCfg_UU */
public void setC_TaxProviderCfg_UU (String C_TaxProviderCfg_UU)
{
set_Value (COLUMNNAME_C_TaxProviderCfg_UU, C_TaxProviderCfg_UU);
}
/** Get C_TaxProviderCfg_UU.
@return C_TaxProviderCfg_UU */
public String getC_TaxProviderCfg_UU ()
{
return (String)get_Value(COLUMNNAME_C_TaxProviderCfg_UU);
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Set Tax Provider Class.
@param TaxProviderClass Tax Provider Class */
public void setTaxProviderClass (String TaxProviderClass)
{
set_Value (COLUMNNAME_TaxProviderClass, TaxProviderClass);
}
/** Get Tax Provider Class.
@return Tax Provider Class */
public String getTaxProviderClass ()
{
return (String)get_Value(COLUMNNAME_TaxProviderClass);
}
/** Set URL.
@param URL
Full URL address - e.g. http://www.idempiere.org
*/
public void setURL (String URL)
{
set_Value (COLUMNNAME_URL, URL);
}
/** Get URL.
@return Full URL address - e.g. http://www.idempiere.org
*/
public String getURL ()
{
return (String)get_Value(COLUMNNAME_URL);
}
}

View File

@ -31,7 +31,7 @@ public class X_M_RMATax extends PO implements I_M_RMATax, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20130626L;
private static final long serialVersionUID = 20130820L;
/** Standard Constructor */
public X_M_RMATax (Properties ctx, int M_RMATax_ID, String trxName)
@ -104,6 +104,31 @@ public class X_M_RMATax extends PO implements I_M_RMATax, I_Persistent
return ii.intValue();
}
public org.compiere.model.I_C_TaxProvider getC_TaxProvider() throws RuntimeException
{
return (org.compiere.model.I_C_TaxProvider)MTable.get(getCtx(), org.compiere.model.I_C_TaxProvider.Table_Name)
.getPO(getC_TaxProvider_ID(), get_TrxName()); }
/** Set Tax Provider.
@param C_TaxProvider_ID Tax Provider */
public void setC_TaxProvider_ID (int C_TaxProvider_ID)
{
if (C_TaxProvider_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_TaxProvider_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_TaxProvider_ID, Integer.valueOf(C_TaxProvider_ID));
}
/** Get Tax Provider.
@return Tax Provider */
public int getC_TaxProvider_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_TaxProvider_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Price includes Tax.
@param IsTaxIncluded
Tax is included in the price

View File

@ -40,16 +40,20 @@ import org.compiere.apps.ADialog;
import org.compiere.apps.AEnv;
import org.compiere.apps.ConfirmPanel;
import org.compiere.model.GridField;
import org.compiere.model.MAddressValidation;
import org.compiere.model.MBPartnerLocation;
import org.compiere.model.MCountry;
import org.compiere.model.MLocation;
import org.compiere.model.MOrgInfo;
import org.compiere.model.MRegion;
import org.compiere.model.MSysConfig;
import org.compiere.swing.CButton;
import org.compiere.swing.CCheckBox;
import org.compiere.swing.CComboBoxEditable;
import org.compiere.swing.CDialog;
import org.compiere.swing.CLabel;
import org.compiere.swing.CPanel;
import org.compiere.swing.CTextArea;
import org.compiere.swing.CTextField;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
@ -87,7 +91,7 @@ public class VLocationDialog extends CDialog
/**
*
*/
private static final long serialVersionUID = -5915071456635949972L;
private static final long serialVersionUID = -5279612834653363233L;
/** Lookup result header */
private Object[] header = null;
@ -216,6 +220,11 @@ public class VLocationDialog extends CDialog
private JButton toLink = new JButton();
private JButton toRoute = new JButton();
private CComboBoxEditable lstAddressValidation = new CComboBoxEditable();
private CButton btnOnline = new CButton();
private CTextArea txtResult = new CTextArea(3, 30);
private CCheckBox cbxValid = new CCheckBox();
//END
/**
@ -250,6 +259,12 @@ public class VLocationDialog extends CDialog
toRoute.setVisible(false);
//END
btnOnline.setText(Msg.getElement(Env.getCtx(), "ValidateAddress"));
btnOnline.addActionListener(this);
txtResult.setReadWrite(false);
cbxValid.setReadWrite(false);
//
confirmPanel.addActionListener(this);
//
@ -388,6 +403,31 @@ public class VLocationDialog extends CDialog
if (!fCountry.getSelectedItem().equals(country))
fCountry.setSelectedItem(country);
}
if (MSysConfig.getBooleanValue(MSysConfig.ADDRESS_VALIDATION, false, Env.getAD_Client_ID(Env.getCtx())))
{
addLine(line++, new CLabel(Msg.getElement(Env.getCtx(), "C_AddressValidation_ID")), lstAddressValidation);
MAddressValidation[] validations = MAddressValidation.getAddressValidation(Env.getCtx(), Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx()), null);
for (MAddressValidation validation : validations)
{
lstAddressValidation.addItem(validation);
if (m_location.getC_AddressValidation_ID() == validation.getC_AddressValidation_ID())
lstAddressValidation.setSelectedItem(validation);
}
if (lstAddressValidation.getSelectedIndex() == -1 && lstAddressValidation.getItemCount() > 0)
lstAddressValidation.setSelectedIndex(0);
addLine(line++, new CLabel(Msg.getElement(Env.getCtx(), "Result")), txtResult);
txtResult.setText(m_location.getResult());
addLine(line++, new CLabel(Msg.getElement(Env.getCtx(), "IsValid")), cbxValid);
cbxValid.setSelected(m_location.isValid());
addLine(line++, new JLabel(), btnOnline);
}
// Update UI
pack();
} // initLocation
@ -534,6 +574,65 @@ public class VLocationDialog extends CDialog
}
}
//END
else if (e.getSource() == btnOnline)
{
btnOnline.setEnabled(false);
inOKAction = true;
if (m_location.getCountry().isHasRegion() && fRegion.getSelectedItem() == null) {
if (fCityAutoCompleter.getC_Region_ID() > 0 && fCityAutoCompleter.getC_Region_ID() != m_location.getC_Region_ID()) {
fRegion.setSelectedItem(MRegion.get(Env.getCtx(), fCityAutoCompleter.getC_Region_ID()));
m_location.setRegion(MRegion.get(Env.getCtx(), fCityAutoCompleter.getC_Region_ID()));
}
}
String msg = validate_OK();
if (msg != null) {
ADialog.error(0, this, "FillMandatory", Msg.parseTranslation(Env.getCtx(), msg));
inOKAction = false;
return;
}
MLocation m_location = new MLocation(Env.getCtx(), 0, null);
m_location.setAddress1(fAddress1.getText());
m_location.setAddress2(fAddress2.getText());
m_location.setAddress3(fAddress3.getText());
m_location.setAddress4(fAddress4.getText());
m_location.setCity(fCity.getText());
m_location.setC_City_ID(fCityAutoCompleter.getC_City_ID());
m_location.setPostal(fPostal.getText());
m_location.setPostal_Add(fPostalAdd.getText());
// Country/Region
MCountry c = (MCountry)fCountry.getSelectedItem();
m_location.setCountry(c);
if (m_location.getCountry().isHasRegion())
{
MRegion r = (MRegion)fRegion.getSelectedItem();
m_location.setRegion(r);
}
else
m_location.setC_Region_ID(0);
MAddressValidation validation = (MAddressValidation) lstAddressValidation.getSelectedItem();
if (validation == null && lstAddressValidation.getItemCount() > 0)
validation = (MAddressValidation) lstAddressValidation.getItemAt(0);
if (validation != null)
{
boolean ok = m_location.processOnline(validation.getC_AddressValidation_ID());
txtResult.setText(m_location.getResult());
cbxValid.setSelected(m_location.isValid());
lstAddressValidation.setSelectedItem(m_location.getC_AddressValidation());
if (!ok)
ADialog.error(0, this, "Error", m_location.getErrorMessage());
}
inOKAction = false;
btnOnline.setEnabled(true);
}
else if (e.getSource() == fOnline)
{
@ -605,6 +704,13 @@ public class VLocationDialog extends CDialog
}
else
m_location.setC_Region_ID(0);
if (lstAddressValidation.getSelectedIndex() != -1)
{
MAddressValidation validation = (MAddressValidation) lstAddressValidation.getSelectedItem();
m_location.setC_AddressValidation_ID(validation.getC_AddressValidation_ID());
}
// Save changes
boolean success = false;
if (m_location.save())

View File

@ -29,6 +29,7 @@ import java.util.logging.Level;
import org.adempiere.util.Callback;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.Columns;
import org.adempiere.webui.component.ConfirmPanel;
@ -39,14 +40,17 @@ import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.Window;
import org.compiere.model.GridField;
import org.compiere.model.MAddressValidation;
import org.compiere.model.MBPartnerLocation;
import org.compiere.model.MCountry;
import org.compiere.model.MLocation;
import org.compiere.model.MOrgInfo;
import org.compiere.model.MRegion;
import org.compiere.model.MSysConfig;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -57,6 +61,7 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Cell;
import org.zkoss.zul.Center;
import org.zkoss.zul.South;
import org.zkoss.zul.Vbox;
@ -83,7 +88,7 @@ public class WLocationDialog extends Window implements EventListener<Event>
/**
*
*/
private static final long serialVersionUID = -8511642461845783366L;
private static final long serialVersionUID = -6213326035184139513L;
private static final String LABEL_STYLE = "white-space: nowrap;";
/** Logger */
private static CLogger log = CLogger.getCLogger(WLocationDialog.class);
@ -137,6 +142,12 @@ public class WLocationDialog extends Window implements EventListener<Event>
private Button toLink;
private Button toRoute;
private Listbox lstAddressValidation;
private Button btnOnline;
private Textbox txtResult;
private Checkbox cbxValid;
private GridField m_GridField = null;
private boolean onSaveError = false;
//END
@ -263,6 +274,25 @@ public class WLocationDialog extends Window implements EventListener<Event>
LayoutUtils.addSclass("txt-btn", toRoute);
toRoute.addEventListener(Events.ON_CLICK,this);
btnOnline = new Button(Msg.getElement(Env.getCtx(), "ValidateAddress"));
LayoutUtils.addSclass("txt-btn", btnOnline);
btnOnline.addEventListener(Events.ON_CLICK,this);
txtResult = new Textbox();
txtResult.setCols(2);
txtResult.setRows(3);
txtResult.setHeight("100%");
txtResult.setReadonly(true);
cbxValid = new Checkbox();
cbxValid.setText(Msg.getElement(Env.getCtx(), "IsValid"));
cbxValid.setDisabled(true);
lstAddressValidation = new Listbox();
lstAddressValidation.setMold("select");
lstAddressValidation.setWidth("154px");
lstAddressValidation.setRows(0);
mainPanel = GridFactory.newGridLayout();
}
@ -349,6 +379,52 @@ public class WLocationDialog extends Window implements EventListener<Event>
vbox.appendChild(mainPanel);
if (MLocation.LOCATION_MAPS_URL_PREFIX != null || MLocation.LOCATION_MAPS_ROUTE_PREFIX != null)
vbox.appendChild(pnlLinks);
if (MSysConfig.getBooleanValue(MSysConfig.ADDRESS_VALIDATION, false, Env.getAD_Client_ID(Env.getCtx())))
{
Grid grid = GridFactory.newGridLayout();
vbox.appendChild(grid);
columns = new Columns();
grid.appendChild(columns);
Rows rows = new Rows();
grid.appendChild(rows);
Row row = new Row();
rows.appendChild(row);
row.appendCellChild(lstAddressValidation, 2);
lstAddressValidation.setHflex("1");
MAddressValidation[] validations = MAddressValidation.getAddressValidation(Env.getCtx(), Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx()), null);
for (MAddressValidation validation : validations)
{
ListItem li = lstAddressValidation.appendItem(validation.getName(), validation);
if (m_location.getC_AddressValidation_ID() == validation.getC_AddressValidation_ID())
lstAddressValidation.setSelectedItem(li);
}
if (lstAddressValidation.getSelectedIndex() == -1 && lstAddressValidation.getChildren().size() > 0)
lstAddressValidation.setSelectedIndex(0);
row = new Row();
rows.appendChild(row);
row.appendCellChild(txtResult, 2);
txtResult.setHflex("1");
txtResult.setText(m_location.getResult());
row = new Row();
rows.appendChild(row);
row.appendChild(cbxValid);
cbxValid.setChecked(m_location.isValid());
Cell cell = new Cell();
cell.setColspan(1);
cell.setRowspan(1);
cell.appendChild(btnOnline);
cell.setAlign("right");
row.appendChild(cell);
}
vbox.setVflex("1");
vbox.setHflex("1");
@ -626,6 +702,92 @@ public class WLocationDialog extends Window implements EventListener<Event>
}
}
}
else if (btnOnline.equals(event.getTarget()))
{
btnOnline.setEnabled(false);
onSaveError = false;
inOKAction = true;
if (m_location.getCountry().isHasRegion() && lstRegion.getSelectedItem() == null) {
if (txtCity.getC_Region_ID() > 0 && txtCity.getC_Region_ID() != m_location.getC_Region_ID()) {
m_location.setRegion(MRegion.get(Env.getCtx(), txtCity.getC_Region_ID()));
setRegion();
}
}
String msg = validate_OK();
if (msg != null) {
onSaveError = true;
FDialog.error(0, this, "FillMandatory", Msg.parseTranslation(Env.getCtx(), msg), new Callback<Integer>() {
@Override
public void onCallback(Integer result) {
Events.echoEvent("onSaveError", WLocationDialog.this, null);
}
});
inOKAction = false;
return;
}
MLocation m_location = new MLocation(Env.getCtx(), 0, null);
m_location.setAddress1(txtAddress1.getValue());
m_location.setAddress2(txtAddress2.getValue());
m_location.setAddress3(txtAddress3.getValue());
m_location.setAddress4(txtAddress4.getValue());
m_location.setC_City_ID(txtCity.getC_City_ID());
m_location.setCity(txtCity.getValue());
m_location.setPostal(txtPostal.getValue());
// Country/Region
MCountry country = (MCountry)lstCountry.getSelectedItem().getValue();
m_location.setCountry(country);
if (country.isHasRegion() && lstRegion.getSelectedItem() != null)
{
MRegion r = (MRegion)lstRegion.getSelectedItem().getValue();
m_location.setRegion(r);
}
else
{
m_location.setC_Region_ID(0);
}
MAddressValidation validation = lstAddressValidation.getSelectedItem().getValue();
if (validation == null && lstAddressValidation.getChildren().size() > 0)
validation = lstAddressValidation.getItemAtIndex(0).getValue();
if (validation != null)
{
boolean ok = m_location.processOnline(validation.getC_AddressValidation_ID());
txtResult.setText(m_location.getResult());
cbxValid.setChecked(m_location.isValid());
List<?> list = lstAddressValidation.getChildren();
Iterator<?> iter = list.iterator();
while (iter.hasNext())
{
ListItem listitem = (ListItem)iter.next();
if (m_location.getC_AddressValidation().equals(listitem.getValue()))
{
lstAddressValidation.setSelectedItem(listitem);
break;
}
}
if (!ok)
{
onSaveError = true;
FDialog.error(0, this, "Error", m_location.getErrorMessage(), new Callback<Integer>() {
@Override
public void onCallback(Integer result) {
Events.echoEvent("onSaveError", WLocationDialog.this, null);
}
});
}
}
inOKAction = false;
btnOnline.setEnabled(true);
}
// Country Changed - display in new Format
else if (lstCountry.equals(event.getTarget()))
{
@ -720,6 +882,13 @@ public class WLocationDialog extends Window implements EventListener<Event>
{
m_location.setC_Region_ID(0);
}
if (lstAddressValidation.getSelectedIndex() != -1)
{
MAddressValidation validation = (MAddressValidation) lstAddressValidation.getSelectedItem().getValue();
m_location.setC_AddressValidation_ID(validation.getC_AddressValidation_ID());
}
// Save changes
boolean success = false;
if (m_location.save())