buttonsComposite.setLayout(new GridLayout(10, false));
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
buttonsComposite.setLayoutData(gridData);
GDDate date = new GDDate();
final DateText fromDateText = new DateText(buttonsComposite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
date.setFirstDayOfMonth();
fromDateText.setValue(date.getDate());
gridData = new GridData();
gridData.widthHint = 80;
fromDateText.setLayoutData(gridData);
Label label = new Label(buttonsComposite, SWT.NONE);
label.setText(" � ");
final DateText toDateText = new DateText(buttonsComposite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
date.setLastDayOfMonth();
toDateText.setValue(date.getDate());
toDateText.setLayoutData(gridData);
createModifyValidatorDateText(fromDateText, toDateText);
Button filterByDate = new Button(buttonsComposite, SWT.NONE);
filterByDate.setText("Filtrar");
filterByDate.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
if (checkIffromDateIsAftertoDate(fromDateText.getText(), toDateText.getText())){
setErrorMessage("A data Inicial deve ser menor que a data Final!");
}else{
setErrorMessage("");
expendituresTable.setFromDate(new GDDate(fromDateText.getText()));
expendituresTable.setToDate(new GDDate(toDateText.getText()));
expendituresTable.updateTable();
}
}
});
Label separator = new Label(buttonsComposite, SWT.NONE);
separator.setText(" | ");
Button payAccount = new Button(buttonsComposite, SWT.NONE);
payAccount.setText("Pagar conta");
payAccount.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
if (expendituresTable.getAccountTableTree().getSelectionCount() > 0) {
TableItem[] item = expendituresTable.getAccountTableTree().getSelection();
String idBill = item[0].getText(0);
GDDate paymentDayBill = new GDDate(item[0].getText(1));
try {
Expenditure expenditure = (Expenditure) system.query(new GetExpenditures(idBill));
if (expenditure.getNextPaymentDate().beforeDay(paymentDayBill)) {
MessageBox messageBox = new MessageBox(mainScreen.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
messageBox.setMessage("Existem Parcelas anteriores em aberto.\nDeseja efetuar o pagamento da parcela vencida?");