const pdfFillData = require('./pdfFillData');

class pdfFillDataSpectrum extends pdfFillData {
    /**
     * @param {string} [pdfDocumentName='SPECTRUM'] - Наименование документа
     */
    constructor() {
        super('SPECTRUM');

        this.foundation_account = "06039461"; // генерить
        this.pageN = [
            "1 of 3",
            "2 of 3",
            "3 of 3"
        ];
        this.staticText1 = [
            "Thanks for choosing us! Keep in mind that your first bill may include a partial month of",
            "service as we align to your bill cycle, one-time fees, and charges for a month of service",
            "billed in advance. The amount due may be higher than expected and more than you'll see",
            "going forward. Sign in to att.com/myATT for a personalized video explanation of your first",
            "bill."
        ];
        this.staticText2 = [
            "Managing your AT&T bills, products, and services on the go? It's a snap with myAT&T. Go to",
            "att.com/myatt to sign in or sign up."
        ];
        this.staticText3 = [
            "Total due",
            "AutoPay is scheduled for:"
        ];
        this.staticText4 = [
            "AutoPay is scheduled to charge your card on "
        ];
        this.total_due = "$88.83"; // генерить
        this.total_due_date = "Oct 09, 2022"; // генерить

        this.billing_date = '';
        this.account_number = '';
        this.service_address_1 = '';
        this.service_address_2 = '';
        this.service_address_3_town = '';
        this.service_address_3_state = '';
        this.service_address_3_index = '';

        this.staticText5 = [
            "AutoPay of",
            "is scheduled for",
            "Account number: "
        ];

        this.code_number = '965001550637507080000000000888300000008883001';

        this.table = [
            "$7.50",
            "$75.00",
            "$4.32",
            "$2.01"
        ];

        this.usage_summary = "(Sep 18 - Sep 20)";

        this.table2 = [
            "8.61GB (unlimited)",
            "3 (unlimited)",
            "0 (unlimited)"
        ];

        this.phone = "978.701.2444";
        this.user = "WIRELESS NUMBER";

        this.table3 = [
            [
                "1.",
                "2.",
                "3."
            ],
            [
                "Activation Fee",
                "Activation Fee Credit",
                "Unlimited Extra - 1 Line",
                "Autopay & paperless bill included ($10 off)"
            ],
            [
                "Sep 18 - Sep 20",
                "Sep 18",
                "Sep 18",
                "Sep 18 - Sep 20"
            ],
            [
                "$35.00",
                "-$35.00",
                "$7.50"
            ],
            [
                "< One-time charge",
                "< One-time credit",
                "< Service changed on Sep 18 - partial month charge"
            ]
        ];

        this.table4 = [
            [
                "4."
            ],
            [
                "Unlimited Extra - 1 Line",
                "Autopay & paperless bill included ($10 off)"
            ],
            [
                "Sep 21 - Oct 20"
            ],
            [
                "$75.00"
            ]
        ];

        this.table5 = [
            [
                "5.",
                "6.",
                "7."
            ],
            [
                "Administrative Fee",
                "Federal Universal Service Charge",
                "Regulatory Cost Recovery Charge"
            ],
            [
                "$1.99",
                "$0.83",
                "$1.50"
            ]
        ];

        this.table6 = [
            [
                "8.",
                "9."
            ],
            [
                "9-1-1 Service Fee",
                "State Sales Tax - Telecom"
            ],
            [
                "$1.50",
                "$0.51"
            ]
        ];

        this.plan = 'AT&T Unlimited Premium';
        this.address = '';

        this.rightMargin = 0;
        this.rightMargin2 = 0;
        this.rightMargin3 = 0;
        this.rightMargin4 = 0;
        this.rightMargin5 = 0;

        this.your_package = "";
        this.equipment = "$0.00";
        this.regular_monthly_charges = '';
        this.other_charges = 0;
        this.totalD = 0;
        this.total = '';
        this.regular_monthly_charges_d = 0;

        this.county_rate = "0.00";
        this.state_rate = "0.00";

        this.baseTarif = [
            {
                "name": "AT&T Unlimited Premium",
                "price": "$85.99"
            },
            {
                "name": "AT&T Unlimited Extra",
                "price": "$75.99"
            },
            {
                "name": "AT&T Unlimited Starter",
                "price": "$65.99"
            }
        ];
    }


    async setFields(fields) {
        // base
        this.billing_date = fields.billing_date;
        this.account_number = fields.account_number;
        this.service_address_1 = fields.service_address_1;
        this.service_address_2 = fields.service_address_2;
        this.service_address_3_town = fields.service_address_3_town;
        this.service_address_3_state = fields.service_address_3_state;
        this.service_address_3_index = fields.service_address_3_index;
        this.address = fields.address;
        this.phone = fields.phone;
        this.user = fields.user;
        this.plan = fields.plan;
        if(fields.baseTarif != undefined) {
            this.baseTarif = fields.baseTarif;
        }
        if(this.baseTarif.length) {
            for (let iplan in this.baseTarif) {
                if (this.baseTarif[iplan].name == this.plan) {
                    this.your_package = this.baseTarif[iplan].price;
                }
            }
        }

        // other

        this.foundation_account = "0" + this.generateDigitNumberFormat(1000000,9999999,7);
        this.total_due_date = this.getMondayInTwoWeeks(this.billing_date);
        this.regular_monthly_charges_d = this.your_package.replace("$",'');
        this.regular_monthly_charges = this.your_package;

        //this.other_charges = await this.getTaxRateByAddress(this.address);
        //this.county_rate = "$" + (this.regular_monthly_charges_d * (parseFloat(this.other_charges.details.rate.county_rate).toFixed(2) * 100) / 100).toFixed(2);
        //this.state_rate = "$" + (this.regular_monthly_charges_d * (parseFloat(this.other_charges.details.rate.state_rate).toFixed(2) * 100) / 100).toFixed(2);
        //this.other_charges = "$" + (this.regular_monthly_charges_d * (parseFloat(this.other_charges.details.rate.combined_rate).toFixed(2) * 100) / 100).toFixed(2);
        //this.totalD = parseFloat(this.regular_monthly_charges.replace('$', '')) + parseFloat(this.other_charges.replace('$', ''));
        //this.total = "$" + this.totalD.toFixed(2);

        this.table6[2][1] = this.state_rate;

        this.table[3] = parseFloat(this.table6[2][0].replace("$","")) + parseFloat(this.table6[2][1].replace("$",""));
        this.table[3] = "$" + this.table[3].toFixed(2);

        this.table[2] =  parseFloat(this.table5[2][0].replace("$","")) + parseFloat(this.table5[2][1].replace("$","")) + parseFloat(this.table5[2][2].replace("$",""));
        this.table[2] = "$" + this.table[2].toFixed(2);

        this.total_due = parseFloat(this.table[0].replace("$",'')) + parseFloat(this.your_package.replace("$",'')) + parseFloat(this.table[2].replace("$",'')) + parseFloat(this.table[3].replace("$",''));
        this.total_due = "$" + this.total_due.toFixed(2);
        this.code_number = this.generateDigitNumberFormat(920,990,3) + '00' + this.account_number + '000000000' + this.formatToFiveDigits(this.total_due) + "000000" + this.formatToFiveDigits(this.total_due) + '001';

    }

    getMondayInTwoWeeks(billingDate) {
        const date = new Date(billingDate);
        const daysUntilMonday = (8 - date.getDay()) % 7 || 7;
        date.setDate(date.getDate() + daysUntilMonday + 14);
        return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });
    }

    formatToFiveDigits(sum) {
        return sum.replace("$",'').replace(".",'').padStart(5, '0');
    }

    getCreditCardPaymentDate(billingDate) {
        return super.getCreditCardPaymentDate(billingDate);
    }

    pixelsToPoints(pixels, dpi = 72) {
        return super.pixelsToPoints(pixels, dpi);
    }

    generateDigitNumberFormat(min, max, format) {
        return (Math.floor(Math.random() * (max - min + 1)) + min).toString().padStart(format, '0');
    }

    async draw() {

        this.dataMap = [
            {
                ipage: 0,
                field: this.service_address_1,
                x: this.pixelsToPoints(this.convert72to300_X(171.29), 300),
                y: this.pixelsToPoints(this.convert72to300_Y(17.10, 8, 4.0, this.getPageHeight(0)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field: this.service_address_2,
                x: this.pixelsToPoints(this.convert72to300_X(171.29), 300),
                y: this.pixelsToPoints(this.convert72to300_Y(26.70, 8, 4.0, this.getPageHeight(0)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field: this.service_address_3_town + ", " + this.service_address_3_state + " " + this.service_address_3_index,
                x: this.pixelsToPoints(this.convert72to300_X(171.29), 300),
                y: this.pixelsToPoints(this.convert72to300_Y(36.30, 8, 4.0, this.getPageHeight(0)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.pageN[0],
                x: this.pixelsToPoints(this.convert72to300_X(470.45), 300),
                y: this.pixelsToPoints(this.convert72to300_Y(16.99, 9, 4.0, this.getPageHeight(0)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.billing_date,
                x: this.pixelsToPoints(this.convert72to300_X(470.45), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 29.95, 9, 4.0, this.getPageHeight(0)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.account_number,
                x: this.pixelsToPoints(this.convert72to300_X(470.45), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 42.91, 9, 4.0, this.getPageHeight(0)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.foundation_account,
                x: this.pixelsToPoints(this.convert72to300_X(470.45), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 55.87, 9, 4.0, this.getPageHeight(0)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.staticText3[0],
                x: this.pixelsToPoints(this.convert72to300_X(477.03), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 153.68, 10, 4.0, this.getPageHeight(0)), 300),
                size: 10,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.total_due,
                x: this.pixelsToPoints(this.convert72to300_X(451.14), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 171.63, 32, 4.0, this.getPageHeight(0)), 300),
                size: 32,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.staticText3[1],
                x: this.pixelsToPoints(this.convert72to300_X(443.17), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 214.16, 10, 4.0, this.getPageHeight(0)), 300),
                size: 10,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.total_due_date,
                x: this.pixelsToPoints(this.convert72to300_X(472.66), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 226.40, 10, 4.0, this.getPageHeight(0)), 300),
                size: 10,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.staticText1[0],
                x: this.pixelsToPoints(this.convert72to300_X(18.00), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 136.11, 9, 4.0, this.getPageHeight(0)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.staticText1[1],
                x: this.pixelsToPoints(this.convert72to300_X(18.00), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 146.11, 9, 4.0, this.getPageHeight(0)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.staticText1[2],
                x: this.pixelsToPoints(this.convert72to300_X(18.00), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 156.11, 9, 4.0, this.getPageHeight(0)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.staticText1[3],
                x: this.pixelsToPoints(this.convert72to300_X(18.00), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 166.11, 9, 4.0, this.getPageHeight(0)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.staticText1[4],
                x: this.pixelsToPoints(this.convert72to300_X(18.00), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 176.11, 9, 4.0, this.getPageHeight(0)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.staticText2[0],
                x: this.pixelsToPoints(this.convert72to300_X(18.00), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 201.23, 9, 4.0, this.getPageHeight(0)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.staticText2[1],
                x: this.pixelsToPoints(this.convert72to300_X(18.00), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 211.23, 9, 4.0, this.getPageHeight(0)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.total_due,
                x: this.pixelsToPoints(this.convert72to300_X(358.74), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 317.58, 10, 4.0, this.getPageHeight(0)), 300),
                size: 10,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.total_due,
                x: this.pixelsToPoints(this.convert72to300_X(352.72), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 343.72, 12, 4.0, this.getPageHeight(0)), 300),
                size: 12,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.total_due,
                x: this.pixelsToPoints(this.convert72to300_X(340.71), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 388.67, 14, 4.0, this.getPageHeight(0)), 300),
                size: 14,
                ifont: 3,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.staticText4[0] + " " + this.total_due_date,
                x: this.pixelsToPoints(this.convert72to300_X(22.97), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 407.54, 10, 4.0, this.getPageHeight(0)), 300),
                size: 10,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.service_address_1,
                x: this.pixelsToPoints(this.convert72to300_X(130.82), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 817.19, 8, 4.0, this.getPageHeight(0)), 300),
                size: 8,
                ifont: 0,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.service_address_2,
                x: this.pixelsToPoints(this.convert72to300_X(130.82), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 827.19, 8, 4.0, this.getPageHeight(0)), 300),
                size: 8,
                ifont: 0,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.service_address_3_town + ", " + this.service_address_3_state + " " + this.service_address_3_index,
                x: this.pixelsToPoints(this.convert72to300_X(130.82), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 837.19, 8, 4.0, this.getPageHeight(0)), 300),
                size: 8,
                ifont: 0,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.staticText5[0] + " " + this.total_due + " " + this.staticText5[1],
                x: this.pixelsToPoints(this.convert72to300_X(343.22), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 814.92, 11.5, 4.0, this.getPageHeight(0)), 300),
                size: 11.5,
                ifont: 3,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.total_due_date,
                x: this.pixelsToPoints(this.convert72to300_X(343.22), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 828.72, 11.5, 4.0, this.getPageHeight(0)), 300),
                size: 11.5,
                ifont: 3,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.staticText5[2] + " " + this.account_number,
                x: this.pixelsToPoints(this.convert72to300_X(343.22), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 844.87, 9, 4.0, this.getPageHeight(0)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 0,
                field:  this.code_number,
                x: this.pixelsToPoints(this.convert72to300_X(101.52), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 966.81, 10, 3.4, this.getPageHeight(0)), 300),
                size: 10,
                ifont: 1,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.pageN[1],
                x: this.pixelsToPoints(this.convert72to300_X(470.45), 300),
                y: this.pixelsToPoints(this.convert72to300_Y(16.99, 9, 4.0, this.getPageHeight(1)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.billing_date,
                x: this.pixelsToPoints(this.convert72to300_X(470.45), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 29.95, 9, 4.0, this.getPageHeight(1)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.account_number,
                x: this.pixelsToPoints(this.convert72to300_X(470.45), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 42.91, 9, 4.0, this.getPageHeight(1)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.foundation_account,
                x: this.pixelsToPoints(this.convert72to300_X(470.45), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 55.87, 9, 4.0, this.getPageHeight(1)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.phone,
                x: this.pixelsToPoints(this.convert72to300_X(25.49), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 218.22, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.user,
                x: this.pixelsToPoints(this.convert72to300_X(85.46), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 219.53, 7, 4.0, this.getPageHeight(1)), 300),
                size: 7,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table[0],
                x: this.pixelsToPoints(this.convert72to300_X(291.57), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 218.22, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.your_package,
                x: this.pixelsToPoints(this.convert72to300_X(345.51), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 218.22, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table[2],
                x: this.pixelsToPoints(this.convert72to300_X(408.44), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 218.22, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table[3],
                x: this.pixelsToPoints(this.convert72to300_X(467.76), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 218.22, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.total_due,
                x: this.pixelsToPoints(this.convert72to300_X(520.50), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 218.22, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table[0],
                x: this.pixelsToPoints(this.convert72to300_X(288.70), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 239.36, 9, 4.0, this.getPageHeight(1)), 300),
                size: 9,
                ifont: 3,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.your_package,
                x: this.pixelsToPoints(this.convert72to300_X(341.96), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 239.36, 9, 4.0, this.getPageHeight(1)), 300),
                size: 9,
                ifont: 3,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table[2],
                x: this.pixelsToPoints(this.convert72to300_X(405.60), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 239.36, 9, 4.0, this.getPageHeight(1)), 300),
                size: 9,
                ifont: 3,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table[3],
                x: this.pixelsToPoints(this.convert72to300_X(464.81), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 239.36, 9, 4.0, this.getPageHeight(1)), 300),
                size: 9,
                ifont: 3,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.total_due,
                x: this.pixelsToPoints(this.convert72to300_X(516.97), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 239.36, 9, 4.0, this.getPageHeight(1)), 300),
                size: 9,
                ifont: 3,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.usage_summary,
                x: this.pixelsToPoints(this.convert72to300_X(93.11), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 291.81, 9, 4.0, this.getPageHeight(1)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.phone,
                x: this.pixelsToPoints(this.convert72to300_X(23.69), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 327.55, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.user,
                x: this.pixelsToPoints(this.convert72to300_X(90.00), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 327.55, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table2[0],
                x: this.pixelsToPoints(this.convert72to300_X(230.94), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 328.40, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table2[1],
                x: this.pixelsToPoints(this.convert72to300_X(350.33), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 327.55, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table2[2],
                x: this.pixelsToPoints(this.convert72to300_X(443.38), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 327.55, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  ", " + this.phone,
                x: this.pixelsToPoints(this.convert72to300_X(76.49), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 373.20, 11, 4.1, this.getPageHeight(1)), 300),
                size: 11,
                ifont: 3,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.user,
                x: this.pixelsToPoints(this.convert72to300_X(43.49), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 386.88, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[2][0],
                x: this.pixelsToPoints(this.convert72to300_X(237.74), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 410.38, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 4,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[0][0],
                x: this.pixelsToPoints(this.convert72to300_X(32.74), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 423.59, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[1][0],
                x: this.pixelsToPoints(this.convert72to300_X(45.43), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 423.59, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[2][1],
                x: this.pixelsToPoints(this.convert72to300_X(237.74), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 423.58, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 4,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[3][0],
                x: this.pixelsToPoints(this.convert72to300_X(365.05), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 423.59, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[4][0],
                x: this.pixelsToPoints(this.convert72to300_X(401.62), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 423.58, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 4,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[0][1],
                x: this.pixelsToPoints(this.convert72to300_X(31.98), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 436.79, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[1][1],
                x: this.pixelsToPoints(this.convert72to300_X(45.43), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 436.79, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[2][2],
                x: this.pixelsToPoints(this.convert72to300_X(237.74), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 436.78, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 4,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[3][1],
                x: this.pixelsToPoints(this.convert72to300_X(361.84), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 436.79, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[4][1],
                x: this.pixelsToPoints(this.convert72to300_X(401.62), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 436.78, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 4,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[0][2],
                x: this.pixelsToPoints(this.convert72to300_X(32.01), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 449.99, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[1][2],
                x: this.pixelsToPoints(this.convert72to300_X(45.43), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 449.99, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[2][3],
                x: this.pixelsToPoints(this.convert72to300_X(237.74), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 449.98, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 4,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[3][2],
                x: this.pixelsToPoints(this.convert72to300_X(369.76), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 449.99, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[4][2],
                x: this.pixelsToPoints(this.convert72to300_X(401.62), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 449.98, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 4,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table3[1][3],
                x: this.pixelsToPoints(this.convert72to300_X(45.36), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 459.69, 7, 4.0, this.getPageHeight(1)), 300),
                size: 7,
                ifont: 4,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table4[2][0],
                x: this.pixelsToPoints(this.convert72to300_X(237.74), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 483.69, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 4,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table4[0][0],
                x: this.pixelsToPoints(this.convert72to300_X(31.40), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 496.89, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table4[1][0],
                x: this.pixelsToPoints(this.convert72to300_X(45.43), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 496.89, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.your_package,
                x: this.pixelsToPoints(this.convert72to300_X(365.17), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 496.89, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table4[1][1],
                x: this.pixelsToPoints(this.convert72to300_X(45.36), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 506.60, 7, 4.0, this.getPageHeight(1)), 300),
                size: 7,
                ifont: 4,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table5[0][0],
                x: this.pixelsToPoints(this.convert72to300_X(32.00), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 543.80, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table5[1][0],
                x: this.pixelsToPoints(this.convert72to300_X(45.43), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 543.80, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table5[2][0],
                x: this.pixelsToPoints(this.convert72to300_X(370.06), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 543.80, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table5[0][1],
                x: this.pixelsToPoints(this.convert72to300_X(31.58), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 557.00, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table5[1][1],
                x: this.pixelsToPoints(this.convert72to300_X(45.43), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 557.00, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table5[2][1],
                x: this.pixelsToPoints(this.convert72to300_X(369.11), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 557.00, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table5[0][2],
                x: this.pixelsToPoints(this.convert72to300_X(32.13), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 570.20, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table5[1][2],
                x: this.pixelsToPoints(this.convert72to300_X(45.43), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 570.20, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table5[2][2],
                x: this.pixelsToPoints(this.convert72to300_X(370.37), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 570.20, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table6[0][0],
                x: this.pixelsToPoints(this.convert72to300_X(31.47), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 608.71, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table6[1][0],
                x: this.pixelsToPoints(this.convert72to300_X(45.43), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 608.71, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table6[2][0],
                x: this.pixelsToPoints(this.convert72to300_X(370.37), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 608.71, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table6[0][1],
                x: this.pixelsToPoints(this.convert72to300_X(31.58), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 621.91, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.service_address_3_state + " " + this.table6[1][1],
                x: this.pixelsToPoints(this.convert72to300_X(45.43), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 621.91, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.table6[2][1],
                x: this.pixelsToPoints(this.convert72to300_X(370.37), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 621.91, 8, 4.0, this.getPageHeight(1)), 300),
                size: 8,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.phone,
                x: this.pixelsToPoints(this.convert72to300_X(65.00), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 644.63, 11, 4.0, this.getPageHeight(1)), 300),
                size: 11,
                ifont: 3,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 1,
                field:  this.total_due,
                x: this.pixelsToPoints(this.convert72to300_X(354.89), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 644.63, 11, 4.0, this.getPageHeight(1)), 300),
                size: 11,
                ifont: 3,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 2,
                field:  this.pageN[2],
                x: this.pixelsToPoints(this.convert72to300_X(470.45), 300),
                y: this.pixelsToPoints(this.convert72to300_Y(16.99, 9, 4.0, this.getPageHeight(2)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 2,
                field:  this.billing_date,
                x: this.pixelsToPoints(this.convert72to300_X(470.45), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 29.95, 9, 4.0, this.getPageHeight(2)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 2,
                field:  this.account_number,
                x: this.pixelsToPoints(this.convert72to300_X(470.45), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 42.91, 9, 4.0, this.getPageHeight(2)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 2,
                field:  this.foundation_account,
                x: this.pixelsToPoints(this.convert72to300_X(470.45), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 55.87, 9, 4.0, this.getPageHeight(2)), 300),
                size: 9,
                ifont: 2,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            },
            {
                ipage: 2,
                field:  this.total_due,
                x: this.pixelsToPoints(this.convert72to300_X(354.89), 300),
                y: this.pixelsToPoints(this.convert72to300_Y( 101.15, 11, 4.0, this.getPageHeight(2)), 300),
                size: 11,
                ifont: 3,
                cR: 0,
                cG: 0,
                cB: 0,
                encoding: 'utf-8'
            }
        ];

        for(let idm in this.dataMap) {
            await super.draw(
                this.dataMap[idm].ipage,
                this.dataMap[idm].field,
                this.dataMap[idm].x,
                this.dataMap[idm].y,
                this.dataMap[idm].size,
                this.dataMap[idm].ifont,
                this.dataMap[idm].cR,
                this.dataMap[idm].cG,
                this.dataMap[idm].cB,
                this.dataMap[idm].encoding
            );
        }

    }

    async saveData(host, outputDir) {
        return await super.saveData(host, outputDir, 'SPECTRUM' );
    }
}

module.exports = pdfFillDataSpectrum;