Function To Create Summary In Item Receipt

/**
 * @description the fuctcion to create the summary box
 * @param {number} values - Values for creating the summary like total, subtotal,tax total etc
 * @return html - html corresponding to the summary
 */
function createSummary(values) {
    try {
        log.debug('inside createsummary');
        /**
         * @Description  style the summary box using html code
         * */

        var html = '<style>' +
            'table.newtotallingtable caption {\n' +
            '    display: table-caption !important;\n' +
            '    margin-bottom: 10px;\n' +
            '    font-weight: bold;\n' +
            '    color: white;\n' +
            '    font-size: 12px !important;\n' +
            '    padding: 4px 0px 4px 8px;\n' +
            '}' +
            'table.newtotallingtable caption {\n' +
            '    background-color: #607799;\n' +
            '}' +
            'caption, th {\n' +
            '    text-align: left;\n' +
            '}' +
            '</style>';
        html += '<span class="bgmd totallingbg" style="display:inline-block; position:relative;left: 0px; padding: 10px 25px; margin-bottom:5px;">';
        html += '<table class="newtotallingtable" cellspacing="2" cellpadding="0px" border="0px" style="padding: 5px;\n' +
            '    width: 217px;"><caption style="display: none;" >Summary</caption>' +
            '<tbody style="border: 1px black solid">' +
            '<td><div class="uir-field-wrapper" data-field-type="currency"><span id="subtotal_fs_lbl_uir_label" class="smalltextnolink uir-label "><span id="subtotal_fs_lbl" class="smalltextnolink" style="color: #262626 !important; font-size: 12px; padding-bottom:10px;">'
        html += 'SUBTOTAL</td>';
        html += '<td  style="color: #262626 !important; font-size: 13px; padding-bottom:10px;" align="right" id="subtotal">';
        html += values.subTotal + '</b></td>' +
            '<td></td>' +
            '</tr>';
        html += '<tr>' +
            '<td  style="color: #262626 !important; font-size: 12px;" align="left">TAX TOTAL</td>' +
            '<td align="right"   style="font-size: 13px; color: #262626 !important;">';
        html += values.taxTotal + '</td>' +
            '<td></td>' +
            '</tr>';
        html += '<tr>' +
            '<td colspan="2"><hr style="width:200px;margin: fill"/></td>' +
            '</tr>'
        html += '<tr>' +
            '<td  style="color: #262626 !important; font-size: 12px;" align="left">TOTAL</td>' +
            '<td align="right"   style="font-size: 13px; color: #262626 !important;">';
        html += values.Total + '</td>' +
            '</tr>';

        html += '</table></div>';
        return '<div id="custom_summary">' + html + '</div>';

    } catch (e) {
        log.debug({
            title: e.name,
            details: e
        });
        return false;
    }
}

Leave a comment

Your email address will not be published. Required fields are marked *