<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="comboClients" max="32767" attributes="0"/>
- <Group type="102" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="buttonGenerate" min="-2" pref="121" max="-2" attributes="0"/>
- <EmptySpace pref="28" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="buttonMarkAsAwaiting" min="-2" pref="117" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
<Component id="buttonClose" min="-2" pref="120" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonGenerate" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonClose" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="buttonMarkAsAwaiting" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonCloseActionPerformed"/>
</Events>
</Component>
+ <Component class="javax.swing.JButton" name="buttonMarkAsAwaiting">
+ <Properties>
+ <Property name="mnemonic" type="int" value="77"/>
+ <Property name="text" type="java.lang.String" value="Mark Raised"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMarkAsAwaitingActionPerformed"/>
+ </Events>
+ </Component>
</SubComponents>
</Form>
comboClients = new javax.swing.JComboBox<>();
buttonGenerate = new javax.swing.JButton();
buttonClose = new javax.swing.JButton();
+ buttonMarkAsAwaiting = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Generate Raised Bills");
}
});
+ buttonMarkAsAwaiting.setMnemonic('M');
+ buttonMarkAsAwaiting.setText("Mark Raised");
+ buttonMarkAsAwaiting.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonMarkAsAwaitingActionPerformed(evt);
+ }
+ });
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(comboClients, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
+ .addGap(0, 0, Short.MAX_VALUE)
.addComponent(buttonGenerate, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(buttonMarkAsAwaiting, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonClose, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 45, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonGenerate)
- .addComponent(buttonClose))
+ .addComponent(buttonClose)
+ .addComponent(buttonMarkAsAwaiting))
.addContainerGap())
);
JOptionPane.showMessageDialog(this, SUCCESSFULLY_GENERATED_BILL);
}
}//GEN-LAST:event_buttonGenerateActionPerformed
+
+ private void buttonMarkAsAwaitingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMarkAsAwaitingActionPerformed
+ // TODO add your handling code here:
+ DBItem selitem = (DBItem)comboClients.getSelectedItem();
+ if (selitem == null) return;
+ ArrayList<Object> client = Utility.getClientDetails(selitem.getKey());
+ if (client == null) {
+ JOptionPane.showMessageDialog(this, ERROR_CLIENT_DETAILS);
+ return;
+ } else if (client.isEmpty()) {
+ JOptionPane.showMessageDialog(this, ERROR_CLIENT_DETAILS);
+ return;
+ }
+
+ int conf = JOptionPane.showConfirmDialog(this, MARK_RAISED_CONFIRM);
+ if (conf == JOptionPane.YES_OPTION) {
+ boolean rt = Utility.updateNoticeBillStatus (selitem.getKey(), "RAISED",
+ "AWAITING PAYMENT");
+ if (rt == false)
+ JOptionPane.showMessageDialog(this, ERROR_UPDATING);
+ else
+ JOptionPane.showMessageDialog(this, UPDATED_SUCCESSFULLY);
+
+ }
+
+
+ }//GEN-LAST:event_buttonMarkAsAwaitingActionPerformed
+ private static final String UPDATED_SUCCESSFULLY = "Updated bill status successfully";
+ private static final String ERROR_UPDATING = "Error in updating";
+ private static final String MARK_RAISED_CONFIRM = "This will change the status of "
+ + "all raised bills for this client to 'awaiting payment' - are you sure?";
private static final String ERROR_WRITING_FILE = "Error writing file";
private static final String SUCCESSFULLY_GENERATED_BILL = "Successfully generated bill";
private static final String ERROR_RAISED_BILLS = "Error getting raised "
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonClose;
private javax.swing.JButton buttonGenerate;
+ private javax.swing.JButton buttonMarkAsAwaiting;
private javax.swing.JComboBox<DBItem> comboClients;
private javax.swing.JLabel jLabel1;
// End of variables declaration//GEN-END:variables