<commit_before>var global = require('../../global');

module.exports = function (purchaseRequest) {

    var items = [].concat.apply([], purchaseRequest.items);

    var iso = "FM-6.00-06-004/R1";
    var number = purchaseRequest.no;

    var locale = global.config.locale; 

    var moment = require('moment');
    moment.locale(locale.name); 

    var header = [{
        columns: [{
            columns: [{
                width: '*',
                stack: [{
                    text: 'PT DAN LIRIS',
                    style: ['size15'],
                    alignment: "center"
                }, {
                        text: 'BANARAN, GROGOL, SUKOHARJO',
                        style: ['size09'],
                        alignment: "center"
                    }]
            }]

        }]
    }];

    var line = [{
        canvas: [{
    	       type: 'line',
            x1: 0,
            y1: 5,
            x2: 378,
            y2: 5,
            lineWidth: 0.5
        }
        ]
    }, '\n'];

    var subheader = [{
        columns: [{
            columns: [{
                width: '*',
                stack: [{
                    text: iso,
                    style: ['size09', 'bold'],
                    alignment: "right"
                },
                    {
                        text: 'ORDER PEMESANAN',
                        style: ['size09', 'bold'],
                        alignment: "center",
                        decoration: 'underline'
                    }]
            }]

        }]
    }];

    var subheader2 = [{
        columns: [
            {
                width: '40%',
                columns: [{
                    width: '35%',
                    stack: ['Bagian', 'Budget' , 'Nomor']
                }, {
                        width: '5%',
                        stack: [':', ':', ':']
                    }, {
                        width: '*',
                        stack: [purchaseRequest.unit.name, purchaseRequest.budget.name, purchaseRequest.no]
                    }],
                style: ['size08']

            },
            {
                width: '30%',
                text: ''
            },
            {
                width: '30%',
                columns: [{
                    width: '*',
                    stack: [`Sukoharjo, ${moment(purchaseRequest.date).format(locale.date.format)} `],
                    alignment: "right",
                }],
                style: ['size08']
            }
        ]
    }];

    var opening = {
        text: [
            '\n', {
                text: 'Mohon dibelikan/diusahakan barang tersebut dibawah ini : '
            },
            '\n\n'
        ],
        style: ['size09']
    };

    var thead = [{
        text: 'NO',
        style: 'tableHeader'
    }, {
            text: 'KODE',
            style: 'tableHeader'
        }, {
            text: 'BARANG',
            style: 'tableHeader'
        }, {
            text: 'JUMLAH',
            style: 'tableHeader'
        }, {
            text: 'HARGA',
            style: 'tableHeader'
        }];

    var tbody = items.map(function (item, index) {
        return [{
            text: (index + 1).toString() || '',
            style: ['size07', 'center']
        }, {
                text: item.product.code,
                style: ['size07', 'left']
            }, {
                text: item.product.name,
                style: ['size07', 'left']
            }, {
                text: parseFloat(item.quantity).toLocaleString(locale, locale.decimal) + " " + item.product.uom.unit,
                style: ['size07', 'center']
            }, {
                text: '',
                style: ['size07', 'left']
            }];
    });

    var tfoot = [[{
        text: " ",
        style: ['size08', 'center']
    }, "", "", "", ""]];

    tbody = tbody.length > 0 ? tbody : [
        [{
            text: "tidak ada barang",
            style: ['size08', 'center'],
            colSpan: 5
        }, "", "", "", ""]
    ];

    var table = [{
        table: {
            widths: ['5%', '20%', '40%', '10%', '25%'],
            headerRows: 1,
            body: [].concat([thead], tbody, tfoot)
        }<commit_msg>fix file definition<commit_after>var global = require('../../global');

module.exports = function (purchaseRequest) {

    var items = [].concat.apply([], purchaseRequest.items);

    var iso = "FM-6.00-06-004/R1";
    var number = purchaseRequest.no;

    var locale = global.config.locale; 

    var moment = require('moment');
    moment.locale(locale.name); 

    var header = [{
        columns: [{
            columns: [{
                width: '*',
                stack: [{
                    text: 'PT DAN LIRIS',
                    style: ['size15'],
                    alignment: "center"
                }, {
                        text: 'BANARAN, GROGOL, SUKOHARJO',
                        style: ['size09'],
                        alignment: "center"
                    }]
            }]

        }]
    }];

    var line = [{
        canvas: [{
    	       type: 'line',
            x1: 0,
            y1: 5,
            x2: 378,
            y2: 5,
            lineWidth: 0.5
        }
        ]
    }, '\n'];

    var subheader = [{
        columns: [{
            columns: [{
                width: '*',
                stack: [{
                    text: iso,
                    style: ['size09', 'bold'],
                    alignment: "right"
                },
                    {
                        text: 'ORDER PEMESANAN',
                        style: ['size09', 'bold'],
                        alignment: "center",
                        decoration: 'underline'
                    }]
            }]

        }]
    }];

    var subheader2 = [{
        columns: [
            {
                width: '40%',
                columns: [{
                    width: '35%',
                    stack: ['Bagian', 'Budget' , 'Nomor']
                }, {
                        width: '5%',
                        stack: [':', ':', ':']
                    }, {
                        width: '*',
                        stack: [purchaseRequest.unit.name, purchaseRequest.budget.name, purchaseRequest.no]
                    }],
                style: ['size08']

            },
            {
                width: '30%',
                text: ''
            },
            {
                width: '30%',
                columns: [{
                    width: '*',
                    stack: [`Sukoharjo, ${moment(purchaseRequest.date).format(locale.date.format)} `],
                    alignment: "right",
                }],
                style: ['size08']
            }
        ]
    }];

    var opening = {
        text: [
            '\n', {
                text: 'Mohon dibelikan/diusahakan barang tersebut dibawah ini : '
            },
            '\n\n'
        ],
        style: ['size09']
    };

    var thead = [{
        text: 'NO',
        style: 'tableHeader'
    }, {
            text: 'KODE',
            style: 'tableHeader'
        }, {
            text: 'BARANG',
            style: 'tableHeader'
        }, {
            text: 'JUMLAH',
            style: 'tableHeader'
        }, {
            text: 'HARGA',
            style: 'tableHeader'
        }];

    var tbody = items.map(function (item, index) {
        return [{
            text: (index + 1).toString() || '',
            style: ['size07', 'center']
        }, {
                text: item.product.code,
                style: ['size07', 'left']
            }, {
                text: item.product.name,
                style: ['size07', 'left']
            }, {
                text: parseFloat(item.quantity).toLocaleString(locale, locale.decimal) + " " + item.product.uom.unit,
                style: ['size07', 'center']
            }, {
                text: '',
                style: ['size07', 'left']
            }];
    });

    var tfoot = [[{
        text: " ",
        style: ['size08', 'center']
    }, "", "", "", ""]];

    tbody = tbody.length > 0 ? tbody : [
        [{
            text: "tidak ada barang",
            style: ['size08', 'center'],
            colSpan: 5
        }, "", "", "", ""]
    ];

    var table = [{
        table: {
            widths: ['5%', '13%', '40%', '17%', '25%'],
            headerRows: 1,
            body: [].concat([thead], tbody, tfoot)
        }
{'fraction_non_alphanumeric': 0.15335538752362948, 'fraction_numerical': 0.017013232514177693, 'mean_word_length': 0.9384016487291047, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '354507', 'n_tokens_mistral': 2511, 'n_tokens_neox': 2233, 'n_words': 448}