Due date in SO depends on Terms

We have to get the due date in sales order depending upon the Terms used in the SO.The terms mainly used are

1.Due on receipt

2. N days EOM

3. Net N

Where is the N number .eg:Net 30, 15 days EOM

<?xml version="1.0"?><!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<pdf>
<head>
	<link name="NotoSans" type="font" subtype="truetype" src="${nsfont.NotoSans_Regular}" src-bold="${nsfont.NotoSans_Bold}" src-italic="${nsfont.NotoSans_Italic}" src-bolditalic="${nsfont.NotoSans_BoldItalic}" bytes="2" />
	<#if .locale == "zh_CN">
		<link name="NotoSansCJKsc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKsc_Regular}" src-bold="${nsfont.NotoSansCJKsc_Bold}" bytes="2" />
	<#elseif .locale == "zh_TW">
		<link name="NotoSansCJKtc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKtc_Regular}" src-bold="${nsfont.NotoSansCJKtc_Bold}" bytes="2" />
	<#elseif .locale == "ja_JP">
		<link name="NotoSansCJKjp" type="font" subtype="opentype" src="${nsfont.NotoSansCJKjp_Regular}" src-bold="${nsfont.NotoSansCJKjp_Bold}" bytes="2" />
	<#elseif .locale == "ko_KR">
		<link name="NotoSansCJKkr" type="font" subtype="opentype" src="${nsfont.NotoSansCJKkr_Regular}" src-bold="${nsfont.NotoSansCJKkr_Bold}" bytes="2" />
	<#elseif .locale == "th_TH">
		<link name="NotoSansThai" type="font" subtype="opentype" src="${nsfont.NotoSansThai_Regular}" src-bold="${nsfont.NotoSansThai_Bold}" bytes="2" />
	</#if>
    <macrolist>
        <macro id="nlheader">
            <table class="header" style="width: 100%; border: 0px solid black;"><tr>
              <td style="margin:1px; width: 217.5px; height: 102px;vertical-align: top; font-size: 8.5pt; padding: 0;"><#if companyInformation.logoUrl?length != 0><img src="${companyInformation.logoUrl}" style="float: left; margin:0px; height: 76px; width: 320.5px; border: 0px solid black;" /></#if><br/></td>
	
	<td align="left" style="margin-top:0px; border:0px solid black; width: 76px; vertical-align: top; "><span class="title"><b> ${record@title}</b></span>&nbsp;
	<table cellspacing="3" style="width: 100%;  margin-top: 4px; font-size:11pt; border: 0px solid black;"><tr>
		<td style="width: 27%;">Date</td>
		<td style="width: 78%;">:${record.trandate}</td>
		</tr>
		<tr>
		<td style="width: 20%;">SO#</td>
		<td style="width: 80%;">:${record.tranid}</td>
		</tr></table>
	</td>
	</tr>
             
          </table>
          
        </macro>
        <macro id="nlfooter">
            <table style="width: 100%; font-size: 8pt; padding: 0; border: 0px solid black;"><tr><td> All orders accepted by North Brisbane Powder Coating are subject to our Standard Terms and Conditions which are available on request. North Brisbane Powder Coating makes every effort to provide services based on the information supplied by the customer, supply times and prevailing pricing - we are not liable for any errors, omission, under or over quantities of any item. It is the customers sole responsibility to confirm the items and quantities required for their specific project or needs at the time an order is placed with and accepted by North Brisbane Powder Coating</td>
              </tr>
              <tr>
		<td align="right" style="padding-right:-16px;"><pagenumber/> of <totalpages/></td>
	</tr></table>
        </macro>
    </macrolist>
    <style type="text/css">* {
		<#if .locale == "zh_CN">
			font-family: NotoSans, NotoSansCJKsc, sans-serif;
		<#elseif .locale == "zh_TW">
			font-family: NotoSans, NotoSansCJKtc, sans-serif;
		<#elseif .locale == "ja_JP">
			font-family: NotoSans, NotoSansCJKjp, sans-serif;
		<#elseif .locale == "ko_KR">
			font-family: NotoSans, NotoSansCJKkr, sans-serif;
		<#elseif .locale == "th_TH">
			font-family: NotoSans, NotoSansThai, sans-serif;
		<#else>
			font-family: NotoSans, sans-serif;
		</#if>
		}
        table {
            font-size: 9pt;
            table-layout: fixed;
        }
        th {
            font-weight: bold;
            font-size: 8pt;
            vertical-align: middle;
            padding: 5px 6px 3px;
            background-color: #A9A9A9;
            color: #333333;
        }
        td {
            padding: 4px 6px;
        }
		td p { align:left }
        b {
            font-weight: bold;
            color: #333333;
        }
        table.header td {
            padding: 0;
            font-size: 10pt;
        }
        table.footer td {
            padding: 0;
            font-size: 8pt;
        }
        table.itemtable th {
            padding-bottom: 10px;
            padding-top: 10px;
        }
        table.body td {
            padding-top: 2px;
        }
        table.total {
            page-break-inside: avoid;
        }
        tr.totalrow {
            background-color: #e3e3e3;
            line-height: 200%;
        }
        td.totalboxtop {
            font-size: 12pt;
            background-color: #e3e3e3;
        }
        td.addressheader {
            font-size: 8pt;
            padding-top: 6px;
            padding-bottom: 2px;
        }
        td.address {
            padding-top: 0;
        }
        td.totalboxmid {
            font-size: 28pt;
            padding-top: 20px;
            background-color: #e3e3e3;
        }
        td.totalboxbot {
            background-color: #e3e3e3;
            font-weight: bold;
        }
        span.title {
            font-size: 19pt;
            width:78px;
            margin-left:3.7px;
            
        }
      span.addr{
         margin-left:4px;
      }
        span.number {
            font-size: 16pt;
        }
        span.itemname {
            font-weight: bold;
            line-height: 150%;
        }
        hr {
            width: 100%;
            color: #d3d3d3;
            background-color: #A9A9A9;
            height: 1px;
        }
</style>
</head>
<body header="nlheader" header-height="10%" footer="nlfooter" footer-height="60pt" padding="0.55in 0.55in 0.55in 0.55in" size="A4">
    <table style="width: 100%;  border: 0px solid black; "><tr>
	<td style="width: 30%; border: 0px solid black;">
	<table cellspacing="-2" style="width: 100%;  border: 0px solid black; margin-top: -13px; vertical-align: top; font-size:11pt; "><tr>
		<td style="line-height:11; margin-left: 0px; margin-top: 0px; text-align: right;"><b>${record.billaddress@label}</b></td>
		</tr>
		<tr>
		<td style="margin-top: 0px; line-height:11;">${record.billaddress}</td>
		</tr>
		<tr></tr></table>
	</td> <td style="width: 30%; border: 0px solid black;">
	<table cellspacing="-2" style="width: 100%;  border: 0px solid black; margin-top: -13px; vertical-align: top; font-size:11pt; "><tr>
		<td style="line-height:11; margin-left: 0px; margin-top: 0px; text-align: right;"><b>${record.shipaddress@label}</b></td>
		</tr>
		<tr>
		<td style="margin-top: 0px; line-height:11;">${record.shipaddress}</td>
		</tr>
		<tr></tr></table>
	</td>
	<td colspan="3">
	<table cellspacing="-1" style="width: 100%;  border:0px solid black; margin-top: -42px; font-size:10pt; vertical-align: top;"><tr>
		<td style="width: 27%;">ABN</td>
		<td style="width: 78%;">:${companyInformation.federalidnumber}</td>
		</tr>
		<tr>
		<td style="width: 20%;">Ph</td>
		<td style="width: 80%;">:${companyInformation.custrecord_ss_anz_sub_phone}</td>
		</tr>
		<tr>
		<td style="width: 20%;">Email</td>
		<td style="width: 80%;">:${companyInformation.custrecord_ss_anz_sub_email}</td>
		</tr>
      <tr>
		<td style="width: 20%;">Web</td>
		<td style="width: 80%;">:${companyInformation.url}</td>
		</tr>
      <tr>
        <#assign BillAddrs = companyInformation.mainaddress_text />
		<td>Address</td>
        <td style="margin-top: 2px;">: Units 6,7<br/> 31 – 79 Paisley Drive <br/> Lawnton Qld 4501, Australia <br/> </td>

	</tr>
      <tr><td>&nbsp;</td></tr>
      </table>
	</td>
	</tr>
</table>

   
  <table class="body" style="width: 100%; margin-top: 14px;"><tr>
	<th>Terms</th>
	<th>Due Date</th>
	<th>Rep</th>
    <th>P.O. No.</th>
    <th>Ship Date</th>
      <th>Ship Via</th>
	</tr>
	<tr>
	<td>${record.terms}</td>
      <td>
        <#assign term=record.terms>
          
         <#if term?contains("Due on receipt")>
           ${record.trandate}
          
        <#elseif term?contains("Net")>
            <#assign term1 = term?replace("\\D+", "", "r")>
            <#assign date = record.trandate?string["dd"]>
            <!-- ${date?number + term1?number}-->
            <#assign date2 = date?number + term1?number>
        ${record.trandate?string[date2+"/MM/YYYY"]?date}
          
        <#elseif term?contains("EOM")>
            <#assign term2 = term?replace("\\D+", "", "r")>
            <#assign date3 = record.trandate?string["dd"]>
            <#assign date4 = date3?number + term2?number>
            <!--  ${record.trandate?string[date4+"/MM/YYYY"]?date}-->
           <#assign lastday=record.trandate?string[date4+"/MM/YYYY"]?date>
           
          
            <#assign lastdaymonth=lastday?string["MM"]>
            <#assign lastdaymonth1=lastdaymonth?number>
              
            <#assign lastdayyear=lastday?string["YYYY"]>
                <#assign lastday=0>
              
              <#switch lastdaymonth1>
  <#case 1>
  <#case 3>
  <#case 5>
  <#case 7>
  <#case 8>
  <#case 10>
  <#case 12>
    <#assign lastday=31><#break>
  <#case 4>
  <#case 6>
  <#case 9>
  <#case 11>
    <#assign lastday=30><#break>
  <#case 2>
    <#assign lastday=28>
    <#break>
  <#default>
    Invalid month
</#switch>
     <#assign lastdate=""+lastday+ "/"+(lastdaymonth1) + "/" + lastdayyear>
          
             <#assign duedate= lastdate?date>
               ${duedate}
                 <!-- ${duedate?string.full}-->
               
            </#if> 
        </td>
       
          
          
          
          
          
	<td>${record.salesrep}</td>
    <td>${record.otherrefnum}</td>
      <td>${record.shipdate}</td>
      <td>${record.shipmethod}</td>
	</tr>
    </table>
<#if record.item?has_content>

<table style="width: 100%; margin-top: 10px;"><!-- start items --><#list record.item as item><#if item_index==0>
<thead>
	<tr>
	<th align="left" colspan="4" style="padding: 10px 6px; ">${item.item@label}</th>
    <th align="left" colspan="6" style="padding: 10px 6px; ">${item.description@label}</th>
	<th align="center" colspan="3" >${item.quantity@label}</th>
    <th align="center" colspan="3" >UOM</th>
	<th align="right" colspan="4" >${item.rate@label}</th>
    <th align="right" colspan="4" >Tax Amt</th>
      	<th align="right" colspan="4" >Amt ex GST</th>

    
	</tr>
</thead>
</#if><tr style='background-color: ${((item_index % 2)==0)?string("White", "Gainsboro")}'>
	<td align="left" colspan="4" line-height="150%" >${item.item}</td>
    <td align="left" colspan="6" >${item.description}</td>
	<td align="center" colspan="3" >${item.quantity}</td>
	<td align="center" colspan="3" >${item.units}</td>
    <td align="right" colspan="4" >${item.rate}</td>
	    <td align="right" colspan="4" >${item.tax1amt}</td>
  <td align="right" colspan="4" >${item.amount}</td>
	</tr>
	</#list><!-- end items --></table>
</#if>
<hr />

<table style="width:100%;"><tr><td>
    <table style="width:100%;" >
  <tr><td style="width:70%; padding-left: 0px; margin-top:0px;">This invoice is payable by EFT into the following bank account:-<br/>
BSB: 041-271<br/>
Act: 642721571<br/>
Name: NBPC Trust<br/><br/>

Payments made by credit or debit cards will incur a 1.5% surcharge.
    </td>
  </tr></table>
     </td><td style="width:30%;"><table page-break-inside="avoid" align="right" style="width:100%; margin-top: 0px;"><tr>
	<td align="right" style="font-weight: bold; color: #333333;">S/T ex GST</td>
	<td align="right">${record.subtotal}</td>
	</tr>
	<tr>
	<td align="right" style="font-weight: bold; color: #333333;">GST</td>
	<td align="right">${record.taxtotal}</td>
	</tr>
	<tr>
	<td align="right" style="font-weight: bold; font-size: 10pt;">${record.total@label}</td>
	<td align="right" style="font-weight: bold; font-size: 10pt;">${record.total}</td>
	</tr></table>
    </td></tr></table>
</body>
</pdf>

Leave a comment

Your email address will not be published. Required fields are marked *