FR [2170521] Add charge to Import Order

https://sourceforge.net/tracker2/?func=detail&aid=2170521&group_id=176962&atid=879335
This commit is contained in:
phib 2008-10-16 05:31:20 +00:00
parent 3b36c31ee3
commit 671a543f62
5 changed files with 210 additions and 0 deletions

View File

@ -193,6 +193,21 @@ public interface I_I_Order
public I_C_Campaign getC_Campaign() throws Exception;
/** Column name C_Charge_ID */
public static final String COLUMNNAME_C_Charge_ID = "C_Charge_ID";
/** Set Charge.
* Additional document charges
*/
public void setC_Charge_ID (int C_Charge_ID);
/** Get Charge.
* Additional document charges
*/
public int getC_Charge_ID();
public I_C_Charge getC_Charge() throws Exception;
/** Column name C_Country_ID */
public static final String COLUMNNAME_C_Country_ID = "C_Country_ID";
@ -238,6 +253,19 @@ public interface I_I_Order
public I_C_DocType getC_DocType() throws Exception;
/** Column name ChargeName */
public static final String COLUMNNAME_ChargeName = "ChargeName";
/** Set Charge Name.
* Name of the Charge
*/
public void setChargeName (String ChargeName);
/** Get Charge Name.
* Name of the Charge
*/
public String getChargeName();
/** Column name City */
public static final String COLUMNNAME_City = "City";

View File

@ -371,6 +371,45 @@ public class X_I_Order extends PO implements I_I_Order, I_Persistent
return ii.intValue();
}
public I_C_Charge getC_Charge() throws Exception
{
Class<?> clazz = MTable.getClass(I_C_Charge.Table_Name);
I_C_Charge result = null;
try {
Constructor<?> constructor = null;
constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class});
result = (I_C_Charge)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_Charge_ID()), get_TrxName()});
} catch (Exception e) {
log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
throw e;
}
return result;
}
/** Set Charge.
@param C_Charge_ID
Additional document charges
*/
public void setC_Charge_ID (int C_Charge_ID)
{
if (C_Charge_ID < 1)
set_Value (COLUMNNAME_C_Charge_ID, null);
else
set_Value (COLUMNNAME_C_Charge_ID, Integer.valueOf(C_Charge_ID));
}
/** Get Charge.
@return Additional document charges
*/
public int getC_Charge_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Charge_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_C_Country getC_Country() throws Exception
{
Class<?> clazz = MTable.getClass(I_C_Country.Table_Name);
@ -488,6 +527,23 @@ public class X_I_Order extends PO implements I_I_Order, I_Persistent
return ii.intValue();
}
/** Set Charge Name.
@param ChargeName
Name of the Charge
*/
public void setChargeName (String ChargeName)
{
set_Value (COLUMNNAME_ChargeName, ChargeName);
}
/** Get Charge Name.
@return Name of the Charge
*/
public String getChargeName ()
{
return (String)get_Value(COLUMNNAME_ChargeName);
}
/** Set City.
@param City
Identifies a City

View File

@ -424,6 +424,30 @@ public class ImportOrder extends SvrProcess
if (no != 0)
log.warning ("Invalid Product=" + no);
// Charge
sql = new StringBuffer ("UPDATE I_Order o "
+ "SET C_Charge_ID=(SELECT C_Charge_ID FROM C_Charge c"
+ " WHERE o.ChargeName=c.Name AND o.AD_Client_ID=c.AD_Client_ID) "
+ "WHERE C_Charge_ID IS NULL AND ChargeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Charge=" + no);
sql = new StringBuffer ("UPDATE I_Order "
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Charge, ' "
+ "WHERE C_Charge_ID IS NULL AND (ChargeName IS NOT NULL)"
+ " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0)
log.warning ("Invalid Charge=" + no);
//
sql = new StringBuffer ("UPDATE I_Invoice "
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Product and Charge, ' "
+ "WHERE M_Product_ID IS NOT NULL AND C_Charge_ID IS NOT NULL "
+ " AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0)
log.warning ("Invalid Product and Charge exclusive=" + no);
// Tax
sql = new StringBuffer ("UPDATE I_Order o "
+ "SET C_Tax_ID=(SELECT MAX(C_Tax_ID) FROM C_Tax t"
@ -678,6 +702,8 @@ public class ImportOrder extends SvrProcess
lineNo += 10;
if (imp.getM_Product_ID() != 0)
line.setM_Product_ID(imp.getM_Product_ID(), true);
if (imp.getC_Charge_ID() != 0)
line.setC_Charge_ID(imp.getC_Charge_ID());
line.setQty(imp.getQtyOrdered());
line.setPrice();
if (imp.getPriceActual().compareTo(Env.ZERO) != 0)

View File

@ -0,0 +1,50 @@
-- 16/10/2008 15:11:55
-- Add charge to order import
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,56364,968,0,19,591,'C_Charge_ID',TO_DATE('2008-10-16 15:11:52','YYYY-MM-DD HH24:MI:SS'),100,'Additional document charges','D',10,'The Charge indicates a type of Charge (Handling, Shipping, Restocking)','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Charge',0,TO_DATE('2008-10-16 15:11:52','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 16/10/2008 15:11:55
-- Add charge to order import
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56364 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- 16/10/2008 15:12:04
-- Add charge to order import
ALTER TABLE I_Order ADD C_Charge_ID NUMBER(10)
;
-- 16/10/2008 15:13:12
-- Add charge to order import
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,56365,2096,0,10,591,'ChargeName',TO_DATE('2008-10-16 15:13:10','YYYY-MM-DD HH24:MI:SS'),100,'Name of the Charge','D',60,'Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Charge Name',0,TO_DATE('2008-10-16 15:13:10','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 16/10/2008 15:13:12
-- Add charge to order import
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56365 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- 16/10/2008 15:13:15
-- Add charge to order import
ALTER TABLE I_Order ADD ChargeName NVARCHAR2(60)
;
-- 16/10/2008 15:17:33
-- Add charge to order import
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,56364,56402,0,512,TO_DATE('2008-10-16 15:17:32','YYYY-MM-DD HH24:MI:SS'),100,'Additional document charges',10,'D','The Charge indicates a type of Charge (Handling, Shipping, Restocking)','Y','Y','Y','N','N','N','N','N','Charge',434,0,TO_DATE('2008-10-16 15:17:32','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16/10/2008 15:17:33
-- Add charge to order import
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56402 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
;
-- 16/10/2008 15:18:50
-- Add charge to order import
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,56365,56403,0,512,TO_DATE('2008-10-16 15:18:49','YYYY-MM-DD HH24:MI:SS'),100,'Name of the Charge',40,'D','Y','Y','Y','N','N','N','N','Y','Charge Name',436,0,TO_DATE('2008-10-16 15:18:49','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16/10/2008 15:18:50
-- Add charge to order import
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56403 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
;

View File

@ -0,0 +1,50 @@
-- 16/10/2008 15:11:55
-- Add charge to order import
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,56364,968,0,19,591,'C_Charge_ID',TO_TIMESTAMP('2008-10-16 15:11:52','YYYY-MM-DD HH24:MI:SS'),100,'Additional document charges','D',10,'The Charge indicates a type of Charge (Handling, Shipping, Restocking)','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Charge',0,TO_TIMESTAMP('2008-10-16 15:11:52','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 16/10/2008 15:11:55
-- Add charge to order import
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56364 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- 16/10/2008 15:12:04
-- Add charge to order import
ALTER TABLE I_Order ADD COLUMN C_Charge_ID NUMERIC(10)
;
-- 16/10/2008 15:13:12
-- Add charge to order import
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,56365,2096,0,10,591,'ChargeName',TO_TIMESTAMP('2008-10-16 15:13:10','YYYY-MM-DD HH24:MI:SS'),100,'Name of the Charge','D',60,'Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Charge Name',0,TO_TIMESTAMP('2008-10-16 15:13:10','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- 16/10/2008 15:13:12
-- Add charge to order import
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56365 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- 16/10/2008 15:13:15
-- Add charge to order import
ALTER TABLE I_Order ADD COLUMN ChargeName VARCHAR(60)
;
-- 16/10/2008 15:17:33
-- Add charge to order import
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,56364,56402,0,512,TO_TIMESTAMP('2008-10-16 15:17:32','YYYY-MM-DD HH24:MI:SS'),100,'Additional document charges',10,'D','The Charge indicates a type of Charge (Handling, Shipping, Restocking)','Y','Y','Y','N','N','N','N','N','Charge',434,0,TO_TIMESTAMP('2008-10-16 15:17:32','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16/10/2008 15:17:33
-- Add charge to order import
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56402 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
;
-- 16/10/2008 15:18:50
-- Add charge to order import
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,56365,56403,0,512,TO_TIMESTAMP('2008-10-16 15:18:49','YYYY-MM-DD HH24:MI:SS'),100,'Name of the Charge',40,'D','Y','Y','Y','N','N','N','N','Y','Charge Name',436,0,TO_TIMESTAMP('2008-10-16 15:18:49','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 16/10/2008 15:18:50
-- Add charge to order import
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56403 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
;