Задать вопрос
MaXComp
@MaXComp
интересуюсь frontend html+css+JS+php. Linux, C

Одна из функций кода не отрабатывает, хотя все сделано по аналогии, куда копать?

Функция PrintLQ_4x20 не работает. Все остальные отрабатывают как надо. Весь мозг взломан. Данный код пишу в плагине: Calculated Fields Form. Данные fieldname... получаю из формы. Код не красив, так как методы, свитч кейс и прочее прочее просто не работают в данной проге. Поэтому все по наипростейшему.

var LQ_base_8x8 = [
        [14, 28, 35, 43, 51, 56, 66, 73, 81, 88], [9, 12, 14, 17, 18, 18, 22, 24, 26, 28], [8, 11, 12, 15, 16, 15, 19, 20, 22, 24]
    ];
    var LQ_base_4x20 = [
        [17, 35, 44, 54, 64, 71, 82, 92, 101, 110], [11, 15, 18, 21, 23, 23, 28, 30, 32, 35], [10, 14, 16, 19, 20, 19, 23, 25, 27, 29]
    ];
    var LQ_base_10x10 = [
        [26, 52, 66, 81, 96, 106, 124, 138, 151, 165], [16, 23, 26, 31, 34, 34, 41, 45, 49, 52], [16, 20, 23, 28, 29, 29, 35, 38, 41, 44]
    ];
    var LQ_base_6x30 = [
        [35, 70, 88, 108, 127, 141, 165, 183, 202, 221], [22, 30, 35, 42, 45, 45, 55, 60, 65, 70], [21, 27, 31, 37, 39, 38, 47, 51, 55, 59]
    ];
    var LQ_base_8x40 = [
        [70, 139, 176, 216, 255, 282, 329, 367, 404, 441], [43, 60, 70, 84, 90, 90, 110, 120, 130, 140], [42, 55, 62, 74, 78, 76, 94, 102, 110, 118]
    ];
    var LQ_base_A4 = [
        [105, 209, 263, 324, 382, 423, 494, 550, 606, 662], [65, 91, 105, 126, 135, 135, 165, 180, 195, 209], [62, 82, 94, 112, 117, 114, 141, 153, 165, 176]
    ];
    var LQ_base_A3 = [
        [209, 418, 527, 647, 765, 846, 988, 1100, 1212, 1324], [130, 181, 210, 252, 271, 270, 330, 360, 389, 419], [125, 164, 187, 223, 235, 228, 282, 305, 329, 353]
    ];
    var HQ_base_8x8 = [
        [42, 49, 57, 64, 72, 79, 86, 94, 101, 108], [21, 22, 23, 24, 25, 26, 27, 28, 28, 29], [20, 21, 22, 22, 23, 24, 24, 25, 25, 25]
    ];
    var HQ_base_4x20 = [
        [53, 62, 71, 80, 89, 99, 108, 117, 126, 135], [27, 28, 29, 30, 32, 33, 34, 34, 35, 36], [26, 26, 27, 28, 29, 30, 30, 31, 31, 32]
    ];
    var HQ_base_10x10 = [
        [79, 93, 107, 120, 134, 148, 162, 176, 189, 203], [40, 41, 44, 45, 48, 49, 50, 52, 53, 54], [38, 39, 41, 42, 44, 44, 45, 46, 47, 47]
    ];
    var HQ_base_6x30 = [
        [105, 124, 142, 160, 179, 197, 216, 234, 252, 271], [53, 55, 58, 60, 64, 65, 67, 69, 71, 72], [51, 52, 55, 56, 58, 59, 60, 61, 62, 63]
    ];
    var HQ_base_8x40 = [
        [211, 247, 284, 321, 358, 395, 431, 468, 505, 542], [107, 110, 117, 121, 127, 131, 134, 138, 141, 145], [102, 104, 109, 111, 116, 119, 121, 123, 125, 126]
    ];
    var HQ_base_A4 = [
        [316, 371, 426, 481, 537, 592, 647, 702, 757, 813], [160, 165, 175, 181, 191, 196, 202, 207, 212, 217], [153, 156, 164, 167, 175, 178, 181, 184, 187, 190]
    ];
    var HQ_base_A3 = [
        [632, 742, 853, 963, 1073, 1184, 1294, 1404, 1515, 1625], [320, 331, 351, 362, 381, 392, 403, 414, 424, 434], [306, 313, 328, 334, 349, 356, 362, 368, 374, 379]
    ];

    var select_count_color = fieldname16;
    var formate_print = fieldname45;
    var quality = fieldname48;
    var opt1 = fieldname47;
    var price_product;
        var ed =
        + (fieldname54 || 0)
        + (fieldname51 || 0)
        + (fieldname55 || 0)
        + (fieldname58 || 0)
        + (fieldname60 || 0)
        + (fieldname62 || 0)
        + (fieldname61 || 0)
        + (fieldname65 || 0)
        + (fieldname64 || 0)
        + (fieldname63 || 0)
        + (fieldname68 || 0)
        + (fieldname67 || 0)
        + (fieldname66 || 0)
        + (fieldname72 || 0)
        + (fieldname71 || 0)
        + (fieldname70 || 0)
        + (fieldname75 || 0)
        + (fieldname76 || 0)
        + (fieldname74 || 0)
        + (fieldname80 || 0)
        + (fieldname79 || 0)
        + (fieldname78 || 0)
        ;

    if (quality == 'LQ' && formate_print == 1) PrintLQ_8x8();
    if (quality == 'LQ' && formate_print == 2) PrintLQ_4x20();
    if (quality == 'LQ' && formate_print == 3) PrintLQ_10x10();
    if (quality == 'LQ' && formate_print == 4) PrintLQ_6x30();
    if (quality == 'LQ' && formate_print == 5) PrintLQ_8x40();
    if (quality == 'LQ' && formate_print == 6) PrintLQ_A4();
    if (quality == 'LQ' && formate_print == 7) PrintLQ_A3();
    if (quality == 'HQ' && formate_print == 1) PrintHQ_8x8();
    if (quality == 'HQ' && formate_print == 2) PrintHQ_4x20();
    if (quality == 'HQ' && formate_print == 3) PrintHQ_10x10();
    if (quality == 'HQ' && formate_print == 4) PrintHQ_6x30();
    if (quality == 'HQ' && formate_print == 5) PrintHQ_8x40();
    if (quality == 'HQ' && formate_print == 6) PrintHQ_A4();
    if (quality == 'HQ' && formate_print == 7) PrintHQ_A3();
    function PrintLQ_8x8() {
        if (ed >= 150 && ed <= 1500) return price_product = LQ_base_8x8[0][select_count_color - 1] + opt1;
        if (ed >= 1500 && ed <= 7500) return price_product = LQ_base_8x8[1][select_count_color - 1] + opt1;
        if (ed >= 7500) return price_product = LQ_base[2][select_count_color - 1] + opt1;
    }
    function PrintLQ_4x20() {
        if (ed >= 150 && ed <= 1200) return price_product = LQ_base_4x20[0][select_count_color - 1] + opt1;
        if (ed >= 1200 && ed <= 6000) return price_product = LQ_base_4x20[1][select_count_color - 1] + opt1;
        if (ed >= 6000) return price_product = LQ_base_4x20[2][select_count_color - 1] + opt1;
    }
    function PrintLQ_10x10() {
        if (ed >= 150 && ed <= 800) return price_product = LQ_base_10x10[0][select_count_color - 1] + opt1;
        if (ed >= 800 && ed <= 4000) return price_product = LQ_base_10x10[1][select_count_color - 1] + opt1;
        if (ed >= 4000) return price_product = LQ_base_10x10[2][select_count_color - 1] + opt1;
    }
    function PrintLQ_6x30() {
        if (ed >= 150 && ed <= 800) return price_product = LQ_base_6x30[0][select_count_color - 1] + opt1;
        if (ed >= 800 && ed <= 4000) return price_product = LQ_base_6x30[1][select_count_color - 1] + opt1;
        if (ed >= 4000) return price_product = LQ_base_6x30[2][select_count_color - 1] + opt1;
    }
    function PrintLQ_8x40() {
        if (ed >= 100 && ed <= 300) return price_product = LQ_base_8x40[0][select_count_color - 1] + opt1;
        if (ed >= 300 && ed <= 1500) return price_product = LQ_base_8x40[1][select_count_color - 1] + opt1;
        if (ed >= 1500) return price_product = LQ_base_8x40[2][select_count_color - 1] + opt1;
    }
    function PrintLQ_A4() {
        if (ed >= 100 && ed <= 200) return price_product = LQ_base_A4[0][select_count_color - 1] + opt1;
        if (ed >= 200 && ed <= 1000) return price_product = LQ_base_A4[1][select_count_color - 1] + opt1;
        if (ed >= 1000) return price_product = LQ_base_A4[2][select_count_color - 1] + opt1;
    }
    function PrintLQ_A3() {
        if (ed >= 50 && ed <= 100) return price_product = LQ_base_A3[0][select_count_color - 1] + opt1;
        if (ed >= 100 && ed <= 500) return price_product = LQ_base_A3[1][select_count_color - 1] + opt1;
        if (ed >= 500) return price_product = LQ_base_A3[2][select_count_color - 1] + opt1;
    }
    function PrintHQ_8x8() {
        if (ed >= 150 && ed <= 1500) return price_product = HQ_base_8x8[0][select_count_color - 1] + opt1;
        if (ed >= 1500 && ed <= 7500) return price_product = HQ_base_8x8[1][select_count_color - 1] + opt1;
        if (ed >= 7500) return price_product = HQ_base_8x8[2][select_count_color - 1] + opt1;
    }
    function PrintHQ_4x20() {
        if (ed >= 150 && ed <= 1200) return price_product = HQ_base_4x20[0][select_count_color - 1] + opt1;
        if (ed >= 1200 && ed <= 6000) return price_product = HQ_base_4x20[1][select_count_color - 1] + opt1;
        if (ed >= 6000) return price_product = HQ_base_4x20[2][select_count_color - 1] + opt1;
    }
    function PrintHQ_10x10() {
        if (ed >= 150 && ed <= 800) return price_product = HQ_base_10x10[0][select_count_color - 1] + opt1;
        if (ed >= 800 && ed <= 4000) return price_product = HQ_base_10x10[1][select_count_color - 1] + opt1;
        if (ed >= 4000) return price_product = HQ_base_10x10[2][select_count_color - 1] + opt1;
    }
    function PrintHQ_6x30() {
        if (ed >= 150 && ed <= 800) return price_product = HQ_base_6x30[0][select_count_color - 1] + opt1;
        if (ed >= 800 && ed <= 4000) return price_product = HQ_base_6x30[1][select_count_color - 1] + opt1;
        if (ed >= 4000) return price_product = HQ_base_6x30[2][select_count_color - 1] + opt1;
    }
    function PrintHQ_8x40() {
        if (ed >= 100 && ed <= 300 || ed < 100) return price_product = HQ_base_8x40[0][select_count_color - 1] + opt1;
        if (ed >= 300 && ed <= 1500) return price_product = HQ_base_8x40[1][select_count_color - 1] + opt1;
        if (ed >= 1500) return price_product = HQ_base_8x40[2][select_count_color - 1] + opt1;
    }
    function PrintHQ_A4() {
        if (ed >= 100 && ed <= 200) return price_product = HQ_base_A4[0][select_count_color - 1] + opt1;
        if (ed >= 200 && ed <= 1000) return price_product = HQ_base_A4[1][select_count_color - 1] + opt1;
        if (ed >= 1000) return price_product = HQ_base_A4[2][select_count_color - 1] + opt1;
    }
    function PrintHQ_A3() {
        if (ed >= 50 && ed <= 100) return price_product = HQ_base_A3[0][select_count_color - 1] + opt1;
        if (ed >= 100 && ed <= 500) return price_product = HQ_base_A3[1][select_count_color - 1] + opt1;
        if (ed >= 500) return price_product = HQ_base_A3[2][select_count_color - 1] + opt1;
    }
    price_product;
  • Вопрос задан
  • 107 просмотров
Подписаться 1 Простой 13 комментариев
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы
22 дек. 2024, в 20:40
10000 руб./за проект
22 дек. 2024, в 20:34
3000 руб./за проект
22 дек. 2024, в 20:12
10000 руб./за проект