SOURCE

//

//五金:
订单统计.数量1 = 0;//五金
订单统计.数量2 = 0;//设计费 
订单统计.数量3 = 0;//安装费 
订单统计.数量4 = 0;// 运输费
订单统计.数量5 = 0;// 税金
订单统计.数量6 = 0;// 费用附加
订单统计.数量7 = 0;// 软装
订单统计.数量8 = 0;// 免漆产品
订单统计.数量9 = 0;// 油漆房门
订单统计.数量10 = 0;// 铝门产品
订单统计.数量11 = 0;// 家居饰面
订单统计.数量12 = 0;// 费用附加
function 五金(dtl) {
    //五金:
    var prdName = dtl.prdName == null ? "" : dtl.prdName;
    var prdSpc = dtl.prdSpc == null ? "" : dtl.prdSpc;
    var prdType = dtl.prdType;
    var matName = dtl.matName == null ? "" : dtl.matName;
    var clsId = @订单主表.clsId;
    var res = false;
    if (prdType == 5 || (prdType == 6 && (prdName == "五金" || prdSpc == "五金"))) {
        res = true;
    }
    return res;
}
function 设计费(dtl) {
    return dtl.prdType == 6 && (dtl.prdName == "设计费" || dtl.prdSpc == "设计费")
}
function 安装费(dtl) {
    return dtl.prdType == 6 && (dtl.prdName == "安装费" || dtl.prdSpc == "安装费")
}
function 运输费(dtl) {
    return dtl.prdType == 6 && (dtl.prdName == "运输费" || dtl.prdSpc == "运输费")
}
function 税金(dtl) {
    return dtl.prdType == 6 && (dtl.prdName == "税金" || dtl.prdSpc == "税金")
}
function 费用附加(dtl) {
    return dtl.prdType == 6 && (dtl.prdName == "费用附加" || dtl.prdSpc == "费用附加")
}
function 软装(dtl) {
    return dtl.prdType == 6 && (dtl.prdName == "软装" || dtl.prdSpc == "软装")
}
function 免漆产品(dtl) {
    ////免漆:
    var prdName = dtl.prdName == null ? "" : dtl.prdName;
    var prdSpc = dtl.prdSpc == null ? "" : dtl.prdSpc;
    var prdType = dtl.prdType;
    var matName = dtl.matName == null ? "" : dtl.matName;
    var clsId = @订单主表.clsId;
    var res = false;
    if ((clsId == 425 || clsId == 276) && matName != "" &&
        (prdType != 6 || prdType != 5) &&
        (matName.indexOf("多层板") > -1 || matName.indexOf("颗粒板") > -1
            || matName.indexOf("欧松板") > -1 || matName.indexOf("UV") > -1
            || matName.indexOf("PET") > -1 || matName.indexOf("吸塑") > -1
            || matName.indexOf("皮革") > -1 || matName.indexOf("岩板") > -1)) {
        res = true;
    }
    return res;


}
function 油漆房门(dtl) {
    //油漆房门:
    var prdName = dtl.prdName == null ? "" : dtl.prdName;
    var prdSpc = dtl.prdSpc == null ? "" : dtl.prdSpc;
    var prdType = dtl.prdType;
    var matName = dtl.matName == null ? "" : dtl.matName;
    var clsId = @订单主表.clsId;
    var res = false;
    if (prdType == 8 && matName != "" &&
        (matName.indexOf("多层板") == -1 || matName.indexOf("颗粒板") == -1 || matName.indexOf("欧松板") == -1 || matName.indexOf("UV") == -1
            || matName.indexOf("PET") == -1 || matName.indexOf("吸塑") == -1 || matName.indexOf("皮革") == -1 || matName.indexOf("岩板") == -1)) {
        res = true;
    }
    return res;
}

function 铝门产品(dtl) {
    //铝门产品:
    var prdName = dtl.prdName == null ? "" : dtl.prdName;
    var prdSpc = dtl.prdSpc == null ? "" : dtl.prdSpc;
    var prdType = dtl.prdType;
    var matName = dtl.matName == null ? "" : dtl.matName;
    var clsId = @订单主表.clsId;
    var res = false;
    if (((clsId == 425 || clsId == 276) && matName.indexOf("铝门产品") > -1) && (prdType != 6 || prdType != 5 || prdType != 8)) {
        res = true;
    }
    return res;
}
function 家居饰面(dtl) {
    var prdName = dtl.prdName == null ? "" : dtl.prdName;
    var prdSpc = dtl.prdSpc == null ? "" : dtl.prdSpc;
    var prdType = dtl.prdType;
    var matName = dtl.matName == null ? "" : dtl.matName;
    var clsId = @订单主表.clsId;
    var res = true;

    //排除报价辅助产品 / 五金产品 // 房门产品 :
    if (dtl.prdId <= 0 || prdType == 6 || prdType == 5 || prdType == 8) {
        res = false;
    } else if (((clsId == 425 || clsId == 276) && matName.indexOf("铝门产品") > -1) && (prdType != 6 || prdType != 5 || prdType != 8)) {
        res = false; //排除铝门产品
    } else if ((clsId == 425 || clsId == 276) && matName != "" &&
        (matName.indexOf("多层板") > -1 || matName.indexOf("颗粒板") > -1 || matName.indexOf("欧松板") > -1 || matName.indexOf("UV") > -1
            || matName.indexOf("PET") > -1 || matName.indexOf("吸塑") > -1 || matName.indexOf("皮革") > -1 || matName.indexOf("岩板") > -1)
    ) {
        res = false; //排除免漆产品
    }

    //返回结果
    return res;
}
function 费用附加(dtl) {
    //费用附加:
    var prdName = dtl.prdName == null ? "" : dtl.prdName;
    var prdSpc = dtl.prdSpc == null ? "" : dtl.prdSpc;
    var prdType = dtl.prdType;
    var matName = dtl.matName == null ? "" : dtl.matName;
    var clsId = @订单主表.clsId;
    var res = false;
    if (prdType == 6 && (prdName == "费用附加" || prdSpc == "费用附加")) {
        res = true;
    }
    return res;
}


for (var i = 0; i < dtl.length; i++) {
    var dtl = dtl[i];
    var amt = dtl.amt == null ? 0 : dtl.amt;
    if (五金(dtl) == true) {
        订单统计.数量1 = 订单统计.数量1 + amt;
    }
    if (设计费(dtl) == true) {
        订单统计.数量2 = 订单统计.数量2 + amt;
    }
    if (安装费(dtl) == true) {
        订单统计.数量3 = 订单统计.数量3 + amt;
    }
    if (运输费(dtl) == true) {
        订单统计.数量4 = 订单统计.数量4 + amt;
    }
    if (税金(dtl) == true) {
        订单统计.数量5 = 订单统计.数量5 + amt;
    }
    if (费用附加(dtl) == true) {
        订单统计.数量6 = 订单统计.数量6 + amt;
    }
    if (软装(dtl) == true) {
        订单统计.数量7 = 订单统计.数量7 + amt;
    }
    if (免漆产品(dtl) == true) {
        订单统计.数量8 = 订单统计.数量8 + amt;
    }
     if (油漆房门(dtl) == true) {
        订单统计.数量9= 订单统计.数量9 + amt;
    }
     if (铝门产品(dtl) == true) {
        订单统计.数量10= 订单统计.数量10 + amt;
    }
     if (家居饰面(dtl) == true) {
        订单统计.数量11= 订单统计.数量11 + amt;
    }
}
console 命令行工具 X clear

                    
>
console