Search in sources :

Example 1 with MFactReconciliation

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--);
        }
    }
}
Also used : IDColumn(org.compiere.minigrid.IDColumn) Query(org.compiere.model.Query) MFactReconciliation(org.compiere.model.MFactReconciliation) DefaultTableModel(javax.swing.table.DefaultTableModel)

Example 2 with MFactReconciliation

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();
}
Also used : Query(org.compiere.model.Query) MFactReconciliation(org.compiere.model.MFactReconciliation) ListModelTable(org.adempiere.webui.component.ListModelTable)

Example 3 with MFactReconciliation

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();
}
Also used : Query(org.compiere.model.Query) MFactReconciliation(org.compiere.model.MFactReconciliation) Calendar(java.util.Calendar) SimpleDateFormat(java.text.SimpleDateFormat)

Example 4 with MFactReconciliation

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--);
        }
    }
}
Also used : IDColumn(org.compiere.minigrid.IDColumn) Query(org.compiere.model.Query) MFactReconciliation(org.compiere.model.MFactReconciliation) Calendar(java.util.Calendar) DefaultTableModel(javax.swing.table.DefaultTableModel) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

MFactReconciliation (org.compiere.model.MFactReconciliation)4 Query (org.compiere.model.Query)4 SimpleDateFormat (java.text.SimpleDateFormat)2 Calendar (java.util.Calendar)2 DefaultTableModel (javax.swing.table.DefaultTableModel)2 IDColumn (org.compiere.minigrid.IDColumn)2 ListModelTable (org.adempiere.webui.component.ListModelTable)1