1021 lines
37 KiB
JavaScript
1021 lines
37 KiB
JavaScript
const pdfFillData = require('./pdfFillData');
|
||
|
||
class pdfFillDataCOX extends pdfFillData {
|
||
/**
|
||
* @param {string} [pdfDocumentName='COX'] - Наименование документа
|
||
*/
|
||
constructor() {
|
||
super('COX');
|
||
|
||
this.billing_date = '';
|
||
this.account_number = '';
|
||
this.service_address_1 = '';
|
||
this.service_address_2 = '';
|
||
this.service_address_3 = '';
|
||
this.customer_name = '';
|
||
this.plan = '';
|
||
this.speed = '';
|
||
this.previous_balance = '';
|
||
this.payment_received = '';
|
||
|
||
this.credit_card_payment_thank_you = '';
|
||
this.cox_pin = '';
|
||
this.firstCode = '';
|
||
this.lastCode = '';
|
||
this.code_number = '';
|
||
this.services_from = '';
|
||
this.services_from2 = '';
|
||
this.services_from3 = '';
|
||
this.address = '';
|
||
this.totalDueBy = '';
|
||
this.p_an = '';
|
||
this.code_number_ocra = '';
|
||
this.rightMargin = 0;
|
||
this.rightMargin2 = 0;
|
||
this.rightMargin3 = 0;
|
||
this.rightMargin4 = 0;
|
||
this.rightMargin5 = 0;
|
||
|
||
this.your_package = "";
|
||
this.equipment = "$15.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: "Go Fast",
|
||
price: "$50.00",
|
||
includes: "Download speeds up to 100 Mbps*|1.25 TB (1,280 GB) Monthly Data Plan|Over 4 Million Wifi Hotspots"
|
||
},
|
||
{
|
||
name: "Go Faster",
|
||
price: "$70.00",
|
||
includes: "Download speeds up to 250 Mbps*|1.25 TB (1,280 GB) Monthly Data Plan|Over 4 Million Wifi Hotspots"
|
||
},
|
||
{
|
||
name: "Go Even Faster",
|
||
price: "$90.00",
|
||
includes: "Download speeds up to 500 Mbps*|1.25 TB (1,280 GB) Monthly Data Plan|Over 4 Million Wifi Hotspots"
|
||
}
|
||
];
|
||
}
|
||
|
||
|
||
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 = fields.service_address_3;
|
||
this.address = fields.address;
|
||
this.customer_name = fields.customer_name;
|
||
this.plan = fields.plan;
|
||
if(fields.speed != undefined) {
|
||
this.speed = fields.speed;
|
||
}
|
||
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;
|
||
|
||
if (this.speed == '' || this.speed == undefined) {
|
||
this.speed = this.baseTarif[iplan].includes;
|
||
}
|
||
|
||
this.speed = fields.speed.split("|");
|
||
}
|
||
}
|
||
}
|
||
this.previous_balance = fields.previous_balance;
|
||
this.payment_received = fields.payment_received;
|
||
|
||
// other
|
||
this.credit_card_payment_thank_you = this.getCreditCardPaymentDate(this.billing_date);
|
||
this.cox_pin = String( this.generateDigitNumber(1000, 5000) );
|
||
this.firstCode = this.generateDigitNumberFormat(10000000,99999998,8);
|
||
this.lastCode = this.generateDigitNumberFormat(10000,999998,6);
|
||
this.code_number = '6400 ' + this.generateDigitNumberFormat(10,299,4) + ' NO RP 21 ' + this.getNextDateFormatted(this.billing_date) + ' NNNNNNNY 01 ' + this.lastCode;
|
||
this.services_from = this.getServicePeriod2(this.billing_date);
|
||
this.services_from2 = this.services_from.split(" to ");
|
||
this.services_from3 = this.services_from2[0].split(",")[0];
|
||
this.services_from2 = this.services_from2[0].split(",")[0] + ' - ' + this.services_from2[1].split(",")[0];
|
||
this.totalDueBy = this.getTotalDueBy(this.billing_date);
|
||
this.p_an = this.account_number.split(' ');
|
||
this.code_number_ocra = '0' + this.p_an[1] + this.p_an[0] + this.generateDigitNumberFormat(450,550,3) + this.p_an[2] + this.generateDigitNumberFormat(470000999,660009999,9);
|
||
|
||
//this.tarif = this.getPriceByAddress(this.plan, this.address, this.getSocrCache(), this.getTariffsCache());
|
||
//this.your_package = this.tarif.price.replace('/mo.','');
|
||
|
||
this.regular_monthly_charges = parseFloat(this.your_package.replace('$', '')) + parseFloat(this.equipment.replace('$', ''));
|
||
this.regular_monthly_charges_d = this.regular_monthly_charges.toFixed(2);
|
||
this.regular_monthly_charges = "$" + this.regular_monthly_charges_d;
|
||
|
||
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.rightMargin = this.pixelsToPoints(this.convert72to300_X(321.00), 300);
|
||
this.rightMargin2 = this.pixelsToPoints(this.convert72to300_X(318.00), 300);
|
||
this.rightMargin3 = this.pixelsToPoints(this.convert72to300_X(42.00), 300);
|
||
this.rightMargin4 = this.pixelsToPoints(this.convert72to300_X(329.00), 300);
|
||
this.rightMargin5 = this.pixelsToPoints(this.convert72to300_X(328.50), 300);
|
||
|
||
}
|
||
|
||
getCreditCardPaymentDate(billingDate) {
|
||
return super.getCreditCardPaymentDate(billingDate);
|
||
}
|
||
|
||
pixelsToPoints(pixels, dpi = 72) {
|
||
return super.pixelsToPoints(pixels, dpi);
|
||
}
|
||
|
||
generateDigitNumber(min, max) {
|
||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||
}
|
||
|
||
generateDigitNumberFormat(min, max, format) {
|
||
return (Math.floor(Math.random() * (max - min + 1)) + min).toString().padStart(format, '0');
|
||
}
|
||
|
||
getNextDateFormatted(inputDate) {
|
||
// Создаем объект Date из входной даты
|
||
const date = new Date(inputDate);
|
||
|
||
// Добавляем 1 день
|
||
date.setDate(date.getDate() + 1);
|
||
|
||
// Форматируем в MMDDYYYY
|
||
const month = String(date.getMonth() + 1).padStart(2, '0'); // +1, т.к. месяцы с 0
|
||
const day = String(date.getDate()).padStart(2, '0');
|
||
const year = date.getFullYear();
|
||
|
||
return `${month}${day}${year}`;
|
||
}
|
||
|
||
getServicePeriod2(billingDateStr) {
|
||
|
||
const billingDate = new Date(billingDateStr);
|
||
const firstDate = new Date(billingDate);
|
||
const secondDate = new Date(billingDate);
|
||
secondDate.setMonth(secondDate.getMonth() + 1);
|
||
secondDate.setDate(secondDate.getDate() - 1);
|
||
|
||
const options = { month: 'short', day: 'numeric', year: 'numeric' };
|
||
const firstDateStr = firstDate.toLocaleDateString('en-US', options);
|
||
const secondDateStr = secondDate.toLocaleDateString('en-US', options);
|
||
|
||
return `${firstDateStr} to ${secondDateStr}`;
|
||
}
|
||
|
||
getTotalDueBy(billingDateStr) {
|
||
|
||
const billingDate = new Date(billingDateStr);
|
||
// Создаем копию исходной даты
|
||
const dueDate = new Date(billingDate);
|
||
|
||
// Добавляем 21 день
|
||
dueDate.setDate(dueDate.getDate() + 21);
|
||
|
||
// Если дата попадает на воскресенье (0 - воскресенье в JS), смещаем на понедельник (+1 день)
|
||
if (dueDate.getDay() === 0) {
|
||
dueDate.setDate(dueDate.getDate() + 1);
|
||
}
|
||
|
||
const options = { month: 'short', day: 'numeric', year: 'numeric' };
|
||
const dueDateStr = dueDate.toLocaleDateString('en-US', options);
|
||
|
||
return `${dueDateStr}`;
|
||
}
|
||
|
||
async draw() {
|
||
|
||
this.dataMap = [
|
||
{
|
||
ipage: 0,
|
||
field: this.billing_date,
|
||
x: this.pixelsToPoints(this.convert72to300_X(324.00), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(75.61, 8, 3.2, this.getPageHeight(0)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.account_number,
|
||
x: this.pixelsToPoints(this.convert72to300_X(402.35), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(167.76, 8, 3.2, this.getPageHeight(0)), 300),
|
||
size: 8,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.cox_pin,
|
||
x: this.pixelsToPoints(this.convert72to300_X(402.35), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(178.56, 8, 3.2, this.getPageHeight(0)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.service_address_1,
|
||
x: this.pixelsToPoints(this.convert72to300_X(402.35), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(189.36, 8, 3.3, this.getPageHeight(0)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.service_address_2,
|
||
x: this.pixelsToPoints(this.convert72to300_X(402.35), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(200.16, 8, 3.3, this.getPageHeight(0)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.service_address_3,
|
||
x: this.pixelsToPoints(this.convert72to300_X(402.35), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(210.71, 8, 3.2, this.getPageHeight(0)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.customer_name,
|
||
x: this.pixelsToPoints(this.convert72to300_X(36.00), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(131.80, 8, 4.4, 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(36.00), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(140.90, 8, 4.5, this.getPageHeight(0)), 300),
|
||
size: 8,
|
||
ifont: 0,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.service_address_1,
|
||
x: this.pixelsToPoints(this.convert72to300_X(115.50), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(140.90, 8, 4.5, this.getPageHeight(0)), 300),
|
||
size: 8,
|
||
ifont: 0,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.service_address_3.replaceAll(',',''),
|
||
x: this.pixelsToPoints(this.convert72to300_X(36.00), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(150.00, 8, 4.5, this.getPageHeight(0)), 300),
|
||
size: 8,
|
||
ifont: 0,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.code_number,
|
||
x: this.pixelsToPoints(this.convert72to300_X(36.00), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(119.55, 6, 4.5, this.getPageHeight(0)), 300),
|
||
size: 6,
|
||
ifont: 0,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.billing_date,
|
||
x: this.pixelsToPoints(this.convert72to300_X(201.70), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(233.87, 12, 3.1, this.getPageHeight(0)), 300),
|
||
size: 12,
|
||
ifont: 2,
|
||
cR: 0.219,
|
||
cG: 0.603,
|
||
cB: 0.843,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.services_from,
|
||
x: this.pixelsToPoints(this.convert72to300_X(113.70), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(300.52, 10, 3.2, this.getPageHeight(0)), 300),
|
||
size: 10,
|
||
ifont: 2,
|
||
cR: 0.219,
|
||
cG: 0.603,
|
||
cB: 0.843,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.credit_card_payment_thank_you.replaceAll(',',''),
|
||
x: this.pixelsToPoints(this.convert72to300_X(137.00), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(266.47, 9, 3.5, this.getPageHeight(0)), 300),
|
||
size: 9,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.totalDueBy,
|
||
x: this.pixelsToPoints(this.convert72to300_X(101.70), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(384.46, 9, 3.2, this.getPageHeight(0)), 300),
|
||
size: 9,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.billing_date + ' bill for ' + this.customer_name,
|
||
x: this.pixelsToPoints(this.convert72to300_X(306.00), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(544.85, 8, 3.0, this.getPageHeight(0)), 300),
|
||
size: 8,
|
||
ifont: 3,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.account_number,
|
||
x: this.pixelsToPoints(this.convert72to300_X(378.00), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(544.90, 8, 8.3, this.getPageHeight(0)), 300),
|
||
size: 8,
|
||
ifont: 3,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.service_address_1,
|
||
x: this.pixelsToPoints(this.convert72to300_X(378.00), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(565.41, 8, 3.1, this.getPageHeight(0)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.service_address_2,
|
||
x: this.pixelsToPoints(this.convert72to300_X(378.00), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(575.05, 8, 3.3, this.getPageHeight(0)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.service_address_3,
|
||
x: this.pixelsToPoints(this.convert72to300_X(378.00), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(584.20, 8, 3.2, this.getPageHeight(0)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.totalDueBy,
|
||
x: this.pixelsToPoints(this.convert72to300_X(369.50), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(617.36, 10, 3.0, this.getPageHeight(0)), 300),
|
||
size: 10,
|
||
ifont: 3,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.code_number_ocra,
|
||
x: this.pixelsToPoints(this.convert72to300_X(36.70), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(753.72, 10, 3.1, this.getPageHeight(0)), 300),
|
||
size: 10,
|
||
ifont: 5,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.previous_balance,
|
||
x: await this.alignTextToRight(0, 1, 10, this.rightMargin, this.previous_balance),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(251.22, 10, 3.1, this.getPageHeight(0)), 300),
|
||
size: 10,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.payment_received,
|
||
x: await this.alignTextToRight(0, 1, 10, this.rightMargin, this.payment_received),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(266.47, 10, 3.1, this.getPageHeight(0)), 300),
|
||
size: 10,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: "$0.00",
|
||
x: await this.alignTextToRight(0, 1, 10, this.rightMargin, "$0.00"),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(285.32, 10, 3.1, this.getPageHeight(0)), 300),
|
||
size: 10,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.regular_monthly_charges,
|
||
x: await this.alignTextToRight(0, 1, 10, this.rightMargin, this.regular_monthly_charges),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(314.47, 10, 3.1, this.getPageHeight(0)), 300),
|
||
size: 10,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: "$0.00",
|
||
x: await this.alignTextToRight(0, 1, 10, this.rightMargin, "$0.00"),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(331.72, 10, 3.1, this.getPageHeight(0)), 300),
|
||
size: 10,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.other_charges,
|
||
x: await this.alignTextToRight(0, 1, 10, this.rightMargin, this.other_charges),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(346.97, 10, 3.1, this.getPageHeight(0)), 300),
|
||
size: 10,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.total,
|
||
x: await this.alignTextToRight(0, 1, 10, this.rightMargin2, '-'+this.total),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(365.82, 10, 3.1, this.getPageHeight(0)), 300),
|
||
size: 10,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.total,
|
||
x: await this.alignTextToRight(0, 1, 10, this.rightMargin2, '-'+this.total),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(384.67, 10, 3.1, this.getPageHeight(0)), 300),
|
||
size: 10,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 0,
|
||
field: this.total,
|
||
x: await this.alignTextToRight(0, 1, 10, this.rightMargin3, '-'+this.total),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(617.36, 10, 3.0, this.getPageHeight(0)), 300),
|
||
size: 10,
|
||
ifont: 3,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.code_number,
|
||
x: this.pixelsToPoints(this.convert72to300_X(43.20), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(9.60, 6, 4.8, this.getPageHeight(1)), 300),
|
||
size: 6,
|
||
ifont: 0,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.billing_date,
|
||
x: this.pixelsToPoints(this.convert72to300_X(43.20), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(23.76, 8, 3.5, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: ' Bill for ' + this.customer_name,
|
||
x: this.pixelsToPoints(this.convert72to300_X(92.20), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(23.76, 8, 3.5, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.account_number,
|
||
x: this.pixelsToPoints(this.convert72to300_X(109.50), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(34.31, 8, 3.5, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.services_from2,
|
||
x: this.pixelsToPoints(this.convert72to300_X(144.10), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(92.86, 8, 3.6, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 2,
|
||
cR: 0.219,
|
||
cG: 0.603,
|
||
cB: 0.843,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.plan,
|
||
x: this.pixelsToPoints(this.convert72to300_X(42.10), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(128.61, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: (this.speed[0] || ''),
|
||
x: this.pixelsToPoints(this.convert72to300_X(42.10), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(151.91, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: (this.speed[1] || ''),
|
||
x: this.pixelsToPoints(this.convert72to300_X(42.10), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(164.61, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: (this.speed[2] || ''),
|
||
x: this.pixelsToPoints(this.convert72to300_X(42.10), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(177.36, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: '*Visit cox.com/modems for',
|
||
x: this.pixelsToPoints(this.convert72to300_X(42.10), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(190.06, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: 'compatible devices',
|
||
x: this.pixelsToPoints(this.convert72to300_X(42.10), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(202.81, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.your_package,
|
||
x: await this.alignTextToRight(1, 1, 8, this.rightMargin4, this.your_package),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(215.51, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.equipment,
|
||
x: await this.alignTextToRight(1, 1, 8, this.rightMargin4, this.equipment),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(297.71, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.regular_monthly_charges,
|
||
x: await this.alignTextToRight(1, 1, 8, this.rightMargin4, this.regular_monthly_charges),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(310.06, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.regular_monthly_charges,
|
||
x: await this.alignTextToRight(1, 1, 8, this.rightMargin4, this.regular_monthly_charges),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(331.41, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: "Affordable Connectivity Benefit",
|
||
x: this.pixelsToPoints(this.convert72to300_X(42.10), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(363.21, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.services_from3,
|
||
x: this.pixelsToPoints(this.convert72to300_X(183.70), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(363.21, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: "$0.00",
|
||
x: await this.alignTextToRight(1, 1, 8, this.rightMargin5, "$0.00"),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(363.21, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: "$0.00",
|
||
x: await this.alignTextToRight(1, 1, 8, this.rightMargin5, "$0.00"),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(379.21, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: "County Sales Tax",
|
||
x: this.pixelsToPoints(this.convert72to300_X(42.10), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(421.56, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.county_rate,
|
||
x: await this.alignTextToRight(1, 1, 8, this.rightMargin5, this.county_rate),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(421.56, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: "State Sales Tax",
|
||
x: this.pixelsToPoints(this.convert72to300_X(42.10), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(433.91, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.state_rate,
|
||
x: await this.alignTextToRight(1, 1, 8, this.rightMargin5, this.state_rate),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(433.91, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 1,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: "Total Internet Taxes and Fees",
|
||
x: this.pixelsToPoints(this.convert72to300_X(42.10), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(446.26, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.other_charges,
|
||
x: await this.alignTextToRight(1, 1, 8, this.rightMargin5, this.other_charges),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(446.26, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: "TOTAL TAXES, FEES AND SURCHARGES",
|
||
x: this.pixelsToPoints(this.convert72to300_X(42.10), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(467.61, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.other_charges,
|
||
x: await this.alignTextToRight(1, 1, 8, this.rightMargin5, this.other_charges),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(467.61, 8, 3.3, this.getPageHeight(1)), 300),
|
||
size: 8,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: "TOTAL NEW CHARGES",
|
||
x: this.pixelsToPoints(this.convert72to300_X(42.10), 300),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(489.66, 9, 3.3, this.getPageHeight(1)), 300),
|
||
size: 9,
|
||
ifont: 2,
|
||
cR: 0,
|
||
cG: 0,
|
||
cB: 0,
|
||
encoding: 'utf-8'
|
||
},
|
||
{
|
||
ipage: 1,
|
||
field: this.total,
|
||
x: await this.alignTextToRight(1, 1, 9, this.rightMargin5, this.total),
|
||
y: this.pixelsToPoints(this.convert72to300_Y(489.66, 9, 3.3, this.getPageHeight(1)), 300),
|
||
size: 9,
|
||
ifont: 2,
|
||
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
|
||
);
|
||
}
|
||
|
||
await this.generateDataMatrix(
|
||
this.code_number.split(' NO ')[0].replace(' ','') + this.account_number,
|
||
'datamatrix',
|
||
0,
|
||
this.pixelsToPoints(956, 300),
|
||
this.pixelsToPoints(2800, 300),
|
||
20,
|
||
20,
|
||
1.8,
|
||
'R'
|
||
);
|
||
|
||
await this.generateDataMatrix(
|
||
this.firstCode + this.lastCode + 'G00001',
|
||
'datamatrixrectangular',
|
||
0,
|
||
await this.alignTextToRight(0, 1, 8, 15, '...'),
|
||
this.pixelsToPoints(2211, 300),
|
||
12,
|
||
36,
|
||
1.8,
|
||
'R'
|
||
);
|
||
|
||
await this.generateDataMatrix(
|
||
this.firstCode + this.lastCode + 'H00001',
|
||
'datamatrixrectangular',
|
||
1,
|
||
await this.alignTextToRight(1, 1, 8, 15, '...'),
|
||
this.pixelsToPoints(2211, 300),
|
||
12,
|
||
36,
|
||
1.8,
|
||
'R'
|
||
);
|
||
|
||
await this.generateDataMatrix(
|
||
this.account_number.replaceAll(" ",""),
|
||
'code128',
|
||
1,
|
||
this.pixelsToPoints(1802, 300),
|
||
this.pixelsToPoints(781, 300),
|
||
83,
|
||
13,
|
||
1.8,
|
||
'N'
|
||
);
|
||
|
||
await super.drawline(1,0.5,
|
||
this.pixelsToPoints(146, 300),
|
||
this.pixelsToPoints(1450, 300),
|
||
this.pixelsToPoints(1182, 300),
|
||
this.pixelsToPoints(1450, 300),
|
||
0,0,0);
|
||
|
||
await super.drawline(1,2,
|
||
this.pixelsToPoints(144, 300),
|
||
this.pixelsToPoints(1375, 300),
|
||
this.pixelsToPoints(1184, 300),
|
||
this.pixelsToPoints(1375, 300),
|
||
0,0,0);
|
||
|
||
await super.drawline(1,2,
|
||
this.pixelsToPoints(144, 300),
|
||
this.pixelsToPoints(1287, 300),
|
||
this.pixelsToPoints(1184, 300),
|
||
this.pixelsToPoints(1287, 300),
|
||
0,0,0);
|
||
|
||
|
||
}
|
||
|
||
async saveData(host, outputDir) {
|
||
return await super.saveData(host, outputDir, 'COX' );
|
||
}
|
||
}
|
||
|
||
module.exports = pdfFillDataCOX; |