📄 vdocaction.java
字号:
}
/********************
* Shipment
*/
else if (m_AD_Table_ID == MInOut.Table_ID)
{
// Complete .. CO
if (DocStatus.equals(DocumentEngine.STATUS_Completed))
{
options[index++] = DocumentEngine.ACTION_Void;
options[index++] = DocumentEngine.ACTION_Reverse_Correct;
}
}
/********************
* Invoice
*/
else if (m_AD_Table_ID == MInvoice.Table_ID)
{
// Complete .. CO
if (DocStatus.equals(DocumentEngine.STATUS_Completed))
{
options[index++] = DocumentEngine.ACTION_Void;
options[index++] = DocumentEngine.ACTION_Reverse_Correct;
}
}
/********************
* Payment
*/
else if (m_AD_Table_ID == MPayment.Table_ID)
{
// Complete .. CO
if (DocStatus.equals(DocumentEngine.STATUS_Completed))
{
options[index++] = DocumentEngine.ACTION_Void;
options[index++] = DocumentEngine.ACTION_Reverse_Correct;
}
}
/********************
* GL Journal
*/
else if (m_AD_Table_ID == MJournal.Table_ID || m_AD_Table_ID == MJournalBatch.Table_ID)
{
// Complete .. CO
if (DocStatus.equals(DocumentEngine.STATUS_Completed))
{
options[index++] = DocumentEngine.ACTION_Reverse_Correct;
options[index++] = DocumentEngine.ACTION_Reverse_Accrual;
}
}
/********************
* Allocation
*/
else if (m_AD_Table_ID == MAllocationHdr.Table_ID)
{
// Complete .. CO
if (DocStatus.equals(DocumentEngine.STATUS_Completed))
{
options[index++] = DocumentEngine.ACTION_Void;
options[index++] = DocumentEngine.ACTION_Reverse_Correct;
}
}
/********************
* Bank Statement
*/
else if (m_AD_Table_ID == MBankStatement.Table_ID)
{
// Complete .. CO
if (DocStatus.equals(DocumentEngine.STATUS_Completed))
{
options[index++] = DocumentEngine.ACTION_Void;
}
}
/********************
* Inventory Movement, Physical Inventory
*/
else if (m_AD_Table_ID == MMovement.Table_ID
|| m_AD_Table_ID == MInventory.Table_ID)
{
// Complete .. CO
if (DocStatus.equals(DocumentEngine.STATUS_Completed))
{
options[index++] = DocumentEngine.ACTION_Void;
options[index++] = DocumentEngine.ACTION_Reverse_Correct;
}
}
/**
* Fill actionCombo
*/
for (int i = 0; i < index; i++)
{
// Serach for option and add it
boolean added = false;
for (int j = 0; j < s_value.length && !added; j++)
if (options[i].equals(s_value[j]))
{
actionCombo.addItem(s_name[j]);
added = true;
}
}
// setDefault
if (DocAction.equals("--")) // If None, suggest closing
DocAction = DocumentEngine.ACTION_Close;
String defaultV = "";
for (int i = 0; i < s_value.length && defaultV.equals(""); i++)
if (DocAction.equals(s_value[i]))
defaultV = s_name[i];
if (!defaultV.equals(""))
actionCombo.setSelectedItem(defaultV);
} // dynInit
/**
* Check Status Change
* @param TableName table name
* @param Record_ID record
* @param DocStatus current doc status
* @return true if status not changed
*/
private boolean checkStatus (String TableName, int Record_ID, String DocStatus)
{
String sql = "SELECT 2 FROM " + TableName
+ " WHERE " + TableName + "_ID=" + Record_ID
+ " AND DocStatus='" + DocStatus + "'";
int result = DB.getSQLValue(null, sql);
return result == 2;
} // checkStatusChange
/**
* Number of options available (to decide to display it)
* @return item count
*/
public int getNumberOfOptions()
{
return actionCombo.getItemCount();
} // getNumberOfOptions
/**
* Should the process be started?
* @return OK pressed
*/
public boolean getStartProcess()
{
return m_OKpressed;
} // getStartProcess
/**
* Fill Vector with DocAction Ref_List(135) values
*/
private void readReference()
{
String sql;
if (Env.isBaseLanguage(Env.getCtx(), "AD_Ref_List"))
sql = "SELECT Value, Name, Description FROM AD_Ref_List "
+ "WHERE AD_Reference_ID=135 ORDER BY Name";
else
sql = "SELECT l.Value, t.Name, t.Description "
+ "FROM AD_Ref_List l, AD_Ref_List_Trl t "
+ "WHERE l.AD_Ref_List_ID=t.AD_Ref_List_ID"
+ " AND t.AD_Language='" + Env.getAD_Language(Env.getCtx()) + "'"
+ " AND l.AD_Reference_ID=135 ORDER BY t.Name";
ArrayList<String> v_value = new ArrayList<String>();
ArrayList<String> v_name = new ArrayList<String>();
ArrayList<String> v_description = new ArrayList<String>();
try
{
PreparedStatement pstmt = DB.prepareStatement(sql, null);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
String value = rs.getString(1);
String name = rs.getString(2);
String description = rs.getString(3);
if (description == null)
description = "";
//
v_value.add(value);
v_name.add(name);
v_description.add(description);
}
rs.close();
pstmt.close();
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql, e);
}
// convert to arrays
int size = v_value.size();
s_value = new String[size];
s_name = new String[size];
s_description = new String[size];
for (int i = 0; i < size; i++)
{
s_value[i] = (String)v_value.get(i);
s_name[i] = (String)v_name.get(i);
s_description[i] = (String)v_description.get(i);
}
} // readReference
/**
* ActionListener
* @param e event
*/
public void actionPerformed(ActionEvent e)
{
if (e.getActionCommand().equals(ConfirmPanel.A_OK))
{
if (save())
{
dispose();
m_OKpressed = true;
return;
}
}
else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL))
{
dispose();
return;
}
else if (e.getSource() != actionCombo)
return;
/**
* ActionCombo: display the description for the selection
*/
int index = getSelectedIndex();
// Display descriprion
if (index != -1)
{
message.setText(s_description[index]);
// log.finer("DocAction=" + s_name[index] + " - " + s_value[index]);
}
} // actionPerformed
/**
* Get index of selected choice
* @return index or -a
*/
private int getSelectedIndex()
{
int index = -1;
// get Selection
String sel = (String)actionCombo.getSelectedItem();
if (sel == null)
return index;
// find it in vector
for (int i = 0; i < s_name.length && index == -1; i++)
if (sel.equals(s_name[i]))
index = i;
//
return index;
} // getSelectedIndex
/**
* Save to Database
* @return true if saved to Tab
*/
private boolean save()
{
int index = getSelectedIndex();
if (index == -1)
return false;
// Save Selection
log.config("DocAction=" + s_value[index]);
m_mTab.setValue("DocAction", s_value[index]);
return true;
} // save
} // VDocAction
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -