Skip to content

feat: print preview#353

Open
Alchez wants to merge 9 commits intoversion-14from
print_preview_lite
Open

feat: print preview#353
Alchez wants to merge 9 commits intoversion-14from
print_preview_lite

Conversation

@Alchez
Copy link
Copy Markdown
Collaborator

@Alchez Alchez commented Jun 17, 2025

Squashes feature commits from #243, with additional changes for verification.

agritheory and others added 4 commits June 17, 2025 12:45
Print Preview Changes by FossERP (#245)

* remove print Get pdf

* fetch all payment entry preview in one single preview

* override a print button

* print page breake issue resolve

* print on specific url

* fix: Url of print

* PDF Button override

* on draft stage only allow check run default print format

* on draft stage only allow check run default print format

* if check run in draft then print should show msg

* remove unrelevent controll

* ci: track overrides por Payment Entry (#248)

* on change of doctype change list of print format

* change the preview and print view on change of selcted options

* render pdf base on selected print_sel

* create new print format 'Check Run'

* remove standard formats

* added a background image in check format

* set the size of check format background image

* back ground image only allow in print not in pdf

* Confirm print pop up

* Secondary print format added

* remove background image in pdf

* reformat by pre-commit

* Change syntex

* closed the window after action on print window

---------

Co-authored-by: Francisco Roldán <franciscoproldan@gmail.com>

wip: configurable PDF generation or preview

wip: print preview working

wip: update prettier approach

ci: update override commit hashes

test: fix duplicated date

feat: add printable MOP in settings, update print formats

docs: update for print settings

feat: add multiselect child table

ci: update override commit hashes -correct branch

chore: add patch for multiselect printable mops

wip: refactor to dynamic link

ci: update track override commits

refactor: add page break in print format

refactor: lists references vs table if secondary print format set

feat: limit table to 6 references otherwise comma separate

chore: update track overrides hash values
@Alchez Alchez requested a review from agritheory June 17, 2025 07:18
Repository owner deleted a comment from github-actions Bot Jun 17, 2025
Repository owner deleted a comment from github-actions Bot Jun 17, 2025
Repository owner deleted a comment from github-actions Bot Jun 17, 2025
Repository owner deleted a comment from github-actions Bot Jun 26, 2025
@Alchez Alchez force-pushed the print_preview_lite branch from 0c566c1 to c03d685 Compare June 26, 2025 06:33
Repository owner deleted a comment from github-actions Bot Jun 26, 2025
@github-actions
Copy link
Copy Markdown
Contributor

Print Format Changes Diff

Diff for check_run/check_run/print_format/check_run/check_run.json:

--- /dev/fd/63	2025-06-26 06:33:23.270156201 +0000
+++ /dev/fd/62	2025-06-26 06:33:23.271156190 +0000
@@ -1 +1,80 @@
+<div id="header-html" class="hidden-pdf">
+	<div class="print-heading">
+		<h2>
+			<div>Check Run</div>
+			<small class="sub-heading">ACC-CR-2024-00001</small>
+		</h2>
+	</div>
+</div>
+<div class="container_">
+    <div class="box">
+        <p>Check Run End Date:</p>
+        <b>{{doc.end_date or  ''}}</b>
+    </div>
+    <div class="box">
+        <p>Initial Check Number:</p>
+        <b>{{ doc.initial_check_number}}</b>
+    </div>
+    <div class="box">
+        <p>Company</p>
+        <b>{{ doc.company }}</b>
+    </div>
+</div>
+<div class="container_">
+    <div class="box">
+        <p>Posting Date:</p>
+        <b>{{doc.posting_date or  ''}}</b>
+    </div>
+    <div class="box">
+        <p>Final Check Number:</p>
+        <b>{{ doc.final_check_number }}</b>
+    </div>
+    <div class="box">
+        <p>Paid From (Bank Account):</p>
+        <b>{{ doc.bank_account }}</b>
+    </div>
+</div>
+<div class="container_">
+    <div class="box">
+        <p>Beginning Bank Account Balance:</p>
+        <b>{{frappe.format(doc.beg_balance,{'fieldtype':"Currency"} ) or  ''}}</b>
+    </div>
+    <div class="box">
+        <p>Amount in Check Run</p>
+        <b>{{frappe.format(doc.amount_check_run ,{'fieldtype':"Currency"} ) or  ''}}</b>
+    </div>
+    <div class="box">
+        <p>Accounts Payable:</p>
+        <b>{{ doc.pay_to_account }}</b>
+    </div>
+</div>
+{% set pe_list = frappe.db.get_list("Payment Entry", {"check_run":doc.name}) %}
+<table width="100%" border=1>
+    <tbody>
+        <tr>
+            <th>Party</th>
+            <th>Document</th>
+            <th>Document Date</th>
+            <th>Outstanding Amount</th>
+            <th>Due Date</th>
+            <th>Reference</th>
+        </tr>
+    
+    {% for row in pe_list %}
+    {% set doc_ = frappe.get_doc("Payment Entry", row.name) %}
+    {% for d in doc_.references %}
+        <tr>
+            <td>{{ doc_.party }}</td>
+            <td>{{ d.reference_name }}</td>
+            <td>{{ frappe.db.get_value(d.reference_doctype, d.reference_name, "posting_date") or ''}}</td>
+            <td>{{ doc_.paid_amount or '' }}</td>
+            <td>{{ frappe.db.get_value(d.reference_doctype, d.reference_name, "due_date") or '' }}</td>
+            <td>{{ doc_.name }}</td>
+        </tr>
+    {% endfor %}
+    {% endfor %}
+    </tbody>
+</table>
 
+    
+    

Diff for check_run/check_run/print_format/example_secondary_print_format/example_secondary_print_format.json:

--- /dev/fd/63	2025-06-26 06:33:23.279156100 +0000
+++ /dev/fd/62	2025-06-26 06:33:23.280156089 +0000
@@ -1,36 +1,44 @@
-<table class="table table-responsive-sm">
-   <tr>
-      <td colspan="4">
-         Cheque Number: {{ doc.reference_no or '' }}
-      </td>
-   </tr>
-   <tr>
-      <td colspan="2">{{doc.party_name}}</td>
-      <td> {{ frappe.utils.formatdate(doc.reference_date) or '' }} </td>
-      <td style="text-align:right;" colspan="2"> {{doc.get_formatted("base_paid_amount")}} </td>
-   <tr>
-      <th> Date </th>
-      <th style="text-align:left;"> Reference </th>
-      <th style="text-align:center;"> Amount </th>
-      <th style="text-align:right;"> Payment </th>
-   </tr>
-   {% for reference in doc.references %}
-   <tr>
-      {% if reference.reference_doctype == 'Purchase Invoice' %}
-      <td>{{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, "bill_date")) or ""}}</td>
-      <td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "bill_no") or "" }}</td>
-      {% elif reference.reference_doctype == 'Sales Invoice' %}
-      <td style="text-align:left;">{{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, "po_date")) or ""}}</td>
-      <td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "po_no") or "" }}</td>
-      {% elif reference.reference_doctype == 'Expense Claim' %}
-      <td style="text-align:left;">{{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, "posting_date")) or "&#160;"}}</td>
-      <td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "name") or "&#160;" }}</td>
-      {% elif reference.reference_doctype == 'Journal Entry' %}
-      <td style="text-align:left;"> {{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, "posting_date")) or "&#160;"}}</td>
-      <td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "name") or "&#160;" }}</td>
-      {% endif %}
-      <td style="text-align:center;"> {{ frappe.utils.fmt_money(reference.get_formatted('total_amount'), 2, 'USD')}}</td>
-      <td style="text-align:right;"> {{ reference.get_formatted('allocated_amount')}}</td>
-   </tr>
-   {% endfor %}
+{% set checkrun = frappe.get_doc("Check Run", doc.check_run) %}
+{% set checkrunsetting = frappe.db.get_list("Check Run Settings", {"bank_account": checkrun.bank_account, "pay_to_account": checkrun.pay_to_account , "company": checkrun.company}) %}
+{% set crs_doc = frappe.get_doc("Check Run Settings", checkrunsetting[0]) %}
+{% set printable_mop = frappe.db.get_list("Check Run Printable MOP", {"parent": crs_doc.name}, "mode_of_payment", pluck="mode_of_payment") %}
+
+{% if doc.mode_of_payment in printable_mop %}
+<table class="table table-responsive-sm">
+    <tr>
+        <td colspan="4">
+            Check Number: {{ doc.reference_no or '' }}
+        </td>
+    </tr>
+    <tr>
+        <td colspan="2">{{doc.party_name}}</td>
+        <td> {{ frappe.utils.formatdate(doc.reference_date) or '' }} </td>
+        <td style="text-align:right;"> {{doc.get_formatted("base_paid_amount")}} </td>
+    </tr>
+    <tr>
+        <th> Date </th>
+        <th style="text-align:left;"> Reference </th>
+        <th style="text-align:center;"> Amount </th>
+        <th style="text-align:right;"> Payment </th>
+    </tr>
+    {% for reference in doc.references %}
+    <tr>
+        {% if reference.reference_doctype == 'Purchase Invoice' %}
+        <td>{{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, "bill_date")) or ""}}</td>
+        <td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "bill_no") or "" }}</td>
+        {% elif reference.reference_doctype == 'Sales Invoice' %}
+        <td style="text-align:left;">{{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, "po_date")) or ""}}</td>
+        <td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "po_no") or "" }}</td>
+        {% elif reference.reference_doctype == 'Expense Claim' %}
+        <td style="text-align:left;">{{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, "posting_date")) or "&#160;"}}</td>
+        <td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "name") or "&#160;" }}</td>
+        {% elif reference.reference_doctype == 'Journal Entry' %}
+        <td style="text-align:left;"> {{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, "posting_date")) or "&#160;"}}</td>
+        <td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "name") or "&#160;" }}</td>
+        {% endif %}
+        <td style="text-align:center;"> {{ frappe.utils.fmt_money(reference.get_formatted('total_amount'), 2, 'USD')}}</td>
+        <td style="text-align:right;"> {{ frappe.utils.fmt_money(reference.get_formatted('allocated_amount'), 2, 'USD')}}</td>
+    </tr>
+    {% endfor %}
 </table>
+{% endif %}

Diff for check_run/check_run/print_format/example_voucher/example_voucher.json:

--- /dev/fd/63	2025-06-26 06:33:23.288156000 +0000
+++ /dev/fd/62	2025-06-26 06:33:23.289155989 +0000
@@ -1,136 +1,156 @@
-<div style="position: relative; top:0.0cm">
-   <div id="check_section_1" >
-      {% if doc.docstatus == 0 %}
-      <span class="stamp right_stamp is-draft">VOID DRAFT</span>
-      <span class="stamp sig_stamp is-draft">VOID DRAFT</span>
-      {% elif doc.docstatus == 2 or overwrite_void %}
-      <span class="stamp right_stamp is-nope">VOID</span>
-      <span class="stamp sig_stamp is-nope">VOID</span>
-      <span class="stamp big_stamp is-nope">VOID</span>
-      {% endif %}
-      <div id="payer_check_window_block" class="test_lines">
-         <span id= "payer_name_block">
-         {{ doc.company }}
-         </span>
-      </div>
-      <span id="check_date_block" style="top:2.0cm; left:17.0cm;
-         position: absolute;">
-      {{ doc.get_formatted('posting_date') }} 
-      </span>
-      <span id="payee_name_block" style="top:3.2cm;left: 2.8cm;
-         position: absolute;  min-width: 6cm;">
-      {{ doc.party_name }}
-      </span>
-      <span id="payee_address_window_block"  class="test_lines" >
-         <div id="address_block">
-            {{ doc.party_name }} <br>
-            {% set address = get_default_address(doc.party_type, doc.party) %}
-            {% if address %}
-            {{ frappe.get_doc('Address', address).get_display() }}
-            {% endif %}
-         </div>
-      </span>
-      <span id="payment_amount_number_block">
-      {% set money_number = doc.get_formatted('paid_amount')[1:].strip() %} 
-      {% if money_number|length < 18 %}
-      {% set money_number = ( money_number + '***************************')[:18] %}
-      {% endif %}
-      {{ money_number }}
-      </span>
-      <span id="payment_in_words_block" style="top:4.05cm; left:2.8cm;
-         position: absolute; display: block; width: 16.5cm;
-         line-height:0.5cm; word-wrap: break-word;">
-      {% set money_in_words = frappe.utils.money_in_words(doc.paid_amount)[:-5] %}
-      {% if money_in_words|length < 90 %}
-      {% set money_in_words = (money_in_words + '************************************************************************')[:100] %}
-      {% endif %}
-      {{ money_in_words }}
-      </span>
-      <span id="memo_block" class="test_lines">
-      {{ doc.check_memo or '' }} {% if test_lines %} MEMO {% endif %}
-      </span>
-      <span id="signature_block" style="top:6.3cm;left: 13.8cm;
-         position: absolute;  min-width: 6cm;">
-      SIGNATURE
-      </span>
-      <span id="check_number_block" style="top:7.9cm;left:4.3cm;
-         position: absolute;  min-width: 1.5cm;">
-      CHECK#
-      </span>
-      <span id="account_number_block" style="top:7.9cm;left:7.15cm;
-         position: absolute;  min-width: 6cm;">
-      ACCOUNT NUMBER {{ doc.account_no or '' }}
-      </span>
-      <span id="routing_number_block" style="top:7.9cm;left:12cm;
-         position: absolute;  min-width: 6cm;">
-      ROUTING_NUMBER
-      </span>
-   </div>
-</div>
-{% set number_of_invoice = frappe.db.get_value("Check Run Settings", {'bank_account':doc.bank_account,'company':doc.company}, ['number_of_invoices_per_voucher'])  %}
-
-{% for i in range(0,2) %}
-{% if i == 0 %}
-<div id="check_section_2" class="test_lines" style="top:9cm;">
-{% endif %}
-{% if i == 1 and not doc.references|length >= number_of_invoice %}
-<div id="check_section_3" class="test_lines" style="top:17.8cm;">
- {% endif %}
-{% if i == 1 and doc.references|length >= number_of_invoice %}
-<div id="check_section_3" class="test_lines" style="top:14cm;">
- {% endif %}
-   <div class="payment_reference_block" >
-      <table class="table table-responsive-sm">
-         <tr>
-            <td colspan="2">{{doc.party_name}}</td>
-            <td> {{ frappe.utils.formatdate(doc.reference_date) or '' }} </td>
-            <td style="text-align:right;" colspan="2"> {{doc.get_formatted("base_paid_amount")}} </td>
-        </tr>
-        {% if doc.references|length >= number_of_invoice %}
-        <tr>
-        <td colspan ="4">
-            {% for reference in doc.references %}
-            {% if reference.reference_doctype == 'Purchase Invoice' %}
-            {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "bill_no") or ""}}, 
-            {% elif reference.reference_doctype == 'Sales Invoice' %}
-            {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "po_no") or "" }},
-            {% elif reference.reference_doctype == 'Expense Claim' %}
-            {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "name") or "&#160;" }}, 
-            {% elif reference.reference_doctype == 'Journal Entry' %}
-            {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "name") or "&#160;" }},
-            {% endif %}
-            {% endfor %}
-        </td>
-         </tr>
-         {% else %}
-        <tr>
-            <th> Date </th>
-            <th style="text-align:left;"> Reference </th>
-            <th style="text-align:center;"> Amount </th>
-            <th style="text-align:right;"> Payment </th>
-         </tr>
-         
-         {% for reference in doc.references %}
-         <tr>
-            {% if reference.reference_doctype == 'Purchase Invoice' %}
-            <td>{{i }}{{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, "bill_date")) or ""}}</td>
-            <td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "bill_no") or "" }}</td>
-            {% elif reference.reference_doctype == 'Sales Invoice' %}
-            <td style="text-align:left;">{{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, "po_date")) or ""}}</td>
-            <td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "po_no") or "" }}</td>
-            {% elif reference.reference_doctype == 'Expense Claim' %}
-            <td style="text-align:left;">{{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, "posting_date")) or "&#160;"}}</td>
-            <td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "name") or "&#160;" }}</td>
-            {% elif reference.reference_doctype == 'Journal Entry' %}
-            <td style="text-align:left;"> {{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype, reference.reference_name, "posting_date")) or "&#160;"}}</td>
-            <td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype, reference.reference_name, "name") or "&#160;" }}</td>
-            {% endif %}
-            <td style="text-align:center;"> {{ frappe.utils.fmt_money(reference.get_formatted('total_amount'), 2, 'USD')}}</td>
-            <td style="text-align:right;"> {{ frappe.utils.fmt_money(reference.get_formatted('allocated_amount'), 2, doc.paid_from_account_currency) }}</td>
-         </tr>
-         {% endfor %}
-        {% endif %}
-      </table>
-   </div>
-</div>
-{% endfor %}
+{% set checkrun = frappe.get_doc("Check Run", doc.check_run) %}
+{% set checkrunsetting = frappe.db.get_list("Check Run Settings", {"bank_account": checkrun.bank_account,
+"pay_to_account": checkrun.pay_to_account , "company": checkrun.company}) %}
+{% set crs_doc = frappe.get_doc("Check Run Settings", checkrunsetting[0]) %}
+{% set printable_mop = frappe.db.get_list("Check Run Printable MOP", {"parent": crs_doc.name}, "mode_of_payment",
+pluck="mode_of_payment") %}
+{% set pdf_page_size = frappe.db.get_value("Print Settings", "Print Settings", "pdf_page_size") %}
+
+{% if doc.mode_of_payment in printable_mop %}
+<style
+	style="min-height: {{11 if pdf_page_size == 'Letter' else 11.69}}in; min-width: {{8.5 if pdf_page_size == 'Letter' else 8.27}}in">
+	.check-run-print {
+		min-height: inherit;
+		background-image: url({{crs_doc.background_image or ''}});
+	}
+</style>
+
+<div class="check-run-print">
+	<div style="position: relative; top:0.0cm">
+		<div id="check_section_1">
+			{% if doc.docstatus == 0 %}
+			<span class="stamp right_stamp is-draft">VOID DRAFT</span>
+			<span class="stamp sig_stamp is-draft">VOID DRAFT</span>
+			{% elif doc.docstatus == 2 or overwrite_void %}
+			<span class="stamp right_stamp is-nope">VOID</span>
+			<span class="stamp sig_stamp is-nope">VOID</span>
+			<span class="stamp big_stamp is-nope">VOID</span>
+			{% endif %}
+
+			<div id="payer_check_window_block" class="test_lines">
+				<span id="payer_name_block">
+					{{ doc.company }}
+				</span>
+			</div>
+			<span id="check_date_block" style="top:2.0cm; left:16.0cm;
+				position: absolute;">
+				{{ doc.get_formatted('posting_date') }}
+			</span>
+
+			<span id="payee_name_block" style="top:3.2cm;left: 2.8cm;
+				position: absolute;  min-width: 6cm;">
+				{{ doc.party_name }}
+			</span>
+
+			<span id="payee_address_window_block" class="test_lines">
+				<div id="address_block">
+					{{ doc.party_name }} <br>
+					{% set address = get_default_address(doc.party_type, doc.party) %}
+					{% if address %}
+					{{ frappe.get_doc('Address', address).get_display() }}
+					{% endif %}
+				</div>
+			</span>
+
+			<span id="payment_amount_number_block">
+				{% set money_number = doc.get_formatted('paid_amount')[1:].strip() %}
+
+				{% if money_number|length < 18 %} {% set money_number=( money_number + '***************************'
+					)[:18] %} {% endif %} {{ money_number }} </span>
+
+					<span id="payment_in_words_block" style="top:4.05cm; left:2.8cm;
+				position: absolute; display: block; width: 16.5cm;
+				line-height:0.5cm; word-wrap: break-word;">
+						{% set money_in_words = frappe.utils.money_in_words(doc.paid_amount)[:-5] %}
+						{% if money_in_words|length < 90 %} {% set money_in_words=(money_in_words
+							+ '************************************************************************' )[:100] %} {%
+							endif %} {{ money_in_words }} </span>
+
+							<span id="memo_block" class="test_lines">
+								{{ doc.check_memo or '' }} {% if test_lines %} MEMO {% endif %}
+							</span>
+
+							<span id="signature_block" style="top:6.3cm;left: 13.8cm;
+				position: absolute;  min-width: 6cm;">
+								SIGNATURE
+							</span>
+
+							<span id="check_number_block" style="top:7.9cm;left:4.3cm;
+				position: absolute;  min-width: 1.5cm;">
+								CHECK#
+							</span>
+
+							<span id="account_number_block" style="top:7.9cm;left:7.15cm;
+				position: absolute;  min-width: 6cm;">
+								ACCOUNT NUMBER {{ doc.account_no or '' }}
+							</span>
+
+							<span id="routing_number_block" style="top:7.9cm;left:12cm;
+				position: absolute;  min-width: 6cm;">
+								ROUTING_NUMBER
+							</span>
+		</div>
+	</div>
+
+	<div id="check_section_2" class="test_lines" style="top:9cm;">
+		<div class="payment_reference_block">
+			<table class="table table-responsive-sm">
+				<tr>
+					<td colspan="2">{{doc.party_name}}</td>
+					<td> {{ frappe.utils.formatdate(doc.reference_date) or '' }} </td>
+					<td style="text-align:right;" colspan="2"> {{doc.get_formatted("base_paid_amount")}} </td>
+				</tr>
+			{% if crs_doc.secondary_print_format or (not crs_doc.secondary_print_format and doc.references|length > 6) %}
+				<!-- Secondary Print Format specified in Check Run Settings, show comma-separated list of references -->
+				</table>
+				<br>
+				{% for reference in doc.references %}
+					<span>{{ reference.reference_name }}</span>
+					{{ ", " if not loop.last else "" }}
+				{% endfor %}
+			{% else %}
+				<!-- Secondary Print Format not specified in Check Run Settings, add table rows for each reference -->
+				<tr>
+					<th> Date </th>
+					<th style="text-align:left;"> Reference </th>
+					<th style="text-align:center;"> Amount </th>
+					<th style="text-align:right;"> Payment </th>
+				</tr>
+				{% for reference in doc.references %}
+				<tr>
+					{% if reference.reference_doctype == 'Purchase Invoice' %}
+					<td>{{ frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype,
+						reference.reference_name, "bill_date")) or ""}}</td>
+					<td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype,
+						reference.reference_name, "bill_no") or "" }}</td>
+					{% elif reference.reference_doctype == 'Sales Invoice' %}
+					<td style="text-align:left;">{{
+						frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype,
+						reference.reference_name, "po_date")) or ""}}</td>
+					<td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype,
+						reference.reference_name, "po_no") or "" }}</td>
+					{% elif reference.reference_doctype == 'Expense Claim' %}
+					<td style="text-align:left;">{{
+						frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype,
+						reference.reference_name, "posting_date")) or "&#160;"}}</td>
+					<td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype,
+						reference.reference_name, "name") or "&#160;" }}</td>
+					{% elif reference.reference_doctype == 'Journal Entry' %}
+					<td style="text-align:left;"> {{
+						frappe.utils.formatdate(frappe.db.get_value(reference.reference_doctype,
+						reference.reference_name, "posting_date")) or "&#160;"}}</td>
+					<td style="text-align:left;"> {{ frappe.db.get_value(reference.reference_doctype,
+						reference.reference_name, "name") or "&#160;" }}</td>
+					{% endif %}
+					<td style="text-align:center;"> {{ frappe.utils.fmt_money(reference.get_formatted('total_amount'),
+						2, 'USD')}}</td>
+					<td style="text-align:right;"> {{
+						frappe.utils.fmt_money(reference.get_formatted('allocated_amount'), 2, 'USD')}}</td>
+				</tr>
+				{% endfor %}
+				</table>
+			{% endif %}
+		</div>
+	</div>
+</div>
+{% endif %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants