parent
dcec97c057
commit
dcceecae85
|
|
@ -0,0 +1,61 @@
|
|||
package andromedia.midsuit.model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.model.MRequisition;
|
||||
import org.compiere.process.DocAction;
|
||||
import org.compiere.process.DocOptions;
|
||||
|
||||
public class MID_MRequisition extends MRequisition implements DocOptions{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3588447351218719946L;
|
||||
public MID_MRequisition(Properties ctx, int M_Requisition_ID, String trxName) {
|
||||
super(ctx, M_Requisition_ID, trxName);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public MID_MRequisition(Properties ctx, ResultSet rs, String trxName) {
|
||||
super(ctx, rs, trxName);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reActivateIt() {
|
||||
setDocStatus(DocAction.STATUS_InProgress);
|
||||
setDocAction(DocAction.ACTION_Complete);
|
||||
setProcessed(false);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public int customizeValidActions(String docStatus, Object processing, String orderType, String isSOTrx,
|
||||
int AD_Table_ID, String[] docAction, String[] options, int index) {
|
||||
for (int i = 0; i < options.length; i++) {
|
||||
options[i] = null;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
|
||||
if (docStatus.equals(DocAction.STATUS_Drafted)) {
|
||||
options[index++] = DocAction.ACTION_Complete;
|
||||
options[index++] = DocAction.ACTION_Void;
|
||||
} else if (docStatus.equals(DocAction.STATUS_InProgress)) {
|
||||
options[index++] = DocAction.ACTION_Complete;
|
||||
options[index++] = DocAction.ACTION_Void;
|
||||
} else if (docStatus.equals(DocAction.STATUS_Completed)) {
|
||||
options[index++] = DocAction.ACTION_Close;
|
||||
options[index++] = DocAction.ACTION_ReActivate;
|
||||
options[index++] = DocAction.ACTION_Void;
|
||||
} else if (docStatus.equals(DocAction.STATUS_Invalid)) {
|
||||
options[index++] = DocAction.ACTION_Complete;
|
||||
options[index++] = DocAction.ACTION_Void;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
//package andromedia.midsuit.process;
|
||||
//
|
||||
//import java.io.File;
|
||||
//import java.io.IOException;
|
||||
//import net.ucanaccess.jdbc.JackcessOpenerInterface;
|
||||
//import com.healthmarketscience.jackcess.CryptCodecProvider;
|
||||
//import com.healthmarketscience.jackcess.Database;
|
||||
//import com.healthmarketscience.jackcess.DatabaseBuilder;
|
||||
//
|
||||
//public class CryptCodecOpener implements JackcessOpenerInterface {
|
||||
// @Override
|
||||
// public Database open(File fl,String pwd) throws IOException {
|
||||
// DatabaseBuilder dbd =new DatabaseBuilder(fl);
|
||||
// dbd.setAutoSync(false);
|
||||
// dbd.setCodecProvider(new CryptCodecProvider(pwd));
|
||||
// dbd.setReadOnly(false);
|
||||
// return dbd.open();
|
||||
// }
|
||||
// //Notice that the parameter setting autosync =true is recommended with UCanAccess for performance reasons.
|
||||
// //UCanAccess flushes the updates to disk at transaction end.
|
||||
// //For more details about autosync parameter (and related tradeoff), see the Jackcess documentation.
|
||||
//}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package andromedia.midsuit.process;
|
||||
|
||||
import org.compiere.model.MJournal;
|
||||
import org.compiere.process.SvrProcess;
|
||||
|
||||
public class MID_JournalTest extends SvrProcess{
|
||||
MJournal journal = null;
|
||||
@Override
|
||||
protected void prepare() {
|
||||
journal = new MJournal(getCtx(), getRecord_ID(), get_TrxName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doIt() throws Exception {
|
||||
Double rand = Math.random();
|
||||
|
||||
journal.setDescription(rand.toString());
|
||||
journal.saveEx();
|
||||
return "Transaction Success !!! Andromedia.Midsuit.Project";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
//package andromedia.midsuit.process;
|
||||
//
|
||||
//import java.io.File;
|
||||
//import java.sql.Connection;
|
||||
//import java.sql.DriverManager;
|
||||
//import java.sql.PreparedStatement;
|
||||
//import java.sql.ResultSet;
|
||||
//import java.sql.SQLException;
|
||||
//import java.sql.Statement;
|
||||
//
|
||||
//import org.compiere.process.ProcessInfoParameter;
|
||||
//import org.compiere.process.SvrProcess;
|
||||
//
|
||||
//import net.ucanaccess.jdbc.UcanaccessDriver;
|
||||
//
|
||||
//public class MID_UploadPEB extends SvrProcess{
|
||||
//
|
||||
// String p_File = "";
|
||||
// @Override
|
||||
// protected void prepare() {
|
||||
// // TODO Auto-generated method stub
|
||||
// ProcessInfoParameter[] para = getParameter();
|
||||
// for (int i = 0; i < para.length; i++)
|
||||
// {
|
||||
// if(para[i].getParameterName().equals("FileName"))
|
||||
// p_File = para[i].getParameterAsString();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected String doIt() throws Exception {
|
||||
// File TPB = new File(p_File);
|
||||
// Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
|
||||
// UcanaccessDriver driver = new UcanaccessDriver();
|
||||
// String databaseURL = "jdbc:ucanaccess://"+TPB.getPath()+";jackcessOpener=andromedia.midsuit.process.CryptCodecOpener";
|
||||
// try (Connection connection = DriverManager.getConnection(databaseURL)) {
|
||||
//
|
||||
// String sql = "SELECT CAR FROM tblResPebUr";
|
||||
//
|
||||
// Statement statement = connection.createStatement();
|
||||
// ResultSet result = statement.executeQuery(sql);
|
||||
//
|
||||
// while (result.next()) {
|
||||
// String id = result.getString(1);
|
||||
// System.out.println(id);
|
||||
// }
|
||||
//
|
||||
// } catch (SQLException ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// return "";
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
//package andromedia.midsuit.process;
|
||||
//
|
||||
//import java.io.File;
|
||||
//
|
||||
//import org.apache.poi.hssf.model.WorkbookRecordList;
|
||||
//import org.apache.poi.ss.usermodel.*;
|
||||
//import org.compiere.process.ProcessInfoParameter;
|
||||
//import org.compiere.process.SvrProcess;
|
||||
//
|
||||
//public class MID_UploadTPB extends SvrProcess{
|
||||
//
|
||||
// String p_File = "";
|
||||
// @Override
|
||||
// protected void prepare() {
|
||||
// // TODO Auto-generated method stub
|
||||
// ProcessInfoParameter[] para = getParameter();
|
||||
// for (int i = 0; i < para.length; i++)
|
||||
// {
|
||||
// if(para[i].getParameterName().equals("FileName"))
|
||||
// p_File = para[i].getParameterAsString();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected String doIt() throws Exception {
|
||||
// File TPB = new File(p_File);
|
||||
// Workbook workbook = WorkbookFactory.create(TPB);
|
||||
// return String.valueOf(workbook.getNumberOfSheets());
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package andromedia.midsuit.validator;
|
||||
|
||||
import org.adempiere.base.event.IEventTopics;
|
||||
import org.compiere.model.MAsset;
|
||||
import org.compiere.model.MDepreciationWorkfile;
|
||||
import org.compiere.model.PO;
|
||||
import org.osgi.service.event.Event;
|
||||
|
||||
public class MID_DeprWorkfileValidator {
|
||||
public static String executeEvent(Event e, PO po) {
|
||||
MDepreciationWorkfile wk = (MDepreciationWorkfile) po;
|
||||
if(e.getTopic().equals(IEventTopics.PO_AFTER_CHANGE))
|
||||
return afterChange(wk);
|
||||
return "";
|
||||
}
|
||||
private static String afterChange(MDepreciationWorkfile wk) {
|
||||
if(wk.getA_Current_Period()>wk.getUseLifeMonths()) {
|
||||
MAsset asset = wk.getAsset();
|
||||
asset.setIsDepreciated(true);
|
||||
asset.setIsFullyDepreciated(true);
|
||||
asset.setA_Asset_Status(MAsset.A_ASSET_STATUS_Depreciated);
|
||||
asset.saveEx();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package edii.midsuit.process;
|
||||
|
||||
import org.compiere.model.MJournal;
|
||||
import org.compiere.process.SvrProcess;
|
||||
|
||||
public class MID_JournalTest extends SvrProcess{
|
||||
MJournal journal = null;
|
||||
@Override
|
||||
protected void prepare() {
|
||||
journal = new MJournal(getCtx(), getRecord_ID(), get_TrxName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doIt() throws Exception {
|
||||
Double rand = Math.random();
|
||||
|
||||
journal.setDescription(rand.toString());
|
||||
journal.saveEx();
|
||||
return "Transaction Success !!! Edii.Midsuit.Project";
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue