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()))
|
||||
{
|
||||
|
@ -1193,6 +1226,15 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
else
|
||||
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());
|
||||
|
||||
|
@ -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());
|
||||
|
@ -238,7 +240,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
|||
setM_AttributeSetInstance_ID(sLine.getM_AttributeSetInstance_ID());
|
||||
// setS_ResourceAssignment_ID(sLine.getS_ResourceAssignment_ID());
|
||||
if(getM_Product_ID() == 0)
|
||||
setC_Charge_ID(sLine.getC_Charge_ID());
|
||||
setC_Charge_ID(sLine.getC_Charge_ID());
|
||||
//
|
||||
int C_OrderLine_ID = sLine.getC_OrderLine_ID();
|
||||
if (C_OrderLine_ID != 0)
|
||||
|
@ -255,6 +257,17 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
|||
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
|
||||
{
|
||||
setPrice();
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
@ -69,10 +71,10 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
private MRMALine[] m_lines = null;
|
||||
/** The Shipment */
|
||||
private MInOut m_inout = null;
|
||||
|
||||
|
||||
/**
|
||||
* 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)
|
||||
|
@ -313,7 +362,7 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
setIsApproved(false);
|
||||
return true;
|
||||
} // rejectIt
|
||||
|
||||
|
||||
/**
|
||||
* Complete Document
|
||||
* @return new status (Complete, In Progress, Invalid, Waiting ..)
|
||||
|
@ -337,11 +386,14 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
approveIt();
|
||||
log.info("completeIt - " + toString());
|
||||
//
|
||||
if (true)
|
||||
/*
|
||||
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,7 +526,63 @@ 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
|
||||
* @return Summary of Document
|
||||
|
@ -473,7 +600,50 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
sb.append(" - ").append(getDescription());
|
||||
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
|
||||
* @return amt
|
||||
*/
|
||||
public BigDecimal getAmt()
|
||||
{
|
||||
BigDecimal amt = Env.ZERO;
|
||||
getShipLine();
|
||||
if (m_ioLine != null)
|
||||
{
|
||||
if (m_ioLine.getC_OrderLine_ID() != 0)
|
||||
{
|
||||
MOrderLine ol = new MOrderLine (getCtx(), m_ioLine.getC_OrderLine_ID(), get_TrxName());
|
||||
amt = ol.getPriceActual();
|
||||
}
|
||||
}
|
||||
//
|
||||
return amt.multiply(getQty());
|
||||
} // getAmt
|
||||
|
||||
|
||||
/**
|
||||
* 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 getTotalAmt()
|
||||
{
|
||||
BigDecimal totalAmt = Env.ZERO;
|
||||
BigDecimal taxAmt = Env.ZERO;
|
||||
|
||||
if (Env.ZERO.compareTo(getQty()) != 0 && Env.ZERO.compareTo(getAmt()) != 0)
|
||||
{
|
||||
totalAmt = getQty().multiply(getAmt());
|
||||
if (!getParent().isTaxIncluded())
|
||||
{
|
||||
MTax tax = MTax.get (getCtx(), taxId);
|
||||
taxAmt = tax.calculateTax(getQty().multiply(unitAmount),
|
||||
getParent().isTaxIncluded(), precision);
|
||||
}
|
||||
}
|
||||
|
||||
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,7 +764,10 @@ 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);
|
||||
createDocType("Cash Journal", Msg.getElement(m_ctx, "C_Cash_ID", true),
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,505 +1,548 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software;
|
||||
* 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;
|
||||
* 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;
|
||||
* with this program;
|
||||
if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
package org.compiere.model;
|
||||
|
||||
/** Generated Model - DO NOT CHANGE */
|
||||
import java.util.*;
|
||||
import java.sql.*;
|
||||
import java.math.*;
|
||||
import org.compiere.util.*;
|
||||
import java.util.*;
|
||||
import java.sql.*;
|
||||
import java.math.*;
|
||||
import org.compiere.util.*;
|
||||
/** Generated Model for M_RMA
|
||||
* @author Adempiere (generated)
|
||||
* @version Release 3.2.0 - $Id$ */
|
||||
public class X_M_RMA extends PO
|
||||
{
|
||||
public class X_M_RMA extends PO
|
||||
{
|
||||
/** Standard Constructor
|
||||
@param ctx context
|
||||
@param M_RMA_ID id
|
||||
@param trxName transaction
|
||||
*/
|
||||
public X_M_RMA (Properties ctx, int M_RMA_ID, String trxName)
|
||||
{
|
||||
super (ctx, M_RMA_ID, trxName);
|
||||
/** if (M_RMA_ID == 0)
|
||||
{
|
||||
setC_DocType_ID (0);
|
||||
setDocAction (null); // CO
|
||||
setDocStatus (null); // DR
|
||||
setDocumentNo (null);
|
||||
setIsApproved (false);
|
||||
setM_InOut_ID (0);
|
||||
setM_RMAType_ID (0);
|
||||
setM_RMA_ID (0);
|
||||
setName (null);
|
||||
setProcessed (false);
|
||||
setSalesRep_ID (0);
|
||||
}
|
||||
public X_M_RMA (Properties ctx, int M_RMA_ID, String trxName)
|
||||
{
|
||||
super (ctx, M_RMA_ID, trxName);
|
||||
/** if (M_RMA_ID == 0)
|
||||
{
|
||||
setC_DocType_ID (0);
|
||||
setDocAction (null); // CO
|
||||
setDocStatus (null); // DR
|
||||
setDocumentNo (null);
|
||||
setInOut_ID (0);
|
||||
setIsApproved (false);
|
||||
setIsSOTrx (false); // @IsSOTrx@
|
||||
setM_RMAType_ID (0);
|
||||
setM_RMA_ID (0);
|
||||
setName (null);
|
||||
setProcessed (false);
|
||||
setSalesRep_ID (0);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
/** Load Constructor
|
||||
@param ctx context
|
||||
@param rs result set
|
||||
@param trxName transaction
|
||||
*/
|
||||
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");
|
||||
|
||||
public X_M_RMA (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
/** TableName=M_RMA */
|
||||
public static final String Table_Name="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 BigDecimal accessLevel = BigDecimal.valueOf(1);
|
||||
protected static KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
protected BigDecimal accessLevel = BigDecimal.valueOf(1);
|
||||
/** AccessLevel
|
||||
@return 1 - Org
|
||||
*/
|
||||
protected int get_AccessLevel()
|
||||
{
|
||||
return accessLevel.intValue();
|
||||
}
|
||||
protected int get_AccessLevel()
|
||||
{
|
||||
return accessLevel.intValue();
|
||||
}
|
||||
/** Load Meta Data
|
||||
@param ctx context
|
||||
@return PO Info
|
||||
*/
|
||||
protected POInfo initPO (Properties ctx)
|
||||
{
|
||||
POInfo poi = POInfo.getPOInfo (ctx, Table_ID);
|
||||
return poi;
|
||||
}
|
||||
protected POInfo initPO (Properties ctx)
|
||||
{
|
||||
POInfo poi = POInfo.getPOInfo (ctx, Table_ID);
|
||||
return poi;
|
||||
}
|
||||
/** Info
|
||||
@return info
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer ("X_M_RMA[").append(get_ID()).append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer ("X_M_RMA[").append(get_ID()).append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
/** Set Amount.
|
||||
@param Amt Amount */
|
||||
public void setAmt (BigDecimal Amt)
|
||||
{
|
||||
set_Value ("Amt", Amt);
|
||||
}
|
||||
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;
|
||||
}
|
||||
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";
|
||||
public static final String COLUMNNAME_Amt = "Amt";
|
||||
/** Set Business Partner .
|
||||
@param C_BPartner_ID Identifies a Business Partner */
|
||||
public void setC_BPartner_ID (int C_BPartner_ID)
|
||||
{
|
||||
if (C_BPartner_ID <= 0) set_Value ("C_BPartner_ID", null);
|
||||
public void setC_BPartner_ID (int C_BPartner_ID)
|
||||
{
|
||||
if (C_BPartner_ID <= 0) set_Value ("C_BPartner_ID", null);
|
||||
else
|
||||
set_Value ("C_BPartner_ID", Integer.valueOf(C_BPartner_ID));
|
||||
}
|
||||
set_Value ("C_BPartner_ID", Integer.valueOf(C_BPartner_ID));
|
||||
}
|
||||
/** Get Business Partner .
|
||||
@return Identifies a Business Partner */
|
||||
public int getC_BPartner_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("C_BPartner_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
public int getC_BPartner_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("C_BPartner_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name C_BPartner_ID */
|
||||
public static final String COLUMNNAME_C_BPartner_ID = "C_BPartner_ID";
|
||||
public static final String COLUMNNAME_C_BPartner_ID = "C_BPartner_ID";
|
||||
/** Set Currency.
|
||||
@param C_Currency_ID The Currency for this record */
|
||||
public void setC_Currency_ID (int C_Currency_ID)
|
||||
{
|
||||
if (C_Currency_ID <= 0) set_Value ("C_Currency_ID", null);
|
||||
public void setC_Currency_ID (int C_Currency_ID)
|
||||
{
|
||||
if (C_Currency_ID <= 0) set_Value ("C_Currency_ID", null);
|
||||
else
|
||||
set_Value ("C_Currency_ID", Integer.valueOf(C_Currency_ID));
|
||||
}
|
||||
set_Value ("C_Currency_ID", Integer.valueOf(C_Currency_ID));
|
||||
}
|
||||
/** Get Currency.
|
||||
@return The Currency for this record */
|
||||
public int getC_Currency_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("C_Currency_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
public int getC_Currency_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("C_Currency_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name C_Currency_ID */
|
||||
public static final String COLUMNNAME_C_Currency_ID = "C_Currency_ID";
|
||||
public static final String COLUMNNAME_C_Currency_ID = "C_Currency_ID";
|
||||
|
||||
/** C_DocType_ID AD_Reference_ID=321 */
|
||||
public static final int C_DOCTYPE_ID_AD_Reference_ID=321;
|
||||
public static final int C_DOCTYPE_ID_AD_Reference_ID=321;
|
||||
/** Set Document Type.
|
||||
@param C_DocType_ID Document type or rules */
|
||||
public void setC_DocType_ID (int C_DocType_ID)
|
||||
{
|
||||
if (C_DocType_ID < 0) throw new IllegalArgumentException ("C_DocType_ID is mandatory.");
|
||||
set_Value ("C_DocType_ID", Integer.valueOf(C_DocType_ID));
|
||||
}
|
||||
public void setC_DocType_ID (int C_DocType_ID)
|
||||
{
|
||||
if (C_DocType_ID < 0) throw new IllegalArgumentException ("C_DocType_ID is mandatory.");
|
||||
set_Value ("C_DocType_ID", Integer.valueOf(C_DocType_ID));
|
||||
}
|
||||
/** Get Document Type.
|
||||
@return Document type or rules */
|
||||
public int getC_DocType_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("C_DocType_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
public int getC_DocType_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("C_DocType_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name C_DocType_ID */
|
||||
public static final String COLUMNNAME_C_DocType_ID = "C_DocType_ID";
|
||||
public static final String COLUMNNAME_C_DocType_ID = "C_DocType_ID";
|
||||
/** Set Order.
|
||||
@param C_Order_ID Order */
|
||||
public void setC_Order_ID (int C_Order_ID)
|
||||
{
|
||||
if (C_Order_ID <= 0) set_ValueNoCheck ("C_Order_ID", null);
|
||||
public void setC_Order_ID (int C_Order_ID)
|
||||
{
|
||||
if (C_Order_ID <= 0) set_ValueNoCheck ("C_Order_ID", null);
|
||||
else
|
||||
set_ValueNoCheck ("C_Order_ID", Integer.valueOf(C_Order_ID));
|
||||
}
|
||||
set_ValueNoCheck ("C_Order_ID", Integer.valueOf(C_Order_ID));
|
||||
}
|
||||
/** Get Order.
|
||||
@return Order */
|
||||
public int getC_Order_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("C_Order_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
public int getC_Order_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("C_Order_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name C_Order_ID */
|
||||
public static final String COLUMNNAME_C_Order_ID = "C_Order_ID";
|
||||
public static final String COLUMNNAME_C_Order_ID = "C_Order_ID";
|
||||
/** Set Description.
|
||||
@param Description Optional short description of the record */
|
||||
public void setDescription (String Description)
|
||||
{
|
||||
if (Description != null && Description.length() > 255)
|
||||
{
|
||||
log.warning("Length > 255 - truncated");
|
||||
Description = Description.substring(0,254);
|
||||
}
|
||||
set_Value ("Description", Description);
|
||||
}
|
||||
public void setDescription (String Description)
|
||||
{
|
||||
if (Description != null && Description.length() > 255)
|
||||
{
|
||||
log.warning("Length > 255 - truncated");
|
||||
Description = Description.substring(0,254);
|
||||
}
|
||||
set_Value ("Description", Description);
|
||||
}
|
||||
/** Get Description.
|
||||
@return Optional short description of the record */
|
||||
public String getDescription()
|
||||
{
|
||||
return (String)get_Value("Description");
|
||||
}
|
||||
public String getDescription()
|
||||
{
|
||||
return (String)get_Value("Description");
|
||||
}
|
||||
/** Column name Description */
|
||||
public static final String COLUMNNAME_Description = "Description";
|
||||
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";
|
||||
public static final int DOCACTION_AD_Reference_ID=135;
|
||||
/** 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";
|
||||
public static final String DOCACTION_Complete = "CO";
|
||||
/** Approve = AP */
|
||||
public static final String DOCACTION_Approve = "AP";
|
||||
/** Reject = RJ */
|
||||
public static final String DOCACTION_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";
|
||||
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";
|
||||
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";
|
||||
public static final String DOCACTION_Unlock = "XL";
|
||||
/** Set Document Action.
|
||||
@param DocAction The targeted status of the document */
|
||||
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.length() > 2)
|
||||
{
|
||||
log.warning("Length > 2 - truncated");
|
||||
DocAction = DocAction.substring(0,1);
|
||||
}
|
||||
set_Value ("DocAction", DocAction);
|
||||
}
|
||||
public void setDocAction (String DocAction)
|
||||
{
|
||||
if (DocAction == null) throw new IllegalArgumentException ("DocAction is mandatory");
|
||||
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");
|
||||
DocAction = DocAction.substring(0,1);
|
||||
}
|
||||
set_Value ("DocAction", DocAction);
|
||||
}
|
||||
/** Get Document Action.
|
||||
@return The targeted status of the document */
|
||||
public String getDocAction()
|
||||
{
|
||||
return (String)get_Value("DocAction");
|
||||
}
|
||||
public String getDocAction()
|
||||
{
|
||||
return (String)get_Value("DocAction");
|
||||
}
|
||||
/** Column name DocAction */
|
||||
public static final String COLUMNNAME_DocAction = "DocAction";
|
||||
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";
|
||||
public static final int DOCSTATUS_AD_Reference_ID=131;
|
||||
/** Waiting Confirmation = WC */
|
||||
public static final String DOCSTATUS_WaitingConfirmation = "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";
|
||||
public static final String DOCSTATUS_WaitingPayment = "WP";
|
||||
/** Set Document Status.
|
||||
@param DocStatus The current status of the document */
|
||||
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.length() > 2)
|
||||
{
|
||||
log.warning("Length > 2 - truncated");
|
||||
DocStatus = DocStatus.substring(0,1);
|
||||
}
|
||||
set_Value ("DocStatus", DocStatus);
|
||||
}
|
||||
public void setDocStatus (String DocStatus)
|
||||
{
|
||||
if (DocStatus == null) throw new IllegalArgumentException ("DocStatus is mandatory");
|
||||
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");
|
||||
DocStatus = DocStatus.substring(0,1);
|
||||
}
|
||||
set_Value ("DocStatus", DocStatus);
|
||||
}
|
||||
/** Get Document Status.
|
||||
@return The current status of the document */
|
||||
public String getDocStatus()
|
||||
{
|
||||
return (String)get_Value("DocStatus");
|
||||
}
|
||||
public String getDocStatus()
|
||||
{
|
||||
return (String)get_Value("DocStatus");
|
||||
}
|
||||
/** Column name DocStatus */
|
||||
public static final String COLUMNNAME_DocStatus = "DocStatus";
|
||||
public static final String COLUMNNAME_DocStatus = "DocStatus";
|
||||
/** Set Document No.
|
||||
@param DocumentNo Document sequence number of the document */
|
||||
public void setDocumentNo (String DocumentNo)
|
||||
{
|
||||
if (DocumentNo == null) throw new IllegalArgumentException ("DocumentNo is mandatory.");
|
||||
if (DocumentNo.length() > 30)
|
||||
{
|
||||
log.warning("Length > 30 - truncated");
|
||||
DocumentNo = DocumentNo.substring(0,29);
|
||||
}
|
||||
set_Value ("DocumentNo", DocumentNo);
|
||||
}
|
||||
public void setDocumentNo (String DocumentNo)
|
||||
{
|
||||
if (DocumentNo == null) throw new IllegalArgumentException ("DocumentNo is mandatory.");
|
||||
if (DocumentNo.length() > 30)
|
||||
{
|
||||
log.warning("Length > 30 - truncated");
|
||||
DocumentNo = DocumentNo.substring(0,29);
|
||||
}
|
||||
set_Value ("DocumentNo", DocumentNo);
|
||||
}
|
||||
/** Get Document No.
|
||||
@return Document sequence number of the document */
|
||||
public String getDocumentNo()
|
||||
{
|
||||
return (String)get_Value("DocumentNo");
|
||||
}
|
||||
public String getDocumentNo()
|
||||
{
|
||||
return (String)get_Value("DocumentNo");
|
||||
}
|
||||
/** Get Record ID/ColumnName
|
||||
@return ID/ColumnName pair
|
||||
*/public KeyNamePair getKeyNamePair()
|
||||
{
|
||||
return new KeyNamePair(get_ID(), getDocumentNo());
|
||||
}
|
||||
*/public KeyNamePair getKeyNamePair()
|
||||
{
|
||||
return new KeyNamePair(get_ID(), getDocumentNo());
|
||||
}
|
||||
/** Column name DocumentNo */
|
||||
public static final String COLUMNNAME_DocumentNo = "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)
|
||||
{
|
||||
if (Help != null && Help.length() > 2000)
|
||||
{
|
||||
log.warning("Length > 2000 - truncated");
|
||||
Help = Help.substring(0,1999);
|
||||
}
|
||||
set_Value ("Help", Help);
|
||||
}
|
||||
public void setHelp (String Help)
|
||||
{
|
||||
if (Help != null && Help.length() > 2000)
|
||||
{
|
||||
log.warning("Length > 2000 - truncated");
|
||||
Help = Help.substring(0,1999);
|
||||
}
|
||||
set_Value ("Help", Help);
|
||||
}
|
||||
/** Get Comment/Help.
|
||||
@return Comment or Hint */
|
||||
public String getHelp()
|
||||
{
|
||||
return (String)get_Value("Help");
|
||||
}
|
||||
public String getHelp()
|
||||
{
|
||||
return (String)get_Value("Help");
|
||||
}
|
||||
/** Column name Help */
|
||||
public static final String COLUMNNAME_Help = "Help";
|
||||
/** Set Approved.
|
||||
@param IsApproved Indicates if this document requires approval */
|
||||
public void setIsApproved (boolean IsApproved)
|
||||
{
|
||||
set_Value ("IsApproved", Boolean.valueOf(IsApproved));
|
||||
}
|
||||
/** Get Approved.
|
||||
@return Indicates if this document requires approval */
|
||||
public boolean isApproved()
|
||||
{
|
||||
Object oo = get_Value("IsApproved");
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/** Column name IsApproved */
|
||||
public static final String COLUMNNAME_IsApproved = "IsApproved";
|
||||
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 M_InOut_ID Material Shipment Document */
|
||||
public void setM_InOut_ID (int M_InOut_ID)
|
||||
{
|
||||
if (M_InOut_ID < 1) throw new IllegalArgumentException ("M_InOut_ID is mandatory.");
|
||||
set_ValueNoCheck ("M_InOut_ID", Integer.valueOf(M_InOut_ID));
|
||||
}
|
||||
@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 getM_InOut_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("M_InOut_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name M_InOut_ID */
|
||||
public static final String COLUMNNAME_M_InOut_ID = "M_InOut_ID";
|
||||
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)
|
||||
{
|
||||
set_Value ("IsApproved", Boolean.valueOf(IsApproved));
|
||||
}
|
||||
/** Get Approved.
|
||||
@return Indicates if this document requires approval */
|
||||
public boolean isApproved()
|
||||
{
|
||||
Object oo = get_Value("IsApproved");
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/** Column name IsApproved */
|
||||
public static final String COLUMNNAME_IsApproved = "IsApproved";
|
||||
/** Set Sales Transaction.
|
||||
@param IsSOTrx This is a Sales Transaction */
|
||||
public void setIsSOTrx (boolean IsSOTrx)
|
||||
{
|
||||
set_Value ("IsSOTrx", Boolean.valueOf(IsSOTrx));
|
||||
}
|
||||
/** Get Sales Transaction.
|
||||
@return This is a Sales Transaction */
|
||||
public boolean isSOTrx()
|
||||
{
|
||||
Object oo = get_Value("IsSOTrx");
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
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)
|
||||
{
|
||||
if (M_RMAType_ID < 1) throw new IllegalArgumentException ("M_RMAType_ID is mandatory.");
|
||||
set_Value ("M_RMAType_ID", Integer.valueOf(M_RMAType_ID));
|
||||
}
|
||||
public void setM_RMAType_ID (int M_RMAType_ID)
|
||||
{
|
||||
if (M_RMAType_ID < 1) throw new IllegalArgumentException ("M_RMAType_ID is mandatory.");
|
||||
set_Value ("M_RMAType_ID", Integer.valueOf(M_RMAType_ID));
|
||||
}
|
||||
/** Get RMA Type.
|
||||
@return Return Material Authorization Type */
|
||||
public int getM_RMAType_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("M_RMAType_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
public int getM_RMAType_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("M_RMAType_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name M_RMAType_ID */
|
||||
public static final String COLUMNNAME_M_RMAType_ID = "M_RMAType_ID";
|
||||
public static final String COLUMNNAME_M_RMAType_ID = "M_RMAType_ID";
|
||||
/** Set RMA.
|
||||
@param M_RMA_ID Return Material Authorization */
|
||||
public void setM_RMA_ID (int M_RMA_ID)
|
||||
{
|
||||
if (M_RMA_ID < 1) throw new IllegalArgumentException ("M_RMA_ID is mandatory.");
|
||||
set_ValueNoCheck ("M_RMA_ID", Integer.valueOf(M_RMA_ID));
|
||||
}
|
||||
public void setM_RMA_ID (int M_RMA_ID)
|
||||
{
|
||||
if (M_RMA_ID < 1) throw new IllegalArgumentException ("M_RMA_ID is mandatory.");
|
||||
set_ValueNoCheck ("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();
|
||||
}
|
||||
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";
|
||||
public static final String COLUMNNAME_M_RMA_ID = "M_RMA_ID";
|
||||
/** Set Name.
|
||||
@param Name Alphanumeric identifier of the entity */
|
||||
public void setName (String Name)
|
||||
{
|
||||
if (Name == null) throw new IllegalArgumentException ("Name is mandatory.");
|
||||
if (Name.length() > 60)
|
||||
{
|
||||
log.warning("Length > 60 - truncated");
|
||||
Name = Name.substring(0,59);
|
||||
}
|
||||
set_Value ("Name", Name);
|
||||
}
|
||||
public void setName (String Name)
|
||||
{
|
||||
if (Name == null) throw new IllegalArgumentException ("Name is mandatory.");
|
||||
if (Name.length() > 60)
|
||||
{
|
||||
log.warning("Length > 60 - truncated");
|
||||
Name = Name.substring(0,59);
|
||||
}
|
||||
set_Value ("Name", Name);
|
||||
}
|
||||
/** Get Name.
|
||||
@return Alphanumeric identifier of the entity */
|
||||
public String getName()
|
||||
{
|
||||
return (String)get_Value("Name");
|
||||
}
|
||||
public String getName()
|
||||
{
|
||||
return (String)get_Value("Name");
|
||||
}
|
||||
/** Column name Name */
|
||||
public static final String COLUMNNAME_Name = "Name";
|
||||
public static final String COLUMNNAME_Name = "Name";
|
||||
/** Set Processed.
|
||||
@param Processed The document has been processed */
|
||||
public void setProcessed (boolean Processed)
|
||||
{
|
||||
set_Value ("Processed", Boolean.valueOf(Processed));
|
||||
}
|
||||
public void setProcessed (boolean Processed)
|
||||
{
|
||||
set_Value ("Processed", Boolean.valueOf(Processed));
|
||||
}
|
||||
/** Get Processed.
|
||||
@return The document has been processed */
|
||||
public boolean isProcessed()
|
||||
{
|
||||
Object oo = get_Value("Processed");
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean isProcessed()
|
||||
{
|
||||
Object oo = get_Value("Processed");
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/** Column name Processed */
|
||||
public static final String COLUMNNAME_Processed = "Processed";
|
||||
public static final String COLUMNNAME_Processed = "Processed";
|
||||
/** Set Process Now.
|
||||
@param Processing Process Now */
|
||||
public void setProcessing (boolean Processing)
|
||||
{
|
||||
set_Value ("Processing", Boolean.valueOf(Processing));
|
||||
}
|
||||
public void setProcessing (boolean Processing)
|
||||
{
|
||||
set_Value ("Processing", Boolean.valueOf(Processing));
|
||||
}
|
||||
/** Get Process Now.
|
||||
@return Process Now */
|
||||
public boolean isProcessing()
|
||||
{
|
||||
Object oo = get_Value("Processing");
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean isProcessing()
|
||||
{
|
||||
Object oo = get_Value("Processing");
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/** Column name Processing */
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
public static final String COLUMNNAME_Processing = "Processing";
|
||||
|
||||
/** SalesRep_ID AD_Reference_ID=190 */
|
||||
public static final int SALESREP_ID_AD_Reference_ID=190;
|
||||
public static final int SALESREP_ID_AD_Reference_ID=190;
|
||||
/** Set Sales Representative.
|
||||
@param SalesRep_ID Sales Representative or Company Agent */
|
||||
public void setSalesRep_ID (int SalesRep_ID)
|
||||
{
|
||||
if (SalesRep_ID < 1) throw new IllegalArgumentException ("SalesRep_ID is mandatory.");
|
||||
set_Value ("SalesRep_ID", Integer.valueOf(SalesRep_ID));
|
||||
}
|
||||
public void setSalesRep_ID (int SalesRep_ID)
|
||||
{
|
||||
if (SalesRep_ID < 1) throw new IllegalArgumentException ("SalesRep_ID is mandatory.");
|
||||
set_Value ("SalesRep_ID", Integer.valueOf(SalesRep_ID));
|
||||
}
|
||||
/** Get Sales Representative.
|
||||
@return Sales Representative or Company Agent */
|
||||
public int getSalesRep_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("SalesRep_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
public int getSalesRep_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("SalesRep_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name SalesRep_ID */
|
||||
public static final String COLUMNNAME_SalesRep_ID = "SalesRep_ID";
|
||||
}
|
||||
public static final String COLUMNNAME_SalesRep_ID = "SalesRep_ID";
|
||||
}
|
||||
|
|
|
@ -1,205 +1,288 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software;
|
||||
* 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;
|
||||
* 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;
|
||||
* with this program;
|
||||
if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
package org.compiere.model;
|
||||
|
||||
/** Generated Model - DO NOT CHANGE */
|
||||
import java.util.*;
|
||||
import java.sql.*;
|
||||
import java.math.*;
|
||||
import org.compiere.util.*;
|
||||
import java.util.*;
|
||||
import java.sql.*;
|
||||
import java.math.*;
|
||||
import org.compiere.util.*;
|
||||
/** Generated Model for M_RMALine
|
||||
* @author Adempiere (generated)
|
||||
* @version Release 3.2.0 - $Id$ */
|
||||
public class X_M_RMALine extends PO
|
||||
{
|
||||
public class X_M_RMALine extends PO
|
||||
{
|
||||
/** Standard Constructor
|
||||
@param ctx context
|
||||
@param M_RMALine_ID id
|
||||
@param trxName transaction
|
||||
*/
|
||||
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);
|
||||
setM_RMALine_ID (0);
|
||||
setM_RMA_ID (0);
|
||||
setProcessed (false);
|
||||
setQty (Env.ZERO);
|
||||
}
|
||||
public X_M_RMALine (Properties ctx, int M_RMALine_ID, String trxName)
|
||||
{
|
||||
super (ctx, M_RMALine_ID, trxName);
|
||||
/** if (M_RMALine_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);
|
||||
setQty (Env.ZERO);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
/** Load Constructor
|
||||
@param ctx context
|
||||
@param rs result set
|
||||
@param trxName transaction
|
||||
*/
|
||||
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");
|
||||
|
||||
public X_M_RMALine (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
/** TableName=M_RMALine */
|
||||
public static final String Table_Name="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 BigDecimal accessLevel = BigDecimal.valueOf(1);
|
||||
protected static KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
protected BigDecimal accessLevel = BigDecimal.valueOf(1);
|
||||
/** AccessLevel
|
||||
@return 1 - Org
|
||||
*/
|
||||
protected int get_AccessLevel()
|
||||
{
|
||||
return accessLevel.intValue();
|
||||
}
|
||||
protected int get_AccessLevel()
|
||||
{
|
||||
return accessLevel.intValue();
|
||||
}
|
||||
/** Load Meta Data
|
||||
@param ctx context
|
||||
@return PO Info
|
||||
*/
|
||||
protected POInfo initPO (Properties ctx)
|
||||
{
|
||||
POInfo poi = POInfo.getPOInfo (ctx, Table_ID);
|
||||
return poi;
|
||||
}
|
||||
protected POInfo initPO (Properties ctx)
|
||||
{
|
||||
POInfo poi = POInfo.getPOInfo (ctx, Table_ID);
|
||||
return poi;
|
||||
}
|
||||
/** Info
|
||||
@return info
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer ("X_M_RMALine[").append(get_ID()).append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
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)
|
||||
{
|
||||
if (Description != null && Description.length() > 255)
|
||||
{
|
||||
log.warning("Length > 255 - truncated");
|
||||
Description = Description.substring(0,254);
|
||||
}
|
||||
set_Value ("Description", Description);
|
||||
}
|
||||
public void setDescription (String Description)
|
||||
{
|
||||
if (Description != null && Description.length() > 255)
|
||||
{
|
||||
log.warning("Length > 255 - truncated");
|
||||
Description = Description.substring(0,254);
|
||||
}
|
||||
set_Value ("Description", Description);
|
||||
}
|
||||
/** Get Description.
|
||||
@return Optional short description of the record */
|
||||
public String getDescription()
|
||||
{
|
||||
return (String)get_Value("Description");
|
||||
}
|
||||
public String getDescription()
|
||||
{
|
||||
return (String)get_Value("Description");
|
||||
}
|
||||
/** Column name Description */
|
||||
public static final String COLUMNNAME_Description = "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.");
|
||||
set_Value ("M_InOutLine_ID", Integer.valueOf(M_InOutLine_ID));
|
||||
}
|
||||
public void setM_InOutLine_ID (int M_InOutLine_ID)
|
||||
{
|
||||
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.
|
||||
@return Line on Shipment or Receipt document */
|
||||
public int getM_InOutLine_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("M_InOutLine_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
public int getM_InOutLine_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("M_InOutLine_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Column name M_InOutLine_ID */
|
||||
public static final String COLUMNNAME_M_InOutLine_ID = "M_InOutLine_ID";
|
||||
public static final String COLUMNNAME_M_InOutLine_ID = "M_InOutLine_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 < 1) throw new IllegalArgumentException ("M_RMALine_ID is mandatory.");
|
||||
set_ValueNoCheck ("M_RMALine_ID", Integer.valueOf(M_RMALine_ID));
|
||||
}
|
||||
public void setM_RMALine_ID (int M_RMALine_ID)
|
||||
{
|
||||
if (M_RMALine_ID < 1) throw new IllegalArgumentException ("M_RMALine_ID is mandatory.");
|
||||
set_ValueNoCheck ("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();
|
||||
}
|
||||
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";
|
||||
public static final String COLUMNNAME_M_RMALine_ID = "M_RMALine_ID";
|
||||
/** Set RMA.
|
||||
@param M_RMA_ID Return Material Authorization */
|
||||
public void setM_RMA_ID (int M_RMA_ID)
|
||||
{
|
||||
if (M_RMA_ID < 1) throw new IllegalArgumentException ("M_RMA_ID is mandatory.");
|
||||
set_ValueNoCheck ("M_RMA_ID", Integer.valueOf(M_RMA_ID));
|
||||
}
|
||||
public void setM_RMA_ID (int M_RMA_ID)
|
||||
{
|
||||
if (M_RMA_ID < 1) throw new IllegalArgumentException ("M_RMA_ID is mandatory.");
|
||||
set_ValueNoCheck ("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();
|
||||
}
|
||||
public int getM_RMA_ID()
|
||||
{
|
||||
Integer ii = (Integer)get_Value("M_RMA_ID");
|
||||
if (ii == null) return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
/** Get Record ID/ColumnName
|
||||
@return ID/ColumnName pair
|
||||
*/public KeyNamePair getKeyNamePair()
|
||||
{
|
||||
return new KeyNamePair(get_ID(), String.valueOf(getM_RMA_ID()));
|
||||
}
|
||||
*/public KeyNamePair getKeyNamePair()
|
||||
{
|
||||
return new KeyNamePair(get_ID(), String.valueOf(getM_RMA_ID()));
|
||||
}
|
||||
/** Column name M_RMA_ID */
|
||||
public static final String COLUMNNAME_M_RMA_ID = "M_RMA_ID";
|
||||
public static final String COLUMNNAME_M_RMA_ID = "M_RMA_ID";
|
||||
/** Set Processed.
|
||||
@param Processed The document has been processed */
|
||||
public void setProcessed (boolean Processed)
|
||||
{
|
||||
set_Value ("Processed", Boolean.valueOf(Processed));
|
||||
}
|
||||
public void setProcessed (boolean Processed)
|
||||
{
|
||||
set_Value ("Processed", Boolean.valueOf(Processed));
|
||||
}
|
||||
/** Get Processed.
|
||||
@return The document has been processed */
|
||||
public boolean isProcessed()
|
||||
{
|
||||
Object oo = get_Value("Processed");
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean isProcessed()
|
||||
{
|
||||
Object oo = get_Value("Processed");
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/** Column name Processed */
|
||||
public static final String COLUMNNAME_Processed = "Processed";
|
||||
public static final String COLUMNNAME_Processed = "Processed";
|
||||
/** Set Quantity.
|
||||
@param Qty Quantity */
|
||||
public void setQty (BigDecimal Qty)
|
||||
{
|
||||
if (Qty == null) throw new IllegalArgumentException ("Qty is mandatory.");
|
||||
set_Value ("Qty", Qty);
|
||||
}
|
||||
public void setQty (BigDecimal Qty)
|
||||
{
|
||||
if (Qty == null) throw new IllegalArgumentException ("Qty is mandatory.");
|
||||
set_Value ("Qty", Qty);
|
||||
}
|
||||
/** Get Quantity.
|
||||
@return Quantity */
|
||||
public BigDecimal getQty()
|
||||
{
|
||||
BigDecimal bd = (BigDecimal)get_Value("Qty");
|
||||
if (bd == null) return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
public BigDecimal getQty()
|
||||
{
|
||||
BigDecimal bd = (BigDecimal)get_Value("Qty");
|
||||
if (bd == null) return Env.ZERO;
|
||||
return bd;
|
||||
}
|
||||
/** Column name Qty */
|
||||
public static final String COLUMNNAME_Qty = "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);
|
||||
|
|
|
@ -100,6 +100,9 @@ public class VInOutGen extends CPanel
|
|||
private CTextPane info = new CTextPane();
|
||||
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
|
||||
|
||||
/**
|
||||
|
@ -203,6 +215,83 @@ public class VInOutGen extends CPanel
|
|||
tabbedPane.addChangeListener(this);
|
||||
} // dynInit
|
||||
|
||||
/**
|
||||
* Get SQL for Orders that needs to be shipped
|
||||
* @return sql
|
||||
*/
|
||||
private String getOrderSQL()
|
||||
{
|
||||
// Create SQL
|
||||
StringBuffer sql = new StringBuffer(
|
||||
"SELECT C_Order_ID, o.Name, dt.Name, DocumentNo, bp.Name, DateOrdered, TotalLines "
|
||||
+ "FROM M_InOut_Candidate_v ic, AD_Org o, C_BPartner bp, C_DocType dt "
|
||||
+ "WHERE ic.AD_Org_ID=o.AD_Org_ID"
|
||||
+ " AND ic.C_BPartner_ID=bp.C_BPartner_ID"
|
||||
+ " AND ic.C_DocType_ID=dt.C_DocType_ID"
|
||||
+ " AND ic.AD_Client_ID=?");
|
||||
|
||||
if (m_M_Warehouse_ID != null)
|
||||
sql.append(" AND ic.M_Warehouse_ID=").append(m_M_Warehouse_ID);
|
||||
if (m_C_BPartner_ID != null)
|
||||
sql.append(" AND ic.C_BPartner_ID=").append(m_C_BPartner_ID);
|
||||
|
||||
// bug - [ 1713317 ] Generate Shipments (manual) show locked records
|
||||
/* begin - Exclude locked records; @Trifon */
|
||||
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID");
|
||||
String lockedIDs = MPrivateAccess.getLockedRecordWhere(MOrder.Table_ID, AD_User_ID);
|
||||
if (lockedIDs != null)
|
||||
{
|
||||
if (sql.length() > 0)
|
||||
sql.append(" AND ");
|
||||
sql.append("C_Order_ID").append(lockedIDs);
|
||||
}
|
||||
/* eng - Exclude locked records; @Trifon */
|
||||
|
||||
//
|
||||
sql.append(" ORDER BY o.Name,bp.Name,DateOrdered");
|
||||
|
||||
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
|
||||
*/
|
||||
|
@ -210,36 +299,21 @@ public class VInOutGen extends CPanel
|
|||
{
|
||||
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 M_InOut_Candidate_v ic, AD_Org o, C_BPartner bp, C_DocType dt "
|
||||
+ "WHERE ic.AD_Org_ID=o.AD_Org_ID"
|
||||
+ " AND ic.C_BPartner_ID=bp.C_BPartner_ID"
|
||||
+ " AND ic.C_DocType_ID=dt.C_DocType_ID"
|
||||
+ " AND ic.AD_Client_ID=?");
|
||||
|
||||
if (m_M_Warehouse_ID != null)
|
||||
sql.append(" AND ic.M_Warehouse_ID=").append(m_M_Warehouse_ID);
|
||||
if (m_C_BPartner_ID != null)
|
||||
sql.append(" AND ic.C_BPartner_ID=").append(m_C_BPartner_ID);
|
||||
|
||||
// bug - [ 1713317 ] Generate Shipments (manual) show locked records
|
||||
/* begin - Exclude locked records; @Trifon */
|
||||
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID");
|
||||
String lockedIDs = MPrivateAccess.getLockedRecordWhere(MOrder.Table_ID, AD_User_ID);
|
||||
if (lockedIDs != null)
|
||||
String sql = "";
|
||||
|
||||
KeyNamePair docTypeKNPair = (KeyNamePair)cmbDocType.getSelectedItem();
|
||||
|
||||
if (docTypeKNPair.getKey() == MRMA.Table_ID)
|
||||
{
|
||||
if (sql.length() > 0)
|
||||
sql.append(" AND ");
|
||||
sql.append("C_Order_ID").append(lockedIDs);
|
||||
sql = getRMASql();
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = getOrderSQL();
|
||||
}
|
||||
/* eng - Exclude locked records; @Trifon */
|
||||
|
||||
//
|
||||
sql.append(" ORDER BY o.Name,bp.Name,DateOrdered");
|
||||
log.fine(sql.toString());
|
||||
|
||||
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
|
||||
|
||||
/**
|
||||
|
@ -198,6 +211,76 @@ public class VInvoiceGen extends CPanel
|
|||
// Tabbed Pane Listener
|
||||
tabbedPane.addChangeListener(this);
|
||||
} // dynInit
|
||||
|
||||
private String getOrderSQL()
|
||||
{
|
||||
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 "
|
||||
+ "WHERE ic.AD_Org_ID=o.AD_Org_ID"
|
||||
+ " AND ic.C_BPartner_ID=bp.C_BPartner_ID"
|
||||
+ " AND ic.C_DocType_ID=dt.C_DocType_ID"
|
||||
+ " AND ic.AD_Client_ID=?");
|
||||
|
||||
if (m_AD_Org_ID != null)
|
||||
sql.append(" AND ic.AD_Org_ID=").append(m_AD_Org_ID);
|
||||
if (m_C_BPartner_ID != null)
|
||||
sql.append(" AND ic.C_BPartner_ID=").append(m_C_BPartner_ID);
|
||||
|
||||
// bug - [ 1713337 ] "Generate Invoices (manual)" show locked records.
|
||||
/* begin - Exclude locked records; @Trifon */
|
||||
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID");
|
||||
String lockedIDs = MPrivateAccess.getLockedRecordWhere(MOrder.Table_ID, AD_User_ID);
|
||||
if (lockedIDs != null)
|
||||
{
|
||||
if (sql.length() > 0)
|
||||
sql.append(" AND ");
|
||||
sql.append("C_Order_ID").append(lockedIDs);
|
||||
}
|
||||
/* eng - Exclude locked records; @Trifon */
|
||||
|
||||
//
|
||||
sql.append(" ORDER BY o.Name,bp.Name,DateOrdered");
|
||||
|
||||
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
|
||||
|
@ -207,34 +290,19 @@ public class VInvoiceGen extends CPanel
|
|||
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 "
|
||||
+ "WHERE ic.AD_Org_ID=o.AD_Org_ID"
|
||||
+ " AND ic.C_BPartner_ID=bp.C_BPartner_ID"
|
||||
+ " AND ic.C_DocType_ID=dt.C_DocType_ID"
|
||||
+ " AND ic.AD_Client_ID=?");
|
||||
|
||||
if (m_AD_Org_ID != null)
|
||||
sql.append(" AND ic.AD_Org_ID=").append(m_AD_Org_ID);
|
||||
if (m_C_BPartner_ID != null)
|
||||
sql.append(" AND ic.C_BPartner_ID=").append(m_C_BPartner_ID);
|
||||
|
||||
// bug - [ 1713337 ] "Generate Invoices (manual)" show locked records.
|
||||
/* begin - Exclude locked records; @Trifon */
|
||||
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID");
|
||||
String lockedIDs = MPrivateAccess.getLockedRecordWhere(MOrder.Table_ID, AD_User_ID);
|
||||
if (lockedIDs != null)
|
||||
{
|
||||
if (sql.length() > 0)
|
||||
sql.append(" AND ");
|
||||
sql.append("C_Order_ID").append(lockedIDs);
|
||||
}
|
||||
/* eng - Exclude locked records; @Trifon */
|
||||
|
||||
//
|
||||
sql.append(" ORDER BY o.Name,bp.Name,DateOrdered");
|
||||
// log.fine( "VInvoiceGen.executeQuery - AD_Client_ID=" + AD_Client_ID, sql.toString());
|
||||
String sql = "";
|
||||
|
||||
KeyNamePair docTypeKNPair = (KeyNamePair)cmbDocType.getSelectedItem();
|
||||
|
||||
if (docTypeKNPair.getKey() == MOrder.Table_ID)
|
||||
{
|
||||
sql = getOrderSQL();
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = getRMASql();
|
||||
}
|
||||
|
||||
// reset table
|
||||
int row = 0;
|
||||
|
@ -296,6 +364,11 @@ public class VInvoiceGen extends CPanel
|
|||
dispose();
|
||||
return;
|
||||
}
|
||||
if (cmbDocType.equals(e.getSource()))
|
||||
{
|
||||
executeQuery();
|
||||
return;
|
||||
}
|
||||
//
|
||||
saveSelection();
|
||||
if (selections != null && selections.size() > 0 && m_selectionActive)
|
||||
|
@ -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,9 +350,7 @@ 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);
|
||||
orderField.removeAllItems();
|
||||
|
@ -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) "
|
||||
|
|
|
@ -62,6 +62,10 @@ public class VCreateFromInvoice extends VCreateFrom implements VetoableChangeLis
|
|||
invoiceField.setVisible(false);
|
||||
locatorLabel.setVisible(false);
|
||||
locatorField.setVisible(false);
|
||||
|
||||
// Do not display RMA document selection
|
||||
rmaLabel.setVisible(false);
|
||||
rmaField.setVisible(false);
|
||||
|
||||
initBPartner(true);
|
||||
bPartnerField.addVetoableChangeListener(this);
|
||||
|
|
|
@ -49,7 +49,45 @@ 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
|
||||
* @throws Exception if Lookups cannot be initialized
|
||||
|
@ -75,55 +113,119 @@ 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
|
||||
invoiceField.removeActionListener(this);
|
||||
invoiceField.removeAllItems();
|
||||
// None
|
||||
KeyNamePair pp = new KeyNamePair(0,"");
|
||||
invoiceField.addItem(pp);
|
||||
StringBuffer display = new StringBuffer("i.DocumentNo||' - '||")
|
||||
.append(DB.TO_CHAR("DateInvoiced", DisplayType.Date, Env.getAD_Language(Env.getCtx())))
|
||||
.append("|| ' - ' ||")
|
||||
.append(DB.TO_CHAR("GrandTotal", DisplayType.Amount, Env.getAD_Language(Env.getCtx())));
|
||||
//
|
||||
StringBuffer sql = new StringBuffer("SELECT i.C_Invoice_ID,").append(display)
|
||||
.append(" FROM C_Invoice i "
|
||||
+ "WHERE i.C_BPartner_ID=? AND i.IsSOTrx='N' AND i.DocStatus IN ('CL','CO')"
|
||||
+ " AND i.C_Invoice_ID IN "
|
||||
+ "(SELECT il.C_Invoice_ID FROM C_InvoiceLine il"
|
||||
+ " LEFT OUTER JOIN M_MatchInv mi ON (il.C_InvoiceLine_ID=mi.C_InvoiceLine_ID) "
|
||||
+ "GROUP BY il.C_Invoice_ID,mi.C_InvoiceLine_ID,il.QtyInvoiced "
|
||||
+ "HAVING (il.QtyInvoiced<>SUM(mi.Qty) AND mi.C_InvoiceLine_ID IS NOT NULL)"
|
||||
+ " OR mi.C_InvoiceLine_ID IS NULL) "
|
||||
+ "ORDER BY i.DateInvoiced");
|
||||
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
pstmt.setInt(1, C_BPartner_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
|
||||
invoiceField.addItem(pp);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
invoiceField.setSelectedIndex(0);
|
||||
invoiceField.addActionListener(this);
|
||||
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
|
||||
KeyNamePair pp = new KeyNamePair(0,"");
|
||||
invoiceField.addItem(pp);
|
||||
StringBuffer display = new StringBuffer("i.DocumentNo||' - '||")
|
||||
.append(DB.TO_CHAR("DateInvoiced", DisplayType.Date, Env.getAD_Language(Env.getCtx())))
|
||||
.append("|| ' - ' ||")
|
||||
.append(DB.TO_CHAR("GrandTotal", DisplayType.Amount, Env.getAD_Language(Env.getCtx())));
|
||||
//
|
||||
StringBuffer sql = new StringBuffer("SELECT i.C_Invoice_ID,").append(display)
|
||||
.append(" FROM C_Invoice i "
|
||||
+ "WHERE i.C_BPartner_ID=? AND i.IsSOTrx='N' AND i.DocStatus IN ('CL','CO')"
|
||||
+ " AND i.C_Invoice_ID IN "
|
||||
+ "(SELECT il.C_Invoice_ID FROM C_InvoiceLine il"
|
||||
+ " LEFT OUTER JOIN M_MatchInv mi ON (il.C_InvoiceLine_ID=mi.C_InvoiceLine_ID) "
|
||||
+ "GROUP BY il.C_Invoice_ID,mi.C_InvoiceLine_ID,il.QtyInvoiced "
|
||||
+ "HAVING (il.QtyInvoiced<>SUM(mi.Qty) AND mi.C_InvoiceLine_ID IS NOT NULL)"
|
||||
+ " OR mi.C_InvoiceLine_ID IS NULL) "
|
||||
+ "ORDER BY i.DateInvoiced");
|
||||
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
pstmt.setInt(1, C_BPartner_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
|
||||
invoiceField.addItem(pp);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
invoiceField.setSelectedIndex(0);
|
||||
invoiceField.addActionListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -253,6 +374,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
|
||||
|
|
|
@ -3,121 +3,124 @@
|
|||
* 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.compiere.grid;
|
||||
|
||||
import java.beans.*;
|
||||
import java.math.*;
|
||||
import java.sql.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.logging.*;
|
||||
import javax.swing.table.*;
|
||||
import org.compiere.apps.*;
|
||||
import org.compiere.grid.ed.*;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* Create Transactions for Bank Statements
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: VCreateFromStatement.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $
|
||||
*/
|
||||
public class VCreateFromStatement extends VCreateFrom implements VetoableChangeListener
|
||||
{
|
||||
/**
|
||||
* Protected Constructor
|
||||
* @param mTab MTab
|
||||
*/
|
||||
VCreateFromStatement(GridTab mTab)
|
||||
{
|
||||
super (mTab);
|
||||
log.info("");
|
||||
} // VCreateFromStatement
|
||||
|
||||
/**
|
||||
* Dynamic Init
|
||||
* @throws Exception if Lookups cannot be initialized
|
||||
* @return true if initialized
|
||||
*/
|
||||
protected boolean dynInit() throws Exception
|
||||
{
|
||||
if (p_mTab.getValue("C_BankStatement_ID") == null)
|
||||
{
|
||||
ADialog.error(0, this, "SaveErrorRowNotFound");
|
||||
return false;
|
||||
}
|
||||
|
||||
setTitle(Msg.translate(Env.getCtx(), "C_BankStatement_ID") + " .. " + Msg.translate(Env.getCtx(), "CreateFrom"));
|
||||
parameterStdPanel.setVisible(false);
|
||||
|
||||
int AD_Column_ID = 4917; // C_BankStatement.C_BankAccount_ID
|
||||
MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir);
|
||||
bankAccountField = new VLookup ("C_BankAccount_ID", true, false, true, lookup);
|
||||
bankAccountField.addVetoableChangeListener(this);
|
||||
// Set Default
|
||||
int C_BankAccount_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_BankAccount_ID");
|
||||
bankAccountField.setValue(new Integer(C_BankAccount_ID));
|
||||
// initial Loading
|
||||
loadBankAccount(C_BankAccount_ID);
|
||||
|
||||
return true;
|
||||
} // dynInit
|
||||
|
||||
/**
|
||||
* Init Details (never called)
|
||||
* @param C_BPartner_ID BPartner
|
||||
*/
|
||||
protected void initBPDetails(int C_BPartner_ID)
|
||||
{
|
||||
} // initDetails
|
||||
|
||||
/**
|
||||
* Change Listener
|
||||
* @param e event
|
||||
*/
|
||||
public void vetoableChange (PropertyChangeEvent e)
|
||||
{
|
||||
log.config(e.getPropertyName() + "=" + e.getNewValue());
|
||||
|
||||
// BankAccount
|
||||
if (e.getPropertyName().equals("C_BankAccount_ID"))
|
||||
{
|
||||
int C_BankAccount_ID = ((Integer)e.getNewValue()).intValue();
|
||||
loadBankAccount(C_BankAccount_ID);
|
||||
}
|
||||
tableChanged(null);
|
||||
} // vetoableChange
|
||||
|
||||
/**
|
||||
* Load Data - Bank Account
|
||||
* @param C_BankAccount_ID Bank Account
|
||||
*/
|
||||
private void loadBankAccount (int C_BankAccount_ID)
|
||||
{
|
||||
log.config ("C_BankAccount_ID=" + C_BankAccount_ID);
|
||||
/**
|
||||
* Selected - 0
|
||||
* Date - 1
|
||||
* C_Payment_ID - 2
|
||||
* C_Currenncy - 3
|
||||
* Amt - 4
|
||||
*/
|
||||
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
||||
String sql = "SELECT p.DateTrx,p.C_Payment_ID,p.DocumentNo, p.C_Currency_ID,c.ISO_Code, p.PayAmt,"
|
||||
+ "currencyConvert(p.PayAmt,p.C_Currency_ID,ba.C_Currency_ID,?,null,p.AD_Client_ID,p.AD_Org_ID)," // #1
|
||||
+ " bp.Name "
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.grid;
|
||||
|
||||
import java.beans.*;
|
||||
import java.math.*;
|
||||
import java.sql.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.logging.*;
|
||||
import javax.swing.table.*;
|
||||
import org.compiere.apps.*;
|
||||
import org.compiere.grid.ed.*;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* Create Transactions for Bank Statements
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: VCreateFromStatement.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $
|
||||
*/
|
||||
public class VCreateFromStatement extends VCreateFrom implements VetoableChangeListener
|
||||
{
|
||||
/**
|
||||
* Protected Constructor
|
||||
* @param mTab MTab
|
||||
*/
|
||||
VCreateFromStatement(GridTab mTab)
|
||||
{
|
||||
super (mTab);
|
||||
log.info("");
|
||||
} // VCreateFromStatement
|
||||
|
||||
/**
|
||||
* Dynamic Init
|
||||
* @throws Exception if Lookups cannot be initialized
|
||||
* @return true if initialized
|
||||
*/
|
||||
protected boolean dynInit() throws Exception
|
||||
{
|
||||
if (p_mTab.getValue("C_BankStatement_ID") == null)
|
||||
{
|
||||
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);
|
||||
|
||||
int AD_Column_ID = 4917; // C_BankStatement.C_BankAccount_ID
|
||||
MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir);
|
||||
bankAccountField = new VLookup ("C_BankAccount_ID", true, false, true, lookup);
|
||||
bankAccountField.addVetoableChangeListener(this);
|
||||
// Set Default
|
||||
int C_BankAccount_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_BankAccount_ID");
|
||||
bankAccountField.setValue(new Integer(C_BankAccount_ID));
|
||||
// initial Loading
|
||||
loadBankAccount(C_BankAccount_ID);
|
||||
|
||||
return true;
|
||||
} // dynInit
|
||||
|
||||
/**
|
||||
* Init Details (never called)
|
||||
* @param C_BPartner_ID BPartner
|
||||
*/
|
||||
protected void initBPDetails(int C_BPartner_ID)
|
||||
{
|
||||
} // initDetails
|
||||
|
||||
/**
|
||||
* Change Listener
|
||||
* @param e event
|
||||
*/
|
||||
public void vetoableChange (PropertyChangeEvent e)
|
||||
{
|
||||
log.config(e.getPropertyName() + "=" + e.getNewValue());
|
||||
|
||||
// BankAccount
|
||||
if (e.getPropertyName().equals("C_BankAccount_ID"))
|
||||
{
|
||||
int C_BankAccount_ID = ((Integer)e.getNewValue()).intValue();
|
||||
loadBankAccount(C_BankAccount_ID);
|
||||
}
|
||||
tableChanged(null);
|
||||
} // vetoableChange
|
||||
|
||||
/**
|
||||
* Load Data - Bank Account
|
||||
* @param C_BankAccount_ID Bank Account
|
||||
*/
|
||||
private void loadBankAccount (int C_BankAccount_ID)
|
||||
{
|
||||
log.config ("C_BankAccount_ID=" + C_BankAccount_ID);
|
||||
/**
|
||||
* Selected - 0
|
||||
* Date - 1
|
||||
* C_Payment_ID - 2
|
||||
* C_Currenncy - 3
|
||||
* Amt - 4
|
||||
*/
|
||||
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
||||
String sql = "SELECT p.DateTrx,p.C_Payment_ID,p.DocumentNo, p.C_Currency_ID,c.ISO_Code, p.PayAmt,"
|
||||
+ "currencyConvert(p.PayAmt,p.C_Currency_ID,ba.C_Currency_ID,?,null,p.AD_Client_ID,p.AD_Org_ID)," // #1
|
||||
+ " bp.Name "
|
||||
+ "FROM C_BankAccount ba"
|
||||
+ " INNER JOIN C_Payment_v p ON (p.C_BankAccount_ID=ba.C_BankAccount_ID)"
|
||||
+ " INNER JOIN C_Currency c ON (p.C_Currency_ID=c.C_Currency_ID)"
|
||||
|
@ -127,115 +130,115 @@ public class VCreateFromStatement extends VCreateFrom implements VetoableChangeL
|
|||
+ " AND p.C_BankAccount_ID=?" // #2
|
||||
+ " AND NOT EXISTS (SELECT * FROM C_BankStatementLine l "
|
||||
// Voided Bank Statements have 0 StmtAmt
|
||||
+ "WHERE p.C_Payment_ID=l.C_Payment_ID AND l.StmtAmt <> 0)";
|
||||
|
||||
// Get StatementDate
|
||||
Timestamp ts = (Timestamp)p_mTab.getValue("StatementDate");
|
||||
if (ts == null)
|
||||
ts = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
pstmt.setTimestamp(1, ts);
|
||||
pstmt.setInt(2, C_BankAccount_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
Vector<Object> line = new Vector<Object>(6);
|
||||
line.add(new Boolean(false)); // 0-Selection
|
||||
line.add(rs.getTimestamp(1)); // 1-DateTrx
|
||||
KeyNamePair pp = new KeyNamePair(rs.getInt(2), rs.getString(3));
|
||||
line.add(pp); // 2-C_Payment_ID
|
||||
pp = new KeyNamePair(rs.getInt(4), rs.getString(5));
|
||||
line.add(pp); // 3-Currency
|
||||
line.add(rs.getBigDecimal(6)); // 4-PayAmt
|
||||
line.add(rs.getBigDecimal(7)); // 5-Conv Amt
|
||||
line.add(rs.getString(8)); // 6-BParner
|
||||
data.add(line);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
// Header Info
|
||||
Vector<String> columnNames = new Vector<String>(6);
|
||||
columnNames.add(Msg.getMsg(Env.getCtx(), "Select"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Date"));
|
||||
columnNames.add(Msg.getElement(Env.getCtx(), "C_Payment_ID"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "C_Currency_ID"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Amount"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "ConvertedAmount"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
|
||||
|
||||
// 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, Timestamp.class, true); // 1-TrxDate
|
||||
dataTable.setColumnClass(2, String.class, true); // 2-Payment
|
||||
dataTable.setColumnClass(3, String.class, true); // 3-Currency
|
||||
dataTable.setColumnClass(4, BigDecimal.class, true); // 4-Amount
|
||||
dataTable.setColumnClass(5, BigDecimal.class, true); // 5-ConvAmount
|
||||
dataTable.setColumnClass(6, String.class, true); // 6-BPartner
|
||||
// Table UI
|
||||
dataTable.autoSize();
|
||||
} // loadBankAccount
|
||||
|
||||
/**
|
||||
* List total amount
|
||||
*/
|
||||
protected void info()
|
||||
{
|
||||
DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
|
||||
|
||||
TableModel model = dataTable.getModel();
|
||||
BigDecimal total = new BigDecimal(0.0);
|
||||
int rows = model.getRowCount();
|
||||
int count = 0;
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
if (((Boolean)model.getValueAt(i, 0)).booleanValue())
|
||||
{
|
||||
total = total.add((BigDecimal)model.getValueAt(i, 4));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
statusBar.setStatusLine(String.valueOf(count) + " - " + Msg.getMsg(Env.getCtx(), "Sum") + " " + format.format(total));
|
||||
} // infoStatement
|
||||
|
||||
/**
|
||||
* Save Statement - Insert Data
|
||||
* @return true if saved
|
||||
*/
|
||||
protected boolean save()
|
||||
{
|
||||
log.config("");
|
||||
TableModel model = dataTable.getModel();
|
||||
int rows = model.getRowCount();
|
||||
if (rows == 0)
|
||||
return false;
|
||||
|
||||
// fixed values
|
||||
int C_BankStatement_ID = ((Integer)p_mTab.getValue("C_BankStatement_ID")).intValue();
|
||||
MBankStatement bs = new MBankStatement (Env.getCtx(), C_BankStatement_ID, null);
|
||||
log.config(bs.toString());
|
||||
|
||||
// Lines
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
if (((Boolean)model.getValueAt(i, 0)).booleanValue())
|
||||
{
|
||||
Timestamp trxDate = (Timestamp)model.getValueAt(i, 1); // 1-DateTrx
|
||||
KeyNamePair pp = (KeyNamePair)model.getValueAt(i, 2); // 2-C_Payment_ID
|
||||
int C_Payment_ID = pp.getKey();
|
||||
+ "WHERE p.C_Payment_ID=l.C_Payment_ID AND l.StmtAmt <> 0)";
|
||||
|
||||
// Get StatementDate
|
||||
Timestamp ts = (Timestamp)p_mTab.getValue("StatementDate");
|
||||
if (ts == null)
|
||||
ts = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
pstmt.setTimestamp(1, ts);
|
||||
pstmt.setInt(2, C_BankAccount_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
Vector<Object> line = new Vector<Object>(6);
|
||||
line.add(new Boolean(false)); // 0-Selection
|
||||
line.add(rs.getTimestamp(1)); // 1-DateTrx
|
||||
KeyNamePair pp = new KeyNamePair(rs.getInt(2), rs.getString(3));
|
||||
line.add(pp); // 2-C_Payment_ID
|
||||
pp = new KeyNamePair(rs.getInt(4), rs.getString(5));
|
||||
line.add(pp); // 3-Currency
|
||||
line.add(rs.getBigDecimal(6)); // 4-PayAmt
|
||||
line.add(rs.getBigDecimal(7)); // 5-Conv Amt
|
||||
line.add(rs.getString(8)); // 6-BParner
|
||||
data.add(line);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
// Header Info
|
||||
Vector<String> columnNames = new Vector<String>(6);
|
||||
columnNames.add(Msg.getMsg(Env.getCtx(), "Select"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Date"));
|
||||
columnNames.add(Msg.getElement(Env.getCtx(), "C_Payment_ID"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "C_Currency_ID"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Amount"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "ConvertedAmount"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
|
||||
|
||||
// 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, Timestamp.class, true); // 1-TrxDate
|
||||
dataTable.setColumnClass(2, String.class, true); // 2-Payment
|
||||
dataTable.setColumnClass(3, String.class, true); // 3-Currency
|
||||
dataTable.setColumnClass(4, BigDecimal.class, true); // 4-Amount
|
||||
dataTable.setColumnClass(5, BigDecimal.class, true); // 5-ConvAmount
|
||||
dataTable.setColumnClass(6, String.class, true); // 6-BPartner
|
||||
// Table UI
|
||||
dataTable.autoSize();
|
||||
} // loadBankAccount
|
||||
|
||||
/**
|
||||
* List total amount
|
||||
*/
|
||||
protected void info()
|
||||
{
|
||||
DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
|
||||
|
||||
TableModel model = dataTable.getModel();
|
||||
BigDecimal total = new BigDecimal(0.0);
|
||||
int rows = model.getRowCount();
|
||||
int count = 0;
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
if (((Boolean)model.getValueAt(i, 0)).booleanValue())
|
||||
{
|
||||
total = total.add((BigDecimal)model.getValueAt(i, 4));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
statusBar.setStatusLine(String.valueOf(count) + " - " + Msg.getMsg(Env.getCtx(), "Sum") + " " + format.format(total));
|
||||
} // infoStatement
|
||||
|
||||
/**
|
||||
* Save Statement - Insert Data
|
||||
* @return true if saved
|
||||
*/
|
||||
protected boolean save()
|
||||
{
|
||||
log.config("");
|
||||
TableModel model = dataTable.getModel();
|
||||
int rows = model.getRowCount();
|
||||
if (rows == 0)
|
||||
return false;
|
||||
|
||||
// fixed values
|
||||
int C_BankStatement_ID = ((Integer)p_mTab.getValue("C_BankStatement_ID")).intValue();
|
||||
MBankStatement bs = new MBankStatement (Env.getCtx(), C_BankStatement_ID, null);
|
||||
log.config(bs.toString());
|
||||
|
||||
// Lines
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
if (((Boolean)model.getValueAt(i, 0)).booleanValue())
|
||||
{
|
||||
Timestamp trxDate = (Timestamp)model.getValueAt(i, 1); // 1-DateTrx
|
||||
KeyNamePair pp = (KeyNamePair)model.getValueAt(i, 2); // 2-C_Payment_ID
|
||||
int C_Payment_ID = pp.getKey();
|
||||
pp = (KeyNamePair)model.getValueAt(i, 3); // 3-Currency
|
||||
int C_Currency_ID = pp.getKey();
|
||||
BigDecimal TrxAmt = (BigDecimal)model.getValueAt(i, 4); // 4-PayAmt
|
||||
|
@ -243,15 +246,15 @@ public class VCreateFromStatement extends VCreateFrom implements VetoableChangeL
|
|||
//
|
||||
log.fine("Line Date=" + trxDate
|
||||
+ ", Payment=" + C_Payment_ID + ", Currency=" + C_Currency_ID + ", Amt=" + TrxAmt);
|
||||
//
|
||||
MBankStatementLine bsl = new MBankStatementLine (bs);
|
||||
bsl.setStatementLineDate(trxDate);
|
||||
bsl.setPayment(new MPayment(Env.getCtx(), C_Payment_ID, null));
|
||||
if (!bsl.save())
|
||||
log.log(Level.SEVERE, "Line not created #" + i);
|
||||
} // if selected
|
||||
} // for all rows
|
||||
return true;
|
||||
} // save
|
||||
|
||||
} // VCreateFromStatement
|
||||
//
|
||||
MBankStatementLine bsl = new MBankStatementLine (bs);
|
||||
bsl.setStatementLineDate(trxDate);
|
||||
bsl.setPayment(new MPayment(Env.getCtx(), C_Payment_ID, null));
|
||||
if (!bsl.save())
|
||||
log.log(Level.SEVERE, "Line not created #" + i);
|
||||
} // if selected
|
||||
} // for all rows
|
||||
return true;
|
||||
} // save
|
||||
|
||||
} // VCreateFromStatement
|
||||
|
|
|
@ -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