While using the below code for the QR code. The only problem is that there is a message saying it is not compatible with Zakat Tax and Customs Authority.
<barcode codetype="qrcode" showtext="false" height="85" width="85" value= "Company Name: ${companyInformation.companyname}, Company VAT: ${companyInformation.employerid}, Invoice Date: ${record.trandate}, Invoice Total: ${record.total}, VAT Amount: ${record.taxtotal}" />

Solution:
We need to encode the data as per the Zakat Tax and Customs Authority documentation. Below is the code for encoding data as per the Zakat
/**
* @NApiVersion 2.1
* @NScriptType UserEventScript
* @NModuleScope SameAccount
*/
define(['N/record', 'N/encode'], function (record, encode) {
function aftersubmit(scriptContext) {
try {
if (scriptContext.type == scriptContext.UserEventType.CREATE || scriptContext.type == scriptContext.UserEventType.EDIT) {
const newRec = scriptContext.newRecord;
const recid = newRec.id;
const recType = newRec.type;
const trandate = newRec.getValue({ fieldId: 'trandate' });
const total = newRec.getValue({ fieldId: 'total' });
const taxtotal = newRec.getValue({ fieldId: 'taxtotal' });
const customerName = "Al Maqasid International Supply & Services Company";
const encodedCustName = encodingString(customerName);
const custNameLength = getLength(encodedCustName);
const sellerNameNew = '01' + custNameLength + encodedCustName;
const vatNum = "301385568200003";
const encodedVatNum = encodingString(vatNum)
const vatNumLength = getLength(encodedVatNum)
const vatNumNew = '02' + vatNumLength + encodedVatNum;
const tempDate = new Date(trandate);
const tempISO = tempDate.toISOString();
const encodededTimeStamp = encodingString(tempISO);
const timStampLength = getLength(encodededTimeStamp)
const timeStampNew = '03' + timStampLength + encodededTimeStamp;
const orderTotal = total.toFixed(2);
const encodedStringorderTotal = encodingString(orderTotal);
const orderTotalLength = getLength(encodedStringorderTotal);
const orderTotalNew = '04' + orderTotalLength + encodedStringorderTotal;
const vatTotal = taxtotal.toFixed(2);
const encodedStringVatTotal = encodingString(vatTotal);
const vatTotalLength = getLength(encodedStringVatTotal);
const vatTotalNew = '05' + vatTotalLength + encodedStringVatTotal;
const encodedQrCode = sellerNameNew + vatNumNew + timeStampNew + orderTotalNew + vatTotalNew;
const base64EncodedString = encode.convert({
string: encodedQrCode,
inputEncoding: encode.Encoding.HEX,
outputEncoding: encode.Encoding.BASE_64
});
record.submitFields({
type: recType,
id: recid,
values: {
'custbody_encoded': base64EncodedString
},
options: {
ignoreMandatoryFields: true
}
});
}
} catch (error) {
log.error('error@aftersubmit', error);
}
}
/**
* function accepts UTF_8 format and returns hexadecimal value of input
* returns encoded string
*/
function encodingString(params) {
try {
let hexEncodedString = encode.convert({
string: params,
inputEncoding: encode.Encoding.UTF_8,
outputEncoding: encode.Encoding.HEX
});
return (hexEncodedString);
} catch (e) {
log.error("error@encodingString", e)
}
}
/**
* function to get the length of the parameters and convert the string to hex value
* returns hexadecimal value of strin
*/
function getLength(lengthparam) {
try {
let length = lengthparam.length
//Revision 2.0 -- For UTF8 Arabic string its length is half of length of byte Array.
let orgLength = Number(length) / 2;
let hexString = orgLength.toString(16);
if (hexString.length < 2) {
hexString = "0" + hexString;
}
return hexString;
} catch (e) {
log.error("error@getLength", e)
}
}
return {
afterSubmit: aftersubmit
};
});
