rightButton.addActionListener(
new java.awt.event.ActionListener() {
//{{{ +actionPerformed(java.awt.event.ActionEvent) : void
public void actionPerformed(java.awt.event.ActionEvent evt) {
DataConnection dc = DataConnection.getInstance(null);
if (dc == null || !dc.bIsConnectionMade) {
return;
}
File ff = new File("");
boolean bFoundFile = true;
try {
ff = Fileio.getFile("AccountPlan." + SetupInfo.getProperty(SetupInfo.PRESENT_LANGUAGE) + ".bin",
"testdata", false, false);
if (ff == null || !ff.isFile()) {
bFoundFile = false;
}
} catch (Exception ee) {
bFoundFile = false;
}
if (!bFoundFile) {
try {
ff = Fileio.getFile("AccountPlan.en.bin",
"testdata", false, false);
} catch (Exception eee) {
SystemLog.ErrorPrint("Cant find test database : " + eee.getMessage());
return;
}
}
Lazy8LedgerPlugin.createRestoreFile(dc.con, true, ff.getAbsolutePath(), iCompId, frameParent);
//name was destroyed in the last operation
CompanyForm.quickAndDirtyChangeCompany(iCompId, sCompName);
//period destroyed also...
try {
PreparedStatement stmt = dc.con.prepareStatement(dc.filterSQL(
"INSERT INTO AccountingPeriods (CompId,StartPeriod,EndPeriod) VALUES(?,?,?)"));
stmt.setInt(1, iCompId);
stmt.setDate(2, new java.sql.Date(dateField1.getDate().getTime()));
stmt.setDate(3, new java.sql.Date(dateField2.getDate().getTime()));
stmt.executeUpdate();