Skip to content

Print Preview#243

Open
agritheory wants to merge 28 commits intoversion-14from
print_preview
Open

Print Preview#243
agritheory wants to merge 28 commits intoversion-14from
print_preview

Conversation

@agritheory
Copy link
Copy Markdown
Owner

@agritheory agritheory commented May 14, 2024

To do:

  • Better styling of preview page
  • Fix example print format
  • Screenshot / Playwright test for primary, secondary and summary print view (move to separate issue)
  • Remove print/ get pdf HTML
  • Pull in settings / defaults from Check Run Settings
  • Provide sample (summary) Check Run print format
  • Provide no-print background image field of check stock with watermark
  • Integrate "Print" button into increment_print_count workflow
  • Update documentation for Print Settings section in Check Run Settings and more info around example print formats (including voucher number considerations around overflow for printing)
  • Patch for new Printable Modes of Payment in Check Run Settings

image

@agritheory agritheory marked this pull request as draft May 14, 2024 21:28
@viralkansodiya
Copy link
Copy Markdown
Contributor

viralkansodiya commented May 28, 2024

@agritheory

can you please explain what should I do in this task?

Screenshot / Selenium test for primary, secondary and summary print view

@agritheory
Copy link
Copy Markdown
Owner Author

@viralkansodiya For this task, I'll move it into its own ticket. It involves adding some dependencies.

@agritheory
Copy link
Copy Markdown
Owner Author

@viralkansodiya I am getting a Content Not Found Error that's coming from one or both of the print formats. Can you take a look at this?

@viralkansodiya
Copy link
Copy Markdown
Contributor

@agritheory I hope you are testing this print preview PR in version 14

@viralkansodiya
Copy link
Copy Markdown
Contributor

@viralkansodiya I am getting a Content Not Found Error that's coming from one or both of the print formats. Can you take a look at this?

@agritheory can you send me some more details? or if we can connect on call, so I can fix it quickly.

agritheory and others added 4 commits July 22, 2024 16:33
* 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>
@agritheory
Copy link
Copy Markdown
Owner Author

@viralkansodiya I was able to solve the content not found issue. Please update the "Example Voucher" print format so that it is sensitive to overflow (secondary print format feature), this is the comma separated list of source documents.

@viralkansodiya
Copy link
Copy Markdown
Contributor

Screenshot 2024-07-23 101018

@agritheory example voucher is already there in my pull request

@HKuz
Copy link
Copy Markdown
Collaborator

HKuz commented Jul 31, 2024

@agritheory this should be close. I wasn't sure what to add for the no-print background image. Latest commits include:

  • Example Voucher: removed the loop that was adding references 2x, checks Print Settings for page size, fixed some missing closing tags. Only prints payments associated with a new Mode of Payment Multiselect Table in Check Run Settings (DESIGN DECISION: I added the multiselect table in settings, but we do explicitly mention in the docs that a Mode of Payment with type "Bank" is special - it indicates the MOP requires physical printing. Another option is to cut out the multiselect table and just collect the MOPs of type Bank and compare against that).
  • Cleans up a few minor things in the Secondary format
  • adds a patch for the new multiselect table (QUESTION: for patches, do we need to call them anywhere or just having ithe execute function okay?)
  • fixed the minor issue with repeated Jan date in test data
  • updated track overrides hashes
  • updates docs

Potentially outstanding:

  • In print_check_run.js setup_sidebar, I pull the defaults for Number of Invoices per Voucher and Print Format, but for some reason the Print Format isn't setting as the default in the sidebar.

@agritheory agritheory marked this pull request as ready for review August 28, 2024 13:27
@agritheory
Copy link
Copy Markdown
Owner Author

Refactored the print format selection to a dynamic link
Pagination is still weird, might be the 'page-break' class in check_run.py might be something else.
How to we get labels for the form fields in the sidebar

@HKuz
Copy link
Copy Markdown
Collaborator

HKuz commented Sep 18, 2024

Latest push fixes a couple things, but here are a few observations in testing this:

  • the PDF render doesn't necessarily respect the print preview's dashed page break lines - I ran a Check Run for one person's payroll and paid 6 items, with the number_of_invoices_per_voucher set to 5, so one overflow. The preview separated them fine but the PDF wasn't adding the page break between the vouchers. Seems fixed by adding a line of code in the print preview for the page break
  • Part of the overflow problem stems from a change in v14 that ignores number_of_invoices_per_voucher if there's a Secondary Print Format set in Check Run Settings, as noted in this comment (see code here). When my settings for Payroll have that field set, Check Run lumps all the references into one Payment Entry, so printing preview shows the overflow (but oddly, actually rendering the PDF didn't seem to be a problem).
  • UPDATE (based on team call): document the secondary print format / invoices per voucher behavior and wrap a function in the preview - if Secondary Print Format exists in Settings, then don't render the invoices as table row, render them as comma-separated list to avoid overflow.

The latest change with the page break at the end of the print format seems to conform the preview and actual PDF page breaks, but I'm only testing when the Check Run Setting secondary print format field is blank.

@HKuz
Copy link
Copy Markdown
Collaborator

HKuz commented Sep 18, 2024

Latest push refactors the Example Voucher so if the Secondary Print Format is set in Check Run Settings, then the references are displayed as a comma-separated list. I tweaked the left positions of the date and paid amount, too - they were wrapping or cutting off in the actual PDF render.

Screen shots of the outcome now:

With Secondary Print Format set - multiple people renders okay too.

prev_w_secondary_print_format

Without Secondary Print Format set - fine for one person, more than 12 invoices is pushing the space limit. The preview still has display issues when there are multiple people being paid in the CR, but oddly the PDF render is fine
prev_no_secondary_print_format

@HKuz
Copy link
Copy Markdown
Collaborator

HKuz commented Oct 11, 2024

@agritheory - just reviewed this again - should be good to go. The new condition to render references as a list (if the Check Run Settings has a secondary print format set) gets rid of the overflow problem.

I made one small tweak in latest commits to cover the case where if the number of references in the Payment Entry is > 6 (regardless of the Secondary Print Format value in CR Settings), then it renders as a comma-separated list, too. I used 6 because that's what the preview page real estate seemed to max out at before there were the overflow issues.

@Alchez
Copy link
Copy Markdown
Collaborator

Alchez commented Jun 11, 2025

@agritheory

Provide no-print background image field of check stock with watermark

So I'm reusing the background image field in Check Run Settings, which will allow importing any attached image there into a Print Format for display.

For the no-print part of it, I've added an app-wide stylesheet that will programmatically remove the background image from any print requested.

PS: I've also added a commit that will fix the background image display in Example Voucher, but I'm not sure if that was intentionally set that way?

Repository owner deleted a comment from github-actions Bot Jun 11, 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-11 17:48:26.177526948 +0000
+++ /dev/fd/62	2025-06-11 17:48:26.177526948 +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-11 17:48:26.186527119 +0000
+++ /dev/fd/62	2025-06-11 17:48:26.186527119 +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-11 17:48:26.195527290 +0000
+++ /dev/fd/62	2025-06-11 17:48:26.195527290 +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">
+	.print-format {
+		background-image: url({{crs_doc.background_image or ''}});
+	}
+</style>
+
+<div class="back_image">
+	<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>
+<div class="page-break"></div>
+{% endif %}

Repository owner deleted a comment from github-actions Bot Jun 17, 2025
@Alchez Alchez mentioned this pull request Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants