parent
f74a1fcaf4
commit
a6054066ab
|
@ -0,0 +1,61 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 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.adempiere.model;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.model.CalloutEngine;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MRMA;
|
||||
import org.compiere.util.DB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Ashley G Ramdass
|
||||
*/
|
||||
public class CalloutRMA extends CalloutEngine
|
||||
{
|
||||
|
||||
/**
|
||||
* docType - set document properties based on document type.
|
||||
* @param ctx
|
||||
* @param WindowNo
|
||||
* @param mTab
|
||||
* @param mField
|
||||
* @param value
|
||||
* @return error message or ""
|
||||
*/
|
||||
public String docType (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
|
||||
{
|
||||
Integer C_DocType_ID = (Integer)value;
|
||||
if (C_DocType_ID == null || C_DocType_ID.intValue() == 0)
|
||||
return "";
|
||||
|
||||
String sql = "SELECT d.IsSoTrx "
|
||||
+ "FROM C_DocType d WHERE C_DocType_ID=?";
|
||||
|
||||
String docSOTrx = DB.getSQLValueString(null, sql, C_DocType_ID);
|
||||
|
||||
boolean isSOTrx = "Y".equals(docSOTrx);
|
||||
|
||||
mTab.setValue("IsSOTrx", isSOTrx);
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,245 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 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.adempiere.process;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.model.MInOut;
|
||||
import org.compiere.model.MInOutLine;
|
||||
import org.compiere.model.MRMA;
|
||||
import org.compiere.model.MRMALine;
|
||||
import org.compiere.process.DocAction;
|
||||
import org.compiere.process.ProcessInfoParameter;
|
||||
import org.compiere.process.SvrProcess;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
* Generate shipment for Vendor RMA
|
||||
* @author Ashley Ramdass
|
||||
*
|
||||
* Based on org.compiere.process.InOutGenerate
|
||||
*/
|
||||
public class InOutGenerateRMA extends SvrProcess
|
||||
{
|
||||
/** Manual Selection */
|
||||
private boolean p_Selection = false;
|
||||
/** Warehouse */
|
||||
@SuppressWarnings("unused")
|
||||
private int p_M_Warehouse_ID = 0;
|
||||
/** DocAction */
|
||||
private String p_docAction = DocAction.ACTION_Complete;
|
||||
/** Number of Shipments */
|
||||
private int m_created = 0;
|
||||
/** Movement Date */
|
||||
private Timestamp m_movementDate = null;
|
||||
|
||||
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("M_Warehouse_ID"))
|
||||
p_M_Warehouse_ID = para[i].getParameterAsInt();
|
||||
else if (name.equals("Selection"))
|
||||
p_Selection = "Y".equals(para[i].getParameter());
|
||||
else if (name.equals("DocAction"))
|
||||
p_docAction = (String)para[i].getParameter();
|
||||
else
|
||||
log.log(Level.SEVERE, "Unknown Parameter: " + name);
|
||||
}
|
||||
|
||||
m_movementDate = Env.getContextAsDate(getCtx(), "#Date");
|
||||
if (m_movementDate == null)
|
||||
{
|
||||
m_movementDate = new Timestamp(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
protected String doIt() throws Exception
|
||||
{
|
||||
if (!p_Selection)
|
||||
{
|
||||
throw new IllegalStateException("Shipments can only be generated from selection");
|
||||
}
|
||||
|
||||
String sql = "SELECT rma.M_RMA_ID FROM M_RMA rma, T_Selection "
|
||||
+ "WHERE rma.DocStatus='CO' AND rma.IsSOTrx='N' AND rma.AD_Client_ID=? "
|
||||
+ "AND rma.M_RMA_ID = T_Selection.T_Selection_ID "
|
||||
+ "AND T_Selection.AD_PInstance_ID=? ";
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, Env.getAD_Client_ID(getCtx()));
|
||||
pstmt.setInt(2, getAD_PInstance_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
|
||||
while (rs.next())
|
||||
{
|
||||
generateShipment(rs.getInt(1));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
pstmt.close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.log(Level.SEVERE, "Could not close prepared statement");
|
||||
}
|
||||
}
|
||||
|
||||
return "@Created@ = " + m_created;
|
||||
}
|
||||
|
||||
private int getShipmentDocTypeId(int M_RMA_ID)
|
||||
{
|
||||
String docTypeSQl = "SELECT dt.C_DocTypeShipment_ID FROM C_DocType dt "
|
||||
+ "INNER JOIN M_RMA rma ON dt.C_DocType_ID=rma.C_DocType_ID "
|
||||
+ "WHERE rma.M_RMA_ID=?";
|
||||
|
||||
int docTypeId = DB.getSQLValue(null, docTypeSQl, M_RMA_ID);
|
||||
|
||||
return docTypeId;
|
||||
}
|
||||
|
||||
private MInOut createShipment(MRMA rma)
|
||||
{
|
||||
int docTypeId = getShipmentDocTypeId(rma.get_ID());
|
||||
|
||||
if (docTypeId == -1)
|
||||
{
|
||||
throw new IllegalStateException("Could not get invoice document type for Vendor RMA");
|
||||
}
|
||||
|
||||
MInOut originalReceipt = rma.getShipment();
|
||||
|
||||
MInOut shipment = new MInOut(getCtx(), 0, get_TrxName());
|
||||
shipment.setM_RMA_ID(rma.get_ID());
|
||||
shipment.setAD_Org_ID(rma.getAD_Org_ID());
|
||||
shipment.setAD_OrgTrx_ID(originalReceipt.getAD_OrgTrx_ID());
|
||||
shipment.setDescription(rma.getDescription());
|
||||
shipment.setC_BPartner_ID(rma.getC_BPartner_ID());
|
||||
shipment.setC_BPartner_Location_ID(originalReceipt.getC_BPartner_Location_ID());
|
||||
shipment.setIsSOTrx(!rma.isSOTrx());
|
||||
shipment.setC_DocType_ID(docTypeId);
|
||||
shipment.setM_Warehouse_ID(originalReceipt.getM_Warehouse_ID());
|
||||
shipment.setMovementType(MInOut.MOVEMENTTYPE_VendorReturns);
|
||||
shipment.setC_Project_ID(originalReceipt.getC_Project_ID());
|
||||
shipment.setC_Campaign_ID(originalReceipt.getC_Campaign_ID());
|
||||
shipment.setC_Activity_ID(originalReceipt.getC_Activity_ID());
|
||||
shipment.setUser1_ID(originalReceipt.getUser1_ID());
|
||||
shipment.setUser2_ID(originalReceipt.getUser2_ID());
|
||||
|
||||
if (!shipment.save())
|
||||
{
|
||||
throw new IllegalStateException("Could not create Shipment");
|
||||
}
|
||||
|
||||
return shipment;
|
||||
}
|
||||
|
||||
private MInOutLine[] createShipmentLines(MRMA rma, MInOut shipment)
|
||||
{
|
||||
ArrayList<MInOutLine> shipLineList = new ArrayList<MInOutLine>();
|
||||
|
||||
MRMALine rmaLines[] = rma.getLines(true);
|
||||
for (MRMALine rmaLine : rmaLines)
|
||||
{
|
||||
if (rmaLine.getM_InOutLine_ID() != 0)
|
||||
{
|
||||
MInOutLine shipLine = new MInOutLine(shipment);
|
||||
shipLine.setM_RMALine_ID(rmaLine.get_ID());
|
||||
shipLine.setLine(rmaLine.getLine());
|
||||
shipLine.setDescription(rmaLine.getDescription());
|
||||
shipLine.setM_Product_ID(rmaLine.getM_Product_ID());
|
||||
shipLine.setM_AttributeSetInstance_ID(rmaLine.getM_AttributeSetInstance_ID());
|
||||
shipLine.setC_UOM_ID(rmaLine.getC_UOM_ID());
|
||||
shipLine.setQty(rmaLine.getQty());
|
||||
shipLine.setM_Locator_ID(rmaLine.getM_Locator_ID());
|
||||
shipLine.setC_Project_ID(rmaLine.getC_Project_ID());
|
||||
shipLine.setC_Campaign_ID(rmaLine.getC_Campaign_ID());
|
||||
shipLine.setC_Activity_ID(rmaLine.getC_Activity_ID());
|
||||
shipLine.setC_ProjectPhase_ID(rmaLine.getC_ProjectPhase_ID());
|
||||
shipLine.setC_ProjectTask_ID(rmaLine.getC_ProjectTask_ID());
|
||||
shipLine.setUser1_ID(rmaLine.getUser1_ID());
|
||||
shipLine.setUser2_ID(rmaLine.getUser2_ID());
|
||||
|
||||
if (!shipLine.save())
|
||||
{
|
||||
throw new IllegalStateException("Could not create shipment line");
|
||||
}
|
||||
|
||||
shipLineList.add(shipLine);
|
||||
}
|
||||
}
|
||||
|
||||
MInOutLine shipLines[] = new MInOutLine[shipLineList.size()];
|
||||
shipLineList.toArray(shipLines);
|
||||
|
||||
return shipLines;
|
||||
}
|
||||
|
||||
private void generateShipment(int M_RMA_ID)
|
||||
{
|
||||
MRMA rma = new MRMA(getCtx(), M_RMA_ID, get_TrxName());
|
||||
|
||||
MInOut shipment = createShipment(rma);
|
||||
MInOutLine shipmentLines[] = createShipmentLines(rma, shipment);
|
||||
|
||||
if (shipmentLines.length == 0)
|
||||
{
|
||||
log.log(Level.WARNING, "No shipment lines created: M_RMA_ID="
|
||||
+ M_RMA_ID + ", M_InOut_ID=" + shipment.get_ID());
|
||||
}
|
||||
|
||||
StringBuffer processMsg = new StringBuffer(shipment.getDocumentNo());
|
||||
|
||||
if (!shipment.processIt(p_docAction))
|
||||
{
|
||||
processMsg.append(" (NOT Processed)");
|
||||
log.warning("Shipment Processing failed: " + shipment + " - " + shipment.getProcessMsg());
|
||||
}
|
||||
|
||||
if (!shipment.save())
|
||||
{
|
||||
throw new IllegalStateException("Could not update shipment");
|
||||
}
|
||||
|
||||
// Add processing information to process log
|
||||
addLog(shipment.getM_InOut_ID(), shipment.getMovementDate(), null, processMsg.toString());
|
||||
m_created++;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,262 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 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.adempiere.process;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.model.MInvoice;
|
||||
import org.compiere.model.MInvoiceLine;
|
||||
import org.compiere.model.MRMA;
|
||||
import org.compiere.model.MRMALine;
|
||||
import org.compiere.process.DocAction;
|
||||
import org.compiere.process.ProcessInfoParameter;
|
||||
import org.compiere.process.SvrProcess;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
* Generate invoice for Vendor RMA
|
||||
* @author Ashley Ramdass
|
||||
*
|
||||
* Based on org.compiere.process.InvoiceGenerate
|
||||
*/
|
||||
public class InvoiceGenerateRMA extends SvrProcess
|
||||
{
|
||||
/** Manual Selection */
|
||||
private boolean p_Selection = false;
|
||||
/** Invoice Document Action */
|
||||
private String p_docAction = DocAction.ACTION_Complete;
|
||||
|
||||
/** Number of Invoices */
|
||||
private int m_created = 0;
|
||||
/** Invoice Date */
|
||||
private Timestamp m_dateinvoiced = null;
|
||||
/** Line Number */
|
||||
private int m_line = 0;
|
||||
|
||||
/**
|
||||
* Prepare - e.g., get Parameters.
|
||||
*/
|
||||
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("Selection"))
|
||||
p_Selection = "Y".equals(para[i].getParameter());
|
||||
else if (name.equals("DocAction"))
|
||||
p_docAction = (String)para[i].getParameter();
|
||||
else
|
||||
log.log(Level.SEVERE, "Unknown Parameter: " + name);
|
||||
}
|
||||
|
||||
m_dateinvoiced = Env.getContextAsDate(getCtx(), "#Date");
|
||||
if (m_dateinvoiced == null)
|
||||
{
|
||||
m_dateinvoiced = new Timestamp(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
protected String doIt() throws Exception
|
||||
{
|
||||
if (!p_Selection)
|
||||
{
|
||||
throw new IllegalStateException("Shipments can only be generated from selection");
|
||||
}
|
||||
|
||||
String sql = "SELECT rma.M_RMA_ID FROM M_RMA rma, T_Selection "
|
||||
+ "WHERE rma.DocStatus='CO' AND rma.IsSOTrx='N' AND rma.AD_Client_ID=? "
|
||||
+ "AND rma.M_RMA_ID = T_Selection.T_Selection_ID "
|
||||
+ "AND T_Selection.AD_PInstance_ID=? ";
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, Env.getAD_Client_ID(getCtx()));
|
||||
pstmt.setInt(2, getAD_PInstance_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
|
||||
while (rs.next())
|
||||
{
|
||||
generateInvoice(rs.getInt(1));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
pstmt.close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.log(Level.SEVERE, "Could not close prepared statement");
|
||||
}
|
||||
}
|
||||
return "@Created@ = " + m_created;
|
||||
}
|
||||
|
||||
private int getInvoiceDocTypeId(int M_RMA_ID)
|
||||
{
|
||||
String docTypeSQl = "SELECT dt.C_DocTypeInvoice_ID FROM C_DocType dt "
|
||||
+ "INNER JOIN M_RMA rma ON dt.C_DocType_ID=rma.C_DocType_ID "
|
||||
+ "WHERE rma.M_RMA_ID=?";
|
||||
|
||||
int docTypeId = DB.getSQLValue(null, docTypeSQl, M_RMA_ID);
|
||||
|
||||
return docTypeId;
|
||||
}
|
||||
|
||||
private MInvoice createInvoice(MRMA rma)
|
||||
{
|
||||
int docTypeId = getInvoiceDocTypeId(rma.get_ID());
|
||||
|
||||
if (docTypeId == -1)
|
||||
{
|
||||
throw new IllegalStateException("Could not get invoice document type for Vendor RMA");
|
||||
}
|
||||
|
||||
MInvoice invoice = new MInvoice(getCtx(), 0, get_TrxName());
|
||||
|
||||
invoice.setM_RMA_ID(rma.getM_RMA_ID());
|
||||
invoice.setAD_Org_ID(rma.getAD_Org_ID());
|
||||
invoice.setDescription(rma.getDescription());
|
||||
invoice.setC_BPartner_ID(rma.getC_BPartner_ID());
|
||||
invoice.setSalesRep_ID(rma.getSalesRep_ID());
|
||||
invoice.setC_DocTypeTarget_ID(docTypeId);
|
||||
invoice.setGrandTotal(rma.getAmt());
|
||||
invoice.setIsSOTrx(rma.isSOTrx());
|
||||
invoice.setTotalLines(rma.getAmt());
|
||||
|
||||
MInvoice originalInvoice = rma.getOriginalInvoice();
|
||||
|
||||
if (originalInvoice == null)
|
||||
{
|
||||
throw new IllegalStateException("Not invoiced - RMA: " + rma.getDocumentNo());
|
||||
}
|
||||
|
||||
invoice.setC_BPartner_Location_ID(originalInvoice.getC_BPartner_Location_ID());
|
||||
invoice.setAD_User_ID(originalInvoice.getAD_User_ID());
|
||||
invoice.setC_Currency_ID(originalInvoice.getC_Currency_ID());
|
||||
invoice.setIsTaxIncluded(originalInvoice.isTaxIncluded());
|
||||
invoice.setM_PriceList_ID(originalInvoice.getM_PriceList_ID());
|
||||
invoice.setC_Project_ID(originalInvoice.getC_Project_ID());
|
||||
invoice.setC_Activity_ID(originalInvoice.getC_Activity_ID());
|
||||
invoice.setC_Campaign_ID(originalInvoice.getC_Campaign_ID());
|
||||
invoice.setUser1_ID(originalInvoice.getUser1_ID());
|
||||
invoice.setUser2_ID(originalInvoice.getUser2_ID());
|
||||
|
||||
if (!invoice.save())
|
||||
{
|
||||
throw new IllegalStateException("Could not create invoice");
|
||||
}
|
||||
|
||||
return invoice;
|
||||
}
|
||||
|
||||
private MInvoiceLine[] createInvoiceLines(MRMA rma, MInvoice invoice)
|
||||
{
|
||||
ArrayList<MInvoiceLine> invLineList = new ArrayList<MInvoiceLine>();
|
||||
|
||||
MRMALine rmaLines[] = rma.getLines(true);
|
||||
|
||||
for (MRMALine rmaLine : rmaLines)
|
||||
{
|
||||
if (!rmaLine.isShipLineInvoiced() && rmaLine.getM_InOutLine_ID() != 0)
|
||||
{
|
||||
throw new IllegalStateException("No invoice line - RMA = "
|
||||
+ rma.getDocumentNo() + ", Line = " + rmaLine.getLine());
|
||||
}
|
||||
|
||||
MInvoiceLine invLine = new MInvoiceLine(invoice);
|
||||
invLine.setAD_Org_ID(rmaLine.getAD_Org_ID());
|
||||
invLine.setM_RMALine_ID(rmaLine.getM_RMALine_ID());
|
||||
invLine.setDescription(rmaLine.getDescription());
|
||||
invLine.setLine(rmaLine.getLine());
|
||||
invLine.setC_Charge_ID(rmaLine.getC_Charge_ID());
|
||||
invLine.setM_Product_ID(rmaLine.getM_Product_ID());
|
||||
invLine.setC_UOM_ID(rmaLine.getC_UOM_ID());
|
||||
invLine.setC_Tax_ID(rmaLine.getC_Tax_ID());
|
||||
invLine.setPrice(rmaLine.getAmt());
|
||||
invLine.setQty(rmaLine.getQty());
|
||||
invLine.setLineNetAmt();
|
||||
invLine.setTaxAmt();
|
||||
invLine.setLineTotalAmt(rmaLine.getLineNetAmt());
|
||||
invLine.setC_Project_ID(rmaLine.getC_Project_ID());
|
||||
invLine.setC_Activity_ID(rmaLine.getC_Activity_ID());
|
||||
invLine.setC_Campaign_ID(rmaLine.getC_Campaign_ID());
|
||||
|
||||
if (!invLine.save())
|
||||
{
|
||||
throw new IllegalStateException("Could not create invoice line");
|
||||
}
|
||||
|
||||
invLineList.add(invLine);
|
||||
}
|
||||
|
||||
MInvoiceLine invLines[] = new MInvoiceLine[invLineList.size()];
|
||||
invLineList.toArray(invLines);
|
||||
|
||||
return invLines;
|
||||
}
|
||||
|
||||
|
||||
private void generateInvoice(int M_RMA_ID)
|
||||
{
|
||||
MRMA rma = new MRMA(getCtx(), M_RMA_ID, get_TrxName());
|
||||
|
||||
MInvoice invoice = createInvoice(rma);
|
||||
MInvoiceLine invoiceLines[] = createInvoiceLines(rma, invoice);
|
||||
|
||||
if (invoiceLines.length == 0)
|
||||
{
|
||||
log.log(Level.WARNING, "No invoice lines created: M_RMA_ID="
|
||||
+ M_RMA_ID + ", M_Invoice_ID=" + invoice.get_ID());
|
||||
}
|
||||
|
||||
StringBuffer processMsg = new StringBuffer(invoice.getDocumentNo());
|
||||
|
||||
if (!invoice.processIt(p_docAction))
|
||||
{
|
||||
processMsg.append(" (NOT Processed)");
|
||||
log.warning("Invoice Processing failed: " + invoice + " - " + invoice.getProcessMsg());
|
||||
}
|
||||
|
||||
if (!invoice.save())
|
||||
{
|
||||
throw new IllegalStateException("Could not update invoice");
|
||||
}
|
||||
|
||||
// Add processing information to process log
|
||||
addLog(invoice.getC_Invoice_ID(), invoice.getDateInvoiced(), null, processMsg.toString());
|
||||
m_created++;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 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.adempiere.process;
|
||||
|
||||
import org.compiere.model.MOrder;
|
||||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.MRMA;
|
||||
import org.compiere.model.MRMALine;
|
||||
import org.compiere.process.SvrProcess;
|
||||
|
||||
/**
|
||||
* Creates Sales Order from RMA document
|
||||
*
|
||||
* @author Ashley Ramdass
|
||||
*/
|
||||
|
||||
public class RMACreateOrder extends SvrProcess
|
||||
{
|
||||
@Override
|
||||
protected void prepare()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doIt() throws Exception
|
||||
{
|
||||
int rmaId = getRecord_ID();
|
||||
|
||||
// Load RMA
|
||||
MRMA rma = new MRMA(getCtx(), rmaId, get_TrxName());
|
||||
|
||||
// Load Original Order
|
||||
MOrder originalOrder = rma.getOriginalOrder();
|
||||
|
||||
if (rma.get_ID() == 0)
|
||||
{
|
||||
throw new Exception("No RMA defined");
|
||||
}
|
||||
|
||||
if (originalOrder == null)
|
||||
{
|
||||
throw new Exception("Could not load the original order");
|
||||
}
|
||||
|
||||
// Create new order and set the different values based on original order/RMA doc
|
||||
MOrder order = new MOrder(getCtx(), 0, get_TrxName());
|
||||
order.setAD_Org_ID(rma.getAD_Org_ID());
|
||||
order.setC_BPartner_ID(originalOrder.getC_BPartner_ID());
|
||||
order.setC_BPartner_Location_ID(originalOrder.getC_BPartner_Location_ID());
|
||||
order.setAD_User_ID(originalOrder.getAD_User_ID());
|
||||
order.setBill_BPartner_ID(originalOrder.getBill_BPartner_ID());
|
||||
order.setBill_Location_ID(originalOrder.getBill_Location_ID());
|
||||
order.setBill_User_ID(originalOrder.getBill_User_ID());
|
||||
order.setSalesRep_ID(rma.getSalesRep_ID());
|
||||
order.setM_PriceList_ID(originalOrder.getM_PriceList_ID());
|
||||
order.setM_Warehouse_ID(originalOrder.getM_Warehouse_ID());
|
||||
order.setC_DocTypeTarget_ID(originalOrder.getC_DocTypeTarget_ID());
|
||||
order.setC_PaymentTerm_ID(originalOrder.getC_PaymentTerm_ID());
|
||||
order.setDeliveryRule(originalOrder.getDeliveryRule());
|
||||
|
||||
if (!order.save())
|
||||
{
|
||||
throw new IllegalStateException("Could not create order");
|
||||
}
|
||||
|
||||
MRMALine lines[] = rma.getLines(true);
|
||||
|
||||
for (MRMALine line : lines)
|
||||
{
|
||||
if (line.getShipLine() != null && line.getShipLine().getC_OrderLine_ID() != 0)
|
||||
{
|
||||
// Create order lines if the RMA Doc line has a shipment line
|
||||
MOrderLine orderLine = new MOrderLine(order);
|
||||
MOrderLine originalOLine = new MOrderLine(getCtx(), line.getShipLine().getC_OrderLine_ID(), null);
|
||||
orderLine.setAD_Org_ID(line.getAD_Org_ID());
|
||||
orderLine.setM_Product_ID(originalOLine.getM_Product_ID());
|
||||
orderLine.setM_AttributeSetInstance_ID(originalOLine.getM_AttributeSetInstance_ID());
|
||||
orderLine.setC_UOM_ID(originalOLine.getC_UOM_ID());
|
||||
orderLine.setC_Tax_ID(originalOLine.getC_Tax_ID());
|
||||
orderLine.setM_Warehouse_ID(originalOLine.getM_Warehouse_ID());
|
||||
orderLine.setC_Currency_ID(originalOLine.getC_Currency_ID());
|
||||
orderLine.setQty(line.getQty());
|
||||
orderLine.setC_Project_ID(originalOLine.getC_Project_ID());
|
||||
orderLine.setC_Activity_ID(originalOLine.getC_Activity_ID());
|
||||
orderLine.setC_Campaign_ID(originalOLine.getC_Campaign_ID());
|
||||
orderLine.setPrice();
|
||||
orderLine.setPrice(line.getAmt());
|
||||
|
||||
if (!orderLine.save())
|
||||
{
|
||||
throw new IllegalStateException("Could not create Order Line");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rma.setC_Order_ID(order.getC_Order_ID());
|
||||
if (!rma.save())
|
||||
{
|
||||
throw new IllegalStateException("Could not update RMA document");
|
||||
}
|
||||
|
||||
commit();
|
||||
|
||||
return "Order Created: " + order.getDocumentNo();
|
||||
}
|
||||
|
||||
}
|
|
@ -30,6 +30,8 @@ import org.compiere.util.*;
|
|||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: MInOut.java,v 1.4 2006/07/30 00:51:03 jjanke Exp $
|
||||
*
|
||||
* Modifications: Added the RMA functionality (Ashley Ramdass)
|
||||
*/
|
||||
public class MInOut extends X_M_InOut implements DocAction
|
||||
{
|
||||
|
@ -189,6 +191,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
//[ 1633721 ] Reverse Documents- Processing=Y
|
||||
to.setProcessing(false);
|
||||
to.setC_Order_ID(0); // Overwritten by setOrder
|
||||
to.setM_RMA_ID(0); // Overwritten by setOrder
|
||||
if (counter)
|
||||
{
|
||||
to.setC_Order_ID(0);
|
||||
|
@ -211,7 +214,10 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
{
|
||||
to.setRef_InOut_ID(0);
|
||||
if (setOrder)
|
||||
{
|
||||
to.setC_Order_ID(from.getC_Order_ID());
|
||||
to.setM_RMA_ID(from.getM_RMA_ID()); // Copy also RMA
|
||||
}
|
||||
}
|
||||
//
|
||||
if (!to.save(trxName))
|
||||
|
@ -663,7 +669,10 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
line.set_ValueNoCheck ("M_InOutLine_ID", I_ZERO); // new
|
||||
// Reset
|
||||
if (!setOrder)
|
||||
{
|
||||
line.setC_OrderLine_ID(0);
|
||||
line.setM_RMALine_ID(0); // Reset RMA Line
|
||||
}
|
||||
if (!counter)
|
||||
line.setM_AttributeSetInstance_ID(0);
|
||||
// line.setS_ResourceAssignment_ID(0);
|
||||
|
@ -923,12 +932,30 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
return false;
|
||||
}
|
||||
}
|
||||
// Shipment - Needs Order
|
||||
if (isSOTrx() && getC_Order_ID() == 0)
|
||||
|
||||
// Shipment/Receipt can have either Order/RMA (For Movement type)
|
||||
if (getC_Order_ID() != 0 && getM_RMA_ID() != 0)
|
||||
{
|
||||
log.saveError("OrderOrRMA", "");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Shipment - Needs Order/RMA
|
||||
if (isSOTrx() && getC_Order_ID() == 0 && getM_RMA_ID() == 0)
|
||||
{
|
||||
log.saveError("FillMandatory", Msg.translate(getCtx(), "C_Order_ID"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isSOTrx() && getM_RMA_ID() != 0)
|
||||
{
|
||||
// Set Document and Movement type for this Receipt
|
||||
MRMA rma = new MRMA(getCtx(), getM_RMA_ID(), get_TrxName());
|
||||
MDocType docType = MDocType.get(getCtx(), rma.getC_DocType_ID());
|
||||
setC_DocType_ID(docType.getC_DocTypeShipment_ID());
|
||||
setMovementType(MOVEMENTTYPE_CustomerReturns);
|
||||
}
|
||||
|
||||
return true;
|
||||
} // beforeSave
|
||||
|
||||
|
@ -1009,6 +1036,12 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
|
||||
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
|
||||
|
||||
// Order OR RMA can be processed on a shipment/receipt
|
||||
if (getC_Order_ID() != 0 && getM_RMA_ID() != 0)
|
||||
{
|
||||
m_processMsg = "@OrderOrRMA@";
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
// Std Period open?
|
||||
if (!MPeriod.isOpen(getCtx(), getDateAcct(), dt.getDocBaseType()))
|
||||
{
|
||||
|
@ -1194,6 +1227,15 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
QtyPO = sLine.getMovementQty();
|
||||
}
|
||||
|
||||
|
||||
// Load RMA Line
|
||||
MRMALine rmaLine = null;
|
||||
|
||||
if (sLine.getM_RMALine_ID() != 0)
|
||||
{
|
||||
rmaLine = new MRMALine(getCtx(), sLine.getM_RMALine_ID(), get_TrxName());
|
||||
}
|
||||
|
||||
log.info("Line=" + sLine.getLine() + " - Qty=" + sLine.getMovementQty());
|
||||
|
||||
// Stock Movement - Counterpart MOrder.reserveStock
|
||||
|
@ -1301,6 +1343,23 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
log.fine("OrderLine -> Reserved=" + oLine.getQtyReserved()
|
||||
+ ", Delivered=" + oLine.getQtyReserved());
|
||||
}
|
||||
// Update RMA Line Qty Delivered
|
||||
else if (rmaLine != null)
|
||||
{
|
||||
if (isSOTrx())
|
||||
{
|
||||
rmaLine.setQtyDelivered(rmaLine.getQtyDelivered().subtract(Qty));
|
||||
}
|
||||
else
|
||||
{
|
||||
rmaLine.setQtyDelivered(rmaLine.getQtyDelivered().add(Qty));
|
||||
}
|
||||
if (!rmaLine.save())
|
||||
{
|
||||
m_processMsg = "Could not update RMA Line";
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
// Create Asset for SO
|
||||
if (product != null
|
||||
|
@ -1799,6 +1858,8 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
}
|
||||
}
|
||||
reversal.setC_Order_ID(getC_Order_ID());
|
||||
// Set M_RMA_ID
|
||||
reversal.setM_RMA_ID(getM_RMA_ID());
|
||||
reversal.addDescription("{->" + getDocumentNo() + ")");
|
||||
//
|
||||
if (!reversal.processIt(DocAction.ACTION_Complete)
|
||||
|
|
|
@ -556,8 +556,8 @@ public class MInOutLine extends X_M_InOutLine
|
|||
if (newRecord || is_ValueChanged("MovementQty"))
|
||||
setMovementQty(getMovementQty());
|
||||
|
||||
// Order Line
|
||||
if (getC_OrderLine_ID() == 0)
|
||||
// Order/RMA Line
|
||||
if (getC_OrderLine_ID() == 0 && getM_RMALine_ID() == 0)
|
||||
{
|
||||
if (getParent().isSOTrx())
|
||||
{
|
||||
|
|
|
@ -34,6 +34,8 @@ import org.compiere.util.*;
|
|||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: MInvoice.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $
|
||||
*
|
||||
* Modifications: Added RMA functionality (Ashley Ramdass)
|
||||
*/
|
||||
public class MInvoice extends X_C_Invoice implements DocAction
|
||||
{
|
||||
|
@ -497,6 +499,29 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
// Overwrite Invoice Address
|
||||
setC_BPartner_Location_ID(order.getBill_Location_ID());
|
||||
}
|
||||
// Check if Shipment/Receipt is based on RMA
|
||||
if (ship.getM_RMA_ID() != 0)
|
||||
{
|
||||
MRMA rma = new MRMA(getCtx(), ship.getM_RMA_ID(), get_TrxName());
|
||||
MOrder rmaOrder = rma.getOriginalOrder();
|
||||
setM_RMA_ID(ship.getM_RMA_ID());
|
||||
setIsSOTrx(rma.isSOTrx());
|
||||
setM_PriceList_ID(rmaOrder.getM_PriceList_ID());
|
||||
setIsTaxIncluded(rmaOrder.isTaxIncluded());
|
||||
setC_Currency_ID(rmaOrder.getC_Currency_ID());
|
||||
setC_ConversionType_ID(rmaOrder.getC_ConversionType_ID());
|
||||
setPaymentRule(rmaOrder.getPaymentRule());
|
||||
setC_PaymentTerm_ID(rmaOrder.getC_PaymentTerm_ID());
|
||||
|
||||
// Retrieves the invoice DocType
|
||||
MDocType dt = MDocType.get(getCtx(), rma.getC_DocType_ID());
|
||||
if (dt.getC_DocTypeInvoice_ID() != 0)
|
||||
{
|
||||
setC_DocTypeTarget_ID(dt.getC_DocTypeInvoice_ID());
|
||||
}
|
||||
setC_BPartner_Location_ID(rmaOrder.getBill_Location_ID());
|
||||
}
|
||||
|
||||
} // setShipment
|
||||
|
||||
/**
|
||||
|
|
|
@ -227,6 +227,8 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
|||
{
|
||||
setM_InOutLine_ID(sLine.getM_InOutLine_ID());
|
||||
setC_OrderLine_ID(sLine.getC_OrderLine_ID());
|
||||
// Set RMALine ID if shipment/receipt is based on RMA Doc
|
||||
setM_RMALine_ID(sLine.getM_RMALine_ID());
|
||||
|
||||
//
|
||||
setLine(sLine.getLine());
|
||||
|
@ -254,6 +256,17 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
|||
setC_Tax_ID(oLine.getC_Tax_ID());
|
||||
setLineNetAmt(oLine.getLineNetAmt());
|
||||
setC_Project_ID(oLine.getC_Project_ID());
|
||||
}
|
||||
// Check if shipment line is based on RMA
|
||||
else if (sLine.getM_RMALine_ID() != 0)
|
||||
{
|
||||
// Set Pricing details from the RMA Line on which it is based
|
||||
MRMALine rmaLine = new MRMALine(getCtx(), sLine.getM_RMALine_ID(), get_TrxName());
|
||||
|
||||
setPrice();
|
||||
setPrice(rmaLine.getAmt());
|
||||
setC_Tax_ID(rmaLine.getC_Tax_ID());
|
||||
setLineNetAmt(rmaLine.getLineNetAmt());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -29,6 +29,8 @@ import org.compiere.util.*;
|
|||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: MRMA.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $
|
||||
*
|
||||
* Modifications: Completed RMA functionality (Ashley Ramdass)
|
||||
*/
|
||||
public class MRMA extends X_M_RMA implements DocAction
|
||||
{
|
||||
|
@ -72,7 +74,7 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
|
||||
/**
|
||||
* Get Lines
|
||||
* @param requery requary
|
||||
* @param requery requery
|
||||
* @return lines
|
||||
*/
|
||||
public MRMALine[] getLines (boolean requery)
|
||||
|
@ -120,11 +122,56 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
*/
|
||||
public MInOut getShipment()
|
||||
{
|
||||
if (m_inout == null && getM_InOut_ID() != 0)
|
||||
m_inout = new MInOut (getCtx(), getM_InOut_ID(), get_TrxName());
|
||||
if (m_inout == null && getInOut_ID() != 0)
|
||||
m_inout = new MInOut (getCtx(), getInOut_ID(), get_TrxName());
|
||||
return m_inout;
|
||||
} // getShipment
|
||||
|
||||
/**
|
||||
* Get the original order on which the shipment/receipt defined is based upon.
|
||||
* @return order
|
||||
*/
|
||||
public MOrder getOriginalOrder()
|
||||
{
|
||||
MInOut shipment = getShipment();
|
||||
if (shipment == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new MOrder(getCtx(), shipment.getC_Order_ID(), get_TrxName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the original invoice on which the shipment/receipt defined is based upon.
|
||||
* @return invoice
|
||||
*/
|
||||
public MInvoice getOriginalInvoice()
|
||||
{
|
||||
MInOut shipment = getShipment();
|
||||
if (shipment == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int invId = 0;
|
||||
|
||||
if (shipment.getC_Invoice_ID() != 0)
|
||||
{
|
||||
invId = shipment.getC_Invoice_ID();
|
||||
}
|
||||
else
|
||||
{
|
||||
String sqlStmt = "SELECT C_Invoice_ID FROM C_Invoice WHERE C_Order_ID=?";
|
||||
invId = DB.getSQLValue(null, sqlStmt, shipment.getC_Order_ID());
|
||||
}
|
||||
|
||||
if (invId <= 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new MInvoice(getCtx(), invId, get_TrxName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set M_InOut_ID
|
||||
|
@ -132,7 +179,7 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
*/
|
||||
public void setM_InOut_ID (int M_InOut_ID)
|
||||
{
|
||||
super.setM_InOut_ID (M_InOut_ID);
|
||||
setInOut_ID (M_InOut_ID);
|
||||
setC_Currency_ID(0);
|
||||
setAmt(Env.ZERO);
|
||||
setC_BPartner_ID(0);
|
||||
|
@ -190,17 +237,16 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
*/
|
||||
protected boolean beforeSave (boolean newRecord)
|
||||
{
|
||||
getShipment();
|
||||
// Set BPartner
|
||||
if (getC_BPartner_ID() == 0)
|
||||
{
|
||||
getShipment();
|
||||
if (m_inout != null)
|
||||
setC_BPartner_ID(m_inout.getC_BPartner_ID());
|
||||
}
|
||||
// Set Currency
|
||||
if (getC_Currency_ID() == 0)
|
||||
{
|
||||
getShipment();
|
||||
if (m_inout != null)
|
||||
{
|
||||
if (m_inout.getC_Order_ID() != 0)
|
||||
|
@ -215,6 +261,14 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Verification whether Shipment/Receipt matches RMA for sales transaction
|
||||
if (m_inout != null && m_inout.isSOTrx() != isSOTrx())
|
||||
{
|
||||
log.saveError("RMA.IsSOTrx <> InOut.IsSOTrx", "");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} // beforeSave
|
||||
|
||||
|
@ -275,14 +329,9 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
m_processMsg = "@NoLines@";
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
// Check Lines
|
||||
BigDecimal amt = Env.ZERO;
|
||||
for (int i = 0; i < lines.length; i++)
|
||||
{
|
||||
MRMALine line = lines[i];
|
||||
amt = amt.add(line.getAmt());
|
||||
}
|
||||
setAmt(amt);
|
||||
|
||||
// Updates Amount
|
||||
setAmt(getTotalAmount());
|
||||
|
||||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
|
||||
if (m_processMsg != null)
|
||||
|
@ -337,11 +386,14 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
approveIt();
|
||||
log.info("completeIt - " + toString());
|
||||
//
|
||||
/*
|
||||
Flow for the creation of the credit memo document changed
|
||||
if (true)
|
||||
{
|
||||
m_processMsg = "Need to code creating the credit memo";
|
||||
return DocAction.STATUS_InProgress;
|
||||
}
|
||||
*/
|
||||
// User Validation
|
||||
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
|
||||
if (valid != null)
|
||||
|
@ -366,13 +418,32 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
|
||||
if (m_processMsg != null)
|
||||
return false;
|
||||
|
||||
MRMALine lines[] = getLines(true);
|
||||
// Set Qty and Amt on all lines to be Zero
|
||||
for (MRMALine rmaLine : lines)
|
||||
{
|
||||
rmaLine.addDescription(Msg.getMsg(getCtx(), "Voided") + " (" + rmaLine.getQty() + ")");
|
||||
rmaLine.setQty(Env.ZERO);
|
||||
rmaLine.setAmt(Env.ZERO);
|
||||
|
||||
if (!rmaLine.save())
|
||||
{
|
||||
m_processMsg = "Could not update line";
|
||||
}
|
||||
}
|
||||
|
||||
addDescription(Msg.getMsg(getCtx(), "Voided"));
|
||||
setAmt(Env.ZERO);
|
||||
|
||||
// After Void
|
||||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
|
||||
if (m_processMsg != null)
|
||||
return false;
|
||||
|
||||
// Revoke Credit
|
||||
return false;
|
||||
setProcessed(true);
|
||||
setDocAction(DOCACTION_None);
|
||||
return true;
|
||||
} // voidIt
|
||||
|
||||
/**
|
||||
|
@ -455,6 +526,62 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
return false;
|
||||
} // reActivateIt
|
||||
|
||||
/**
|
||||
* Set Processed.
|
||||
* Propagate to Lines
|
||||
* @param processed processed
|
||||
*/
|
||||
public void setProcessed (boolean processed)
|
||||
{
|
||||
super.setProcessed (processed);
|
||||
if (get_ID() == 0)
|
||||
return;
|
||||
String set = "SET Processed='"
|
||||
+ (processed ? "Y" : "N")
|
||||
+ "' WHERE M_RMA_ID=" + getM_RMA_ID();
|
||||
int noLine = DB.executeUpdate("UPDATE M_RMALine " + set, get_TrxName());
|
||||
m_lines = null;
|
||||
log.fine("setProcessed - " + processed + " - Lines=" + noLine);
|
||||
} // setProcessed
|
||||
|
||||
/**
|
||||
* Add to Description
|
||||
* @param description text
|
||||
*/
|
||||
public void addDescription (String description)
|
||||
{
|
||||
String desc = getDescription();
|
||||
if (desc == null)
|
||||
setDescription(description);
|
||||
else
|
||||
setDescription(desc + " | " + description);
|
||||
} // addDescription
|
||||
|
||||
/**
|
||||
* Get the total amount based on the lines
|
||||
* @return Total Amount
|
||||
*/
|
||||
public BigDecimal getTotalAmount()
|
||||
{
|
||||
MRMALine lines[] = this.getLines(true);
|
||||
|
||||
BigDecimal amt = Env.ZERO;
|
||||
|
||||
for (MRMALine line : lines)
|
||||
{
|
||||
amt = amt.add(line.getLineNetAmt());
|
||||
}
|
||||
|
||||
return amt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the amount on the document
|
||||
*/
|
||||
public void updateAmount()
|
||||
{
|
||||
setAmt(getTotalAmount());
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Get Summary
|
||||
|
@ -474,6 +601,49 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
return sb.toString();
|
||||
} // getSummary
|
||||
|
||||
/**
|
||||
* Retrieves all the charge lines that is present on the document
|
||||
* @return Charge Lines
|
||||
*/
|
||||
public MRMALine[] getChargeLines()
|
||||
{
|
||||
StringBuffer whereClause = new StringBuffer();
|
||||
whereClause.append("IsActive='Y' AND M_RMA_ID=");
|
||||
whereClause.append(get_ID());
|
||||
whereClause.append(" AND C_Charge_ID IS NOT null");
|
||||
|
||||
int rmaLineIds[] = MRMALine.getAllIDs(MRMALine.Table_Name, whereClause.toString(), get_TrxName());
|
||||
|
||||
ArrayList<MRMALine> chargeLineList = new ArrayList<MRMALine>();
|
||||
|
||||
for (int i = 0; i < rmaLineIds.length; i++)
|
||||
{
|
||||
MRMALine rmaLine = new MRMALine(getCtx(), rmaLineIds[i], get_TrxName());
|
||||
chargeLineList.add(rmaLine);
|
||||
}
|
||||
|
||||
MRMALine lines[] = new MRMALine[chargeLineList.size()];
|
||||
chargeLineList.toArray(lines);
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether Tax is included (based on the original order)
|
||||
* @return True if tax is included
|
||||
*/
|
||||
public boolean isTaxIncluded()
|
||||
{
|
||||
MOrder order = getOriginalOrder();
|
||||
|
||||
if (order != null && order.get_ID() != 0)
|
||||
{
|
||||
return order.isTaxIncluded();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Process Message
|
||||
* @return clear text error message
|
||||
|
@ -500,5 +670,4 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
{
|
||||
return getAmt();
|
||||
} // getApprovalAmt
|
||||
|
||||
} // MRMA
|
||||
|
|
|
@ -44,10 +44,12 @@ public class MRMALine extends X_M_RMALine
|
|||
{
|
||||
setQty(Env.ONE);
|
||||
}
|
||||
|
||||
init();
|
||||
} // MRMALine
|
||||
|
||||
/**
|
||||
* Load Cosntructor
|
||||
* Load Constructor
|
||||
* @param ctx context
|
||||
* @param rs result set
|
||||
* @param trxName transaction
|
||||
|
@ -55,11 +57,80 @@ public class MRMALine extends X_M_RMALine
|
|||
public MRMALine (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super(ctx, rs, trxName);
|
||||
init();
|
||||
} // MRMALine
|
||||
|
||||
/** Shipment Line */
|
||||
private MInOutLine m_ioLine = null;
|
||||
/** Parent */
|
||||
private MRMA m_parent = null;
|
||||
|
||||
private int precision = 0;
|
||||
private int taxId = 0;
|
||||
private BigDecimal unitAmount = Env.ZERO;
|
||||
private BigDecimal originalQty = Env.ZERO;
|
||||
|
||||
/**
|
||||
* Initialise parameters that are required
|
||||
*/
|
||||
private void init()
|
||||
{
|
||||
if (getC_Charge_ID() != 0)
|
||||
{
|
||||
// Retrieve tax Exempt
|
||||
String sql = "SELECT C_Tax_ID FROM C_Tax WHERE AD_Client_ID=? AND IsActive='Y' "
|
||||
+ "AND IsTaxExempt='Y' AND ValidFrom < SYSDATE ORDER BY IsDefault DESC";
|
||||
|
||||
// Set tax for charge as exempt
|
||||
taxId = DB.getSQLValue(null, sql, Env.getAD_Client_ID(getCtx()));
|
||||
m_ioLine = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
getShipLine();
|
||||
}
|
||||
|
||||
if (m_ioLine != null)
|
||||
{
|
||||
// Get pricing details (Based on invoice if found, on order otherwise)
|
||||
if (m_ioLine.isInvoiced() && getInvoiceLineId() != 0)
|
||||
{
|
||||
MInvoiceLine invoiceLine = new MInvoiceLine(getCtx(), getInvoiceLineId(), get_TrxName());
|
||||
precision = invoiceLine.getPrecision();
|
||||
unitAmount = invoiceLine.getPriceEntered();
|
||||
originalQty = invoiceLine.getQtyInvoiced();
|
||||
taxId = invoiceLine.getC_Tax_ID();
|
||||
}
|
||||
else if (m_ioLine.getC_OrderLine_ID() != 0)
|
||||
{
|
||||
MOrderLine orderLine = new MOrderLine (getCtx(), m_ioLine.getC_OrderLine_ID(), get_TrxName());
|
||||
precision = orderLine.getPrecision();
|
||||
unitAmount = orderLine.getPriceEntered();
|
||||
originalQty = orderLine.getQtyDelivered();
|
||||
taxId = orderLine.getC_Tax_ID();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException("No Invoice/Order line found the Shipment/Receipt line associated");
|
||||
}
|
||||
}
|
||||
else if (getC_Charge_ID() != 0)
|
||||
{
|
||||
MCharge charge = new MCharge(this.getCtx(), getC_Charge_ID(), null);
|
||||
unitAmount = charge.getChargeAmt();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Parent
|
||||
* @return parent
|
||||
*/
|
||||
public MRMA getParent()
|
||||
{
|
||||
if (m_parent == null)
|
||||
m_parent = new MRMA(getCtx(), getM_RMA_ID(), get_TrxName());
|
||||
return m_parent;
|
||||
} // getParent
|
||||
|
||||
/**
|
||||
* Set M_InOutLine_ID
|
||||
|
@ -77,30 +148,356 @@ public class MRMALine extends X_M_RMALine
|
|||
*/
|
||||
public MInOutLine getShipLine()
|
||||
{
|
||||
if (m_ioLine == null && getM_InOutLine_ID() != 0)
|
||||
if ((m_ioLine == null || is_ValueChanged("M_InOutLine_ID")) && getM_InOutLine_ID() != 0)
|
||||
m_ioLine = new MInOutLine (getCtx(), getM_InOutLine_ID(), get_TrxName());
|
||||
return m_ioLine;
|
||||
} // getShipLine
|
||||
|
||||
/**
|
||||
* Get Total Amt
|
||||
* Retrieves the invoiceLine Id associated with the Shipment/Receipt Line
|
||||
* @return Invoice Line ID
|
||||
*/
|
||||
private int getInvoiceLineId()
|
||||
{
|
||||
String whereClause = "M_InOutLine_ID=" + getM_InOutLine_ID();
|
||||
|
||||
int invoiceLineIds[] = MInvoiceLine.getAllIDs(MInvoiceLine.Table_Name, whereClause, null);
|
||||
|
||||
if (invoiceLineIds.length == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return invoiceLineIds[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the unit amount for the product/charge
|
||||
* @return Unit Amount
|
||||
*/
|
||||
public BigDecimal getUnitAmt()
|
||||
{
|
||||
return unitAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Total Amt for the line including tax
|
||||
* @return amt
|
||||
*/
|
||||
public BigDecimal getAmt()
|
||||
public BigDecimal getTotalAmt()
|
||||
{
|
||||
BigDecimal amt = Env.ZERO;
|
||||
getShipLine();
|
||||
if (m_ioLine != null)
|
||||
BigDecimal totalAmt = Env.ZERO;
|
||||
BigDecimal taxAmt = Env.ZERO;
|
||||
|
||||
if (Env.ZERO.compareTo(getQty()) != 0 && Env.ZERO.compareTo(getAmt()) != 0)
|
||||
{
|
||||
if (m_ioLine.getC_OrderLine_ID() != 0)
|
||||
totalAmt = getQty().multiply(getAmt());
|
||||
if (!getParent().isTaxIncluded())
|
||||
{
|
||||
MOrderLine ol = new MOrderLine (getCtx(), m_ioLine.getC_OrderLine_ID(), get_TrxName());
|
||||
amt = ol.getPriceActual();
|
||||
MTax tax = MTax.get (getCtx(), taxId);
|
||||
taxAmt = tax.calculateTax(getQty().multiply(unitAmount),
|
||||
getParent().isTaxIncluded(), precision);
|
||||
}
|
||||
}
|
||||
//
|
||||
return amt.multiply(getQty());
|
||||
|
||||
totalAmt = totalAmt.add(taxAmt);
|
||||
return totalAmt;
|
||||
} // getAmt
|
||||
|
||||
/**
|
||||
* Get whether the Ship line has been invoiced
|
||||
* @return true if invoiced
|
||||
*/
|
||||
public boolean isShipLineInvoiced()
|
||||
{
|
||||
return (getInvoiceLineId() != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Before Save
|
||||
* @param newRecord new
|
||||
* @return save
|
||||
*/
|
||||
protected boolean beforeSave(boolean newRecord)
|
||||
{
|
||||
if (this.getM_InOutLine_ID() == 0 && this.getC_Charge_ID() == 0)
|
||||
{
|
||||
log.saveError("FillMandatory", "Shipment/Receipt Line or charge should be entered");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.getM_InOutLine_ID() != 0 && this.getC_Charge_ID() != 0)
|
||||
{
|
||||
log.saveError("Error", "Either shipment/receipt line or charge should be selected");
|
||||
return false;
|
||||
}
|
||||
|
||||
init();
|
||||
if (m_ioLine != null)
|
||||
{
|
||||
if (m_ioLine.getMovementQty().compareTo(getQty()) < 0)
|
||||
{
|
||||
log.saveError("Error", "Amount to be returned is greater than the amount shipped");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (newRecord)
|
||||
{
|
||||
String whereClause = "M_RMA_ID=" + this.getM_RMA_ID() + " and M_InOutLine_ID=" + this.getM_InOutLine_ID();
|
||||
|
||||
int lineIds[] = MRMALine.getAllIDs(MRMALine.Table_Name, whereClause, this.get_TrxName());
|
||||
|
||||
if (lineIds.length > 0)
|
||||
{
|
||||
log.saveError("Error", "Shipment/Receipt line is already defined in another line");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set default amount for charge and qty
|
||||
if (this.getC_Charge_ID() != 0 && this.getQty().doubleValue() <= 0)
|
||||
{
|
||||
if (Env.ZERO.compareTo(getQty()) == 0)
|
||||
this.setQty(new BigDecimal(1));
|
||||
if (Env.ZERO.compareTo(getAmt()) == 0)
|
||||
this.setAmt(getUnitAmt());
|
||||
}
|
||||
|
||||
// Set amount for products
|
||||
if (this.getM_InOutLine_ID() != 0)
|
||||
{
|
||||
this.setAmt(getUnitAmt());
|
||||
|
||||
if (newRecord && Env.ZERO.compareTo(getQty()) == 0)
|
||||
{
|
||||
this.setQty(originalQty);
|
||||
}
|
||||
}
|
||||
|
||||
this.setLineNetAmt(getTotalAmt());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* After Save
|
||||
* @param newRecord new
|
||||
* @param success success
|
||||
* @return true if can be saved
|
||||
*/
|
||||
protected boolean afterSave(boolean newRecord, boolean success)
|
||||
{
|
||||
if (!success)
|
||||
{
|
||||
return success;
|
||||
}
|
||||
|
||||
MRMA rma = new MRMA(getCtx(), getM_RMA_ID(), get_TrxName());
|
||||
rma.updateAmount();
|
||||
|
||||
if (!rma.save())
|
||||
{
|
||||
throw new IllegalStateException("Could not update RMA grand total");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to Description
|
||||
* @param description text
|
||||
*/
|
||||
public void addDescription (String description)
|
||||
{
|
||||
String desc = getDescription();
|
||||
if (desc == null)
|
||||
setDescription(description);
|
||||
else
|
||||
setDescription(desc + " | " + description);
|
||||
} // addDescription
|
||||
|
||||
/**
|
||||
* Get precision
|
||||
* Based on Invoice if the shipment was invoiced, on Order otherwise
|
||||
*/
|
||||
public int getPrecision()
|
||||
{
|
||||
return precision;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get UOM
|
||||
* Based on Shipment line if present
|
||||
* Default to Each (100) for charge
|
||||
* @return UOM if based on shipment line and 100 for charge based
|
||||
*/
|
||||
public int getC_UOM_ID()
|
||||
{
|
||||
if (m_ioLine == null) // Charge
|
||||
{
|
||||
return 100; // Each
|
||||
}
|
||||
|
||||
return m_ioLine.getC_UOM_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Product
|
||||
* @return product if based on shipment line and 0 for charge based
|
||||
*/
|
||||
public int getM_Product_ID()
|
||||
{
|
||||
if (getC_Charge_ID() != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getM_Product_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Project
|
||||
* @return project if based on shipment line and 0 for charge based
|
||||
*/
|
||||
public int getC_Project_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getC_Project_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Project Phase
|
||||
* @return project phase if based on shipment line and 0 for charge based
|
||||
*/
|
||||
public int getC_ProjectPhase_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getC_ProjectPhase_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Project Task
|
||||
* @return project task if based on shipment line and 0 for charge based
|
||||
*/
|
||||
public int getC_ProjectTask_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getC_ProjectTask_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Activity
|
||||
* @return project phase if based on shipment line and 0 for charge based
|
||||
*/
|
||||
public int getC_Activity_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getC_Activity_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Campaign
|
||||
* @return campaign if based on shipment line and 0 for charge based
|
||||
*/
|
||||
public int getC_Campaign_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getC_Campaign_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Org Trx
|
||||
* @return Org Trx if based on shipment line and 0 for charge based
|
||||
*/
|
||||
public int getAD_OrgTrx_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getAD_OrgTrx_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get User1
|
||||
* @return user1 if based on shipment line and 0 for charge based
|
||||
*/
|
||||
public int getUser1_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getUser1_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get User2
|
||||
* @return user2 if based on shipment line and 0 for charge based
|
||||
*/
|
||||
public int getUser2_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getUser2_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Attribute Set Instance
|
||||
* @return ASI if based on shipment line and 0 for charge based
|
||||
*/
|
||||
public int getM_AttributeSetInstance_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getM_AttributeSetInstance_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Locator
|
||||
* @return locator if based on shipment line and 0 for charge based
|
||||
*/
|
||||
public int getM_Locator_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getM_Locator_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Tax
|
||||
* @return Tax based on Invoice/Order line and Tax exempt for charge based
|
||||
*/
|
||||
public int getC_Tax_ID()
|
||||
{
|
||||
return taxId;
|
||||
}
|
||||
|
||||
} // MRMALine
|
||||
|
|
|
@ -734,7 +734,7 @@ public final class MSetup
|
|||
|
||||
createDocType("AP Invoice", Msg.getElement(m_ctx, "C_Invoice_ID", false),
|
||||
MDocType.DOCBASETYPE_APInvoice, null, 0, 0, 0, GL_API);
|
||||
createDocType("AP CreditMemo", Msg.getMsg(m_ctx, "CreditMemo"),
|
||||
int DT_IPC = createDocType("AP CreditMemo", Msg.getMsg(m_ctx, "CreditMemo"),
|
||||
MDocType.DOCBASETYPE_APCreditMemo, null, 0, 0, 0, GL_API);
|
||||
createDocType("Match Invoice", Msg.getElement(m_ctx, "M_MatchInv_ID", false),
|
||||
MDocType.DOCBASETYPE_MatchInvoice, null, 0, 0, 390000, GL_API);
|
||||
|
@ -750,6 +750,8 @@ public final class MSetup
|
|||
MDocType.DOCBASETYPE_MaterialDelivery, null, 0, 0, 500000, GL_MM);
|
||||
int DT_SI = createDocType("MM Shipment Indirect", "Delivery Note",
|
||||
MDocType.DOCBASETYPE_MaterialDelivery, null, 0, 0, 550000, GL_MM);
|
||||
int DT_VRM = createDocType("MM Vendor Return", "Vendor Returns",
|
||||
MDocType.DOCBASETYPE_MaterialDelivery, null, 0, 0, 590000, GL_MM);
|
||||
|
||||
createDocType("MM Receipt", "Vendor Delivery",
|
||||
MDocType.DOCBASETYPE_MaterialReceipt, null, 0, 0, 0, GL_MM);
|
||||
|
@ -762,6 +764,9 @@ public final class MSetup
|
|||
MDocType.DOCBASETYPE_MatchPO, null, 0, 0, 890000, GL_None);
|
||||
createDocType("Purchase Requisition", Msg.getElement(m_ctx, "M_Requisition_ID", false),
|
||||
MDocType.DOCBASETYPE_PurchaseRequisition, null, 0, 0, 900000, GL_None);
|
||||
createDocType("Vendor Return Material", "Vendor Return Material Authorization",
|
||||
MDocType.DOCBASETYPE_PurchaseOrder, MDocType.DOCSUBTYPESO_ReturnMaterial, DT_VRM,
|
||||
DT_IPC, 990000, GL_MM);
|
||||
|
||||
createDocType("Bank Statement", Msg.getElement(m_ctx, "C_BankStatemet_ID", true),
|
||||
MDocType.DOCBASETYPE_BankStatement, null, 0, 0, 700000, GL_CASH);
|
||||
|
|
|
@ -80,13 +80,13 @@ public X_C_Invoice (Properties ctx, ResultSet rs, String trxName)
|
|||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
/** AD_Table_ID=318 */
|
||||
public static final int Table_ID=MTable.getTable_ID("C_Invoice");
|
||||
|
||||
/** TableName=C_Invoice */
|
||||
public static final String Table_Name="C_Invoice";
|
||||
|
||||
protected static KeyNamePair Model = new KeyNamePair(Table_ID,"C_Invoice");
|
||||
/** AD_Table_ID=318 */
|
||||
public static final int Table_ID=MTable.getTable_ID(Table_Name);
|
||||
|
||||
protected static KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
protected BigDecimal accessLevel = BigDecimal.valueOf(1);
|
||||
/** AccessLevel
|
||||
|
@ -555,32 +555,32 @@ public static final String COLUMNNAME_Description = "Description";
|
|||
|
||||
/** DocAction AD_Reference_ID=135 */
|
||||
public static final int DOCACTION_AD_Reference_ID=135;
|
||||
/** <None> = -- */
|
||||
public static final String DOCACTION_None = "--";
|
||||
/** Approve = AP */
|
||||
public static final String DOCACTION_Approve = "AP";
|
||||
/** Close = CL */
|
||||
public static final String DOCACTION_Close = "CL";
|
||||
/** Complete = CO */
|
||||
public static final String DOCACTION_Complete = "CO";
|
||||
/** Invalidate = IN */
|
||||
public static final String DOCACTION_Invalidate = "IN";
|
||||
/** Post = PO */
|
||||
public static final String DOCACTION_Post = "PO";
|
||||
/** Prepare = PR */
|
||||
public static final String DOCACTION_Prepare = "PR";
|
||||
/** Reverse - Accrual = RA */
|
||||
public static final String DOCACTION_Reverse_Accrual = "RA";
|
||||
/** Reverse - Correct = RC */
|
||||
public static final String DOCACTION_Reverse_Correct = "RC";
|
||||
/** Re-activate = RE */
|
||||
public static final String DOCACTION_Re_Activate = "RE";
|
||||
/** Approve = AP */
|
||||
public static final String DOCACTION_Approve = "AP";
|
||||
/** Reject = RJ */
|
||||
public static final String DOCACTION_Reject = "RJ";
|
||||
/** Post = PO */
|
||||
public static final String DOCACTION_Post = "PO";
|
||||
/** Void = VO */
|
||||
public static final String DOCACTION_Void = "VO";
|
||||
/** Close = CL */
|
||||
public static final String DOCACTION_Close = "CL";
|
||||
/** Reverse - Correct = RC */
|
||||
public static final String DOCACTION_Reverse_Correct = "RC";
|
||||
/** Reverse - Accrual = RA */
|
||||
public static final String DOCACTION_Reverse_Accrual = "RA";
|
||||
/** Invalidate = IN */
|
||||
public static final String DOCACTION_Invalidate = "IN";
|
||||
/** Re-activate = RE */
|
||||
public static final String DOCACTION_Re_Activate = "RE";
|
||||
/** <None> = -- */
|
||||
public static final String DOCACTION_None = "--";
|
||||
/** Wait Complete = WC */
|
||||
public static final String DOCACTION_WaitComplete = "WC";
|
||||
/** Prepare = PR */
|
||||
public static final String DOCACTION_Prepare = "PR";
|
||||
/** Unlock = XL */
|
||||
public static final String DOCACTION_Unlock = "XL";
|
||||
/** Set Document Action.
|
||||
|
@ -588,8 +588,8 @@ public static final String DOCACTION_Unlock = "XL";
|
|||
public void setDocAction (String DocAction)
|
||||
{
|
||||
if (DocAction == null) throw new IllegalArgumentException ("DocAction is mandatory");
|
||||
if (DocAction.equals("--") || DocAction.equals("AP") || DocAction.equals("CL") || DocAction.equals("CO") || DocAction.equals("IN") || DocAction.equals("PO") || DocAction.equals("PR") || DocAction.equals("RA") || DocAction.equals("RC") || DocAction.equals("RE") || DocAction.equals("RJ") || DocAction.equals("VO") || DocAction.equals("WC") || DocAction.equals("XL"));
|
||||
else throw new IllegalArgumentException ("DocAction Invalid value - " + DocAction + " - Reference_ID=135 - -- - AP - CL - CO - IN - PO - PR - RA - RC - RE - RJ - VO - WC - XL");
|
||||
if (DocAction.equals("CO") || DocAction.equals("AP") || DocAction.equals("RJ") || DocAction.equals("PO") || DocAction.equals("VO") || DocAction.equals("CL") || DocAction.equals("RC") || DocAction.equals("RA") || DocAction.equals("IN") || DocAction.equals("RE") || DocAction.equals("--") || DocAction.equals("WC") || DocAction.equals("PR") || DocAction.equals("XL"));
|
||||
else throw new IllegalArgumentException ("DocAction Invalid value - " + DocAction + " - Reference_ID=135 - CO - AP - RJ - PO - VO - CL - RC - RA - IN - RE - -- - WC - PR - XL");
|
||||
if (DocAction.length() > 2)
|
||||
{
|
||||
log.warning("Length > 2 - truncated");
|
||||
|
@ -608,28 +608,28 @@ public static final String COLUMNNAME_DocAction = "DocAction";
|
|||
|
||||
/** DocStatus AD_Reference_ID=131 */
|
||||
public static final int DOCSTATUS_AD_Reference_ID=131;
|
||||
/** Unknown = ?? */
|
||||
public static final String DOCSTATUS_Unknown = "??";
|
||||
/** Approved = AP */
|
||||
public static final String DOCSTATUS_Approved = "AP";
|
||||
/** Closed = CL */
|
||||
public static final String DOCSTATUS_Closed = "CL";
|
||||
/** Completed = CO */
|
||||
public static final String DOCSTATUS_Completed = "CO";
|
||||
/** Drafted = DR */
|
||||
public static final String DOCSTATUS_Drafted = "DR";
|
||||
/** Invalid = IN */
|
||||
public static final String DOCSTATUS_Invalid = "IN";
|
||||
/** In Progress = IP */
|
||||
public static final String DOCSTATUS_InProgress = "IP";
|
||||
/** Not Approved = NA */
|
||||
public static final String DOCSTATUS_NotApproved = "NA";
|
||||
/** Reversed = RE */
|
||||
public static final String DOCSTATUS_Reversed = "RE";
|
||||
/** Voided = VO */
|
||||
public static final String DOCSTATUS_Voided = "VO";
|
||||
/** Waiting Confirmation = WC */
|
||||
public static final String DOCSTATUS_WaitingConfirmation = "WC";
|
||||
/** In Progress = IP */
|
||||
public static final String DOCSTATUS_InProgress = "IP";
|
||||
/** Drafted = DR */
|
||||
public static final String DOCSTATUS_Drafted = "DR";
|
||||
/** Completed = CO */
|
||||
public static final String DOCSTATUS_Completed = "CO";
|
||||
/** Approved = AP */
|
||||
public static final String DOCSTATUS_Approved = "AP";
|
||||
/** Not Approved = NA */
|
||||
public static final String DOCSTATUS_NotApproved = "NA";
|
||||
/** Voided = VO */
|
||||
public static final String DOCSTATUS_Voided = "VO";
|
||||
/** Invalid = IN */
|
||||
public static final String DOCSTATUS_Invalid = "IN";
|
||||
/** Reversed = RE */
|
||||
public static final String DOCSTATUS_Reversed = "RE";
|
||||
/** Closed = CL */
|
||||
public static final String DOCSTATUS_Closed = "CL";
|
||||
/** Unknown = ?? */
|
||||
public static final String DOCSTATUS_Unknown = "??";
|
||||
/** Waiting Payment = WP */
|
||||
public static final String DOCSTATUS_WaitingPayment = "WP";
|
||||
/** Set Document Status.
|
||||
|
@ -637,8 +637,8 @@ public static final String DOCSTATUS_WaitingPayment = "WP";
|
|||
public void setDocStatus (String DocStatus)
|
||||
{
|
||||
if (DocStatus == null) throw new IllegalArgumentException ("DocStatus is mandatory");
|
||||
if (DocStatus.equals("??") || DocStatus.equals("AP") || DocStatus.equals("CL") || DocStatus.equals("CO") || DocStatus.equals("DR") || DocStatus.equals("IN") || DocStatus.equals("IP") || DocStatus.equals("NA") || DocStatus.equals("RE") || DocStatus.equals("VO") || DocStatus.equals("WC") || DocStatus.equals("WP"));
|
||||
else throw new IllegalArgumentException ("DocStatus Invalid value - " + DocStatus + " - Reference_ID=131 - ?? - AP - CL - CO - DR - IN - IP - NA - RE - VO - WC - WP");
|
||||
if (DocStatus.equals("WC") || DocStatus.equals("IP") || DocStatus.equals("DR") || DocStatus.equals("CO") || DocStatus.equals("AP") || DocStatus.equals("NA") || DocStatus.equals("VO") || DocStatus.equals("IN") || DocStatus.equals("RE") || DocStatus.equals("CL") || DocStatus.equals("??") || DocStatus.equals("WP"));
|
||||
else throw new IllegalArgumentException ("DocStatus Invalid value - " + DocStatus + " - Reference_ID=131 - WC - IP - DR - CO - AP - NA - VO - IN - RE - CL - ?? - WP");
|
||||
if (DocStatus.length() > 2)
|
||||
{
|
||||
log.warning("Length > 2 - truncated");
|
||||
|
@ -719,10 +719,10 @@ public static final String COLUMNNAME_GrandTotal = "GrandTotal";
|
|||
|
||||
/** InvoiceCollectionType AD_Reference_ID=394 */
|
||||
public static final int INVOICECOLLECTIONTYPE_AD_Reference_ID=394;
|
||||
/** Collection Agency = C */
|
||||
public static final String INVOICECOLLECTIONTYPE_CollectionAgency = "C";
|
||||
/** Dunning = D */
|
||||
public static final String INVOICECOLLECTIONTYPE_Dunning = "D";
|
||||
/** Collection Agency = C */
|
||||
public static final String INVOICECOLLECTIONTYPE_CollectionAgency = "C";
|
||||
/** Legal Procedure = L */
|
||||
public static final String INVOICECOLLECTIONTYPE_LegalProcedure = "L";
|
||||
/** Uncollectable = U */
|
||||
|
@ -731,8 +731,8 @@ public static final String INVOICECOLLECTIONTYPE_Uncollectable = "U";
|
|||
@param InvoiceCollectionType Invoice Collection Status */
|
||||
public void setInvoiceCollectionType (String InvoiceCollectionType)
|
||||
{
|
||||
if (InvoiceCollectionType == null || InvoiceCollectionType.equals("C") || InvoiceCollectionType.equals("D") || InvoiceCollectionType.equals("L") || InvoiceCollectionType.equals("U"));
|
||||
else throw new IllegalArgumentException ("InvoiceCollectionType Invalid value - " + InvoiceCollectionType + " - Reference_ID=394 - C - D - L - U");
|
||||
if (InvoiceCollectionType == null || InvoiceCollectionType.equals("D") || InvoiceCollectionType.equals("C") || InvoiceCollectionType.equals("L") || InvoiceCollectionType.equals("U"));
|
||||
else throw new IllegalArgumentException ("InvoiceCollectionType Invalid value - " + InvoiceCollectionType + " - Reference_ID=394 - D - C - L - U");
|
||||
if (InvoiceCollectionType != null && InvoiceCollectionType.length() > 1)
|
||||
{
|
||||
log.warning("Length > 1 - truncated");
|
||||
|
@ -965,6 +965,24 @@ return ii.intValue();
|
|||
}
|
||||
/** Column name M_PriceList_ID */
|
||||
public static final String COLUMNNAME_M_PriceList_ID = "M_PriceList_ID";
|
||||
/** Set RMA.
|
||||
@param M_RMA_ID Return Material Authorization */
|
||||
public void setM_RMA_ID (int M_RMA_ID)
|
||||
{
|
||||
if (M_RMA_ID <= 0) set_Value ("M_RMA_ID", null);
|
||||
else
|
||||
set_Value ("M_RMA_ID", Integer.valueOf(M_RMA_ID));
|
||||
}
|
||||
/** Get RMA.
|
||||
@return Return Material Authorization */
|
||||
public int getM_RMA_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("M_RMA_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name M_RMA_ID */
|
||||
public static final String COLUMNNAME_M_RMA_ID = "M_RMA_ID";
|
||||
/** Set Order Reference.
|
||||
@param POReference Transaction Reference Number (Sales Order, Purchase Order) of your Business Partner */
|
||||
public void setPOReference (String POReference)
|
||||
|
@ -989,23 +1007,23 @@ public static final String COLUMNNAME_POReference = "POReference";
|
|||
public static final int PAYMENTRULE_AD_Reference_ID=195;
|
||||
/** Cash = B */
|
||||
public static final String PAYMENTRULE_Cash = "B";
|
||||
/** Direct Debit = D */
|
||||
public static final String PAYMENTRULE_DirectDebit = "D";
|
||||
/** Credit Card = K */
|
||||
public static final String PAYMENTRULE_CreditCard = "K";
|
||||
/** On Credit = P */
|
||||
public static final String PAYMENTRULE_OnCredit = "P";
|
||||
/** Check = S */
|
||||
public static final String PAYMENTRULE_Check = "S";
|
||||
/** Direct Deposit = T */
|
||||
public static final String PAYMENTRULE_DirectDeposit = "T";
|
||||
/** Check = S */
|
||||
public static final String PAYMENTRULE_Check = "S";
|
||||
/** On Credit = P */
|
||||
public static final String PAYMENTRULE_OnCredit = "P";
|
||||
/** Direct Debit = D */
|
||||
public static final String PAYMENTRULE_DirectDebit = "D";
|
||||
/** Set Payment Rule.
|
||||
@param PaymentRule How you pay the invoice */
|
||||
public void setPaymentRule (String PaymentRule)
|
||||
{
|
||||
if (PaymentRule == null) throw new IllegalArgumentException ("PaymentRule is mandatory");
|
||||
if (PaymentRule.equals("B") || PaymentRule.equals("D") || PaymentRule.equals("K") || PaymentRule.equals("P") || PaymentRule.equals("S") || PaymentRule.equals("T"));
|
||||
else throw new IllegalArgumentException ("PaymentRule Invalid value - " + PaymentRule + " - Reference_ID=195 - B - D - K - P - S - T");
|
||||
if (PaymentRule.equals("B") || PaymentRule.equals("K") || PaymentRule.equals("T") || PaymentRule.equals("S") || PaymentRule.equals("P") || PaymentRule.equals("D"));
|
||||
else throw new IllegalArgumentException ("PaymentRule Invalid value - " + PaymentRule + " - Reference_ID=195 - B - K - T - S - P - D");
|
||||
if (PaymentRule.length() > 1)
|
||||
{
|
||||
log.warning("Length > 1 - truncated");
|
||||
|
|
|
@ -66,13 +66,13 @@ public X_C_InvoiceLine (Properties ctx, ResultSet rs, String trxName)
|
|||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
/** AD_Table_ID=333 */
|
||||
public static final int Table_ID=MTable.getTable_ID("C_InvoiceLine");
|
||||
|
||||
/** TableName=C_InvoiceLine */
|
||||
public static final String Table_Name="C_InvoiceLine";
|
||||
|
||||
protected static KeyNamePair Model = new KeyNamePair(Table_ID,"C_InvoiceLine");
|
||||
/** AD_Table_ID=333 */
|
||||
public static final int Table_ID=MTable.getTable_ID(Table_Name);
|
||||
|
||||
protected static KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
protected BigDecimal accessLevel = BigDecimal.valueOf(1);
|
||||
/** AccessLevel
|
||||
|
@ -500,6 +500,24 @@ return ii.intValue();
|
|||
}
|
||||
/** Column name M_Product_ID */
|
||||
public static final String COLUMNNAME_M_Product_ID = "M_Product_ID";
|
||||
/** Set RMA Line.
|
||||
@param M_RMALine_ID Return Material Authorization Line */
|
||||
public void setM_RMALine_ID (int M_RMALine_ID)
|
||||
{
|
||||
if (M_RMALine_ID <= 0) set_Value ("M_RMALine_ID", null);
|
||||
else
|
||||
set_Value ("M_RMALine_ID", Integer.valueOf(M_RMALine_ID));
|
||||
}
|
||||
/** Get RMA Line.
|
||||
@return Return Material Authorization Line */
|
||||
public int getM_RMALine_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("M_RMALine_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name M_RMALine_ID */
|
||||
public static final String COLUMNNAME_M_RMALine_ID = "M_RMALine_ID";
|
||||
/** Set Unit Price.
|
||||
@param PriceActual Actual Price */
|
||||
public void setPriceActual (BigDecimal PriceActual)
|
||||
|
|
|
@ -74,13 +74,13 @@ public X_M_InOut (Properties ctx, ResultSet rs, String trxName)
|
|||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
/** AD_Table_ID=319 */
|
||||
public static final int Table_ID=MTable.getTable_ID("M_InOut");
|
||||
|
||||
/** TableName=M_InOut */
|
||||
public static final String Table_Name="M_InOut";
|
||||
|
||||
protected static KeyNamePair Model = new KeyNamePair(Table_ID,"M_InOut");
|
||||
/** AD_Table_ID=319 */
|
||||
public static final int Table_ID=MTable.getTable_ID(Table_Name);
|
||||
|
||||
protected static KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
protected BigDecimal accessLevel = BigDecimal.valueOf(1);
|
||||
/** AccessLevel
|
||||
|
@ -444,25 +444,25 @@ public static final String COLUMNNAME_DateReceived = "DateReceived";
|
|||
|
||||
/** DeliveryRule AD_Reference_ID=151 */
|
||||
public static final int DELIVERYRULE_AD_Reference_ID=151;
|
||||
/** Availability = A */
|
||||
public static final String DELIVERYRULE_Availability = "A";
|
||||
/** Force = F */
|
||||
public static final String DELIVERYRULE_Force = "F";
|
||||
/** Complete Line = L */
|
||||
public static final String DELIVERYRULE_CompleteLine = "L";
|
||||
/** Manual = M */
|
||||
public static final String DELIVERYRULE_Manual = "M";
|
||||
/** Complete Order = O */
|
||||
public static final String DELIVERYRULE_CompleteOrder = "O";
|
||||
/** After Receipt = R */
|
||||
public static final String DELIVERYRULE_AfterReceipt = "R";
|
||||
/** Availability = A */
|
||||
public static final String DELIVERYRULE_Availability = "A";
|
||||
/** Complete Line = L */
|
||||
public static final String DELIVERYRULE_CompleteLine = "L";
|
||||
/** Complete Order = O */
|
||||
public static final String DELIVERYRULE_CompleteOrder = "O";
|
||||
/** Manual = M */
|
||||
public static final String DELIVERYRULE_Manual = "M";
|
||||
/** Force = F */
|
||||
public static final String DELIVERYRULE_Force = "F";
|
||||
/** Set Delivery Rule.
|
||||
@param DeliveryRule Defines the timing of Delivery */
|
||||
public void setDeliveryRule (String DeliveryRule)
|
||||
{
|
||||
if (DeliveryRule == null) throw new IllegalArgumentException ("DeliveryRule is mandatory");
|
||||
if (DeliveryRule.equals("A") || DeliveryRule.equals("F") || DeliveryRule.equals("L") || DeliveryRule.equals("M") || DeliveryRule.equals("O") || DeliveryRule.equals("R"));
|
||||
else throw new IllegalArgumentException ("DeliveryRule Invalid value - " + DeliveryRule + " - Reference_ID=151 - A - F - L - M - O - R");
|
||||
if (DeliveryRule.equals("R") || DeliveryRule.equals("A") || DeliveryRule.equals("L") || DeliveryRule.equals("O") || DeliveryRule.equals("M") || DeliveryRule.equals("F"));
|
||||
else throw new IllegalArgumentException ("DeliveryRule Invalid value - " + DeliveryRule + " - Reference_ID=151 - R - A - L - O - M - F");
|
||||
if (DeliveryRule.length() > 1)
|
||||
{
|
||||
log.warning("Length > 1 - truncated");
|
||||
|
@ -481,10 +481,10 @@ public static final String COLUMNNAME_DeliveryRule = "DeliveryRule";
|
|||
|
||||
/** DeliveryViaRule AD_Reference_ID=152 */
|
||||
public static final int DELIVERYVIARULE_AD_Reference_ID=152;
|
||||
/** Delivery = D */
|
||||
public static final String DELIVERYVIARULE_Delivery = "D";
|
||||
/** Pickup = P */
|
||||
public static final String DELIVERYVIARULE_Pickup = "P";
|
||||
/** Delivery = D */
|
||||
public static final String DELIVERYVIARULE_Delivery = "D";
|
||||
/** Shipper = S */
|
||||
public static final String DELIVERYVIARULE_Shipper = "S";
|
||||
/** Set Delivery Via.
|
||||
|
@ -492,8 +492,8 @@ public static final String DELIVERYVIARULE_Shipper = "S";
|
|||
public void setDeliveryViaRule (String DeliveryViaRule)
|
||||
{
|
||||
if (DeliveryViaRule == null) throw new IllegalArgumentException ("DeliveryViaRule is mandatory");
|
||||
if (DeliveryViaRule.equals("D") || DeliveryViaRule.equals("P") || DeliveryViaRule.equals("S"));
|
||||
else throw new IllegalArgumentException ("DeliveryViaRule Invalid value - " + DeliveryViaRule + " - Reference_ID=152 - D - P - S");
|
||||
if (DeliveryViaRule.equals("P") || DeliveryViaRule.equals("D") || DeliveryViaRule.equals("S"));
|
||||
else throw new IllegalArgumentException ("DeliveryViaRule Invalid value - " + DeliveryViaRule + " - Reference_ID=152 - P - D - S");
|
||||
if (DeliveryViaRule.length() > 1)
|
||||
{
|
||||
log.warning("Length > 1 - truncated");
|
||||
|
@ -531,32 +531,32 @@ public static final String COLUMNNAME_Description = "Description";
|
|||
|
||||
/** DocAction AD_Reference_ID=135 */
|
||||
public static final int DOCACTION_AD_Reference_ID=135;
|
||||
/** <None> = -- */
|
||||
public static final String DOCACTION_None = "--";
|
||||
/** Approve = AP */
|
||||
public static final String DOCACTION_Approve = "AP";
|
||||
/** Close = CL */
|
||||
public static final String DOCACTION_Close = "CL";
|
||||
/** Complete = CO */
|
||||
public static final String DOCACTION_Complete = "CO";
|
||||
/** Invalidate = IN */
|
||||
public static final String DOCACTION_Invalidate = "IN";
|
||||
/** Post = PO */
|
||||
public static final String DOCACTION_Post = "PO";
|
||||
/** Prepare = PR */
|
||||
public static final String DOCACTION_Prepare = "PR";
|
||||
/** Reverse - Accrual = RA */
|
||||
public static final String DOCACTION_Reverse_Accrual = "RA";
|
||||
/** Reverse - Correct = RC */
|
||||
public static final String DOCACTION_Reverse_Correct = "RC";
|
||||
/** Re-activate = RE */
|
||||
public static final String DOCACTION_Re_Activate = "RE";
|
||||
/** Approve = AP */
|
||||
public static final String DOCACTION_Approve = "AP";
|
||||
/** Reject = RJ */
|
||||
public static final String DOCACTION_Reject = "RJ";
|
||||
/** Post = PO */
|
||||
public static final String DOCACTION_Post = "PO";
|
||||
/** Void = VO */
|
||||
public static final String DOCACTION_Void = "VO";
|
||||
/** Close = CL */
|
||||
public static final String DOCACTION_Close = "CL";
|
||||
/** Reverse - Correct = RC */
|
||||
public static final String DOCACTION_Reverse_Correct = "RC";
|
||||
/** Reverse - Accrual = RA */
|
||||
public static final String DOCACTION_Reverse_Accrual = "RA";
|
||||
/** Invalidate = IN */
|
||||
public static final String DOCACTION_Invalidate = "IN";
|
||||
/** Re-activate = RE */
|
||||
public static final String DOCACTION_Re_Activate = "RE";
|
||||
/** <None> = -- */
|
||||
public static final String DOCACTION_None = "--";
|
||||
/** Wait Complete = WC */
|
||||
public static final String DOCACTION_WaitComplete = "WC";
|
||||
/** Prepare = PR */
|
||||
public static final String DOCACTION_Prepare = "PR";
|
||||
/** Unlock = XL */
|
||||
public static final String DOCACTION_Unlock = "XL";
|
||||
/** Set Document Action.
|
||||
|
@ -564,8 +564,8 @@ public static final String DOCACTION_Unlock = "XL";
|
|||
public void setDocAction (String DocAction)
|
||||
{
|
||||
if (DocAction == null) throw new IllegalArgumentException ("DocAction is mandatory");
|
||||
if (DocAction.equals("--") || DocAction.equals("AP") || DocAction.equals("CL") || DocAction.equals("CO") || DocAction.equals("IN") || DocAction.equals("PO") || DocAction.equals("PR") || DocAction.equals("RA") || DocAction.equals("RC") || DocAction.equals("RE") || DocAction.equals("RJ") || DocAction.equals("VO") || DocAction.equals("WC") || DocAction.equals("XL"));
|
||||
else throw new IllegalArgumentException ("DocAction Invalid value - " + DocAction + " - Reference_ID=135 - -- - AP - CL - CO - IN - PO - PR - RA - RC - RE - RJ - VO - WC - XL");
|
||||
if (DocAction.equals("CO") || DocAction.equals("AP") || DocAction.equals("RJ") || DocAction.equals("PO") || DocAction.equals("VO") || DocAction.equals("CL") || DocAction.equals("RC") || DocAction.equals("RA") || DocAction.equals("IN") || DocAction.equals("RE") || DocAction.equals("--") || DocAction.equals("WC") || DocAction.equals("PR") || DocAction.equals("XL"));
|
||||
else throw new IllegalArgumentException ("DocAction Invalid value - " + DocAction + " - Reference_ID=135 - CO - AP - RJ - PO - VO - CL - RC - RA - IN - RE - -- - WC - PR - XL");
|
||||
if (DocAction.length() > 2)
|
||||
{
|
||||
log.warning("Length > 2 - truncated");
|
||||
|
@ -584,28 +584,28 @@ public static final String COLUMNNAME_DocAction = "DocAction";
|
|||
|
||||
/** DocStatus AD_Reference_ID=131 */
|
||||
public static final int DOCSTATUS_AD_Reference_ID=131;
|
||||
/** Unknown = ?? */
|
||||
public static final String DOCSTATUS_Unknown = "??";
|
||||
/** Approved = AP */
|
||||
public static final String DOCSTATUS_Approved = "AP";
|
||||
/** Closed = CL */
|
||||
public static final String DOCSTATUS_Closed = "CL";
|
||||
/** Completed = CO */
|
||||
public static final String DOCSTATUS_Completed = "CO";
|
||||
/** Drafted = DR */
|
||||
public static final String DOCSTATUS_Drafted = "DR";
|
||||
/** Invalid = IN */
|
||||
public static final String DOCSTATUS_Invalid = "IN";
|
||||
/** In Progress = IP */
|
||||
public static final String DOCSTATUS_InProgress = "IP";
|
||||
/** Not Approved = NA */
|
||||
public static final String DOCSTATUS_NotApproved = "NA";
|
||||
/** Reversed = RE */
|
||||
public static final String DOCSTATUS_Reversed = "RE";
|
||||
/** Voided = VO */
|
||||
public static final String DOCSTATUS_Voided = "VO";
|
||||
/** Waiting Confirmation = WC */
|
||||
public static final String DOCSTATUS_WaitingConfirmation = "WC";
|
||||
/** In Progress = IP */
|
||||
public static final String DOCSTATUS_InProgress = "IP";
|
||||
/** Drafted = DR */
|
||||
public static final String DOCSTATUS_Drafted = "DR";
|
||||
/** Completed = CO */
|
||||
public static final String DOCSTATUS_Completed = "CO";
|
||||
/** Approved = AP */
|
||||
public static final String DOCSTATUS_Approved = "AP";
|
||||
/** Not Approved = NA */
|
||||
public static final String DOCSTATUS_NotApproved = "NA";
|
||||
/** Voided = VO */
|
||||
public static final String DOCSTATUS_Voided = "VO";
|
||||
/** Invalid = IN */
|
||||
public static final String DOCSTATUS_Invalid = "IN";
|
||||
/** Reversed = RE */
|
||||
public static final String DOCSTATUS_Reversed = "RE";
|
||||
/** Closed = CL */
|
||||
public static final String DOCSTATUS_Closed = "CL";
|
||||
/** Unknown = ?? */
|
||||
public static final String DOCSTATUS_Unknown = "??";
|
||||
/** Waiting Payment = WP */
|
||||
public static final String DOCSTATUS_WaitingPayment = "WP";
|
||||
/** Set Document Status.
|
||||
|
@ -613,8 +613,8 @@ public static final String DOCSTATUS_WaitingPayment = "WP";
|
|||
public void setDocStatus (String DocStatus)
|
||||
{
|
||||
if (DocStatus == null) throw new IllegalArgumentException ("DocStatus is mandatory");
|
||||
if (DocStatus.equals("??") || DocStatus.equals("AP") || DocStatus.equals("CL") || DocStatus.equals("CO") || DocStatus.equals("DR") || DocStatus.equals("IN") || DocStatus.equals("IP") || DocStatus.equals("NA") || DocStatus.equals("RE") || DocStatus.equals("VO") || DocStatus.equals("WC") || DocStatus.equals("WP"));
|
||||
else throw new IllegalArgumentException ("DocStatus Invalid value - " + DocStatus + " - Reference_ID=131 - ?? - AP - CL - CO - DR - IN - IP - NA - RE - VO - WC - WP");
|
||||
if (DocStatus.equals("WC") || DocStatus.equals("IP") || DocStatus.equals("DR") || DocStatus.equals("CO") || DocStatus.equals("AP") || DocStatus.equals("NA") || DocStatus.equals("VO") || DocStatus.equals("IN") || DocStatus.equals("RE") || DocStatus.equals("CL") || DocStatus.equals("??") || DocStatus.equals("WP"));
|
||||
else throw new IllegalArgumentException ("DocStatus Invalid value - " + DocStatus + " - Reference_ID=131 - WC - IP - DR - CO - AP - NA - VO - IN - RE - CL - ?? - WP");
|
||||
if (DocStatus.length() > 2)
|
||||
{
|
||||
log.warning("Length > 2 - truncated");
|
||||
|
@ -675,12 +675,12 @@ public static final String COLUMNNAME_FreightAmt = "FreightAmt";
|
|||
|
||||
/** FreightCostRule AD_Reference_ID=153 */
|
||||
public static final int FREIGHTCOSTRULE_AD_Reference_ID=153;
|
||||
/** Calculated = C */
|
||||
public static final String FREIGHTCOSTRULE_Calculated = "C";
|
||||
/** Fix price = F */
|
||||
public static final String FREIGHTCOSTRULE_FixPrice = "F";
|
||||
/** Freight included = I */
|
||||
public static final String FREIGHTCOSTRULE_FreightIncluded = "I";
|
||||
/** Fix price = F */
|
||||
public static final String FREIGHTCOSTRULE_FixPrice = "F";
|
||||
/** Calculated = C */
|
||||
public static final String FREIGHTCOSTRULE_Calculated = "C";
|
||||
/** Line = L */
|
||||
public static final String FREIGHTCOSTRULE_Line = "L";
|
||||
/** Set Freight Cost Rule.
|
||||
|
@ -688,8 +688,8 @@ public static final String FREIGHTCOSTRULE_Line = "L";
|
|||
public void setFreightCostRule (String FreightCostRule)
|
||||
{
|
||||
if (FreightCostRule == null) throw new IllegalArgumentException ("FreightCostRule is mandatory");
|
||||
if (FreightCostRule.equals("C") || FreightCostRule.equals("F") || FreightCostRule.equals("I") || FreightCostRule.equals("L"));
|
||||
else throw new IllegalArgumentException ("FreightCostRule Invalid value - " + FreightCostRule + " - Reference_ID=153 - C - F - I - L");
|
||||
if (FreightCostRule.equals("I") || FreightCostRule.equals("F") || FreightCostRule.equals("C") || FreightCostRule.equals("L"));
|
||||
else throw new IllegalArgumentException ("FreightCostRule Invalid value - " + FreightCostRule + " - Reference_ID=153 - I - F - C - L");
|
||||
if (FreightCostRule.length() > 1)
|
||||
{
|
||||
log.warning("Length > 1 - truncated");
|
||||
|
@ -841,6 +841,24 @@ return ii.intValue();
|
|||
}
|
||||
/** Column name M_InOut_ID */
|
||||
public static final String COLUMNNAME_M_InOut_ID = "M_InOut_ID";
|
||||
/** Set RMA.
|
||||
@param M_RMA_ID Return Material Authorization */
|
||||
public void setM_RMA_ID (int M_RMA_ID)
|
||||
{
|
||||
if (M_RMA_ID <= 0) set_Value ("M_RMA_ID", null);
|
||||
else
|
||||
set_Value ("M_RMA_ID", Integer.valueOf(M_RMA_ID));
|
||||
}
|
||||
/** Get RMA.
|
||||
@return Return Material Authorization */
|
||||
public int getM_RMA_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("M_RMA_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name M_RMA_ID */
|
||||
public static final String COLUMNNAME_M_RMA_ID = "M_RMA_ID";
|
||||
/** Set Shipper.
|
||||
@param M_Shipper_ID Method or manner of product delivery */
|
||||
public void setM_Shipper_ID (int M_Shipper_ID)
|
||||
|
@ -894,26 +912,26 @@ public static final String COLUMNNAME_MovementDate = "MovementDate";
|
|||
|
||||
/** MovementType AD_Reference_ID=189 */
|
||||
public static final int MOVEMENTTYPE_AD_Reference_ID=189;
|
||||
/** Customer Returns = C+ */
|
||||
public static final String MOVEMENTTYPE_CustomerReturns = "C+";
|
||||
/** Customer Shipment = C- */
|
||||
public static final String MOVEMENTTYPE_CustomerShipment = "C-";
|
||||
/** Inventory In = I+ */
|
||||
public static final String MOVEMENTTYPE_InventoryIn = "I+";
|
||||
/** Inventory Out = I- */
|
||||
public static final String MOVEMENTTYPE_InventoryOut = "I-";
|
||||
/** Movement To = M+ */
|
||||
public static final String MOVEMENTTYPE_MovementTo = "M+";
|
||||
/** Movement From = M- */
|
||||
public static final String MOVEMENTTYPE_MovementFrom = "M-";
|
||||
/** Production + = P+ */
|
||||
public static final String MOVEMENTTYPE_ProductionPlus = "P+";
|
||||
/** Production - = P- */
|
||||
public static final String MOVEMENTTYPE_Production_ = "P-";
|
||||
/** Customer Shipment = C- */
|
||||
public static final String MOVEMENTTYPE_CustomerShipment = "C-";
|
||||
/** Customer Returns = C+ */
|
||||
public static final String MOVEMENTTYPE_CustomerReturns = "C+";
|
||||
/** Vendor Receipts = V+ */
|
||||
public static final String MOVEMENTTYPE_VendorReceipts = "V+";
|
||||
/** Vendor Returns = V- */
|
||||
public static final String MOVEMENTTYPE_VendorReturns = "V-";
|
||||
/** Inventory Out = I- */
|
||||
public static final String MOVEMENTTYPE_InventoryOut = "I-";
|
||||
/** Inventory In = I+ */
|
||||
public static final String MOVEMENTTYPE_InventoryIn = "I+";
|
||||
/** Movement From = M- */
|
||||
public static final String MOVEMENTTYPE_MovementFrom = "M-";
|
||||
/** Movement To = M+ */
|
||||
public static final String MOVEMENTTYPE_MovementTo = "M+";
|
||||
/** Work Order + = W+ */
|
||||
public static final String MOVEMENTTYPE_WorkOrderPlus = "W+";
|
||||
/** Work Order - = W- */
|
||||
|
@ -923,8 +941,8 @@ public static final String MOVEMENTTYPE_WorkOrder_ = "W-";
|
|||
public void setMovementType (String MovementType)
|
||||
{
|
||||
if (MovementType == null) throw new IllegalArgumentException ("MovementType is mandatory");
|
||||
if (MovementType.equals("C+") || MovementType.equals("C-") || MovementType.equals("I+") || MovementType.equals("I-") || MovementType.equals("M+") || MovementType.equals("M-") || MovementType.equals("P+") || MovementType.equals("P-") || MovementType.equals("V+") || MovementType.equals("V-") || MovementType.equals("W+") || MovementType.equals("W-"));
|
||||
else throw new IllegalArgumentException ("MovementType Invalid value - " + MovementType + " - Reference_ID=189 - C+ - C- - I+ - I- - M+ - M- - P+ - P- - V+ - V- - W+ - W-");
|
||||
if (MovementType.equals("P+") || MovementType.equals("P-") || MovementType.equals("C-") || MovementType.equals("C+") || MovementType.equals("V+") || MovementType.equals("V-") || MovementType.equals("I-") || MovementType.equals("I+") || MovementType.equals("M-") || MovementType.equals("M+") || MovementType.equals("W+") || MovementType.equals("W-"));
|
||||
else throw new IllegalArgumentException ("MovementType Invalid value - " + MovementType + " - Reference_ID=189 - P+ - P- - C- - C+ - V+ - V- - I- - I+ - M- - M+ - W+ - W-");
|
||||
if (MovementType.length() > 2)
|
||||
{
|
||||
log.warning("Length > 2 - truncated");
|
||||
|
@ -1012,14 +1030,14 @@ public static final String COLUMNNAME_Posted = "Posted";
|
|||
|
||||
/** PriorityRule AD_Reference_ID=154 */
|
||||
public static final int PRIORITYRULE_AD_Reference_ID=154;
|
||||
/** Urgent = 1 */
|
||||
public static final String PRIORITYRULE_Urgent = "1";
|
||||
/** High = 3 */
|
||||
public static final String PRIORITYRULE_High = "3";
|
||||
/** Medium = 5 */
|
||||
public static final String PRIORITYRULE_Medium = "5";
|
||||
/** Low = 7 */
|
||||
public static final String PRIORITYRULE_Low = "7";
|
||||
/** Urgent = 1 */
|
||||
public static final String PRIORITYRULE_Urgent = "1";
|
||||
/** Minor = 9 */
|
||||
public static final String PRIORITYRULE_Minor = "9";
|
||||
/** Set Priority.
|
||||
|
@ -1027,8 +1045,8 @@ public static final String PRIORITYRULE_Minor = "9";
|
|||
public void setPriorityRule (String PriorityRule)
|
||||
{
|
||||
if (PriorityRule == null) throw new IllegalArgumentException ("PriorityRule is mandatory");
|
||||
if (PriorityRule.equals("1") || PriorityRule.equals("3") || PriorityRule.equals("5") || PriorityRule.equals("7") || PriorityRule.equals("9"));
|
||||
else throw new IllegalArgumentException ("PriorityRule Invalid value - " + PriorityRule + " - Reference_ID=154 - 1 - 3 - 5 - 7 - 9");
|
||||
if (PriorityRule.equals("3") || PriorityRule.equals("5") || PriorityRule.equals("7") || PriorityRule.equals("1") || PriorityRule.equals("9"));
|
||||
else throw new IllegalArgumentException ("PriorityRule Invalid value - " + PriorityRule + " - Reference_ID=154 - 3 - 5 - 7 - 1 - 9");
|
||||
if (PriorityRule.length() > 1)
|
||||
{
|
||||
log.warning("Length > 1 - truncated");
|
||||
|
|
|
@ -62,13 +62,13 @@ public X_M_InOutLine (Properties ctx, ResultSet rs, String trxName)
|
|||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
/** AD_Table_ID=320 */
|
||||
public static final int Table_ID=MTable.getTable_ID("M_InOutLine");
|
||||
|
||||
/** TableName=M_InOutLine */
|
||||
public static final String Table_Name="M_InOutLine";
|
||||
|
||||
protected static KeyNamePair Model = new KeyNamePair(Table_ID,"M_InOutLine");
|
||||
/** AD_Table_ID=320 */
|
||||
public static final int Table_ID=MTable.getTable_ID(Table_Name);
|
||||
|
||||
protected static KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
protected BigDecimal accessLevel = BigDecimal.valueOf(1);
|
||||
/** AccessLevel
|
||||
|
@ -442,6 +442,24 @@ return ii.intValue();
|
|||
}
|
||||
/** Column name M_Product_ID */
|
||||
public static final String COLUMNNAME_M_Product_ID = "M_Product_ID";
|
||||
/** Set RMA Line.
|
||||
@param M_RMALine_ID Return Material Authorization Line */
|
||||
public void setM_RMALine_ID (int M_RMALine_ID)
|
||||
{
|
||||
if (M_RMALine_ID <= 0) set_Value ("M_RMALine_ID", null);
|
||||
else
|
||||
set_Value ("M_RMALine_ID", Integer.valueOf(M_RMALine_ID));
|
||||
}
|
||||
/** Get RMA Line.
|
||||
@return Return Material Authorization Line */
|
||||
public int getM_RMALine_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("M_RMALine_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name M_RMALine_ID */
|
||||
public static final String COLUMNNAME_M_RMALine_ID = "M_RMALine_ID";
|
||||
/** Set Movement Quantity.
|
||||
@param MovementQty Quantity of a product moved. */
|
||||
public void setMovementQty (BigDecimal MovementQty)
|
||||
|
|
|
@ -43,8 +43,9 @@ setC_DocType_ID (0);
|
|||
setDocAction (null); // CO
|
||||
setDocStatus (null); // DR
|
||||
setDocumentNo (null);
|
||||
setInOut_ID (0);
|
||||
setIsApproved (false);
|
||||
setM_InOut_ID (0);
|
||||
setIsSOTrx (false); // @IsSOTrx@
|
||||
setM_RMAType_ID (0);
|
||||
setM_RMA_ID (0);
|
||||
setName (null);
|
||||
|
@ -62,13 +63,13 @@ public X_M_RMA (Properties ctx, ResultSet rs, String trxName)
|
|||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
/** AD_Table_ID=661 */
|
||||
public static final int Table_ID=MTable.getTable_ID("M_RMA");
|
||||
|
||||
/** TableName=M_RMA */
|
||||
public static final String Table_Name="M_RMA";
|
||||
|
||||
protected static KeyNamePair Model = new KeyNamePair(Table_ID,"M_RMA");
|
||||
/** AD_Table_ID=661 */
|
||||
public static final int Table_ID=MTable.getTable_ID(Table_Name);
|
||||
|
||||
protected static KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
protected BigDecimal accessLevel = BigDecimal.valueOf(1);
|
||||
/** AccessLevel
|
||||
|
@ -207,32 +208,32 @@ public static final String COLUMNNAME_Description = "Description";
|
|||
|
||||
/** DocAction AD_Reference_ID=135 */
|
||||
public static final int DOCACTION_AD_Reference_ID=135;
|
||||
/** <None> = -- */
|
||||
public static final String DOCACTION_None = "--";
|
||||
/** Approve = AP */
|
||||
public static final String DOCACTION_Approve = "AP";
|
||||
/** Close = CL */
|
||||
public static final String DOCACTION_Close = "CL";
|
||||
/** Complete = CO */
|
||||
public static final String DOCACTION_Complete = "CO";
|
||||
/** Invalidate = IN */
|
||||
public static final String DOCACTION_Invalidate = "IN";
|
||||
/** Post = PO */
|
||||
public static final String DOCACTION_Post = "PO";
|
||||
/** Prepare = PR */
|
||||
public static final String DOCACTION_Prepare = "PR";
|
||||
/** Reverse - Accrual = RA */
|
||||
public static final String DOCACTION_Reverse_Accrual = "RA";
|
||||
/** Reverse - Correct = RC */
|
||||
public static final String DOCACTION_Reverse_Correct = "RC";
|
||||
/** Re-activate = RE */
|
||||
public static final String DOCACTION_Re_Activate = "RE";
|
||||
/** Approve = AP */
|
||||
public static final String DOCACTION_Approve = "AP";
|
||||
/** Reject = RJ */
|
||||
public static final String DOCACTION_Reject = "RJ";
|
||||
/** Post = PO */
|
||||
public static final String DOCACTION_Post = "PO";
|
||||
/** Void = VO */
|
||||
public static final String DOCACTION_Void = "VO";
|
||||
/** Close = CL */
|
||||
public static final String DOCACTION_Close = "CL";
|
||||
/** Reverse - Correct = RC */
|
||||
public static final String DOCACTION_Reverse_Correct = "RC";
|
||||
/** Reverse - Accrual = RA */
|
||||
public static final String DOCACTION_Reverse_Accrual = "RA";
|
||||
/** Invalidate = IN */
|
||||
public static final String DOCACTION_Invalidate = "IN";
|
||||
/** Re-activate = RE */
|
||||
public static final String DOCACTION_Re_Activate = "RE";
|
||||
/** <None> = -- */
|
||||
public static final String DOCACTION_None = "--";
|
||||
/** Wait Complete = WC */
|
||||
public static final String DOCACTION_WaitComplete = "WC";
|
||||
/** Prepare = PR */
|
||||
public static final String DOCACTION_Prepare = "PR";
|
||||
/** Unlock = XL */
|
||||
public static final String DOCACTION_Unlock = "XL";
|
||||
/** Set Document Action.
|
||||
|
@ -240,8 +241,8 @@ public static final String DOCACTION_Unlock = "XL";
|
|||
public void setDocAction (String DocAction)
|
||||
{
|
||||
if (DocAction == null) throw new IllegalArgumentException ("DocAction is mandatory");
|
||||
if (DocAction.equals("--") || DocAction.equals("AP") || DocAction.equals("CL") || DocAction.equals("CO") || DocAction.equals("IN") || DocAction.equals("PO") || DocAction.equals("PR") || DocAction.equals("RA") || DocAction.equals("RC") || DocAction.equals("RE") || DocAction.equals("RJ") || DocAction.equals("VO") || DocAction.equals("WC") || DocAction.equals("XL"));
|
||||
else throw new IllegalArgumentException ("DocAction Invalid value - " + DocAction + " - Reference_ID=135 - -- - AP - CL - CO - IN - PO - PR - RA - RC - RE - RJ - VO - WC - XL");
|
||||
if (DocAction.equals("CO") || DocAction.equals("AP") || DocAction.equals("RJ") || DocAction.equals("PO") || DocAction.equals("VO") || DocAction.equals("CL") || DocAction.equals("RC") || DocAction.equals("RA") || DocAction.equals("IN") || DocAction.equals("RE") || DocAction.equals("--") || DocAction.equals("WC") || DocAction.equals("PR") || DocAction.equals("XL"));
|
||||
else throw new IllegalArgumentException ("DocAction Invalid value - " + DocAction + " - Reference_ID=135 - CO - AP - RJ - PO - VO - CL - RC - RA - IN - RE - -- - WC - PR - XL");
|
||||
if (DocAction.length() > 2)
|
||||
{
|
||||
log.warning("Length > 2 - truncated");
|
||||
|
@ -260,28 +261,28 @@ public static final String COLUMNNAME_DocAction = "DocAction";
|
|||
|
||||
/** DocStatus AD_Reference_ID=131 */
|
||||
public static final int DOCSTATUS_AD_Reference_ID=131;
|
||||
/** Unknown = ?? */
|
||||
public static final String DOCSTATUS_Unknown = "??";
|
||||
/** Approved = AP */
|
||||
public static final String DOCSTATUS_Approved = "AP";
|
||||
/** Closed = CL */
|
||||
public static final String DOCSTATUS_Closed = "CL";
|
||||
/** Completed = CO */
|
||||
public static final String DOCSTATUS_Completed = "CO";
|
||||
/** Drafted = DR */
|
||||
public static final String DOCSTATUS_Drafted = "DR";
|
||||
/** Invalid = IN */
|
||||
public static final String DOCSTATUS_Invalid = "IN";
|
||||
/** In Progress = IP */
|
||||
public static final String DOCSTATUS_InProgress = "IP";
|
||||
/** Not Approved = NA */
|
||||
public static final String DOCSTATUS_NotApproved = "NA";
|
||||
/** Reversed = RE */
|
||||
public static final String DOCSTATUS_Reversed = "RE";
|
||||
/** Voided = VO */
|
||||
public static final String DOCSTATUS_Voided = "VO";
|
||||
/** Waiting Confirmation = WC */
|
||||
public static final String DOCSTATUS_WaitingConfirmation = "WC";
|
||||
/** Drafted = DR */
|
||||
public static final String DOCSTATUS_Drafted = "DR";
|
||||
/** Completed = CO */
|
||||
public static final String DOCSTATUS_Completed = "CO";
|
||||
/** Approved = AP */
|
||||
public static final String DOCSTATUS_Approved = "AP";
|
||||
/** Not Approved = NA */
|
||||
public static final String DOCSTATUS_NotApproved = "NA";
|
||||
/** Voided = VO */
|
||||
public static final String DOCSTATUS_Voided = "VO";
|
||||
/** Invalid = IN */
|
||||
public static final String DOCSTATUS_Invalid = "IN";
|
||||
/** Reversed = RE */
|
||||
public static final String DOCSTATUS_Reversed = "RE";
|
||||
/** Closed = CL */
|
||||
public static final String DOCSTATUS_Closed = "CL";
|
||||
/** Unknown = ?? */
|
||||
public static final String DOCSTATUS_Unknown = "??";
|
||||
/** In Progress = IP */
|
||||
public static final String DOCSTATUS_InProgress = "IP";
|
||||
/** Waiting Payment = WP */
|
||||
public static final String DOCSTATUS_WaitingPayment = "WP";
|
||||
/** Set Document Status.
|
||||
|
@ -289,8 +290,8 @@ public static final String DOCSTATUS_WaitingPayment = "WP";
|
|||
public void setDocStatus (String DocStatus)
|
||||
{
|
||||
if (DocStatus == null) throw new IllegalArgumentException ("DocStatus is mandatory");
|
||||
if (DocStatus.equals("??") || DocStatus.equals("AP") || DocStatus.equals("CL") || DocStatus.equals("CO") || DocStatus.equals("DR") || DocStatus.equals("IN") || DocStatus.equals("IP") || DocStatus.equals("NA") || DocStatus.equals("RE") || DocStatus.equals("VO") || DocStatus.equals("WC") || DocStatus.equals("WP"));
|
||||
else throw new IllegalArgumentException ("DocStatus Invalid value - " + DocStatus + " - Reference_ID=131 - ?? - AP - CL - CO - DR - IN - IP - NA - RE - VO - WC - WP");
|
||||
if (DocStatus.equals("WC") || DocStatus.equals("DR") || DocStatus.equals("CO") || DocStatus.equals("AP") || DocStatus.equals("NA") || DocStatus.equals("VO") || DocStatus.equals("IN") || DocStatus.equals("RE") || DocStatus.equals("CL") || DocStatus.equals("??") || DocStatus.equals("IP") || DocStatus.equals("WP"));
|
||||
else throw new IllegalArgumentException ("DocStatus Invalid value - " + DocStatus + " - Reference_ID=131 - WC - DR - CO - AP - NA - VO - IN - RE - CL - ?? - IP - WP");
|
||||
if (DocStatus.length() > 2)
|
||||
{
|
||||
log.warning("Length > 2 - truncated");
|
||||
|
@ -332,6 +333,25 @@ return new KeyNamePair(get_ID(), getDocumentNo());
|
|||
}
|
||||
/** Column name DocumentNo */
|
||||
public static final String COLUMNNAME_DocumentNo = "DocumentNo";
|
||||
/** Set Generate To.
|
||||
@param GenerateTo Generate To */
|
||||
public void setGenerateTo (String GenerateTo)
|
||||
{
|
||||
if (GenerateTo != null && GenerateTo.length() > 1)
|
||||
{
|
||||
log.warning("Length > 1 - truncated");
|
||||
GenerateTo = GenerateTo.substring(0,0);
|
||||
}
|
||||
set_Value ("GenerateTo", GenerateTo);
|
||||
}
|
||||
/** Get Generate To.
|
||||
@return Generate To */
|
||||
public String getGenerateTo()
|
||||
{
|
||||
return (String)get_Value("GenerateTo");
|
||||
}
|
||||
/** Column name GenerateTo */
|
||||
public static final String COLUMNNAME_GenerateTo = "GenerateTo";
|
||||
/** Set Comment/Help.
|
||||
@param Help Comment or Hint */
|
||||
public void setHelp (String Help)
|
||||
|
@ -351,6 +371,26 @@ return (String)get_Value("Help");
|
|||
}
|
||||
/** Column name Help */
|
||||
public static final String COLUMNNAME_Help = "Help";
|
||||
|
||||
/** InOut_ID AD_Reference_ID=337 */
|
||||
public static final int INOUT_ID_AD_Reference_ID=337;
|
||||
/** Set Shipment/Receipt.
|
||||
@param InOut_ID Material Shipment Document */
|
||||
public void setInOut_ID (int InOut_ID)
|
||||
{
|
||||
if (InOut_ID < 1) throw new IllegalArgumentException ("InOut_ID is mandatory.");
|
||||
set_ValueNoCheck ("InOut_ID", Integer.valueOf(InOut_ID));
|
||||
}
|
||||
/** Get Shipment/Receipt.
|
||||
@return Material Shipment Document */
|
||||
public int getInOut_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("InOut_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name InOut_ID */
|
||||
public static final String COLUMNNAME_InOut_ID = "InOut_ID";
|
||||
/** Set Approved.
|
||||
@param IsApproved Indicates if this document requires approval */
|
||||
public void setIsApproved (boolean IsApproved)
|
||||
|
@ -371,23 +411,26 @@ return false;
|
|||
}
|
||||
/** Column name IsApproved */
|
||||
public static final String COLUMNNAME_IsApproved = "IsApproved";
|
||||
/** Set Shipment/Receipt.
|
||||
@param M_InOut_ID Material Shipment Document */
|
||||
public void setM_InOut_ID (int M_InOut_ID)
|
||||
/** Set Sales Transaction.
|
||||
@param IsSOTrx This is a Sales Transaction */
|
||||
public void setIsSOTrx (boolean IsSOTrx)
|
||||
{
|
||||
if (M_InOut_ID < 1) throw new IllegalArgumentException ("M_InOut_ID is mandatory.");
|
||||
set_ValueNoCheck ("M_InOut_ID", Integer.valueOf(M_InOut_ID));
|
||||
set_Value ("IsSOTrx", Boolean.valueOf(IsSOTrx));
|
||||
}
|
||||
/** Get Shipment/Receipt.
|
||||
@return Material Shipment Document */
|
||||
public int getM_InOut_ID()
|
||||
/** Get Sales Transaction.
|
||||
@return This is a Sales Transaction */
|
||||
public boolean isSOTrx()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("M_InOut_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
Object oo = get_Value("IsSOTrx");
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
/** Column name M_InOut_ID */
|
||||
public static final String COLUMNNAME_M_InOut_ID = "M_InOut_ID";
|
||||
return false;
|
||||
}
|
||||
/** Column name IsSOTrx */
|
||||
public static final String COLUMNNAME_IsSOTrx = "IsSOTrx";
|
||||
/** Set RMA Type.
|
||||
@param M_RMAType_ID Return Material Authorization Type */
|
||||
public void setM_RMAType_ID (int M_RMAType_ID)
|
||||
|
|
|
@ -39,7 +39,7 @@ public X_M_RMALine (Properties ctx, int M_RMALine_ID, String trxName)
|
|||
super (ctx, M_RMALine_ID, trxName);
|
||||
/** if (M_RMALine_ID == 0)
|
||||
{
|
||||
setM_InOutLine_ID (0);
|
||||
setLine (0); // @SQL=SELECT NVL(MAX(Line),0)+10 AS DefaultValue FROM M_RMALine WHERE M_RMA_ID=@M_RMA_ID@
|
||||
setM_RMALine_ID (0);
|
||||
setM_RMA_ID (0);
|
||||
setProcessed (false);
|
||||
|
@ -56,13 +56,13 @@ public X_M_RMALine (Properties ctx, ResultSet rs, String trxName)
|
|||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
/** AD_Table_ID=660 */
|
||||
public static final int Table_ID=MTable.getTable_ID("M_RMALine");
|
||||
|
||||
/** TableName=M_RMALine */
|
||||
public static final String Table_Name="M_RMALine";
|
||||
|
||||
protected static KeyNamePair Model = new KeyNamePair(Table_ID,"M_RMALine");
|
||||
/** AD_Table_ID=660 */
|
||||
public static final int Table_ID=MTable.getTable_ID(Table_Name);
|
||||
|
||||
protected static KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
protected BigDecimal accessLevel = BigDecimal.valueOf(1);
|
||||
/** AccessLevel
|
||||
|
@ -89,6 +89,40 @@ public String toString()
|
|||
StringBuffer sb = new StringBuffer ("X_M_RMALine[").append(get_ID()).append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
/** Set Amount.
|
||||
@param Amt Amount */
|
||||
public void setAmt (BigDecimal Amt)
|
||||
{
|
||||
set_Value ("Amt", Amt);
|
||||
}
|
||||
/** Get Amount.
|
||||
@return Amount */
|
||||
public BigDecimal getAmt()
|
||||
{
|
||||
BigDecimal bd = (BigDecimal)get_Value("Amt");
|
||||
if (bd == null) return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
/** Column name Amt */
|
||||
public static final String COLUMNNAME_Amt = "Amt";
|
||||
/** Set Charge.
|
||||
@param C_Charge_ID Additional document charges */
|
||||
public void setC_Charge_ID (int C_Charge_ID)
|
||||
{
|
||||
if (C_Charge_ID <= 0) set_Value ("C_Charge_ID", null);
|
||||
else
|
||||
set_Value ("C_Charge_ID", Integer.valueOf(C_Charge_ID));
|
||||
}
|
||||
/** Get Charge.
|
||||
@return Additional document charges */
|
||||
public int getC_Charge_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("C_Charge_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name C_Charge_ID */
|
||||
public static final String COLUMNNAME_C_Charge_ID = "C_Charge_ID";
|
||||
/** Set Description.
|
||||
@param Description Optional short description of the record */
|
||||
public void setDescription (String Description)
|
||||
|
@ -108,11 +142,44 @@ return (String)get_Value("Description");
|
|||
}
|
||||
/** Column name Description */
|
||||
public static final String COLUMNNAME_Description = "Description";
|
||||
/** Set Line No.
|
||||
@param Line Unique line for this document */
|
||||
public void setLine (int Line)
|
||||
{
|
||||
set_Value ("Line", Integer.valueOf(Line));
|
||||
}
|
||||
/** Get Line No.
|
||||
@return Unique line for this document */
|
||||
public int getLine()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("Line");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name Line */
|
||||
public static final String COLUMNNAME_Line = "Line";
|
||||
/** Set Line Amount.
|
||||
@param LineNetAmt Line Extended Amount (Quantity * Actual Price) without Freight and Charges */
|
||||
public void setLineNetAmt (BigDecimal LineNetAmt)
|
||||
{
|
||||
set_Value ("LineNetAmt", LineNetAmt);
|
||||
}
|
||||
/** Get Line Amount.
|
||||
@return Line Extended Amount (Quantity * Actual Price) without Freight and Charges */
|
||||
public BigDecimal getLineNetAmt()
|
||||
{
|
||||
BigDecimal bd = (BigDecimal)get_Value("LineNetAmt");
|
||||
if (bd == null) return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
/** Column name LineNetAmt */
|
||||
public static final String COLUMNNAME_LineNetAmt = "LineNetAmt";
|
||||
/** Set Shipment/Receipt Line.
|
||||
@param M_InOutLine_ID Line on Shipment or Receipt document */
|
||||
public void setM_InOutLine_ID (int M_InOutLine_ID)
|
||||
{
|
||||
if (M_InOutLine_ID < 1) throw new IllegalArgumentException ("M_InOutLine_ID is mandatory.");
|
||||
if (M_InOutLine_ID <= 0) set_Value ("M_InOutLine_ID", null);
|
||||
else
|
||||
set_Value ("M_InOutLine_ID", Integer.valueOf(M_InOutLine_ID));
|
||||
}
|
||||
/** Get Shipment/Receipt Line.
|
||||
|
@ -202,4 +269,20 @@ return bd;
|
|||
}
|
||||
/** Column name Qty */
|
||||
public static final String COLUMNNAME_Qty = "Qty";
|
||||
/** Set Delivered Quantity.
|
||||
@param QtyDelivered Delivered Quantity */
|
||||
public void setQtyDelivered (BigDecimal QtyDelivered)
|
||||
{
|
||||
set_Value ("QtyDelivered", QtyDelivered);
|
||||
}
|
||||
/** Get Delivered Quantity.
|
||||
@return Delivered Quantity */
|
||||
public BigDecimal getQtyDelivered()
|
||||
{
|
||||
BigDecimal bd = (BigDecimal)get_Value("QtyDelivered");
|
||||
if (bd == null) return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
/** Column name QtyDelivered */
|
||||
public static final String COLUMNNAME_QtyDelivered = "QtyDelivered";
|
||||
}
|
||||
|
|
|
@ -75,7 +75,8 @@ public class InOutCreateInvoice extends SvrProcess
|
|||
throw new IllegalArgumentException("Shipment not completed");
|
||||
|
||||
MInvoice invoice = new MInvoice (ship, null);
|
||||
if (p_M_PriceList_ID != 0)
|
||||
// Should not override pricelist for RMA
|
||||
if (p_M_PriceList_ID != 0 && ship.getM_RMA_ID() != 0)
|
||||
invoice.setM_PriceList_ID(p_M_PriceList_ID);
|
||||
if (p_InvoiceDocumentNo != null && p_InvoiceDocumentNo.length() > 0)
|
||||
invoice.setDocumentNo(p_InvoiceDocumentNo);
|
||||
|
|
|
@ -101,6 +101,9 @@ public class VInOutGen extends CPanel
|
|||
private JScrollPane scrollPane = new JScrollPane();
|
||||
private MiniTable miniTable = new MiniTable();
|
||||
|
||||
private CLabel lDocType = new CLabel();
|
||||
private VComboBox cmbDocType = new VComboBox();
|
||||
|
||||
/** User selection */
|
||||
private ArrayList<Integer> selection = null;
|
||||
|
||||
|
@ -145,6 +148,10 @@ public class VInOutGen extends CPanel
|
|||
info.setEditable(false);
|
||||
genPanel.add(confirmPanelGen, BorderLayout.SOUTH);
|
||||
confirmPanelGen.addActionListener(this);
|
||||
|
||||
lDocType.setLabelFor(cmbDocType);
|
||||
selNorthPanel.add(lDocType, null);
|
||||
selNorthPanel.add(cmbDocType, null);
|
||||
} // jbInit
|
||||
|
||||
/**
|
||||
|
@ -165,6 +172,11 @@ public class VInOutGen extends CPanel
|
|||
fBPartner = new VLookup ("C_BPartner_ID", false, false, true, bpL);
|
||||
lBPartner.setText(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
|
||||
fBPartner.addVetoableChangeListener(this);
|
||||
//Document Type Sales Order/Vendor RMA
|
||||
lDocType.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
|
||||
cmbDocType.addItem(new KeyNamePair(MOrder.Table_ID, Msg.translate(Env.getCtx(), "Order")));
|
||||
cmbDocType.addItem(new KeyNamePair(MRMA.Table_ID, Msg.translate(Env.getCtx(), "VendorRMA")));
|
||||
cmbDocType.addActionListener(this);
|
||||
} // fillPicks
|
||||
|
||||
/**
|
||||
|
@ -204,12 +216,11 @@ public class VInOutGen extends CPanel
|
|||
} // dynInit
|
||||
|
||||
/**
|
||||
* Query Info
|
||||
* Get SQL for Orders that needs to be shipped
|
||||
* @return sql
|
||||
*/
|
||||
private void executeQuery()
|
||||
private String getOrderSQL()
|
||||
{
|
||||
log.info("");
|
||||
int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
|
||||
// Create SQL
|
||||
StringBuffer sql = new StringBuffer(
|
||||
"SELECT C_Order_ID, o.Name, dt.Name, DocumentNo, bp.Name, DateOrdered, TotalLines "
|
||||
|
@ -238,8 +249,71 @@ public class VInOutGen extends CPanel
|
|||
|
||||
//
|
||||
sql.append(" ORDER BY o.Name,bp.Name,DateOrdered");
|
||||
log.fine(sql.toString());
|
||||
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SQL for Vendor RMA that need to be shipped
|
||||
* @return sql
|
||||
*/
|
||||
private String getRMASql()
|
||||
{
|
||||
StringBuffer sql = new StringBuffer();
|
||||
|
||||
sql.append("SELECT rma.M_RMA_ID, org.Name, dt.Name, rma.DocumentNo, bp.Name, rma.Created, rma.Amt ");
|
||||
sql.append("FROM M_RMA rma INNER JOIN AD_Org org ON rma.AD_Org_ID=org.AD_Org_ID ");
|
||||
sql.append("INNER JOIN C_DocType dt ON rma.C_DocType_ID=dt.C_DocType_ID ");
|
||||
sql.append("INNER JOIN C_BPartner bp ON rma.C_BPartner_ID=bp.C_BPartner_ID ");
|
||||
sql.append("INNER JOIN M_InOut io ON rma.InOut_ID=io.M_InOut_ID ");
|
||||
sql.append("WHERE rma.DocStatus='CO' ");
|
||||
sql.append("AND dt.DocBaseType = 'POO' ");
|
||||
sql.append("AND EXISTS (SELECT * FROM M_RMA r INNER JOIN M_RMALine rl ");
|
||||
sql.append("ON r.M_RMA_ID=rl.M_RMA_ID WHERE r.M_RMA_ID=rma.M_RMA_ID ");
|
||||
sql.append("AND rl.IsActive='Y' AND rl.M_InOutLine_ID > 0 AND rl.QtyDelivered < rl.Qty) ");
|
||||
sql.append("AND NOT EXISTS (SELECT * FROM M_InOut oio WHERE oio.M_RMA_ID=rma.M_RMA_ID ");
|
||||
sql.append("AND oio.DocStatus IN ('IP', 'CO', 'CL')) " );
|
||||
sql.append("AND rma.AD_Client_ID=?");
|
||||
|
||||
if (m_M_Warehouse_ID != null)
|
||||
sql.append(" AND io.M_Warehouse_ID=").append(m_M_Warehouse_ID);
|
||||
if (m_C_BPartner_ID != null)
|
||||
sql.append(" AND bp.C_BPartner_ID=").append(m_C_BPartner_ID);
|
||||
|
||||
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID");
|
||||
String lockedIDs = MPrivateAccess.getLockedRecordWhere(MRMA.Table_ID, AD_User_ID);
|
||||
if (lockedIDs != null)
|
||||
{
|
||||
sql.append(" AND rma.M_RMA_ID").append(lockedIDs);
|
||||
}
|
||||
|
||||
sql.append(" ORDER BY org.Name, bp.Name, rma.Created ");
|
||||
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Query Info
|
||||
*/
|
||||
private void executeQuery()
|
||||
{
|
||||
log.info("");
|
||||
int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
|
||||
|
||||
String sql = "";
|
||||
|
||||
KeyNamePair docTypeKNPair = (KeyNamePair)cmbDocType.getSelectedItem();
|
||||
|
||||
if (docTypeKNPair.getKey() == MRMA.Table_ID)
|
||||
{
|
||||
sql = getRMASql();
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = getOrderSQL();
|
||||
}
|
||||
|
||||
log.fine(sql);
|
||||
// reset table
|
||||
int row = 0;
|
||||
miniTable.setRowCount(row);
|
||||
|
@ -300,6 +374,11 @@ public class VInOutGen extends CPanel
|
|||
dispose();
|
||||
return;
|
||||
}
|
||||
if (cmbDocType.equals(e.getSource()))
|
||||
{
|
||||
executeQuery();
|
||||
return;
|
||||
}
|
||||
//
|
||||
saveSelection();
|
||||
if (selection != null
|
||||
|
@ -402,7 +481,18 @@ public class VInOutGen extends CPanel
|
|||
statusBar.setStatusDB(String.valueOf(selection.size()));
|
||||
|
||||
// Prepare Process
|
||||
int AD_Process_ID = 199; // M_InOutCreate - org.compiere.process.InOutGenerate
|
||||
int AD_Process_ID = 0;
|
||||
KeyNamePair docTypeKNPair = (KeyNamePair)cmbDocType.getSelectedItem();
|
||||
|
||||
if (docTypeKNPair.getKey() == MRMA.Table_ID)
|
||||
{
|
||||
AD_Process_ID = 52001; // M_InOut_GenerateRMA - org.adempiere.process.InOutGenerateRMA
|
||||
}
|
||||
else
|
||||
{
|
||||
AD_Process_ID = 199; // M_InOut_Generate - org.compiere.process.InOutGenerate
|
||||
}
|
||||
|
||||
MPInstance instance = new MPInstance(Env.getCtx(), AD_Process_ID, 0);
|
||||
if (!instance.save())
|
||||
{
|
||||
|
|
|
@ -101,6 +101,9 @@ public class VInvoiceGen extends CPanel
|
|||
private MiniTable miniTable = new MiniTable();
|
||||
private ArrayList<Integer> selections = null;
|
||||
|
||||
private CLabel lDocType = new CLabel();
|
||||
private VComboBox cmbDocType = new VComboBox();
|
||||
|
||||
/**
|
||||
* Static Init.
|
||||
* <pre>
|
||||
|
@ -143,6 +146,10 @@ public class VInvoiceGen extends CPanel
|
|||
info.setEditable(false);
|
||||
genPanel.add(confirmPanelGen, BorderLayout.SOUTH);
|
||||
confirmPanelGen.addActionListener(this);
|
||||
|
||||
lDocType.setLabelFor(cmbDocType);
|
||||
selNorthPanel.add(lDocType, null);
|
||||
selNorthPanel.add(cmbDocType, null);
|
||||
} // jbInit
|
||||
|
||||
/**
|
||||
|
@ -161,6 +168,12 @@ public class VInvoiceGen extends CPanel
|
|||
fBPartner = new VLookup ("C_BPartner_ID", false, false, true, bpL);
|
||||
// lBPartner.setText(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
|
||||
fBPartner.addVetoableChangeListener(this);
|
||||
|
||||
//Document Type Sales Order/Vendor RMA
|
||||
lDocType.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
|
||||
cmbDocType.addItem(new KeyNamePair(MOrder.Table_ID, Msg.translate(Env.getCtx(), "Order")));
|
||||
cmbDocType.addItem(new KeyNamePair(MRMA.Table_ID, Msg.translate(Env.getCtx(), "VendorRMA")));
|
||||
cmbDocType.addActionListener(this);
|
||||
} // fillPicks
|
||||
|
||||
/**
|
||||
|
@ -199,14 +212,8 @@ public class VInvoiceGen extends CPanel
|
|||
tabbedPane.addChangeListener(this);
|
||||
} // dynInit
|
||||
|
||||
/**
|
||||
* Query Info
|
||||
*/
|
||||
private void executeQuery()
|
||||
private String getOrderSQL()
|
||||
{
|
||||
log.info("");
|
||||
int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
|
||||
// Create SQL
|
||||
StringBuffer sql = new StringBuffer(
|
||||
"SELECT C_Order_ID, o.Name, dt.Name, DocumentNo, bp.Name, DateOrdered, TotalLines "
|
||||
+ "FROM C_Invoice_Candidate_v ic, AD_Org o, C_BPartner bp, C_DocType dt "
|
||||
|
@ -234,7 +241,68 @@ public class VInvoiceGen extends CPanel
|
|||
|
||||
//
|
||||
sql.append(" ORDER BY o.Name,bp.Name,DateOrdered");
|
||||
// log.fine( "VInvoiceGen.executeQuery - AD_Client_ID=" + AD_Client_ID, sql.toString());
|
||||
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
private String getRMASql()
|
||||
{
|
||||
StringBuffer sql = new StringBuffer();
|
||||
sql.append("SELECT rma.M_RMA_ID, org.Name, dt.Name, rma.DocumentNo, bp.Name, rma.Created, rma.Amt ");
|
||||
sql.append("FROM M_RMA rma INNER JOIN AD_Org org ON rma.AD_Org_ID=org.AD_Org_ID ");
|
||||
sql.append("INNER JOIN C_DocType dt ON rma.C_DocType_ID=dt.C_DocType_ID ");
|
||||
sql.append("INNER JOIN C_BPartner bp ON rma.C_BPartner_ID=bp.C_BPartner_ID ");
|
||||
sql.append("INNER JOIN M_InOut io ON rma.InOut_ID=io.M_InOut_ID ");
|
||||
sql.append("WHERE rma.DocStatus='CO' ");
|
||||
sql.append("AND dt.DocBaseType = 'POO' ");
|
||||
sql.append("AND NOT EXISTS (SELECT * FROM C_Invoice i ");
|
||||
sql.append("WHERE i.M_RMA_ID=rma.M_RMA_ID AND i.DocStatus IN ('IP', 'CO', 'CL')) ");
|
||||
sql.append("AND EXISTS (SELECT * FROM C_InvoiceLine il INNER JOIN M_InOutLine iol ");
|
||||
sql.append("ON il.M_InOutLine_ID=iol.M_InOutLine_ID INNER JOIN C_Invoice i ");
|
||||
sql.append("ON i.C_Invoice_ID=il.C_Invoice_ID WHERE i.DocStatus IN ('CO', 'CL') ");
|
||||
sql.append("AND iol.M_InOutLine_ID IN ");
|
||||
sql.append("(SELECT M_InOutLine_ID FROM M_RMALine rl WHERE rl.M_RMA_ID=rma.M_RMA_ID ");
|
||||
sql.append("AND rl.M_InOutLine_ID IS NOT NULL)) ");
|
||||
sql.append("AND rma.AD_Client_ID=?");
|
||||
|
||||
if (m_AD_Org_ID != null)
|
||||
sql.append(" AND rma.AD_Org_ID=").append(m_AD_Org_ID);
|
||||
if (m_C_BPartner_ID != null)
|
||||
sql.append(" AND bp.C_BPartner_ID=").append(m_C_BPartner_ID);
|
||||
|
||||
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID");
|
||||
String lockedIDs = MPrivateAccess.getLockedRecordWhere(MRMA.Table_ID, AD_User_ID);
|
||||
if (lockedIDs != null)
|
||||
{
|
||||
sql.append(" AND rma.M_RMA_ID").append(lockedIDs);
|
||||
}
|
||||
|
||||
sql.append(" ORDER BY org.Name, bp.Name, rma.Created ");
|
||||
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Query Info
|
||||
*/
|
||||
private void executeQuery()
|
||||
{
|
||||
log.info("");
|
||||
int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
|
||||
// Create SQL
|
||||
|
||||
String sql = "";
|
||||
|
||||
KeyNamePair docTypeKNPair = (KeyNamePair)cmbDocType.getSelectedItem();
|
||||
|
||||
if (docTypeKNPair.getKey() == MOrder.Table_ID)
|
||||
{
|
||||
sql = getOrderSQL();
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = getRMASql();
|
||||
}
|
||||
|
||||
// reset table
|
||||
int row = 0;
|
||||
|
@ -295,6 +363,11 @@ public class VInvoiceGen extends CPanel
|
|||
{
|
||||
dispose();
|
||||
return;
|
||||
}
|
||||
if (cmbDocType.equals(e.getSource()))
|
||||
{
|
||||
executeQuery();
|
||||
return;
|
||||
}
|
||||
//
|
||||
saveSelection();
|
||||
|
@ -392,7 +465,17 @@ public class VInvoiceGen extends CPanel
|
|||
statusBar.setStatusDB(String.valueOf(selections.size()));
|
||||
|
||||
// Prepare Process
|
||||
int AD_Process_ID = 134; // HARDCODED C_InvoiceCreate
|
||||
int AD_Process_ID = 0;
|
||||
KeyNamePair docTypeKNPair = (KeyNamePair)cmbDocType.getSelectedItem();
|
||||
|
||||
if (docTypeKNPair.getKey() == MRMA.Table_ID)
|
||||
{
|
||||
AD_Process_ID = 52002; // C_Invoice_GenerateRMA - org.adempiere.process.InvoiceGenerateRMA
|
||||
}
|
||||
else
|
||||
{
|
||||
AD_Process_ID = 134; // HARDCODED C_InvoiceCreate
|
||||
}
|
||||
MPInstance instance = new MPInstance(Env.getCtx(), AD_Process_ID, 0);
|
||||
if (!instance.save())
|
||||
{
|
||||
|
|
|
@ -140,6 +140,11 @@ public abstract class VCreateFrom extends CDialog
|
|||
protected VLocator locatorField = new VLocator();
|
||||
public static final String SELECT_ALL = "SelectAll";
|
||||
// public static final String SELECT_ALL_TOOLTIP = "Select all records";
|
||||
|
||||
/** Label for the rma selection */
|
||||
protected JLabel rmaLabel = new JLabel();
|
||||
/** Combo box for selecting RMA document */
|
||||
protected JComboBox rmaField = new JComboBox();
|
||||
/**
|
||||
* Static Init.
|
||||
* <pre>
|
||||
|
@ -166,6 +171,7 @@ public abstract class VCreateFrom extends CDialog
|
|||
invoiceLabel.setText(Msg.getElement(Env.getCtx(), "C_Invoice_ID", false));
|
||||
shipmentLabel.setText(Msg.getElement(Env.getCtx(), "M_InOut_ID", false));
|
||||
locatorLabel.setText(Msg.translate(Env.getCtx(), "M_Locator_ID"));
|
||||
rmaLabel.setText(Msg.translate(Env.getCtx(), "M_RMA_ID"));
|
||||
//
|
||||
this.getContentPane().add(parameterPanel, BorderLayout.NORTH);
|
||||
parameterPanel.add(parameterBankPanel, BorderLayout.NORTH);
|
||||
|
@ -196,6 +202,13 @@ public abstract class VCreateFrom extends CDialog
|
|||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterStdPanel.add(locatorField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
// Add RMA document selection to panel
|
||||
parameterStdPanel.add(rmaLabel, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
parameterStdPanel.add(rmaField, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0
|
||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
|
||||
|
||||
this.getContentPane().add(dataPane, BorderLayout.CENTER);
|
||||
dataPane.getViewport().add(dataTable, null);
|
||||
//
|
||||
|
@ -337,8 +350,6 @@ public abstract class VCreateFrom extends CDialog
|
|||
{
|
||||
log.config("C_BPartner_ID=" + C_BPartner_ID);
|
||||
KeyNamePair pp = new KeyNamePair(0,"");
|
||||
//
|
||||
int M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "M_Warehouse_ID");
|
||||
|
||||
// load PO Orders - Closed, Completed
|
||||
orderField.removeActionListener(this);
|
||||
|
@ -356,7 +367,6 @@ public abstract class VCreateFrom extends CDialog
|
|||
StringBuffer sql = new StringBuffer("SELECT o.C_Order_ID,").append(display)
|
||||
.append(" FROM C_Order o "
|
||||
+ "WHERE o.C_BPartner_ID=? AND o.IsSOTrx='N' AND o.DocStatus IN ('CL','CO')"
|
||||
+ " AND o.M_Warehouse_ID = " + M_Warehouse_ID
|
||||
+ " AND o.C_Order_ID IN "
|
||||
+ "(SELECT ol.C_Order_ID FROM C_OrderLine ol"
|
||||
+ " LEFT OUTER JOIN M_MatchPO m ON (ol.C_OrderLine_ID=m.C_OrderLine_ID) "
|
||||
|
|
|
@ -63,6 +63,10 @@ public class VCreateFromInvoice extends VCreateFrom implements VetoableChangeLis
|
|||
locatorLabel.setVisible(false);
|
||||
locatorField.setVisible(false);
|
||||
|
||||
// Do not display RMA document selection
|
||||
rmaLabel.setVisible(false);
|
||||
rmaField.setVisible(false);
|
||||
|
||||
initBPartner(true);
|
||||
bPartnerField.addVetoableChangeListener(this);
|
||||
return true;
|
||||
|
|
|
@ -49,6 +49,44 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
|||
|
||||
/** Loaded Invoice */
|
||||
private MInvoice m_invoice = null;
|
||||
/** Loaded RMA */
|
||||
private MRMA m_rma = null;
|
||||
|
||||
/**
|
||||
* Load Order/Invoice/RMA data into Table
|
||||
* @param data data
|
||||
*/
|
||||
protected void loadTableOIS (Vector data)
|
||||
{
|
||||
// Header Info
|
||||
Vector<String> columnNames = new Vector<String>(7);
|
||||
columnNames.add(Msg.getMsg(Env.getCtx(), "Select"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Quantity"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "C_UOM_ID"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "M_Product_ID"));
|
||||
columnNames.add(Msg.getElement(Env.getCtx(), "VendorProductNo", false));
|
||||
columnNames.add(Msg.getElement(Env.getCtx(), "C_Order_ID", false));
|
||||
columnNames.add(Msg.getElement(Env.getCtx(), "M_RMA_ID", false));
|
||||
columnNames.add(Msg.getElement(Env.getCtx(), "C_Invoice_ID", false));
|
||||
|
||||
// Remove previous listeners
|
||||
dataTable.getModel().removeTableModelListener(this);
|
||||
// Set Model
|
||||
DefaultTableModel model = new DefaultTableModel(data, columnNames);
|
||||
model.addTableModelListener(this);
|
||||
dataTable.setModel(model);
|
||||
//
|
||||
dataTable.setColumnClass(0, Boolean.class, false); // 0-Selection
|
||||
dataTable.setColumnClass(1, Double.class, true); // 1-Qty
|
||||
dataTable.setColumnClass(2, String.class, true); // 2-UOM
|
||||
dataTable.setColumnClass(3, String.class, true); // 3-Product
|
||||
dataTable.setColumnClass(4, String.class, true); // 4-VendorProductNo
|
||||
dataTable.setColumnClass(5, String.class, true); // 5-Order
|
||||
dataTable.setColumnClass(6, String.class, true); // 6-RMA
|
||||
dataTable.setColumnClass(7, String.class, true); // 7-Invoice
|
||||
// Table UI
|
||||
dataTable.autoSize();
|
||||
} // loadOrder
|
||||
|
||||
/**
|
||||
* Dynamic Init
|
||||
|
@ -75,14 +113,24 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
|||
} // dynInit
|
||||
|
||||
/**
|
||||
* Init Details - load invoices not shipped
|
||||
* Init Details - load invoices not shipped and RMA candidates for Shipment
|
||||
* @param C_BPartner_ID BPartner
|
||||
*/
|
||||
protected void initBPDetails(int C_BPartner_ID)
|
||||
{
|
||||
log.config("C_BPartner_ID=" + C_BPartner_ID);
|
||||
|
||||
// load AP Invoice closed or complete
|
||||
initBPInvoiceDetails(C_BPartner_ID);
|
||||
initBPRMADetails(C_BPartner_ID);
|
||||
} // initBPDetails
|
||||
|
||||
/**
|
||||
* Init Details - load invoices not shipped
|
||||
* @param C_BPartner_ID BPartner
|
||||
*/
|
||||
private void initBPInvoiceDetails(int C_BPartner_ID)
|
||||
{
|
||||
// load AP Invoice closed or complete
|
||||
invoiceField.removeActionListener(this);
|
||||
invoiceField.removeAllItems();
|
||||
// None
|
||||
|
@ -123,7 +171,61 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
|||
}
|
||||
invoiceField.setSelectedIndex(0);
|
||||
invoiceField.addActionListener(this);
|
||||
} // initBPDetails
|
||||
}
|
||||
|
||||
/**
|
||||
* Load RMA that are candidates for shipment
|
||||
* @param C_BPartner_ID BPartner
|
||||
*/
|
||||
private void initBPRMADetails(int C_BPartner_ID)
|
||||
{
|
||||
rmaField.removeActionListener(this);
|
||||
rmaField.removeAllItems();
|
||||
// None
|
||||
KeyNamePair pp = new KeyNamePair(0,"");
|
||||
rmaField.addItem(pp);
|
||||
|
||||
String sqlStmt = "SELECT r.M_RMA_ID, r.DocumentNo || '-' || r.Amt from M_RMA r "
|
||||
+ "WHERE ISSOTRX='Y' AND r.DocStatus in ('CO', 'CL') "
|
||||
+ "AND r.C_BPartner_ID=? "
|
||||
+ "AND r.M_RMA_ID in (SELECT rl.M_RMA_ID FROM M_RMALine rl "
|
||||
+ "WHERE rl.M_RMA_ID=r.M_RMA_ID AND rl.QtyDelivered < rl.Qty "
|
||||
+ "AND rl.M_InOutLine_ID IS NOT NULL)";
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sqlStmt, null);
|
||||
pstmt.setInt(1, C_BPartner_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
|
||||
rmaField.addItem(pp);
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sqlStmt.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (pstmt != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
pstmt.close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.severe("Could not close prepared statement");
|
||||
}
|
||||
}
|
||||
}
|
||||
rmaField.setSelectedIndex(0);
|
||||
rmaField.addActionListener(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -147,6 +249,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
|||
// set Invoice and Shipment to Null
|
||||
invoiceField.setSelectedIndex(-1);
|
||||
shipmentField.setSelectedIndex(-1);
|
||||
rmaField.setSelectedIndex(-1);
|
||||
loadOrder(C_Order_ID, false);
|
||||
m_invoice = null;
|
||||
}
|
||||
|
@ -163,9 +266,26 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
|||
// set Order and Shipment to Null
|
||||
orderField.setSelectedIndex(-1);
|
||||
shipmentField.setSelectedIndex(-1);
|
||||
rmaField.setSelectedIndex(-1);
|
||||
loadInvoice(C_Invoice_ID);
|
||||
}
|
||||
}
|
||||
// RMA
|
||||
else if (e.getSource().equals(rmaField))
|
||||
{
|
||||
KeyNamePair pp = (KeyNamePair)rmaField.getSelectedItem();
|
||||
if (pp == null || pp.getKey() == 0)
|
||||
;
|
||||
else
|
||||
{
|
||||
int M_RMA_ID = pp.getKey();
|
||||
// set Order and Shipment to Null
|
||||
orderField.setSelectedIndex(-1);
|
||||
shipmentField.setSelectedIndex(-1);
|
||||
invoiceField.setSelectedIndex(-1);
|
||||
loadRMA(M_RMA_ID);
|
||||
}
|
||||
}
|
||||
} // actionPerformed
|
||||
|
||||
|
||||
|
@ -195,6 +315,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
|||
log.config("C_Invoice_ID=" + C_Invoice_ID);
|
||||
m_invoice = new MInvoice(Env.getCtx(), C_Invoice_ID, null); // save
|
||||
p_order = null;
|
||||
m_rma = null;
|
||||
|
||||
Vector<Vector> data = new Vector<Vector>();
|
||||
StringBuffer sql = new StringBuffer("SELECT " // Entered UOM
|
||||
|
@ -254,6 +375,99 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
|||
loadTableOIS(data);
|
||||
} // loadInvoice
|
||||
|
||||
/**
|
||||
* Load RMA details
|
||||
* @param M_RMA_ID RMA
|
||||
*/
|
||||
private void loadRMA(int M_RMA_ID)
|
||||
{
|
||||
m_invoice = null;
|
||||
p_order = null;
|
||||
|
||||
m_rma = new MRMA(Env.getCtx(), M_RMA_ID, null);
|
||||
|
||||
Vector<Vector> data = new Vector<Vector>();
|
||||
StringBuffer sqlStmt = new StringBuffer();
|
||||
sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - rl.QtyDelivered, iol.M_Product_ID, p.Name, uom.C_UOM_ID, COALESCE(uom.UOMSymbol,uom.Name) ");
|
||||
sqlStmt.append("FROM M_RMALine rl INNER JOIN M_InOutLine iol ON rl.M_InOutLine_ID=iol.M_InOutLine_ID ");
|
||||
|
||||
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
|
||||
{
|
||||
sqlStmt.append("LEFT OUTER JOIN C_UOM uom ON (uom.C_UOM_ID=iol.C_UOM_ID) ");
|
||||
}
|
||||
else
|
||||
{
|
||||
sqlStmt.append("LEFT OUTER JOIN C_UOM_Trl uom ON (uom.C_UOM_ID=iol.C_UOM_ID AND uom.AD_Language='");
|
||||
sqlStmt.append(Env.getAD_Language(Env.getCtx())).append("') ");
|
||||
}
|
||||
sqlStmt.append("LEFT OUTER JOIN M_Product p ON p.M_Product_ID=iol.M_Product_ID ");
|
||||
sqlStmt.append("WHERE rl.M_RMA_ID=? ");
|
||||
sqlStmt.append("AND rl.M_INOUTLINE_ID IS NOT NULL");
|
||||
|
||||
sqlStmt.append(" UNION ");
|
||||
|
||||
sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - rl.QtyDelivered, 0, c.Name, uom.C_UOM_ID, COALESCE(uom.UOMSymbol,uom.Name) ");
|
||||
sqlStmt.append("FROM M_RMALine rl INNER JOIN C_Charge c ON c.C_Charge_ID = rl.C_Charge_ID ");
|
||||
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
|
||||
{
|
||||
sqlStmt.append("LEFT OUTER JOIN C_UOM uom ON (uom.C_UOM_ID=100) ");
|
||||
}
|
||||
else
|
||||
{
|
||||
sqlStmt.append("LEFT OUTER JOIN C_UOM_Trl uom ON (uom.C_UOM_ID=100 AND uom.AD_Language='");
|
||||
sqlStmt.append(Env.getAD_Language(Env.getCtx())).append("') ");
|
||||
}
|
||||
sqlStmt.append("WHERE rl.M_RMA_ID=? ");
|
||||
sqlStmt.append("AND rl.C_Charge_ID IS NOT NULL");
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sqlStmt.toString(), null);
|
||||
pstmt.setInt(1, M_RMA_ID);
|
||||
pstmt.setInt(2, M_RMA_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
|
||||
while (rs.next())
|
||||
{
|
||||
Vector<Object> line = new Vector<Object>(7);
|
||||
line.add(new Boolean(false)); // 0-Selection
|
||||
line.add(rs.getBigDecimal(3).doubleValue()); // 1-Qty
|
||||
KeyNamePair pp = new KeyNamePair(rs.getInt(6), rs.getString(7));
|
||||
line.add(pp); // 2-UOM
|
||||
pp = new KeyNamePair(rs.getInt(4), rs.getString(5));
|
||||
line.add(pp); // 3-Product
|
||||
line.add(null); //4-Vendor Product No
|
||||
line.add(null); //5-Order
|
||||
pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
|
||||
line.add(pp); //6-RMA
|
||||
line.add(null); //7-invoice
|
||||
data.add(line);
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.log(Level.SEVERE, sqlStmt.toString(), ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (pstmt != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
pstmt.close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.severe("Could not close prepared statement");
|
||||
}
|
||||
}
|
||||
}
|
||||
loadTableOIS(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* List number of rows selected
|
||||
*/
|
||||
|
@ -297,7 +511,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
|||
// variable values
|
||||
Double d = (Double) model.getValueAt(i, 1); // 1-Qty
|
||||
BigDecimal QtyEntered = new BigDecimal(d.doubleValue());
|
||||
KeyNamePair pp = (KeyNamePair) model.getValueAt(i, 2); // 2-Product
|
||||
KeyNamePair pp = (KeyNamePair) model.getValueAt(i, 2); // 2-UOM
|
||||
int C_UOM_ID = pp.getKey();
|
||||
pp = (KeyNamePair) model.getValueAt(i, 3); // 3-Product
|
||||
int M_Product_ID = pp.getKey();
|
||||
|
@ -305,6 +519,10 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
|||
pp = (KeyNamePair) model.getValueAt(i, 5); // 5-OrderLine
|
||||
if (pp != null)
|
||||
C_OrderLine_ID = pp.getKey();
|
||||
int M_RMALine_ID = 0;
|
||||
pp = (KeyNamePair) model.getValueAt(i, 6); // 6-RMA
|
||||
if (pp != null)
|
||||
M_RMALine_ID = pp.getKey();
|
||||
int C_InvoiceLine_ID = 0;
|
||||
MInvoiceLine il = null;
|
||||
pp = (KeyNamePair) model.getValueAt(i, 7); // 7-InvoiceLine
|
||||
|
@ -336,6 +554,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
|||
iol.setQty(QtyEntered); // Movement/Entered
|
||||
//
|
||||
MOrderLine ol = null;
|
||||
MRMALine rmal = null;
|
||||
if (C_OrderLine_ID != 0)
|
||||
{
|
||||
iol.setC_OrderLine_ID(C_OrderLine_ID);
|
||||
|
@ -380,6 +599,22 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
|||
iol.setUser1_ID(il.getUser1_ID());
|
||||
iol.setUser2_ID(il.getUser2_ID());
|
||||
}
|
||||
else if (M_RMALine_ID != 0)
|
||||
{
|
||||
rmal = new MRMALine(Env.getCtx(), M_RMALine_ID, null);
|
||||
iol.setM_RMALine_ID(M_RMALine_ID);
|
||||
iol.setQtyEntered(QtyEntered);
|
||||
iol.setDescription(rmal.getDescription());
|
||||
iol.setM_AttributeSetInstance_ID(rmal.getM_AttributeSetInstance_ID());
|
||||
iol.setC_Project_ID(rmal.getC_Project_ID());
|
||||
iol.setC_ProjectPhase_ID(rmal.getC_ProjectPhase_ID());
|
||||
iol.setC_ProjectTask_ID(rmal.getC_ProjectTask_ID());
|
||||
iol.setC_Activity_ID(rmal.getC_Activity_ID());
|
||||
iol.setAD_OrgTrx_ID(rmal.getAD_OrgTrx_ID());
|
||||
iol.setUser1_ID(rmal.getUser1_ID());
|
||||
iol.setUser2_ID(rmal.getUser2_ID());
|
||||
}
|
||||
|
||||
// Charge
|
||||
if (M_Product_ID == 0)
|
||||
{
|
||||
|
@ -387,6 +622,8 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
|||
iol.setC_Charge_ID(ol.getC_Charge_ID());
|
||||
else if (il != null && il.getC_Charge_ID() != 0) // from invoice
|
||||
iol.setC_Charge_ID(il.getC_Charge_ID());
|
||||
else if (rmal != null && rmal.getC_Charge_ID() != 0) // from rma
|
||||
iol.setC_Charge_ID(rmal.getC_Charge_ID());
|
||||
}
|
||||
//
|
||||
iol.setM_Locator_ID(M_Locator_ID);
|
||||
|
@ -403,7 +640,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
|||
|
||||
/**
|
||||
* Update Header
|
||||
* - if linked to another order/invoice - remove link
|
||||
* - if linked to another order/invoice/rma - remove link
|
||||
* - if no link set it
|
||||
*/
|
||||
if (p_order != null && p_order.getC_Order_ID() != 0)
|
||||
|
@ -428,6 +665,20 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
|
|||
inout.setUser1_ID(m_invoice.getUser1_ID());
|
||||
inout.setUser2_ID(m_invoice.getUser2_ID());
|
||||
}
|
||||
if (m_rma != null && m_rma.getM_RMA_ID() != 0)
|
||||
{
|
||||
MInOut originalIO = m_rma.getShipment();
|
||||
inout.setIsSOTrx(!m_rma.isSOTrx());
|
||||
inout.setC_Order_ID(0);
|
||||
inout.setC_Invoice_ID(0);
|
||||
inout.setM_RMA_ID(m_rma.getM_RMA_ID());
|
||||
inout.setAD_OrgTrx_ID(originalIO.getAD_OrgTrx_ID());
|
||||
inout.setC_Project_ID(originalIO.getC_Project_ID());
|
||||
inout.setC_Campaign_ID(originalIO.getC_Campaign_ID());
|
||||
inout.setC_Activity_ID(originalIO.getC_Activity_ID());
|
||||
inout.setUser1_ID(originalIO.getUser1_ID());
|
||||
inout.setUser2_ID(originalIO.getUser2_ID());
|
||||
}
|
||||
inout.save();
|
||||
return true;
|
||||
} // save
|
||||
|
|
|
@ -58,6 +58,9 @@ public class VCreateFromStatement extends VCreateFrom implements VetoableChangeL
|
|||
ADialog.error(0, this, "SaveErrorRowNotFound");
|
||||
return false;
|
||||
}
|
||||
// Do not display RMA selection
|
||||
rmaLabel.setVisible(false);
|
||||
rmaField.setVisible(false);
|
||||
|
||||
setTitle(Msg.translate(Env.getCtx(), "C_BankStatement_ID") + " .. " + Msg.translate(Env.getCtx(), "CreateFrom"));
|
||||
parameterStdPanel.setVisible(false);
|
||||
|
|
|
@ -0,0 +1,287 @@
|
|||
-- Element change
|
||||
|
||||
INSERT INTO AD_ELEMENT
|
||||
(AD_ELEMENT_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY,COLUMNNAME, ENTITYTYPE, NAME, PRINTNAME, DESCRIPTION, HELP, PO_NAME, PO_PRINTNAME, PO_DESCRIPTION, PO_HELP)
|
||||
VALUES
|
||||
(52000,0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'InOut_ID', 'D', 'Shipment/Receipt', 'Shipment/Receipt', 'MaterialShipment Document', 'The Material Shipment / Receipt ', 'Receipt', 'Receipt', 'Material Receipt Document', 'The Material Shipment / Receipt ');
|
||||
|
||||
|
||||
-- Rule
|
||||
|
||||
INSERT INTO AD_VAL_RULE
|
||||
(AD_VAL_RULE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, TYPE, CODE, ENTITYTYPE)
|
||||
VALUES
|
||||
(52000, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'M_InOutShipment/Receipt', NULL, 'S', 'M_InOut.MovementType IN (''C-'', ''V+'') AND M_InOut.DocStatus IN (''CO'', ''CL'')', 'D');
|
||||
|
||||
INSERT INTO AD_VAL_RULE
|
||||
(AD_VAL_RULE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, TYPE, CODE, ENTITYTYPE)
|
||||
VALUES
|
||||
(52001, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'M_InOutShipment/Receipt (RMA)', NULL, 'S', 'M_InOutLine.M_InOut_ID=@InOut_ID@', 'D');
|
||||
|
||||
|
||||
-- Processes
|
||||
|
||||
INSERT INTO AD_PROCESS
|
||||
(AD_PROCESS_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, VALUE, NAME, DESCRIPTION, HELP, ACCESSLEVEL, ENTITYTYPE, PROCEDURENAME, ISREPORT, ISDIRECTPRINT, AD_REPORTVIEW_ID, CLASSNAME, STATISTIC_COUNT,STATISTIC_SECONDS, AD_PRINTFORMAT_ID, WORKFLOWVALUE, AD_WORKFLOW_ID, ISBETAFUNCTIONALITY, ISSERVERPROCESS, SHOWHELP, JASPERREPORT)
|
||||
VALUES
|
||||
(52000, 0,0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'M_RMA_CreateOrder', 'Create Order From RMA', 'Creates an order based on this RMA Document. The RMA should be correct and completed.', 'Generate Order from RMA will create an order based on this RMA document.', '3', 'D', NULL, 'N', 'N', NULL, 'org.adempiere.process.RMACreateOrder', 0, 0, NULL, NULL, NULL, 'N', 'N', 'Y', NULL);
|
||||
|
||||
INSERT INTO AD_PROCESS_ACCESS
|
||||
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
|
||||
VALUES
|
||||
(52000, 0, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
|
||||
|
||||
INSERT INTO AD_PROCESS_ACCESS
|
||||
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
|
||||
VALUES
|
||||
(52000, 102, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
|
||||
|
||||
INSERT INTO AD_PROCESS_ACCESS
|
||||
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
|
||||
VALUES
|
||||
(52000, 103, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
|
||||
|
||||
INSERT INTO AD_PROCESS
|
||||
(AD_PROCESS_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, VALUE, NAME, DESCRIPTION, HELP, ACCESSLEVEL, ENTITYTYPE, PROCEDURENAME, ISREPORT, ISDIRECTPRINT, AD_REPORTVIEW_ID, CLASSNAME, STATISTIC_COUNT,STATISTIC_SECONDS, AD_PRINTFORMAT_ID, WORKFLOWVALUE, AD_WORKFLOW_ID, ISBETAFUNCTIONALITY, ISSERVERPROCESS, SHOWHELP, JASPERREPORT)
|
||||
VALUES
|
||||
(52001, 0,0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'M_InOut_GenerateRMA (Manual)', 'Generate Shipments for Vendor RMA', 'Generate Shipments from open vendor RMA based on selection.', NULL, '3', 'D', NULL, 'N', 'N', NULL, 'org.adempiere.process.InOutGenerateRMA', 0, 0, NULL, NULL, NULL, 'N', 'N', 'Y', NULL);
|
||||
|
||||
INSERT INTO AD_PROCESS_ACCESS
|
||||
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
|
||||
VALUES
|
||||
(52001, 0, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
|
||||
|
||||
INSERT INTO AD_PROCESS_ACCESS
|
||||
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
|
||||
VALUES
|
||||
(52001, 102, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
|
||||
|
||||
INSERT INTO AD_PROCESS_ACCESS
|
||||
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
|
||||
VALUES
|
||||
(52001, 103, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
|
||||
|
||||
|
||||
INSERT INTO AD_PROCESS
|
||||
(AD_PROCESS_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, VALUE, NAME, DESCRIPTION, HELP, ACCESSLEVEL, ENTITYTYPE, PROCEDURENAME, ISREPORT, ISDIRECTPRINT, AD_REPORTVIEW_ID, CLASSNAME, STATISTIC_COUNT,STATISTIC_SECONDS, AD_PRINTFORMAT_ID, WORKFLOWVALUE, AD_WORKFLOW_ID, ISBETAFUNCTIONALITY, ISSERVERPROCESS, SHOWHELP, JASPERREPORT)
|
||||
VALUES
|
||||
(52002, 0,0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'C_Invoice_GenerateRMA (Manual)', 'Generate Invoices for Vendor RMA', 'Generate Invoices from open vendor RMA based on selection.', NULL, '3', 'D', NULL, 'N', 'N', NULL, 'org.adempiere.process.InvoiceGenerateRMA', 0, 0, NULL, NULL, NULL, 'N', 'N', 'Y', NULL);
|
||||
|
||||
INSERT INTO AD_PROCESS_ACCESS
|
||||
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
|
||||
VALUES
|
||||
(52002, 0, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
|
||||
|
||||
INSERT INTO AD_PROCESS_ACCESS
|
||||
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
|
||||
VALUES
|
||||
(52002, 102, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
|
||||
|
||||
INSERT INTO AD_PROCESS_ACCESS
|
||||
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
|
||||
VALUES
|
||||
(52002, 103, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
|
||||
|
||||
|
||||
-- Column Addition
|
||||
|
||||
INSERT INTO AD_COLUMN
|
||||
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
|
||||
VALUES
|
||||
(52000, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'Sales Transaction', 'This is a Sales Transaction', 'The Sales Transaction checkbox indicates if this item is a Sales Transaction.', 1, 'D', 'IsSOTrx', 661, 20, NULL, NULL, 1, '@IsSOTrx@', 'N', 'N', 'Y', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 1106, NULL, 'N', 'N', NULL);
|
||||
|
||||
INSERT INTO AD_COLUMN
|
||||
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
|
||||
VALUES
|
||||
(52001, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'Amount', 'Amount', 'Amount', 1, 'D', 'Amt', 660, 12, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', '@M_InOutLine_ID@!0', 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 160, NULL, 'N', 'N', NULL);
|
||||
|
||||
|
||||
INSERT INTO AD_COLUMN
|
||||
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
|
||||
VALUES
|
||||
(52002, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'Charge', 'Additional document charges', 'The Charge indicates a type of Charge (Handling, Shipping, Restocking)', 1, 'D', 'C_Charge_ID', 660, 19, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 968, NULL, 'N', 'N', NULL);
|
||||
|
||||
INSERT INTO AD_COLUMN
|
||||
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
|
||||
VALUES
|
||||
(52003, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'Line Amount', 'Line Extended Amount (Quantity * Actual Price) without Freight and Charges','Indicates the extended line amount based on the quantity and the actual price. Any additional charges or freight are not included. The Amount may or may not include tax. If the price list is inclusive tax, the line amount is the same as the line total.', 1, 'D', 'LineNetAmt', 660, 12, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 441, NULL, 'N', 'N', NULL);
|
||||
|
||||
INSERT INTO AD_COLUMN
|
||||
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
|
||||
VALUES
|
||||
(52004, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'Line No', 'Unique line for this document', 'Indicates the unique line for a document. It will also control the display order of the lines within a document.', 1, 'D', 'Line', 660, 11, NULL, NULL, 22, '@SQL=SELECT NVL(MAX(Line),0)+10 AS DefaultValue FROM M_RMALine WHERE M_RMA_ID=@M_RMA_ID@', 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 439, NULL, 'N', 'N', NULL);
|
||||
|
||||
INSERT INTO AD_COLUMN
|
||||
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
|
||||
VALUES
|
||||
(52005, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'Delivered Quantity', 'Delivered Quantity', 'The Delivered Quantity indicates the quantity of a product that has been delivered.', 1, 'D', 'QtyDelivered', 660, 29, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 528, NULL, 'N', 'N', NULL);
|
||||
|
||||
INSERT INTO AD_COLUMN
|
||||
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
|
||||
VALUES
|
||||
(52006, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'Generate To', 'Generate To', NULL, 0, 'D', 'GenerateTo', 661, 28, NULL, NULL, 1, NULL, 'N','N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 1491, 52000, 'N', 'N', NULL);
|
||||
|
||||
INSERT INTO AD_COLUMN
|
||||
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
|
||||
VALUES
|
||||
(52007, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'RMA', 'Return Material Authorization', 'A Return Material Authorization may be required to accept returns and to create Credit Memos', 1, 'D', 'M_RMA_ID', 318, 19, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 2412, NULL, 'N', 'N', NULL);
|
||||
|
||||
INSERT INTO AD_COLUMN
|
||||
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
|
||||
VALUES
|
||||
(52008, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'RMA Line', 'Return Material Authorization Line', 'Detail information about the returned goods', 1, 'D', 'M_RMALine_ID', 333, 19, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 2413, NULL, 'N', 'N', NULL);
|
||||
|
||||
INSERT INTO AD_COLUMN
|
||||
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
|
||||
VALUES
|
||||
(52009, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'RMA', 'Return Material Authorization', 'A Return Material Authorization may be required to accept returns and to create Credit Memos', 1, 'D', 'M_RMA_ID', 319, 19, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 2412, NULL, 'N', 'N', NULL);
|
||||
|
||||
INSERT INTO AD_COLUMN
|
||||
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
|
||||
VALUES
|
||||
(52010, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'RMA Line', 'Return Material Authorization Line', 'Detail information about the returned goods', 0, 'D', 'M_RMALine_ID', 320, 19, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 2413, NULL, 'N', 'N', NULL);
|
||||
|
||||
|
||||
-- Field addition
|
||||
|
||||
INSERT INTO AD_FIELD
|
||||
(AD_FIELD_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, HELP, ISCENTRALLYMAINTAINED, AD_TAB_ID, AD_COLUMN_ID, AD_FIELDGROUP_ID, ISDISPLAYED, DISPLAYLOGIC, DISPLAYLENGTH, ISREADONLY, SEQNO, SORTNO, ISSAMELINE, ISHEADING, ISFIELDONLY, ISENCRYPTED, ENTITYTYPE, OBSCURETYPE, AD_REFERENCE_ID, ISMANDATORY)
|
||||
VALUES
|
||||
(52000, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Create Order From RMA', 'Creates an order based on the RMA document', NULL, 'Y', 628, 52006, NULL, 'Y', '@Processed@=''Y'' & @C_Order_ID@=0 & @DocStatus@=''CO''', 1, 'N', 160, NULL, 'Y', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
|
||||
|
||||
INSERT INTO AD_FIELD
|
||||
(AD_FIELD_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, HELP, ISCENTRALLYMAINTAINED, AD_TAB_ID, AD_COLUMN_ID, AD_FIELDGROUP_ID, ISDISPLAYED, DISPLAYLOGIC, DISPLAYLENGTH, ISREADONLY, SEQNO, SORTNO, ISSAMELINE, ISHEADING, ISFIELDONLY, ISENCRYPTED, ENTITYTYPE, OBSCURETYPE, AD_REFERENCE_ID, ISMANDATORY)
|
||||
VALUES
|
||||
(52001, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Amount', 'Amount', 'Amount', 'Y', 629, 52001, NULL, 'Y', NULL, 22, 'N', 100, NULL, 'Y', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
|
||||
|
||||
INSERT INTO AD_FIELD
|
||||
(AD_FIELD_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, HELP, ISCENTRALLYMAINTAINED, AD_TAB_ID, AD_COLUMN_ID, AD_FIELDGROUP_ID, ISDISPLAYED, DISPLAYLOGIC, DISPLAYLENGTH, ISREADONLY, SEQNO, SORTNO, ISSAMELINE, ISHEADING, ISFIELDONLY, ISENCRYPTED, ENTITYTYPE, OBSCURETYPE, AD_REFERENCE_ID, ISMANDATORY)
|
||||
VALUES
|
||||
(52002, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Charge', 'Additional document charges', 'The Charge indicates a type of Charge (Handling, Shipping, Restocking)', 'Y', 629, 52002, NULL, 'Y', NULL, 22, 'N', 80, NULL, 'Y', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
|
||||
|
||||
INSERT INTO AD_FIELD
|
||||
(AD_FIELD_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, HELP, ISCENTRALLYMAINTAINED, AD_TAB_ID, AD_COLUMN_ID, AD_FIELDGROUP_ID, ISDISPLAYED, DISPLAYLOGIC, DISPLAYLENGTH, ISREADONLY, SEQNO, SORTNO, ISSAMELINE, ISHEADING, ISFIELDONLY, ISENCRYPTED, ENTITYTYPE, OBSCURETYPE, AD_REFERENCE_ID, ISMANDATORY)
|
||||
VALUES
|
||||
(52003, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Delivered Quantity', 'Delivered Quantity', 'The Delivered Quantity indicates the quantity of a product that has been delivered.', 'Y', 629, 52005, NULL, 'N', NULL, 22, 'N', 0, NULL, 'N', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
|
||||
|
||||
INSERT INTO AD_FIELD
|
||||
(AD_FIELD_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, HELP, ISCENTRALLYMAINTAINED, AD_TAB_ID, AD_COLUMN_ID, AD_FIELDGROUP_ID, ISDISPLAYED, DISPLAYLOGIC, DISPLAYLENGTH, ISREADONLY, SEQNO, SORTNO, ISSAMELINE, ISHEADING, ISFIELDONLY, ISENCRYPTED, ENTITYTYPE, OBSCURETYPE, AD_REFERENCE_ID, ISMANDATORY)
|
||||
VALUES
|
||||
(52004, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Line Amount', 'Line Extended Amount (Quantity * Actual Price) without Freight and Charges', 'Indicates the extended line amount based on the quantity and the actual price. Any additional charges or freight are not included. The Amount may or may not include tax. If the price list is inclusive tax, the line amount is the same as the line total.', 'Y', 629, 52003, NULL, 'Y', NULL, 22, 'Y', 110, NULL, 'N', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
|
||||
|
||||
INSERT INTO AD_FIELD
|
||||
(AD_FIELD_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, HELP, ISCENTRALLYMAINTAINED, AD_TAB_ID, AD_COLUMN_ID, AD_FIELDGROUP_ID, ISDISPLAYED, DISPLAYLOGIC, DISPLAYLENGTH, ISREADONLY, SEQNO, SORTNO, ISSAMELINE, ISHEADING, ISFIELDONLY, ISENCRYPTED, ENTITYTYPE, OBSCURETYPE, AD_REFERENCE_ID, ISMANDATORY)
|
||||
VALUES
|
||||
(52005, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Line No', 'Unique line for this document', 'Indicates the unique line for a document. It will also control the display order of the lines within a document.', 'Y', 629, 52004, NULL, 'Y', NULL, 22, 'N', 40, NULL, 'Y', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
|
||||
|
||||
INSERT INTO AD_FIELD(ad_field_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, NAME, description, help, iscentrallymaintained, ad_tab_id, ad_column_id, ad_fieldgroup_id, isdisplayed, displaylogic, displaylength, isreadonly, seqno, sortno, issameline, isheading, isfieldonly, isencrypted, entitytype, obscuretype, ad_reference_id, ismandatory)
|
||||
VALUES(52007, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Sales Transaction', 'This is a Sales Transaction', 'The Sales Transaction checkbox indicates if this item is a Sales Transaction.', 'Y', 628, 52000, NULL, 'N', NULL, 1, 'N', NULL, NULL, 'N', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
|
||||
|
||||
-- Update Field
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=(SeqNo + 10) WHERE AD_Tab_ID=296 AND SeqNo > 40;
|
||||
|
||||
INSERT INTO AD_FIELD
|
||||
(ad_field_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, NAME, description, help, iscentrallymaintained, ad_tab_id, ad_column_id, ad_fieldgroup_id, isdisplayed, displaylogic, displaylength, isreadonly, seqno, sortno, issameline, isheading, isfieldonly, isencrypted, entitytype, obscuretype, ad_reference_id, ismandatory)
|
||||
VALUES(52006, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'RMA', 'Return Material Authorization', 'A Return Material Authorization may be required to accept returns and to create Credit Memos', 'Y', 296, 52009, NULL, 'Y', '@M_RMA_ID@!0', 26, 'Y', 50, 0, 'N', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
|
||||
|
||||
|
||||
-- Garden World RMA Fix
|
||||
|
||||
INSERT INTO AD_SEQUENCE(ad_sequence_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, NAME, description, vformat, isautosequence, incrementno, startno, currentnext, currentnextsys, isaudited, istableid, prefix, suffix, startnewyear)
|
||||
VALUES(52000, 11, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 0, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 0, 'Vendor Return Material', NULL, NULL, 'Y', 1, 990000, 990000, 900, 'N', 'N', NULL, NULL, 'N');
|
||||
|
||||
INSERT INTO AD_SEQUENCE(ad_sequence_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, NAME, description, vformat, isautosequence, incrementno, startno, currentnext, currentnextsys, isaudited, istableid, prefix, suffix, startnewyear)
|
||||
VALUES(52001, 11, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 0, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 0, 'MM Vendor Return', 'MM Vendor Return', NULL, 'Y', 1, 590000, 590000, 59000, 'N', 'N', NULL, NULL, 'N');
|
||||
|
||||
INSERT INTO C_DOCTYPE(c_doctype_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, NAME, printname, description, docbasetype, issotrx, docsubtypeso, hasproforma, c_doctypeproforma_id, c_doctypeshipment_id, c_doctypeinvoice_id, isdocnocontrolled, docnosequence_id, gl_category_id, hascharges, documentnote, isdefault, documentcopies, ad_printformat_id, isdefaultcounterdoc, isshipconfirm, ispickqaconfirm, isintransit, issplitwhendifference, c_doctypedifference_id, iscreatecounter, isindexed)
|
||||
VALUES(151, 11, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'MM Vendor Return', 'Vendor Return Material', NULL, 'MMS', 'Y', NULL, 'N', NULL, NULL, NULL, 'Y', 52001, 111, 'N', NULL, 'Y', 1, NULL, 'N', 'N', 'N', 'N', 'N', NULL, 'Y', 'Y');
|
||||
|
||||
INSERT INTO C_DOCTYPE(c_doctype_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, NAME, printname, description, docbasetype, issotrx, docsubtypeso, hasproforma, c_doctypeproforma_id, c_doctypeshipment_id, c_doctypeinvoice_id, isdocnocontrolled, docnosequence_id, gl_category_id, hascharges, documentnote, isdefault, documentcopies, ad_printformat_id, isdefaultcounterdoc, isshipconfirm, ispickqaconfirm, isintransit, issplitwhendifference, c_doctypedifference_id, iscreatecounter, isindexed)
|
||||
VALUES(150, 11, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Vendor Return Material', 'Vendor Return Material Authorization', NULL, 'POO', 'N', 'RM', 'N', NULL, 151, 124, 'Y', 52000, 111, 'N', NULL, 'N', 1, NULL, 'N', 'N', 'N', 'N', 'N', NULL, 'Y', 'Y');
|
||||
|
||||
-- Message Addition
|
||||
|
||||
INSERT INTO AD_MESSAGE
|
||||
(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype)
|
||||
VALUES(52000, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'OrderOrRMA', 'Either Order or RMA can be process on this document.', NULL, 'E', 'D');
|
||||
|
||||
INSERT INTO AD_MESSAGE
|
||||
(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype)
|
||||
VALUES(52001, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'VendorRMA', 'Vendor RMA', NULL, 'I', 'D');
|
||||
|
||||
-- Misc AD Updates
|
||||
|
||||
UPDATE AD_COLUMN SET ColumnName='InOut_ID' WHERE AD_Column_ID=10842;
|
||||
|
||||
UPDATE AD_COLUMN SET AD_Element_ID=52000 WHERE AD_Column_ID=10842;
|
||||
|
||||
UPDATE AD_COLUMN SET AD_Reference_Value_ID=337 WHERE AD_Column_ID=10842;
|
||||
|
||||
UPDATE AD_COLUMN SET AD_Val_Rule_ID=52000 WHERE AD_Column_ID=10842;
|
||||
|
||||
UPDATE AD_TAB SET WhereClause='MovementType IN (''C+'', ''V+'')' WHERE AD_Tab_ID=296;
|
||||
|
||||
UPDATE AD_TAB SET WhereClause='MovementType IN (''C-'', ''V-'')' WHERE AD_Tab_ID=257;
|
||||
|
||||
UPDATE AD_COLUMN SET IsMandatory='N' WHERE AD_Column_ID=10829;
|
||||
|
||||
UPDATE AD_COLUMN SET AD_Val_Rule_ID=52001 WHERE AD_Column_ID=10829;
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=60, IsSameLine='N' WHERE AD_Field_ID=9310;
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=20, IsSameLine='Y' WHERE AD_Field_ID=9311;
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=70, IsSameLine='N' WHERE AD_Field_ID=9312;
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=0, IsSameLine='N' WHERE AD_Field_ID=9313;
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=30, IsSameLine='N' WHERE AD_Field_ID=9314;
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=50, IsSameLine='N' WHERE AD_Field_ID=9315;
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=90, IsSameLine='N' WHERE AD_Field_ID=9316;
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=10, IsSameLine='N' WHERE AD_Field_ID=9317;
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=0, IsSameLine='N' WHERE AD_Field_ID=10401;
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=100, IsSameLine='Y' WHERE AD_Field_ID=52001;
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=80, IsSameLine='Y' WHERE AD_Field_ID=52002;
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=0, IsSameLine='N' WHERE AD_Field_ID=52003;
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=110, IsSameLine='N' WHERE AD_Field_ID=52004;
|
||||
|
||||
UPDATE AD_FIELD SET SeqNo=40, IsSameLine='Y' WHERE AD_Field_ID=52005;
|
||||
|
||||
UPDATE AD_TAB SET IsSingleRow='Y' WHERE AD_Tab_ID=628;
|
||||
|
||||
UPDATE AD_TAB SET IsSingleRow='Y' WHERE AD_Tab_ID=629;
|
||||
|
||||
UPDATE C_DOCTYPE SET IsActive='Y' WHERE C_DocType_ID=149;
|
||||
|
||||
|
||||
UPDATE AD_COLUMN SET Callout='org.adempiere.model.CalloutRMA.docType' WHERE AD_Column_ID=12118;
|
||||
|
||||
UPDATE AD_COLUMN SET ReadOnlyLogic='@IsSOTrx@=''N''' WHERE AD_Column_ID=52006;
|
||||
|
||||
UPDATE AD_FIELD SET DisplayLogic='@Processed@=''Y'' & @C_Order_ID@=0 & @DocStatus@=''CO'' & @IsSOTrx@=''Y'''
|
||||
WHERE AD_Field_ID=52000;
|
||||
|
||||
UPDATE AD_REF_TABLE SET WhereClause='C_DocType.DocBaseType IN (''SOO'', ''POO'') AND C_DocType.DocSubTypeSO=''RM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@'
|
||||
WHERE AD_Reference_ID=321;
|
||||
|
||||
UPDATE AD_VAL_RULE SET Code='M_InOutLine.M_InOut_ID=@InOut_ID@ AND NOT EXISTS (SELECT * FROM M_RMALine rl WHERE rl.M_InOutLine_ID=M_InOutLine.M_InOutLine_ID AND rl.M_RMA_ID=@M_RMA_ID@)'
|
||||
WHERE AD_Val_Rule_ID=52001;
|
||||
|
||||
UPDATE C_DOCTYPE SET NAME='MM Returns', IsSOTrx='N' WHERE C_DocType_ID=149;
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
-- NOTE: Don't forget to run the three processes:
|
||||
-- 1 - Add missing translations
|
||||
-- 2 - Synchronize terminology
|
||||
-- 3 - Check sequences
|
|
@ -0,0 +1,38 @@
|
|||
-- Oracle Changes
|
||||
|
||||
ALTER TABLE C_Invoice ADD M_RMA_ID NUMBER(10, 0) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE C_InvoiceLine ADD M_RMALine_ID NUMBER(10,0) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE M_InOut ADD M_RMA_ID NUMBER(10,0) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE M_InOutLine ADD M_RMALine_ID NUMBER(10,0) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE M_RMA ADD IsSOTrx CHAR(1) DEFAULT 'Y' CHECK (IsSOTrx IN ('Y', 'N')) NOT NULL;
|
||||
|
||||
ALTER TABLE M_RMA RENAME COLUMN M_InOut_ID TO InOut_ID;
|
||||
|
||||
ALTER TABLE M_RMA ADD GenerateTo CHAR(1) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE M_RMALine ADD Amt NUMBER(22,2);
|
||||
|
||||
ALTER TABLE M_RMALine ADD C_Charge_ID NUMBER(10,0);
|
||||
|
||||
ALTER TABLE M_RMALine ADD Line NUMBER(10,0) DEFAULT 0 NOT NULL;
|
||||
|
||||
ALTER TABLE M_RMALine ADD LineNetAmt NUMBER(22,2);
|
||||
|
||||
ALTER TABLE M_RMALine ADD QtyDelivered NUMBER(22,2);
|
||||
|
||||
ALTER TABLE M_RMALine MODIFY M_InOutLine_ID NUMBER(10,0) NULL;
|
||||
|
||||
|
||||
-- Constraints
|
||||
|
||||
ALTER TABLE C_Invoice ADD CONSTRAINT mrma_cinvoice FOREIGN KEY (M_RMA_ID) REFERENCES M_RMA (M_RMA_ID);
|
||||
|
||||
ALTER TABLE C_InvoiceLine ADD CONSTRAINT mrmaline_cinvoiceline FOREIGN KEY (M_RMALine_ID) REFERENCES M_RMALine (M_RMALine_ID);
|
||||
|
||||
ALTER TABLE M_InOut ADD CONSTRAINT mrma_minout FOREIGN KEY (M_RMA_ID) REFERENCES M_RMA (M_RMA_ID);
|
||||
|
||||
ALTER TABLE M_InOutLine ADD CONSTRAINT mrmaline_minoutline FOREIGN KEY (M_RMALine_ID) REFERENCES M_RMALine (M_RMALine_ID);
|
|
@ -0,0 +1,40 @@
|
|||
-- POSTGRESQL Changes
|
||||
|
||||
ALTER TABLE C_Invoice ADD M_RMA_ID NUMERIC(10) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE C_InvoiceLine ADD M_RMALine_ID NUMERIC(10,0) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE M_InOut ADD M_RMA_ID NUMERIC(10,0) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE M_InOutLine ADD M_RMALine_ID NUMERIC(10,0) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE M_RMA ADD IsSOTrx CHAR(1) DEFAULT 'Y' CHECK (IsSOTrx IN ('Y', 'N')) NOT NULL;
|
||||
|
||||
ALTER TABLE M_RMA RENAME M_InOut_ID TO InOut_ID;
|
||||
|
||||
ALTER TABLE M_RMA ADD GenerateTo CHAR(1) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE M_RMALine ADD Amt NUMERIC;
|
||||
|
||||
ALTER TABLE M_RMALine ADD C_Charge_ID NUMERIC(10,0);
|
||||
|
||||
ALTER TABLE M_RMALine ADD Line NUMERIC(10,0) DEFAULT 0 NOT NULL;
|
||||
|
||||
ALTER TABLE M_RMALine ADD LineNetAmt NUMERIC;
|
||||
|
||||
ALTER TABLE M_RMALine ADD QtyDelivered NUMERIC;
|
||||
|
||||
ALTER TABLE M_RMALine ALTER COLUMN M_InOutLine_ID DROP DEFAULT;
|
||||
|
||||
ALTER TABLE M_RMALine ALTER COLUMN M_InOutLine_ID DROP NOT NULL;
|
||||
|
||||
|
||||
-- Constraints
|
||||
|
||||
ALTER TABLE C_Invoice ADD CONSTRAINT mrma_cinvoice FOREIGN KEY (M_RMA_ID) REFERENCES M_RMA (M_RMA_ID);
|
||||
|
||||
ALTER TABLE C_InvoiceLine ADD CONSTRAINT mrmaline_cinvoiceline FOREIGN KEY (M_RMALine_ID) REFERENCES M_RMALine (M_RMALine_ID);
|
||||
|
||||
ALTER TABLE M_InOut ADD CONSTRAINT mrma_minout FOREIGN KEY (M_RMA_ID) REFERENCES M_RMA (M_RMA_ID);
|
||||
|
||||
ALTER TABLE M_InOutLine ADD CONSTRAINT mrmaline_minoutline FOREIGN KEY (M_RMALine_ID) REFERENCES M_RMALine (M_RMALine_ID);
|
Loading…
Reference in New Issue