forked from Systemhaus-Westfalia/LSV
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7439f6b
commit 0d4d2c8
Showing
6 changed files
with
213 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/****************************************************************************** | ||
* Product: ADempiere ERP & CRM Smart Business Solution * | ||
* Copyright (C) 2006-2017 ADempiere Foundation, 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 * | ||
* or (at your option) any later version. * | ||
* 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 * | ||
* or via [email protected] * | ||
* or https://github.com/adempiere/adempiere/blob/develop/license.html * | ||
*****************************************************************************/ | ||
|
||
package org.shw.process; | ||
|
||
import java.sql.Timestamp; | ||
import java.util.List; | ||
|
||
import org.compiere.model.MBPartner; | ||
import org.compiere.model.MDocType; | ||
import org.compiere.model.MOrder; | ||
import org.compiere.model.MProject; | ||
import org.compiere.model.MUser; | ||
|
||
/** Generated Process for (C_Project_GenerateOrder_POSO) | ||
* @author ADempiere (generated) | ||
* @version Release 3.9.4 | ||
*/ | ||
public class Project_CreateOrder extends Project_CreateOrderAbstract | ||
{ | ||
@Override | ||
protected void prepare() | ||
{ | ||
super.prepare(); | ||
} | ||
|
||
@Override | ||
protected String doIt() throws Exception | ||
{ | ||
String Docbasetype = isSOTrx()?"SOO":"POO"; | ||
MProject project = new MProject(getCtx(), getRecord_ID(), get_TrxName()); | ||
{ | ||
|
||
|
||
MOrder order = new MOrder(getCtx(), 0, get_TrxName()); | ||
order.setAD_Org_ID(project.getAD_Org_ID()); | ||
order.setC_Campaign_ID(project.getC_Campaign_ID()); | ||
//order. | ||
order.setC_Project_ID(project.getC_Project_ID()); | ||
order.setDescription(project.getName()); | ||
Timestamp ts = project.getDateStart(); | ||
if (ts != null) | ||
order.setDateOrdered (ts); | ||
ts = project.getDateFinish(); | ||
if (ts != null) | ||
order.setDatePromised (ts); | ||
// | ||
MBPartner bpartner = null; | ||
if (isSOTrx()) | ||
{ | ||
order.setC_BPartner_ID(project.getC_BPartner_ID()); | ||
bpartner = (MBPartner)project.getC_BPartner(); | ||
order.setAD_User_ID(project.getAD_User_ID()); | ||
order.setSalesRep_ID(project.getSalesRep_ID()); | ||
int c_DocType_ID = bpartner.get_ValueAsInt("C_DocType_ID")<=0? MDocType.getDocType(Docbasetype): | ||
bpartner.get_ValueAsInt("C_DocType_ID"); | ||
order.setC_DocTypeTarget_ID(c_DocType_ID); | ||
order.setM_PriceList_ID(bpartner.getM_PriceList_ID()); | ||
order.setC_PaymentTerm_ID(bpartner.getC_PaymentTerm_ID()); | ||
order.setIsSOTrx(true); | ||
} | ||
else | ||
{ | ||
order.setC_BPartner_ID(getBPartnerId()); | ||
bpartner = new MBPartner(getCtx(), order.getC_BPartner_ID(), get_TrxName()); | ||
MUser[] contacts = bpartner.getContacts(true); | ||
if (contacts.length>0) | ||
order.setAD_User_ID(contacts[0].getAD_User_ID()); | ||
order.setSalesRep_ID(project.getSalesRep_ID()); | ||
int c_DocType_ID = 0; | ||
if (getDocTypeId() ==0) | ||
c_DocType_ID = bpartner.get_ValueAsInt("C_DoctypePO_ID")<=0? MDocType.getDocType(Docbasetype): | ||
bpartner.get_ValueAsInt("C_DoctypePO_ID"); | ||
else c_DocType_ID = getDocTypeId(); | ||
order.setC_DocTypeTarget_ID(c_DocType_ID); | ||
order.setM_PriceList_ID(bpartner.getPO_PriceList_ID()); | ||
order.setC_PaymentTerm_ID(bpartner.getPO_PaymentTerm_ID()); | ||
order.setIsSOTrx(false); | ||
} | ||
order.setC_BPartner_Location_ID(bpartner.getPrimaryC_BPartner_Location_ID()); // | ||
order.setM_Warehouse_ID(project.getM_Warehouse_ID()); | ||
order.saveEx(); | ||
} | ||
|
||
return ""; | ||
} | ||
|
||
} |
98 changes: 98 additions & 0 deletions
98
src/main/java/org/shw/process/Project_CreateOrderAbstract.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/****************************************************************************** | ||
* Product: ADempiere ERP & CRM Smart Business Solution * | ||
* Copyright (C) 2006-2017 ADempiere Foundation, 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 * | ||
* or (at your option) any later version. * | ||
* 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 * | ||
* or via [email protected] * | ||
* or https://github.com/adempiere/adempiere/blob/develop/license.html * | ||
*****************************************************************************/ | ||
|
||
package org.shw.process; | ||
|
||
import org.compiere.process.SvrProcess; | ||
|
||
/** Generated Process for (C_Project_GenerateOrder_POSO) | ||
* @author ADempiere (generated) | ||
* @version Release 3.9.4 | ||
*/ | ||
public abstract class Project_CreateOrderAbstract extends SvrProcess { | ||
/** Process Value */ | ||
private static final String VALUE_FOR_PROCESS = "C_Project_GenerateOrder_POSO"; | ||
/** Process Name */ | ||
private static final String NAME_FOR_PROCESS = "C_Project_GenerateOrder_POSO"; | ||
/** Process Id */ | ||
private static final int ID_FOR_PROCESS = 54639; | ||
/** Parameter Name for Sales Transaction */ | ||
public static final String ISSOTRX = "IsSOTrx"; | ||
/** Parameter Name for Business Partner */ | ||
public static final String C_BPARTNER_ID = "C_BPartner_ID"; | ||
/** Parameter Name for Document Type */ | ||
public static final String C_DOCTYPE_ID = "C_DocType_ID"; | ||
/** Parameter Value for Sales Transaction */ | ||
private boolean isSOTrx; | ||
/** Parameter Value for Business Partner */ | ||
private int bPartnerId; | ||
/** Parameter Value for Document Type */ | ||
private int docTypeId; | ||
|
||
@Override | ||
protected void prepare() { | ||
isSOTrx = getParameterAsBoolean(ISSOTRX); | ||
bPartnerId = getParameterAsInt(C_BPARTNER_ID); | ||
docTypeId = getParameterAsInt(C_DOCTYPE_ID); | ||
} | ||
|
||
/** Getter Parameter Value for Sales Transaction */ | ||
protected boolean isSOTrx() { | ||
return isSOTrx; | ||
} | ||
|
||
/** Setter Parameter Value for Sales Transaction */ | ||
protected void setIsSOTrx(boolean isSOTrx) { | ||
this.isSOTrx = isSOTrx; | ||
} | ||
|
||
/** Getter Parameter Value for Business Partner */ | ||
protected int getBPartnerId() { | ||
return bPartnerId; | ||
} | ||
|
||
/** Setter Parameter Value for Business Partner */ | ||
protected void setBPartnerId(int bPartnerId) { | ||
this.bPartnerId = bPartnerId; | ||
} | ||
|
||
/** Getter Parameter Value for Document Type */ | ||
protected int getDocTypeId() { | ||
return docTypeId; | ||
} | ||
|
||
/** Setter Parameter Value for Document Type */ | ||
protected void setDocTypeId(int docTypeId) { | ||
this.docTypeId = docTypeId; | ||
} | ||
|
||
/** Getter Parameter Value for Process ID */ | ||
public static final int getProcessId() { | ||
return ID_FOR_PROCESS; | ||
} | ||
|
||
/** Getter Parameter Value for Process Value */ | ||
public static final String getProcessValue() { | ||
return VALUE_FOR_PROCESS; | ||
} | ||
|
||
/** Getter Parameter Value for Process Name */ | ||
public static final String getProcessName() { | ||
return NAME_FOR_PROCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters