Search in sources :

Example 1 with MBPartnerInfo

use of org.compiere.model.MBPartnerInfo in project adempiere by adempiere.

the class WPOSDocumentPanel method findBPartner.

/**
	 * 	Find/Set BPartner
	 */
private void findBPartner() {
    String query = bPartnerName.getText();
    //	
    if (query == null || query.length() == 0)
        return;
    // unchanged
    if (posPanel.hasBPartner() && posPanel.compareBPName(query))
        return;
    query = query.toUpperCase();
    //	Test Number
    boolean allNumber = true;
    boolean noNumber = true;
    char[] qq = query.toCharArray();
    for (int i = 0; i < qq.length; i++) {
        if (Character.isDigit(qq[i])) {
            noNumber = false;
            break;
        }
    }
    try {
        Integer.parseInt(query);
    } catch (Exception e) {
        allNumber = false;
    }
    String value = query;
    String taxId = query;
    String name = (allNumber ? null : query);
    String name2 = (allNumber ? null : query);
    String contact = (allNumber ? null : query);
    String eMail = (query.indexOf('@') != -1 ? query : null);
    String phone = (noNumber ? null : query);
    String city = null;
    //
    MBPartnerInfo[] results = MBPartnerInfo.find(ctx, value, taxId, contact, name, name2, eMail, phone, city);
    //	Set Result
    if (results.length == 1) {
        MBPartner bp = MBPartner.get(ctx, results[0].getC_BPartner_ID());
        posPanel.configureBPartner(bp.getC_BPartner_ID());
        bPartnerName.setText(bp.getName() + "");
    } else {
        //	more than one
        changeBusinessPartner(results);
    }
    //	Default return
    posPanel.refreshPanel();
    return;
}
Also used : MBPartnerInfo(org.compiere.model.MBPartnerInfo) MBPartner(org.compiere.model.MBPartner)

Example 2 with MBPartnerInfo

use of org.compiere.model.MBPartnerInfo in project adempiere by adempiere.

the class POSDocumentPanel method findBPartner.

/**
	 * 	Find/Set BPartner
	 */
private void findBPartner() {
    String query = fieldPartnerName.getText();
    //	
    if (query == null || query.length() == 0)
        return;
    // unchanged
    if (posPanel.hasBPartner() && posPanel.compareBPName(query))
        return;
    query = query.toUpperCase();
    //	Test Number
    boolean allNumber = true;
    boolean noNumber = true;
    char[] qq = query.toCharArray();
    for (int i = 0; i < qq.length; i++) {
        if (Character.isDigit(qq[i])) {
            noNumber = false;
            break;
        }
    }
    try {
        Integer.parseInt(query);
    } catch (Exception e) {
        allNumber = false;
    }
    String value = query;
    String taxId = query;
    String name = (allNumber ? null : query);
    String name2 = (allNumber ? null : query);
    String contact = (allNumber ? null : query);
    String eMail = (query.indexOf('@') != -1 ? query : null);
    String phone = (noNumber ? null : query);
    String city = null;
    //
    MBPartnerInfo[] results = MBPartnerInfo.find(ctx, value, taxId, name, name2, contact, eMail, phone, city);
    //	Set Result
    if (results.length == 1) {
        MBPartner bp = MBPartner.get(ctx, results[0].getC_BPartner_ID());
        posPanel.configureBPartner(bp.getC_BPartner_ID());
        fieldPartnerName.setText(bp.getName());
    } else {
        //	more than one
        changeBusinessPartner(results);
    }
    //	Default return
    posPanel.refreshPanel();
    return;
}
Also used : MBPartnerInfo(org.compiere.model.MBPartnerInfo) MBPartner(org.compiere.model.MBPartner)

Aggregations

MBPartner (org.compiere.model.MBPartner)2 MBPartnerInfo (org.compiere.model.MBPartnerInfo)2