<!DOCTYPE html>
<html lang='en'>
<head>
<title>robots.txt « doc - ikiwiki-upstream - Unnamed repository; edit this file to name it for gitweb.</title>
<meta name='generator' content='cgit v1.2.3'/>
<meta name='robots' content='index, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit-css/cgit.css'/>
<link rel='stylesheet' type='text/css' href='/cgit-local/local.css'/>
<script type='text/javascript' src='/cgit.js'></script>
<link rel='shortcut icon' href='/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='https://source.jones.dk/ikiwiki-upstream/atom/doc/robots.txt?h=master' type='application/atom+xml'/>
<link rel='vcs-git' href='https://source.jones.dk/ikiwiki-upstream' title='ikiwiki-upstream Git repository'/>
<link rel='vcs-git' href='user@source.jones.dk:ikiwiki-upstream' title='ikiwiki-upstream Git repository'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/'><img src='/cgit-css/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/'>index</a> : <a href='/ikiwiki-upstream/'>ikiwiki-upstream</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='dd96853fe36102e512dea69d06514786cd9a96df'/><select name='h' onchange='this.form.submit();'>
<option value='layoutgala'>layoutgala</option>
<option value='master' selected='selected'>master</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Unnamed repository; edit this file to name it for gitweb.</td><td class='sub right'>Jonas Smedegaard</td></tr></table>
<table class='tabs'><tr><td>
<a href='/ikiwiki-upstream/'>summary</a><a href='/ikiwiki-upstream/refs/?id=dd96853fe36102e512dea69d06514786cd9a96df'>refs</a><a href='/ikiwiki-upstream/log/doc/robots.txt'>log</a><a class='active' href='/ikiwiki-upstream/tree/doc/robots.txt?id=dd96853fe36102e512dea69d06514786cd9a96df'>tree</a><a href='/ikiwiki-upstream/commit/doc/robots.txt?id=dd96853fe36102e512dea69d06514786cd9a96df'>commit</a><a href='/ikiwiki-upstream/diff/doc/robots.txt?id=dd96853fe36102e512dea69d06514786cd9a96df'>diff</a></td><td class='form'><form class='right' method='get' action='/ikiwiki-upstream/log/doc/robots.txt'>
<input type='hidden' name='id' value='dd96853fe36102e512dea69d06514786cd9a96df'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/ikiwiki-upstream/tree/?id=dd96853fe36102e512dea69d06514786cd9a96df'>root</a>/<a href='/ikiwiki-upstream/tree/doc?id=dd96853fe36102e512dea69d06514786cd9a96df'>doc</a>/<a href='/ikiwiki-upstream/tree/doc/robots.txt?id=dd96853fe36102e512dea69d06514786cd9a96df'>robots.txt</a></div><div class='content'>blob: 7be87f9bd26743ebc07329da7bd38180d7e9e134 (<a href='/ikiwiki-upstream/plain/doc/robots.txt?id=dd96853fe36102e512dea69d06514786cd9a96df'>plain</a>)
<table summary='blob content' class='blob'>
<tr>
<td class='lines'><pre><code><ol class="hl">
<li id="n_1" class="hl">User-Agent:&nbsp;*</li>
<li id="n_2" class="hl">Disallow: /ikiwiki.cgi</li>
</ol></code></pre></td></tr></table>
</div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit v1.2.3</a> (<a href='https://git-scm.com/'>git 2.46.0</a>) at 2025-06-30 15:47:05 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>
nbsp;LedgerSMB Small Medium Business Accounting</span></li>
<li id="n_3" class="hl"><span class="hl slc"># http://www.ledgersmb.org/</span></li>
<li id="n_4" class="hl"><span class="hl slc">#</span></li>
<li id="n_5" class="hl"></li>
<li id="n_6" class="hl"><span class="hl slc"># Copyright (C) 2006</span></li>
<li id="n_7" class="hl"><span class="hl slc"># This work contains copyrighted information from a number of sources all used</span></li>
<li id="n_8" class="hl"><span class="hl slc"># with permission.</span></li>
<li id="n_9" class="hl"><span class="hl slc">#</span></li>
<li id="n_10" class="hl"><span class="hl slc"># This file contains source code included with or based on SQL-Ledger which</span></li>
<li id="n_11" class="hl"><span class="hl slc"># is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed </span></li>
<li id="n_12" class="hl"><span class="hl slc"># under the GNU General Public License version 2 or, at your option, any later </span></li>
<li id="n_13" class="hl"><span class="hl slc"># version.  For a full list including contact information of contributors, </span></li>
<li id="n_14" class="hl"><span class="hl slc"># maintainers, and copyright holders, see the CONTRIBUTORS file.</span></li>
<li id="n_15" class="hl"><span class="hl slc">#</span></li>
<li id="n_16" class="hl"><span class="hl slc"># Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):</span></li>
<li id="n_17" class="hl"><span class="hl slc"># Copyright (c) 2002</span></li>
<li id="n_18" class="hl"><span class="hl slc">#</span></li>
<li id="n_19" class="hl"><span class="hl slc">#  Author: DWS Systems Inc.</span></li>
<li id="n_20" class="hl"><span class="hl slc">#     Web: http://www.sql-ledger.org</span></li>
<li id="n_21" class="hl"><span class="hl slc">#</span></li>
<li id="n_22" class="hl"><span class="hl slc">#</span></li>
<li id="n_23" class="hl"><span class="hl slc"># This program is free software; you can redistribute it and/or modify</span></li>
<li id="n_24" class="hl"><span class="hl slc"># it under the terms of the GNU General Public License as published by</span></li>
<li id="n_25" class="hl"><span class="hl slc"># the Free Software Foundation; either version 2 of the License, or</span></li>
<li id="n_26" class="hl"><span class="hl slc"># (at your option) any later version.</span></li>
<li id="n_27" class="hl"><span class="hl slc">#</span></li>
<li id="n_28" class="hl"><span class="hl slc"># This program is distributed in the hope that it will be useful,</span></li>
<li id="n_29" class="hl"><span class="hl slc"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span></li>
<li id="n_30" class="hl"><span class="hl slc"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></li>
<li id="n_31" class="hl"><span class="hl slc"># GNU General Public License for more details.</span></li>
<li id="n_32" class="hl"><span class="hl slc"># You should have received a copy of the GNU General Public License</span></li>
<li id="n_33" class="hl"><span class="hl slc"># along with this program; if not, write to the Free Software</span></li>
<li id="n_34" class="hl"><span class="hl slc"># Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span></li>
<li id="n_35" class="hl"><span class="hl slc">#######################################################################</span></li>
<li id="n_36" class="hl"><span class="hl slc">#</span></li>
<li id="n_37" class="hl"><span class="hl slc"># common routines used in is, ir, oe</span></li>
<li id="n_38" class="hl"><span class="hl slc">#</span></li>
<li id="n_39" class="hl"><span class="hl slc">#######################################################################</span></li>
<li id="n_40" class="hl"></li>
<li id="n_41" class="hl"><span class="hl kwa">use </span>LedgerSMB<span class="hl opt">::</span>Tax<span class="hl opt">;</span></li>
<li id="n_42" class="hl"><span class="hl kwa">use </span>LedgerSMB<span class="hl opt">::</span>Sysconfig<span class="hl opt">;</span></li>
<li id="n_43" class="hl"></li>
<li id="n_44" class="hl"><span class="hl slc"># any custom scripts for this one</span></li>
<li id="n_45" class="hl"><span class="hl kwa">if </span><span class="hl opt">(-</span>f <span class="hl sng">&quot;bin/custom/io.pl&quot;</span><span class="hl opt">) {</span></li>
<li id="n_46" class="hl">  <span class="hl kwc">eval </span><span class="hl opt">{ </span><span class="hl kwa">require </span><span class="hl sng">&quot;bin/custom/io.pl&quot;</span><span class="hl opt">; };</span></li>
<li id="n_47" class="hl"><span class="hl opt">}</span></li>
<li id="n_48" class="hl"><span class="hl kwa">if </span><span class="hl opt">(-</span>f <span class="hl sng">&quot;bin/custom/</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{login}_io.pl&quot;</span><span class="hl opt">) {</span></li>
<li id="n_49" class="hl">  <span class="hl kwc">eval </span><span class="hl opt">{ </span><span class="hl kwa">require </span><span class="hl sng">&quot;bin/custom/</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{login}_io.pl&quot;</span><span class="hl opt">; };</span></li>
<li id="n_50" class="hl"><span class="hl opt">}</span></li>
<li id="n_51" class="hl"></li>
<li id="n_52" class="hl"></li>
<li id="n_53" class="hl"><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_54" class="hl"><span class="hl slc"># end of main</span></li>
<li id="n_55" class="hl"></li>
<li id="n_56" class="hl"></li>
<li id="n_57" class="hl"><span class="hl slc"># this is for our long dates</span></li>
<li id="n_58" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;January&#39;)</span></li>
<li id="n_59" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;February&#39;)</span></li>
<li id="n_60" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;March&#39;)</span></li>
<li id="n_61" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;April&#39;)</span></li>
<li id="n_62" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;May &#39;)</span></li>
<li id="n_63" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;June&#39;)</span></li>
<li id="n_64" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;July&#39;)</span></li>
<li id="n_65" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;August&#39;)</span></li>
<li id="n_66" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;September&#39;)</span></li>
<li id="n_67" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;October&#39;)</span></li>
<li id="n_68" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;November&#39;)</span></li>
<li id="n_69" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;December&#39;)</span></li>
<li id="n_70" class="hl"></li>
<li id="n_71" class="hl"><span class="hl slc"># this is for our short month</span></li>
<li id="n_72" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Jan&#39;)</span></li>
<li id="n_73" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Feb&#39;)</span></li>
<li id="n_74" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Mar&#39;)</span></li>
<li id="n_75" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Apr&#39;)</span></li>
<li id="n_76" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;May&#39;)</span></li>
<li id="n_77" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Jun&#39;)</span></li>
<li id="n_78" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Jul&#39;)</span></li>
<li id="n_79" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Aug&#39;)</span></li>
<li id="n_80" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Sep&#39;)</span></li>
<li id="n_81" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Oct&#39;)</span></li>
<li id="n_82" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Nov&#39;)</span></li>
<li id="n_83" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Dec&#39;)</span></li>
<li id="n_84" class="hl"></li>
<li id="n_85" class="hl"></li>
<li id="n_86" class="hl"><span class="hl kwa">sub </span>display_row <span class="hl opt">{</span></li>
<li id="n_87" class="hl">  <span class="hl kwc">my </span><span class="hl kwb">$numrows </span><span class="hl opt">= </span><span class="hl kwc">shift</span><span class="hl opt">;</span></li>
<li id="n_88" class="hl"></li>
<li id="n_89" class="hl">  <span class="hl kwb">&#64;column_index </span><span class="hl opt">= </span><span class="hl sng">qw(runningnumber partnumber description qty)</span><span class="hl opt">;</span></li>
<li id="n_90" class="hl"></li>
<li id="n_91" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>type<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&quot;sales_order&quot;</span><span class="hl opt">) {</span></li>
<li id="n_92" class="hl">    <span class="hl kwc">push </span><span class="hl kwb">&#64;column_index</span><span class="hl opt">, </span><span class="hl sng">&quot;ship&quot;</span><span class="hl opt">;</span></li>
<li id="n_93" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>ship<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading align<span class="hl opt">=</span>center width<span class="hl opt">=</span><span class="hl sng">&quot;auto&quot;</span><span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Ship&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_94" class="hl">  <span class="hl opt">}</span></li>
<li id="n_95" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>type<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&quot;purchase_order&quot;</span><span class="hl opt">) {</span></li>
<li id="n_96" class="hl">    <span class="hl kwc">push </span><span class="hl kwb">&#64;column_index</span><span class="hl opt">, </span><span class="hl sng">&quot;ship&quot;</span><span class="hl opt">;</span></li>
<li id="n_97" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>ship<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading align<span class="hl opt">=</span>center width<span class="hl opt">=</span><span class="hl sng">&quot;auto&quot;</span><span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Recd&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_98" class="hl">  <span class="hl opt">}</span></li>
<li id="n_99" class="hl"></li>
<li id="n_100" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(projectnumber partsgroup)</span><span class="hl opt">) {</span></li>
<li id="n_101" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;select</span><span class="hl ipl">$_</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">unescape</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;select</span><span class="hl ipl">$_</span><span class="hl sng">&quot;</span><span class="hl opt">}) </span><span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;select</span><span class="hl ipl">$_</span><span class="hl sng">&quot;</span><span class="hl opt">};</span></li>
<li id="n_102" class="hl">  <span class="hl opt">}</span></li>
<li id="n_103" class="hl">      </li>
<li id="n_104" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>language_code<span class="hl opt">} </span><span class="hl kwc">ne </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>oldlanguage_code<span class="hl opt">}) {</span></li>
<li id="n_105" class="hl">    <span class="hl slc"># rebuild partsgroup</span></li>
<li id="n_106" class="hl">    <span class="hl kwb">$l</span><span class="hl opt">{</span>language_code<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>language_code<span class="hl opt">};</span></li>
<li id="n_107" class="hl">    <span class="hl kwb">$l</span><span class="hl opt">{</span>searchitems<span class="hl opt">} = </span><span class="hl sng">&#39;nolabor&#39;</span> <span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>vc<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;customer&#39;</span><span class="hl opt">;</span></li>
<li id="n_108" class="hl">    </li>
<li id="n_109" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">get_partsgroup</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span>\<span class="hl kwb">%l</span><span class="hl opt">);</span></li>
<li id="n_110" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(&#64; { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>all_partsgroup<span class="hl opt">} }) {</span></li>
<li id="n_111" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectpartsgroup<span class="hl opt">} = </span><span class="hl sng">&quot;&lt;option&gt;</span><span class="hl esc">\n</span><span class="hl sng">&quot;</span><span class="hl opt">;</span></li>
<li id="n_112" class="hl">      <span class="hl kwa">foreach </span><span class="hl kwb">$ref </span><span class="hl opt">(&#64; { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>all_partsgroup<span class="hl opt">} }) {</span></li>
<li id="n_113" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$ref</span><span class="hl opt">-&gt;{</span>translation<span class="hl opt">}) {</span></li>
<li id="n_114" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectpartsgroup<span class="hl opt">} .= </span>qq<span class="hl opt">|&lt;</span>option value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$ref</span><span class="hl sng">-&gt;{partsgroup}--</span><span class="hl ipl">$ref</span><span class="hl sng">-&gt;{id}&quot;</span><span class="hl opt">&gt;</span><span class="hl kwb">$ref</span><span class="hl opt">-&gt;{</span>translation<span class="hl opt">}</span><span class="hl esc">\n</span><span class="hl opt">|;</span></li>
<li id="n_115" class="hl">    <span class="hl opt">} </span><span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_116" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectpartsgroup<span class="hl opt">} .= </span>qq<span class="hl opt">|&lt;</span>option value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$ref</span><span class="hl sng">-&gt;{partsgroup}--</span><span class="hl ipl">$ref</span><span class="hl sng">-&gt;{id}&quot;</span><span class="hl opt">&gt;</span><span class="hl kwb">$ref</span><span class="hl opt">-&gt;{</span>partsgroup<span class="hl opt">}</span><span class="hl esc">\n</span><span class="hl opt">|;</span></li>
<li id="n_117" class="hl">    <span class="hl opt">}</span></li>
<li id="n_118" class="hl">      <span class="hl opt">}</span></li>
<li id="n_119" class="hl">    <span class="hl opt">}</span></li>
<li id="n_120" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>oldlanguage_code<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>language_code<span class="hl opt">};</span></li>
<li id="n_121" class="hl">  <span class="hl opt">}</span></li>
<li id="n_122" class="hl">      </li>
<li id="n_123" class="hl"></li>
<li id="n_124" class="hl">  <span class="hl kwc">push </span><span class="hl kwb">&#64;column_index</span><span class="hl opt">, &#64;{</span>LedgerSMB<span class="hl opt">::</span>Sysconfig<span class="hl opt">::</span>io_lineitem_columns<span class="hl opt">};</span></li>
<li id="n_125" class="hl"></li>
<li id="n_126" class="hl">  <span class="hl kwc">my </span><span class="hl kwb">$colspan </span><span class="hl opt">= </span><span class="hl kwb">$#column_index </span><span class="hl opt">+ </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_127" class="hl"></li>
<li id="n_128" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>invsubtotal<span class="hl opt">} = </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_129" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwc">split </span><span class="hl kwd">/ /</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>taxaccounts<span class="hl opt">}) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_base&quot;</span><span class="hl opt">} = </span><span class="hl num">0 </span><span class="hl opt">}</span></li>
<li id="n_130" class="hl">  </li>
<li id="n_131" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>runningnumber<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Item&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_132" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>partnumber<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Number&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_133" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>description<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Description&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_134" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>qty<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Qty&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_135" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>unit<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Unit&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_136" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>sellprice<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Price&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_137" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>discount<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading<span class="hl opt">&gt;%&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_138" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>linetotal<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Extended&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_139" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>bin<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Bin&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_140" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>onhand<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;OH&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_141" class="hl">  </li>
<li id="n_142" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_143" class="hl">  <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_144" class="hl">    <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span></li>
<li id="n_145" class="hl">      <span class="hl opt">&lt;</span>table width<span class="hl opt">=</span><span class="hl num">100</span><span class="hl opt">%&gt;</span></li>
<li id="n_146" class="hl">    <span class="hl opt">&lt;</span>tr <span class="hl kwa">class</span><span class="hl opt">=</span>listheading<span class="hl opt">&gt;|;</span></li>
<li id="n_147" class="hl"></li>
<li id="n_148" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwb">&#64;column_index</span><span class="hl opt">) { </span><span class="hl kwc">print </span><span class="hl sng">&quot;</span><span class="hl esc">\n</span><span class="hl sng"></span><span class="hl ipl">$column_data</span><span class="hl sng">{</span><span class="hl ipl">$_</span><span class="hl sng">}&quot;</span> <span class="hl opt">}</span></li>
<li id="n_149" class="hl"></li>
<li id="n_150" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_151" class="hl">        <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_152" class="hl"><span class="hl opt">|;</span></li>
<li id="n_153" class="hl"></li>
<li id="n_154" class="hl"></li>
<li id="n_155" class="hl">  <span class="hl kwb">$deliverydate </span><span class="hl opt">= </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Delivery Date&#39;</span><span class="hl opt">);</span></li>
<li id="n_156" class="hl">  <span class="hl kwb">$serialnumber </span><span class="hl opt">= </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Serial No.&#39;</span><span class="hl opt">);</span></li>
<li id="n_157" class="hl">  <span class="hl kwb">$projectnumber </span><span class="hl opt">= </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Project&#39;</span><span class="hl opt">);</span></li>
<li id="n_158" class="hl">  <span class="hl kwb">$group </span><span class="hl opt">= </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Group&#39;</span><span class="hl opt">);</span></li>
<li id="n_159" class="hl">  <span class="hl kwb">$sku </span><span class="hl opt">= </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;SKU&#39;</span><span class="hl opt">);</span></li>
<li id="n_160" class="hl"></li>
<li id="n_161" class="hl">  <span class="hl kwb">$delvar </span><span class="hl opt">= </span><span class="hl sng">&#39;deliverydate&#39;</span><span class="hl opt">;</span></li>
<li id="n_162" class="hl">  </li>
<li id="n_163" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>type<span class="hl opt">} =~ </span><span class="hl kwd">/_(order|quotation)$/</span><span class="hl opt">) {</span></li>
<li id="n_164" class="hl">    <span class="hl kwb">$reqdate </span><span class="hl opt">= </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Required by&#39;</span><span class="hl opt">);</span></li>
<li id="n_165" class="hl">    <span class="hl kwb">$delvar </span><span class="hl opt">= </span><span class="hl sng">&#39;reqdate&#39;</span><span class="hl opt">;</span></li>
<li id="n_166" class="hl">  <span class="hl opt">}</span></li>
<li id="n_167" class="hl"></li>
<li id="n_168" class="hl">  <span class="hl kwb">$exchangerate </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>exchangerate<span class="hl opt">});</span></li>
<li id="n_169" class="hl">  <span class="hl kwb">$exchangerate </span><span class="hl opt">= (</span><span class="hl kwb">$exchangerate</span><span class="hl opt">) ? </span><span class="hl kwb">$exchangerate </span><span class="hl opt">: </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_170" class="hl"></li>
<li id="n_171" class="hl">  <span class="hl kwb">$spc </span><span class="hl opt">= </span><span class="hl kwc">substr</span><span class="hl opt">(</span><span class="hl kwb">$myconfig</span><span class="hl opt">{</span>numberformat<span class="hl opt">},-</span><span class="hl num">3</span><span class="hl opt">,</span><span class="hl num">1</span><span class="hl opt">);</span></li>
<li id="n_172" class="hl">  <span class="hl kwa">for </span><span class="hl kwb">$i </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. </span><span class="hl kwb">$numrows</span><span class="hl opt">) {</span></li>
<li id="n_173" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$spc </span><span class="hl kwc">eq </span><span class="hl sng">&#39;.&#39;</span><span class="hl opt">) {</span></li>
<li id="n_174" class="hl">      <span class="hl opt">(</span><span class="hl kwb">$null</span><span class="hl opt">, </span><span class="hl kwb">$dec</span><span class="hl opt">) = </span><span class="hl kwc">split </span><span class="hl kwd">/\./</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;sellprice_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">};</span></li>
<li id="n_175" class="hl">    <span class="hl opt">} </span><span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_176" class="hl">      <span class="hl opt">(</span><span class="hl kwb">$null</span><span class="hl opt">, </span><span class="hl kwb">$dec</span><span class="hl opt">) = </span><span class="hl kwc">split </span><span class="hl kwd">/,/</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;sellprice_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">};</span></li>
<li id="n_177" class="hl">    <span class="hl opt">}</span></li>
<li id="n_178" class="hl">    <span class="hl kwb">$dec </span><span class="hl opt">= </span><span class="hl kwc">length </span><span class="hl kwb">$dec</span><span class="hl opt">;</span></li>
<li id="n_179" class="hl">    <span class="hl kwb">$decimalplaces </span><span class="hl opt">= (</span><span class="hl kwb">$dec </span><span class="hl opt">&gt; </span><span class="hl num">2</span><span class="hl opt">) ? </span><span class="hl kwb">$dec </span><span class="hl opt">: </span><span class="hl num">2</span><span class="hl opt">;</span></li>
<li id="n_180" class="hl"></li>
<li id="n_181" class="hl">    <span class="hl slc"># undo formatting</span></li>
<li id="n_182" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(qty oldqty ship discount sellprice)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}) }</span></li>
<li id="n_183" class="hl">    </li>
<li id="n_184" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} != </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;oldqty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}) {</span></li>
<li id="n_185" class="hl">      <span class="hl slc"># check pricematrix</span></li>
<li id="n_186" class="hl">      <span class="hl kwb">&#64;a </span><span class="hl opt">= </span><span class="hl kwc">split </span><span class="hl kwd">/ /</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;pricematrix_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">};</span></li>
<li id="n_187" class="hl">      <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">scalar </span><span class="hl kwb">&#64;a </span><span class="hl opt">&gt; </span><span class="hl num">2</span><span class="hl opt">) {</span></li>
<li id="n_188" class="hl">    <span class="hl kwa">foreach </span><span class="hl kwb">$item </span><span class="hl opt">(</span><span class="hl kwb">&#64;a</span><span class="hl opt">) {</span></li>
<li id="n_189" class="hl">      <span class="hl opt">(</span><span class="hl kwb">$q</span><span class="hl opt">, </span><span class="hl kwb">$p</span><span class="hl opt">) = </span><span class="hl kwc">split </span><span class="hl kwd">/:/</span><span class="hl opt">, </span><span class="hl kwb">$item</span><span class="hl opt">;</span></li>
<li id="n_190" class="hl">      <span class="hl kwa">if </span><span class="hl opt">((</span><span class="hl kwb">$p </span><span class="hl opt">* </span><span class="hl num">1</span><span class="hl opt">) &amp;&amp; (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} &gt;= (</span><span class="hl kwb">$q </span><span class="hl opt">* </span><span class="hl num">1</span><span class="hl opt">))) {</span></li>
<li id="n_191" class="hl">        <span class="hl opt">(</span><span class="hl kwb">$dec</span><span class="hl opt">) = (</span><span class="hl kwb">$p </span><span class="hl opt">=~ </span><span class="hl kwd">/\.(\d+)/</span><span class="hl opt">);</span></li>
<li id="n_192" class="hl">        <span class="hl kwb">$dec </span><span class="hl opt">= </span><span class="hl kwc">length </span><span class="hl kwb">$dec</span><span class="hl opt">;</span></li>
<li id="n_193" class="hl">        <span class="hl kwb">$decimalplaces </span><span class="hl opt">= (</span><span class="hl kwb">$dec </span><span class="hl opt">&gt; </span><span class="hl num">2</span><span class="hl opt">) ? </span><span class="hl kwb">$dec </span><span class="hl opt">: </span><span class="hl num">2</span><span class="hl opt">;</span></li>
<li id="n_194" class="hl">        <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;sellprice_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">round_amount</span><span class="hl opt">(</span><span class="hl kwb">$p </span><span class="hl opt">/ </span><span class="hl kwb">$exchangerate</span><span class="hl opt">, </span><span class="hl kwb">$decimalplaces</span><span class="hl opt">);</span></li>
<li id="n_195" class="hl">      <span class="hl opt">}</span></li>
<li id="n_196" class="hl">    <span class="hl opt">}</span></li>
<li id="n_197" class="hl">      <span class="hl opt">}</span></li>
<li id="n_198" class="hl">    <span class="hl opt">}</span></li>
<li id="n_199" class="hl">    </li>
<li id="n_200" class="hl">    <span class="hl kwb">$discount </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">round_amount</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;sellprice_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} * </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;discount_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}/</span><span class="hl num">100</span><span class="hl opt">, </span><span class="hl kwb">$decimalplaces</span><span class="hl opt">);</span></li>
<li id="n_201" class="hl">    <span class="hl kwb">$linetotal </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">round_amount</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;sellprice_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} - </span><span class="hl kwb">$discount</span><span class="hl opt">, </span><span class="hl kwb">$decimalplaces</span><span class="hl opt">);</span></li>
<li id="n_202" class="hl">    <span class="hl kwb">$linetotal </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">round_amount</span><span class="hl opt">(</span><span class="hl kwb">$linetotal </span><span class="hl opt">* </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}, </span><span class="hl num">2</span><span class="hl opt">);</span></li>
<li id="n_203" class="hl"></li>
<li id="n_204" class="hl">    </li>
<li id="n_205" class="hl">    <span class="hl kwa">if </span><span class="hl opt">((</span><span class="hl kwb">$rows </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">numtextrows</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;description_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}, </span><span class="hl num">46</span><span class="hl opt">, </span><span class="hl num">6</span><span class="hl opt">)) &gt; </span><span class="hl num">1</span><span class="hl opt">) {</span></li>
<li id="n_206" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;description_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">quote</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;description_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">});</span></li>
<li id="n_207" class="hl">      <span class="hl kwb">$column_data</span><span class="hl opt">{</span>description<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td<span class="hl opt">&gt;&lt;</span>textarea name<span class="hl opt">=</span><span class="hl sng">&quot;description_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> rows<span class="hl opt">=</span><span class="hl kwb">$rows </span>cols<span class="hl opt">=</span><span class="hl num">46 </span>wrap<span class="hl opt">=</span>soft<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;description_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}&lt;</span><span class="hl kwd">/textarea&gt;&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_208" class="hl">    <span class="hl opt">} </span><span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_209" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;description_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">quote</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;description_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">});</span></li>
<li id="n_210" class="hl">      <span class="hl kwb">$column_data</span><span class="hl opt">{</span>description<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span><span class="hl sng">&quot;description_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> size<span class="hl opt">=</span><span class="hl num">48 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{&quot;</span>description_<span class="hl kwb">$i</span><span class="hl sng">&quot;}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_211" class="hl">    <span class="hl opt">}</span></li>
<li id="n_212" class="hl"></li>
<li id="n_213" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(partnumber sku unit)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">quote</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}) }</span></li>
<li id="n_214" class="hl">    </li>
<li id="n_215" class="hl">    <span class="hl kwb">$skunumber </span><span class="hl opt">= </span>qq<span class="hl opt">|</span></li>
<li id="n_216" class="hl">                <span class="hl opt">&lt;</span>p<span class="hl opt">&gt;&lt;</span>b<span class="hl opt">&gt;</span><span class="hl kwb">$sku</span><span class="hl opt">&lt;/</span>b<span class="hl opt">&gt; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;sku_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}| </span><span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>vc<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;vendor&#39;</span> <span class="hl opt">&amp;&amp; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;sku_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">});</span></li>
<li id="n_217" class="hl"></li>
<li id="n_218" class="hl">    </li>
<li id="n_219" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectpartsgroup<span class="hl opt">}) {</span></li>
<li id="n_220" class="hl">      <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$i </span><span class="hl opt">&lt; </span><span class="hl kwb">$numrows</span><span class="hl opt">) {</span></li>
<li id="n_221" class="hl">    <span class="hl kwb">$partsgroup </span><span class="hl opt">= </span>qq<span class="hl opt">|</span></li>
<li id="n_222" class="hl">          <span class="hl opt">&lt;</span>b<span class="hl opt">&gt;</span><span class="hl kwb">$group</span><span class="hl opt">&lt;/</span>b<span class="hl opt">&gt;</span></li>
<li id="n_223" class="hl">          <span class="hl opt">&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span><span class="hl sng">&quot;partsgroup_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{&quot;</span>partsgroup_<span class="hl kwb">$i</span><span class="hl sng">&quot;}&quot;</span><span class="hl opt">&gt;|;</span></li>
<li id="n_224" class="hl">    <span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;partsgroup_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}) = </span><span class="hl kwc">split </span><span class="hl kwd">/--/</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;partsgroup_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">};</span></li>
<li id="n_225" class="hl">    <span class="hl kwb">$partsgroup </span><span class="hl opt">.= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;partsgroup_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">};</span></li>
<li id="n_226" class="hl">    <span class="hl kwb">$partsgroup </span><span class="hl opt">= </span><span class="hl sng">&quot;&quot;</span> <span class="hl kwa">unless </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;partsgroup_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">};</span></li>
<li id="n_227" class="hl">      <span class="hl opt">}</span></li>
<li id="n_228" class="hl">    <span class="hl opt">}</span></li>
<li id="n_229" class="hl">    </li>
<li id="n_230" class="hl">    <span class="hl kwb">$delivery </span><span class="hl opt">= </span>qq<span class="hl opt">|</span></li>
<li id="n_231" class="hl">          <span class="hl opt">&lt;</span>td colspan<span class="hl opt">=</span><span class="hl num">2 </span>nowrap<span class="hl opt">&gt;</span></li>
<li id="n_232" class="hl">      <span class="hl opt">&lt;</span>b<span class="hl opt">&gt;${</span><span class="hl kwb">$delvar</span><span class="hl opt">}&lt;/</span>b<span class="hl opt">&gt;</span></li>
<li id="n_233" class="hl">      <span class="hl opt">&lt;</span>input name<span class="hl opt">=</span><span class="hl sng">&quot;${delvar}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> size<span class="hl opt">=</span><span class="hl num">11 </span>title<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$myconfig</span><span class="hl sng">{dateformat}&quot;</span> value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{&quot;</span><span class="hl opt">${</span>delvar<span class="hl opt">}</span>_<span class="hl kwb">$i</span><span class="hl sng">&quot;}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_234" class="hl"><span class="hl opt">|;</span></li>
<li id="n_235" class="hl"></li>
<li id="n_236" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>runningnumber<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span><span class="hl sng">&quot;runningnumber_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> size<span class="hl opt">=</span><span class="hl num">3 </span>value<span class="hl opt">=</span><span class="hl kwb">$i</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_237" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>partnumber<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span><span class="hl sng">&quot;partnumber_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> size<span class="hl opt">=</span><span class="hl num">15 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{&quot;</span>partnumber_<span class="hl kwb">$i</span><span class="hl sng">&quot;}&quot;</span> accesskey<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> title<span class="hl opt">=</span><span class="hl sng">&quot;[Alt-</span><span class="hl ipl">$i</span><span class="hl sng">]&quot;</span><span class="hl opt">&gt;</span><span class="hl kwb">$skunumber</span><span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_238" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>qty<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td align<span class="hl opt">=</span>right<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> title<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{&quot;</span>onhand_<span class="hl kwb">$i</span><span class="hl sng">&quot;}&quot;</span> size<span class="hl opt">=</span><span class="hl num">5 </span>value<span class="hl opt">=|.</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">format_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}).</span>qq<span class="hl opt">|&gt;&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_239" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>ship<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td align<span class="hl opt">=</span>right<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span><span class="hl sng">&quot;ship_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> size<span class="hl opt">=</span><span class="hl num">5 </span>value<span class="hl opt">=|.</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">format_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;ship_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}).</span>qq<span class="hl opt">|&gt;&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_240" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>unit<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span><span class="hl sng">&quot;unit_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> size<span class="hl opt">=</span><span class="hl num">5 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{&quot;</span>unit_<span class="hl kwb">$i</span><span class="hl sng">&quot;}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_241" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>sellprice<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td align<span class="hl opt">=</span>right<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span><span class="hl sng">&quot;sellprice_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> size<span class="hl opt">=</span><span class="hl num">9 </span>value<span class="hl opt">=|.</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">format_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;sellprice_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}, </span><span class="hl kwb">$decimalplaces</span><span class="hl opt">).</span>qq<span class="hl opt">|&gt;&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_242" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>discount<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td align<span class="hl opt">=</span>right<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span><span class="hl sng">&quot;discount_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> size<span class="hl opt">=</span><span class="hl num">3 </span>value<span class="hl opt">=|.</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">format_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;discount_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}).</span>qq<span class="hl opt">|&gt;&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_243" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>linetotal<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td align<span class="hl opt">=</span>right<span class="hl opt">&gt;|.</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">format_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$linetotal</span><span class="hl opt">, </span><span class="hl num">2</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_244" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>bin<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;bin_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_245" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>onhand<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;onhand_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_246" class="hl">    </li>
<li id="n_247" class="hl">    <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_248" class="hl">        <span class="hl opt">&lt;</span>tr valign<span class="hl opt">=</span>top<span class="hl opt">&gt;|;</span></li>
<li id="n_249" class="hl"></li>
<li id="n_250" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwb">&#64;column_index</span><span class="hl opt">) {</span></li>
<li id="n_251" class="hl">      <span class="hl kwc">print </span><span class="hl sng">&quot;</span><span class="hl esc">\n</span><span class="hl sng"></span><span class="hl ipl">$column_data</span><span class="hl sng">{</span><span class="hl ipl">$_</span><span class="hl sng">}&quot;</span><span class="hl opt">;</span></li>
<li id="n_252" class="hl">    <span class="hl opt">}</span></li>
<li id="n_253" class="hl">  </li>
<li id="n_254" class="hl">    <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_255" class="hl">        <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_256" class="hl"><span class="hl opt">&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span><span class="hl sng">&quot;oldqty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{&quot;</span>qty_<span class="hl kwb">$i</span><span class="hl sng">&quot;}&quot;</span><span class="hl opt">&gt;</span></li>
<li id="n_257" class="hl"><span class="hl opt">|;</span></li>
<li id="n_258" class="hl"></li>
<li id="n_259" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(orderitems_id id bin weight listprice lastcost taxaccounts pricematrix sku onhand assembly inventory_accno_id income_accno_id expense_accno_id)</span><span class="hl opt">) {</span></li>
<li id="n_260" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">hide_form</span><span class="hl opt">(</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">);</span></li>
<li id="n_261" class="hl">    <span class="hl opt">}</span></li>
<li id="n_262" class="hl">  </li>
<li id="n_263" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectprojectnumber<span class="hl opt">} =~ </span><span class="hl kwd">s/ selected//</span><span class="hl opt">;</span></li>
<li id="n_264" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectprojectnumber<span class="hl opt">} =~ </span><span class="hl kwd">s/(&lt;option value=&quot;\Q$form-&gt;{&quot;projectnumber_$i&quot;}\E&quot;)/$1 selected/</span><span class="hl opt">;</span></li>
<li id="n_265" class="hl"></li>
<li id="n_266" class="hl">    <span class="hl kwb">$project </span><span class="hl opt">= </span>qq<span class="hl opt">|</span></li>
<li id="n_267" class="hl">                <span class="hl opt">&lt;</span>b<span class="hl opt">&gt;</span><span class="hl kwb">$projectnumber</span><span class="hl opt">&lt;/</span>b<span class="hl opt">&gt;</span></li>
<li id="n_268" class="hl">        <span class="hl opt">&lt;</span><span class="hl kwc">select </span>name<span class="hl opt">=</span><span class="hl sng">&quot;projectnumber_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectprojectnumber<span class="hl opt">}&lt;/</span><span class="hl kwc">select</span><span class="hl opt">&gt;</span></li>
<li id="n_269" class="hl"><span class="hl opt">| </span><span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectprojectnumber<span class="hl opt">};</span></li>
<li id="n_270" class="hl"></li>
<li id="n_271" class="hl"></li>
<li id="n_272" class="hl">    <span class="hl kwa">if </span><span class="hl opt">((</span><span class="hl kwb">$rows </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">numtextrows</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;notes_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}, </span><span class="hl num">46</span><span class="hl opt">, </span><span class="hl num">6</span><span class="hl opt">)) &gt; </span><span class="hl num">1</span><span class="hl opt">) {</span></li>
<li id="n_273" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;notes_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">quote</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;notes_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">});</span></li>
<li id="n_274" class="hl">      <span class="hl kwb">$notes </span><span class="hl opt">= </span>qq<span class="hl opt">|&lt;</span>td<span class="hl opt">&gt;&lt;</span>textarea name<span class="hl opt">=</span><span class="hl sng">&quot;notes_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> rows<span class="hl opt">=</span><span class="hl kwb">$rows </span>cols<span class="hl opt">=</span><span class="hl num">46 </span>wrap<span class="hl opt">=</span>soft<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;notes_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}&lt;</span><span class="hl kwd">/textarea&gt;&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_275" class="hl">    <span class="hl opt">} </span><span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_276" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;notes_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">quote</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;notes_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">});</span></li>
<li id="n_277" class="hl">      <span class="hl kwb">$notes </span><span class="hl opt">= </span>qq<span class="hl opt">|&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span><span class="hl sng">&quot;notes_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> size<span class="hl opt">=</span><span class="hl num">48 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{&quot;</span>notes_<span class="hl kwb">$i</span><span class="hl sng">&quot;}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_278" class="hl">    <span class="hl opt">}</span></li>
<li id="n_279" class="hl">    </li>
<li id="n_280" class="hl">    <span class="hl kwb">$serial </span><span class="hl opt">= </span>qq<span class="hl opt">|</span></li>
<li id="n_281" class="hl">                <span class="hl opt">&lt;</span>td colspan<span class="hl opt">=</span><span class="hl num">6 </span>nowrap<span class="hl opt">&gt;&lt;</span>b<span class="hl opt">&gt;</span><span class="hl kwb">$serialnumber</span><span class="hl opt">&lt;</span><span class="hl kwd">/b&gt; &lt;input name=&quot;serialnumber_$i&quot; value=&quot;$form-&gt;{&quot;serialnumber_$i&quot;}&quot;&gt;&lt;/</span>td<span class="hl opt">&gt;| </span><span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>type<span class="hl opt">} !~ </span><span class="hl kwd">/_quotation/</span><span class="hl opt">;</span></li>
<li id="n_282" class="hl">        </li>
<li id="n_283" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$i </span><span class="hl opt">== </span><span class="hl kwb">$numrows</span><span class="hl opt">) {</span></li>
<li id="n_284" class="hl">      <span class="hl kwb">$partsgroup </span><span class="hl opt">= </span><span class="hl sng">&quot;&quot;</span><span class="hl opt">;</span></li>
<li id="n_285" class="hl">      <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectpartsgroup<span class="hl opt">}) {</span></li>
<li id="n_286" class="hl">    <span class="hl kwb">$partsgroup </span><span class="hl opt">= </span>qq<span class="hl opt">|</span></li>
<li id="n_287" class="hl">            <span class="hl opt">&lt;</span>b<span class="hl opt">&gt;</span><span class="hl kwb">$group</span><span class="hl opt">&lt;/</span>b<span class="hl opt">&gt;</span></li>
<li id="n_288" class="hl">        <span class="hl opt">&lt;</span><span class="hl kwc">select </span>name<span class="hl opt">=</span><span class="hl sng">&quot;partsgroup_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectpartsgroup<span class="hl opt">}&lt;/</span><span class="hl kwc">select</span><span class="hl opt">&gt;</span></li>
<li id="n_289" class="hl"><span class="hl opt">|;</span></li>
<li id="n_290" class="hl">      <span class="hl opt">}</span></li>
<li id="n_291" class="hl"></li>
<li id="n_292" class="hl">      <span class="hl kwb">$serial </span><span class="hl opt">= </span><span class="hl sng">&quot;&quot;</span><span class="hl opt">;</span></li>
<li id="n_293" class="hl">      <span class="hl kwb">$project </span><span class="hl opt">= </span><span class="hl sng">&quot;&quot;</span><span class="hl opt">;</span></li>
<li id="n_294" class="hl">      <span class="hl kwb">$delivery </span><span class="hl opt">= </span><span class="hl sng">&quot;&quot;</span><span class="hl opt">;</span></li>
<li id="n_295" class="hl">      <span class="hl kwb">$notes </span><span class="hl opt">= </span><span class="hl sng">&quot;&quot;</span><span class="hl opt">;</span></li>
<li id="n_296" class="hl">    <span class="hl opt">}</span></li>
<li id="n_297" class="hl"></li>
<li id="n_298" class="hl">    </li>
<li id="n_299" class="hl">    <span class="hl slc"># print second and third row</span></li>
<li id="n_300" class="hl">    <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_301" class="hl">        <span class="hl opt">&lt;</span>tr valign<span class="hl opt">=</span>top<span class="hl opt">&gt;</span></li>
<li id="n_302" class="hl">      <span class="hl kwb">$delivery</span></li>
<li id="n_303" class="hl">      <span class="hl kwb">$notes</span></li>
<li id="n_304" class="hl">      <span class="hl kwb">$serial</span></li>
<li id="n_305" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_306" class="hl">        <span class="hl opt">&lt;</span>tr valign<span class="hl opt">=</span>top<span class="hl opt">&gt;</span></li>
<li id="n_307" class="hl">      <span class="hl opt">&lt;</span>td colspan<span class="hl opt">=</span><span class="hl kwb">$colspan</span><span class="hl opt">&gt;</span></li>
<li id="n_308" class="hl">      <span class="hl kwb">$project</span></li>
<li id="n_309" class="hl">      <span class="hl kwb">$partsgroup</span></li>
<li id="n_310" class="hl">      <span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_311" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_312" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_313" class="hl">      <span class="hl opt">&lt;</span>td colspan<span class="hl opt">=</span><span class="hl kwb">$colspan</span><span class="hl opt">&gt;&lt;</span>hr size<span class="hl opt">=</span><span class="hl num">1 </span>noshade<span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_314" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_315" class="hl"><span class="hl opt">|;</span></li>
<li id="n_316" class="hl"></li>
<li id="n_317" class="hl">    <span class="hl kwb">$skunumber </span><span class="hl opt">= </span><span class="hl sng">&quot;&quot;</span><span class="hl opt">;</span></li>
<li id="n_318" class="hl">    </li>
<li id="n_319" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwc">split </span><span class="hl kwd">/ /</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;taxaccounts_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}) {</span></li>
<li id="n_320" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_base&quot;</span><span class="hl opt">} += </span><span class="hl kwb">$linetotal</span><span class="hl opt">;</span></li>
<li id="n_321" class="hl">    <span class="hl opt">}</span></li>
<li id="n_322" class="hl">  </li>
<li id="n_323" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>invsubtotal<span class="hl opt">} += </span><span class="hl kwb">$linetotal</span><span class="hl opt">;</span></li>
<li id="n_324" class="hl">  <span class="hl opt">}</span></li>
<li id="n_325" class="hl"></li>
<li id="n_326" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_327" class="hl">      <span class="hl opt">&lt;/</span>table<span class="hl opt">&gt;</span></li>
<li id="n_328" class="hl">    <span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_329" class="hl">  <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_330" class="hl"><span class="hl opt">|;</span></li>
<li id="n_331" class="hl"></li>
<li id="n_332" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">hide_form</span><span class="hl opt">(</span><span class="hl sng">qw(audittrail)</span><span class="hl opt">);</span></li>
<li id="n_333" class="hl">  </li>
<li id="n_334" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_335" class="hl"></li>
<li id="n_336" class="hl"><span class="hl opt">&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span>oldcurrency value<span class="hl opt">=</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>currency<span class="hl opt">}&gt;</span></li>
<li id="n_337" class="hl"></li>
<li id="n_338" class="hl"><span class="hl opt">&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span>selectpartsgroup value<span class="hl opt">=</span><span class="hl sng">&quot;|.</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;escape(</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{selectpartsgroup},1).qq|&quot;</span><span class="hl opt">&gt;</span></li>
<li id="n_339" class="hl"><span class="hl opt">&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span>selectprojectnumber value<span class="hl opt">=</span><span class="hl sng">&quot;|.</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;escape(</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{selectprojectnumber},1).qq|&quot;</span><span class="hl opt">&gt;</span></li>
<li id="n_340" class="hl"></li>
<li id="n_341" class="hl"><span class="hl opt">|;</span></li>
<li id="n_342" class="hl"> </li>
<li id="n_343" class="hl"><span class="hl opt">}</span></li>
<li id="n_344" class="hl"></li>
<li id="n_345" class="hl"></li>
<li id="n_346" class="hl"><span class="hl kwa">sub </span>select_item <span class="hl opt">{</span></li>
<li id="n_347" class="hl"></li>
<li id="n_348" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>vc<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&quot;vendor&quot;</span><span class="hl opt">) {</span></li>
<li id="n_349" class="hl">    <span class="hl kwb">&#64;column_index </span><span class="hl opt">= </span><span class="hl sng">qw(ndx partnumber sku description partsgroup onhand sellprice)</span><span class="hl opt">;</span></li>
<li id="n_350" class="hl">  <span class="hl opt">} </span><span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_351" class="hl">    <span class="hl kwb">&#64;column_index </span><span class="hl opt">= </span><span class="hl sng">qw(ndx partnumber description partsgroup onhand sellprice)</span><span class="hl opt">;</span></li>
<li id="n_352" class="hl">  <span class="hl opt">}</span></li>
<li id="n_353" class="hl"></li>
<li id="n_354" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>ndx<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th<span class="hl opt">&gt;&amp;</span>nbsp<span class="hl opt">;&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_355" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>partnumber<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Number&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_356" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>sku<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;SKU&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_357" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>description<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Description&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_358" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>partsgroup<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Group&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_359" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>sellprice<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Price&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_360" class="hl">  <span class="hl kwb">$column_data</span><span class="hl opt">{</span>onhand<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Qty&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;|;</span></li>
<li id="n_361" class="hl">  </li>
<li id="n_362" class="hl">  <span class="hl kwb">$exchangerate </span><span class="hl opt">= (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>exchangerate<span class="hl opt">}) ? </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>exchangerate<span class="hl opt">} : </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_363" class="hl"></li>
<li id="n_364" class="hl">  <span class="hl slc"># list items with radio button on a form</span></li>
<li id="n_365" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">header</span><span class="hl opt">;</span></li>
<li id="n_366" class="hl"></li>
<li id="n_367" class="hl">  <span class="hl kwb">$title </span><span class="hl opt">= </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Select items&#39;</span><span class="hl opt">);</span></li>
<li id="n_368" class="hl"></li>
<li id="n_369" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_370" class="hl"><span class="hl opt">&lt;</span>body<span class="hl opt">&gt;</span></li>
<li id="n_371" class="hl"></li>
<li id="n_372" class="hl"><span class="hl opt">&lt;</span>form <span class="hl kwa">method</span><span class="hl opt">=</span>post action<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{script}&quot;</span><span class="hl opt">&gt;</span></li>
<li id="n_373" class="hl"></li>
<li id="n_374" class="hl"><span class="hl opt">&lt;</span>table width<span class="hl opt">=</span><span class="hl num">100</span><span class="hl opt">%&gt;</span></li>
<li id="n_375" class="hl">  <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_376" class="hl">    <span class="hl opt">&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listtop<span class="hl opt">&gt;</span><span class="hl kwb">$title</span><span class="hl opt">&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_377" class="hl">  <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_378" class="hl">  <span class="hl opt">&lt;</span>tr height<span class="hl opt">=</span><span class="hl sng">&quot;5&quot;</span><span class="hl opt">&gt;&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_379" class="hl">  <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_380" class="hl">    <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$option</span><span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_381" class="hl">  <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_382" class="hl">  <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_383" class="hl">    <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span></li>
<li id="n_384" class="hl">      <span class="hl opt">&lt;</span>table width<span class="hl opt">=</span><span class="hl num">100</span><span class="hl opt">%&gt;</span></li>
<li id="n_385" class="hl">        <span class="hl opt">&lt;</span>tr <span class="hl kwa">class</span><span class="hl opt">=</span>listheading<span class="hl opt">&gt;|;</span></li>
<li id="n_386" class="hl"></li>
<li id="n_387" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwb">&#64;column_index</span><span class="hl opt">) { </span><span class="hl kwc">print </span><span class="hl sng">&quot;</span><span class="hl esc">\n</span><span class="hl sng"></span><span class="hl ipl">$column_data</span><span class="hl sng">{</span><span class="hl ipl">$_</span><span class="hl sng">}&quot;</span> <span class="hl opt">}</span></li>
<li id="n_388" class="hl">  </li>
<li id="n_389" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_390" class="hl">        <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_391" class="hl"><span class="hl opt">|;</span></li>
<li id="n_392" class="hl"></li>
<li id="n_393" class="hl">  <span class="hl kwc">my </span><span class="hl kwb">$i </span><span class="hl opt">= </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_394" class="hl">  <span class="hl kwa">foreach </span><span class="hl kwb">$ref </span><span class="hl opt">(&#64;{ </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>item_list<span class="hl opt">} }) {</span></li>
<li id="n_395" class="hl">    <span class="hl kwb">$i++</span><span class="hl opt">;</span></li>
<li id="n_396" class="hl"></li>
<li id="n_397" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(sku partnumber description unit notes partsgroup)</span><span class="hl opt">) {</span></li>
<li id="n_398" class="hl">      <span class="hl kwb">$ref</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">quote</span><span class="hl opt">(</span><span class="hl kwb">$ref</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">});</span></li>
<li id="n_399" class="hl">    <span class="hl opt">}</span></li>
<li id="n_400" class="hl"></li>
<li id="n_401" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>ndx<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span><span class="hl sng">&quot;ndx_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> <span class="hl kwa">class</span><span class="hl opt">=</span>checkbox type<span class="hl opt">=</span>checkbox value<span class="hl opt">=</span><span class="hl kwb">$i</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_402" class="hl">    </li>
<li id="n_403" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(partnumber sku description partsgroup)</span><span class="hl opt">) { </span><span class="hl kwb">$column_data</span><span class="hl opt">{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$ref</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">}&amp;</span>nbsp<span class="hl opt">;&lt;/</span>td<span class="hl opt">&gt;| }</span></li>
<li id="n_404" class="hl">    </li>
<li id="n_405" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>sellprice<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td align<span class="hl opt">=</span>right<span class="hl opt">&gt;|.</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">format_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$ref</span><span class="hl opt">-&gt;{</span>sellprice<span class="hl opt">} </span><span class="hl kwd">/ $exchangerate, 2, &quot;&amp;nbsp;&quot;).qq|&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_406" class="hl">    <span class="hl kwb">$column_data</span><span class="hl opt">{</span>onhand<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>td align<span class="hl opt">=</span>right<span class="hl opt">&gt;|.</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">format_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$ref</span><span class="hl opt">-&gt;{</span>onhand<span class="hl opt">}, </span><span class="hl sng">&#39;&#39;</span><span class="hl opt">, </span><span class="hl sng">&quot;&amp;nbsp;&quot;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>td<span class="hl opt">&gt;|;</span></li>
<li id="n_407" class="hl">    </li>
<li id="n_408" class="hl">    <span class="hl kwb">$j++</span><span class="hl opt">; </span><span class="hl kwb">$j </span><span class="hl opt">%= </span><span class="hl num">2</span><span class="hl opt">;</span></li>
<li id="n_409" class="hl">    <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_410" class="hl">        <span class="hl opt">&lt;</span>tr <span class="hl kwa">class</span><span class="hl opt">=</span>listrow<span class="hl kwb">$j</span><span class="hl opt">&gt;|;</span></li>
<li id="n_411" class="hl"></li>
<li id="n_412" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwb">&#64;column_index</span><span class="hl opt">) {</span></li>
<li id="n_413" class="hl">      <span class="hl kwc">print </span><span class="hl sng">&quot;</span><span class="hl esc">\n</span><span class="hl sng"></span><span class="hl ipl">$column_data</span><span class="hl sng">{</span><span class="hl ipl">$_</span><span class="hl sng">}&quot;</span><span class="hl opt">;</span></li>
<li id="n_414" class="hl">    <span class="hl opt">}</span></li>
<li id="n_415" class="hl"></li>
<li id="n_416" class="hl">    <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_417" class="hl">        <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_418" class="hl"><span class="hl opt">|;</span></li>
<li id="n_419" class="hl"></li>
<li id="n_420" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(partnumber sku description partsgroup partsgroup_id bin weight sellprice listprice lastcost onhand unit assembly taxaccounts inventory_accno_id income_accno_id expense_accno_id pricematrix id notes)</span><span class="hl opt">) {</span></li>
<li id="n_421" class="hl">      <span class="hl kwc">print </span>qq<span class="hl opt">|&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span><span class="hl sng">&quot;new_${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span> value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$ref</span><span class="hl sng">-&gt;{</span><span class="hl ipl">$_</span><span class="hl sng">}&quot;</span><span class="hl opt">&gt;</span><span class="hl esc">\n</span><span class="hl opt">|;</span></li>
<li id="n_422" class="hl">    <span class="hl opt">}</span></li>
<li id="n_423" class="hl">  <span class="hl opt">}</span></li>
<li id="n_424" class="hl">  </li>
<li id="n_425" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_426" class="hl">      <span class="hl opt">&lt;/</span>table<span class="hl opt">&gt;</span></li>
<li id="n_427" class="hl">    <span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_428" class="hl">  <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_429" class="hl">  <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_430" class="hl">    <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>hr size<span class="hl opt">=</span><span class="hl num">3 </span>noshade<span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_431" class="hl">  <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_432" class="hl"><span class="hl opt">&lt;/</span>table<span class="hl opt">&gt;</span></li>
<li id="n_433" class="hl"></li>
<li id="n_434" class="hl"><span class="hl opt">&lt;</span>input name<span class="hl opt">=</span>lastndx type<span class="hl opt">=</span>hidden value<span class="hl opt">=</span><span class="hl kwb">$i</span><span class="hl opt">&gt;</span></li>
<li id="n_435" class="hl"></li>
<li id="n_436" class="hl"><span class="hl opt">|;</span></li>
<li id="n_437" class="hl"></li>
<li id="n_438" class="hl">  <span class="hl slc"># delete variables</span></li>
<li id="n_439" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(nextsub item_list)</span><span class="hl opt">) { </span><span class="hl kwc">delete </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} }</span></li>
<li id="n_440" class="hl"></li>
<li id="n_441" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>action<span class="hl opt">} = </span><span class="hl sng">&quot;item_selected&quot;</span><span class="hl opt">;</span></li>
<li id="n_442" class="hl">  </li>
<li id="n_443" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">hide_form</span><span class="hl opt">;</span></li>
<li id="n_444" class="hl">  </li>
<li id="n_445" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_446" class="hl"><span class="hl opt">&lt;</span>input type<span class="hl opt">=</span><span class="hl sng">&quot;hidden&quot;</span> name<span class="hl opt">=</span><span class="hl sng">&quot;nextsub&quot;</span> value<span class="hl opt">=</span><span class="hl sng">&quot;item_selected&quot;</span><span class="hl opt">&gt;</span></li>
<li id="n_447" class="hl"></li>
<li id="n_448" class="hl"><span class="hl opt">&lt;</span>br<span class="hl opt">&gt;</span></li>
<li id="n_449" class="hl"><span class="hl opt">&lt;</span>button <span class="hl kwa">class</span><span class="hl opt">=</span><span class="hl sng">&quot;submit&quot;</span> type<span class="hl opt">=</span><span class="hl sng">&quot;submit&quot;</span> name<span class="hl opt">=</span><span class="hl sng">&quot;action&quot;</span> value<span class="hl opt">=</span><span class="hl sng">&quot;continue&quot;</span><span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Continue&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>button<span class="hl opt">&gt;</span></li>
<li id="n_450" class="hl"><span class="hl opt">&lt;/</span>form<span class="hl opt">&gt;</span></li>
<li id="n_451" class="hl"></li>
<li id="n_452" class="hl"><span class="hl opt">&lt;/</span>body<span class="hl opt">&gt;</span></li>
<li id="n_453" class="hl"><span class="hl opt">&lt;/</span>html<span class="hl opt">&gt;</span></li>
<li id="n_454" class="hl"><span class="hl opt">|;</span></li>
<li id="n_455" class="hl"></li>
<li id="n_456" class="hl"><span class="hl opt">}</span></li>
<li id="n_457" class="hl"></li>
<li id="n_458" class="hl"></li>
<li id="n_459" class="hl"></li>
<li id="n_460" class="hl"><span class="hl kwa">sub </span>item_selected <span class="hl opt">{</span></li>
<li id="n_461" class="hl"></li>
<li id="n_462" class="hl">  <span class="hl kwb">$i </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">} - </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_463" class="hl">  <span class="hl kwb">$i </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>assembly_rows<span class="hl opt">} - </span><span class="hl num">1 </span><span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>item<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;assembly&#39;</span><span class="hl opt">);</span></li>
<li id="n_464" class="hl">  <span class="hl kwb">$qty </span><span class="hl opt">= (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{rowcount}&quot;</span><span class="hl opt">}) ? </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{rowcount}&quot;</span><span class="hl opt">} : </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_465" class="hl"></li>
<li id="n_466" class="hl">  <span class="hl kwa">for </span><span class="hl kwb">$j </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>lastndx<span class="hl opt">}) {</span></li>
<li id="n_467" class="hl">    </li>
<li id="n_468" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;ndx_</span><span class="hl ipl">$j</span><span class="hl sng">&quot;</span><span class="hl opt">}) {</span></li>
<li id="n_469" class="hl"></li>
<li id="n_470" class="hl">      <span class="hl kwb">$i++</span><span class="hl opt">;</span></li>
<li id="n_471" class="hl">  </li>
<li id="n_472" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$qty</span><span class="hl opt">;</span></li>
<li id="n_473" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;discount_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>discount<span class="hl opt">} * </span><span class="hl num">100</span><span class="hl opt">;</span></li>
<li id="n_474" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;reqdate_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>reqdate<span class="hl opt">} </span><span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>type<span class="hl opt">} !~ </span><span class="hl kwd">/_quotation/</span><span class="hl opt">;</span></li>
<li id="n_475" class="hl"></li>
<li id="n_476" class="hl">      <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(id partnumber sku description sellprice listprice lastcost bin unit weight assembly taxaccounts pricematrix onhand notes inventory_accno_id income_accno_id expense_accno_id)</span><span class="hl opt">) {</span></li>
<li id="n_477" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;new_${_}_</span><span class="hl ipl">$j</span><span class="hl sng">&quot;</span><span class="hl opt">};</span></li>
<li id="n_478" class="hl">      <span class="hl opt">}</span></li>
<li id="n_479" class="hl"></li>
<li id="n_480" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;partsgroup_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span>qq<span class="hl opt">|</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;new_partsgroup_</span><span class="hl ipl">$j</span><span class="hl sng">&quot;</span><span class="hl opt">}--</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;new_partsgroup_id_</span><span class="hl ipl">$j</span><span class="hl sng">&quot;</span><span class="hl opt">}|;</span></li>
<li id="n_481" class="hl"></li>
<li id="n_482" class="hl">      <span class="hl opt">(</span><span class="hl kwb">$dec</span><span class="hl opt">) = (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;sellprice_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} =~ </span><span class="hl kwd">/\.(\d+)/</span><span class="hl opt">);</span></li>
<li id="n_483" class="hl">      <span class="hl kwb">$dec </span><span class="hl opt">= </span><span class="hl kwc">length </span><span class="hl kwb">$dec</span><span class="hl opt">;</span></li>
<li id="n_484" class="hl">      <span class="hl kwb">$decimalplaces1 </span><span class="hl opt">= (</span><span class="hl kwb">$dec </span><span class="hl opt">&gt; </span><span class="hl num">2</span><span class="hl opt">) ? </span><span class="hl kwb">$dec </span><span class="hl opt">: </span><span class="hl num">2</span><span class="hl opt">;</span></li>
<li id="n_485" class="hl">      </li>
<li id="n_486" class="hl">      <span class="hl opt">(</span><span class="hl kwb">$dec</span><span class="hl opt">) = (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;lastcost_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} =~ </span><span class="hl kwd">/\.(\d+)/</span><span class="hl opt">);</span></li>
<li id="n_487" class="hl">      <span class="hl kwb">$dec </span><span class="hl opt">= </span><span class="hl kwc">length </span><span class="hl kwb">$dec</span><span class="hl opt">;</span></li>
<li id="n_488" class="hl">      <span class="hl kwb">$decimalplaces2 </span><span class="hl opt">= (</span><span class="hl kwb">$dec </span><span class="hl opt">&gt; </span><span class="hl num">2</span><span class="hl opt">) ? </span><span class="hl kwb">$dec </span><span class="hl opt">: </span><span class="hl num">2</span><span class="hl opt">;</span></li>
<li id="n_489" class="hl"></li>
<li id="n_490" class="hl">      <span class="hl slc"># if there is an exchange rate adjust sellprice</span></li>
<li id="n_491" class="hl">      <span class="hl kwa">if </span><span class="hl opt">((</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>exchangerate<span class="hl opt">} * </span><span class="hl num">1</span><span class="hl opt">)) {</span></li>
<li id="n_492" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(sellprice listprice lastcost)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} /= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>exchangerate<span class="hl opt">} }</span></li>
<li id="n_493" class="hl">        <span class="hl slc"># don&#39;t format list and cost</span></li>
<li id="n_494" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;sellprice_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">round_amount</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;sellprice_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}, </span><span class="hl kwb">$decimalplaces1</span><span class="hl opt">);</span></li>
<li id="n_495" class="hl">      <span class="hl opt">}</span></li>
<li id="n_496" class="hl"></li>
<li id="n_497" class="hl">      <span class="hl slc"># this is for the assembly</span></li>
<li id="n_498" class="hl">      <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>item<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;assembly&#39;</span><span class="hl opt">) {</span></li>
<li id="n_499" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;adj_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_500" class="hl">    </li>
<li id="n_501" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(sellprice listprice weight)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">}) }</span></li>
<li id="n_502" class="hl"></li>
<li id="n_503" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>sellprice<span class="hl opt">} += (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;sellprice_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} * </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">});</span></li>
<li id="n_504" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>weight<span class="hl opt">} += (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;weight_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} * </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">});</span></li>
<li id="n_505" class="hl">      <span class="hl opt">}</span></li>
<li id="n_506" class="hl"></li>
<li id="n_507" class="hl">      <span class="hl kwb">$amount </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;sellprice_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} * (</span><span class="hl num">1 </span><span class="hl opt">- </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;discount_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} / </span><span class="hl num">100</span><span class="hl opt">) * </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">};</span></li>
<li id="n_508" class="hl">      <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwc">split </span><span class="hl kwd">/ /</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;taxaccounts_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_base&quot;</span><span class="hl opt">} += </span><span class="hl kwb">$amount </span><span class="hl opt">}</span></li>
<li id="n_509" class="hl">      <span class="hl kwa">if </span><span class="hl opt">(!</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>taxincluded<span class="hl opt">}) {</span></li>
<li id="n_510" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">&#64;taxlist</span><span class="hl opt">= </span>Tax<span class="hl opt">::</span>init_taxes<span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;taxaccounts_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">});</span></li>
<li id="n_511" class="hl">    <span class="hl kwb">$amount </span><span class="hl opt">+= </span>Tax<span class="hl opt">::</span>calculate_taxes<span class="hl opt">(</span>\<span class="hl kwb">&#64;taxlist</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">, </span><span class="hl kwb">$amount</span><span class="hl opt">, </span><span class="hl num">0</span><span class="hl opt">);</span></li>
<li id="n_512" class="hl">      <span class="hl opt">}</span></li>
<li id="n_513" class="hl"></li>
<li id="n_514" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>creditremaining<span class="hl opt">} -= </span><span class="hl kwb">$amount</span><span class="hl opt">;</span></li>
<li id="n_515" class="hl"></li>
<li id="n_516" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;runningnumber_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$i</span><span class="hl opt">;</span></li>
<li id="n_517" class="hl">  </li>
<li id="n_518" class="hl">      <span class="hl slc"># format amounts</span></li>
<li id="n_519" class="hl">      <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>item<span class="hl opt">} </span><span class="hl kwc">ne </span><span class="hl sng">&#39;assembly&#39;</span><span class="hl opt">) {</span></li>
<li id="n_520" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(sellprice listprice)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">format_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}, </span><span class="hl kwb">$decimalplaces1</span><span class="hl opt">) }</span></li>
<li id="n_521" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;lastcost_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">format_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;lastcost_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}, </span><span class="hl kwb">$decimalplaces2</span><span class="hl opt">);</span></li>
<li id="n_522" class="hl">      <span class="hl opt">}</span></li>
<li id="n_523" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;discount_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">format_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;discount_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">});</span></li>
<li id="n_524" class="hl"></li>
<li id="n_525" class="hl">    <span class="hl opt">}</span></li>
<li id="n_526" class="hl">  <span class="hl opt">}</span></li>
<li id="n_527" class="hl"></li>
<li id="n_528" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">} = </span><span class="hl kwb">$i</span><span class="hl opt">;</span></li>
<li id="n_529" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>assembly_rows<span class="hl opt">} = </span><span class="hl kwb">$i </span><span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>item<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;assembly&#39;</span><span class="hl opt">);</span></li>
<li id="n_530" class="hl">  </li>
<li id="n_531" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>focus<span class="hl opt">} = </span><span class="hl sng">&quot;description_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">;</span></li>
<li id="n_532" class="hl"></li>
<li id="n_533" class="hl">  <span class="hl slc"># delete all the new_ variables</span></li>
<li id="n_534" class="hl">  <span class="hl kwa">for </span><span class="hl kwb">$i </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>lastndx<span class="hl opt">}) {</span></li>
<li id="n_535" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(id partnumber sku description sellprice listprice lastcost bin unit weight assembly taxaccounts pricematrix onhand notes inventory_accno_id income_accno_id expense_accno_id)</span><span class="hl opt">) {</span></li>
<li id="n_536" class="hl">      <span class="hl kwc">delete </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;new_${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">};</span></li>
<li id="n_537" class="hl">    <span class="hl opt">}</span></li>
<li id="n_538" class="hl">  <span class="hl opt">}</span></li>
<li id="n_539" class="hl">  </li>
<li id="n_540" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(ndx lastndx nextsub)</span><span class="hl opt">) { </span><span class="hl kwc">delete </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} }</span></li>
<li id="n_541" class="hl"></li>
<li id="n_542" class="hl">  <span class="hl opt">&amp;</span>display_form<span class="hl opt">;</span></li>
<li id="n_543" class="hl"></li>
<li id="n_544" class="hl"><span class="hl opt">}</span></li>
<li id="n_545" class="hl"></li>
<li id="n_546" class="hl"></li>
<li id="n_547" class="hl"><span class="hl kwa">sub </span>new_item <span class="hl opt">{</span></li>
<li id="n_548" class="hl"></li>
<li id="n_549" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>language_code<span class="hl opt">} &amp;&amp; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;description_</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{rowcount}&quot;</span><span class="hl opt">}) {</span></li>
<li id="n_550" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">error</span><span class="hl opt">(</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Translation not on file!&#39;</span><span class="hl opt">));</span></li>
<li id="n_551" class="hl">  <span class="hl opt">}</span></li>
<li id="n_552" class="hl">  </li>
<li id="n_553" class="hl">  <span class="hl slc"># change callback</span></li>
<li id="n_554" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>old_callback<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">escape</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>callback<span class="hl opt">},</span><span class="hl num">1</span><span class="hl opt">);</span></li>
<li id="n_555" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>callback<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">escape</span><span class="hl opt">(</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{script}?action=display_form&quot;</span><span class="hl opt">,</span><span class="hl num">1</span><span class="hl opt">);</span></li>
<li id="n_556" class="hl"></li>
<li id="n_557" class="hl">  <span class="hl slc"># delete action</span></li>
<li id="n_558" class="hl">  <span class="hl kwc">delete </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>action<span class="hl opt">};</span></li>
<li id="n_559" class="hl"></li>
<li id="n_560" class="hl">  <span class="hl slc"># save all other form variables in a previousform variable</span></li>
<li id="n_561" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(!</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>previousform<span class="hl opt">}) {</span></li>
<li id="n_562" class="hl">    <span class="hl kwa">foreach </span><span class="hl kwb">$key </span><span class="hl opt">(</span><span class="hl kwc">keys </span><span class="hl kwb">%$form</span><span class="hl opt">) {</span></li>
<li id="n_563" class="hl">      <span class="hl slc"># escape ampersands</span></li>
<li id="n_564" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$key</span><span class="hl opt">} =~ </span><span class="hl kwd">s/&amp;/%26/g</span><span class="hl opt">;</span></li>
<li id="n_565" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>previousform<span class="hl opt">} .= </span>qq<span class="hl opt">|</span><span class="hl kwb">$key</span><span class="hl opt">=</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$key</span><span class="hl opt">}&amp;|;</span></li>
<li id="n_566" class="hl">    <span class="hl opt">}</span></li>
<li id="n_567" class="hl">    <span class="hl kwc">chop </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>previousform<span class="hl opt">};</span></li>
<li id="n_568" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>previousform<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">escape</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>previousform<span class="hl opt">}, </span><span class="hl num">1</span><span class="hl opt">);</span></li>
<li id="n_569" class="hl">  <span class="hl opt">}</span></li>
<li id="n_570" class="hl"></li>
<li id="n_571" class="hl">  <span class="hl kwb">$i </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">};</span></li>
<li id="n_572" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(partnumber description)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">quote</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}) }</span></li>
<li id="n_573" class="hl"></li>
<li id="n_574" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">header</span><span class="hl opt">;</span></li>
<li id="n_575" class="hl"></li>
<li id="n_576" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_577" class="hl"><span class="hl opt">&lt;</span>body<span class="hl opt">&gt;</span></li>
<li id="n_578" class="hl"></li>
<li id="n_579" class="hl"><span class="hl opt">&lt;</span>h4 <span class="hl kwa">class</span><span class="hl opt">=</span>error<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Item not on file!&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>h4<span class="hl opt">&gt;|;</span></li>
<li id="n_580" class="hl"></li>
<li id="n_581" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$myconfig</span><span class="hl opt">{</span>acs<span class="hl opt">} !~ </span><span class="hl kwd">/(Goods \&amp; Services--Add Part|Goods \&amp; Services--Add Service)/</span><span class="hl opt">) {</span></li>
<li id="n_582" class="hl"></li>
<li id="n_583" class="hl">    <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_584" class="hl"><span class="hl opt">&lt;</span>h4<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;What type of item is this?&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>h4<span class="hl opt">&gt;</span></li>
<li id="n_585" class="hl"></li>
<li id="n_586" class="hl"><span class="hl opt">&lt;</span>form <span class="hl kwa">method</span><span class="hl opt">=</span>post action<span class="hl opt">=</span>ic<span class="hl opt">.</span>pl<span class="hl opt">&gt;</span></li>
<li id="n_587" class="hl"></li>
<li id="n_588" class="hl"><span class="hl opt">&lt;</span>p<span class="hl opt">&gt;</span></li>
<li id="n_589" class="hl"></li>
<li id="n_590" class="hl">  <span class="hl opt">&lt;</span>input <span class="hl kwa">class</span><span class="hl opt">=</span>radio type<span class="hl opt">=</span>radio name<span class="hl opt">=</span>item value<span class="hl opt">=</span>part checked<span class="hl opt">&gt;&amp;</span>nbsp<span class="hl opt">;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Part&#39;</span><span class="hl opt">)</span></li>
<li id="n_591" class="hl"><span class="hl opt">.</span>qq<span class="hl opt">|&lt;</span>br<span class="hl opt">&gt;</span></li>
<li id="n_592" class="hl">  <span class="hl opt">&lt;</span>input <span class="hl kwa">class</span><span class="hl opt">=</span>radio type<span class="hl opt">=</span>radio name<span class="hl opt">=</span>item value<span class="hl opt">=</span>service<span class="hl opt">&gt;&amp;</span>nbsp<span class="hl opt">;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Service&#39;</span><span class="hl opt">)</span></li>
<li id="n_593" class="hl"></li>
<li id="n_594" class="hl"><span class="hl opt">.</span>qq<span class="hl opt">|</span></li>
<li id="n_595" class="hl"><span class="hl opt">&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span>partnumber value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{&quot;</span>partnumber_<span class="hl kwb">$i</span><span class="hl sng">&quot;}&quot;</span><span class="hl opt">&gt;</span></li>
<li id="n_596" class="hl"><span class="hl opt">&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span>description value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{&quot;</span>description_<span class="hl kwb">$i</span><span class="hl sng">&quot;}&quot;</span><span class="hl opt">&gt;</span></li>
<li id="n_597" class="hl"><span class="hl opt">&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span>nextsub value<span class="hl opt">=</span>add<span class="hl opt">&gt;</span></li>
<li id="n_598" class="hl"><span class="hl opt">&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span>action value<span class="hl opt">=</span>add<span class="hl opt">&gt;</span></li>
<li id="n_599" class="hl"><span class="hl opt">|;</span></li>
<li id="n_600" class="hl"></li>
<li id="n_601" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">hide_form</span><span class="hl opt">(</span><span class="hl sng">qw(previousform rowcount path login sessionid)</span><span class="hl opt">);</span></li>
<li id="n_602" class="hl"></li>
<li id="n_603" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_604" class="hl"><span class="hl opt">&lt;</span>p<span class="hl opt">&gt;</span></li>
<li id="n_605" class="hl"><span class="hl opt">&lt;</span>button <span class="hl kwa">class</span><span class="hl opt">=</span><span class="hl sng">&quot;submit&quot;</span> type<span class="hl opt">=</span><span class="hl sng">&quot;submit&quot;</span> name<span class="hl opt">=</span><span class="hl sng">&quot;action&quot;</span> value<span class="hl opt">=</span><span class="hl sng">&quot;continue&quot;</span><span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Continue&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>button<span class="hl opt">&gt;</span></li>
<li id="n_606" class="hl"><span class="hl opt">&lt;/</span>form<span class="hl opt">&gt;</span></li>
<li id="n_607" class="hl"><span class="hl opt">|;</span></li>
<li id="n_608" class="hl">  <span class="hl opt">}</span></li>
<li id="n_609" class="hl"></li>
<li id="n_610" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_611" class="hl"><span class="hl opt">&lt;/</span>body<span class="hl opt">&gt;</span></li>
<li id="n_612" class="hl"><span class="hl opt">&lt;/</span>html<span class="hl opt">&gt;</span></li>
<li id="n_613" class="hl"><span class="hl opt">|;</span></li>
<li id="n_614" class="hl"></li>
<li id="n_615" class="hl"><span class="hl opt">}</span></li>
<li id="n_616" class="hl"></li>
<li id="n_617" class="hl"></li>
<li id="n_618" class="hl"></li>
<li id="n_619" class="hl"><span class="hl kwa">sub </span>display_form <span class="hl opt">{</span></li>
<li id="n_620" class="hl"></li>
<li id="n_621" class="hl">  <span class="hl slc"># if we have a display_form</span></li>
<li id="n_622" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>display_form<span class="hl opt">}) {</span></li>
<li id="n_623" class="hl">    <span class="hl opt">&amp;{ </span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{display_form}&quot;</span> <span class="hl opt">};</span></li>
<li id="n_624" class="hl">    <span class="hl kwa">exit</span><span class="hl opt">;</span></li>
<li id="n_625" class="hl">  <span class="hl opt">}</span></li>
<li id="n_626" class="hl">  </li>
<li id="n_627" class="hl">  <span class="hl opt">&amp;</span>form_header<span class="hl opt">;</span></li>
<li id="n_628" class="hl"></li>
<li id="n_629" class="hl">  <span class="hl kwb">$numrows </span><span class="hl opt">= ++</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">};</span></li>
<li id="n_630" class="hl">  <span class="hl kwb">$subroutine </span><span class="hl opt">= </span><span class="hl sng">&quot;display_row&quot;</span><span class="hl opt">;</span></li>
<li id="n_631" class="hl"></li>
<li id="n_632" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>item<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;part&#39;</span><span class="hl opt">) {</span></li>
<li id="n_633" class="hl">    <span class="hl slc"># create makemodel rows</span></li>
<li id="n_634" class="hl">    <span class="hl opt">&amp;</span>makemodel_row<span class="hl opt">(++</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>makemodel_rows<span class="hl opt">});</span></li>
<li id="n_635" class="hl"></li>
<li id="n_636" class="hl">    <span class="hl opt">&amp;</span>vendor_row<span class="hl opt">(++</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>vendor_rows<span class="hl opt">});</span></li>
<li id="n_637" class="hl">    </li>
<li id="n_638" class="hl">    <span class="hl kwb">$numrows </span><span class="hl opt">= ++</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>customer_rows<span class="hl opt">};</span></li>
<li id="n_639" class="hl">    <span class="hl kwb">$subroutine </span><span class="hl opt">= </span><span class="hl sng">&quot;customer_row&quot;</span><span class="hl opt">;</span></li>
<li id="n_640" class="hl">  <span class="hl opt">}</span></li>
<li id="n_641" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>item<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;assembly&#39;</span><span class="hl opt">) {</span></li>
<li id="n_642" class="hl">    <span class="hl slc"># create makemodel rows</span></li>
<li id="n_643" class="hl">    <span class="hl opt">&amp;</span>makemodel_row<span class="hl opt">(++</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>makemodel_rows<span class="hl opt">});</span></li>
<li id="n_644" class="hl">    </li>
<li id="n_645" class="hl">    <span class="hl kwb">$numrows </span><span class="hl opt">= ++</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>customer_rows<span class="hl opt">};</span></li>
<li id="n_646" class="hl">    <span class="hl kwb">$subroutine </span><span class="hl opt">= </span><span class="hl sng">&quot;customer_row&quot;</span><span class="hl opt">;</span></li>
<li id="n_647" class="hl">  <span class="hl opt">}</span></li>
<li id="n_648" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>item<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;service&#39;</span><span class="hl opt">) {</span></li>
<li id="n_649" class="hl">    <span class="hl opt">&amp;</span>vendor_row<span class="hl opt">(++</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>vendor_rows<span class="hl opt">});</span></li>
<li id="n_650" class="hl">    </li>
<li id="n_651" class="hl">    <span class="hl kwb">$numrows </span><span class="hl opt">= ++</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>customer_rows<span class="hl opt">};</span></li>
<li id="n_652" class="hl">    <span class="hl kwb">$subroutine </span><span class="hl opt">= </span><span class="hl sng">&quot;customer_row&quot;</span><span class="hl opt">;</span></li>
<li id="n_653" class="hl">  <span class="hl opt">}</span></li>
<li id="n_654" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>item<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;labor&#39;</span><span class="hl opt">) {</span></li>
<li id="n_655" class="hl">    <span class="hl kwb">$numrows </span><span class="hl opt">= </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_656" class="hl">  <span class="hl opt">}</span></li>
<li id="n_657" class="hl"></li>
<li id="n_658" class="hl">  <span class="hl slc"># create rows</span></li>
<li id="n_659" class="hl">  <span class="hl opt">&amp;{ </span><span class="hl kwb">$subroutine </span><span class="hl opt">}(</span><span class="hl kwb">$numrows</span><span class="hl opt">) </span><span class="hl kwa">if </span><span class="hl kwb">$numrows</span><span class="hl opt">;</span></li>
<li id="n_660" class="hl"></li>
<li id="n_661" class="hl">  <span class="hl opt">&amp;</span>form_footer<span class="hl opt">;</span></li>
<li id="n_662" class="hl"></li>
<li id="n_663" class="hl"><span class="hl opt">}</span></li>
<li id="n_664" class="hl"></li>
<li id="n_665" class="hl"></li>
<li id="n_666" class="hl"></li>
<li id="n_667" class="hl"><span class="hl kwa">sub </span>check_form <span class="hl opt">{</span></li>
<li id="n_668" class="hl">  </li>
<li id="n_669" class="hl">  <span class="hl kwc">my </span><span class="hl kwb">&#64;a </span><span class="hl opt">= ();</span></li>
<li id="n_670" class="hl">  <span class="hl kwc">my </span><span class="hl kwb">$count </span><span class="hl opt">= </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_671" class="hl">  <span class="hl kwc">my </span><span class="hl kwb">$i</span><span class="hl opt">;</span></li>
<li id="n_672" class="hl">  <span class="hl kwc">my </span><span class="hl kwb">$j</span><span class="hl opt">;</span></li>
<li id="n_673" class="hl">  <span class="hl kwc">my </span><span class="hl kwb">&#64;flds </span><span class="hl opt">= </span><span class="hl sng">qw(id runningnumber partnumber description partsgroup qty ship unit sellprice discount oldqty orderitems_id bin weight listprice lastcost taxaccounts pricematrix sku onhand assembly inventory_accno_id income_accno_id expense_accno_id notes reqdate deliverydate serialnumber projectnumber)</span><span class="hl opt">;</span></li>
<li id="n_674" class="hl"></li>
<li id="n_675" class="hl">  <span class="hl slc"># remove any makes or model rows</span></li>
<li id="n_676" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>item<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;part&#39;</span><span class="hl opt">) {</span></li>
<li id="n_677" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(listprice sellprice lastcost avgcost weight rop markup)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">}) }</span></li>
<li id="n_678" class="hl">    </li>
<li id="n_679" class="hl">    <span class="hl opt">&amp;</span>calc_markup<span class="hl opt">;</span></li>
<li id="n_680" class="hl">    </li>
<li id="n_681" class="hl">    <span class="hl kwb">&#64;flds </span><span class="hl opt">= </span><span class="hl sng">qw(make model)</span><span class="hl opt">;</span></li>
<li id="n_682" class="hl">    <span class="hl kwb">$count </span><span class="hl opt">= </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_683" class="hl">    <span class="hl kwb">&#64;a </span><span class="hl opt">= ();</span></li>
<li id="n_684" class="hl">    <span class="hl kwa">for </span><span class="hl kwb">$i </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>makemodel_rows<span class="hl opt">}) {</span></li>
<li id="n_685" class="hl">      <span class="hl kwa">if </span><span class="hl opt">((</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;make_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} </span><span class="hl kwc">ne </span><span class="hl sng">&quot;&quot;</span><span class="hl opt">) || (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;model_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} </span><span class="hl kwc">ne </span><span class="hl sng">&quot;&quot;</span><span class="hl opt">)) {</span></li>
<li id="n_686" class="hl">    <span class="hl kwc">push </span><span class="hl kwb">&#64;a</span><span class="hl opt">, {};</span></li>
<li id="n_687" class="hl">    <span class="hl kwb">$j </span><span class="hl opt">= </span><span class="hl kwb">$#a</span><span class="hl opt">;</span></li>
<li id="n_688" class="hl"></li>
<li id="n_689" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwb">&#64;flds</span><span class="hl opt">) { </span><span class="hl kwb">$a</span><span class="hl opt">[</span><span class="hl kwb">$j</span><span class="hl opt">]-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} }</span></li>
<li id="n_690" class="hl">    <span class="hl kwb">$count++</span><span class="hl opt">;</span></li>
<li id="n_691" class="hl">      <span class="hl opt">}</span></li>
<li id="n_692" class="hl">    <span class="hl opt">}</span></li>
<li id="n_693" class="hl"></li>
<li id="n_694" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">redo_rows</span><span class="hl opt">(</span>\<span class="hl kwb">&#64;flds</span><span class="hl opt">, </span>\<span class="hl kwb">&#64;a</span><span class="hl opt">, </span><span class="hl kwb">$count</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>makemodel_rows<span class="hl opt">});</span></li>
<li id="n_695" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>makemodel_rows<span class="hl opt">} = </span><span class="hl kwb">$count</span><span class="hl opt">;</span></li>
<li id="n_696" class="hl"></li>
<li id="n_697" class="hl">    <span class="hl opt">&amp;</span>check_vendor<span class="hl opt">;</span></li>
<li id="n_698" class="hl">    <span class="hl opt">&amp;</span>check_customer<span class="hl opt">;</span></li>
<li id="n_699" class="hl">    </li>
<li id="n_700" class="hl">  <span class="hl opt">}</span></li>
<li id="n_701" class="hl">  </li>
<li id="n_702" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>item<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;service&#39;</span><span class="hl opt">) {</span></li>
<li id="n_703" class="hl">    </li>
<li id="n_704" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(sellprice listprice lastcost avgcost markup)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">}) }</span></li>
<li id="n_705" class="hl">    </li>
<li id="n_706" class="hl">    <span class="hl opt">&amp;</span>calc_markup<span class="hl opt">;</span></li>
<li id="n_707" class="hl">    <span class="hl opt">&amp;</span>check_vendor<span class="hl opt">;</span></li>
<li id="n_708" class="hl">    <span class="hl opt">&amp;</span>check_customer<span class="hl opt">;</span></li>
<li id="n_709" class="hl">    </li>
<li id="n_710" class="hl">  <span class="hl opt">}</span></li>
<li id="n_711" class="hl">  </li>
<li id="n_712" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>item<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;assembly&#39;</span><span class="hl opt">) {</span></li>
<li id="n_713" class="hl"></li>
<li id="n_714" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(!</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>project_id<span class="hl opt">}) {</span></li>
<li id="n_715" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>sellprice<span class="hl opt">} = </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_716" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>listprice<span class="hl opt">} = </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_717" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>lastcost<span class="hl opt">} = </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_718" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>weight<span class="hl opt">} = </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_719" class="hl">    <span class="hl opt">}</span></li>
<li id="n_720" class="hl">    </li>
<li id="n_721" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(rop stock markup)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">}) }</span></li>
<li id="n_722" class="hl">   </li>
<li id="n_723" class="hl">    <span class="hl kwb">&#64;flds </span><span class="hl opt">= </span><span class="hl sng">qw(id qty unit bom adj partnumber description sellprice listprice lastcost weight assembly runningnumber partsgroup)</span><span class="hl opt">;</span></li>
<li id="n_724" class="hl">    <span class="hl kwb">$count </span><span class="hl opt">= </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_725" class="hl">    <span class="hl kwb">&#64;a </span><span class="hl opt">= ();</span></li>
<li id="n_726" class="hl">    </li>
<li id="n_727" class="hl">    <span class="hl kwa">for </span><span class="hl kwb">$i </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>assembly_rows<span class="hl opt">} - </span><span class="hl num">1</span><span class="hl opt">)) {</span></li>
<li id="n_728" class="hl">      <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}) {</span></li>
<li id="n_729" class="hl">    <span class="hl kwc">push </span><span class="hl kwb">&#64;a</span><span class="hl opt">, {};</span></li>
<li id="n_730" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$j </span><span class="hl opt">= </span><span class="hl kwb">$#a</span><span class="hl opt">;</span></li>
<li id="n_731" class="hl"></li>
<li id="n_732" class="hl">        <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">});</span></li>
<li id="n_733" class="hl"></li>
<li id="n_734" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwb">&#64;flds</span><span class="hl opt">) { </span><span class="hl kwb">$a</span><span class="hl opt">[</span><span class="hl kwb">$j</span><span class="hl opt">]-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} }</span></li>
<li id="n_735" class="hl"></li>
<li id="n_736" class="hl">        <span class="hl kwa">if </span><span class="hl opt">(! </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>project_id<span class="hl opt">}) {</span></li>
<li id="n_737" class="hl">      <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(sellprice listprice weight lastcost)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} += (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} * </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}) }</span></li>
<li id="n_738" class="hl">    <span class="hl opt">}</span></li>
<li id="n_739" class="hl">    </li>
<li id="n_740" class="hl">    <span class="hl kwb">$count++</span><span class="hl opt">;</span></li>
<li id="n_741" class="hl">      <span class="hl opt">}</span></li>
<li id="n_742" class="hl">    <span class="hl opt">}</span></li>
<li id="n_743" class="hl"></li>
<li id="n_744" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>markup<span class="hl opt">} &amp;&amp; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>markup<span class="hl opt">} != </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>oldmarkup<span class="hl opt">}) {</span></li>
<li id="n_745" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>sellprice<span class="hl opt">} = </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_746" class="hl">      <span class="hl opt">&amp;</span>calc_markup<span class="hl opt">;</span></li>
<li id="n_747" class="hl">    <span class="hl opt">}</span></li>
<li id="n_748" class="hl"> </li>
<li id="n_749" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(sellprice lastcost listprice)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">round_amount</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">}, </span><span class="hl num">2</span><span class="hl opt">) }</span></li>
<li id="n_750" class="hl">    </li>
<li id="n_751" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">redo_rows</span><span class="hl opt">(</span>\<span class="hl kwb">&#64;flds</span><span class="hl opt">, </span>\<span class="hl kwb">&#64;a</span><span class="hl opt">, </span><span class="hl kwb">$count</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>assembly_rows<span class="hl opt">});</span></li>
<li id="n_752" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>assembly_rows<span class="hl opt">} = </span><span class="hl kwb">$count</span><span class="hl opt">;</span></li>
<li id="n_753" class="hl">    </li>
<li id="n_754" class="hl">    <span class="hl kwb">$count </span><span class="hl opt">= </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_755" class="hl">    <span class="hl kwb">&#64;flds </span><span class="hl opt">= </span><span class="hl sng">qw(make model)</span><span class="hl opt">;</span></li>
<li id="n_756" class="hl">    <span class="hl kwb">&#64;a </span><span class="hl opt">= ();</span></li>
<li id="n_757" class="hl">    </li>
<li id="n_758" class="hl">    <span class="hl kwa">for </span><span class="hl kwb">$i </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>makemodel_rows<span class="hl opt">})) {</span></li>
<li id="n_759" class="hl">      <span class="hl kwa">if </span><span class="hl opt">((</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;make_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} </span><span class="hl kwc">ne </span><span class="hl sng">&quot;&quot;</span><span class="hl opt">) || (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;model_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} </span><span class="hl kwc">ne </span><span class="hl sng">&quot;&quot;</span><span class="hl opt">)) {</span></li>
<li id="n_760" class="hl">    <span class="hl kwc">push </span><span class="hl kwb">&#64;a</span><span class="hl opt">, {};</span></li>
<li id="n_761" class="hl">    <span class="hl kwc">my </span><span class="hl kwb">$j </span><span class="hl opt">= </span><span class="hl kwb">$#a</span><span class="hl opt">;</span></li>
<li id="n_762" class="hl"></li>
<li id="n_763" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwb">&#64;flds</span><span class="hl opt">) { </span><span class="hl kwb">$a</span><span class="hl opt">[</span><span class="hl kwb">$j</span><span class="hl opt">]-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} }</span></li>
<li id="n_764" class="hl">    <span class="hl kwb">$count++</span><span class="hl opt">;</span></li>
<li id="n_765" class="hl">      <span class="hl opt">}</span></li>
<li id="n_766" class="hl">    <span class="hl opt">}</span></li>
<li id="n_767" class="hl"></li>
<li id="n_768" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">redo_rows</span><span class="hl opt">(</span>\<span class="hl kwb">&#64;flds</span><span class="hl opt">, </span>\<span class="hl kwb">&#64;a</span><span class="hl opt">, </span><span class="hl kwb">$count</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>makemodel_rows<span class="hl opt">});</span></li>
<li id="n_769" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>makemodel_rows<span class="hl opt">} = </span><span class="hl kwb">$count</span><span class="hl opt">;</span></li>
<li id="n_770" class="hl"></li>
<li id="n_771" class="hl">    <span class="hl opt">&amp;</span>check_customer<span class="hl opt">;</span></li>
<li id="n_772" class="hl">  </li>
<li id="n_773" class="hl">  <span class="hl opt">}</span></li>
<li id="n_774" class="hl">  </li>
<li id="n_775" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>type<span class="hl opt">}) {</span></li>
<li id="n_776" class="hl"></li>
<li id="n_777" class="hl">    <span class="hl slc"># this section applies to invoices and orders</span></li>
<li id="n_778" class="hl">    <span class="hl slc"># remove any empty numbers</span></li>
<li id="n_779" class="hl">    </li>
<li id="n_780" class="hl">    <span class="hl kwb">$count </span><span class="hl opt">= </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_781" class="hl">    <span class="hl kwb">&#64;a </span><span class="hl opt">= ();</span></li>
<li id="n_782" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">}) {</span></li>
<li id="n_783" class="hl">      <span class="hl kwa">for </span><span class="hl kwb">$i </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">} - </span><span class="hl num">1</span><span class="hl opt">) {</span></li>
<li id="n_784" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;partnumber_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}) {</span></li>
<li id="n_785" class="hl">      <span class="hl kwc">push </span><span class="hl kwb">&#64;a</span><span class="hl opt">, {};</span></li>
<li id="n_786" class="hl">      <span class="hl kwc">my </span><span class="hl kwb">$j </span><span class="hl opt">= </span><span class="hl kwb">$#a</span><span class="hl opt">;</span></li>
<li id="n_787" class="hl"></li>
<li id="n_788" class="hl">      <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwb">&#64;flds</span><span class="hl opt">) { </span><span class="hl kwb">$a</span><span class="hl opt">[</span><span class="hl kwb">$j</span><span class="hl opt">]-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} }</span></li>
<li id="n_789" class="hl">      <span class="hl kwb">$count++</span><span class="hl opt">;</span></li>
<li id="n_790" class="hl">    <span class="hl opt">}</span></li>
<li id="n_791" class="hl">      <span class="hl opt">}</span></li>
<li id="n_792" class="hl">      </li>
<li id="n_793" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">redo_rows</span><span class="hl opt">(</span>\<span class="hl kwb">&#64;flds</span><span class="hl opt">, </span>\<span class="hl kwb">&#64;a</span><span class="hl opt">, </span><span class="hl kwb">$count</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">});</span></li>
<li id="n_794" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">} = </span><span class="hl kwb">$count</span><span class="hl opt">;</span></li>
<li id="n_795" class="hl"></li>
<li id="n_796" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>creditremaining<span class="hl opt">} -= &amp;</span>invoicetotal<span class="hl opt">;</span></li>
<li id="n_797" class="hl">      </li>
<li id="n_798" class="hl">    <span class="hl opt">}</span></li>
<li id="n_799" class="hl">  <span class="hl opt">}</span></li>
<li id="n_800" class="hl"></li>
<li id="n_801" class="hl">  <span class="hl opt">&amp;</span>display_form<span class="hl opt">;</span></li>
<li id="n_802" class="hl"></li>
<li id="n_803" class="hl"><span class="hl opt">}</span></li>
<li id="n_804" class="hl"></li>
<li id="n_805" class="hl"></li>
<li id="n_806" class="hl"><span class="hl kwa">sub </span>calc_markup <span class="hl opt">{</span></li>
<li id="n_807" class="hl"></li>
<li id="n_808" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>markup<span class="hl opt">}) {</span></li>
<li id="n_809" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>markup<span class="hl opt">} != </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>oldmarkup<span class="hl opt">}) {</span></li>
<li id="n_810" class="hl">      <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>lastcost<span class="hl opt">}) {</span></li>
<li id="n_811" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>sellprice<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>lastcost<span class="hl opt">} * (</span><span class="hl num">1 </span><span class="hl opt">+ </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>markup<span class="hl opt">}/</span><span class="hl num">100</span><span class="hl opt">);</span></li>
<li id="n_812" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>sellprice<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">round_amount</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>sellprice<span class="hl opt">}, </span><span class="hl num">2</span><span class="hl opt">);</span></li>
<li id="n_813" class="hl">      <span class="hl opt">} </span><span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_814" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>lastcost<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>sellprice<span class="hl opt">} </span><span class="hl kwd">/ (1 + $form-&gt;{markup}/</span><span class="hl num">100</span><span class="hl opt">);</span></li>
<li id="n_815" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>lastcost<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">round_amount</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>lastcost<span class="hl opt">}, </span><span class="hl num">2</span><span class="hl opt">);</span></li>
<li id="n_816" class="hl">      <span class="hl opt">}</span></li>
<li id="n_817" class="hl">    <span class="hl opt">}</span></li>
<li id="n_818" class="hl">  <span class="hl opt">} </span><span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_819" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>lastcost<span class="hl opt">}) {</span></li>
<li id="n_820" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>markup<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">round_amount</span><span class="hl opt">(((</span><span class="hl num">1 </span><span class="hl opt">- </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>sellprice<span class="hl opt">} / </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>lastcost<span class="hl opt">}) * </span><span class="hl num">100</span><span class="hl opt">), </span><span class="hl num">1</span><span class="hl opt">);</span></li>
<li id="n_821" class="hl">    <span class="hl opt">}</span></li>
<li id="n_822" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>markup<span class="hl opt">} = </span><span class="hl sng">&quot;&quot;</span> <span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>markup<span class="hl opt">} == </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_823" class="hl">  <span class="hl opt">}</span></li>
<li id="n_824" class="hl"></li>
<li id="n_825" class="hl"><span class="hl opt">}</span></li>
<li id="n_826" class="hl"></li>
<li id="n_827" class="hl"></li>
<li id="n_828" class="hl"><span class="hl kwa">sub </span>invoicetotal <span class="hl opt">{</span></li>
<li id="n_829" class="hl"></li>
<li id="n_830" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>oldinvtotal<span class="hl opt">} = </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_831" class="hl">  <span class="hl slc"># add all parts and deduct paid</span></li>
<li id="n_832" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwc">split </span><span class="hl kwd">/ /</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>taxaccounts<span class="hl opt">}) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_base&quot;</span><span class="hl opt">} = </span><span class="hl num">0 </span><span class="hl opt">}</span></li>
<li id="n_833" class="hl"></li>
<li id="n_834" class="hl">  <span class="hl kwc">my </span><span class="hl opt">(</span><span class="hl kwb">$amount</span><span class="hl opt">, </span><span class="hl kwb">$sellprice</span><span class="hl opt">, </span><span class="hl kwb">$discount</span><span class="hl opt">, </span><span class="hl kwb">$qty</span><span class="hl opt">);</span></li>
<li id="n_835" class="hl">  </li>
<li id="n_836" class="hl">  <span class="hl kwa">for </span><span class="hl kwb">$i </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">}) {</span></li>
<li id="n_837" class="hl">    <span class="hl kwb">$sellprice </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;sellprice_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">});</span></li>
<li id="n_838" class="hl">    <span class="hl kwb">$discount </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;discount_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">});</span></li>
<li id="n_839" class="hl">    <span class="hl kwb">$qty </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">});</span></li>
<li id="n_840" class="hl"></li>
<li id="n_841" class="hl">    <span class="hl kwb">$amount </span><span class="hl opt">= </span><span class="hl kwb">$sellprice </span><span class="hl opt">* (</span><span class="hl num">1 </span><span class="hl opt">- </span><span class="hl kwb">$discount </span><span class="hl opt">/ </span><span class="hl num">100</span><span class="hl opt">) * </span><span class="hl kwb">$qty</span><span class="hl opt">;</span></li>
<li id="n_842" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwc">split </span><span class="hl kwd">/ /</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;taxaccounts_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_base&quot;</span><span class="hl opt">} += </span><span class="hl kwb">$amount </span><span class="hl opt">}</span></li>
<li id="n_843" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>oldinvtotal<span class="hl opt">} += </span><span class="hl kwb">$amount</span><span class="hl opt">;</span></li>
<li id="n_844" class="hl">  <span class="hl opt">}</span></li>
<li id="n_845" class="hl"></li>
<li id="n_846" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(!</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>taxincluded<span class="hl opt">}) {</span></li>
<li id="n_847" class="hl">        <span class="hl kwc">my </span><span class="hl kwb">&#64;taxlist</span><span class="hl opt">= </span>Tax<span class="hl opt">::</span>init_taxes<span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>taxaccounts<span class="hl opt">});</span></li>
<li id="n_848" class="hl">        <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>oldinvtotal<span class="hl opt">} += </span>Tax<span class="hl opt">::</span>calculate_taxes<span class="hl opt">(</span>\<span class="hl kwb">&#64;taxlist</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">, </span></li>
<li id="n_849" class="hl">      <span class="hl kwb">$amount</span><span class="hl opt">, </span><span class="hl num">0</span><span class="hl opt">);</span></li>
<li id="n_850" class="hl">  <span class="hl opt">}</span></li>
<li id="n_851" class="hl">  </li>
<li id="n_852" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>oldtotalpaid<span class="hl opt">} = </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_853" class="hl">  <span class="hl kwa">for </span><span class="hl kwb">$i </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>paidaccounts<span class="hl opt">}) {</span></li>
<li id="n_854" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>oldtotalpaid<span class="hl opt">} += </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;paid_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">};</span></li>
<li id="n_855" class="hl">  <span class="hl opt">}</span></li>
<li id="n_856" class="hl">  </li>
<li id="n_857" class="hl">  <span class="hl slc"># return total</span></li>
<li id="n_858" class="hl">  <span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>oldinvtotal<span class="hl opt">} - </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>oldtotalpaid<span class="hl opt">});</span></li>
<li id="n_859" class="hl"></li>
<li id="n_860" class="hl"><span class="hl opt">}</span></li>
<li id="n_861" class="hl"></li>
<li id="n_862" class="hl"></li>
<li id="n_863" class="hl"><span class="hl kwa">sub </span>validate_items <span class="hl opt">{</span></li>
<li id="n_864" class="hl">  </li>
<li id="n_865" class="hl">  <span class="hl slc"># check if items are valid</span></li>
<li id="n_866" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">} == </span><span class="hl num">1</span><span class="hl opt">) {</span></li>
<li id="n_867" class="hl">    <span class="hl opt">&amp;</span>update<span class="hl opt">;</span></li>
<li id="n_868" class="hl">    <span class="hl kwa">exit</span><span class="hl opt">;</span></li>
<li id="n_869" class="hl">  <span class="hl opt">}</span></li>
<li id="n_870" class="hl">    </li>
<li id="n_871" class="hl">  <span class="hl kwa">for </span><span class="hl kwb">$i </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">} - </span><span class="hl num">1</span><span class="hl opt">) {</span></li>
<li id="n_872" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">isblank</span><span class="hl opt">(</span><span class="hl sng">&quot;partnumber_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">, </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Number missing in Row&#39;</span><span class="hl opt">) . </span><span class="hl sng">&quot; </span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">);</span></li>
<li id="n_873" class="hl">  <span class="hl opt">}</span></li>
<li id="n_874" class="hl"></li>
<li id="n_875" class="hl"><span class="hl opt">}</span></li>
<li id="n_876" class="hl"></li>
<li id="n_877" class="hl"></li>
<li id="n_878" class="hl"></li>
<li id="n_879" class="hl"><span class="hl kwa">sub </span>purchase_order <span class="hl opt">{</span></li>
<li id="n_880" class="hl">  </li>
<li id="n_881" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>title<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Add Purchase Order&#39;</span><span class="hl opt">);</span></li>
<li id="n_882" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>vc<span class="hl opt">} = </span><span class="hl sng">&#39;vendor&#39;</span><span class="hl opt">;</span></li>
<li id="n_883" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>type<span class="hl opt">} = </span><span class="hl sng">&#39;purchase_order&#39;</span><span class="hl opt">;</span></li>
<li id="n_884" class="hl">  <span class="hl kwb">$buysell </span><span class="hl opt">= </span><span class="hl sng">&#39;sell&#39;</span><span class="hl opt">;</span></li>
<li id="n_885" class="hl"></li>
<li id="n_886" class="hl">  <span class="hl opt">&amp;</span>create_form<span class="hl opt">;</span></li>
<li id="n_887" class="hl"></li>
<li id="n_888" class="hl"><span class="hl opt">}</span></li>
<li id="n_889" class="hl"></li>
<li id="n_890" class="hl"> </li>
<li id="n_891" class="hl"><span class="hl kwa">sub </span>sales_order <span class="hl opt">{</span></li>
<li id="n_892" class="hl"></li>
<li id="n_893" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>title<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Add Sales Order&#39;</span><span class="hl opt">);</span></li>
<li id="n_894" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>vc<span class="hl opt">} = </span><span class="hl sng">&#39;customer&#39;</span><span class="hl opt">;</span></li>
<li id="n_895" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>type<span class="hl opt">} = </span><span class="hl sng">&#39;sales_order&#39;</span><span class="hl opt">;</span></li>
<li id="n_896" class="hl">  <span class="hl kwb">$buysell </span><span class="hl opt">= </span><span class="hl sng">&#39;buy&#39;</span><span class="hl opt">;</span></li>
<li id="n_897" class="hl"></li>
<li id="n_898" class="hl">  <span class="hl opt">&amp;</span>create_form<span class="hl opt">;</span></li>
<li id="n_899" class="hl"></li>
<li id="n_900" class="hl"><span class="hl opt">}</span></li>
<li id="n_901" class="hl"></li>
<li id="n_902" class="hl"></li>
<li id="n_903" class="hl"><span class="hl kwa">sub </span>rfq <span class="hl opt">{</span></li>
<li id="n_904" class="hl">  </li>
<li id="n_905" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>title<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Add Request for Quotation&#39;</span><span class="hl opt">);</span></li>
<li id="n_906" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>vc<span class="hl opt">} = </span><span class="hl sng">&#39;vendor&#39;</span><span class="hl opt">;</span></li>
<li id="n_907" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>type<span class="hl opt">} = </span><span class="hl sng">&#39;request_quotation&#39;</span><span class="hl opt">;</span></li>
<li id="n_908" class="hl">  <span class="hl kwb">$buysell </span><span class="hl opt">= </span><span class="hl sng">&#39;sell&#39;</span><span class="hl opt">;</span></li>
<li id="n_909" class="hl"> </li>
<li id="n_910" class="hl">  <span class="hl opt">&amp;</span>create_form<span class="hl opt">;</span></li>
<li id="n_911" class="hl">  </li>
<li id="n_912" class="hl"><span class="hl opt">}</span></li>
<li id="n_913" class="hl"></li>
<li id="n_914" class="hl"></li>
<li id="n_915" class="hl"><span class="hl kwa">sub </span>quotation <span class="hl opt">{</span></li>
<li id="n_916" class="hl"></li>
<li id="n_917" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>title<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Add Quotation&#39;</span><span class="hl opt">);</span></li>
<li id="n_918" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>vc<span class="hl opt">} = </span><span class="hl sng">&#39;customer&#39;</span><span class="hl opt">;</span></li>
<li id="n_919" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>type<span class="hl opt">} = </span><span class="hl sng">&#39;sales_quotation&#39;</span><span class="hl opt">;</span></li>
<li id="n_920" class="hl">  <span class="hl kwb">$buysell </span><span class="hl opt">= </span><span class="hl sng">&#39;buy&#39;</span><span class="hl opt">;</span></li>
<li id="n_921" class="hl"></li>
<li id="n_922" class="hl">  <span class="hl opt">&amp;</span>create_form<span class="hl opt">;</span></li>
<li id="n_923" class="hl"></li>
<li id="n_924" class="hl"><span class="hl opt">}</span></li>
<li id="n_925" class="hl"></li>
<li id="n_926" class="hl"></li>
<li id="n_927" class="hl"><span class="hl kwa">sub </span>create_form <span class="hl opt">{</span></li>
<li id="n_928" class="hl"></li>
<li id="n_929" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(id printed emailed queued)</span><span class="hl opt">) { </span><span class="hl kwc">delete </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} }</span></li>
<li id="n_930" class="hl"> </li>
<li id="n_931" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>script<span class="hl opt">} = </span><span class="hl sng">&#39;oe.pl&#39;</span><span class="hl opt">;</span></li>
<li id="n_932" class="hl"></li>
<li id="n_933" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>shipto<span class="hl opt">} = </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_934" class="hl"></li>
<li id="n_935" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">}-- </span><span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">};</span></li>
<li id="n_936" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">} = </span><span class="hl num">0 </span><span class="hl kwa">if </span><span class="hl opt">! </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{vc}_id&quot;</span><span class="hl opt">};</span></li>
<li id="n_937" class="hl"></li>
<li id="n_938" class="hl">  <span class="hl kwa">do </span><span class="hl sng">&quot;bin/</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{script}&quot;</span><span class="hl opt">;</span></li>
<li id="n_939" class="hl"></li>
<li id="n_940" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{vc}&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;currency&quot;</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;select</span><span class="hl ipl">$_</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl sng">&quot;&quot;</span> <span class="hl opt">}</span></li>
<li id="n_941" class="hl">  </li>
<li id="n_942" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(currency employee department intnotes notes language_code taxincluded)</span><span class="hl opt">) { </span><span class="hl kwb">$temp</span><span class="hl opt">{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} }</span></li>
<li id="n_943" class="hl"></li>
<li id="n_944" class="hl">  <span class="hl opt">&amp;</span>order_links<span class="hl opt">;</span></li>
<li id="n_945" class="hl"></li>
<li id="n_946" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwc">keys </span><span class="hl kwb">%temp</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$temp</span><span class="hl opt">{</span><span class="hl kwb">$_</span><span class="hl opt">} </span><span class="hl kwa">if </span><span class="hl kwb">$temp</span><span class="hl opt">{</span><span class="hl kwb">$_</span><span class="hl opt">} }</span></li>
<li id="n_947" class="hl"></li>
<li id="n_948" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>exchangerate<span class="hl opt">} = </span><span class="hl sng">&quot;&quot;</span><span class="hl opt">;</span></li>
<li id="n_949" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>forex<span class="hl opt">} = </span><span class="hl sng">&quot;&quot;</span><span class="hl opt">;</span></li>
<li id="n_950" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>currency<span class="hl opt">} </span><span class="hl kwc">ne </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>defaultcurrency<span class="hl opt">}) {</span></li>
<li id="n_951" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>exchangerate<span class="hl opt">} = </span><span class="hl kwb">$exchangerate </span><span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>forex<span class="hl opt">} = (</span><span class="hl kwb">$exchangerate </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">check_exchangerate</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>currency<span class="hl opt">}, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>transdate<span class="hl opt">}, </span><span class="hl kwb">$buysell</span><span class="hl opt">)));</span></li>
<li id="n_952" class="hl">  <span class="hl opt">}</span></li>
<li id="n_953" class="hl"></li>
<li id="n_954" class="hl">  <span class="hl opt">&amp;</span>prepare_order<span class="hl opt">;</span></li>
<li id="n_955" class="hl"></li>
<li id="n_956" class="hl">  <span class="hl opt">&amp;</span>display_form<span class="hl opt">;</span></li>
<li id="n_957" class="hl"></li>
<li id="n_958" class="hl"><span class="hl opt">}</span></li>
<li id="n_959" class="hl"></li>
<li id="n_960" class="hl"></li>
<li id="n_961" class="hl"></li>
<li id="n_962" class="hl"><span class="hl kwa">sub </span>e_mail <span class="hl opt">{</span></li>
<li id="n_963" class="hl"></li>
<li id="n_964" class="hl">  <span class="hl kwb">$bcc </span><span class="hl opt">= </span>qq<span class="hl opt">|&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span>bcc value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{bcc}&quot;</span><span class="hl opt">&gt;|;</span></li>
<li id="n_965" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$myconfig</span><span class="hl opt">{</span><span class="hl kwa">role</span><span class="hl opt">} =~ </span><span class="hl kwd">/(admin|manager)/</span><span class="hl opt">) {</span></li>
<li id="n_966" class="hl">    <span class="hl kwb">$bcc </span><span class="hl opt">= </span>qq<span class="hl opt">|</span></li>
<li id="n_967" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">=</span>true<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Bcc&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_968" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>bcc size<span class="hl opt">=</span><span class="hl num">30 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{bcc}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_969" class="hl"><span class="hl opt">|;</span></li>
<li id="n_970" class="hl">  <span class="hl opt">}</span></li>
<li id="n_971" class="hl"></li>
<li id="n_972" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">} =~ </span><span class="hl kwd">/(pick|packing|bin)_list/</span><span class="hl opt">) {</span></li>
<li id="n_973" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>email<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>shiptoemail<span class="hl opt">} </span><span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>shiptoemail<span class="hl opt">};</span></li>
<li id="n_974" class="hl">  <span class="hl opt">}</span></li>
<li id="n_975" class="hl"></li>
<li id="n_976" class="hl">  <span class="hl kwb">$name </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>vc<span class="hl opt">}};</span></li>
<li id="n_977" class="hl">  <span class="hl kwb">$name </span><span class="hl opt">=~ </span><span class="hl kwd">s/--.*//g</span><span class="hl opt">;</span></li>
<li id="n_978" class="hl">  <span class="hl kwb">$title </span><span class="hl opt">= </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;E-mail&#39;</span><span class="hl opt">).</span><span class="hl sng">&quot; </span><span class="hl ipl">$name</span><span class="hl sng">&quot;</span><span class="hl opt">;</span></li>
<li id="n_979" class="hl">  </li>
<li id="n_980" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">header</span><span class="hl opt">;</span></li>
<li id="n_981" class="hl"></li>
<li id="n_982" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_983" class="hl"><span class="hl opt">&lt;</span>body<span class="hl opt">&gt;</span></li>
<li id="n_984" class="hl"></li>
<li id="n_985" class="hl"><span class="hl opt">&lt;</span>form <span class="hl kwa">method</span><span class="hl opt">=</span>post action<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{script}&quot;</span><span class="hl opt">&gt;</span></li>
<li id="n_986" class="hl"></li>
<li id="n_987" class="hl"><span class="hl opt">&lt;</span>table width<span class="hl opt">=</span><span class="hl num">100</span><span class="hl opt">%&gt;</span></li>
<li id="n_988" class="hl">  <span class="hl opt">&lt;</span>tr <span class="hl kwa">class</span><span class="hl opt">=</span>listtop<span class="hl opt">&gt;</span></li>
<li id="n_989" class="hl">    <span class="hl opt">&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listtop<span class="hl opt">&gt;</span><span class="hl kwb">$title</span><span class="hl opt">&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_990" class="hl">  <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_991" class="hl">  <span class="hl opt">&lt;</span>tr height<span class="hl opt">=</span><span class="hl sng">&quot;5&quot;</span><span class="hl opt">&gt;&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_992" class="hl">  <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_993" class="hl">    <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span></li>
<li id="n_994" class="hl">      <span class="hl opt">&lt;</span>table width<span class="hl opt">=</span><span class="hl num">100</span><span class="hl opt">%&gt;</span></li>
<li id="n_995" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_996" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;E-mail&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_997" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>email size<span class="hl opt">=</span><span class="hl num">30 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{email}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_998" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Cc&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_999" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>cc size<span class="hl opt">=</span><span class="hl num">30 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{cc}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1000" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1001" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1002" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Subject&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1003" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>subject size<span class="hl opt">=</span><span class="hl num">30 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{subject}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1004" class="hl">      <span class="hl kwb">$bcc</span></li>
<li id="n_1005" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1006" class="hl">      <span class="hl opt">&lt;/</span>table<span class="hl opt">&gt;</span></li>
<li id="n_1007" class="hl">    <span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1008" class="hl">  <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1009" class="hl">  <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1010" class="hl">    <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1011" class="hl">      <span class="hl opt">&lt;</span>table width<span class="hl opt">=</span><span class="hl num">100</span><span class="hl opt">%&gt;</span></li>
<li id="n_1012" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1013" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>left nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Message&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1014" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1015" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1016" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>textarea name<span class="hl opt">=</span>message rows<span class="hl opt">=</span><span class="hl num">15 </span>cols<span class="hl opt">=</span><span class="hl num">60 </span>wrap<span class="hl opt">=</span>soft<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>message<span class="hl opt">}&lt;</span><span class="hl kwd">/textarea&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1017" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1018" class="hl">      <span class="hl opt">&lt;/</span>table<span class="hl opt">&gt;</span></li>
<li id="n_1019" class="hl">    <span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1020" class="hl">  <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1021" class="hl">  <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1022" class="hl">    <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1023" class="hl"><span class="hl opt">|;</span></li>
<li id="n_1024" class="hl"></li>
<li id="n_1025" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>oldmedia<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>media<span class="hl opt">};</span></li>
<li id="n_1026" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>media<span class="hl opt">} = </span><span class="hl sng">&quot;email&quot;</span><span class="hl opt">;</span></li>
<li id="n_1027" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>format<span class="hl opt">} = </span><span class="hl sng">&quot;pdf&quot;</span><span class="hl opt">;</span></li>
<li id="n_1028" class="hl">  </li>
<li id="n_1029" class="hl">  <span class="hl opt">&amp;</span>print_options<span class="hl opt">;</span></li>
<li id="n_1030" class="hl">  </li>
<li id="n_1031" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(email cc bcc subject message formname sendmode format language_code action nextsub)</span><span class="hl opt">) { </span><span class="hl kwc">delete </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} }</span></li>
<li id="n_1032" class="hl">  </li>
<li id="n_1033" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">hide_form</span><span class="hl opt">;</span></li>
<li id="n_1034" class="hl"></li>
<li id="n_1035" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_1036" class="hl">    <span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1037" class="hl">  <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1038" class="hl">  <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1039" class="hl">    <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>hr size<span class="hl opt">=</span><span class="hl num">3 </span>noshade<span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1040" class="hl">  <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1041" class="hl"><span class="hl opt">&lt;/</span>table<span class="hl opt">&gt;</span></li>
<li id="n_1042" class="hl"></li>
<li id="n_1043" class="hl"><span class="hl opt">&lt;</span>input type<span class="hl opt">=</span><span class="hl sng">&quot;hidden&quot;</span> name<span class="hl opt">=</span><span class="hl sng">&quot;nextsub&quot;</span> value<span class="hl opt">=</span><span class="hl sng">&quot;send_email&quot;</span><span class="hl opt">&gt;</span></li>
<li id="n_1044" class="hl"></li>
<li id="n_1045" class="hl"><span class="hl opt">&lt;</span>br<span class="hl opt">&gt;</span></li>
<li id="n_1046" class="hl"><span class="hl opt">&lt;</span>button name<span class="hl opt">=</span><span class="hl sng">&quot;action&quot;</span> <span class="hl kwa">class</span><span class="hl opt">=</span><span class="hl sng">&quot;submit&quot;</span> type<span class="hl opt">=</span><span class="hl sng">&quot;submit&quot;</span> value<span class="hl opt">=</span><span class="hl sng">&quot;continue&quot;</span><span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Continue&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>button<span class="hl opt">&gt;</span></li>
<li id="n_1047" class="hl"><span class="hl opt">&lt;/</span>form<span class="hl opt">&gt;</span></li>
<li id="n_1048" class="hl"></li>
<li id="n_1049" class="hl"><span class="hl opt">&lt;/</span>body<span class="hl opt">&gt;</span></li>
<li id="n_1050" class="hl"><span class="hl opt">&lt;/</span>html<span class="hl opt">&gt;</span></li>
<li id="n_1051" class="hl"><span class="hl opt">|;</span></li>
<li id="n_1052" class="hl"></li>
<li id="n_1053" class="hl"><span class="hl opt">}</span></li>
<li id="n_1054" class="hl"></li>
<li id="n_1055" class="hl"></li>
<li id="n_1056" class="hl"><span class="hl kwa">sub </span>send_email <span class="hl opt">{</span></li>
<li id="n_1057" class="hl"></li>
<li id="n_1058" class="hl">  <span class="hl kwb">$old_form </span><span class="hl opt">= </span>new Form<span class="hl opt">;</span></li>
<li id="n_1059" class="hl">  </li>
<li id="n_1060" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwc">keys </span><span class="hl kwb">%$form</span><span class="hl opt">) { </span><span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} }</span></li>
<li id="n_1061" class="hl">  <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>media<span class="hl opt">} = </span><span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>oldmedia<span class="hl opt">};</span></li>
<li id="n_1062" class="hl">  </li>
<li id="n_1063" class="hl">  <span class="hl opt">&amp;</span>print_form<span class="hl opt">(</span><span class="hl kwb">$old_form</span><span class="hl opt">);</span></li>
<li id="n_1064" class="hl">  </li>
<li id="n_1065" class="hl"><span class="hl opt">}</span></li>
<li id="n_1066" class="hl">  </li>
<li id="n_1067" class="hl"></li>
<li id="n_1068" class="hl"> </li>
<li id="n_1069" class="hl"><span class="hl kwa">sub </span>print_options <span class="hl opt">{</span></li>
<li id="n_1070" class="hl"></li>
<li id="n_1071" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>sendmode<span class="hl opt">} = </span><span class="hl sng">&quot;attachment&quot;</span><span class="hl opt">;</span></li>
<li id="n_1072" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>copies<span class="hl opt">} = </span><span class="hl num">1 </span><span class="hl kwa">unless </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>copies<span class="hl opt">};</span></li>
<li id="n_1073" class="hl">  </li>
<li id="n_1074" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>SM<span class="hl opt">}{</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>sendmode<span class="hl opt">}} = </span><span class="hl sng">&quot;selected&quot;</span><span class="hl opt">;</span></li>
<li id="n_1075" class="hl">  </li>
<li id="n_1076" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectlanguage<span class="hl opt">}) {</span></li>
<li id="n_1077" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;selectlanguage&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">unescape</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;selectlanguage&quot;</span><span class="hl opt">});</span></li>
<li id="n_1078" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;selectlanguage&quot;</span><span class="hl opt">} =~ </span><span class="hl kwd">s/ selected//</span><span class="hl opt">;</span></li>
<li id="n_1079" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;selectlanguage&quot;</span><span class="hl opt">} =~ </span><span class="hl kwd">s/(&lt;option value=&quot;\Q$form-&gt;{language_code}\E&quot;)/$1 selected/</span><span class="hl opt">;</span></li>
<li id="n_1080" class="hl"></li>
<li id="n_1081" class="hl">    <span class="hl kwb">$lang </span><span class="hl opt">= </span>qq<span class="hl opt">|&lt;</span><span class="hl kwc">select </span>name<span class="hl opt">=</span>language_code<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectlanguage<span class="hl opt">}&lt;/</span><span class="hl kwc">select</span><span class="hl opt">&gt;</span></li>
<li id="n_1082" class="hl">    <span class="hl opt">&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span>oldlanguage_code value<span class="hl opt">=</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>oldlanguage_code<span class="hl opt">}&gt;</span></li>
<li id="n_1083" class="hl">    <span class="hl opt">&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span>selectlanguage value<span class="hl opt">=</span><span class="hl sng">&quot;|.</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;escape(</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{selectlanguage},1).qq|&quot;</span><span class="hl opt">&gt;|;</span></li>
<li id="n_1084" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1085" class="hl"></li>
<li id="n_1086" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectformname<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">unescape</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectformname<span class="hl opt">});</span></li>
<li id="n_1087" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectformname<span class="hl opt">} =~ </span><span class="hl kwd">s/ selected//</span><span class="hl opt">;</span></li>
<li id="n_1088" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectformname<span class="hl opt">} =~ </span><span class="hl kwd">s/(&lt;option value=&quot;\Q$form-&gt;{formname}\E&quot;)/$1 selected/</span><span class="hl opt">;</span></li>
<li id="n_1089" class="hl"></li>
<li id="n_1090" class="hl">  <span class="hl kwb">$type </span><span class="hl opt">= </span>qq<span class="hl opt">|&lt;</span><span class="hl kwc">select </span>name<span class="hl opt">=</span>formname<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectformname<span class="hl opt">}&lt;/</span><span class="hl kwc">select</span><span class="hl opt">&gt;</span></li>
<li id="n_1091" class="hl">  <span class="hl opt">&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span>selectformname value<span class="hl opt">=</span><span class="hl sng">&quot;|.</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;escape(</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{selectformname},1).qq|&quot;</span><span class="hl opt">&gt;|;</span></li>
<li id="n_1092" class="hl"></li>
<li id="n_1093" class="hl">  </li>
<li id="n_1094" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>media<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;email&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1095" class="hl">    <span class="hl kwb">$media </span><span class="hl opt">= </span>qq<span class="hl opt">|&lt;</span><span class="hl kwc">select </span>name<span class="hl opt">=</span>sendmode<span class="hl opt">&gt;</span></li>
<li id="n_1096" class="hl">        <span class="hl opt">&lt;</span>option value<span class="hl opt">=</span>attachment <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>SM<span class="hl opt">}{</span>attachment<span class="hl opt">}&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Attachment&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|</span></li>
<li id="n_1097" class="hl">        <span class="hl opt">&lt;</span>option value<span class="hl opt">=</span>inline <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>SM<span class="hl opt">}{</span>inline<span class="hl opt">}&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;In-line&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span><span class="hl kwc">select</span><span class="hl opt">&gt;|;</span></li>
<li id="n_1098" class="hl">  <span class="hl opt">} </span><span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_1099" class="hl">    <span class="hl kwb">$media </span><span class="hl opt">= </span>qq<span class="hl opt">|&lt;</span><span class="hl kwc">select </span>name<span class="hl opt">=</span>media<span class="hl opt">&gt;</span></li>
<li id="n_1100" class="hl">        <span class="hl opt">&lt;</span>option value<span class="hl opt">=</span><span class="hl sng">&quot;screen&quot;</span><span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Screen&#39;</span><span class="hl opt">);</span></li>
<li id="n_1101" class="hl"> </li>
<li id="n_1102" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(%{</span>LedgerSMB<span class="hl opt">::</span>Sysconfig<span class="hl opt">::</span>printer<span class="hl opt">} &amp;&amp; ${</span>LedgerSMB<span class="hl opt">::</span>Sysconfig<span class="hl opt">::</span>latex<span class="hl opt">}) {</span></li>
<li id="n_1103" class="hl">      <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwc">sort keys </span><span class="hl opt">%{</span>LedgerSMB<span class="hl opt">::</span>Sysconfig<span class="hl opt">::</span>printer<span class="hl opt">}) { </span><span class="hl kwb">$media </span><span class="hl opt">.= </span>qq<span class="hl opt">|</span></li>
<li id="n_1104" class="hl">            <span class="hl opt">&lt;</span>option value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$_</span><span class="hl sng">&quot;</span><span class="hl opt">&gt;</span><span class="hl kwb">$_</span><span class="hl opt">| }</span></li>
<li id="n_1105" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1106" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(${</span>LedgerSMB<span class="hl opt">::</span>Sysconfig<span class="hl opt">::</span>latex<span class="hl opt">}) {</span></li>
<li id="n_1107" class="hl">      <span class="hl kwb">$media </span><span class="hl opt">.= </span>qq<span class="hl opt">|</span></li>
<li id="n_1108" class="hl">            <span class="hl opt">&lt;</span>option value<span class="hl opt">=</span><span class="hl sng">&quot;queue&quot;</span><span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Queue&#39;</span><span class="hl opt">);</span></li>
<li id="n_1109" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1110" class="hl">    <span class="hl kwb">$media </span><span class="hl opt">.= </span>qq<span class="hl opt">|&lt;/</span><span class="hl kwc">select</span><span class="hl opt">&gt;|;</span></li>
<li id="n_1111" class="hl"></li>
<li id="n_1112" class="hl">    <span class="hl slc"># set option selected</span></li>
<li id="n_1113" class="hl">    <span class="hl kwb">$media </span><span class="hl opt">=~ </span><span class="hl kwd">s/(&lt;option value=&quot;\Q$form-&gt;{media}\E&quot;)/$1 selected/</span><span class="hl opt">;</span></li>
<li id="n_1114" class="hl"> </li>
<li id="n_1115" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1116" class="hl"></li>
<li id="n_1117" class="hl"></li>
<li id="n_1118" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectformat<span class="hl opt">} = </span>qq<span class="hl opt">|&lt;</span>option value<span class="hl opt">=</span><span class="hl sng">&quot;html&quot;</span><span class="hl opt">&gt;</span>html<span class="hl esc">\n</span><span class="hl opt">|;</span></li>
<li id="n_1119" class="hl"><span class="hl slc">#       &lt;option value=&quot;txt&quot;&gt;|.$locale-&gt;text(&#39;Text&#39;);</span></li>
<li id="n_1120" class="hl"></li>
<li id="n_1121" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(${</span>LedgerSMB<span class="hl opt">::</span>Sysconfig<span class="hl opt">::</span>latex<span class="hl opt">}) {</span></li>
<li id="n_1122" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectformat<span class="hl opt">} .= </span>qq<span class="hl opt">|</span></li>
<li id="n_1123" class="hl">            <span class="hl opt">&lt;</span>option value<span class="hl opt">=</span><span class="hl sng">&quot;postscript&quot;</span><span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Postscript&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|</span></li>
<li id="n_1124" class="hl">        <span class="hl opt">&lt;</span>option value<span class="hl opt">=</span><span class="hl sng">&quot;pdf&quot;</span><span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;PDF&#39;</span><span class="hl opt">);</span></li>
<li id="n_1125" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1126" class="hl">    </li>
<li id="n_1127" class="hl">  <span class="hl kwb">$format </span><span class="hl opt">= </span>qq<span class="hl opt">|&lt;</span><span class="hl kwc">select </span>name<span class="hl opt">=</span>format<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>selectformat<span class="hl opt">}&lt;/</span><span class="hl kwc">select</span><span class="hl opt">&gt;|;</span></li>
<li id="n_1128" class="hl">  <span class="hl kwb">$format </span><span class="hl opt">=~ </span><span class="hl kwd">s/(&lt;option value=&quot;\Q$form-&gt;{format}\E&quot;)/$1 selected/</span><span class="hl opt">;</span></li>
<li id="n_1129" class="hl">  <span class="hl kwb">$format </span><span class="hl opt">.= </span>qq<span class="hl opt">|</span></li>
<li id="n_1130" class="hl">  <span class="hl opt">&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span>selectformat value<span class="hl opt">=</span><span class="hl sng">&quot;|.</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;escape(</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{selectformat},1).qq|&quot;</span><span class="hl opt">&gt;|;</span></li>
<li id="n_1131" class="hl">  </li>
<li id="n_1132" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_1133" class="hl"><span class="hl opt">&lt;</span>table width<span class="hl opt">=</span><span class="hl num">100</span><span class="hl opt">%&gt;</span></li>
<li id="n_1134" class="hl">  <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1135" class="hl">    <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$type</span><span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1136" class="hl">    <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$lang</span><span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1137" class="hl">    <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$format</span><span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1138" class="hl">    <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$media</span><span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1139" class="hl"><span class="hl opt">|;</span></li>
<li id="n_1140" class="hl"></li>
<li id="n_1141" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(%{</span>LedgerSMB<span class="hl opt">::</span>Sysconfig<span class="hl opt">::</span>printer<span class="hl opt">} &amp;&amp; ${</span>LedgerSMB<span class="hl opt">::</span>Sysconfig<span class="hl opt">::</span>latex<span class="hl opt">} &amp;&amp; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>media<span class="hl opt">} </span><span class="hl kwc">ne </span><span class="hl sng">&#39;email&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1142" class="hl">    <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_1143" class="hl">    <span class="hl opt">&lt;</span>td nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Copies&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|</span></li>
<li id="n_1144" class="hl">    <span class="hl opt">&lt;</span>input name<span class="hl opt">=</span>copies size<span class="hl opt">=</span><span class="hl num">2 </span>value<span class="hl opt">=</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>copies<span class="hl opt">}&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1145" class="hl"><span class="hl opt">|;</span></li>
<li id="n_1146" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1147" class="hl"></li>
<li id="n_1148" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Printed&#39;)</span></li>
<li id="n_1149" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;E-mailed&#39;)</span></li>
<li id="n_1150" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Queued&#39;)</span></li>
<li id="n_1151" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Scheduled&#39;)</span></li>
<li id="n_1152" class="hl"></li>
<li id="n_1153" class="hl">  <span class="hl kwb">%status </span><span class="hl opt">= ( </span>printed <span class="hl opt">=&gt; </span><span class="hl sng">&#39;Printed&#39;</span><span class="hl opt">,</span></li>
<li id="n_1154" class="hl">              emailed <span class="hl opt">=&gt; </span><span class="hl sng">&#39;E-mailed&#39;</span><span class="hl opt">,</span></li>
<li id="n_1155" class="hl">          queued  <span class="hl opt">=&gt; </span><span class="hl sng">&#39;Queued&#39;</span><span class="hl opt">,</span></li>
<li id="n_1156" class="hl">          recurring <span class="hl opt">=&gt; </span><span class="hl sng">&#39;Scheduled&#39;</span> <span class="hl opt">);</span></li>
<li id="n_1157" class="hl"></li>
<li id="n_1158" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|&lt;</span>td align<span class="hl opt">=</span>right width<span class="hl opt">=</span><span class="hl num">90</span><span class="hl opt">%&gt;|;</span></li>
<li id="n_1159" class="hl"></li>
<li id="n_1160" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(printed emailed queued recurring)</span><span class="hl opt">) {</span></li>
<li id="n_1161" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} =~ </span><span class="hl kwd">/$form-&gt;{formname}/</span><span class="hl opt">) {</span></li>
<li id="n_1162" class="hl">      <span class="hl kwc">print </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl kwb">$status</span><span class="hl opt">{</span><span class="hl kwb">$_</span><span class="hl opt">}).</span>qq<span class="hl opt">|&lt;</span>br<span class="hl opt">&gt;|;</span></li>
<li id="n_1163" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1164" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1165" class="hl"></li>
<li id="n_1166" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_1167" class="hl">    <span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1168" class="hl">  <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1169" class="hl"><span class="hl opt">|;</span></li>
<li id="n_1170" class="hl"></li>
<li id="n_1171" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>groupprojectnumber<span class="hl opt">} = </span><span class="hl sng">&quot;checked&quot;</span> <span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>groupprojectnumber<span class="hl opt">};</span></li>
<li id="n_1172" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>grouppartsgroup<span class="hl opt">} = </span><span class="hl sng">&quot;checked&quot;</span> <span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>grouppartsgroup<span class="hl opt">};</span></li>
<li id="n_1173" class="hl"></li>
<li id="n_1174" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(runningnumber partnumber description bin)</span><span class="hl opt">) { </span><span class="hl kwb">$sortby</span><span class="hl opt">{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl sng">&quot;checked&quot;</span> <span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>sortby<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl kwb">$_ </span><span class="hl opt">}</span></li>
<li id="n_1175" class="hl">  </li>
<li id="n_1176" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_1177" class="hl">  <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1178" class="hl">    <span class="hl opt">&lt;</span>td colspan<span class="hl opt">=</span><span class="hl num">3</span><span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Group by&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">| -&gt;</span></li>
<li id="n_1179" class="hl">    <span class="hl opt">&lt;</span>input name<span class="hl opt">=</span>groupprojectnumber type<span class="hl opt">=</span>checkbox <span class="hl kwa">class</span><span class="hl opt">=</span>checkbox <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>groupprojectnumber<span class="hl opt">}&gt;</span></li>
<li id="n_1180" class="hl">    <span class="hl opt">|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Project&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|</span></li>
<li id="n_1181" class="hl">    <span class="hl opt">&lt;</span>input name<span class="hl opt">=</span>grouppartsgroup type<span class="hl opt">=</span>checkbox <span class="hl kwa">class</span><span class="hl opt">=</span>checkbox <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>grouppartsgroup<span class="hl opt">}&gt;</span></li>
<li id="n_1182" class="hl">    <span class="hl opt">|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Group&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|</span></li>
<li id="n_1183" class="hl">    <span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1184" class="hl"></li>
<li id="n_1185" class="hl">    <span class="hl opt">&lt;</span>td colspan<span class="hl opt">=</span><span class="hl num">3</span><span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Sort by&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">| -&gt;</span></li>
<li id="n_1186" class="hl">    <span class="hl opt">&lt;</span>input name<span class="hl opt">=</span>sortby type<span class="hl opt">=</span>radio <span class="hl kwa">class</span><span class="hl opt">=</span>radio value<span class="hl opt">=</span>runningnumber <span class="hl kwb">$sortby</span><span class="hl opt">{</span>runningnumber<span class="hl opt">}&gt;</span></li>
<li id="n_1187" class="hl">    <span class="hl opt">|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Item&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|</span></li>
<li id="n_1188" class="hl">    <span class="hl opt">&lt;</span>input name<span class="hl opt">=</span>sortby type<span class="hl opt">=</span>radio <span class="hl kwa">class</span><span class="hl opt">=</span>radio value<span class="hl opt">=</span>partnumber <span class="hl kwb">$sortby</span><span class="hl opt">{</span>partnumber<span class="hl opt">}&gt;</span></li>
<li id="n_1189" class="hl">    <span class="hl opt">|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Number&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|</span></li>
<li id="n_1190" class="hl">    <span class="hl opt">&lt;</span>input name<span class="hl opt">=</span>sortby type<span class="hl opt">=</span>radio <span class="hl kwa">class</span><span class="hl opt">=</span>radio value<span class="hl opt">=</span>description <span class="hl kwb">$sortby</span><span class="hl opt">{</span>description<span class="hl opt">}&gt;</span></li>
<li id="n_1191" class="hl">    <span class="hl opt">|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Description&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|</span></li>
<li id="n_1192" class="hl">    <span class="hl opt">&lt;</span>input name<span class="hl opt">=</span>sortby type<span class="hl opt">=</span>radio <span class="hl kwa">class</span><span class="hl opt">=</span>radio value<span class="hl opt">=</span>bin <span class="hl kwb">$sortby</span><span class="hl opt">{</span>bin<span class="hl opt">}&gt;</span></li>
<li id="n_1193" class="hl">    <span class="hl opt">|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Bin&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|</span></li>
<li id="n_1194" class="hl">    <span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1195" class="hl">    </li>
<li id="n_1196" class="hl">  <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1197" class="hl"><span class="hl opt">&lt;/</span>table<span class="hl opt">&gt;</span></li>
<li id="n_1198" class="hl"><span class="hl opt">|;</span></li>
<li id="n_1199" class="hl"></li>
<li id="n_1200" class="hl"><span class="hl opt">}</span></li>
<li id="n_1201" class="hl"></li>
<li id="n_1202" class="hl"></li>
<li id="n_1203" class="hl"></li>
<li id="n_1204" class="hl"><span class="hl kwa">sub </span><span class="hl kwc">print </span><span class="hl opt">{</span></li>
<li id="n_1205" class="hl"></li>
<li id="n_1206" class="hl">  <span class="hl slc"># if this goes to the printer pass through</span></li>
<li id="n_1207" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>media<span class="hl opt">} !~ </span><span class="hl kwd">/(screen|email)/</span><span class="hl opt">) {</span></li>
<li id="n_1208" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">error</span><span class="hl opt">(</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Select txt, postscript or PDF!&#39;</span><span class="hl opt">)) </span><span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>format<span class="hl opt">} !~ </span><span class="hl kwd">/(txt|postscript|pdf)/</span><span class="hl opt">);</span></li>
<li id="n_1209" class="hl"></li>
<li id="n_1210" class="hl">    <span class="hl kwb">$old_form </span><span class="hl opt">= </span>new Form<span class="hl opt">;</span></li>
<li id="n_1211" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwc">keys </span><span class="hl kwb">%$form</span><span class="hl opt">) { </span><span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} }</span></li>
<li id="n_1212" class="hl">    </li>
<li id="n_1213" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1214" class="hl">   </li>
<li id="n_1215" class="hl">  <span class="hl opt">&amp;</span>print_form<span class="hl opt">(</span><span class="hl kwb">$old_form</span><span class="hl opt">);</span></li>
<li id="n_1216" class="hl"></li>
<li id="n_1217" class="hl"><span class="hl opt">}</span></li>
<li id="n_1218" class="hl"></li>
<li id="n_1219" class="hl"></li>
<li id="n_1220" class="hl"><span class="hl kwa">sub </span>print_form <span class="hl opt">{</span></li>
<li id="n_1221" class="hl">  <span class="hl kwc">my </span><span class="hl opt">(</span><span class="hl kwb">$old_form</span><span class="hl opt">) = </span><span class="hl kwb">&#64;_</span><span class="hl opt">;</span></li>
<li id="n_1222" class="hl"></li>
<li id="n_1223" class="hl">  <span class="hl kwb">$inv </span><span class="hl opt">= </span><span class="hl sng">&quot;inv&quot;</span><span class="hl opt">;</span></li>
<li id="n_1224" class="hl">  <span class="hl kwb">$due </span><span class="hl opt">= </span><span class="hl sng">&quot;due&quot;</span><span class="hl opt">;</span></li>
<li id="n_1225" class="hl"></li>
<li id="n_1226" class="hl">  <span class="hl kwb">$numberfld </span><span class="hl opt">= </span><span class="hl sng">&quot;sinumber&quot;</span><span class="hl opt">;</span></li>
<li id="n_1227" class="hl"></li>
<li id="n_1228" class="hl">  <span class="hl kwb">$display_form </span><span class="hl opt">= (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>display_form<span class="hl opt">}) ? </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>display_form<span class="hl opt">} : </span><span class="hl sng">&quot;display_form&quot;</span><span class="hl opt">;</span></li>
<li id="n_1229" class="hl"></li>
<li id="n_1230" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&quot;invoice&quot;</span><span class="hl opt">) {</span></li>
<li id="n_1231" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>label<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Invoice&#39;</span><span class="hl opt">);</span></li>
<li id="n_1232" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1233" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;sales_order&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1234" class="hl">    <span class="hl kwb">$inv </span><span class="hl opt">= </span><span class="hl sng">&quot;ord&quot;</span><span class="hl opt">;</span></li>
<li id="n_1235" class="hl">    <span class="hl kwb">$due </span><span class="hl opt">= </span><span class="hl sng">&quot;req&quot;</span><span class="hl opt">;</span></li>
<li id="n_1236" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>label<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Sales Order&#39;</span><span class="hl opt">);</span></li>
<li id="n_1237" class="hl">    <span class="hl kwb">$numberfld </span><span class="hl opt">= </span><span class="hl sng">&quot;sonumber&quot;</span><span class="hl opt">;</span></li>
<li id="n_1238" class="hl">    <span class="hl kwb">$order </span><span class="hl opt">= </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_1239" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1240" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;work_order&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1241" class="hl">    <span class="hl kwb">$inv </span><span class="hl opt">= </span><span class="hl sng">&quot;ord&quot;</span><span class="hl opt">;</span></li>
<li id="n_1242" class="hl">    <span class="hl kwb">$due </span><span class="hl opt">= </span><span class="hl sng">&quot;req&quot;</span><span class="hl opt">;</span></li>
<li id="n_1243" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>label<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Work Order&#39;</span><span class="hl opt">);</span></li>
<li id="n_1244" class="hl">    <span class="hl kwb">$numberfld </span><span class="hl opt">= </span><span class="hl sng">&quot;sonumber&quot;</span><span class="hl opt">;</span></li>
<li id="n_1245" class="hl">    <span class="hl kwb">$order </span><span class="hl opt">= </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_1246" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1247" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;packing_list&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1248" class="hl">    <span class="hl slc"># we use the same packing list as from an invoice</span></li>
<li id="n_1249" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>label<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Packing List&#39;</span><span class="hl opt">);</span></li>
<li id="n_1250" class="hl"></li>
<li id="n_1251" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>type<span class="hl opt">} </span><span class="hl kwc">ne </span><span class="hl sng">&#39;invoice&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1252" class="hl">      <span class="hl kwb">$inv </span><span class="hl opt">= </span><span class="hl sng">&quot;ord&quot;</span><span class="hl opt">;</span></li>
<li id="n_1253" class="hl">      <span class="hl kwb">$due </span><span class="hl opt">= </span><span class="hl sng">&quot;req&quot;</span><span class="hl opt">;</span></li>
<li id="n_1254" class="hl">      <span class="hl kwb">$numberfld </span><span class="hl opt">= </span><span class="hl sng">&quot;sonumber&quot;</span><span class="hl opt">;</span></li>
<li id="n_1255" class="hl">      <span class="hl kwb">$order </span><span class="hl opt">= </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_1256" class="hl"></li>
<li id="n_1257" class="hl">      <span class="hl kwb">$filled </span><span class="hl opt">= </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_1258" class="hl">      <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwb">$i </span><span class="hl opt">= </span><span class="hl num">1</span><span class="hl opt">; </span><span class="hl kwb">$i </span><span class="hl opt">&lt; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">}; </span><span class="hl kwb">$i++</span><span class="hl opt">) {</span></li>
<li id="n_1259" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;ship_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}) {</span></li>
<li id="n_1260" class="hl">      <span class="hl kwb">$filled </span><span class="hl opt">= </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_1261" class="hl">      <span class="hl kwa">last</span><span class="hl opt">;</span></li>
<li id="n_1262" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1263" class="hl">      <span class="hl opt">}</span></li>
<li id="n_1264" class="hl">      <span class="hl kwa">if </span><span class="hl opt">(!</span><span class="hl kwb">$filled</span><span class="hl opt">) {</span></li>
<li id="n_1265" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">}) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;ship_</span><span class="hl ipl">$_</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;qty_</span><span class="hl ipl">$_</span><span class="hl sng">&quot;</span><span class="hl opt">} }</span></li>
<li id="n_1266" class="hl">      <span class="hl opt">}</span></li>
<li id="n_1267" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1268" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1269" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;pick_list&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1270" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>label<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Pick List&#39;</span><span class="hl opt">);</span></li>
<li id="n_1271" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>type<span class="hl opt">} </span><span class="hl kwc">ne </span><span class="hl sng">&#39;invoice&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1272" class="hl">      <span class="hl kwb">$inv </span><span class="hl opt">= </span><span class="hl sng">&quot;ord&quot;</span><span class="hl opt">;</span></li>
<li id="n_1273" class="hl">      <span class="hl kwb">$due </span><span class="hl opt">= </span><span class="hl sng">&quot;req&quot;</span><span class="hl opt">;</span></li>
<li id="n_1274" class="hl">      <span class="hl kwb">$order </span><span class="hl opt">= </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_1275" class="hl">      <span class="hl kwb">$numberfld </span><span class="hl opt">= </span><span class="hl sng">&quot;sonumber&quot;</span><span class="hl opt">;</span></li>
<li id="n_1276" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1277" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1278" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;purchase_order&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1279" class="hl">    <span class="hl kwb">$inv </span><span class="hl opt">= </span><span class="hl sng">&quot;ord&quot;</span><span class="hl opt">;</span></li>
<li id="n_1280" class="hl">    <span class="hl kwb">$due </span><span class="hl opt">= </span><span class="hl sng">&quot;req&quot;</span><span class="hl opt">;</span></li>
<li id="n_1281" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>label<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Purchase Order&#39;</span><span class="hl opt">);</span></li>
<li id="n_1282" class="hl">    <span class="hl kwb">$numberfld </span><span class="hl opt">= </span><span class="hl sng">&quot;ponumber&quot;</span><span class="hl opt">;</span></li>
<li id="n_1283" class="hl">    <span class="hl kwb">$order </span><span class="hl opt">= </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_1284" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1285" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;bin_list&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1286" class="hl">    <span class="hl kwb">$inv </span><span class="hl opt">= </span><span class="hl sng">&quot;ord&quot;</span><span class="hl opt">;</span></li>
<li id="n_1287" class="hl">    <span class="hl kwb">$due </span><span class="hl opt">= </span><span class="hl sng">&quot;req&quot;</span><span class="hl opt">;</span></li>
<li id="n_1288" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>label<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Bin List&#39;</span><span class="hl opt">);</span></li>
<li id="n_1289" class="hl">    <span class="hl kwb">$numberfld </span><span class="hl opt">= </span><span class="hl sng">&quot;ponumber&quot;</span><span class="hl opt">;</span></li>
<li id="n_1290" class="hl">    <span class="hl kwb">$order </span><span class="hl opt">= </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_1291" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1292" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;sales_quotation&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1293" class="hl">    <span class="hl kwb">$inv </span><span class="hl opt">= </span><span class="hl sng">&quot;quo&quot;</span><span class="hl opt">;</span></li>
<li id="n_1294" class="hl">    <span class="hl kwb">$due </span><span class="hl opt">= </span><span class="hl sng">&quot;req&quot;</span><span class="hl opt">;</span></li>
<li id="n_1295" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>label<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Quotation&#39;</span><span class="hl opt">);</span></li>
<li id="n_1296" class="hl">    <span class="hl kwb">$numberfld </span><span class="hl opt">= </span><span class="hl sng">&quot;sqnumber&quot;</span><span class="hl opt">;</span></li>
<li id="n_1297" class="hl">    <span class="hl kwb">$order </span><span class="hl opt">= </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_1298" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1299" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;request_quotation&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1300" class="hl">    <span class="hl kwb">$inv </span><span class="hl opt">= </span><span class="hl sng">&quot;quo&quot;</span><span class="hl opt">;</span></li>
<li id="n_1301" class="hl">    <span class="hl kwb">$due </span><span class="hl opt">= </span><span class="hl sng">&quot;req&quot;</span><span class="hl opt">;</span></li>
<li id="n_1302" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>label<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Quotation&#39;</span><span class="hl opt">);</span></li>
<li id="n_1303" class="hl">    <span class="hl kwb">$numberfld </span><span class="hl opt">= </span><span class="hl sng">&quot;rfqnumber&quot;</span><span class="hl opt">;</span></li>
<li id="n_1304" class="hl">    <span class="hl kwb">$order </span><span class="hl opt">= </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_1305" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1306" class="hl"></li>
<li id="n_1307" class="hl">  <span class="hl opt">&amp;</span>validate_items<span class="hl opt">;</span></li>
<li id="n_1308" class="hl"> </li>
<li id="n_1309" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${inv}date&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>transdate<span class="hl opt">};</span></li>
<li id="n_1310" class="hl"></li>
<li id="n_1311" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">isblank</span><span class="hl opt">(</span><span class="hl sng">&quot;email&quot;</span><span class="hl opt">, </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;E-mail address missing!&#39;</span><span class="hl opt">)) </span><span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>media<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;email&#39;</span><span class="hl opt">);</span></li>
<li id="n_1312" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">isblank</span><span class="hl opt">(</span><span class="hl sng">&quot;${inv}date&quot;</span><span class="hl opt">, </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>label<span class="hl opt">} .</span><span class="hl sng">&#39; Date missing!&#39;</span><span class="hl opt">));</span></li>
<li id="n_1313" class="hl"></li>
<li id="n_1314" class="hl">  <span class="hl slc"># get next number</span></li>
<li id="n_1315" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(! </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${inv}number&quot;</span><span class="hl opt">}) {</span></li>
<li id="n_1316" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${inv}number&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">update_defaults</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$numberfld</span><span class="hl opt">);</span></li>
<li id="n_1317" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>media<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;screen&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1318" class="hl">      <span class="hl opt">&amp;</span>update<span class="hl opt">;</span></li>
<li id="n_1319" class="hl">      <span class="hl kwa">exit</span><span class="hl opt">;</span></li>
<li id="n_1320" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1321" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1322" class="hl"></li>
<li id="n_1323" class="hl"></li>
<li id="n_1324" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Invoice Number missing!&#39;)</span></li>
<li id="n_1325" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Invoice Date missing!&#39;)</span></li>
<li id="n_1326" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Packing List Number missing!&#39;)</span></li>
<li id="n_1327" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Packing List Date missing!&#39;)</span></li>
<li id="n_1328" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Order Number missing!&#39;)</span></li>
<li id="n_1329" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Order Date missing!&#39;)</span></li>
<li id="n_1330" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Quotation Number missing!&#39;)</span></li>
<li id="n_1331" class="hl"><span class="hl slc"># $locale-&gt;text(&#39;Quotation Date missing!&#39;)</span></li>
<li id="n_1332" class="hl"></li>
<li id="n_1333" class="hl">  <span class="hl opt">&amp;{ </span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{vc}_details&quot;</span> <span class="hl opt">};</span></li>
<li id="n_1334" class="hl"></li>
<li id="n_1335" class="hl">  <span class="hl kwb">&#64;a </span><span class="hl opt">= ();</span></li>
<li id="n_1336" class="hl">  <span class="hl kwa">foreach </span><span class="hl kwb">$i </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">}) {</span></li>
<li id="n_1337" class="hl">    <span class="hl kwc">push </span><span class="hl kwb">&#64;a</span><span class="hl opt">, (</span><span class="hl sng">&quot;partnumber_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;description_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;projectnumber_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;partsgroup_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;serialnumber_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;bin_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;unit_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;notes_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">);</span></li>
<li id="n_1338" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1339" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwc">split </span><span class="hl kwd">/ /</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>taxaccounts<span class="hl opt">}) { </span><span class="hl kwc">push </span><span class="hl kwb">&#64;a</span><span class="hl opt">, </span><span class="hl sng">&quot;${_}_description&quot;</span> <span class="hl opt">}</span></li>
<li id="n_1340" class="hl"></li>
<li id="n_1341" class="hl">  <span class="hl kwb">$ARAP </span><span class="hl opt">= (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>vc<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;customer&#39;</span><span class="hl opt">) ? </span><span class="hl sng">&quot;AR&quot;</span> <span class="hl opt">: </span><span class="hl sng">&quot;AP&quot;</span><span class="hl opt">;</span></li>
<li id="n_1342" class="hl">  <span class="hl kwc">push </span><span class="hl kwb">&#64;a</span><span class="hl opt">, </span><span class="hl kwb">$ARAP</span><span class="hl opt">;</span></li>
<li id="n_1343" class="hl">  </li>
<li id="n_1344" class="hl">  <span class="hl slc"># format payment dates</span></li>
<li id="n_1345" class="hl">  <span class="hl kwa">for </span><span class="hl kwb">$i </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>paidaccounts<span class="hl opt">} - </span><span class="hl num">1</span><span class="hl opt">) {</span></li>
<li id="n_1346" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">exists </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>longformat<span class="hl opt">}) {</span></li>
<li id="n_1347" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;datepaid_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">date</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;datepaid_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>longformat<span class="hl opt">});</span></li>
<li id="n_1348" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1349" class="hl">    </li>
<li id="n_1350" class="hl">    <span class="hl kwc">push </span><span class="hl kwb">&#64;a</span><span class="hl opt">, </span><span class="hl sng">&quot;${ARAP}_paid_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;source_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;memo_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">;</span></li>
<li id="n_1351" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1352" class="hl">  </li>
<li id="n_1353" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">format_string</span><span class="hl opt">(</span><span class="hl kwb">&#64;a</span><span class="hl opt">);</span></li>
<li id="n_1354" class="hl">  </li>
<li id="n_1355" class="hl">  <span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>employee<span class="hl opt">}) = </span><span class="hl kwc">split </span><span class="hl kwd">/--/</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>employee<span class="hl opt">};</span></li>
<li id="n_1356" class="hl">  <span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>warehouse<span class="hl opt">}, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>warehouse_id<span class="hl opt">}) = </span><span class="hl kwc">split </span><span class="hl kwd">/--/</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>warehouse<span class="hl opt">};</span></li>
<li id="n_1357" class="hl">  </li>
<li id="n_1358" class="hl">  <span class="hl slc"># this is a label for the subtotals</span></li>
<li id="n_1359" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>groupsubtotaldescription<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Subtotal&#39;</span><span class="hl opt">) </span><span class="hl kwa">if </span><span class="hl kwc">not exists </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>groupsubtotaldescription<span class="hl opt">};</span></li>
<li id="n_1360" class="hl">  <span class="hl kwc">delete </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>groupsubtotaldescription<span class="hl opt">} </span><span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>deletegroupsubtotal<span class="hl opt">};</span></li>
<li id="n_1361" class="hl"></li>
<li id="n_1362" class="hl">  <span class="hl kwb">$duedate </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${due}date&quot;</span><span class="hl opt">};</span></li>
<li id="n_1363" class="hl">  </li>
<li id="n_1364" class="hl">  <span class="hl slc"># create the form variables</span></li>
<li id="n_1365" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$order</span><span class="hl opt">) {</span></li>
<li id="n_1366" class="hl">    OE-<span class="hl opt">&gt;</span><span class="hl kwd">order_details</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span>\<span class="hl kwb">%$form</span><span class="hl opt">);</span></li>
<li id="n_1367" class="hl">  <span class="hl opt">} </span><span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_1368" class="hl">    IS-<span class="hl opt">&gt;</span><span class="hl kwd">invoice_details</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span>\<span class="hl kwb">%$form</span><span class="hl opt">);</span></li>
<li id="n_1369" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1370" class="hl"></li>
<li id="n_1371" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">exists </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>longformat<span class="hl opt">}) {</span></li>
<li id="n_1372" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${due}date&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$duedate</span><span class="hl opt">;</span></li>
<li id="n_1373" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">&quot;${inv}date&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;${due}date&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;shippingdate&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;transdate&quot;</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">date</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">}, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>longformat<span class="hl opt">}) }</span></li>
<li id="n_1374" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1375" class="hl">  </li>
<li id="n_1376" class="hl">  <span class="hl kwb">&#64;a </span><span class="hl opt">= </span><span class="hl sng">qw(name address1 address2 city state zipcode country contact phone fax email)</span><span class="hl opt">;</span></li>
<li id="n_1377" class="hl"> </li>
<li id="n_1378" class="hl">  <span class="hl kwb">$shipto </span><span class="hl opt">= </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_1379" class="hl">  <span class="hl slc"># if there is no shipto fill it in from billto</span></li>
<li id="n_1380" class="hl">  <span class="hl kwa">foreach </span><span class="hl kwb">$item </span><span class="hl opt">(</span><span class="hl kwb">&#64;a</span><span class="hl opt">) {</span></li>
<li id="n_1381" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;shipto</span><span class="hl ipl">$item</span><span class="hl sng">&quot;</span><span class="hl opt">}) {</span></li>
<li id="n_1382" class="hl">      <span class="hl kwb">$shipto </span><span class="hl opt">= </span><span class="hl num">0</span><span class="hl opt">;</span></li>
<li id="n_1383" class="hl">      <span class="hl kwa">last</span><span class="hl opt">;</span></li>
<li id="n_1384" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1385" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1386" class="hl"></li>
<li id="n_1387" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$shipto</span><span class="hl opt">) {</span></li>
<li id="n_1388" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;purchase_order&#39;</span> <span class="hl opt">|| </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;request_quotation&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1389" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>shiptoname<span class="hl opt">} = </span><span class="hl kwb">$myconfig</span><span class="hl opt">{</span>company<span class="hl opt">};</span></li>
<li id="n_1390" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>shiptoaddress1<span class="hl opt">} = </span><span class="hl kwb">$myconfig</span><span class="hl opt">{</span>address<span class="hl opt">};</span></li>
<li id="n_1391" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>shiptoaddress1<span class="hl opt">} =~ </span><span class="hl kwd">s/\\n/\n/g</span><span class="hl opt">;</span></li>
<li id="n_1392" class="hl">    <span class="hl opt">} </span><span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_1393" class="hl">      <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">} !~ </span><span class="hl kwd">/bin_list/</span><span class="hl opt">) {</span></li>
<li id="n_1394" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwb">&#64;a</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;shipto</span><span class="hl ipl">$_</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} }</span></li>
<li id="n_1395" class="hl">      <span class="hl opt">}</span></li>
<li id="n_1396" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1397" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1398" class="hl"></li>
<li id="n_1399" class="hl">  <span class="hl slc"># some of the stuff could have umlauts so we translate them</span></li>
<li id="n_1400" class="hl">  <span class="hl kwc">push </span><span class="hl kwb">&#64;a</span><span class="hl opt">, </span><span class="hl sng">qw(contact shiptoname shiptoaddress1 shiptoaddress2 shiptocity shiptostate shiptozipcode shiptocountry shiptocontact shiptoemail shippingpoint shipvia notes intnotes employee warehouse)</span><span class="hl opt">;</span></li>
<li id="n_1401" class="hl"></li>
<li id="n_1402" class="hl">  <span class="hl kwc">push </span><span class="hl kwb">&#64;a</span><span class="hl opt">, (</span><span class="hl sng">&quot;${inv}number&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;${inv}date&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;${due}date&quot;</span><span class="hl opt">);</span></li>
<li id="n_1403" class="hl">  </li>
<li id="n_1404" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(company address tel fax businessnumber)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$myconfig</span><span class="hl opt">{</span><span class="hl kwb">$_</span><span class="hl opt">} }</span></li>
<li id="n_1405" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>address<span class="hl opt">} =~ </span><span class="hl kwd">s/\\n/\n/g</span><span class="hl opt">;</span></li>
<li id="n_1406" class="hl"></li>
<li id="n_1407" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(name email)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;user</span><span class="hl ipl">$_</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$myconfig</span><span class="hl opt">{</span><span class="hl kwb">$_</span><span class="hl opt">} }</span></li>
<li id="n_1408" class="hl"></li>
<li id="n_1409" class="hl">  <span class="hl kwc">push </span><span class="hl kwb">&#64;a</span><span class="hl opt">, </span><span class="hl sng">qw(company address tel fax businessnumber username useremail)</span><span class="hl opt">;</span></li>
<li id="n_1410" class="hl"></li>
<li id="n_1411" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(notes intnotes)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} =~ </span><span class="hl kwd">s/^\s+//g </span><span class="hl opt">}</span></li>
<li id="n_1412" class="hl">  </li>
<li id="n_1413" class="hl">  <span class="hl slc"># before we format replace &lt;%var%&gt;</span></li>
<li id="n_1414" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(notes intnotes message)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} =~ </span><span class="hl kwd">s/&lt;%(.*?)%&gt;/$form-&gt;{$1}/g </span><span class="hl opt">}</span></li>
<li id="n_1415" class="hl"></li>
<li id="n_1416" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">format_string</span><span class="hl opt">(</span><span class="hl kwb">&#64;a</span><span class="hl opt">);</span></li>
<li id="n_1417" class="hl"></li>
<li id="n_1418" class="hl"></li>
<li id="n_1419" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>templates<span class="hl opt">} = </span><span class="hl sng">&quot;</span><span class="hl ipl">$myconfig</span><span class="hl sng">{templates}&quot;</span><span class="hl opt">;</span></li>
<li id="n_1420" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>IN<span class="hl opt">} = </span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{formname}.</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{format}&quot;</span><span class="hl opt">;</span></li>
<li id="n_1421" class="hl"></li>
<li id="n_1422" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>format<span class="hl opt">} =~ </span><span class="hl kwd">/(postscript|pdf)/</span><span class="hl opt">) {</span></li>
<li id="n_1423" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>IN<span class="hl opt">} =~ </span><span class="hl kwd">s/$&amp;$/tex/</span><span class="hl opt">;</span></li>
<li id="n_1424" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1425" class="hl"></li>
<li id="n_1426" class="hl"></li>
<li id="n_1427" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>pre<span class="hl opt">} = </span><span class="hl sng">&quot;&lt;body bgcolor=#ffffff&gt;</span><span class="hl esc">\n</span><span class="hl sng">&lt;pre&gt;&quot;</span> <span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>format<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;txt&#39;</span><span class="hl opt">;</span></li>
<li id="n_1428" class="hl"></li>
<li id="n_1429" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>media<span class="hl opt">} !~ </span><span class="hl kwd">/(screen|queue|email)/</span><span class="hl opt">) {</span></li>
<li id="n_1430" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>OUT<span class="hl opt">} = </span><span class="hl sng">&quot;| ${LedgerSMB::SysConfig::printer}{</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{media}}&quot;</span><span class="hl opt">;</span></li>
<li id="n_1431" class="hl">    </li>
<li id="n_1432" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>OUT<span class="hl opt">} =~ </span><span class="hl kwd">s/&lt;%(fax)%&gt;/&lt;%$form-&gt;{vc}$1%&gt;/</span><span class="hl opt">;</span></li>
<li id="n_1433" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>OUT<span class="hl opt">} =~ </span><span class="hl kwd">s/&lt;%(.*?)%&gt;/$form-&gt;{$1}/g</span><span class="hl opt">;</span></li>
<li id="n_1434" class="hl"></li>
<li id="n_1435" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>printed<span class="hl opt">} !~ </span><span class="hl kwd">/$form-&gt;{formname}/</span><span class="hl opt">) {</span></li>
<li id="n_1436" class="hl">    </li>
<li id="n_1437" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>printed<span class="hl opt">} .= </span><span class="hl sng">&quot; </span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{formname}&quot;</span><span class="hl opt">;</span></li>
<li id="n_1438" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>printed<span class="hl opt">} =~ </span><span class="hl kwd">s/^ //</span><span class="hl opt">;</span></li>
<li id="n_1439" class="hl"></li>
<li id="n_1440" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">update_status</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">);</span></li>
<li id="n_1441" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1442" class="hl"></li>
<li id="n_1443" class="hl">    <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>printed<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>printed<span class="hl opt">} </span><span class="hl kwa">if </span><span class="hl kwc">defined </span><span class="hl kwb">%$old_form</span><span class="hl opt">;</span></li>
<li id="n_1444" class="hl"></li>
<li id="n_1445" class="hl">    <span class="hl kwb">%audittrail </span><span class="hl opt">= ( </span>tablename   <span class="hl opt">=&gt; (</span><span class="hl kwb">$order</span><span class="hl opt">) ? </span><span class="hl sng">&#39;oe&#39;</span> <span class="hl opt">: </span><span class="hl kwc">lc </span><span class="hl kwb">$ARAP</span><span class="hl opt">,</span></li>
<li id="n_1446" class="hl">                    reference   <span class="hl opt">=&gt; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${inv}number&quot;</span><span class="hl opt">},</span></li>
<li id="n_1447" class="hl">            formname    <span class="hl opt">=&gt; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">},</span></li>
<li id="n_1448" class="hl">            action  <span class="hl opt">=&gt; </span><span class="hl sng">&#39;printed&#39;</span><span class="hl opt">,</span></li>
<li id="n_1449" class="hl">            id      <span class="hl opt">=&gt; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>id<span class="hl opt">} );</span></li>
<li id="n_1450" class="hl"> </li>
<li id="n_1451" class="hl">    <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>audittrail<span class="hl opt">} .= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">audittrail</span><span class="hl opt">(</span><span class="hl sng">&quot;&quot;</span><span class="hl opt">, </span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span>\<span class="hl kwb">%audittrail</span><span class="hl opt">) </span><span class="hl kwa">if </span><span class="hl kwc">defined </span><span class="hl kwb">%$old_form</span><span class="hl opt">;</span></li>
<li id="n_1452" class="hl">    </li>
<li id="n_1453" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1454" class="hl"></li>
<li id="n_1455" class="hl"></li>
<li id="n_1456" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>media<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;email&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1457" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>subject<span class="hl opt">} = </span>qq<span class="hl opt">|</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>label<span class="hl opt">} </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${inv}number&quot;</span><span class="hl opt">}| </span><span class="hl kwa">unless </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>subject<span class="hl opt">};</span></li>
<li id="n_1458" class="hl"></li>
<li id="n_1459" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>plainpaper<span class="hl opt">} = </span><span class="hl num">1</span><span class="hl opt">;</span></li>
<li id="n_1460" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>OUT<span class="hl opt">} = </span><span class="hl sng">&quot;${LedgerSMB::Sysconfig::sendmail}&quot;</span><span class="hl opt">;</span></li>
<li id="n_1461" class="hl"></li>
<li id="n_1462" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>emailed<span class="hl opt">} !~ </span><span class="hl kwd">/$form-&gt;{formname}/</span><span class="hl opt">) {</span></li>
<li id="n_1463" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>emailed<span class="hl opt">} .= </span><span class="hl sng">&quot; </span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{formname}&quot;</span><span class="hl opt">;</span></li>
<li id="n_1464" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>emailed<span class="hl opt">} =~ </span><span class="hl kwd">s/^ //</span><span class="hl opt">;</span></li>
<li id="n_1465" class="hl"></li>
<li id="n_1466" class="hl">      <span class="hl slc"># save status</span></li>
<li id="n_1467" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">update_status</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">);</span></li>
<li id="n_1468" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1469" class="hl"></li>
<li id="n_1470" class="hl">    <span class="hl kwb">$now </span><span class="hl opt">= </span><span class="hl kwc">scalar localtime</span><span class="hl opt">;</span></li>
<li id="n_1471" class="hl">    <span class="hl kwb">$cc </span><span class="hl opt">= </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Cc: [_1]&#39;</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>cc<span class="hl opt">}).</span>qq<span class="hl opt">|</span><span class="hl esc">\n</span><span class="hl opt">| </span><span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>cc<span class="hl opt">};</span></li>
<li id="n_1472" class="hl">    <span class="hl kwb">$bcc </span><span class="hl opt">= </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Bcc: [_1]&#39;</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>bcc<span class="hl opt">}).</span>qq<span class="hl opt">|</span><span class="hl esc">\n</span><span class="hl opt">| </span><span class="hl kwa">if </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>bcc<span class="hl opt">};</span></li>
<li id="n_1473" class="hl">    </li>
<li id="n_1474" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">defined </span><span class="hl kwb">%$old_form</span><span class="hl opt">) {</span></li>
<li id="n_1475" class="hl">      <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>intnotes<span class="hl opt">} = </span>qq<span class="hl opt">|</span><span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>intnotes<span class="hl opt">}</span><span class="hl esc">\n\n</span><span class="hl opt">| </span><span class="hl kwa">if </span><span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>intnotes<span class="hl opt">};</span></li>
<li id="n_1476" class="hl">      <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>intnotes<span class="hl opt">} .= </span>qq<span class="hl opt">|[</span>email<span class="hl opt">]</span><span class="hl esc">\n</span><span class="hl opt">|</span></li>
<li id="n_1477" class="hl">      <span class="hl opt">.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Date: [_1]&#39;</span><span class="hl opt">, </span><span class="hl kwb">$now</span><span class="hl opt">).</span>qq<span class="hl opt">|</span><span class="hl esc">\n</span><span class="hl opt">|</span></li>
<li id="n_1478" class="hl">      <span class="hl opt">.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;To: [_1]</span><span class="hl esc">\n</span><span class="hl sng">[_2][_3]&#39;</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>email<span class="hl opt">}, ${</span>cc<span class="hl opt">}, ${</span>bcc<span class="hl opt">})</span></li>
<li id="n_1479" class="hl">      <span class="hl opt">.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Subject: [_1]&#39;</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>subject<span class="hl opt">}).</span>qq<span class="hl opt">|</span><span class="hl esc">\n</span><span class="hl opt">|;</span></li>
<li id="n_1480" class="hl"></li>
<li id="n_1481" class="hl">      <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>intnotes<span class="hl opt">} .= </span>qq<span class="hl opt">|</span><span class="hl esc">\n</span><span class="hl opt">|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Message&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|: |;</span></li>
<li id="n_1482" class="hl">      <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>intnotes<span class="hl opt">} .= (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>message<span class="hl opt">}) ? </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>message<span class="hl opt">} : </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;sent&#39;</span><span class="hl opt">);</span></li>
<li id="n_1483" class="hl"></li>
<li id="n_1484" class="hl">      <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>message<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>message<span class="hl opt">};</span></li>
<li id="n_1485" class="hl">      <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>emailed<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>emailed<span class="hl opt">};</span></li>
<li id="n_1486" class="hl"></li>
<li id="n_1487" class="hl">      <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>format<span class="hl opt">} = </span><span class="hl sng">&quot;postscript&quot;</span> <span class="hl kwa">if </span><span class="hl kwb">$myconfig</span><span class="hl opt">{</span>printer<span class="hl opt">};</span></li>
<li id="n_1488" class="hl">      <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>media<span class="hl opt">} = </span><span class="hl kwb">$myconfig</span><span class="hl opt">{</span>printer<span class="hl opt">};</span></li>
<li id="n_1489" class="hl"></li>
<li id="n_1490" class="hl">      <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;</span><span class="hl kwd">save_intnotes</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, (</span><span class="hl kwb">$order</span><span class="hl opt">) ? </span><span class="hl sng">&#39;oe&#39;</span> <span class="hl opt">: </span><span class="hl kwc">lc </span><span class="hl kwb">$ARAP</span><span class="hl opt">);</span></li>
<li id="n_1491" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1492" class="hl">    </li>
<li id="n_1493" class="hl">    <span class="hl kwb">%audittrail </span><span class="hl opt">= ( </span>tablename   <span class="hl opt">=&gt; (</span><span class="hl kwb">$order</span><span class="hl opt">) ? </span><span class="hl sng">&#39;oe&#39;</span> <span class="hl opt">: </span><span class="hl kwc">lc </span><span class="hl kwb">$ARAP</span><span class="hl opt">,</span></li>
<li id="n_1494" class="hl">                    reference   <span class="hl opt">=&gt; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${inv}number&quot;</span><span class="hl opt">},</span></li>
<li id="n_1495" class="hl">            formname    <span class="hl opt">=&gt; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">},</span></li>
<li id="n_1496" class="hl">            action  <span class="hl opt">=&gt; </span><span class="hl sng">&#39;emailed&#39;</span><span class="hl opt">,</span></li>
<li id="n_1497" class="hl">            id      <span class="hl opt">=&gt; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>id<span class="hl opt">} );</span></li>
<li id="n_1498" class="hl"> </li>
<li id="n_1499" class="hl">    <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>audittrail<span class="hl opt">} .= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">audittrail</span><span class="hl opt">(</span><span class="hl sng">&quot;&quot;</span><span class="hl opt">, </span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span>\<span class="hl kwb">%audittrail</span><span class="hl opt">) </span><span class="hl kwa">if </span><span class="hl kwc">defined </span><span class="hl kwb">%$old_form</span><span class="hl opt">;</span></li>
<li id="n_1500" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1501" class="hl"></li>
<li id="n_1502" class="hl"></li>
<li id="n_1503" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>media<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;queue&#39;</span><span class="hl opt">) {</span></li>
<li id="n_1504" class="hl">    <span class="hl kwb">%queued </span><span class="hl opt">= </span><span class="hl kwc">split </span><span class="hl kwd">/ /</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>queued<span class="hl opt">};</span></li>
<li id="n_1505" class="hl"></li>
<li id="n_1506" class="hl">    <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwb">$filename </span><span class="hl opt">= </span><span class="hl kwb">$queued</span><span class="hl opt">{</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">}}) {</span></li>
<li id="n_1507" class="hl">      <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>queued<span class="hl opt">} =~ </span><span class="hl kwd">s/$form-&gt;{formname} $filename//</span><span class="hl opt">;</span></li>
<li id="n_1508" class="hl">      <span class="hl kwc">unlink </span><span class="hl sng">&quot;${LedgerSMB::Sysconfig::spool}/</span><span class="hl ipl">$filename</span><span class="hl sng">&quot;</span><span class="hl opt">;</span></li>
<li id="n_1509" class="hl">      <span class="hl kwb">$filename </span><span class="hl opt">=~ </span><span class="hl kwd">s/\..*$//g</span><span class="hl opt">;</span></li>
<li id="n_1510" class="hl">    <span class="hl opt">} </span><span class="hl kwa">else </span><span class="hl opt">{</span></li>
<li id="n_1511" class="hl">      <span class="hl kwb">$filename </span><span class="hl opt">= </span><span class="hl kwc">time</span><span class="hl opt">;</span></li>
<li id="n_1512" class="hl">      <span class="hl kwb">$filename </span><span class="hl opt">.= </span><span class="hl kwb">$$</span><span class="hl opt">;</span></li>
<li id="n_1513" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1514" class="hl"></li>
<li id="n_1515" class="hl">    <span class="hl kwb">$filename </span><span class="hl opt">.= (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>format<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;postscript&#39;</span><span class="hl opt">) ? </span><span class="hl sng">&#39;.ps&#39;</span> <span class="hl opt">: </span><span class="hl sng">&#39;.pdf&#39;</span><span class="hl opt">;</span></li>
<li id="n_1516" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>OUT<span class="hl opt">} = </span><span class="hl sng">&quot;&gt;${LedgerSMB::Sysconfig::spool}/</span><span class="hl ipl">$filename</span><span class="hl sng">&quot;</span><span class="hl opt">;</span></li>
<li id="n_1517" class="hl"></li>
<li id="n_1518" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>queued<span class="hl opt">} .= </span><span class="hl sng">&quot; </span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{formname} </span><span class="hl ipl">$filename</span><span class="hl sng">&quot;</span><span class="hl opt">;</span></li>
<li id="n_1519" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>queued<span class="hl opt">} =~ </span><span class="hl kwd">s/^ //</span><span class="hl opt">;</span></li>
<li id="n_1520" class="hl"></li>
<li id="n_1521" class="hl">    <span class="hl slc"># save status</span></li>
<li id="n_1522" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">update_status</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">);</span></li>
<li id="n_1523" class="hl"></li>
<li id="n_1524" class="hl">    <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>queued<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>queued<span class="hl opt">};</span></li>
<li id="n_1525" class="hl"></li>
<li id="n_1526" class="hl">    <span class="hl kwb">%audittrail </span><span class="hl opt">= ( </span>tablename   <span class="hl opt">=&gt; (</span><span class="hl kwb">$order</span><span class="hl opt">) ? </span><span class="hl sng">&#39;oe&#39;</span> <span class="hl opt">: </span><span class="hl kwc">lc </span><span class="hl kwb">$ARAP</span><span class="hl opt">,</span></li>
<li id="n_1527" class="hl">                    reference   <span class="hl opt">=&gt; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${inv}number&quot;</span><span class="hl opt">},</span></li>
<li id="n_1528" class="hl">            formname    <span class="hl opt">=&gt; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>formname<span class="hl opt">},</span></li>
<li id="n_1529" class="hl">            action      <span class="hl opt">=&gt; </span><span class="hl sng">&#39;queued&#39;</span><span class="hl opt">,</span></li>
<li id="n_1530" class="hl">            id          <span class="hl opt">=&gt; </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>id<span class="hl opt">} );</span></li>
<li id="n_1531" class="hl"></li>
<li id="n_1532" class="hl">    <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span>audittrail<span class="hl opt">} .= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">audittrail</span><span class="hl opt">(</span><span class="hl sng">&quot;&quot;</span><span class="hl opt">, </span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span>\<span class="hl kwb">%audittrail</span><span class="hl opt">);</span></li>
<li id="n_1533" class="hl"></li>
<li id="n_1534" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1535" class="hl"></li>
<li id="n_1536" class="hl"></li>
<li id="n_1537" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">format_string</span><span class="hl opt">(</span><span class="hl sng">&quot;email&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;cc&quot;</span><span class="hl opt">, </span><span class="hl sng">&quot;bcc&quot;</span><span class="hl opt">);</span></li>
<li id="n_1538" class="hl"> </li>
<li id="n_1539" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>fileid<span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${inv}number&quot;</span><span class="hl opt">};</span></li>
<li id="n_1540" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>fileid<span class="hl opt">} =~ </span><span class="hl kwd">s/(\s|\W)+//g</span><span class="hl opt">;</span></li>
<li id="n_1541" class="hl">  </li>
<li id="n_1542" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_template</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, ${</span>LedgerSMB<span class="hl opt">::</span>Sysconfig<span class="hl opt">::</span>userspath<span class="hl opt">});</span></li>
<li id="n_1543" class="hl"></li>
<li id="n_1544" class="hl">  <span class="hl slc"># if we got back here restore the previous form</span></li>
<li id="n_1545" class="hl">  <span class="hl kwa">if </span><span class="hl opt">(</span><span class="hl kwc">defined </span><span class="hl kwb">%$old_form</span><span class="hl opt">) {</span></li>
<li id="n_1546" class="hl">    </li>
<li id="n_1547" class="hl">    <span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${inv}number&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${inv}number&quot;</span><span class="hl opt">};</span></li>
<li id="n_1548" class="hl">    </li>
<li id="n_1549" class="hl">    <span class="hl slc"># restore and display form</span></li>
<li id="n_1550" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl kwc">keys </span><span class="hl kwb">%$old_form</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$old_form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} }</span></li>
<li id="n_1551" class="hl">    <span class="hl kwc">delete </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>pre<span class="hl opt">};</span></li>
<li id="n_1552" class="hl">    </li>
<li id="n_1553" class="hl">    <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">}--;</span></li>
<li id="n_1554" class="hl"></li>
<li id="n_1555" class="hl">    <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(exchangerate creditlimit creditremaining)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">}) }</span></li>
<li id="n_1556" class="hl">    </li>
<li id="n_1557" class="hl">    <span class="hl kwa">for </span><span class="hl kwb">$i </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>paidaccounts<span class="hl opt">}) {</span></li>
<li id="n_1558" class="hl">      <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(paid exchangerate)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;${_}_</span><span class="hl ipl">$i</span><span class="hl sng">&quot;</span><span class="hl opt">}) }</span></li>
<li id="n_1559" class="hl">    <span class="hl opt">}</span></li>
<li id="n_1560" class="hl"></li>
<li id="n_1561" class="hl">    <span class="hl opt">&amp;{ </span><span class="hl sng">&quot;</span><span class="hl ipl">$display_form</span><span class="hl sng">&quot;</span> <span class="hl opt">};</span></li>
<li id="n_1562" class="hl"></li>
<li id="n_1563" class="hl">  <span class="hl opt">}</span></li>
<li id="n_1564" class="hl"></li>
<li id="n_1565" class="hl"><span class="hl opt">}</span></li>
<li id="n_1566" class="hl"></li>
<li id="n_1567" class="hl"></li>
<li id="n_1568" class="hl"><span class="hl kwa">sub </span>customer_details <span class="hl opt">{</span></li>
<li id="n_1569" class="hl"></li>
<li id="n_1570" class="hl">  IS-<span class="hl opt">&gt;</span><span class="hl kwd">customer_details</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span>\<span class="hl kwb">%$form</span><span class="hl opt">);</span></li>
<li id="n_1571" class="hl"></li>
<li id="n_1572" class="hl"><span class="hl opt">}</span></li>
<li id="n_1573" class="hl"></li>
<li id="n_1574" class="hl"></li>
<li id="n_1575" class="hl"><span class="hl kwa">sub </span>vendor_details <span class="hl opt">{</span></li>
<li id="n_1576" class="hl"></li>
<li id="n_1577" class="hl">  IR-<span class="hl opt">&gt;</span><span class="hl kwd">vendor_details</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span>\<span class="hl kwb">%$form</span><span class="hl opt">);</span></li>
<li id="n_1578" class="hl"></li>
<li id="n_1579" class="hl"><span class="hl opt">}</span></li>
<li id="n_1580" class="hl"></li>
<li id="n_1581" class="hl"></li>
<li id="n_1582" class="hl"><span class="hl kwa">sub </span>ship_to <span class="hl opt">{</span></li>
<li id="n_1583" class="hl"></li>
<li id="n_1584" class="hl">  <span class="hl kwb">$title </span><span class="hl opt">= </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>title<span class="hl opt">};</span></li>
<li id="n_1585" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>title<span class="hl opt">} = </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Ship to&#39;</span><span class="hl opt">);</span></li>
<li id="n_1586" class="hl"></li>
<li id="n_1587" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(exchangerate creditlimit creditremaining)</span><span class="hl opt">) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">}) }</span></li>
<li id="n_1588" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl num">1 </span><span class="hl opt">.. </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>paidaccounts<span class="hl opt">}) { </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;paid_</span><span class="hl ipl">$_</span><span class="hl sng">&quot;</span><span class="hl opt">} = </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">parse_amount</span><span class="hl opt">(</span>\<span class="hl kwb">%myconfig</span><span class="hl opt">, </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;paid_</span><span class="hl ipl">$_</span><span class="hl sng">&quot;</span><span class="hl opt">}) }</span></li>
<li id="n_1589" class="hl"></li>
<li id="n_1590" class="hl">  <span class="hl slc"># get details for name</span></li>
<li id="n_1591" class="hl">  <span class="hl opt">&amp;{ </span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{vc}_details&quot;</span> <span class="hl opt">};</span></li>
<li id="n_1592" class="hl"></li>
<li id="n_1593" class="hl">  <span class="hl kwb">$number </span><span class="hl opt">= (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>vc<span class="hl opt">} </span><span class="hl kwc">eq </span><span class="hl sng">&#39;customer&#39;</span><span class="hl opt">) ? </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Customer Number&#39;</span><span class="hl opt">) : </span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Vendor Number&#39;</span><span class="hl opt">);</span></li>
<li id="n_1594" class="hl"></li>
<li id="n_1595" class="hl">  <span class="hl kwb">$nextsub </span><span class="hl opt">= (</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>display_form<span class="hl opt">}) ? </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>display_form<span class="hl opt">} : </span><span class="hl sng">&quot;display_form&quot;</span><span class="hl opt">;</span></li>
<li id="n_1596" class="hl"></li>
<li id="n_1597" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>rowcount<span class="hl opt">}--;</span></li>
<li id="n_1598" class="hl"></li>
<li id="n_1599" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">header</span><span class="hl opt">;</span></li>
<li id="n_1600" class="hl"></li>
<li id="n_1601" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_1602" class="hl"><span class="hl opt">&lt;</span>body<span class="hl opt">&gt;</span></li>
<li id="n_1603" class="hl"></li>
<li id="n_1604" class="hl"><span class="hl opt">&lt;</span>form <span class="hl kwa">method</span><span class="hl opt">=</span>post action<span class="hl opt">=</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>script<span class="hl opt">}&gt;</span></li>
<li id="n_1605" class="hl"></li>
<li id="n_1606" class="hl"><span class="hl opt">&lt;</span>table width<span class="hl opt">=</span><span class="hl num">100</span><span class="hl opt">%&gt;</span></li>
<li id="n_1607" class="hl">  <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1608" class="hl">    <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1609" class="hl">      <span class="hl opt">&lt;</span>table<span class="hl opt">&gt;</span></li>
<li id="n_1610" class="hl">    <span class="hl opt">&lt;</span>tr <span class="hl kwa">class</span><span class="hl opt">=</span>listheading<span class="hl opt">&gt;</span></li>
<li id="n_1611" class="hl">      <span class="hl opt">&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading colspan<span class="hl opt">=</span><span class="hl num">2 </span>width<span class="hl opt">=</span><span class="hl num">50</span><span class="hl opt">%&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Billing Address&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1612" class="hl">      <span class="hl opt">&lt;</span>th <span class="hl kwa">class</span><span class="hl opt">=</span>listheading width<span class="hl opt">=</span><span class="hl num">50</span><span class="hl opt">%&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Shipping Address&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1613" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1614" class="hl">    <span class="hl opt">&lt;</span>tr height<span class="hl opt">=</span><span class="hl sng">&quot;5&quot;</span><span class="hl opt">&gt;&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1615" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1616" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">&gt;</span><span class="hl kwb">$number</span><span class="hl opt">&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1617" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{vc}number&quot;</span><span class="hl opt">}&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1618" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1619" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1620" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Company Name&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1621" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>name<span class="hl opt">}&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1622" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>shiptoname size<span class="hl opt">=</span><span class="hl num">35 </span>maxlength<span class="hl opt">=</span><span class="hl num">64 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{shiptoname}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1623" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1624" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1625" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Address&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1626" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>address1<span class="hl opt">}&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1627" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>shiptoaddress1 size<span class="hl opt">=</span><span class="hl num">35 </span>maxlength<span class="hl opt">=</span><span class="hl num">32 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{shiptoaddress1}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1628" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1629" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1630" class="hl">      <span class="hl opt">&lt;</span>th<span class="hl opt">&gt;&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1631" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>address2<span class="hl opt">}&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1632" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>shiptoaddress2 size<span class="hl opt">=</span><span class="hl num">35 </span>maxlength<span class="hl opt">=</span><span class="hl num">32 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{shiptoaddress2}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1633" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1634" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1635" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;City&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1636" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>city<span class="hl opt">}&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1637" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>shiptocity size<span class="hl opt">=</span><span class="hl num">35 </span>maxlength<span class="hl opt">=</span><span class="hl num">32 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{shiptocity}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1638" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1639" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1640" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;State/Province&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1641" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwc">state</span><span class="hl opt">}&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1642" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>shiptostate size<span class="hl opt">=</span><span class="hl num">35 </span>maxlength<span class="hl opt">=</span><span class="hl num">32 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{shiptostate}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1643" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1644" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1645" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Zip/Postal Code&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1646" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>zipcode<span class="hl opt">}&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1647" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>shiptozipcode size<span class="hl opt">=</span><span class="hl num">10 </span>maxlength<span class="hl opt">=</span><span class="hl num">10 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{shiptozipcode}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1648" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1649" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1650" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Country&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1651" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>country<span class="hl opt">}&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1652" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>shiptocountry size<span class="hl opt">=</span><span class="hl num">35 </span>maxlength<span class="hl opt">=</span><span class="hl num">32 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{shiptocountry}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1653" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1654" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1655" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Contact&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1656" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>contact<span class="hl opt">}&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1657" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>shiptocontact size<span class="hl opt">=</span><span class="hl num">35 </span>maxlength<span class="hl opt">=</span><span class="hl num">64 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{shiptocontact}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1658" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1659" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1660" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Phone&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1661" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{vc}phone&quot;</span><span class="hl opt">}&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1662" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>shiptophone size<span class="hl opt">=</span><span class="hl num">20 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{shiptophone}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1663" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1664" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1665" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Fax&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1666" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{vc}fax&quot;</span><span class="hl opt">}&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1667" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>shiptofax size<span class="hl opt">=</span><span class="hl num">20 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{shiptofax}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1668" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1669" class="hl">    <span class="hl opt">&lt;</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1670" class="hl">      <span class="hl opt">&lt;</span>th align<span class="hl opt">=</span>right nowrap<span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;E-mail&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>th<span class="hl opt">&gt;</span></li>
<li id="n_1671" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;</span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>email<span class="hl opt">}&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1672" class="hl">      <span class="hl opt">&lt;</span>td<span class="hl opt">&gt;&lt;</span>input name<span class="hl opt">=</span>shiptoemail size<span class="hl opt">=</span><span class="hl num">35 </span>value<span class="hl opt">=</span><span class="hl sng">&quot;</span><span class="hl ipl">$form</span><span class="hl sng">-&gt;{shiptoemail}&quot;</span><span class="hl opt">&gt;&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1673" class="hl">    <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1674" class="hl">      <span class="hl opt">&lt;/</span>table<span class="hl opt">&gt;</span></li>
<li id="n_1675" class="hl">    <span class="hl opt">&lt;/</span>td<span class="hl opt">&gt;</span></li>
<li id="n_1676" class="hl">  <span class="hl opt">&lt;/</span>tr<span class="hl opt">&gt;</span></li>
<li id="n_1677" class="hl"><span class="hl opt">&lt;/</span>table<span class="hl opt">&gt;</span></li>
<li id="n_1678" class="hl"></li>
<li id="n_1679" class="hl"><span class="hl opt">&lt;</span>input type<span class="hl opt">=</span>hidden name<span class="hl opt">=</span>nextsub value<span class="hl opt">=</span><span class="hl kwb">$nextsub</span><span class="hl opt">&gt;</span></li>
<li id="n_1680" class="hl"><span class="hl opt">|;</span></li>
<li id="n_1681" class="hl"></li>
<li id="n_1682" class="hl">  <span class="hl slc"># delete shipto</span></li>
<li id="n_1683" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(action nextsub)</span><span class="hl opt">) { </span><span class="hl kwc">delete </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl kwb">$_</span><span class="hl opt">} }</span></li>
<li id="n_1684" class="hl">  <span class="hl kwa">for </span><span class="hl opt">(</span><span class="hl sng">qw(name address1 address2 city state zipcode country contact phone fax email)</span><span class="hl opt">) { </span><span class="hl kwc">delete </span><span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span><span class="hl sng">&quot;shipto</span><span class="hl ipl">$_</span><span class="hl sng">&quot;</span><span class="hl opt">} }</span></li>
<li id="n_1685" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;{</span>title<span class="hl opt">} = </span><span class="hl kwb">$title</span><span class="hl opt">;</span></li>
<li id="n_1686" class="hl">  </li>
<li id="n_1687" class="hl">  <span class="hl kwb">$form</span><span class="hl opt">-&gt;</span><span class="hl kwd">hide_form</span><span class="hl opt">;</span></li>
<li id="n_1688" class="hl"></li>
<li id="n_1689" class="hl">  <span class="hl kwc">print </span>qq<span class="hl opt">|</span></li>
<li id="n_1690" class="hl"></li>
<li id="n_1691" class="hl"><span class="hl opt">&lt;</span>hr size<span class="hl opt">=</span><span class="hl num">3 </span>noshade<span class="hl opt">&gt;</span></li>
<li id="n_1692" class="hl"></li>
<li id="n_1693" class="hl"><span class="hl opt">&lt;</span>br<span class="hl opt">&gt;</span></li>
<li id="n_1694" class="hl"><span class="hl opt">&lt;</span>button <span class="hl kwa">class</span><span class="hl opt">=</span><span class="hl sng">&quot;submit&quot;</span> type<span class="hl opt">=</span><span class="hl sng">&quot;submit&quot;</span> name<span class="hl opt">=</span><span class="hl sng">&quot;action&quot;</span> value<span class="hl opt">=</span><span class="hl sng">&quot;continue&quot;</span><span class="hl opt">&gt;|.</span><span class="hl kwb">$locale</span><span class="hl opt">-&gt;</span><span class="hl kwd">text</span><span class="hl opt">(</span><span class="hl sng">&#39;Continue&#39;</span><span class="hl opt">).</span>qq<span class="hl opt">|&lt;/</span>button<span class="hl opt">&gt;</span></li>
<li id="n_1695" class="hl"><span class="hl opt">&lt;/</span>form<span class="hl opt">&gt;</span></li>
<li id="n_1696" class="hl"></li>
<li id="n_1697" class="hl"><span class="hl opt">&lt;/</span>body<span class="hl opt">&gt;</span></li>
<li id="n_1698" class="hl"><span class="hl opt">&lt;/</span>html<span class="hl opt">&gt;</span></li>
<li id="n_1699" class="hl"><span class="hl opt">|;</span></li>
<li id="n_1700" class="hl"></li>
<li id="n_1701" class="hl"><span class="hl opt">}</span></li>
<li id="n_1702" class="hl"></li>
<li id="n_1703" class="hl"></li>
</ol></code></pre></td></tr></table>
</div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit v1.2.3</a> (<a href='https://git-scm.com/'>git 2.46.0</a>) at 2025-06-30 15:47:05 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>
