Tuesday, July 19, 2016

Erpnext-Sample Print Format for Quotation Module

To create a new Print Format


  • Go to Setup->Print Format
  • Select Doctype-Example :- Quotation
  • Tick Custom Doctype Checkbox 
  • Select Print Format Type as Server
  • Write print format code into Text box


{% if letter_head and not no_letterhead -%}

    <div class="letter-head">{{ letter_head }}</div>

    <hr>

{%- endif %}


<small>

<big>

<p class="text-center"><b>{{ _("Quotation") }}</b></p><br>

</big>


<div class="row">    

     <div class="col-xs-6">        

        <div class="row">

            <div class="col-xs-5 text-right"><big><b>Customer Name</b></big></div>

            {%- if doc.customer -%}

                <div class="col-xs-6 "><big>{{ doc.customer or '' }}</big> </div>

            {%- else -%}

                <div class="col-xs-6 "><big>{{ doc.customer_name or '' }}</big> </div>

            {%- endif -%}

        </div>

             

    </div>


    <div class="col-xs-6">

        <div class="row">

            <div class="col-xs-6 text-right"><big><b>Quotation No</b></big></div>

            <div class="col-xs-6 "><big>{{ doc.name or '' }}</big> </div>

        </div>

        <div class="row">

            <div class="col-xs-6 text-right"> <big><b>Date</b></big> </div>

            <div class="col-xs-6 "><big>{{ doc.get_formatted("transaction_date") or '' }}</big>                  </div>

        </div>

   

    </div>

         

</div>


<br>

<br>


<table class="table table-condensed table-hover table-bordered">

  <tbody>

    <tr>

      <th>Sr</th>

      <th>Item</th>

      <th class="text-right">Qty</th>

      <th class="text-right">Rate</th>

      <th class="text-right">Amount</th>

    </tr>

    {%- for row in doc.items -%}


    <tr>

      <td style="width: 3%;">{{ row.idx }}</td>


      <td style="width: 50%;">{{ row.item_code}}    </td>

      <td style="width: 8%; text-align: right;">{{ row.qty }} </td>

      <td style="width: 15%; text-align: right;">{{

        row.get_formatted("rate", doc) }}</td>

      <td style="width: 15%; text-align: right;">{{

        row.get_formatted("amount", doc) }}</td>

       


      </tr>

    {%- endfor -%}

    {%- if doc.discount_amount -%}

    <tr>

         <td colspan="4"><b>{{ _("Net Total") }}</b> </td>

         <td style="width: 8%; text-align: right;"><b>{{ doc.get_formatted("total") or '' }} </b></td>

    </tr>

    <tr>

         <td colspan="4"><b>{{ _("Discount") }}</b> </td>

         <td style="width: 8%; text-align: right;"><b>{{ doc.get_formatted("discount_amount") or '' }} </b></td>

    </tr>

 {%- endif -%}

    <tr>

         <td colspan="4"><b>{{ _("Total : ") }}{{ doc.in_words or '' }}</b> </td>

         <td style="width: 8%; text-align: right;"><b>{{ doc.get_formatted("grand_total") or '' }} </b></td>

    </tr>

  </tbody>

</table>

<br>


<div class="row">

 <div class="col-xs-12 text-left"><big>{{ doc.terms or '' }}</big></div>

</div>

</small>


Result



4 comments:

  1. Thanks for the tutorials on this blog I have gained better experience in deploying and working with frappe and erpnext.

    Keep up the good work brother.

    ReplyDelete
  2. Thanks Hafees. I dug up this step to include for other learners -

    To specify your custom HTML as the default Print Format for a Quotation, go to Setup -> Customize Form as explained here

    https://discuss.erpnext.com/t/how-to-set-a-default-print-format/5446

    ReplyDelete
  3. Can you create print format from a query report?

    ReplyDelete
    Replies
    1. yes.please check the tutorials

      https://frappe.io/docs/user/en/guides/reports-and-printing/print-format-for-reports

      Delete