@disruptive-learning/cfdi-to-pdf
Version:
Librería para crear un pdf basado en un XML CFDI o Retenciones
126 lines (125 loc) • 6.07 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const break_characters_1 = __importDefault(require("#src/utils/break_characters"));
const genericStampContent = (tfd, tfdSourceString, qrUrl, primaryColor) => {
const isVersion11 = tfd.hasAttribute('Version');
return {
table: {
widths: ['53%', '47%'],
body: [
[{ text: '', border: [false, false, false, true], colSpan: 2 }, ''],
[
{
style: 'tableSat',
table: {
widths: ['34.5%', '0.5%', '27%', '38%'],
body: [
[
{ qr: qrUrl, fit: 98, rowSpan: 4 },
'',
{
text: 'Folio fiscal:',
style: 'tableSatSub',
color: primaryColor,
marginLeft: 1,
border: [false, false, false, true],
},
{
text: tfd.getAttribute('UUID'),
alignment: 'right',
border: [false, false, false, true],
},
],
[
'',
'',
{
text: 'RFC Prov. de Certificación:',
style: 'tableSatSub',
color: primaryColor,
marginLeft: 1,
border: [false, false, false, true],
},
{
text: tfd.getAttribute('RfcProvCertif'),
alignment: 'right',
border: [false, false, false, true],
},
],
[
'',
'',
{
text: 'Cadena original del Timbre',
marginLeft: 1,
colSpan: 2,
style: 'tableSatSub',
color: primaryColor,
},
'',
],
[
'',
'',
{
text: (0, break_characters_1.default)(tfdSourceString),
marginLeft: 1,
colSpan: 2,
},
'',
],
],
},
layout: 'stampLayout',
},
{
style: 'tableSat',
table: {
widths: ['49.5%', '1%', '49.5%'],
body: [
[
{ text: 'Número de certificado SAT', style: 'tableSatSub', color: primaryColor },
'',
{
text: 'Fecha y hora de certificación',
style: 'tableSatSub',
color: primaryColor,
},
],
[
{
text: tfd.getAttribute(isVersion11 ? 'NoCertificadoSAT' : 'noCertificadoSAT'),
border: [false, false, false, true],
},
'',
{ text: tfd.getAttribute('FechaTimbrado'), border: [false, false, false, true] },
],
[
{ text: 'Sello digital del SAT', style: 'tableSatSub', color: primaryColor },
'',
{ text: 'Sello digital del CFDI', style: 'tableSatSub', color: primaryColor },
],
[
{
text: (0, break_characters_1.default)(tfd.getAttribute(isVersion11 ? 'SelloSAT' : 'selloSAT')),
},
'',
{
text: (0, break_characters_1.default)(tfd.getAttribute(isVersion11 ? 'SelloCFD' : 'selloCFD')),
},
],
],
},
layout: 'stampLayout',
},
],
],
dontBreakRows: true,
},
layout: 'tableLayout',
};
};
exports.default = genericStampContent;