Thắng Trương
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.

Go down
avatar
Admin
Admin
Tổng số bài gửi : 1562
Join date : 20/05/2018
https://thangcrm2.forumvi.com

[Javascript] Nhập field phuongxa, xuất field quận huyện, tỉnh thành, quốc gia đã lookup từ trước Empty [Javascript] Nhập field phuongxa, xuất field quận huyện, tỉnh thành, quốc gia đã lookup từ trước

Mon Jun 11, 2018 10:06 am
Code:
/******************************************************************************************
VERSION     KEY                 NAME            DESCRIPTION
---------    ------------         -------------  --------------------
08062018                    ThangTCQ      Filter Địa chỉ theo quốc gia, tỉnh thành, quận huyện, phường xã, số nhà
******************************************************************************************/

function KhachhangDoanhnghiep_setDiachi() {
    /*Input: quốc gia, tỉnh thành, quận huyện, phường xã, số nhà
    Output: địa chỉ*/
    if (Xrm.Page.getAttribute("new_quocgia").getValue() != null) {
        var quocgia = Xrm.Page.getAttribute("new_quocgia").getValue()[0].name;
    } else if (Xrm.Page.getAttribute("new_tinhthanh").getValue() == null) {
        var quocgia = "";
    }

    if (Xrm.Page.getAttribute("new_tinhthanh").getValue() != null) {
        var tinhthanh = Xrm.Page.getAttribute("new_tinhthanh").getValue()[0].name + ", ";
    } else if (Xrm.Page.getAttribute("new_tinhthanh").getValue() == null) {
        var tinhthanh = "";
    }

    if (Xrm.Page.getAttribute("new_quanhuyen").getValue() != null) {
        var quanhuyen = Xrm.Page.getAttribute("new_quanhuyen").getValue()[0].name + ", ";
    } else if (Xrm.Page.getAttribute("new_quanhuyen").getValue() == null) {
        var quanhuyen = "";
    }

    if (Xrm.Page.getAttribute("new_phuongxa").getValue() != null) {
        var phuongxa = Xrm.Page.getAttribute("new_phuongxa").getValue()[0].name + ", ";
    } else if (Xrm.Page.getAttribute("new_phuongxa").getValue() == null) {
        var phuongxa = "";
    }

    if (Xrm.Page.getAttribute("new_sonha").getValue() != null) {
        var sonha = Xrm.Page.getAttribute("new_sonha").getValue() + ", ";
    } else if (Xrm.Page.getAttribute("new_sonha").getValue() == null) {
        var sonha = "";
    }

    var diachi = sonha + phuongxa + quanhuyen + tinhthanh + quocgia;
    Xrm.Page.getAttribute("new_diachi").setValue(diachi);
};

/* --------------------------------------------------------------- */
/* -------------------- Lấy dữ liệu phường xã -------------------- */
/* --------------------------------------------------------------- */

function KhachhangDoanhnghiep_getPhuongXa_setQuanHuyen() {
    /*Input: phường xã
    Output: quận huyện*/

    // Lấy dữ liệu field new_phuongxa
    if (Xrm.Page.getAttribute("new_phuongxa").getValue() != null) {
        var req = new XMLHttpRequest();
        var clientUrl = Xrm.Page.context.getClientUrl();
        var _getPhuongXa = Xrm.Page.getAttribute("new_phuongxa").getValue()[0].id;
        var _lenPhuongXa = _getPhuongXa.length;
        var _resPhuongXa = _getPhuongXa.slice(1, _lenPhuongXa - 1);
        var _getUrlPhuongXa = clientUrl + "/api/data/v9.0/new_phuongxas(" + _resPhuongXa + ")";
        req.open("GET", encodeURI(_getUrlPhuongXa), true);
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
        req.setRequestHeader("Access-Control-Allow-Origin", "*");
        req.onreadystatechange = function () {
            var object = JSON.parse(this.response);

            // Gán dữ liệu field new_quanhuyen
            var _getIdQuanHuyen = object._new_quanhuyen_value;
            var _getUrlQuanHuyen = clientUrl + "/api/data/v9.0/new_quanhuyens(" + _getIdQuanHuyen + ")";
            req.open("GET", encodeURI(_getUrlQuanHuyen), true);
            req.onreadystatechange = function () {
                var _objectQuanHuyen = JSON.parse(this.response);
                var _setLookupQuanHuyen = new Array();
                _setLookupQuanHuyen[0] = new Object();
                _setLookupQuanHuyen[0].id = _getIdQuanHuyen;
                _setLookupQuanHuyen[0].name = _objectQuanHuyen.new_name;
                _setLookupQuanHuyen[0].entityType = "new_quanhuyen";
                Xrm.Page.getAttribute("new_quanhuyen").setValue(_setLookupQuanHuyen);
               
                Xrm.Page.getControl("new_quanhuyen").setDisabled(true);
                Xrm.Page.getControl("new_tinhthanh").setDisabled(true);
                Xrm.Page.getControl("new_quocgia").setDisabled(true);
                KhachhangDoanhnghiep_setDiachi();
            };
            req.send(null);
        };
        req.send(null);

    } else if (Xrm.Page.getAttribute("new_phuongxa").getValue() == null) {
        Xrm.Page.getControl("new_quanhuyen").setDisabled(false);
        Xrm.Page.getControl("new_tinhthanh").setDisabled(false);
        Xrm.Page.getControl("new_quocgia").setDisabled(false);
    }
}

function KhachhangDoanhnghiep_getPhuongXa_setTinhThanh() {
    /*Input: phường xã
    Output: tỉnh thành*/

    // Lấy dữ liệu field new_phuongxa
    if (Xrm.Page.getAttribute("new_phuongxa").getValue() != null) {
        var req = new XMLHttpRequest();
        var clientUrl = Xrm.Page.context.getClientUrl();
        var _getPhuongXa = Xrm.Page.getAttribute("new_phuongxa").getValue()[0].id;
        var _lenPhuongXa = _getPhuongXa.length;
        var _resPhuongXa = _getPhuongXa.slice(1, _lenPhuongXa - 1);
        var _getUrlPhuongXa = clientUrl + "/api/data/v9.0/new_phuongxas(" + _resPhuongXa + ")";
        req.open("GET", encodeURI(_getUrlPhuongXa), true);
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
        req.setRequestHeader("Access-Control-Allow-Origin", "*");
        req.onreadystatechange = function () {
            var object = JSON.parse(this.response);

            // Gán dữ liệu field new_tinhthanh
            var _getIdTinhThanh = object._new_tinhthanh_value;
            var _getUrlTinhThanh = clientUrl + "/api/data/v9.0/new_tinhthanhs(" + _getIdTinhThanh + ")";
            req.open("GET", encodeURI(_getUrlTinhThanh), true);
            req.onreadystatechange = function () {
                var _objectTinhThanh = JSON.parse(this.response);
                var _setLookupTinhThanh = new Array();
                _setLookupTinhThanh[0] = new Object();
                _setLookupTinhThanh[0].id = _getIdTinhThanh;
                _setLookupTinhThanh[0].name = _objectTinhThanh.new_name;
                _setLookupTinhThanh[0].entityType = "new_tinhthanh";
                Xrm.Page.getAttribute("new_tinhthanh").setValue(_setLookupTinhThanh);

                Xrm.Page.getControl("new_quanhuyen").setDisabled(true);
                Xrm.Page.getControl("new_tinhthanh").setDisabled(true);
                Xrm.Page.getControl("new_quocgia").setDisabled(true);
                KhachhangDoanhnghiep_setDiachi();
            };
            req.send(null);

        };
        req.send(null);
    } else if (Xrm.Page.getAttribute("new_phuongxa").getValue() == null) {
        Xrm.Page.getControl("new_quanhuyen").setDisabled(false);
        Xrm.Page.getControl("new_tinhthanh").setDisabled(false);
        Xrm.Page.getControl("new_quocgia").setDisabled(false);
    }
}

function KhachhangDoanhnghiep_getPhuongXa_setQuocGia() {
    /*Input: phường xã
    Output: quốc gia*/

    // Lấy dữ liệu field new_phuongxa
    if (Xrm.Page.getAttribute("new_phuongxa").getValue() != null) {
        var req = new XMLHttpRequest();
        var clientUrl = Xrm.Page.context.getClientUrl();
        var _getPhuongXa = Xrm.Page.getAttribute("new_phuongxa").getValue()[0].id;
        var _lenPhuongXa = _getPhuongXa.length;
        var _resPhuongXa = _getPhuongXa.slice(1, _lenPhuongXa - 1);
        var _getUrlPhuongXa = clientUrl + "/api/data/v9.0/new_phuongxas(" + _resPhuongXa + ")";
        req.open("GET", encodeURI(_getUrlPhuongXa), true);
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
        req.setRequestHeader("Access-Control-Allow-Origin", "*");
        req.onreadystatechange = function () {
            var object = JSON.parse(this.response);

            // Gán dữ liệu field new_quocgia
            var _getIdQuocGia = object._new_quocgia_value;
            var _getUrlQuocGia = clientUrl + "/api/data/v9.0/new_quocgias(" + _getIdQuocGia + ")";
            req.open("GET", encodeURI(_getUrlQuocGia), true);
            req.onreadystatechange = function () {
                var _objectQuocGia = JSON.parse(this.response);
                var _setLookupQuocGia = new Array();
                _setLookupQuocGia[0] = new Object();
                _setLookupQuocGia[0].id = _getIdQuocGia;
                _setLookupQuocGia[0].name = _objectQuocGia.new_name;
                _setLookupQuocGia[0].entityType = "new_quocgia";
                Xrm.Page.getAttribute("new_quocgia").setValue(_setLookupQuocGia);

                Xrm.Page.getControl("new_quanhuyen").setDisabled(true);
                Xrm.Page.getControl("new_tinhthanh").setDisabled(true);
                Xrm.Page.getControl("new_quocgia").setDisabled(true);
                KhachhangDoanhnghiep_setDiachi();
            };
            req.send(null);

        };
        req.send(null);
    } else if (Xrm.Page.getAttribute("new_phuongxa").getValue() == null) {
        Xrm.Page.getControl("new_quanhuyen").setDisabled(false);
        Xrm.Page.getControl("new_tinhthanh").setDisabled(false);
        Xrm.Page.getControl("new_quocgia").setDisabled(false);
    }
}

/* ---------------------------------------------------------------- */
/* -------------------- Lấy dữ liệu quận huyện -------------------- */
/* ---------------------------------------------------------------- */

function KhachhangDoanhnghiep_getQuanHuyen_setTinhThanh() {
    /*Input: quận huyện
    Output: tỉnh thành*/

    // Lấy dữ liệu field new_quanhuyen
    if (Xrm.Page.getAttribute("new_quanhuyen").getValue() != null) {
        var req = new XMLHttpRequest();
        var clientUrl = Xrm.Page.context.getClientUrl();
        var _getQuanHuyen = Xrm.Page.getAttribute("new_quanhuyen").getValue()[0].id;
        var _lenQuanHuyen = _getQuanHuyen.length;
        var _resQuanHuyen = _getQuanHuyen.slice(1, _lenQuanHuyen - 1);
        var _getUrlQuanHuyen = clientUrl + "/api/data/v9.0/new_quanhuyens(" + _resQuanHuyen + ")";
        req.open("GET", encodeURI(_getUrlQuanHuyen), true);
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
        req.setRequestHeader("Access-Control-Allow-Origin", "*");
        req.onreadystatechange = function () {
            var object = JSON.parse(this.response);

            // Gán dữ liệu field new_tinhthanh
            var _getIdTinhThanh = object._new_tinhthanh_value;
            var _getUrlTinhThanh = clientUrl + "/api/data/v9.0/new_tinhthanhs(" + _getIdTinhThanh + ")";
            req.open("GET", encodeURI(_getUrlTinhThanh), true);
            req.onreadystatechange = function () {
                var _objectTinhThanh = JSON.parse(this.response);
                var _setLookupTinhThanh = new Array();
                _setLookupTinhThanh[0] = new Object();
                _setLookupTinhThanh[0].id = _getIdTinhThanh;
                _setLookupTinhThanh[0].name = _objectTinhThanh.new_name;
                _setLookupTinhThanh[0].entityType = "new_tinhthanh";
                Xrm.Page.getAttribute("new_tinhthanh").setValue(_setLookupTinhThanh);

                Xrm.Page.getControl("new_tinhthanh").setDisabled(true);
                Xrm.Page.getControl("new_quocgia").setDisabled(true);
                KhachhangDoanhnghiep_setDiachi();
            };
            req.send(null);

        };
        req.send(null);
    } else if (Xrm.Page.getAttribute("new_quanhuyen").getValue() == null) {
        Xrm.Page.getControl("new_tinhthanh").setDisabled(false);
        Xrm.Page.getControl("new_quocgia").setDisabled(false);
    }
}

function KhachhangDoanhnghiep_getQuanHuyen_setQuocGia() {
    /*Input: quận huyện
    Output: quốc gia*/

    // Lấy dữ liệu field new_quanhuyen
    if (Xrm.Page.getAttribute("new_quanhuyen").getValue() != null) {
        var req = new XMLHttpRequest();
        var clientUrl = Xrm.Page.context.getClientUrl();
        var _getQuanHuyen = Xrm.Page.getAttribute("new_quanhuyen").getValue()[0].id;
        var _lenQuanHuyen = _getQuanHuyen.length;
        var _resQuanHuyen = _getQuanHuyen.slice(1, _lenQuanHuyen - 1);
        var _getUrlQuanHuyen = clientUrl + "/api/data/v9.0/new_quanhuyens(" + _resQuanHuyen + ")";
        req.open("GET", encodeURI(_getUrlQuanHuyen), true);
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
        req.setRequestHeader("Access-Control-Allow-Origin", "*");
        req.onreadystatechange = function () {
            var object = JSON.parse(this.response);

            // Gán dữ liệu field new_quocgia
            var _getIdQuocGia = object._new_quocgia_value;
            var _getUrlQuocGia = clientUrl + "/api/data/v9.0/new_quocgias(" + _getIdQuocGia + ")";
            req.open("GET", encodeURI(_getUrlQuocGia), true);
            req.onreadystatechange = function () {
                var _objectQuocGia = JSON.parse(this.response);
                var _setLookupQuocGia = new Array();
                _setLookupQuocGia[0] = new Object();
                _setLookupQuocGia[0].id = _getIdQuocGia;
                _setLookupQuocGia[0].name = _objectQuocGia.new_name;
                _setLookupQuocGia[0].entityType = "new_quocgia";
                Xrm.Page.getAttribute("new_quocgia").setValue(_setLookupQuocGia);

                Xrm.Page.getControl("new_tinhthanh").setDisabled(true);
                Xrm.Page.getControl("new_quocgia").setDisabled(true);
                KhachhangDoanhnghiep_setDiachi();
            };
            req.send(null);

        };
        req.send(null);
    } else if (Xrm.Page.getAttribute("new_quanhuyen").getValue() == null) {
        Xrm.Page.getControl("new_tinhthanh").setDisabled(false);
        Xrm.Page.getControl("new_quocgia").setDisabled(false);
    }
}

/* ---------------------------------------------------------------- */
/* -------------------- Lấy dữ liệu tỉnh thành -------------------- */
/* ---------------------------------------------------------------- */

function KhachhangDoanhnghiep_getTinhThanh_setQuocGia() {
    /*Input: phường xã
    Output: quốc gia*/

    // Lấy dữ liệu field new_tinhthanh
    if (Xrm.Page.getAttribute("new_tinhthanh").getValue() != null) {
        var req = new XMLHttpRequest();
        var clientUrl = Xrm.Page.context.getClientUrl();
        var _getTinhThanh = Xrm.Page.getAttribute("new_tinhthanh").getValue()[0].id;
        var _lenTinhThanh = _getTinhThanh.length;
        var _resTinhThanh = _getTinhThanh.slice(1, _lenTinhThanh - 1);
        var _getUrlTinhThanh = clientUrl + "/api/data/v9.0/new_tinhthanhs(" + _resTinhThanh + ")";
        req.open("GET", encodeURI(_getUrlTinhThanh), true);
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
        req.setRequestHeader("Access-Control-Allow-Origin", "*");
        req.onreadystatechange = function () {
            var object = JSON.parse(this.response);

            // Gán dữ liệu field new_quocgia
            var _getIdQuocGia = object._new_quocgia_value;
            var _getUrlQuocGia = clientUrl + "/api/data/v9.0/new_quocgias(" + _getIdQuocGia + ")";
            req.open("GET", encodeURI(_getUrlQuocGia), true);
            req.onreadystatechange = function () {
                var _objectQuocGia = JSON.parse(this.response);
                var _setLookupQuocGia = new Array();
                _setLookupQuocGia[0] = new Object();
                _setLookupQuocGia[0].id = _getIdQuocGia;
                _setLookupQuocGia[0].name = _objectQuocGia.new_name;
                _setLookupQuocGia[0].entityType = "new_quocgia";
                Xrm.Page.getAttribute("new_quocgia").setValue(_setLookupQuocGia);

                Xrm.Page.getControl("new_tinhthanh").setDisabled(true);
                KhachhangDoanhnghiep_setDiachi();
            };
            req.send(null);

        };
        req.send(null);
    } else if (Xrm.Page.getAttribute("new_tinhthanh").getValue() == null) {
        Xrm.Page.getControl("new_tinhthanh").setDisabled(false);
    }
}

Yêu cầu:

- Nhập phường xã, xuất thông tin quận huyện, tỉnh thành, quốc gia

- Nhập phường xã, quận huyện, tỉnh thành, quốc gia, số nhà xuất địa chỉ

[Javascript] Nhập field phuongxa, xuất field quận huyện, tỉnh thành, quốc gia đã lookup từ trước Untitledf97d1d5266b7e755

[Javascript] Nhập field phuongxa, xuất field quận huyện, tỉnh thành, quốc gia đã lookup từ trước 123123123
avatar
Admin
Admin
Tổng số bài gửi : 1562
Join date : 20/05/2018
https://thangcrm2.forumvi.com

[Javascript] Nhập field phuongxa, xuất field quận huyện, tỉnh thành, quốc gia đã lookup từ trước Empty Re: [Javascript] Nhập field phuongxa, xuất field quận huyện, tỉnh thành, quốc gia đã lookup từ trước

Mon Jun 18, 2018 10:14 am
Code:
/******************************************************************************************
VERSION    KEY                NAME            DESCRIPTION
---------  ------------        -------------  --------------------
08062018                        ThangTCQ        Filter Địa chỉ theo quốc gia, tỉnh thành, quận huyện, phường xã, số nhà
******************************************************************************************/

/******************************************************************************************
--------------------------------- Lấy dữ liệu, gán địa chỉ --------------------------------
******************************************************************************************/

function KhachhangDoanhnghiep_setDiachi() {
    var quocgia = tinhthanh = quanhuyen = phuongxa = sonha = "";
    if (Xrm.Page.getAttribute("new_quocgia").getValue() != null) {
        quocgia = Xrm.Page.getAttribute("new_quocgia").getValue()[0].name;
    }
    if (Xrm.Page.getAttribute("new_tinhthanh").getValue() != null) {
        tinhthanh = Xrm.Page.getAttribute("new_tinhthanh").getValue()[0].name + ", ";
    }
    if (Xrm.Page.getAttribute("new_quanhuyen").getValue() != null) {
        quanhuyen = Xrm.Page.getAttribute("new_quanhuyen").getValue()[0].name + ", ";
    }
    if (Xrm.Page.getAttribute("new_phuongxa").getValue() != null) {
        phuongxa = Xrm.Page.getAttribute("new_phuongxa").getValue()[0].name + ", ";
    }
    if (Xrm.Page.getAttribute("new_sonha").getValue() != null) {
        sonha = Xrm.Page.getAttribute("new_sonha").getValue() + ", ";
    }
    var diachi = sonha + phuongxa + quanhuyen + tinhthanh + quocgia;
    Xrm.Page.getAttribute("new_diachi").setValue(diachi);
};

/******************************************************************************************
---------------------------------------- Lấy dữ liệu --------------------------------------
******************************************************************************************/

function getAPI(_stringAttribute, _stringEntityLookupLogicalName, _stringEntityLookupValue, _boolDisabledQuanHuyen, _boolDisabledTinhThanh, _boolDisabledQuocGia) {
    if (Xrm.Page.getAttribute(_stringAttribute).getValue() != null) {
        var req = new XMLHttpRequest();
        var clientUrl = Xrm.Page.context.getClientUrl();
        var id = Xrm.Page.getAttribute(_stringAttribute).getValue()[0].id;
        var res = id.slice(1, id.length - 1);
        var _getUrl = clientUrl + "/api/data/v9.0/" + _stringAttribute + "s(" + res + ")";
        req.open("GET", encodeURI(_getUrl), true);
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
        req.setRequestHeader("Access-Control-Allow-Origin", "*");
        req.onreadystatechange = function () {
            var object = JSON.parse(this.response);
            http://console.log(response);
            var _stringEntityLookupId = object[_stringEntityLookupValue];
            var _stringEntityLookupUrl = clientUrl + "/api/data/v9.0/" + _stringEntityLookupLogicalName + "s(" + _stringEntityLookupId + ")";
            alert(_stringEntityLookupUrl);
            req.open("GET", encodeURI(_stringEntityLookupUrl), true);
            req.onreadystatechange = function () {
                var _object = JSON.parse(this.response);
                var _setLookup = new Array();
                _setLookup[0] = new Object();
                _setLookup[0].id = _stringEntityLookupId;
                _setLookup[0].name = _object.new_name;
                _setLookup[0].entityType = _stringEntityLookupLogicalName;
                Xrm.Page.getAttribute(_stringEntityLookupLogicalName).setValue(_setLookup);

                Xrm.Page.getControl("new_quanhuyen").setDisabled(_boolDisabledQuanHuyen);
                Xrm.Page.getControl("new_tinhthanh").setDisabled(_boolDisabledQuocGia);
                Xrm.Page.getControl("new_quocgia").setDisabled(_boolDisabledTinhThanh);
            };
            req.send(null);
        };
        req.send(null);
    } else if (Xrm.Page.getAttribute(_stringAttribute).getValue() == null) {
        Xrm.Page.getControl("new_quanhuyen").setDisabled(false);
        Xrm.Page.getControl("new_tinhthanh").setDisabled(false);
        Xrm.Page.getControl("new_quocgia").setDisabled(false);
    }
}

/******************************************************************************************
---------------------------------- Lấy dữ liệu phường xã ----------------------------------
******************************************************************************************/

function KhachhangDoanhnghiep_getPhuongXa() {
    getAPI("new_phuongxa", "new_quanhuyen", "_new_quanhuyen_value", true, true, true);
    getAPI("new_phuongxa", "new_tinhthanh", "_new_tinhthanh_value", true, true, true);
    getAPI("new_phuongxa", "new_quocgia", "_new_quocgia_value", true, true, true);
    KhachhangDoanhnghiep_setDiachi();
}

/******************************************************************************************
---------------------------------- Lấy dữ liệu quận huyện ---------------------------------
******************************************************************************************/

function KhachhangDoanhnghiep_getQuanHuyen() {
    getAPI("new_quanhuyen", "new_tinhthanh", "_new_tinhthanh_value", true, true, true);
    getAPI("new_quanhuyen", "new_quocgia", "_new_quocgia_value", true, true, true);
    Xrm.Page.getAttribute("fso_phuongxa").setValue(null);
    KhachhangDoanhnghiep_setDiachi();
}

/******************************************************************************************
---------------------------------- Lấy dữ liệu tỉnh thành ---------------------------------
******************************************************************************************/

function KhachhangDoanhnghiep_getTinhThanh() {
    getAPI("new_tinhthanh", "new_quocgia", "_new_quocgia_value", true, true, true);
    Xrm.Page.getAttribute("fso_quanhuyen").setValue(null);
    Xrm.Page.getAttribute("fso_phuongxa").setValue(null);
    KhachhangDoanhnghiep_setDiachi();
}

/******************************************************************************************
----------------------------------- Lấy dữ liệu quốc gia ----------------------------------
******************************************************************************************/
function KhachhangDoanhnghiep_getQuocGia() {
    Xrm.Page.getAttribute("fso_tinhthanh").setValue(null);
    Xrm.Page.getAttribute("fso_quanhuyen").setValue(null);
    Xrm.Page.getAttribute("fso_phuongxa").setValue(null);
    KhachhangDoanhnghiep_setDiachi();
}

/******************************************************************************************
------------------------------------ Lấy dữ liệu số nhà -----------------------------------
******************************************************************************************/
function KhachhangDoanhnghiep_getSoNha() {
    KhachhangDoanhnghiep_setDiachi();
}
Về Đầu Trang
Permissions in this forum:
Bạn không có quyền trả lời bài viết