- Old-style (recommended): save a name (example: opd_print_parcha_chamunda_hospital_ksp), then set that name in doctor master fields:
- opd_print_format, opd_blank_print, rx_pre_print_letter_head_format, rx_blank_letter_head, rx_plain_paper.
- Optional composed mode: use compose_default with type-specific parts.
-
How it works:
1. Margin values (cm) auto-populate the CSS @page block
- 2. Header HTML: Enter HTML for top of page (logo, hospital name, address, doctor info using {{variables}})
- 3. Footer HTML: Enter HTML for bottom of page (print time, page number, etc. using {{variables}})
- 4. HTML Content: Enter main body content between header and footer (patient info, diagnosis, etc.)
- Available variables:
- Hospital: {{H_Name}}, {{H_address_1}}, {{H_address_2}}, {{H_phone_No}}, {{H_Email}}, {{H_logo}}
- Patient/OPD: {{pName}}, {{age_sex}}, {{phoneno}}, {{uhid_no}}, {{opd_no}}, {{opd_date}}
- Medical: {{Complaint}}, {{diagnosis}}, {{medical}}, {{advice}}, {{doctor_name}}, {{short_description}}, {{doctor_short_description}}, {{doctor_sign_html}}
- Dates: {{print_time}}, {{current_date}}
- Margins (cm): {{MarginTop}}, {{MarginBottom}}, {{MarginLeft}}, {{MarginRight}}, {{MarginHeader}}, {{MarginFooter}}
+ 2. Header/Footer HTML define print header/footer blocks
+ 3. HTML Content is the main body between header and footer
+ 4. Custom CSS is optional and applies to template body elements (for exact letterhead positioning)
+
+ Rule: The complete list is shown in All Placeholders above.
+
+
+
+
+ Old-style (recommended): save a name (example: opd_print_parcha_chamunda_hospital_ksp), then set that name in doctor master fields:
+ opd_print_format, opd_blank_print, rx_pre_print_letter_head_format, rx_blank_letter_head, rx_plain_paper.
+ Optional composed mode: use compose_default with type-specific parts.
+
+
@@ -204,19 +401,29 @@ $paperCustomHeight = (string) ($paperSettings['custom_height_mm'] ?? '297');
return value.replace(/^[_-]+|[_-]+$/g, '');
}
- document.getElementById('btn_load_part').addEventListener('click', function () {
- var name = normalizeTemplateId(document.getElementById('tmpl_name').value || 'default');
- if (!name) { name = 'default'; }
- document.getElementById('tmpl_name').value = name;
- load_form_div('= base_url('Opd/print_template_builder') ?>?mode=edit&name=' + encodeURIComponent(name), 'maindiv', 'OPD Template Edit');
- });
+ var placeholderSearch = document.getElementById('placeholder_search');
+ if (placeholderSearch) {
+ placeholderSearch.addEventListener('input', function () {
+ var query = (placeholderSearch.value || '').toLowerCase().trim();
+ var groups = document.querySelectorAll('.placeholder-group');
- document.getElementById('btn_new_part').addEventListener('click', function () {
- document.getElementById('tmpl_name').value = '';
- document.getElementById('tmpl_content').value = '';
- document.getElementById('tmpl_original_name').value = '';
- setMsg('Enter new template name, then write HTML and click Save.', true);
- });
+ groups.forEach(function (groupEl) {
+ var chips = groupEl.querySelectorAll('.placeholder-chip');
+ var visibleCount = 0;
+
+ chips.forEach(function (chipEl) {
+ var key = (chipEl.getAttribute('data-placeholder') || '').toLowerCase();
+ var isVisible = !query || key.indexOf(query) !== -1;
+ chipEl.style.display = isVisible ? 'inline-block' : 'none';
+ if (isVisible) {
+ visibleCount += 1;
+ }
+ });
+
+ groupEl.style.display = visibleCount > 0 ? 'block' : 'none';
+ });
+ });
+ }
function toggleCustomSize() {
var pageSize = document.getElementById('opd_page_size');
@@ -237,6 +444,7 @@ $paperCustomHeight = (string) ($paperSettings['custom_height_mm'] ?? '297');
var header = document.getElementById('opd_header_html');
var footer = document.getElementById('opd_footer_html');
var body = document.getElementById('opd_paper_html_content');
+ var customCss = document.getElementById('opd_custom_style_css');
var pageBlock = '\n\n' : '';
+
+ return pageBlock + headerBlock + footerBlock + customStyleBlock + bodyText;
+ }
+
+ function splitCustomCssAndBody(content) {
+ var source = (content || '').trim();
+ var cssList = [];
+
+ source = source.replace(/'
+ + '