All Comm
This commit is contained in:
parent
0488fa2e5a
commit
34d2c7b1d5
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -4,12 +4,14 @@ import org.adempiere.base.event.AbstractEventHandler;
|
||||||
import org.adempiere.base.event.IEventTopics;
|
import org.adempiere.base.event.IEventTopics;
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.compiere.model.MOrder;
|
import org.compiere.model.MOrder;
|
||||||
|
import org.compiere.model.MPaymentAllocate;
|
||||||
import org.compiere.model.MRMA;
|
import org.compiere.model.MRMA;
|
||||||
import org.compiere.model.PO;
|
import org.compiere.model.PO;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
|
|
||||||
import andromedia.midsuit.validator.MID_OrderValidator;
|
import andromedia.midsuit.validator.MID_OrderValidator;
|
||||||
|
import andromedia.midsuit.validator.MID_PaymentAllocateValidator;
|
||||||
import andromedia.midsuit.validator.MID_RMAValidator;
|
import andromedia.midsuit.validator.MID_RMAValidator;
|
||||||
|
|
||||||
public class MID_ValidatorFactory extends AbstractEventHandler {
|
public class MID_ValidatorFactory extends AbstractEventHandler {
|
||||||
|
|
@ -26,6 +28,9 @@ public class MID_ValidatorFactory extends AbstractEventHandler {
|
||||||
msg = MID_OrderValidator.executeEvent(event, getPO(event));
|
msg = MID_OrderValidator.executeEvent(event, getPO(event));
|
||||||
if (getPO(event).get_TableName().equals(MRMA.Table_Name))
|
if (getPO(event).get_TableName().equals(MRMA.Table_Name))
|
||||||
msg = MID_RMAValidator.executeEvent(event, getPO(event));
|
msg = MID_RMAValidator.executeEvent(event, getPO(event));
|
||||||
|
if(getPO(event).get_TableName().equals(MPaymentAllocate.Table_Name))
|
||||||
|
msg = MID_PaymentAllocateValidator.executeEvent(event, getPO(event));
|
||||||
|
|
||||||
logEvent(event, getPO(event), msg);
|
logEvent(event, getPO(event), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,6 +49,14 @@ public class MID_ValidatorFactory extends AbstractEventHandler {
|
||||||
//RMA
|
//RMA
|
||||||
registerTableEvent(IEventTopics.DOC_AFTER_COMPLETE, MRMA.Table_Name);
|
registerTableEvent(IEventTopics.DOC_AFTER_COMPLETE, MRMA.Table_Name);
|
||||||
registerTableEvent(IEventTopics.PO_AFTER_NEW, MRMA.Table_Name);
|
registerTableEvent(IEventTopics.PO_AFTER_NEW, MRMA.Table_Name);
|
||||||
|
|
||||||
|
// MPaymentAllocate
|
||||||
|
registerTableEvent(IEventTopics.PO_AFTER_CHANGE, MPaymentAllocate.Table_Name);
|
||||||
|
registerTableEvent(IEventTopics.PO_AFTER_NEW, MPaymentAllocate.Table_Name);
|
||||||
|
registerTableEvent(IEventTopics.PO_AFTER_DELETE, MPaymentAllocate.Table_Name);
|
||||||
|
registerTableEvent(IEventTopics.PO_BEFORE_CHANGE, MPaymentAllocate.Table_Name);
|
||||||
|
registerTableEvent(IEventTopics.PO_BEFORE_NEW, MPaymentAllocate.Table_Name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ public class MID_CreateFromOrder extends CreateFrom {
|
||||||
pstmt = DB.prepareStatement(sql.toString(), null);
|
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||||
pstmt.setInt(++count, AD_Client_ID);
|
pstmt.setInt(++count, AD_Client_ID);
|
||||||
// pstmt.setString(++count, DocAction.STATUS_Completed);
|
// pstmt.setString(++count, DocAction.STATUS_Completed);
|
||||||
pstmt.setInt(++count, M_Warehouse_ID);
|
// pstmt.setInt(++count, M_Warehouse_ID);
|
||||||
//pstmt.setInt(++count, C_BPartner_ID);
|
//pstmt.setInt(++count, C_BPartner_ID);
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ public class MID_WCreateFromShipment extends CreateFromShipment implements Event
|
||||||
boolean isRMAWindow = ((getGridTab().getAD_Window_ID() == WINDOW_RETURNTOVENDOR) || (getGridTab().getAD_Window_ID() == WINDOW_CUSTOMERRETURN));
|
boolean isRMAWindow = ((getGridTab().getAD_Window_ID() == WINDOW_RETURNTOVENDOR) || (getGridTab().getAD_Window_ID() == WINDOW_CUSTOMERRETURN));
|
||||||
|
|
||||||
bPartnerLabel.setText(Msg.getElement(Env.getCtx(), "C_BPartner_ID"));
|
bPartnerLabel.setText(Msg.getElement(Env.getCtx(), "C_BPartner_ID"));
|
||||||
orderLabel.setText(Msg.getElement(Env.getCtx(), "C_Order_ID", false));
|
orderLabel.setText("Order");
|
||||||
invoiceLabel.setText(Msg.getElement(Env.getCtx(), "C_Invoice_ID", false));
|
invoiceLabel.setText(Msg.getElement(Env.getCtx(), "C_Invoice_ID", false));
|
||||||
rmaLabel.setText(Msg.translate(Env.getCtx(), "M_RMA_ID"));
|
rmaLabel.setText(Msg.translate(Env.getCtx(), "M_RMA_ID"));
|
||||||
locatorLabel.setText(Msg.translate(Env.getCtx(), "M_Locator_ID"));
|
locatorLabel.setText(Msg.translate(Env.getCtx(), "M_Locator_ID"));
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,168 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* 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 andromedia.midsuit.model;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import org.compiere.model.*;
|
||||||
|
import org.compiere.util.KeyNamePair;
|
||||||
|
|
||||||
|
/** Generated Interface for zpos_Cashier
|
||||||
|
* @author iDempiere (generated)
|
||||||
|
* @version Release 5.1
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("all")
|
||||||
|
public interface I_zpos_Cashier
|
||||||
|
{
|
||||||
|
|
||||||
|
/** TableName=zpos_Cashier */
|
||||||
|
public static final String Table_Name = "zpos_Cashier";
|
||||||
|
|
||||||
|
/** AD_Table_ID=300006 */
|
||||||
|
public static final int Table_ID = 300006;
|
||||||
|
|
||||||
|
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 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 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 Value */
|
||||||
|
public static final String COLUMNNAME_Value = "Value";
|
||||||
|
|
||||||
|
/** Set Search Key.
|
||||||
|
* Search key for the record in the format required - must be unique
|
||||||
|
*/
|
||||||
|
public void setValue (String Value);
|
||||||
|
|
||||||
|
/** Get Search Key.
|
||||||
|
* Search key for the record in the format required - must be unique
|
||||||
|
*/
|
||||||
|
public String getValue();
|
||||||
|
|
||||||
|
/** Column name zpos_Cashier_ID */
|
||||||
|
public static final String COLUMNNAME_zpos_Cashier_ID = "zpos_Cashier_ID";
|
||||||
|
|
||||||
|
/** Set Cashier Machine */
|
||||||
|
public void setzpos_Cashier_ID (int zpos_Cashier_ID);
|
||||||
|
|
||||||
|
/** Get Cashier Machine */
|
||||||
|
public int getzpos_Cashier_ID();
|
||||||
|
|
||||||
|
/** Column name zpos_Cashier_UU */
|
||||||
|
public static final String COLUMNNAME_zpos_Cashier_UU = "zpos_Cashier_UU";
|
||||||
|
|
||||||
|
/** Set Cashier Machine UU */
|
||||||
|
public void setzpos_Cashier_UU (String zpos_Cashier_UU);
|
||||||
|
|
||||||
|
/** Get Cashier Machine UU */
|
||||||
|
public String getzpos_Cashier_UU();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,156 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* 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 andromedia.midsuit.model;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.util.Properties;
|
||||||
|
import org.compiere.model.*;
|
||||||
|
|
||||||
|
/** Generated Model for zpos_Cashier
|
||||||
|
* @author iDempiere (generated)
|
||||||
|
* @version Release 5.1 - $Id$ */
|
||||||
|
public class X_zpos_Cashier extends PO implements I_zpos_Cashier, I_Persistent
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 20180321L;
|
||||||
|
|
||||||
|
/** Standard Constructor */
|
||||||
|
public X_zpos_Cashier (Properties ctx, int zpos_Cashier_ID, String trxName)
|
||||||
|
{
|
||||||
|
super (ctx, zpos_Cashier_ID, trxName);
|
||||||
|
/** if (zpos_Cashier_ID == 0)
|
||||||
|
{
|
||||||
|
} */
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Load Constructor */
|
||||||
|
public X_zpos_Cashier (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_zpos_Cashier[")
|
||||||
|
.append(get_ID()).append("]");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 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 Search Key.
|
||||||
|
@param Value
|
||||||
|
Search key for the record in the format required - must be unique
|
||||||
|
*/
|
||||||
|
public void setValue (String Value)
|
||||||
|
{
|
||||||
|
set_Value (COLUMNNAME_Value, Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get Search Key.
|
||||||
|
@return Search key for the record in the format required - must be unique
|
||||||
|
*/
|
||||||
|
public String getValue ()
|
||||||
|
{
|
||||||
|
return (String)get_Value(COLUMNNAME_Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set Cashier Machine.
|
||||||
|
@param zpos_Cashier_ID Cashier Machine */
|
||||||
|
public void setzpos_Cashier_ID (int zpos_Cashier_ID)
|
||||||
|
{
|
||||||
|
if (zpos_Cashier_ID < 1)
|
||||||
|
set_ValueNoCheck (COLUMNNAME_zpos_Cashier_ID, null);
|
||||||
|
else
|
||||||
|
set_ValueNoCheck (COLUMNNAME_zpos_Cashier_ID, Integer.valueOf(zpos_Cashier_ID));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get Cashier Machine.
|
||||||
|
@return Cashier Machine */
|
||||||
|
public int getzpos_Cashier_ID ()
|
||||||
|
{
|
||||||
|
Integer ii = (Integer)get_Value(COLUMNNAME_zpos_Cashier_ID);
|
||||||
|
if (ii == null)
|
||||||
|
return 0;
|
||||||
|
return ii.intValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set Cashier Machine UU.
|
||||||
|
@param zpos_Cashier_UU Cashier Machine UU */
|
||||||
|
public void setzpos_Cashier_UU (String zpos_Cashier_UU)
|
||||||
|
{
|
||||||
|
set_ValueNoCheck (COLUMNNAME_zpos_Cashier_UU, zpos_Cashier_UU);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get Cashier Machine UU.
|
||||||
|
@return Cashier Machine UU */
|
||||||
|
public String getzpos_Cashier_UU ()
|
||||||
|
{
|
||||||
|
return (String)get_Value(COLUMNNAME_zpos_Cashier_UU);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,9 +15,11 @@ import javax.management.MalformedObjectNameException;
|
||||||
import javax.swing.JComboBox.KeySelectionManager;
|
import javax.swing.JComboBox.KeySelectionManager;
|
||||||
|
|
||||||
import org.adempiere.base.DefaultModelFactory;
|
import org.adempiere.base.DefaultModelFactory;
|
||||||
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.compiere.model.MEntityType;
|
import org.compiere.model.MEntityType;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.PO;
|
import org.compiere.model.PO;
|
||||||
|
import org.compiere.model.Query;
|
||||||
import org.compiere.process.DocAction;
|
import org.compiere.process.DocAction;
|
||||||
import org.compiere.process.DocumentEngine;
|
import org.compiere.process.DocumentEngine;
|
||||||
import org.compiere.process.ProcessInfoParameter;
|
import org.compiere.process.ProcessInfoParameter;
|
||||||
|
|
@ -51,7 +53,6 @@ public class MID_InsertIntoAllTable extends SvrProcess{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String doIt() throws Exception {
|
protected String doIt() throws Exception {
|
||||||
if(jsonString.length()==0) return "Failed to execute insert";
|
|
||||||
JSONParser parser = new JSONParser();
|
JSONParser parser = new JSONParser();
|
||||||
JSONObject JSON = (JSONObject) parser.parse(jsonString);
|
JSONObject JSON = (JSONObject) parser.parse(jsonString);
|
||||||
if(JSON!=null) {
|
if(JSON!=null) {
|
||||||
|
|
@ -59,19 +60,47 @@ public class MID_InsertIntoAllTable extends SvrProcess{
|
||||||
tableName = JSON.get("TableName").toString();
|
tableName = JSON.get("TableName").toString();
|
||||||
JSONObject Data = (JSONObject) JSON.get("Data");
|
JSONObject Data = (JSONObject) JSON.get("Data");
|
||||||
String Mode = JSON.get("Mode").toString();
|
String Mode = JSON.get("Mode").toString();
|
||||||
|
String whereClause = JSON.get("WhereClause").toString();
|
||||||
if(Mode.equals("I")) {
|
if(Mode.equals("I")) {
|
||||||
po = getPO(tableName, 0, get_TrxName());
|
po = getPO(tableName, 0, get_TrxName());
|
||||||
}else if (Mode.equals("U")) {
|
}else if (Mode.equals("U")) {
|
||||||
|
if(whereClause.length()>0) {
|
||||||
|
int[] IDs = new Query(getCtx(), tableName, whereClause,get_TrxName())
|
||||||
|
.setOnlyActiveRecords(true)
|
||||||
|
.getIDs();
|
||||||
|
|
||||||
|
for(int ID : IDs) {
|
||||||
|
PO obj = null;
|
||||||
|
obj = getPO(tableName, ID, get_TrxName());
|
||||||
|
Set<Object> keySetMass= Data.keySet();
|
||||||
|
Iterator<Object> keysMass = keySetMass.iterator();
|
||||||
|
while(keysMass.hasNext()) {
|
||||||
|
String columnInsert = keysMass.next().toString();
|
||||||
|
obj.set_ValueNoCheck(columnInsert, Data.get(columnInsert).toString());
|
||||||
|
}
|
||||||
|
if(!obj.save())
|
||||||
|
throw new AdempiereException("Failed to Save the Data !");
|
||||||
|
|
||||||
|
}
|
||||||
|
return "Update Mass Data Success !!";
|
||||||
|
}else {
|
||||||
int Record_ID = Integer.parseInt(Data.get("Record_ID").toString());
|
int Record_ID = Integer.parseInt(Data.get("Record_ID").toString());
|
||||||
po = getPO(tableName, Record_ID, get_TrxName());
|
po = getPO(tableName, Record_ID, get_TrxName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<Object> keySet= Data.keySet();
|
Set<Object> keySet= Data.keySet();
|
||||||
Iterator<Object> keys = keySet.iterator();
|
Iterator<Object> keys = keySet.iterator();
|
||||||
while(keys.hasNext()) {
|
if(whereClause.length()==0)
|
||||||
String columnInsert = keys.next().toString();
|
while(keys.hasNext()) {
|
||||||
po.set_ValueNoCheck(columnInsert, Data.get(columnInsert));
|
String columnInsert = keys.next().toString();
|
||||||
po.saveEx();
|
if(columnInsert.equals("Record_ID"))
|
||||||
}
|
continue;
|
||||||
|
po.set_ValueNoCheck(columnInsert, Data.get(columnInsert).toString());
|
||||||
|
if(!po.save())
|
||||||
|
throw new AdempiereException("Failed to Save the Data !");
|
||||||
|
return String.valueOf(po.get_ID());
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
return "No JSON to be processed !";
|
return "No JSON to be processed !";
|
||||||
}
|
}
|
||||||
|
|
@ -168,7 +197,7 @@ public class MID_InsertIntoAllTable extends SvrProcess{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Adempiere Extension
|
// Adempiere Extension
|
||||||
Class<?> clazz = getPOclass("adempiere.model.X_" + tableName, tableName);
|
Class<?> clazz = getPOclass("adempiere.model.X_" + tableName, tableName);
|
||||||
if (clazz != null)
|
if (clazz != null)
|
||||||
|
|
@ -193,7 +222,13 @@ public class MID_InsertIntoAllTable extends SvrProcess{
|
||||||
s_classCache.put(tableName, clazz);
|
s_classCache.put(tableName, clazz);
|
||||||
return clazz;
|
return clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clazz = getPOclass("andromedia.midsuit.model.X_" + tableName, tableName);
|
||||||
|
if (clazz != null)
|
||||||
|
{
|
||||||
|
s_classCache.put(tableName, clazz);
|
||||||
|
return clazz;
|
||||||
|
}
|
||||||
//Object.class to indicate no PO class for tableName
|
//Object.class to indicate no PO class for tableName
|
||||||
s_classCache.put(tableName, Object.class);
|
s_classCache.put(tableName, Object.class);
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
package andromedia.midsuit.validator;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import org.adempiere.base.event.IEventTopics;
|
||||||
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
|
import org.compiere.model.MPayment;
|
||||||
|
import org.compiere.model.MPaymentAllocate;
|
||||||
|
import org.compiere.model.PO;
|
||||||
|
import org.compiere.model.Query;
|
||||||
|
import org.compiere.model.X_C_OrderLandedCostAllocation;
|
||||||
|
import org.osgi.service.event.Event;
|
||||||
|
|
||||||
|
public class MID_PaymentAllocateValidator {
|
||||||
|
public static String executeEvent(Event e, PO po) {
|
||||||
|
MPaymentAllocate pa = (MPaymentAllocate) po;
|
||||||
|
if (e.getTopic().equals(IEventTopics.PO_AFTER_DELETE)
|
||||||
|
|| (e.getTopic().equals(IEventTopics.PO_AFTER_CHANGE)
|
||||||
|
&& pa.is_ValueChanged(MPaymentAllocate.COLUMNNAME_Amount))
|
||||||
|
|| e.getTopic().equals((IEventTopics.PO_AFTER_NEW))) {
|
||||||
|
return afterSave(pa);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String afterSave(MPaymentAllocate po) {
|
||||||
|
BigDecimal allocatedAmt = new Query(po.getCtx(), po.get_TableName(), "C_Payment_ID =?", po.get_TrxName())
|
||||||
|
.setOnlyActiveRecords(true).setParameters(new Object[] { po.getC_Payment_ID() })
|
||||||
|
.sum(po.COLUMNNAME_Amount);
|
||||||
|
|
||||||
|
MPayment payForUpdate = (MPayment) po.getC_Payment();
|
||||||
|
payForUpdate.set_ValueNoCheck("PayAmt", allocatedAmt);
|
||||||
|
payForUpdate.saveEx();
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String beforeSave(MPaymentAllocate po) {
|
||||||
|
BigDecimal amount = po.getAmount();
|
||||||
|
BigDecimal invAmt = po.getInvoiceAmt();
|
||||||
|
|
||||||
|
if (amount.doubleValue() > invAmt.doubleValue()) {
|
||||||
|
throw new AdempiereException("Jumlah yang dibayarkan lebih besar daripada jumlah Invoice");
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -19,6 +19,7 @@ import org.compiere.model.MRMALine;
|
||||||
import org.compiere.model.PO;
|
import org.compiere.model.PO;
|
||||||
import org.compiere.model.Query;
|
import org.compiere.model.Query;
|
||||||
import org.compiere.model.X_C_DocType;
|
import org.compiere.model.X_C_DocType;
|
||||||
|
import org.compiere.model.X_M_InOut;
|
||||||
import org.compiere.process.DocAction;
|
import org.compiere.process.DocAction;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
|
|
||||||
|
|
@ -39,8 +40,9 @@ public class MID_RMAValidator {
|
||||||
ioR.setC_DocType_ID(RMA.getC_DocType().getC_DocTypeShipment_ID());
|
ioR.setC_DocType_ID(RMA.getC_DocType().getC_DocTypeShipment_ID());
|
||||||
ioR.setM_RMA_ID(RMA.getM_RMA_ID());
|
ioR.setM_RMA_ID(RMA.getM_RMA_ID());
|
||||||
ioR.setC_BPartner_ID(RMA.getC_BPartner_ID());
|
ioR.setC_BPartner_ID(RMA.getC_BPartner_ID());
|
||||||
|
ioR.setIsSOTrx(RMA.isSOTrx());
|
||||||
ioR.setC_BPartner_Location_ID(RMA.getInOut().getC_BPartner_Location_ID());
|
ioR.setC_BPartner_Location_ID(RMA.getInOut().getC_BPartner_Location_ID());
|
||||||
ioR.setMovementType(ioR.MOVEMENTTYPE_CustomerReturns);
|
ioR.setMovementType(RMA.isSOTrx() ? X_M_InOut.MOVEMENTTYPE_CustomerReturns : X_M_InOut.MOVEMENTTYPE_VendorReturns);
|
||||||
ioR.setM_Warehouse_ID(RMA.getInOut().getM_Warehouse_ID());
|
ioR.setM_Warehouse_ID(RMA.getInOut().getM_Warehouse_ID());
|
||||||
ioR.saveEx();
|
ioR.saveEx();
|
||||||
|
|
||||||
|
|
@ -53,59 +55,64 @@ public class MID_RMAValidator {
|
||||||
ioRl.saveEx();
|
ioRl.saveEx();
|
||||||
}
|
}
|
||||||
|
|
||||||
ioR.processIt("IP");
|
ioR.processIt("CO");
|
||||||
ioR.saveEx();
|
ioR.saveEx();
|
||||||
|
|
||||||
MInOutConfirm confirm = new Query(RMA.getCtx(), MInOutConfirm.Table_Name, "M_InOut_ID =?", RMA.get_TrxName())
|
MInOutConfirm confirm = new Query(RMA.getCtx(), MInOutConfirm.Table_Name, "M_InOut_ID =?", RMA.get_TrxName())
|
||||||
.setParameters(new Object[] { ioR.getM_InOut_ID() }).first();
|
.setParameters(new Object[] { ioR.getM_InOut_ID() }).first();
|
||||||
|
if(confirm!=null) {
|
||||||
confirm.processIt("CO");
|
confirm.processIt("CO");
|
||||||
confirm.saveEx();
|
confirm.saveEx();
|
||||||
|
}
|
||||||
ioR.processIt("CO");
|
|
||||||
ioR.saveEx();
|
|
||||||
|
|
||||||
// Create Invoice
|
// Create Invoice
|
||||||
MOrder order = (MOrder) RMA.getInOut().getC_Order();
|
MOrder order = (MOrder) RMA.getInOut().getC_Order();
|
||||||
MInvoice invoice = new MInvoice(order, order.getC_DocType().getC_DocTypeInvoice_ID(), order.getDateOrdered());
|
if(order.getInvoices().length>0) {
|
||||||
invoice.setPaymentRule(order.getPaymentRule());
|
int ARCreditMemo_ID = new Query(RMA.getCtx(), X_C_DocType.Table_Name, "name =? AND AD_Client_ID =?", RMA.get_TrxName())
|
||||||
int ARCreditMemo_ID = new Query(RMA.getCtx(), X_C_DocType.Table_Name, "name =?", RMA.get_TrxName())
|
.setParameters(new Object[] {RMA.isSOTrx() ? "AR Credit Memo" : "AP Credit Memo", RMA.getAD_Client_ID()})
|
||||||
.setParameters("AR Credit Memo")
|
.setOnlyActiveRecords(true)
|
||||||
.setOnlyActiveRecords(true)
|
.firstId();
|
||||||
.firstId();
|
MInvoice invoice = new MInvoice(RMA.getCtx(), 0, RMA.get_TrxName());
|
||||||
invoice.setC_DocTypeTarget_ID(ARCreditMemo_ID);
|
invoice.setRMA(RMA);
|
||||||
invoice.setC_PaymentTerm_ID(order.getC_PaymentTerm_ID());
|
invoice.setPaymentRule(order.getPaymentRule());
|
||||||
invoice.setC_Currency_ID(order.getC_Currency_ID());
|
invoice.setC_DocTypeTarget_ID(ARCreditMemo_ID);
|
||||||
invoice.setM_PriceList_ID(order.getM_PriceList_ID());
|
invoice.setC_PaymentTerm_ID(order.getC_PaymentTerm_ID());
|
||||||
invoice.saveEx();
|
invoice.setIsSOTrx(RMA.isSOTrx());
|
||||||
|
invoice.setC_Currency_ID(order.getC_Currency_ID());
|
||||||
MOrderLine[] oLines = order.getLines();
|
invoice.setM_PriceList_ID(order.getM_PriceList_ID());
|
||||||
for (int i = 0; i < oLines.length; i++) {
|
invoice.saveEx();
|
||||||
MOrderLine oLine = oLines[i];
|
|
||||||
MInvoiceLine iLine = new MInvoiceLine(invoice);
|
MRMALine[] lines = RMA.getLines(true);
|
||||||
iLine.setOrderLine(oLine);
|
for (int i = 0; i < lines.length; i++) {
|
||||||
iLine.setQtyEntered(oLine.getQtyOrdered());
|
MRMALine line = lines[i];
|
||||||
iLine.setQtyInvoiced(oLine.getQtyOrdered());
|
MInvoiceLine iLine = new MInvoiceLine(invoice);
|
||||||
iLine.saveEx();
|
iLine.setRMALine(line);
|
||||||
|
iLine.setM_Product_ID(line.getM_Product_ID());
|
||||||
|
iLine.setQtyEntered(line.getQty());
|
||||||
|
iLine.setQtyInvoiced(line.getQty());
|
||||||
|
iLine.saveEx();
|
||||||
|
}
|
||||||
|
|
||||||
|
invoice.processIt(DocAction.ACTION_Complete);
|
||||||
|
invoice.saveEx();
|
||||||
|
MInvoice invoiceUsed = new MInvoice(RMA.getCtx (), order.getC_Invoice_ID(), RMA.get_TrxName());
|
||||||
|
if(invoiceUsed.getC_Payment_ID()>0) {
|
||||||
|
MPayment payment = new MPayment(RMA.getCtx(), 0, RMA.get_TrxName());
|
||||||
|
|
||||||
|
payment.setC_Invoice_ID(invoice.get_ID());
|
||||||
|
// payment.setC_Order_ID(invoice.getC_Order_ID());
|
||||||
|
payment.setIsReceipt(invoice.isSOTrx());
|
||||||
|
payment.setAD_Org_ID(order.getAD_Org_ID());
|
||||||
|
payment.setC_DocType_ID(invoice.isSOTrx());
|
||||||
|
payment.setC_BPartner_ID(invoice.getC_BPartner_ID());
|
||||||
|
payment.setAmount(invoice.getC_Currency_ID(), invoice.getGrandTotal().negate());
|
||||||
|
payment.setC_BankAccount_ID(invoiceUsed.getC_Payment().getC_BankAccount_ID());
|
||||||
|
payment.saveEx();
|
||||||
|
|
||||||
|
payment.processIt(DocAction.ACTION_Complete);
|
||||||
|
payment.saveEx();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
invoice.processIt(DocAction.ACTION_Complete);
|
|
||||||
invoice.saveEx();
|
|
||||||
|
|
||||||
MPayment payment = new MPayment(RMA.getCtx(), 0, RMA.get_TrxName());
|
|
||||||
payment.setC_Invoice_ID(invoice.get_ID());
|
|
||||||
// payment.setC_Order_ID(invoice.getC_Order_ID());
|
|
||||||
payment.setIsReceipt(invoice.isSOTrx());
|
|
||||||
payment.setAD_Org_ID(order.getAD_Org_ID());
|
|
||||||
payment.setC_DocType_ID(invoice.isSOTrx());
|
|
||||||
payment.setC_BPartner_ID(invoice.getC_BPartner_ID());
|
|
||||||
payment.setAmount(invoice.getC_Currency_ID(), invoice.getGrandTotal().negate());
|
|
||||||
MInvoice invoiceUsed = new MInvoice(RMA.getCtx(), order.getC_Invoice_ID(), RMA.get_TrxName());
|
|
||||||
payment.setC_BankAccount_ID(invoiceUsed.getC_Payment().getC_BankAccount_ID());
|
|
||||||
payment.saveEx();
|
|
||||||
|
|
||||||
payment.processIt(DocAction.ACTION_Complete);
|
|
||||||
payment.saveEx();
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue