public PostCheckWidget(HashSet<String> p, CustomRequestCallback cb) { callback = cb; procs = p; vPanel = new VerticalPanel(); vPanel.setSpacing(10); initWidget(vPanel); postCheckInfoFlexTable = new FlexTable(); // postCheckInfoFlexTable.setWidth("100%"); // Label payerLb = new Label("Payer"); // payerWidget = new CustomModuleWidget( // "api.ClaimLog.RebillDistinctPayers"); Label checkNumberLb = new Label(_("Check Number")); tbCheckNo = new TextBox(); Label totalAmountLb = new Label(_("Total Amount")); tbTotalAmount = new TextBox(); // postCheckInfoFlexTable.setWidget(0, 0, payerLb); // postCheckInfoFlexTable.setWidget(0, 1, payerWidget); postCheckInfoFlexTable.setWidget(1, 0, checkNumberLb); postCheckInfoFlexTable.setWidget(1, 1, tbCheckNo); postCheckInfoFlexTable.setWidget(2, 0, totalAmountLb); postCheckInfoFlexTable.setWidget(2, 1, tbTotalAmount); proceduresInfoTable = new CustomTable(); proceduresInfoTable.setAllowSelection(false); proceduresInfoTable.setSize("100%", "100%"); proceduresInfoTable.setIndexName("id"); proceduresInfoTable.addColumn(_("Patient"), "pt_name"); proceduresInfoTable.addColumn(_("Claim"), "clm"); proceduresInfoTable.addColumn(_("CPT"), "cpt"); proceduresInfoTable.addColumn(_("Service Date"), "ser_date"); proceduresInfoTable.addColumn(_("Paid"), "paid"); proceduresInfoTable.addColumn(_("Amount Billed"), "amnt_bill"); proceduresInfoTable.addColumn(_("Amount Allowed"), "balance"); proceduresInfoTable.addColumn(_("Adustment Balance"), "adj_bal"); proceduresInfoTable.addColumn(_("Payment"), "pay"); proceduresInfoTable.addColumn(_("Copay"), "copay"); proceduresInfoTable.addColumn(_("Left Over"), "left"); proceduresInfoTable .setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() { @SuppressWarnings("unchecked") @Override public Widget setColumn(String columnName, final HashMap<String, String> data) { final int actionRow = proceduresInfoTable .getActionRow(); if (columnName.compareTo("balance") == 0) { int row = proceduresInfoTable.getActionRow(); proceduresInfoTable.getFlexTable() .getFlexCellFormatter().setWidth(row, 6, "10%"); pids.add(data.get("id")); final TextBox tbAllowedAmount = new TextBox(); tbAllowedAmount.setWidth("100%"); tbAllowedAmount.setText(data.get("balance")); tbAllowedAmount .addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent arg0) { float all_amnt = 0; float pay = 0; float copay = 0; if (!(tbAllowedAmount.getText() .equals("0") || tbAllowedAmount .getText().equals(""))) { all_amnt = Float .parseFloat(tbAllowedAmount .getText() .trim()); } TextBox tb1 = (TextBox) proceduresInfoTable .getWidget(8); TextBox tb2 = (TextBox) proceduresInfoTable .getWidget(9); if (!(tb1.getText().equals("0") || tb1 .getText().equals(""))) { pay = Float.parseFloat(tb1 .getText().trim()); } if (!(tb2.getText().equals("0") || tb2 .getText().equals(""))) { copay = Float.parseFloat(tb2 .getText().trim()); } Label left = (Label) proceduresInfoTable .getWidget(10); left.setText("" + (all_amnt - pay - copay)); } }); return tbAllowedAmount; } else if (columnName.compareTo("pay") == 0) { int row = proceduresInfoTable.getActionRow(); proceduresInfoTable.getFlexTable() .getFlexCellFormatter().setWidth(row, 8, "10%"); final TextBox tbPayment = new TextBox(); tbPayment.setWidth("100%"); tbPayment.setText("0"); tbPayment.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent arg0) { float all_amnt = 0; float pay = 0; float copay = 0; if (!(tbPayment.getText().equals("0") || tbPayment .getText().equals(""))) { pay = Float.parseFloat(tbPayment .getText().trim()); } TextBox tb1 = (TextBox) proceduresInfoTable .getWidget(6); TextBox tb2 = (TextBox) proceduresInfoTable .getWidget(9); if (!(tb1.getText().equals("0") || tb1 .getText().equals(""))) { all_amnt = Float.parseFloat(tb1 .getText().trim()); } if (!(tb2.getText().equals("0") || tb2 .getText().equals(""))) { copay = Float.parseFloat(tb2.getText() .trim()); } Label left = (Label) proceduresInfoTable .getWidget(10); left.setText("" + (all_amnt - pay - copay)); } }); return tbPayment; } else if (columnName.compareTo("copay") == 0) { int row = proceduresInfoTable.getActionRow(); proceduresInfoTable.getFlexTable() .getFlexCellFormatter().setWidth(row, 9, "10%"); final TextBox tbCopay = new TextBox(); tbCopay.setWidth("100%"); tbCopay.setText("0"); @SuppressWarnings("rawtypes") ArrayList params = new ArrayList(); tbCopay.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent arg0) { float all_amnt = 0; float pay = 0; float copay = 0; if (!(tbCopay.getText().equals("0") || tbCopay .getText().equals(""))) { copay = Float.parseFloat(tbCopay .getText().trim()); } TextBox tb1 = (TextBox) proceduresInfoTable .getWidget(6); TextBox tb2 = (TextBox) proceduresInfoTable .getWidget(8); if (!(tb1.getText().equals("0") || tb1 .getText().equals(""))) { all_amnt = Float.parseFloat(tb1 .getText().trim()); } if (!(tb2.getText().equals("0") || tb2 .getText().equals(""))) { pay = Float.parseFloat(tb2.getText() .trim()); } Label left = (Label) proceduresInfoTable .getWidget(10); left.setText("" + (all_amnt - pay - copay)); } }); params.add(data.get("pt_id")); params.add(data.get("id")); Util.callApiMethod("Ledger", "getCoveragesCopayInfo", params, new CustomRequestCallback() { @Override public void onError() { } @Override public void jsonifiedData(Object d) { if (data != null) { HashMap<String, String> result = (HashMap<String, String>) d; // tbAmount.setEnabled(false); if (result != null) { tbCopay.setText(result .get("copay")); try { Label lbLeft = new Label(); float left = 0; float copay = Float .parseFloat(result .get("copay")); left = Float .parseFloat(data .get("left")); lbLeft .setText("" + (left - copay)); proceduresInfoTable .getFlexTable() .setWidget( actionRow, 10, lbLeft); } catch (Exception e) { Window.alert("aaaa"); } // tbAmount.setEnabled(false); } } } }, "HashMap<String,String>"); return tbCopay; } else if (columnName.compareTo("left") == 0) { int row = proceduresInfoTable.getActionRow(); proceduresInfoTable.getFlexTable() .getFlexCellFormatter().setWidth(row, 10, "10%"); try { Label lb = (Label) proceduresInfoTable .getWidget(10); return lb; } catch (Exception e) { return new Label(); } } else if (columnName.compareTo("adj_bal") == 0) { int row = proceduresInfoTable.getActionRow(); proceduresInfoTable.getFlexTable() .getFlexCellFormatter().setWidth(row, 7, "10%"); Label adjbal = new Label(); adjbal.setText(data.get("adj_bal")); return adjbal; } else if (columnName.compareTo("amnt_bill") == 0) { int row = proceduresInfoTable.getActionRow(); proceduresInfoTable.getFlexTable() .getFlexCellFormatter().setWidth(row, 5, "10%"); Label amntbill = new Label(); amntbill.setText(data.get("amnt_bill")); return amntbill; } else { return (Widget) null; } } }); HorizontalPanel actionPanel = new HorizontalPanel(); actionPanel.setSpacing(5); // actionPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); CustomButton postBtn = new CustomButton(_("Post"), AppConstants.ICON_ADD); postBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { prepareDataForPostCheck(); } }); CustomButton cancelBtn = new CustomButton(_("Cancel"), AppConstants.ICON_CANCEL); final PostCheckWidget pcw = this; cancelBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { pcw.removeFromParent(); callback.jsonifiedData("cancel"); } }); actionPanel.add(postBtn); actionPanel.add(cancelBtn); vPanel.add(postCheckInfoFlexTable); vPanel.add(proceduresInfoTable); vPanel.add(actionPanel); vPanel.setCellHorizontalAlignment(actionPanel, HasHorizontalAlignment.ALIGN_RIGHT); pids = new ArrayList<String>(); loadSelectedProcedureInfo(); }