package com.sssw.gen.forms;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.util.Hashtable;
import java.util.Locale;
import javax.swing.DefaultComboBoxModel;
import javax.swing.SwingConstants;
import org.apache.log4j.Logger;
import com.gpc.backofficecommon.FwoSessionMgr;
import com.gpc.backofficecommon.app.TamsCacheMgr;
import com.gpc.backofficecommon.constants.schema.Sch_Customer;
import com.gpc.backofficecommon.constants.schema.Sch_CustomerAR;
import com.gpc.backofficecommon.constants.schema.Sch_CustomerStatementAddress;
import com.gpc.backofficecommon.constants.schema.Sch_RefLanguage;
import com.gpc.backofficecommon.constants.schema.Sch_Tables;
import com.gpc.businessservice.valueobject.arupdate.CustomerRequest;
import com.gpc.client.backoffice.FwoFormMaster;
import com.gpc.client.backoffice.FwoToolBarDirector;
import com.gpc.common.util.CommonUtil;
import com.gpc.client.backoffice.app.TamsFormMaster;
import com.gpc.client.backoffice.util.FwoUnsupportedObjectException;
import com.gpc.client.common.ClientApplicationContext;
import com.gpc.client.common.table.FwoJTableMgr;
import com.gpc.common.ApplicationContext;
import com.gpc.common.FwiConstant;
import com.gpc.common.Profile;
import com.gpc.common.TsoConstant;
import com.gpc.common.constants.refvalues.RefArStoreType;
import com.gpc.common.constants.refvalues.RefCustomerType;
import com.gpc.common.multistore.MSHelper;
import com.gpc.common.pattern.FwoPattern;
import com.gpc.common.util.LockableBoolean;
import com.gpc.frame.FwiFormClose;
import com.gpc.frame.FwiFormEdit;
import com.gpc.frame.FwiFormProcess;
import com.gpc.valueobjects.customerstatement.ARStatementMonitorVO;
import com.gpc.valueobjects.profile.ARProfileVO;
import com.gpc.valueobjects.profile.InvoicingProfileVO;
import com.gpc.valueobjects.profile.StoreProfileVO;
import com.sssw.rt.event.AgiPropertyValidationListener;
import com.sssw.rt.event.AgoPropertyChangeEvent;
import com.sssw.rt.form.AgcData;
import com.sssw.rt.form.AgfForm;
import com.sssw.rt.jform.AgcJTextField;
import com.sssw.rt.util.AgiRowCursor;
import com.sssw.rt.util.AgoData;
import com.sssw.rt.util.AgoDataConcurrencyException;
import com.sssw.rt.util.AgoInvalidDataException;
import com.sssw.rt.util.AgoMissingDataException;
import com.sssw.rt.util.AgoSecurityException;
import com.sssw.rt.util.AgoSystemDatabaseException;
import com.sssw.rt.util.AgoTransientSystemException;
import com.sssw.rt.util.AgoUnrecoverableSystemException;
import com.sssw.rt.util.AgoValidationException;
import com.sssw.rt.util.DataCursor;
import com.gpc.common.constants.refvalues.RefBillingType;
public class FrmCM_CustMaint_EmailInfo extends AgfForm implements FwiFormClose, ActionListener,
AgiPropertyValidationListener, FocusListener, FwiFormEdit, FwiFormProcess {
private static final Logger logger = Logger.getLogger(FrmCM_CustMaint_EmailInfo.class);
// Added for Email Invoices
public com.sssw.rt.jform.AgcJLabel lblEmailInvoices;
public com.sssw.rt.jform.AgcJTextField fldEmailInvoices;
public com.sssw.rt.jform.AgcJLabel lblStatementEmailAddress;
public com.sssw.rt.jform.AgcJTextField fldStatementEmailAddress;
public com.sssw.rt.jform.AgcJLabel lblUapCanadaEmailAddress;
public com.sssw.rt.jform.AgcJTextField fldUapCanadaEmailAddress;
public com.sssw.rt.form.AgcData agcCustomer;
public com.sssw.rt.form.AgcData agcCustomerAR;
public com.sssw.rt.jform.AgcJLabel lblDoNotSendEmailForDeliveryInvoices;
public com.sssw.rt.jform.AgcJCheckBox ckDoNotSendEmailForDeliveryInvoices;
public com.sssw.rt.jform.AgcJLabel lblDoNotSendEmailROAInvoices;
public com.sssw.rt.jform.AgcJCheckBox ckDoNotSendEmailROAInvoices;
public com.sssw.rt.jform.AgcJLabel lblSendEmailInvoiceCopies;
public com.sssw.rt.jform.AgcJComboBox cbSendInvoiceCopiesOptions;
public com.sssw.rt.jform.AgcJLabel lblEmailIfPaidVia;
public com.sssw.rt.jform.AgcJComboBox cbEmailIfPaidVia;
public com.sssw.rt.form.AgcRectangle recInvoiceEmailInfo;
public com.sssw.rt.form.AgcRectangle recStatementEmailInfo;
public com.sssw.rt.jform.AgcJLabel lblText;
ARProfileVO arvo = ApplicationContext.getInstance()
.getProfile(Profile.BACKOFFICE_CLIENT,
ClientApplicationContext.getClientApplicationContext().getLocation())
.getARProfile();
private TamsFormMaster FM;
private TamsCacheMgr m_cacheMgr;
/* pattern matching */
private FwoPattern m_pattern;
private Integer m_customerID;
private Integer m_customerNum;
private String m_customerName;
private Locale m_recordLocale = ClientApplicationContext.getClientApplicationContext()
.getCurrentLocale();
private Sch_Customer CUST;
private Sch_CustomerAR CUSTAR;
private String m_CustomerType;
public FrmCM_CustMaint_EmailInfo() {
}
public void init() throws Exception {
// Initialize form and data
this.setTransparent(false);
this.setBackground(Color.white);
this.setBackgroundImageMode(2);
agData.setDataMode(AgoData.DATA_MODE_NORMAL);
this.setName("FrmCM_CustMaint_EmailInfo");
this.setBounds(10, 10, 1004, 585);
// Initialize lblText
lblText = new com.sssw.rt.jform.AgcJLabel();
lblText.setName("lblheading");
lblText.setBounds(3,2,750,20);
lblText.setText("lblheading");
lblText.setOpaque(false);
lblText.setTextStyle(0);
lblText.setForeground(Color.black);
lblText.setTextShadowColor(Color.darkGray);
lblText.setTextHighlightColor(Color.gray);
lblText.setBackground(Color.lightGray);
lblText.setHorizontalAlignment(SwingConstants.LEFT);
lblText.setVerticalAlignment(SwingConstants.CENTER);
lblText.setHorizontalTextPosition(SwingConstants.LEFT);
lblText.setVerticalTextPosition(SwingConstants.CENTER);
lblText.setWordWrap(false);
lblText.setFont(new Font("SansSerif", 1, 12));
// Initialize lblEmailInvoices
lblEmailInvoices = new com.sssw.rt.jform.AgcJLabel();
lblEmailInvoices.setName("lblEmailInvoices");
lblEmailInvoices.setBounds(18, 56, 300, 20);
lblEmailInvoices.setText("Email Invoices");
lblEmailInvoices.setOpaque(false);
lblEmailInvoices.setTextStyle(0);
lblEmailInvoices.setForeground(Color.black);
lblEmailInvoices.setTextShadowColor(Color.darkGray);
lblEmailInvoices.setTextHighlightColor(Color.gray);
lblEmailInvoices.setBackground(Color.lightGray);
lblEmailInvoices.setHorizontalAlignment(SwingConstants.RIGHT);
lblEmailInvoices.setVerticalAlignment(SwingConstants.CENTER);
lblEmailInvoices.setHorizontalTextPosition(SwingConstants.RIGHT);
lblEmailInvoices.setVerticalTextPosition(SwingConstants.CENTER);
lblEmailInvoices.setWordWrap(false);
lblEmailInvoices.setFont(new Font("SansSerif", 1, 12));
// Initialize fldEmailInvoices
fldEmailInvoices = new com.sssw.rt.jform.AgcJTextField();
fldEmailInvoices.setName("fldEmailInvoices");
fldEmailInvoices.setBounds(340, 56, 300, 20);
fldEmailInvoices.setFont(new Font("SansSerif", 0, 12));
fldEmailInvoices.setHorizontalAlignment(2);
fldEmailInvoices.setMargin(new Insets(1, 1, 1, 1));
fldEmailInvoices.setEditable(true);
fldEmailInvoices.setForeground(Color.black);
fldEmailInvoices.setBackground(Color.white);
fldEmailInvoices.setMaxLength(AgcJTextField.NO_LIMIT);
fldEmailInvoices.setMinLength(AgcJTextField.NO_LIMIT);
// Initialize lblStatementEmailAddress
lblStatementEmailAddress = new com.sssw.rt.jform.AgcJLabel();
lblStatementEmailAddress.setName("lblStatementEmailAddress");
lblStatementEmailAddress.setBounds(19,400,170,20);
lblStatementEmailAddress.setText("Statement Email Address");
lblStatementEmailAddress.setOpaque(false);
lblStatementEmailAddress.setTextStyle(0);
lblStatementEmailAddress.setForeground(Color.black);
lblStatementEmailAddress.setTextShadowColor(Color.darkGray);
lblStatementEmailAddress.setTextHighlightColor(Color.gray);
lblStatementEmailAddress.setBackground(Color.lightGray);
lblStatementEmailAddress.setHorizontalAlignment(SwingConstants.RIGHT);
lblStatementEmailAddress.setVerticalAlignment(SwingConstants.CENTER);
lblStatementEmailAddress.setHorizontalTextPosition(SwingConstants.RIGHT);
lblStatementEmailAddress.setVerticalTextPosition(SwingConstants.CENTER);
lblStatementEmailAddress.setWordWrap(false);
lblStatementEmailAddress.setFont(new Font("SansSerif", 1, 12));
// Initialize fldStatementEmailAddress
fldStatementEmailAddress = new com.sssw.rt.jform.AgcJTextField();
fldStatementEmailAddress.setName("fldStatementEmailAddress");
fldStatementEmailAddress.setBounds(201,400,380,20);
fldStatementEmailAddress.setFont(new Font("SansSerif", 0, 12));
fldStatementEmailAddress.setHorizontalAlignment(2);
fldStatementEmailAddress.setMargin(new Insets(1, 1, 1, 1));
fldStatementEmailAddress.setEditable(true);
fldStatementEmailAddress.setForeground(Color.black);
fldStatementEmailAddress.setBackground(Color.white);
fldStatementEmailAddress.setMaxLength(AgcJTextField.NO_LIMIT);
fldStatementEmailAddress.setMinLength(AgcJTextField.NO_LIMIT);
// Initiliaze lblUapCanadaEmailAddress
lblUapCanadaEmailAddress = new com.sssw.rt.jform.AgcJLabel();
lblUapCanadaEmailAddress.setName("lblUapCanadaEmailAddress");
lblUapCanadaEmailAddress.setBounds(19, 440, 170, 20);
lblUapCanadaEmailAddress.setText("UAP/Canada Email Address");
lblUapCanadaEmailAddress.setOpaque(false);
lblUapCanadaEmailAddress.setTextStyle(0);
lblUapCanadaEmailAddress.setForeground(Color.black);
lblUapCanadaEmailAddress.setTextShadowColor(Color.darkGray);
lblUapCanadaEmailAddress.setTextHighlightColor(Color.gray);
lblUapCanadaEmailAddress.setBackground(Color.lightGray);
lblUapCanadaEmailAddress.setHorizontalAlignment(SwingConstants.RIGHT);
lblUapCanadaEmailAddress.setVerticalAlignment(SwingConstants.CENTER);
lblUapCanadaEmailAddress.setHorizontalTextPosition(SwingConstants.RIGHT);
lblUapCanadaEmailAddress.setVerticalTextPosition(SwingConstants.CENTER);
lblUapCanadaEmailAddress.setWordWrap(false);
lblUapCanadaEmailAddress.setFont(new Font("SansSerif", 1, 12));
// Initialize fldUapCanadaEmailAddress
fldUapCanadaEmailAddress = new com.sssw.rt.jform.AgcJTextField();
fldUapCanadaEmailAddress.setName("fldUapCanadaEmailAddress");
fldUapCanadaEmailAddress.setBounds(201, 440, 380, 20);
fldUapCanadaEmailAddress.setFont(new Font("SansSerif", 0, 12));
fldUapCanadaEmailAddress.setHorizontalAlignment(2);
fldUapCanadaEmailAddress.setMargin(new Insets(1, 1, 1, 1));
fldUapCanadaEmailAddress.setEditable(true);
fldUapCanadaEmailAddress.setForeground(Color.black);
fldUapCanadaEmailAddress.setBackground(Color.white);
fldUapCanadaEmailAddress.setMaxLength(AgcJTextField.NO_LIMIT);
fldUapCanadaEmailAddress.setMinLength(AgcJTextField.NO_LIMIT);
// Initialize lblDoNotSendEmailForDeliveryInvoices
lblDoNotSendEmailForDeliveryInvoices = new com.sssw.rt.jform.AgcJLabel();
lblDoNotSendEmailForDeliveryInvoices.setName("lblDoNotSendEmailForDeliveryInvoices");
lblDoNotSendEmailForDeliveryInvoices.setBounds(18, 116, 300, 20);
lblDoNotSendEmailForDeliveryInvoices
.setText("Do not send delivery invoices until delivered");
lblDoNotSendEmailForDeliveryInvoices.setOpaque(false);
lblDoNotSendEmailForDeliveryInvoices.setTextStyle(0);
lblDoNotSendEmailForDeliveryInvoices.setForeground(Color.black);
lblDoNotSendEmailForDeliveryInvoices.setTextShadowColor(Color.darkGray);
lblDoNotSendEmailForDeliveryInvoices.setTextHighlightColor(Color.gray);
lblDoNotSendEmailForDeliveryInvoices.setBackground(Color.lightGray);
lblDoNotSendEmailForDeliveryInvoices.setHorizontalAlignment(SwingConstants.RIGHT);
lblDoNotSendEmailForDeliveryInvoices.setVerticalAlignment(SwingConstants.CENTER);
lblDoNotSendEmailForDeliveryInvoices.setHorizontalTextPosition(SwingConstants.RIGHT);
lblDoNotSendEmailForDeliveryInvoices.setVerticalTextPosition(SwingConstants.CENTER);
lblDoNotSendEmailForDeliveryInvoices.setWordWrap(false);
lblDoNotSendEmailForDeliveryInvoices.setFont(new Font("SansSerif", 1, 12));
// Initialize ckDoNotSendEmailForDeliveryInvoices
ckDoNotSendEmailForDeliveryInvoices = new com.sssw.rt.jform.AgcJCheckBox();
ckDoNotSendEmailForDeliveryInvoices.setName("ckDoNotSendEmailForDeliveryInvoices");
ckDoNotSendEmailForDeliveryInvoices.setBounds(340, 116, 200, 20);
ckDoNotSendEmailForDeliveryInvoices.setContentAreaFilled(false);
ckDoNotSendEmailForDeliveryInvoices.setBorderPainted(false);
ckDoNotSendEmailForDeliveryInvoices.setText(" ");
ckDoNotSendEmailForDeliveryInvoices.setCheckedValue("Y");
ckDoNotSendEmailForDeliveryInvoices.setUncheckedValue("N");
ckDoNotSendEmailForDeliveryInvoices.setFont(new Font("SansSerif", 0, 12));
ckDoNotSendEmailForDeliveryInvoices.setForeground(Color.black);
ckDoNotSendEmailForDeliveryInvoices.setBackground(Color.lightGray);
// Initialize lblDoNotSendEmailROAInvoices
lblDoNotSendEmailROAInvoices = new com.sssw.rt.jform.AgcJLabel();
lblDoNotSendEmailROAInvoices.setName("lblDoNotSendEmailROAInvoices");
lblDoNotSendEmailROAInvoices.setBounds(18, 146, 300, 20);
lblDoNotSendEmailROAInvoices.setText("Do not email ROA Payment invoices");
lblDoNotSendEmailROAInvoices.setOpaque(false);
lblDoNotSendEmailROAInvoices.setTextStyle(0);
lblDoNotSendEmailROAInvoices.setForeground(Color.black);
lblDoNotSendEmailROAInvoices.setTextShadowColor(Color.darkGray);
lblDoNotSendEmailROAInvoices.setTextHighlightColor(Color.gray);
lblDoNotSendEmailROAInvoices.setBackground(Color.lightGray);
lblDoNotSendEmailROAInvoices.setHorizontalAlignment(SwingConstants.RIGHT);
lblDoNotSendEmailROAInvoices.setVerticalAlignment(SwingConstants.CENTER);
lblDoNotSendEmailROAInvoices.setHorizontalTextPosition(SwingConstants.RIGHT);
lblDoNotSendEmailROAInvoices.setVerticalTextPosition(SwingConstants.CENTER);
lblDoNotSendEmailROAInvoices.setWordWrap(false);
lblDoNotSendEmailROAInvoices.setFont(new Font("SansSerif", 1, 12));
// Initialize ckDoNotSendEmailROAInvoices
ckDoNotSendEmailROAInvoices = new com.sssw.rt.jform.AgcJCheckBox();
ckDoNotSendEmailROAInvoices.setName("ckDoNotSendEmailROAInvoices");
ckDoNotSendEmailROAInvoices.setBounds(340, 146, 200, 20);
ckDoNotSendEmailROAInvoices.setContentAreaFilled(false);
ckDoNotSendEmailROAInvoices.setBorderPainted(false);
ckDoNotSendEmailROAInvoices.setText(" ");
ckDoNotSendEmailROAInvoices.setCheckedValue("Y");
ckDoNotSendEmailROAInvoices.setUncheckedValue("N");
ckDoNotSendEmailROAInvoices.setFont(new Font("SansSerif", 0, 12));
ckDoNotSendEmailROAInvoices.setForeground(Color.black);
ckDoNotSendEmailROAInvoices.setBackground(Color.lightGray);
// Initiliaze lblSendEmailInvoiceCopies
lblSendEmailInvoiceCopies = new com.sssw.rt.jform.AgcJLabel();
lblSendEmailInvoiceCopies.setName("lblSendEmailInvoiceCopies");
lblSendEmailInvoiceCopies.setBounds(18, 176, 300, 20);
lblSendEmailInvoiceCopies.setText("Send Email Invoice Copies");
lblSendEmailInvoiceCopies.setOpaque(false);
lblSendEmailInvoiceCopies.setTextStyle(0);
lblSendEmailInvoiceCopies.setForeground(Color.black);
lblSendEmailInvoiceCopies.setTextShadowColor(Color.darkGray);
lblSendEmailInvoiceCopies.setTextHighlightColor(Color.gray);
lblSendEmailInvoiceCopies.setBackground(Color.lightGray);
lblSendEmailInvoiceCopies.setHorizontalAlignment(SwingConstants.RIGHT);
lblSendEmailInvoiceCopies.setVerticalAlignment(SwingConstants.CENTER);
lblSendEmailInvoiceCopies.setHorizontalTextPosition(SwingConstants.RIGHT);
lblSendEmailInvoiceCopies.setVerticalTextPosition(SwingConstants.CENTER);
lblSendEmailInvoiceCopies.setWordWrap(false);
lblSendEmailInvoiceCopies.setFont(new Font("SansSerif", 1, 12));
// Initialize cbSendInvoiceCopiesOptions
cbSendInvoiceCopiesOptions = new com.sssw.rt.jform.AgcJComboBox();
cbSendInvoiceCopiesOptions.setName("cbSendInvoiceCopiesOptions");
cbSendInvoiceCopiesOptions.setBounds(340, 176, 209, 25);
cbSendInvoiceCopiesOptions.setFont(new Font("SansSerif", 0, 12));
DefaultComboBoxModel cbCustomerTypeModel = new DefaultComboBoxModel();
cbSendInvoiceCopiesOptions.setModel(cbCustomerTypeModel);
// Initialize lblEmailIfPaidVia
lblEmailIfPaidVia = new com.sssw.rt.jform.AgcJLabel();
lblEmailIfPaidVia.setName("lblEmailIfPaidVia");
lblEmailIfPaidVia.setBounds(18, 242, 300, 20);
lblEmailIfPaidVia.setText("Email if Paid Via");
lblEmailIfPaidVia.setOpaque(false);
lblEmailIfPaidVia.setTextStyle(0);
lblEmailIfPaidVia.setForeground(Color.black);
lblEmailIfPaidVia.setTextShadowColor(Color.darkGray);
lblEmailIfPaidVia.setTextHighlightColor(Color.gray);
lblEmailIfPaidVia.setBackground(Color.lightGray);
lblEmailIfPaidVia.setHorizontalAlignment(SwingConstants.RIGHT);
lblEmailIfPaidVia.setVerticalAlignment(SwingConstants.CENTER);
lblEmailIfPaidVia.setHorizontalTextPosition(SwingConstants.RIGHT);
lblEmailIfPaidVia.setVerticalTextPosition(SwingConstants.CENTER);
lblEmailIfPaidVia.setWordWrap(false);
lblEmailIfPaidVia.setFont(new Font("SansSerif", 1, 12));
// Initialize cbEmailIfPaidVia
cbEmailIfPaidVia = new com.sssw.rt.jform.AgcJComboBox();
cbEmailIfPaidVia.setName("cbEmailIfPaidVia");
cbEmailIfPaidVia.setBounds(340, 242, 209, 25);
cbEmailIfPaidVia.setEditable((boolean) false);
cbEmailIfPaidVia.setFont(new Font("SansSerif", 0, 12));
DefaultComboBoxModel cbEmailIfPaidViaModel = new DefaultComboBoxModel();
cbEmailIfPaidVia.setModel(cbEmailIfPaidViaModel);
// Initialize agcCustomer
agcCustomer = new com.sssw.rt.form.AgcData();
agcCustomer.setName("agcCustomer");
agcCustomer.setBounds(557, 680, 75, 58);
agcCustomer.setExpressionCount(9);
agcCustomer.setExpression(0, 0, "ID", 0);
agcCustomer.setExpression(1, 1, "LOC", 1);
agcCustomer.setExpression(2, 2, "CUSTOMER_NUM", 2);
agcCustomer.setExpression(3, 3, "INVOICE_EMAIL_ADDRESS", 3);
agcCustomer.setExpression(4, 4, "EMAIL", 4);
agcCustomer.setExpression(5, 5, "SEND_INVOICE_EMAIL_AFTER_DELIVERY", 5);
agcCustomer.setExpression(6, 6, "DO_NOT_EMAIL_ROA_INVOICE", 6);
agcCustomer.setExpression(7, 7, "REF_EMAIL_INVOICE_DELIVERY_OPTIONS_ID", 7);
agcCustomer.setExpression(8, 8, "EMAIL_INVOICE_TENDER_VIA", 8);
// Initialize agcCustomerAR
agcCustomerAR = new com.sssw.rt.form.AgcData();
agcCustomerAR.setName("agcCustomerAR");
agcCustomerAR.setBounds(396, 605, 73, 58);
agcCustomerAR.setExpressionCount(3);
agcCustomerAR.setExpression(0, 9, "CUSTOMER_ID", 0);
agcCustomerAR.setExpression(1, 10, "LOC", 1);
agcCustomerAR.setExpression(2, 11, "STATEMENT_EMAIL_ADDRESS", 2);
// Initialize recInvoiceEmailInfo
recInvoiceEmailInfo = new com.sssw.rt.form.AgcRectangle();
recInvoiceEmailInfo.setName("recInvoiceEmailInfo");
recInvoiceEmailInfo.setBounds(14, 20, 650, 330);
recInvoiceEmailInfo.setColor(Color.lightGray);
recInvoiceEmailInfo.setBorderStyle(4);
recInvoiceEmailInfo.setText("Invoices");
recInvoiceEmailInfo.setFont(new Font("SansSerif", 1, 12));
recInvoiceEmailInfo.setForeground(Color.black);
recInvoiceEmailInfo.setTransparent(true);
// Initialize recStatementEmailInfo
recStatementEmailInfo = new com.sssw.rt.form.AgcRectangle();
recStatementEmailInfo.setName("recStatementEmailInfo");
recStatementEmailInfo.setBounds(14, 375, 650, 150);
recStatementEmailInfo.setColor(Color.lightGray);
recStatementEmailInfo.setBorderStyle(4);
recStatementEmailInfo.setText("Statements");
recStatementEmailInfo.setFont(new Font("SansSerif", 1, 12));
recStatementEmailInfo.setForeground(Color.black);
recStatementEmailInfo.setTransparent(true);
addControls();
addBindings();
// Setup tab order
Component[] tabOrder = {
fldEmailInvoices, ckDoNotSendEmailForDeliveryInvoices,
ckDoNotSendEmailROAInvoices, cbSendInvoiceCopiesOptions,cbEmailIfPaidVia,fldStatementEmailAddress, fldUapCanadaEmailAddress };
setUserDefinedTabOrder(tabOrder);
return;
}
protected void addAllFormControls() {
this.add(agcCustomer);
this.add(agcCustomerAR);
this.add(lblText);
this.add(lblEmailInvoices);
this.add(fldEmailInvoices);
// this.add(lblDoNotSendEmailForDeliveryInvoices);
// this.add(ckDoNotSendEmailForDeliveryInvoices);
// this.add(lblDoNotSendEmailROAInvoices);
// this.add(ckDoNotSendEmailROAInvoices);
this.add(lblSendEmailInvoiceCopies);
this.add(cbSendInvoiceCopiesOptions);
this.add(lblEmailIfPaidVia);
this.add(cbEmailIfPaidVia);
this.add(lblStatementEmailAddress);
this.add(fldStatementEmailAddress);
this.add(lblUapCanadaEmailAddress);
this.add(fldUapCanadaEmailAddress);
this.add(recInvoiceEmailInfo);
this.add(recStatementEmailInfo);
}
protected void addBindings() {
agDataMgr.bind(fldEmailInvoices, "Text", "getText", "setText", agcCustomer,
"INVOICE_EMAIL_ADDRESS");
agDataMgr.bind(fldUapCanadaEmailAddress, "Text", "getText", "setText", agcCustomer,
"EMAIL");
agDataMgr.bind(ckDoNotSendEmailForDeliveryInvoices, "Value", "getValue", "setValue",
agcCustomer, "SEND_INVOICE_EMAIL_AFTER_DELIVERY");
agDataMgr.bind(ckDoNotSendEmailROAInvoices, "Value", "getValue", "setValue", agcCustomer,
"DO_NOT_EMAIL_ROA_INVOICE");
agDataMgr.bind(cbSendInvoiceCopiesOptions, "Value", "getValue", "setValue", agcCustomer,
"REF_EMAIL_INVOICE_DELIVERY_OPTIONS_ID");
agDataMgr.addValidationEvent(cbSendInvoiceCopiesOptions, "Value");
agDataMgr.bind(cbEmailIfPaidVia, "Value", "getValue", "setValue", agcCustomer, "EMAIL_INVOICE_TENDER_VIA");
agDataMgr.addValidationEvent(cbEmailIfPaidVia, "Value");
agDataMgr.bind(fldStatementEmailAddress, "Text", "getText", "setText", agcCustomerAR,
"STATEMENT_EMAIL_ADDRESS");
addExpDependencies();
}
/**
* Initializes the TamsFormMaster object, including its toolbar and navigation data. Uses the
* parent's navigation data.
*/
protected void formLoaded() {
AgiRowCursor navData = ((FwiFormProcess) this.getParentForm()).fGetFormMaster()
.getNavData();
Hashtable permissions = new Hashtable();
permissions.put(FwoToolBarDirector.NAV_OK, Boolean.TRUE);
permissions.put(FwoToolBarDirector.SAVE_OK, Boolean.TRUE);
permissions.put(FwoToolBarDirector.EDIT_OK, Boolean.TRUE);
FwoToolBarDirector toolBarDirector = new FwoToolBarDirector(permissions);
FM = new TamsFormMaster(this, ((FwiFormProcess) this.getParentForm()), navData,
toolBarDirector);
m_cacheMgr = (TamsCacheMgr) FwoSessionMgr.getInstance().getCacheMgr();
fillSendEmailInvoiceCopiesCombos(true);
initValidators();
FM.setMode(FwoFormMaster.EDIT_MODE_EDITING);
}
/**
* Adds InputVerifiers to the text fields that need them.
**/
private void initValidators() {
try {
FM.addValidatedTextComponent(fldEmailInvoices, FwiConstant.ANY, 100);
FM.addValidatedTextComponent(fldUapCanadaEmailAddress, FwiConstant.ANY, 100);
FM.addValidatedTextComponent(fldStatementEmailAddress, FwiConstant.ANY, 100);
} catch (FwoUnsupportedObjectException e) {
logger.error("Error in initValidators() ", e);
}
}
/**
* Loads the current record
* Must call setToolBar(Component) on the form master to set the current form in the toolbar
*
* @param Hashtable Contains any data being passed in pertaining to what record should be loaded
*/
public void fRetrieve(java.util.Hashtable hshParams) {
boolean arBranchStore = isARBranchStore();
String storeType = arvo.getRefArStoreTypeCd();
//Branch Store always View Mode & Main will be Edit mode if employee has permission in security screen (TNSS-6309)
if (arBranchStore && storeType.equals(RefArStoreType.BRANCH)) {
FM.setMode(FwoFormMaster.VIEW_MODE);
} else {
FM.setMode(FwoFormMaster.EDIT_MODE_EDITING);
}
// If this is a subform on a tab, must call FM.formActivate() to set the
// current FM in the toolbar.
FM.formActivate();
// Get the current customer id passed in from Main
m_customerID = (Integer) hshParams.get(FM.TC.KEY_ID);
m_customerNum = (Integer) hshParams.get(Sch_Customer.CUSTOMER_NUM);
m_customerName = (String) hshParams.get(Sch_Customer.NAME);
retrieveCustomerEmailData();
retrieveARData();
}
private void retrieveCustomerEmailData() {
try {
StringBuffer sbWhere = new StringBuffer(96);
sbWhere.append(Sch_Tables.CUSTOMER).append('.').append(Sch_CustomerStatementAddress.LOC)
.append('=').append(FM.m_loc);
sbWhere.append(" AND ").append(Sch_Tables.CUSTOMER).append('.').append(CUST.ID)
.append('=');
sbWhere.append(m_customerID);
logger.debug(" in retrieveDataForCustomer() query: \n " + sbWhere);
agcCustomer.query(sbWhere.toString());
agcCustomer.gotoFirst();
} catch (AgoSecurityException e) {
logger.error("AgoSecurityException in retrieveCustomerEmailData: ", e);
} catch (AgoTransientSystemException e) {
logger.error("AgoTransientSystemException in retrieveCustomerEmailData: ", e);
} catch (AgoUnrecoverableSystemException e) {
logger.error("AgoUnrecoverableSystemException in retrieveCustomerEmailData: ", e);
}
}
/**
* Retrieves all AR data, including calculations will be called from fRetrieve, fCancel, fNext,
* fPrevious
*/
private void retrieveARData() {
try {
StringBuffer sbWhere = new StringBuffer(96);
sbWhere.append(Sch_Tables.CUSTOMER_AR).append('.').append(Sch_CustomerAR.LOC).append(
'=').append(FM.m_loc);
sbWhere.append(" AND ").append(Sch_Tables.CUSTOMER_AR).append('.').append(
Sch_CustomerAR.CUSTOMER_ID).append('=');
sbWhere.append(m_customerID);
agcCustomerAR.query(sbWhere.toString());
agcCustomerAR.gotoFirst();
} catch (AgoSecurityException e) {
logger.error("AgoSecurityException in retrieveStatementAddress: ", e);
} catch (AgoTransientSystemException e) {
logger.error("AgoTransientSystemException in retrieveStatementAddress: ", e);
} catch (AgoUnrecoverableSystemException e) {
logger.error("AgoUnrecoverableSystemException in retrieveStatementAddress: ", e);
}
}
private ARStatementMonitorVO getARStatementMonitor() {
ARStatementMonitorVO arStmtMonitorVO = ClientApplicationContext
.getClientApplicationContext().getARStatementMonitorDAO()
.getARStatementMonitor(new Integer(
ClientApplicationContext.getClientApplicationContext().getLocation()));
if (arStmtMonitorVO != null)
logger.debug(" arStmtMonitorVO.toString() = \n" + arStmtMonitorVO.toString());
else
logger.debug(" arStmtMonitorVO = null !");
return arStmtMonitorVO;
}
/**
* Inserts a new record into the database
* . This method is not used on this form.
*
* @return boolean Return true if insert passes, false if insert fails
*/
public boolean fNew() {
// this subform doesn't have access to the New function
return false;
}
/**
* Edits the current row of data. This method is not used on this form.
*
* @return boolean
*/
public boolean fEdit() {
// this subform doesn't have access to the Edit function
return false;
}
/**
* Puts the form in Find Mode.
*
* @return boolean - true = find mode succeeded; false = find mode failed
*/
public boolean fFindMode() {
return false;
}
/**
* Navigates the parent navigation data to the first row
*
* @return boolean Return true if fFirst() passes, false if fFirst() fails
*/
public boolean fFirst() {
// Typically we will be going to the first record on the parent's data
return ((FwiFormEdit) this.getParentForm()).fFirst();
}
/**
* Saves any changes made to the data. Also updates the "modified by" database and display
* values.
*
* @return boolean Return true if update passes, false if update fails
*/
public boolean fSave() {
logger.debug("fSave ()::");
try {
if (agcCustomer.haveRowsChanged()) {
if (fldEmailInvoices.getText().isEmpty()) {
agcCustomer.setProperty(CUST.INVOICE_EMAIL_ADDRESS, null);
}
if (fldUapCanadaEmailAddress.getText().isEmpty()) {
agcCustomer.setProperty(CUST.EMAIL, null);
}
}
if (agcCustomerAR.haveRowsChanged()) {
if (fldStatementEmailAddress.getText().isEmpty()) {
agcCustomerAR.setProperty(CUSTAR.STATEMENT_EMAIL_ADDRESS, null);
}
}
//Do all updates here!
AgcData[] saveData = {agcCustomer,agcCustomerAR};
FM.setTransactionColumns(saveData, true);
buildAndFireArUpdate(m_customerNum, CustomerRequest.CustomerAction.UPDATE_INFO, m_customerName);
agData.updateTransactionally(saveData);
return true;
} catch (AgoSecurityException e) {
logger.error("fSave(): " + e.toString(), e);
return false;
} catch (AgoTransientSystemException e) {
logger.error("fSave(): " + e.toString(), e);
return false;
} catch (AgoSystemDatabaseException e) {
//This shouldn't happen anymore, but if the validation ever gets messed up
// this should catch the database error.
String dbErrorMessage = e.getMessage();
if (dbErrorMessage.indexOf("18500") > 0) {
// The customer entered is sending statement to another
//customer. Therefore this customer cannot send its
//statements to the entered customer
ClientApplicationContext.getClientApplicationContext().getMessageMgr()
.showMessage(this, "1712");
} else if (dbErrorMessage.indexOf("18501") > 0) {
//Other customers are sending statements to this customer's
//address. Therefore this customer's address
//cannot send its statements to another customer.
ClientApplicationContext.getClientApplicationContext().getMessageMgr()
.showMessage(this, "1711");
} else {
logger.error("fSave(): " + e.toString(), e);
}
return false;
} catch (AgoUnrecoverableSystemException e) {
logger.error("fSave(): " + e.toString(), e);
return false;
} catch (AgoMissingDataException e) {
logger.error("fSave(): " + e.toString(), e);
return false;
} catch (AgoInvalidDataException e) {
logger.error("fSave(): " + e.toString(), e);
return false;
} catch (AgoDataConcurrencyException e) {
logger.error("fSave(): " + e.toString(), e);
try {
agcCustomer.refreshRows();
agcCustomerAR.refreshRows();
// agcStatementAddr.refreshRows();
} catch (AgoSecurityException se) {
logger.error(se.toString(), se);
} catch (AgoTransientSystemException tse) {
logger.error(tse.toString(), tse);
} catch (AgoUnrecoverableSystemException use) {
logger.error(use.toString(), use);
}
return false;
}
}
/**
* This method is not relevant to the form.
*
* @return boolean Return true if delete passes, false if v fails
*/
public boolean fDelete() {
return true;
}
/**
* Re-retrieves the current AR information
*/
public void fCancel() {
retrieveCustomerEmailData();
retrieveARData();
}
/**
* Navigates the parent navigation data to the previous row
*
* @return boolean Return true if fPrevious() passes, false if fPrevious() fails
*/
public boolean fPrevious() {
// Typically we will be going to the first record on the parent's data
return ((FwiFormEdit) this.getParentForm()).fPrevious();
}
/**
* Validates data. Required fields are not validated here; they are now validated by the Form
* Master object.
*
* @return boolean - true = all data is valid; false = some data is not valid
*/
public boolean fValidate() {
return validateSave();
}
/**
* Navigates the parent navigation data to the next row
*
* @return boolean Return true if fNext() passes, false if fNext() fails
*/
public boolean fNext() {
// Typically we will be going to the next record on the parent's data
return ((FwiFormEdit) this.getParentForm()).fNext();
}
/**
* Navigates the parent navigation data to the last row
*
* @return boolean Return true if fLast() passes, false if fLast() fails
*/
public boolean fLast() {
// Typically we will be going to the last record on the parent's data
return ((FwiFormEdit) this.getParentForm()).fLast();
}
/**
* Executes a search. I don't think this is used anymore.
*
* @return boolean - true = search succeeded; false = search failed
*/
public boolean fFindExec() {
return false;
}
/**
* Not sure what this does
*/
public void fCheckLogin() {
}
/**
* Re-Localizes this form. This method will most likely be called by the parent form when the
* language gets changed on the toolbar
*/
public void fLocalize() {
ClientApplicationContext.getClientApplicationContext().getLocalizationMgr().localize(this);
fillSendEmailInvoiceCopiesCombos(true);
}
/**
* Not sure what this does.
*
* @return boolean - true: logout was stopped; false: logout was not stopped
*/
public boolean fStopLogout() {
return false;
}
/**
* Not sure what this does.
*/
public void fCheckAccess() {
}
/**
* Returns the form's instance of FwoFormMaster
*
*
* @return com.gpc.client.backoffice.FwoFormMaster
*/
public com.gpc.client.backoffice.FwoFormMaster fGetFormMaster() {
return FM;
}
/**
* Not sure what this does.
*/
public void fSetToolBar(java.awt.Component component1) {
}
/**
* Creates a title for this form.
*
* @return String - title value
*/
public java.lang.String fCreateTitle() {
return "Email Info";
}
/**
* Updates this form's GUI to follow a certain style using the Style Manager object. Not sure
* what is suppose to be coded here. It is still under construction I think.
*/
public void fStylize() {
}
/**
* Not sure what this is used for, but for now it is just returning a description of this form
*
* @return String - description value
*/
public java.lang.String fDescribe() {
return "Email Information";
}
/**
* Provides this form's name.
*
* @return String - form name value
*/
public java.lang.String fGetFormName() {
return FM.TC.FRM_CM_EMAIL_INFO;
}
public void fSort() {
}
public void fPostNew() {
}
public void fPostSave() {
}
public void fPostEdit() {
}
public void fPostCancel() {
}
public void fPostDelete() {
}
public boolean fValidateComponent(javax.swing.JComponent comp) {
logger.debug(" entering fValidateComponent for " + comp.getName());
return true;
}
public java.util.Locale fGetCurrentRecordLocale(javax.swing.JComponent jComponent1) {
return m_recordLocale;
}
public Integer fGetFunctionId() {
return TsoConstant.CM_EMAIL_INFO;
}
public boolean validateSave() {
boolean rtnFlag = true;
if (rtnFlag) {
if (fldEmailInvoices.getText() != null) {
String fldMail = fldEmailInvoices.getText();
if (!CommonUtil.multipleEmailValidation(fldMail, null)) {
ClientApplicationContext.getClientApplicationContext().getMessageMgr()
.showMessage(this, "9950");
fldEmailInvoices.requestFocus();
return false;
}
}
if (fldUapCanadaEmailAddress.getText() != null) {
String emailAddresses = fldUapCanadaEmailAddress.getText();
String country = ClientApplicationContext.getClientApplicationContext().getLocale().getCountry();
if(!CommonUtil.multipleEmailValidation(emailAddresses, country)){
ClientApplicationContext.getClientApplicationContext().getMessageMgr()
.showMessage(this, "9950");
fldUapCanadaEmailAddress.requestFocus();
return false;
}
}
if (fldStatementEmailAddress.getText() != null) {
String fldMail = fldStatementEmailAddress.getText();
if (!CommonUtil.multipleEmailValidation(fldMail, null)) {
ClientApplicationContext.getClientApplicationContext().getMessageMgr()
.showMessage(this, "9950");
fldStatementEmailAddress.requestFocus();
return false;
}
}
}
return rtnFlag;
}
public void finalize() throws Throwable {
logger.debug("Memory being released: " + this);
super.finalize();
}
public boolean fClose() {
boolean parentReturn = true;
if (((FrmCM_CustMaint) getParentForm()).doUpdatesForArBranchesExist()) {
parentReturn = ((FrmCM_CustMaint) getParentForm()).fClose();
}
if (!parentReturn) {
return false;
}
removeGlobalReferences();
return true;
}
/**
* Set All Globals null except: No primitives (int, boolean) No constant renames (private
* TsoConstant TC); No agcdatas No final variables
*/
private void removeGlobalReferences() {
FM = null;
removeAllGUIComponents();
removeAllGUIComponentReferences();
}
private void removeAllGUIComponents() {
if (fldEmailInvoices != null)
remove(fldEmailInvoices);
if(fldUapCanadaEmailAddress!=null)
remove(fldUapCanadaEmailAddress);
if(fldStatementEmailAddress !=null)
remove(fldStatementEmailAddress);
}
private void removeAllGUIComponentReferences() {
lblEmailInvoices = null;
fldEmailInvoices = null;
lblUapCanadaEmailAddress = null;
fldUapCanadaEmailAddress = null;
lblDoNotSendEmailForDeliveryInvoices = null;
ckDoNotSendEmailForDeliveryInvoices = null;
lblDoNotSendEmailROAInvoices = null;
ckDoNotSendEmailROAInvoices = null;
lblSendEmailInvoiceCopies = null;
cbSendInvoiceCopiesOptions = null;
lblEmailIfPaidVia = null;
cbEmailIfPaidVia = null;
lblStatementEmailAddress = null;
fldStatementEmailAddress = null;
recInvoiceEmailInfo = null;
recStatementEmailInfo = null;
}
public void focusGained(FocusEvent focusEvent) {
}
public void focusLost(FocusEvent focusEvent) {
Object src = focusEvent.getSource();
}
public Object ag_getValue(DataCursor cursor, int valueID, Object param1, Object param2) {
try {
switch (valueID) {
case 0:
/* agcCustomer.ID */
return ((Integer) cursor.getProperty(0));
case 1:
/* agcCustomer.LOC */
return ((Integer) cursor.getProperty(1));
case 2:
/* agcCustomer.CUSTOMER_NUM */
return ((Integer) cursor.getProperty(2));
case 3:
/* agcCustomer.INVOICE_EMAIL_ADDRESS */
return ((String) cursor.getProperty(3));
case 4:
/* agcCustomer.INVOICE_EMAIL_ADDRESS */
return ((String) cursor.getProperty(4));
case 5:
/* agcCustomer.SEND_INVOICE_EMAIL_AFTER_DELIVERY */
return ((String) cursor.getProperty(5));
case 6:
/* agcCustomer.DO_NOT_EMAIL_ROA_INVOICE */
return ((String) cursor.getProperty(6));
case 7:
/* agcCustomer.REF_EMAIL_INVOICE_DELIVERY_OPTIONS_ID */
return (Byte) cursor.getProperty(7);
case 8:
/* agcCustomer.EMAIL_INVOICE_TENDER_VIA */
return((String) cursor.getProperty(8));
case 9:
/* agcCustomerAR.ID */
return ((String) cursor.getProperty(0));
case 10:
/* agcCustomerAR.LOC */
return ((String) cursor.getProperty(1));
case 11:
/* agcCustomerAR.STATEMENT_EMAIL_ADDRESS */
return ((String) cursor.getProperty(2));
default:
return null;
}
} catch (Throwable e) {
return null;
}
}
protected void addExpDependencies() {
}
public void actionPerformed(ActionEvent evt) {
Object src = evt.getSource();
super.actionPerformed(evt);
}
public void valueChanged(AgoPropertyChangeEvent evt) {
Object src = evt.getSource();
}
public void validationTest(AgoPropertyChangeEvent evt) throws AgoValidationException {
}
public void validationFailed(AgoPropertyChangeEvent evt) throws AgoValidationException {
}
private boolean isGPCOwned() {
LockableBoolean gpc = ClientApplicationContext.getClientApplicationContext()
.getProfile(Profile.BACKOFFICE_CLIENT,
ClientApplicationContext.getClientApplicationContext().getLocation())
.getStoreProfile().getGpcOwned();
return (gpc.byteValue() == 1 || gpc.byteValue() == 11);
}
private boolean isConsolidatedARMSBranchStore() {
return MSHelper.getInstance().isConsolidatedARMSBranchStore(Profile.BACKOFFICE_CLIENT,
ClientApplicationContext.getClientApplicationContext().getLocation());
}
private boolean isMSStore() {
return MSHelper.getInstance().isMSStore(Profile.BACKOFFICE_CLIENT,
ClientApplicationContext.getClientApplicationContext().getLocation());
}
private boolean isARBranchStore() {
return MSHelper.getInstance().isARBranchStore(Profile.BACKOFFICE_CLIENT,
ClientApplicationContext.getClientApplicationContext().getLocation());
}
private void buildAndFireArUpdate(Integer customerNum, CustomerRequest.CustomerAction action,
String customerName) {
if (((FrmCM_CustMaint) getParentForm()).isArMainWithBranches()) {
((FrmCM_CustMaint) this.getParentForm()).transactionAdded(customerNum, customerName,
action);
}
}
/**
* This method checks for whether Core Tracking functionality is activated or not.
*
* @return a boolean indicator whether Core Tracking functionality is activated or not.
*/
private boolean isCoreBankInUse() {
ClientApplicationContext clientApplicationContext = ClientApplicationContext
.getClientApplicationContext();
InvoicingProfileVO invoicingProfileVO = clientApplicationContext
.getProfile(Profile.BACKOFFICE_CLIENT, clientApplicationContext.getLocation())
.getInvoicingProfile();
return invoicingProfileVO.getCoreBankInUse().booleanValue();
}
/**
* Make the email address field editable in view mode.
*/
private void setEmailEditableInViewMode() {
boolean gpcOwned = isGPCOwned();
boolean arBranchStore = isARBranchStore();
String storeType = arvo.getRefArStoreTypeCd();
boolean isRegularCustomer = true;// !m_CustomerType.equals(RefCustomerType.RETAIL_ACCOUNT);
ARStatementMonitorVO arStmtMonitorVO = getARStatementMonitor();
if ((arStmtMonitorVO != null && arStmtMonitorVO.getStatementClosingDate() != null)
|| gpcOwned || !isRegularCustomer
|| (arBranchStore && storeType.equals(RefArStoreType.BRANCH))) {
StoreProfileVO storeProfileVO = ClientApplicationContext.getClientApplicationContext()
.getProfile(Profile.BACKOFFICE_CLIENT,
ClientApplicationContext.getClientApplicationContext().getLocation())
.getStoreProfile();
if (storeProfileVO.getUseEmailCustomer() != null
&& storeProfileVO.getUseEmailCustomer().equals(TsoConstant.GENERIC_Y)) {
FM.setHandleButtonStates(false);
FM.setMode(FwoFormMaster.VIEW_MODE);
FM.setSave(true);
FM.setDelete(false);
FM.setCancel(true);
FM.setNew(false);
FM.setEdit(false);
fldEmailInvoices.setEnabled(FM.canEdit());
fldUapCanadaEmailAddress.setEnabled(FM.canEdit());
fldStatementEmailAddress.setEnabled(FM.canEdit());
FM.formActivate();
}
}
}
@Override
public boolean fValidateJTableCell(FwoJTableMgr a_tbl_mgr, int row, int column) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean fValidateJTableRow(FwoJTableMgr a_tbl_mgr, int row) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean fNeedsUpdate() {
return (agcCustomer.haveRowsChanged() || agcCustomerAR.haveRowsChanged());
}
private void fillSendEmailInvoiceCopiesCombos(boolean forcefill) {
logger.debug("fillSendEmailInvoiceCopiesCombos :: " + forcefill);
if (forcefill) {
m_cacheMgr.fillComponent(cbSendInvoiceCopiesOptions,
TsoConstant.LIST_REF_EMAIL_INVOICE_DELIVERY_OPTIONS);
// don't visible below 3 option until it implements its functionality.
cbSendInvoiceCopiesOptions.removeItemAt(3); // End Of Week
cbSendInvoiceCopiesOptions.removeItemAt(2); //EOD
cbSendInvoiceCopiesOptions.removeItemAt(0); //Never
m_cacheMgr.fillComponent(cbEmailIfPaidVia, TsoConstant.LIST_REF_BILLING_TYPE);
cbEmailIfPaidVia.removeItemAt(3);
}
}
}