Project

General

Profile

Template.txt

Luc Tran Van, 04/06/2023 04:31 PM

 
1
SELECT * FROM CM_REPORT_TEMPLATE_DETAIL CRTD WHERE CRTD.REPORT_TEMPLATE_DETAIL_ID = 'RTMPD0000000020'
2

    
3
UPDATE CM_REPORT_TEMPLATE_DETAIL SET REPORT_TEMPLATE_DETAIL_CONTENT = N'<style type="text/css">
4
    * {
5
        font-family: Arial, Helvetica, sans-serif;
6
    }
7
    body {
8
        page-break-inside: auto
9
    }
10
    table {
11
        page-break-inside: avoid;
12
        page-break-after: auto;
13
        width: 100%;
14
        height: 100%;
15
        box-sizing: border-box;
16
        padding: 1.2mm 1.2mm 1.2mm 1.2mm;
17
        display: inline-block;
18
        border: 0;
19
    }
20
    table[border] {
21
        border-collapse: collapse;
22
    }
23
    tbody {
24
        display: table;
25
        width: 100%;
26
        height: 100%;
27
        border: black;
28
    }
29
    img {
30
        vertical-align: middle;
31
        border-style: none;
32
        width: 10mm !important;
33
        height: 10mm !important;
34
    }
35
    html,
36
    body {
37
        margin: 0;
38
        padding: 0;
39
    }
40
</style> 
41
<body>
42
    <div style="flex-wrap: wrap;">
43
        <p>{table1.TableStart.GroupByTable[ROW]}</p>
44
        <table align="left" border="1">
45
            <tbody>
46
                <tr>
47
                    <td rowspan="2" style="text-align: center; width:10mm">
48
                        QRCode{{table1.ASSET_CODE}}</td>
49
                    <td style="padding-left: 1mm;width: 22%;"><span style="font-size: 8px;">Mã TS</span></td>
50
                    <td class="custom-code" style="padding-left: 1mm;width: 88%;"><span style="font-size: 10px; word-break: break-word;">{table1.ASSET_CODE}</span></td>
51
                </tr>
52
                <tr>
53
                    <td style="padding-left: 1mm; width: 22%;"><span style="font-size: 8px;">Tên TS</span></td>
54
                    <td style="padding-left: 1mm;width: 88%;"><span style="font-size: 8px; word-break: break-word;">{table1.ASSET_NAME}</span></td>
55
                </tr>
56
                <tr>                   
57
                    <td class="custom" colspan="3" style="padding-left: 1mm; text-align: center;"><span style="word-break: break-word; ">{table1.DVSD}</span></td>
58
                </tr>
59
            </tbody>
60
        </table>
61
        <p>{table1.TableEnd}</p>
62
    </div>
63
</body>
64
<script type="text/javascript" defer>
65
    window.addEventListener("DOMContentLoaded", (event) => {
66
        const lstTdCustomElement = document.querySelectorAll(".custom-code span");
67
        lstTdCustomElement.forEach((item, index) => {
68
            const getTextContentTd = item.textContent;
69
            if (getTextContentTd.length > 25) {
70
                item.style.fontSize = "6px";
71
            }else if (getTextContentTd.length > 22) {
72
                item.style.fontSize = "7px";
73
            }else if (getTextContentTd.length > 19) {
74
                item.style.fontSize = "8px";
75
            }else if (getTextContentTd.length > 18) {
76
                item.style.fontSize = "9px";
77
            } else {
78
                item.style.fontSize = "10px";
79
            }
80
        })
81
    });
82
    window.addEventListener("DOMContentLoaded", (event) => {
83
        const lstTdCustomElement = document.querySelectorAll(".custom span");
84
        lstTdCustomElement.forEach((item, index) => {
85
            const getTextContentTd = item.textContent;
86
            if (getTextContentTd.length > 70) {
87
                item.style.fontSize = "3px";
88
            } else if (getTextContentTd.length > 60) {
89
                item.style.fontSize = "4px";
90
            }else if (getTextContentTd.length > 50) {
91
                item.style.fontSize = "5px";
92
            }else if (getTextContentTd.length > 40) {
93
                item.style.fontSize = "6px";
94
            }else if (getTextContentTd.length > 35) {
95
                item.style.fontSize = "7px";
96
            } else if (getTextContentTd.length > 29) {
97
                item.style.fontSize = "9px";
98
            } else {
99
                item.style.fontSize = "10px";
100
            }
101
        })
102
    });
103
</script>' WHERE REPORT_TEMPLATE_DETAIL_ID = 'RTMPD0000000020'
104