use of org.compiere.model.MFactReconciliation in project adempiere by adempiere.
the class VFactReconcile method resetReconciliation.
// zoom
private void resetReconciliation() {
log.info("");
//
miniTable.stopEditor(true);
if (miniTable.getRowCount() == 0)
return;
miniTable.setRowSelectionInterval(0, 0);
calculateSelection();
if (m_noSelected == 0)
return;
for (int r = 0; r < miniTable.getModel().getRowCount(); r++) {
if (((IDColumn) miniTable.getModel().getValueAt(r, idColIndex)).isSelected()) {
int factId = ((IDColumn) miniTable.getModel().getValueAt(r, idColIndex)).getRecord_ID();
MFactReconciliation rec = new Query(Env.getCtx(), MFactReconciliation.Table_Name, "Fact_Acct_ID = ?", null).setParameters(new Object[] { factId }).first();
if (rec == null) {
continue;
}
rec.setMatchCode(null);
rec.saveEx();
((DefaultTableModel) miniTable.getModel()).removeRow(r--);
}
}
}
use of org.compiere.model.MFactReconciliation in project adempiere by adempiere.
the class WFactReconcile method resetReconciliation.
// getSelectedRowKeys
private void resetReconciliation() {
log.info("");
//
if (miniTable.getRowCount() == 0)
return;
if (m_noSelected == 0)
return;
int[] rows = miniTable.getSelectedIndices();
if (rows.length == 0)
return;
for (//work backwards and shrink the table as you go
int row = rows.length - 1; //work backwards and shrink the table as you go
row >= 0; //work backwards and shrink the table as you go
row--) {
int factId = miniTable.getRowKey(rows[row]);
MFactReconciliation rec = new Query(Env.getCtx(), MFactReconciliation.Table_Name, "Fact_Acct_ID = ?", null).setParameters(new Object[] { factId }).first();
if (rec == null) {
continue;
}
rec.setMatchCode(null);
rec.saveEx();
((ListModelTable) miniTable.getModel()).remove(rows[row]);
}
calculateSelection();
}
use of org.compiere.model.MFactReconciliation in project adempiere by adempiere.
the class WFactReconcile method generateReconciliation.
// calculateSelection
/**
* Generate Reconciliation record
*/
private void generateReconciliation() {
log.info("");
//miniTable.stopEditor(true);
if (miniTable.getRowCount() == 0)
return;
if (m_noSelected == 0)
return;
String format = "yyyy-MM-dd HH:mm:ss.SSS";
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(format);
String time = sdf.format(cal.getTime());
String matchcode = "Manual: " + Env.getContext(Env.getCtx(), "#AD_User_Name") + " " + time;
int[] rows = miniTable.getSelectedIndices();
Arrays.sort(rows);
int[] sortedRows = rows;
if (rows.length == 0)
return;
for (//work backwards and shrink the table as you go
int row = sortedRows.length - 1; //work backwards and shrink the table as you go
row >= 0; //work backwards and shrink the table as you go
row--) {
int factId = miniTable.getRowKey(sortedRows[row]);
MFactReconciliation rec = new Query(Env.getCtx(), MFactReconciliation.Table_Name, "Fact_Acct_ID = ?", null).setParameters(new Object[] { factId }).first();
if (rec == null) {
rec = new MFactReconciliation(Env.getCtx(), 0, null);
rec.setFact_Acct_ID(factId);
}
rec.setMatchCode(matchcode);
rec.setIsDirectLoad(true);
rec.saveEx();
miniTable.getModel().remove(rows[row]);
}
calculateSelection();
}
use of org.compiere.model.MFactReconciliation in project adempiere by adempiere.
the class VFactReconcile method generateReconciliation.
// calculateSelection
/**
* Generate Reconciliation record
*/
private void generateReconciliation() {
log.info("");
//
miniTable.stopEditor(true);
if (miniTable.getRowCount() == 0)
return;
miniTable.setRowSelectionInterval(0, 0);
calculateSelection();
if (m_noSelected == 0)
return;
String format = "yyyy-MM-dd HH:mm:ss.SSS";
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(format);
String time = sdf.format(cal.getTime());
String matchcode = "Manual: " + Env.getContext(Env.getCtx(), "#AD_User_Name") + " " + time;
for (int r = 0; r < miniTable.getModel().getRowCount(); r++) {
if (((IDColumn) miniTable.getModel().getValueAt(r, idColIndex)).isSelected()) {
int factId = ((IDColumn) miniTable.getModel().getValueAt(r, idColIndex)).getRecord_ID();
MFactReconciliation rec = new Query(Env.getCtx(), MFactReconciliation.Table_Name, "Fact_Acct_ID = ?", null).setParameters(new Object[] { factId }).first();
if (rec == null) {
rec = new MFactReconciliation(Env.getCtx(), 0, null);
rec.setFact_Acct_ID(factId);
}
rec.setMatchCode(matchcode);
rec.setIsDirectLoad(true);
rec.saveEx();
((DefaultTableModel) miniTable.getModel()).removeRow(r--);
}
}
}
Aggregations