📄 info.java
字号:
+ "WHERE IsSelfService='Y' AND AD_Client_ID=? ORDER BY Name";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, getAD_Client_ID());
ResultSet rs = pstmt.executeQuery();
while (rs.next())
list.add (new MRequestType (m_ctx, rs, null));
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql, e);
}
finally
{
try
{
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
}
log.fine("#" + list.size());
return list;
} // getRequestTypes
/**
* Get Request Type
* @return Request Type
*/
public MRequestType getRequestType ()
{
m_infoMessage = null;
MRequestType retValue = null;
String sql = "SELECT * FROM R_RequestType WHERE IsSelfService='Y' AND R_RequestType_ID=?";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, m_id);
ResultSet rs = pstmt.executeQuery();
if (rs.next())
retValue = new MRequestType (m_ctx, rs, null);
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql, e);
}
finally
{
try
{
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
}
log.fine("R_RequestType_ID=" + m_id + " - " + retValue);
return retValue;
} // getRequestType
/**
* Get Invoices
* @return invoices of BP
*/
public ArrayList<MInvoice> getInvoices()
{
m_infoMessage = null;
ArrayList<MInvoice> list = new ArrayList<MInvoice>();
if (m_wu != null &&
!m_wu.hasBPAccess(X_AD_UserBPAccess.BPACCESSTYPE_BusinessDocuments,
new Object[] {MDocType.DOCBASETYPE_APInvoice, MDocType.DOCBASETYPE_APCreditMemo,
MDocType.DOCBASETYPE_ARInvoice, MDocType.DOCBASETYPE_ARCreditMemo}))
{
log.info("No Access");
return list;
}
String sql = "SELECT * FROM C_Invoice WHERE C_BPartner_ID=?"
+ " AND DocStatus NOT IN ('DR','IN') "
+ "ORDER BY DocumentNo DESC";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, getC_BPartner_ID());
ResultSet rs = pstmt.executeQuery();
while (rs.next())
list.add(new MInvoice (m_ctx, rs, null));
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql, e);
}
finally
{
try
{
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
}
log.fine("#" + list.size());
return list;
} // getInvoices
/**
* Get Invoice.
* Needs to have ID set first
* @return invoice with ID of BP
*/
public MInvoice getInvoice()
{
m_infoMessage = null;
MInvoice retValue = null;
if (m_wu != null &&
!m_wu.hasBPAccess(X_AD_UserBPAccess.BPACCESSTYPE_BusinessDocuments,
new Object[] {MDocType.DOCBASETYPE_APInvoice, MDocType.DOCBASETYPE_APCreditMemo,
MDocType.DOCBASETYPE_ARInvoice, MDocType.DOCBASETYPE_ARCreditMemo}))
{
log.info("No Access");
return null;
}
String sql = "SELECT * FROM C_Invoice WHERE C_BPartner_ID=? AND C_Invoice_ID=?";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, getC_BPartner_ID());
pstmt.setInt(2, m_id);
ResultSet rs = pstmt.executeQuery();
if (rs.next())
retValue = new MInvoice (m_ctx, rs, null);
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, "C_Invoice_ID=" + m_id, e);
}
finally
{
try
{
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
}
log.fine("C_Invoice_ID=" + m_id + " - " + retValue);
return retValue;
} // getInvoice
/**
* Get Payments
* @return payments of BP
*/
public ArrayList<MPayment> getPayments()
{
m_infoMessage = null;
ArrayList<MPayment> list = new ArrayList<MPayment>();
if (m_wu != null &&
!m_wu.hasBPAccess(X_AD_UserBPAccess.BPACCESSTYPE_BusinessDocuments,
new Object[] {MDocType.DOCBASETYPE_APPayment, MDocType.DOCBASETYPE_ARReceipt}))
{
log.info("No Access");
return list;
}
String sql = "SELECT * FROM C_Payment WHERE C_BPartner_ID=?"
+ " AND DocStatus NOT IN ('DR','IN') "
+ "ORDER BY DocumentNo DESC";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, getC_BPartner_ID());
ResultSet rs = pstmt.executeQuery();
while (rs.next())
list.add(new MPayment (m_ctx, rs, null));
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql, e);
}
finally
{
try
{
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
}
log.fine("#" + list.size());
return list;
} // getPayments
/**
* Get Active Assets if not Credit Stop and EMail is verified
* @return payments of BP
*/
public ArrayList<MAsset> getAssets()
{
m_infoMessage = null;
ArrayList<MAsset> list = new ArrayList<MAsset>();
if (m_wu != null)
{
if (m_wu.isCreditStopHold())
return list;
if (!m_wu.isEMailVerified())
return list;
}
if (m_wu != null &&
!m_wu.hasBPAccess(X_AD_UserBPAccess.BPACCESSTYPE_AssetsDownload, null))
{
log.info("No Access");
return list;
}
String sql = "SELECT * FROM A_Asset WHERE C_BPartner_ID=? AND IsActive='Y' ORDER BY Name";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, getC_BPartner_ID());
ResultSet rs = pstmt.executeQuery();
while (rs.next())
list.add(new MAsset (m_ctx, rs, null));
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql, e);
}
finally
{
try
{
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
}
log.fine("#" + list.size());
return list;
} // getAssets
/**
* Get Interest Areas
* @return interest areas of BPC
*/
public ArrayList<MInterestArea> getInterests()
{
m_infoMessage = null;
int AD_Client_ID = Env.getAD_Client_ID(m_ctx);
//
ArrayList<MInterestArea> list = new ArrayList<MInterestArea>();
String sql = "SELECT * FROM R_InterestArea "
+ "WHERE IsActive='Y' AND IsSelfService='Y'"
+ " AND AD_Client_ID=? "
+ "ORDER BY Name";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, AD_Client_ID);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
MInterestArea ia = new MInterestArea (m_ctx, rs, null);
ia.setSubscriptionInfo(getAD_User_ID());
list.add (ia);
}
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql, e);
}
finally
{
try
{
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
}
log.fine("#" + list.size());
return list;
} // getInterests
/**
* Get Advertisements
* @return advertisements of BP
*/
public ArrayList<MAdvertisement> getAdvertisements()
{
m_infoMessage = null;
ArrayList<MAdvertisement> list = new ArrayList<MAdvertisement>();
String sql = "SELECT * FROM W_Advertisement WHERE C_BPartner_ID=? ORDER BY ValidFrom DESC";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, getC_BPartner_ID());
ResultSet rs = pstmt.executeQuery();
while (rs.next())
list.add(new MAdvertisement (m_ctx, rs, null));
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql, e);
}
finally
{
try
{
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
}
log.fine("#" + list.size());
return list;
} // getAdvertisement
/**
* Get All Advertisements
* @return all advertisements
*/
public ArrayList<MAdvertisement> getAllAds()
{
m_infoMessage = null;
ArrayList<MAdvertisement> list = new ArrayList<MAdvertisement>();
String sql = "SELECT * FROM W_Advertisement WHERE IsActive='Y' ORDER BY Description";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql, null);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
list.add(new MAdvertisement (m_ctx, rs, null));
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql, e);
}
finally
{
try
{
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
}
log.fine("#" + list.size());
return list;
} // getAllAds
/**
* Get Commissioned Invoices
* @return commissioned invoices
*/
public ArrayList<MInvoice> getCommissionedInvoices()
{
m_infoMessage = null;
ArrayList<MInvoice> list = new ArrayList<MInvoice>();
String sql = "SELECT * FROM C_Invoice "
+ "WHERE (C_Invoice.SalesRep_ID=?" // #1
+ " OR EXISTS (SELECT * FROM C_BPartner bp WHERE C_Invoice.C_BPartner_ID=bp.C_BPartner_ID AND bp.SalesRep_ID=?)"
+ " OR EXISTS (SELECT * FROM C_InvoiceLine il INNER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID) WHERE C_Invoice.C_Invoice_ID=il.C_Invoice_ID AND p.SalesRep_ID=?))"
+ " AND DocStatus NOT IN ('DR','IN') "
+ "ORDER BY DocumentNo DESC";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, getAD_User_ID());
pstmt.setInt(2, getAD_User_ID());
pstmt.setInt(3, getAD_User_ID());
ResultSet rs = pstmt.executeQuery();
while (rs.next())
list.add(new MInvoice (m_ctx, rs, null));
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql, e);
}
finally
{
try
{
if (pstmt != null)
pstmt.close ();
}
catch (Exception e)
{}
pstmt = null;
}
log.fine("#" + list.size());
return list;
} // getCommissionedInvoices
/**
* Get Commission Runs
* @return commissioned invoices
*/
public ArrayList<MCommissionRun> getCommissionRuns()
{
m_infoMessage = null;
ArrayList<MCommissionRun> list = new ArrayList<MCommissionRun>();
String sql = "SELECT * FROM C_CommissionRun "
+ "WHERE EXISTS (SELECT * FROM C_Commission c "
+ "WHERE C_CommissionRun.C_Commission_ID=c.C_Commission_ID AND c.C_BPartner_ID=?) "
+ "ORDER BY DocumentNo";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, getC_BPartner_ID());
ResultSet rs = pstmt.executeQuery();
while (rs.next())
list.add(new MCommissionRun (m_ctx, rs, null));
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql, e);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -