Dépôt officiel du code source de l'ERP OpenConcerto
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/ui/ListeDesEcheancesClientsPanel.java |
---|
15,12 → 15,11 |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.config.Gestion; |
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement; |
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel; |
import org.openconcerto.erp.core.common.ui.IListTotalPanel; |
import org.openconcerto.erp.core.customerrelationship.customer.element.RelanceSQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.MouvementSQLElement; |
import org.openconcerto.erp.core.finance.payment.component.EncaisserMontantSQLComponent; |
import org.openconcerto.erp.core.sales.invoice.element.EcheanceClientSQLElement; |
import org.openconcerto.erp.rights.ComptaUserRight; |
import org.openconcerto.erp.rights.NXRights; |
import org.openconcerto.sql.Configuration; |
31,12 → 30,10 |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.users.rights.UserRightsManager; |
import org.openconcerto.sql.view.EditFrame; |
import org.openconcerto.sql.view.EditPanelListener; |
import org.openconcerto.sql.view.IListPanel; |
import org.openconcerto.sql.view.IListener; |
import org.openconcerto.sql.view.list.IListe; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.utils.ExceptionHandler; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
44,10 → 41,8 |
import java.awt.event.ActionListener; |
import java.awt.event.MouseAdapter; |
import java.awt.event.MouseEvent; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Date; |
import java.util.List; |
import javax.swing.JButton; |
130,7 → 125,7 |
this.add(this.relancer, c); |
this.relancer.addActionListener(new ActionListener() { |
public void actionPerformed(ActionEvent e) { |
relanceClient(); |
((EcheanceClientSQLElement) panelEcheances.getElement()).relanceClient(getListPanelEcheancesClients().getListe().getSelectedRow().asRow()); |
} |
}); |
} |
272,70 → 267,6 |
} |
private void relanceClient() { |
SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete(); |
final SQLElement relanceElt = Configuration.getInstance().getDirectory().getElement("RELANCE"); |
final SQLRow rowSource = this.panelEcheances.getListe().fetchSelectedRow(); |
if (rowSource != null) { |
int idMvtSource = MouvementSQLElement.getSourceId(rowSource.getInt("ID_MOUVEMENT")); |
SQLRow rowMvtSource = base.getTable("MOUVEMENT").getRow(idMvtSource); |
if (!rowMvtSource.getString("SOURCE").equalsIgnoreCase("SAISIE_VENTE_FACTURE")) { |
this.relancer.setEnabled(false); |
return; |
} |
if (this.editRelance == null) { |
this.editRelance = new EditFrame(relanceElt); |
this.editRelance.setIconImages(Gestion.getFrameIcon()); |
this.editRelance.addEditPanelListener(new EditPanelListener() { |
public void cancelled() { |
// rien |
} |
public void modified() { |
// rien |
} |
public void deleted() { |
// rien |
} |
public void inserted(int id) { |
int nbRelance = rowSource.getInt("NOMBRE_RELANCE"); |
nbRelance++; |
SQLRowValues rowValsEch = new SQLRowValues(rowSource.getTable()); |
rowValsEch.put("NOMBRE_RELANCE", nbRelance); |
rowValsEch.put("DATE_LAST_RELANCE", new Date()); |
try { |
rowValsEch.update(rowSource.getID()); |
relanceElt.getTable().getRow(id).createEmptyUpdateRow().put("ID_ECHEANCE_CLIENT", rowSource.getID()).commit(); |
} catch (SQLException e1) { |
ExceptionHandler.handle("erreur lors de la mise à jour du nombre de relances", e1); |
} |
} |
}); |
} |
SQLRowValues rowVals = new SQLRowValues(relanceElt.getTable()); |
rowVals.put("ID_SAISIE_VENTE_FACTURE", rowMvtSource.getInt("IDSOURCE")); |
rowVals.put("MONTANT", rowSource.getObject("MONTANT")); |
rowVals.put("ID_CLIENT", rowSource.getInt("ID_CLIENT")); |
rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(RelanceSQLElement.class, new Date())); |
this.editRelance.getSQLComponent().select(rowVals); |
this.editRelance.pack(); |
this.editRelance.setVisible(true); |
} else { |
Thread.dumpStack(); |
} |
} |
public IListPanel getListPanelEcheancesClients() { |
return this.panelEcheances; |
} |