diff --git a/andromeida.midsuit.project/src/andromedia/midsuit/doc/MID_DocMovement.java b/andromeida.midsuit.project/src/andromedia/midsuit/doc/MID_DocMovement.java
new file mode 100644
index 0000000..78b0fc4
--- /dev/null
+++ b/andromeida.midsuit.project/src/andromedia/midsuit/doc/MID_DocMovement.java
@@ -0,0 +1,272 @@
+/******************************************************************************
+ * 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 andromedia.midsuit.doc;
+
+import java.math.BigDecimal;
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.logging.Level;
+
+import org.compiere.acct.Doc;
+import org.compiere.acct.DocLine;
+import org.compiere.acct.Fact;
+import org.compiere.acct.FactLine;
+import org.compiere.model.MAcctSchema;
+import org.compiere.model.MCostDetail;
+import org.compiere.model.MMovement;
+import org.compiere.model.MMovementLine;
+import org.compiere.model.MMovementLineMA;
+import org.compiere.model.MProduct;
+import org.compiere.model.ProductCost;
+import org.compiere.util.Env;
+
+/**
+ * Post Invoice Documents.
+ *
+ * Table: M_Movement (323)
+ * Document Types: MMM
+ *
+ * @author Jorg Janke
+ * @author Armen Rizal, Goodwill Consulting
+ * BF [ 1745154 ] Cost in Reversing Material Related Docs
+ * @version $Id: Doc_Movement.java,v 1.3 2006/07/30 00:53:33 jjanke Exp $
+ */
+public class MID_DocMovement extends Doc
+{
+ private int m_Reversal_ID = 0;
+ @SuppressWarnings("unused")
+ private String m_DocStatus = "";
+
+ /**
+ * Constructor
+ * @param as accounting schema
+ * @param rs record
+ * @param trxName trx
+ */
+ public MID_DocMovement (MAcctSchema as, ResultSet rs, String trxName)
+ {
+ super (as, MMovement.class, rs, DOCTYPE_MatMovement, trxName);
+ } // Doc_Movement
+
+ /**
+ * Load Document Details
+ * @return error message or null
+ */
+ protected String loadDocumentDetails()
+ {
+ setC_Currency_ID(NO_CURRENCY);
+ MMovement move = (MMovement)getPO();
+ setDateDoc (move.getMovementDate());
+ setDateAcct(move.getMovementDate());
+ m_Reversal_ID = move.getReversal_ID();//store original (voided/reversed) document
+ m_DocStatus = move.getDocStatus();
+ // Contained Objects
+ p_lines = loadLines(move);
+ if (log.isLoggable(Level.FINE)) log.fine("Lines=" + p_lines.length);
+ return null;
+ } // loadDocumentDetails
+
+ /**
+ * Load Invoice Line
+ * @param move move
+ * @return document lines (DocLine_Material)
+ */
+ private DocLine[] loadLines(MMovement move)
+ {
+ ArrayList list = new ArrayList();
+ MMovementLine[] lines = move.getLines(false);
+ if(move.get_ValueAsBoolean("IsAsset"))
+ return new DocLine[0];
+ for (int i = 0; i < lines.length; i++)
+ {
+ MMovementLine line = lines[i];
+ DocLine docLine = new DocLine (line, this);
+ docLine.setQty(line.getMovementQty(), false);
+ docLine.setReversalLine_ID(line.getReversalLine_ID());
+ if (log.isLoggable(Level.FINE)) log.fine(docLine.toString());
+ list.add (docLine);
+ }
+
+ // Return Array
+ DocLine[] dls = new DocLine[list.size()];
+ list.toArray(dls);
+ return dls;
+ } // loadLines
+
+ /**
+ * Get Balance
+ * @return balance (ZERO) - always balanced
+ */
+ public BigDecimal getBalance()
+ {
+ BigDecimal retValue = Env.ZERO;
+ return retValue;
+ } // getBalance
+
+ /**
+ * Create Facts (the accounting logic) for
+ * MMM.
+ *
+ * Movement
+ * Inventory DR CR
+ * InventoryTo DR CR
+ *
+ * @param as account schema
+ * @return Fact
+ */
+ public ArrayList createFacts (MAcctSchema as)
+ {
+ // create Fact Header
+ Fact fact = new Fact(this, as, Fact.POST_Actual);
+ setC_Currency_ID(as.getC_Currency_ID());
+
+ // Line pointers
+ FactLine dr = null;
+ FactLine cr = null;
+
+ for (int i = 0; i < p_lines.length; i++)
+ {
+ DocLine line = p_lines[i];
+ BigDecimal costs = null;
+
+ if (!isReversal(line))
+ {
+ MProduct product = (MProduct) line.getProduct();
+ String costingLevel = product.getCostingLevel(as);
+ if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(costingLevel) )
+ {
+ if (line.getM_AttributeSetInstance_ID() == 0 )
+ {
+ MMovementLine mLine = (MMovementLine) line.getPO();
+ MMovementLineMA mas[] = MMovementLineMA.get(getCtx(), mLine.get_ID(), getTrxName());
+ if (mas != null && mas.length > 0 )
+ {
+ costs = BigDecimal.ZERO;
+ for (int j = 0; j < mas.length; j++)
+ {
+ MMovementLineMA ma = mas[j];
+ BigDecimal QtyMA = ma.getMovementQty();
+ ProductCost pc = line.getProductCost();
+ pc.setQty(QtyMA);
+ pc.setM_M_AttributeSetInstance_ID(ma.getM_AttributeSetInstance_ID());
+ BigDecimal maCosts = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_MovementLine_ID=? AND IsSOTrx='N'");
+
+ costs = costs.add(maCosts);
+ }
+ }
+ }
+ else
+ {
+ costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_MovementLine_ID=? AND IsSOTrx='N'");
+ }
+ }
+ else
+ {
+ // MZ Goodwill
+ // if Inventory Move CostDetail exist then get Cost from Cost Detail
+ costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_MovementLine_ID=? AND IsSOTrx='N'");
+ // end MZ
+ }
+ }
+ else
+ {
+ costs = BigDecimal.ZERO;
+ }
+
+ // ** Inventory DR CR
+ dr = fact.createLine(line,
+ line.getAccount(ProductCost.ACCTTYPE_P_Asset, as),
+ as.getC_Currency_ID(), costs.negate()); // from (-) CR
+ if (dr == null)
+ continue;
+ dr.setM_Locator_ID(line.getM_Locator_ID());
+ dr.setQty(line.getQty().negate()); // outgoing
+ if (isReversal(line))
+ {
+ // Set AmtAcctDr from Original Movement
+ if (!dr.updateReverseLine (MMovement.Table_ID,
+ m_Reversal_ID, line.getReversalLine_ID(),Env.ONE))
+ {
+ p_Error = "Original Inventory Move not posted yet";
+ return null;
+ }
+ }
+
+ // ** InventoryTo DR CR
+ cr = fact.createLine(line,
+ line.getAccount(ProductCost.ACCTTYPE_P_Asset, as),
+ as.getC_Currency_ID(), costs); // to (+) DR
+ if (cr == null)
+ continue;
+ cr.setM_Locator_ID(line.getM_LocatorTo_ID());
+ cr.setQty(line.getQty());
+ if (isReversal(line))
+ {
+ // Set AmtAcctCr from Original Movement
+ if (!cr.updateReverseLine (MMovement.Table_ID,
+ m_Reversal_ID, line.getReversalLine_ID(),Env.ONE))
+ {
+ p_Error = "Original Inventory Move not posted yet";
+ return null;
+ }
+ costs = cr.getAcctBalance(); //get original cost
+ }
+
+ // Only for between-org movements
+ if (dr.getAD_Org_ID() != cr.getAD_Org_ID())
+ {
+ String costingLevel = line.getProduct().getCostingLevel(as);
+ if (!MAcctSchema.COSTINGLEVEL_Organization.equals(costingLevel))
+ continue;
+ //
+ String description = line.getDescription();
+ if (description == null)
+ description = "";
+ // Cost Detail From
+ if (!MCostDetail.createMovement(as, dr.getAD_Org_ID(), // locator org
+ line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
+ line.get_ID(), 0,
+ costs.negate(), line.getQty().negate(), true,
+ description + "(|->)", getTrxName()))
+ {
+ p_Error = "Failed to create cost detail record";
+ return null;
+ }
+ // Cost Detail To
+ if (!MCostDetail.createMovement(as, cr.getAD_Org_ID(), // locator org
+ line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
+ line.get_ID(), 0,
+ costs, line.getQty(), false,
+ description + "(|<-)", getTrxName()))
+ {
+ p_Error = "Failed to create cost detail record";
+ return null;
+ }
+ }
+ }
+
+ //
+ ArrayList facts = new ArrayList();
+ facts.add(fact);
+ return facts;
+ } // createFact
+
+ private boolean isReversal(DocLine line) {
+ return m_Reversal_ID !=0 && line.getReversalLine_ID() != 0;
+ }
+
+} // Doc_Movement
diff --git a/andromeida.midsuit.project/src/andromedia/midsuit/factory/MID_DocFactory.java b/andromeida.midsuit.project/src/andromedia/midsuit/factory/MID_DocFactory.java
index 9b2f8d5..53feb17 100644
--- a/andromeida.midsuit.project/src/andromedia/midsuit/factory/MID_DocFactory.java
+++ b/andromeida.midsuit.project/src/andromedia/midsuit/factory/MID_DocFactory.java
@@ -19,7 +19,9 @@ import andromedia.midsuit.doc.MID_DocDDOrder;
import andromedia.midsuit.doc.MID_DocInvoice;
import andromedia.midsuit.doc.MID_DocMRPPPO;
import andromedia.midsuit.doc.MID_DocMidRequsiition;
+import andromedia.midsuit.doc.MID_DocMovement;
import andromedia.midsuit.model.MID_Analysis;
+import andromedia.midsuit.model.MID_MMovement;
import andromedia.midsuit.model.MID_MRequisitionTrx;
import andromedia.midsuit.model.MID_PPO;
@@ -69,7 +71,8 @@ public class MID_DocFactory implements IDocFactory{
}
if(tableName.equals(MDDOrder.Table_Name))
return new MID_DocDDOrder(as, rs, trxName);
-
+ if(tableName.equals(MID_MMovement.Table_Name))
+ return new MID_DocMovement(as, rs, trxName);
return null;
}
diff --git a/andromeida.midsuit.project/src/andromedia/midsuit/factory/MID_ModelFactory.java b/andromeida.midsuit.project/src/andromedia/midsuit/factory/MID_ModelFactory.java
index 25e2fe3..5d49969 100644
--- a/andromeida.midsuit.project/src/andromedia/midsuit/factory/MID_ModelFactory.java
+++ b/andromeida.midsuit.project/src/andromedia/midsuit/factory/MID_ModelFactory.java
@@ -7,6 +7,7 @@ import java.util.Properties;
import org.adempiere.base.IModelFactory;
import org.compiere.model.MMovement;
+import org.compiere.model.MMovementLine;
import org.compiere.model.PO;
import org.compiere.util.Env;
@@ -69,6 +70,7 @@ public class MID_ModelFactory implements IModelFactory{
mapTableModels.put(MID_UnrealizedRateLine.Table_Name, "andromedia.midsuit.model.MID_UnrealizedRateLine");
mapTableModels.put(MID_MOrder.Table_Name, "andromedia.midsuit.model.MID_MOrder");
mapTableModels.put(MMovement.Table_Name, "andromedia.midsuit.model.MID_MMovement");
+ mapTableModels.put(MMovementLine.Table_Name, "andromedia.midsuit.model.MID_MMovementLine");
mapTableModels.put(X_MID_UploadPEBLine.Table_Name, "andromedia.midsuit.model.X_MID_UploadPEBLine");
mapTableModels.put(X_MID_UploadPEB.Table_Name, "andromedia.midsuit.model.X_MID_UploadPEB");
mapTableModels.put(X_MID_UploadTPB.Table_Name, "andromedia.midsuit.model.X_MID_UploadTPB");
diff --git a/andromeida.midsuit.project/src/andromedia/midsuit/model/MID_MMovement.java b/andromeida.midsuit.project/src/andromedia/midsuit/model/MID_MMovement.java
index 5c256db..d529ff4 100644
--- a/andromeida.midsuit.project/src/andromedia/midsuit/model/MID_MMovement.java
+++ b/andromeida.midsuit.project/src/andromedia/midsuit/model/MID_MMovement.java
@@ -5,6 +5,7 @@ import java.util.Properties;
import org.compiere.model.MMovement;
import org.compiere.model.X_M_Movement;
+import org.compiere.process.DocAction;
import org.compiere.util.DB;
public class MID_MMovement extends MMovement{
@@ -22,7 +23,26 @@ public class MID_MMovement extends MMovement{
super(ctx, rs, trxName);
// TODO Auto-generated constructor stub
}
-
+ @Override
+ public String prepareIt() {
+ if(get_ValueAsBoolean("IsAsset")) {
+ setDocAction(DOCACTION_Complete);
+ return DocAction.STATUS_InProgress;
+ }
+
+ return super.prepareIt();
+ }
+ @Override
+ public String completeIt() {
+ if(get_ValueAsBoolean("IsAsset")) {
+ setProcessed(true);
+ setDocAction(DOCACTION_Close);
+ return DocAction.STATUS_Completed;
+ }
+ return super.completeIt();
+ }
+
+
@Override
protected boolean beforeSave(boolean newRecord) {
if(!newRecord)
diff --git a/andromeida.midsuit.project/src/andromedia/midsuit/model/MID_MMovementLine.java b/andromeida.midsuit.project/src/andromedia/midsuit/model/MID_MMovementLine.java
new file mode 100644
index 0000000..ea0ab5d
--- /dev/null
+++ b/andromeida.midsuit.project/src/andromedia/midsuit/model/MID_MMovementLine.java
@@ -0,0 +1,46 @@
+package andromedia.midsuit.model;
+
+import java.math.BigDecimal;
+import java.sql.ResultSet;
+import java.util.Properties;
+
+import org.compiere.model.MMovement;
+import org.compiere.model.MMovementLine;
+import org.compiere.util.DB;
+
+public class MID_MMovementLine extends MMovementLine{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1884915669018246342L;
+ public MID_MMovementLine(MMovement parent) {
+ super(parent);
+ // TODO Auto-generated constructor stub
+ }
+ public MID_MMovementLine(Properties ctx, int M_MovementLine_ID, String trxName) {
+ super(ctx, M_MovementLine_ID, trxName);
+ // TODO Auto-generated constructor stub
+ }
+ public MID_MMovementLine(Properties ctx, ResultSet rs, String trxName) {
+ super(ctx, rs, trxName);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ protected boolean afterSave(boolean newRecord, boolean success) {
+ if(success) {
+ BigDecimal totalLines = DB.getSQLValueBD(get_TrxName(), "SELECT COALESCE(SUM(Price),0) FROM M_MovementLine WHERE M_Movement_ID =?", new Object[] { getM_Movement_ID() });
+ int no = DB.executeUpdateEx("UPDATE M_Movement SET TotalLines =? WHERE M_Movement_ID =?", new Object[] { totalLines, getM_Movement_ID()},get_TrxName());
+ }
+ return super.afterSave(newRecord, success);
+ }
+ @Override
+ protected boolean afterDelete(boolean success) {
+ if(success) {
+ BigDecimal totalLines = DB.getSQLValueBD(get_TrxName(), "SELECT COALESCE(SUM(Price),0) FROM M_MovementLine WHERE M_Movement_ID =?", new Object[] { getM_Movement_ID() });
+ int no = DB.executeUpdateEx("UPDATE M_Movement SET TotalLines =? WHERE M_Movement_ID =?", new Object[] { totalLines, getM_Movement_ID()},get_TrxName());
+ }
+ return super.afterDelete(success);
+ }
+}
diff --git a/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_TPBUpdateOrder.java b/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_TPBUpdateOrder.java
index abda897..b151a0e 100644
--- a/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_TPBUpdateOrder.java
+++ b/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_TPBUpdateOrder.java
@@ -43,9 +43,11 @@ public class MID_TPBUpdateOrder extends SvrProcess{
if(line.getM_Requisition_ID()>0 && !isRetur) {
MOrder order = createPurchaseOrder(line);
createPurchaseOrderLine(line, order);
+ line.setC_Order_ID(order.get_ID());
}else if (line.getM_RMA_ID()>0 && isRetur) {
MRMA RMA = createCustomerRMA(line);
createCustomerRMALine(line, RMA);
+ line.setM_RMA_ID(RMA.get_ID());
}else {
continue;
}
@@ -112,8 +114,11 @@ public class MID_TPBUpdateOrder extends SvrProcess{
retValue.setC_BPartner_Location_ID(line.getC_BPartner_Location_ID());
retValue.setC_Currency_ID(line.getC_Currency_ID());
retValue.setSalesRep_ID(line.getSalesRep_ID());
+ retValue.setPOReference(line.getM_Requisition().getDocumentNo());
+ retValue.set_ValueNoCheck("M_Requisition_ID", line.getM_Requisition_ID());
retValue.setM_Warehouse_ID(line.getM_Warehouse_ID());
retValue.setC_DocTypeTarget_ID(line.getC_DocTypeTarget_ID());
+ retValue.setIsSOTrx(false);
retValue.setM_PriceList_ID(line.getM_PriceList_ID());
retValue.saveEx();
String message = Msg.parseTranslation(getCtx(), "@PurchaseOrderCreated@ " + retValue.getDocumentNo());
diff --git a/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_TPBUpdateOrderLine.java b/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_TPBUpdateOrderLine.java
index d21d493..82c04bf 100644
--- a/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_TPBUpdateOrderLine.java
+++ b/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_TPBUpdateOrderLine.java
@@ -36,9 +36,11 @@ public class MID_TPBUpdateOrderLine extends SvrProcess{
if(tpbLine.getM_Requisition_ID()>0 && !isRetur) {
MOrder order = createPurchaseOrder(tpbLine);
createPurchaseOrderLine(tpbLine, order);
+ tpbLine.setC_Order_ID(order.get_ID());
}else if (tpbLine.getM_RMA_ID()>0 && isRetur) {
MRMA RMA = createCustomerRMA(tpbLine);
createCustomerRMALine(tpbLine, RMA);
+ tpbLine.setM_RMA_ID(RMA.get_ID());
}else {
throw new AdempiereException("Requisition / RMA Wajib diisi !!!");
}
@@ -101,12 +103,15 @@ public class MID_TPBUpdateOrderLine extends SvrProcess{
retValue.set_ValueNoCheck("RegisterDate", line.getRegisterDate());
retValue.set_ValueNoCheck("RegisterNo", line.getRegisterNo());
retValue.set_ValueNoCheck("MID_AJUDocumentType_ID", line.getMID_AJUDocumentType_ID());
+ retValue.setPOReference(line.getM_Requisition().getDocumentNo());
retValue.setC_BPartner_ID(line.getC_BPartner_ID());
retValue.setC_BPartner_Location_ID(line.getC_BPartner_Location_ID());
+ retValue.set_ValueNoCheck("M_Requisition_ID", line.getM_Requisition_ID());
retValue.setC_Currency_ID(line.getC_Currency_ID());
retValue.setSalesRep_ID(line.getSalesRep_ID());
retValue.setM_Warehouse_ID(line.getM_Warehouse_ID());
retValue.setC_DocTypeTarget_ID(line.getC_DocTypeTarget_ID());
+ retValue.setIsSOTrx(false);
retValue.setM_PriceList_ID(line.getM_PriceList_ID());
retValue.saveEx();
String message = Msg.parseTranslation(getCtx(), "@PurchaseOrderCreated@ " + retValue.getDocumentNo());
diff --git a/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_UploadTPB.java b/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_UploadTPB.java
index 4069721..8467801 100644
--- a/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_UploadTPB.java
+++ b/andromeida.midsuit.project/src/andromedia/midsuit/process/MID_UploadTPB.java
@@ -61,7 +61,11 @@ public class MID_UploadTPB extends SvrProcess{
X_MID_UploadTPBLine line = createTPBDocumentLine(row);
- Sheet Barang = workbook.getSheet("Barang");
+ Sheet Barang = null;
+ if(AJU_DocType_Value.equals("27a") || AJU_DocType_Value.equals("27b"))
+ Barang = workbook.getSheet("BahanBaku");
+ else
+ Barang = workbook.getSheet("Barang");
Iterator rowsBarang = Barang.rowIterator();
int rowBarangNum = 0;
while(rowsBarang.hasNext()){
@@ -126,6 +130,9 @@ public class MID_UploadTPB extends SvrProcess{
if(C_Currency_ID <=0)
throw new AdempiereException("Currency Not Found "+dataRow.getCell(88).getStringCellValue()+" !!!");
tpbLine.setC_BPartner_ID(C_BPartner_ID);
+ if(MBPartnerLocation.getForBPartner(getCtx(), C_BPartner_ID, get_TrxName())[0].getC_BPartner_Location_ID()==0) {
+ throw new AdempiereException("No Location for this Business Partner !!!");
+ }
tpbLine.setC_BPartner_Location_ID(MBPartnerLocation.getForBPartner(getCtx(), C_BPartner_ID, get_TrxName())[0].getC_BPartner_Location_ID());
tpbLine.setC_DocTypeTarget_ID(p_C_DocType_ID);
tpbLine.setSalesRep_ID(30178);
@@ -150,7 +157,7 @@ public class MID_UploadTPB extends SvrProcess{
BigDecimal PriceList = Env.ZERO;
BigDecimal Discount = Env.ZERO;
BigDecimal PriceActual = Env.ZERO;
- if(AJU_DocType_Value.equals("23") || AJU_DocType_Value.equals("40")){
+ if(AJU_DocType_Value.equals("23") || AJU_DocType_Value.equals("40") || AJU_DocType_Value.equals("262")){
M_Product_ID = DB.getSQLValue(get_TrxName(), "SELECT M_Product_ID FROM M_Product WHERE Value =?", new Object[] { rowBarang.getCell(20).getStringCellValue() });
C_UOM_ID = DB.getSQLValue(get_TrxName(), " SELECT C_UOM_ID FROM C_UOM WHERE UOMSymbol =?", new Object[] { rowBarang.getCell(27).getStringCellValue()});
@@ -171,19 +178,28 @@ public class MID_UploadTPB extends SvrProcess{
}
- if(AJU_DocType_Value.equals("23")){
+ if(AJU_DocType_Value.equals("23") || AJU_DocType_Value.equals("262")){
Qty = new BigDecimal(rowBarang.getCell(16).getStringCellValue());
PriceList = new BigDecimal(rowBarang.getCell(12).getStringCellValue());
- Discount = new BigDecimal(rowBarang.getCell(5).getStringCellValue());
+ try {
+ Discount = new BigDecimal(rowBarang.getCell(5).getStringCellValue());
+
+ }catch (Exception e) {
+ Discount = Env.ZERO;
+ }
PriceActual = PriceList.subtract(Discount.divide(Env.ONEHUNDRED, 2,BigDecimal.ROUND_DOWN).multiply(PriceList));
}else if (AJU_DocType_Value.equals("40")){
Qty = new BigDecimal(rowBarang.getCell(32).getStringCellValue());
- PriceList = new BigDecimal(rowBarang.getCell(29).getStringCellValue());
+ PriceList = new BigDecimal(rowBarang.getCell(11).getStringCellValue());
+ PriceList = PriceList.divide(Qty,2,BigDecimal.ROUND_DOWN);
PriceActual = PriceList;
}else{
Qty = new BigDecimal(rowBarang.getCell(8).getStringCellValue());
- PriceList = new BigDecimal(rowBarang.getCell(12).getStringCellValue());
PriceActual = new BigDecimal(rowBarang.getCell(5).getStringCellValue());
+ if(AJU_DocType_Value.equals("27"))
+ PriceList = new BigDecimal(rowBarang.getCell(12).getStringCellValue());
+ else
+ PriceList = PriceActual;
}
if(AJU_DocType_Value.equals("27")){
diff --git a/andromeida.midsuit.project/src/andromedia/midsuit/validator/MID_InOutValidator.java b/andromeida.midsuit.project/src/andromedia/midsuit/validator/MID_InOutValidator.java
index a24512e..ac38ebd 100644
--- a/andromeida.midsuit.project/src/andromedia/midsuit/validator/MID_InOutValidator.java
+++ b/andromeida.midsuit.project/src/andromedia/midsuit/validator/MID_InOutValidator.java
@@ -27,6 +27,8 @@ public class MID_InOutValidator {
return "";
}
private static String beforePrepare(MInOut inOut) {
+ if(inOut.getMovementType().equals(MInOut.MOVEMENTTYPE_VendorReturns) || inOut.getMovementType().equals(MInOut.MOVEMENTTYPE_CustomerReturns))
+ return "";
for(MInOutLine line : inOut.getLines()) {
int countAttLines = new Query(inOut.getCtx(), X_M_InOutLineMA.Table_Name, "M_InOutLine_ID =?", inOut.get_TrxName())
.setParameters(new Object[] { line.getM_InOutLine_ID() })