summaryrefslogtreecommitdiff
path: root/bin/arapprn.pl
blob: 5eb138d91cfa3d9092af529ab62115b1f8b9cddb (plain)
  1. #=====================================================================
  2. # LedgerSMB Small Medium Business Accounting
  3. # http://www.ledgersmb.org/
  4. #
  5. # Copyright (C) 2006
  6. # This work contains copyrighted information from a number of sources all used
  7. # with permission.
  8. #
  9. # This file contains source code included with or based on SQL-Ledger which
  10. # is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
  11. # under the GNU General Public License version 2 or, at your option, any later
  12. # version. For a full list including contact information of contributors,
  13. # maintainers, and copyright holders, see the CONTRIBUTORS file.
  14. #
  15. # Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
  16. # Copyright (c) 2003
  17. #
  18. # Author: DWS Systems Inc.
  19. # Web: http://www.sql-ledger.org
  20. #
  21. #
  22. # This program is free software; you can redistribute it and/or modify
  23. # it under the terms of the GNU General Public License as published by
  24. # the Free Software Foundation; either version 2 of the License, or
  25. # (at your option) any later version.
  26. #
  27. # This program is distributed in the hope that it will be useful,
  28. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  29. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  30. # GNU General Public License for more details.
  31. # You should have received a copy of the GNU General Public License
  32. # along with this program; if not, write to the Free Software
  33. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  34. #======================================================================
  35. #
  36. # This file has not undergone any whitespace cleanup.
  37. #
  38. # printing routines for ar, ap
  39. #
  40. # any custom scripts for this one
  41. if (-f "bin/custom/arapprn.pl") {
  42. eval { require "bin/custom/arapprn.pl"; };
  43. }
  44. if (-f "bin/custom/$form->{login}_arapprn.pl") {
  45. eval { require "bin/custom/$form->{login}_arapprn.pl"; };
  46. }
  47. 1;
  48. # end of main
  49. sub print {
  50. if ($form->{media} !~ /screen/) {
  51. $form->error($locale->text('Select postscript or PDF!')) if $form->{format} !~ /(postscript|pdf)/;
  52. $old_form = new Form;
  53. for (keys %$form) { $old_form->{$_} = $form->{$_} }
  54. }
  55. if ($form->{formname} =~ /(check|receipt)/) {
  56. if ($form->{media} eq 'screen') {
  57. $form->error($locale->text('Select postscript or PDF!')) if $form->{format} !~ /(postscript|pdf)/;
  58. }
  59. }
  60. if (! $form->{invnumber}) {
  61. $invfld = 'sinumber';
  62. $invfld = 'vinumber' if $form->{ARAP} eq 'AP';
  63. $form->{invnumber} = $form->update_defaults(\%myconfig, $invfld);
  64. if ($form->{media} eq 'screen') {
  65. if ($form->{media} eq 'screen') {
  66. &update;
  67. exit;
  68. }
  69. }
  70. }
  71. if ($form->{formname} =~ /(check|receipt)/) {
  72. if ($form->{media} ne 'screen') {
  73. for (qw(action header)) { delete $form->{$_} }
  74. $form->{invtotal} = $form->{oldinvtotal};
  75. foreach $key (keys %$form) {
  76. $form->{$key} =~ s/&/%26/g;
  77. $form->{previousform} .= qq|$key=$form->{$key}&|;
  78. }
  79. chop $form->{previousform};
  80. $form->{previousform} = $form->escape($form->{previousform}, 1);
  81. }
  82. if ($form->{paidaccounts} > 1) {
  83. if ($form->{"paid_$form->{paidaccounts}"}) {
  84. &update;
  85. exit;
  86. } elsif ($form->{paidaccounts} > 2) {
  87. # select payment
  88. &select_payment;
  89. exit;
  90. }
  91. } else {
  92. $form->error($locale->text('Nothing to print!'));
  93. }
  94. }
  95. if ($filename = $queued{$form->{formname}}) {
  96. $form->{queued} =~ s/$form->{formname} $filename//;
  97. unlink "${LedgerSMB::Sysconfig::spool}/$filename";
  98. $filename =~ s/\..*$//g;
  99. } else {
  100. $filename = time;
  101. $filename .= $$;
  102. }
  103. $filename .= ($form->{format} eq 'postscript') ? '.ps' : '.pdf';
  104. if ($form->{media} ne 'screen'){
  105. $form->{OUT} = "${LedgerSMB::Sysconfig::spool}/$filename";
  106. $form{printmode} = '>';
  107. }
  108. $form->{queued} .= " $form->{formname} $filename";
  109. $form->{queued} =~ s/^ //;
  110. $printform = new Form;
  111. for (keys %$form){
  112. $printform->{$_} = $form->{$_};
  113. }
  114. if ($form->{printandpost}){
  115. &post;
  116. } else {
  117. &{ "print_$form->{formname}" }($old_form, 1);
  118. }
  119. }
  120. sub print_check {
  121. my ($old_form, $i) = @_;
  122. $display_form = ($form->{display_form}) ? $form->{display_form} : "display_form";
  123. if ($form->{"paid_$i"}) {
  124. @a = ();
  125. if (exists $form->{longformat}) {
  126. $form->{"datepaid_$i"} = $locale->date(\%myconfig, $form->{"datepaid_$i"}, $form->{longformat});
  127. }
  128. push @a, "source_$i", "memo_$i";
  129. $form->format_string(@a);
  130. }
  131. $form->{amount} = $form->{"paid_$i"};
  132. if (($form->{formname} eq 'check' && $form->{vc} eq 'customer') ||
  133. ($form->{formname} eq 'receipt' && $form->{vc} eq 'vendor')) {
  134. $form->{amount} =~ s/-//g;
  135. }
  136. for (qw(datepaid source memo)) { $form->{$_} = $form->{"${_}_$i"} }
  137. &{ "$form->{vc}_details" };
  138. @a = qw(name address1 address2 city state zipcode country);
  139. foreach $item (qw(invnumber ordnumber)) {
  140. $temp{$item} = $form->{$item};
  141. delete $form->{$item};
  142. push(@{ $form->{$item} }, $temp{$item});
  143. }
  144. push(@{ $form->{invdate} }, $form->{transdate});
  145. push(@{ $form->{due} }, $form->format_amount(\%myconfig, $form->{oldinvtotal}, 2));
  146. push(@{ $form->{paid} }, $form->{"paid_$i"});
  147. use LedgerSMB::CP;
  148. $c = CP->new(($form->{language_code}) ? $form->{language_code} : $myconfig{countrycode});
  149. $c->init;
  150. ($whole, $form->{decimal}) = split /\./, $form->parse_amount(\%myconfig, $form->{amount});
  151. $form->{decimal} .= "00";
  152. $form->{decimal} = substr($form->{decimal}, 0, 2);
  153. $form->{text_decimal} = $c->num2text($form->{decimal} * 1);
  154. $form->{text_amount} = $c->num2text($whole);
  155. $form->{integer_amount} = $form->format_amount($myconfig, $whole);
  156. ($form->{employee}) = split /--/, $form->{employee};
  157. $form->{notes} =~ s/^\s+//g;
  158. push @a, "notes";
  159. for (qw(company address tel fax businessnumber)) { $form->{$_} = $myconfig{$_} }
  160. $form->{address} =~ s/\\n/\n/g;
  161. push @a, qw(company address tel fax businessnumber text_amount text_decimal);
  162. $form->format_string(@a);
  163. $form->{templates} = "$myconfig{templates}";
  164. $form->{IN} = ($form->{formname} eq 'transaction') ? lc $form->{ARAP} . "_$form->{formname}.html" : "$form->{formname}.html";
  165. if ($form->{format} =~ /(postscript|pdf)/) {
  166. $form->{IN} =~ s/html$/tex/;
  167. }
  168. if ($form->{media} eq 'queue') {
  169. # save status
  170. $form->update_status(\%myconfig);
  171. $form->{queued} = $form->{queued};
  172. %audittrail = ( tablename => ($order) ? 'oe' : lc $ARAP,
  173. reference => $form->{"${inv}number"},
  174. formname => $form->{formname},
  175. action => 'queued',
  176. id => $form->{id} );
  177. $form->{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail);
  178. $form->{OUT} = "${LedgerSMB::Sysconfig::spool}/$filename";
  179. $form->{printmode} = '>';
  180. $form->{queued} .= " $form->{formname} $filename";
  181. $form->{queued} =~ s/^ //;
  182. }
  183. if ($form->{media} !~ /(screen|queue)/) {
  184. %queued = split / /, $form->{queued};
  185. $form->{OUT} = "| ${LedgerSMB::Sysconfig::printer}{$form->{media}}";
  186. $form->{printmode} = '|-';
  187. if ($form->{printed} !~ /$form->{formname}/) {
  188. $form->{printed} .= " $form->{formname}";
  189. $form->{printed} =~ s/^ //;
  190. $form->update_status(\%myconfig);
  191. }
  192. %audittrail = ( tablename => lc $form->{ARAP},
  193. reference => $form->{invnumber},
  194. formname => $form->{formname},
  195. action => 'printed',
  196. id => $form->{id} );
  197. %status = ();
  198. for (qw(printed audittrail)) { $status{$_} = $form->{$_} }
  199. $status{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail);
  200. }
  201. $form->{fileid} = $invnumber;
  202. $form->{fileid} =~ s/(\s|\W)+//g;
  203. $form->parse_template(\%myconfig);
  204. if ($form->{previousform}) {
  205. $previousform = $form->unescape($form->{previousform});
  206. for (keys %$form) { delete $form->{$_} }
  207. foreach $item (split /&/, $previousform) {
  208. ($key, $value) = split /=/, $item, 2;
  209. $value =~ s/%26/&/g;
  210. $form->{$key} = $value;
  211. }
  212. for (qw(exchangerate creditlimit creditremaining)) { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
  213. for (1 .. $form->{rowcount}) { $form->{"amount_$_"} = $form->parse_amount(\%myconfig, $form->{"amount_$_"}) }
  214. for (split / /, $form->{taxaccounts}) { $form->{"tax_$_"} = $form->parse_amount(\%myconfig, $form->{"tax_$_"}) }
  215. for $i (1 .. $form->{paidaccounts}) {
  216. for (qw(paid exchangerate)) { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) }
  217. }
  218. for (qw(printed audittrail)) { $form->{$_} = $status{$_} }
  219. &{ "$display_form" };
  220. }
  221. }
  222. sub print_receipt {
  223. my ($old_form, $i) = @_;
  224. &print_check($old_form, $i);
  225. }
  226. sub print_transaction {
  227. my ($old_form) = @_;
  228. $display_form = ($form->{display_form}) ? $form->{display_form} : "display_form";
  229. &{ "$form->{vc}_details" };
  230. @a = qw(name address1 address2 city state zipcode country);
  231. $form->{invtotal} = 0;
  232. foreach $i (1 .. $form->{rowcount} - 1) {
  233. ($form->{tempaccno}, $form->{tempaccount}) = split /--/, $form->{"$form->{ARAP}_amount_$i"};
  234. ($form->{tempprojectnumber}) = split /--/, $form->{"projectnumber_$i"};
  235. $form->{tempdescription} = $form->{"description_$i"};
  236. $form->format_string(qw(tempaccno tempaccount tempprojectnumber tempdescription));
  237. push(@{ $form->{accno} }, $form->{tempaccno});
  238. push(@{ $form->{account} }, $form->{tempaccount});
  239. push(@{ $form->{description} }, $form->{tempdescription});
  240. push(@{ $form->{projectnumber} }, $form->{tempprojectnumber});
  241. push(@{ $form->{amount} }, $form->{"amount_$i"});
  242. $form->{subtotal} += $form->parse_amount(\%myconfig, $form->{"amount_$i"});
  243. }
  244. foreach $accno (split / /, $form->{taxaccounts}) {
  245. if ($form->{"tax_$accno"}) {
  246. $form->format_string("${accno}_description");
  247. $tax += $form->parse_amount(\%myconfig, $form->{"tax_$accno"});
  248. $form->{"${accno}_tax"} = $form->{"tax_$accno"};
  249. push(@{ $form->{tax} }, $form->{"tax_$accno"});
  250. push(@{ $form->{taxdescription} }, $form->{"${accno}_description"});
  251. $form->{"${accno}_taxrate"} = $form->format_amount($myconfig, $form->{"${accno}_rate"} * 100);
  252. push(@{ $form->{taxrate} }, $form->{"${accno}_taxrate"});
  253. push(@{ $form->{taxnumber} }, $form->{"${accno}_taxnumber"});
  254. }
  255. }
  256. $tax = 0 if $form->{taxincluded};
  257. push @a, $form->{ARAP};
  258. $form->format_string(@a);
  259. $form->{paid} = 0;
  260. for $i (1 .. $form->{paidaccounts} - 1) {
  261. if ($form->{"paid_$i"}) {
  262. @a = ();
  263. $form->{paid} += $form->parse_amount(\%myconfig, $form->{"paid_$i"});
  264. if (exists $form->{longformat}) {
  265. $form->{"datepaid_$i"} = $locale->date(\%myconfig, $form->{"datepaid_$i"}, $form->{longformat});
  266. }
  267. push @a, "$form->{ARAP}_paid_$i", "source_$i", "memo_$i";
  268. $form->format_string(@a);
  269. ($accno, $account) = split /--/, $form->{"$form->{ARAP}_paid_$i"};
  270. push(@{ $form->{payment} }, $form->{"paid_$i"});
  271. push(@{ $form->{paymentdate} }, $form->{"datepaid_$i"});
  272. push(@{ $form->{paymentaccount} }, $account);
  273. push(@{ $form->{paymentsource} }, $form->{"source_$i"});
  274. push(@{ $form->{paymentmemo} }, $form->{"memo_$i"});
  275. }
  276. }
  277. $form->{invtotal} = $form->{subtotal} + $tax;
  278. $form->{total} = $form->{invtotal} - $form->{paid};
  279. use LedgerSMB::CP;
  280. $c = CP->new(($form->{language_code}) ? $form->{language_code} : $myconfig{countrycode});
  281. $c->init;
  282. ($whole, $form->{decimal}) = split /\./, $form->{invtotal};
  283. $form->{decimal} .= "00";
  284. $form->{decimal} = substr($form->{decimal}, 0, 2);
  285. $form->{text_decimal} = $c->num2text($form->{decimal} * 1);
  286. $form->{text_amount} = $c->num2text($whole);
  287. $form->{integer_amount} = $form->format_amount($myconfig, $whole);
  288. for (qw(invtotal subtotal paid total)) { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 2) }
  289. ($form->{employee}) = split /--/, $form->{employee};
  290. if (exists $form->{longformat}) {
  291. for (qw(duedate transdate)) { $form->{$_} = $locale->date(\%myconfig, $form->{$_}, $form->{longformat}) }
  292. }
  293. $form->{notes} =~ s/^\s+//g;
  294. @a = ("invnumber", "transdate", "duedate", "notes");
  295. for (qw(company address tel fax businessnumber)) { $form->{$_} = $myconfig{$_} }
  296. $form->{address} =~ s/\\n/\n/g;
  297. push @a, qw(company address tel fax businessnumber text_amount text_decimal);
  298. $form->format_string(@a);
  299. $form->{invdate} = $form->{transdate};
  300. $form->{templates} = "$myconfig{templates}";
  301. $form->{IN} = ($form->{formname} eq 'transaction') ? lc $form->{ARAP} . "_$form->{formname}.html" : "$form->{formname}.html";
  302. if ($form->{format} =~ /(postscript|pdf)/) {
  303. $form->{IN} =~ s/html$/tex/;
  304. }
  305. if ($form->{media} eq 'queue') {
  306. %queued = split / /, $form->{queued};
  307. if ($filename = $queued{$form->{formname}}) {
  308. $form->{queued} =~ s/$form->{formname} $filename//;
  309. unlink "${LedgerSMB::Sysconfig::spool}/$filename";
  310. $filename =~ s/\..*$//g;
  311. } else {
  312. $filename = time;
  313. $filename .= $$;
  314. }
  315. $filename .= ($form->{format} eq 'postscript') ? '.ps' : '.pdf';
  316. $form->{OUT} = "${LedgerSMB::Sysconfig::spool}/$filename";
  317. $form->{printmode} = '>';
  318. $form->{queued} .= " $form->{formname} $filename";
  319. $form->{queued} =~ s/^ //;
  320. # save status
  321. $form->update_status(\%myconfig);
  322. $old_form->{queued} = $form->{queued};
  323. %audittrail = ( tablename => ($order) ? 'oe' : lc $ARAP,
  324. reference => $form->{"${inv}number"},
  325. formname => $form->{formname},
  326. action => 'queued',
  327. id => $form->{id} );
  328. $old_form->{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail);
  329. }
  330. if ($form->{media} !~ /(queue|screen)/) {
  331. $form->{OUT} = "${LedgerSMB::Sysconfig::printer}{$form->{media}}";
  332. $form->{printmode} = '|-';
  333. if ($form->{printed} !~ /$form->{formname}/) {
  334. $form->{printed} .= " $form->{formname}";
  335. $form->{printed} =~ s/^ //;
  336. $form->update_status(\%myconfig);
  337. }
  338. $old_form->{printed} = $form->{printed} if %$old_form;
  339. %audittrail = ( tablename => lc $form->{ARAP},
  340. reference => $form->{"invnumber"},
  341. formname => $form->{formname},
  342. action => 'printed',
  343. id => $form->{id} );
  344. $old_form->{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail) if %$old_form;
  345. }
  346. $form->{fileid} = $form->{invnumber};
  347. $form->{fileid} =~ s/(\s|\W)+//g;
  348. $form->parse_template(\%myconfig);
  349. if (%$old_form) {
  350. $old_form->{invnumber} = $form->{invnumber};
  351. $old_form->{invtotal} = $form->{invtotal};
  352. for (keys %$form) { delete $form->{$_} }
  353. for (keys %$old_form) { $form->{$_} = $old_form->{$_} }
  354. if (! $form->{printandpost}) {
  355. for (qw(exchangerate creditlimit creditremaining)) { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
  356. for (1 .. $form->{rowcount}) { $form->{"amount_$_"} = $form->parse_amount(\%myconfig, $form->{"amount_$_"}) }
  357. for (split / /, $form->{taxaccounts}) { $form->{"tax_$_"} = $form->parse_amount(\%myconfig, $form->{"tax_$_"}) }
  358. for $i (1 .. $form->{paidaccounts}) {
  359. for (qw(paid exchangerate)) { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) }
  360. }
  361. }
  362. &{ "$display_form" };
  363. }
  364. }
  365. sub vendor_details { IR->vendor_details(\%myconfig, \%$form) };
  366. sub customer_details { IS->customer_details(\%myconfig, \%$form) };
  367. sub select_payment {
  368. @column_index = ("ndx", "datepaid", "source", "memo", "paid", "$form->{ARAP}_paid");
  369. # list payments with radio button on a form
  370. $form->header;
  371. $title = $locale->text('Select payment');
  372. $column_data{ndx} = qq|<th width=1%>&nbsp;</th>|;
  373. $column_data{datepaid} = qq|<th>|.$locale->text('Date').qq|</th>|;
  374. $column_data{source} = qq|<th>|.$locale->text('Source').qq|</th>|;
  375. $column_data{memo} = qq|<th>|.$locale->text('Memo').qq|</th>|;
  376. $column_data{paid} = qq|<th>|.$locale->text('Amount').qq|</th>|;
  377. $column_data{"$form->{ARAP}_paid"} = qq|<th>|.$locale->text('Account').qq|</th>|;
  378. print qq|
  379. <body>
  380. <form method=post action=$form->{script}>
  381. <table width=100%>
  382. <tr>
  383. <th class=listtop>$title</th>
  384. </tr>
  385. <tr space=5></tr>
  386. <tr>
  387. <td>
  388. <table width=100%>
  389. <tr class=listheading>|;
  390. for (@column_index) { print "\n$column_data{$_}" }
  391. print qq|
  392. </tr>
  393. |;
  394. $checked = "checked";
  395. foreach $i (1 .. $form->{paidaccounts} - 1) {
  396. for (@column_index) { $column_data{$_} = qq|<td>$form->{"${_}_$i"}</td>| }
  397. $paid = $form->{"paid_$i"};
  398. $ok = 1;
  399. $column_data{ndx} = qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
  400. $column_data{paid} = qq|<td align=right>$paid</td>|;
  401. $checked = "";
  402. $j++; $j %= 2;
  403. print qq|
  404. <tr class=listrow$j>|;
  405. for (@column_index) { print "\n$column_data{$_}" }
  406. print qq|
  407. </tr>
  408. |;
  409. }
  410. print qq|
  411. </table>
  412. </td>
  413. </tr>
  414. <tr>
  415. <td><hr size=3 noshade></td>
  416. </tr>
  417. </table>
  418. |;
  419. for (qw(action nextsub)) { delete $form->{$_} }
  420. $form->hide_form;
  421. print qq|
  422. <br>
  423. <input type=hidden name=nextsub value=payment_selected>
  424. |;
  425. if ($ok) {
  426. print qq|
  427. <button class="submit" type="submit" name="action" value="continue">|.$locale->text('Continue').qq|</button>|;
  428. }
  429. print qq|
  430. </form>
  431. </body>
  432. </html>
  433. |;
  434. }
  435. sub payment_selected {
  436. &{ "print_$form->{formname}" }($form->{oldform}, $form->{ndx});
  437. }
  438. sub print_options {
  439. if ($form->{selectlanguage}) {
  440. $form->{"selectlanguage"} = $form->unescape($form->{"selectlanguage"});
  441. $form->{"selectlanguage"} =~ s/ selected//;
  442. $form->{"selectlanguage"} =~ s/(<option value="\Q$form->{language_code}\E")/$1 selected/;
  443. $lang = qq|<select name=language_code>$form->{selectlanguage}</select>
  444. <input type=hidden name=selectlanguage value="|.
  445. $form->escape($form->{selectlanguage},1).qq|">|;
  446. }
  447. $form->{selectformname} = $form->unescape($form->{selectformname});
  448. $form->{selectformname} =~ s/ selected//;
  449. $form->{selectformname} =~ s/(<option value="\Q$form->{formname}\E")/$1 selected/;
  450. $type = qq|<select name=formname>$form->{selectformname}</select>
  451. <input type=hidden name=selectformname value="|.$form->escape($form->{selectformname},1).qq|">|;
  452. $media = qq|<select name=media>
  453. <option value="screen">|.$locale->text('Screen');
  454. $form->{selectformat} = qq|<option value="html">html\n|;
  455. if (%{LedgerSMB::Sysconfig::printer} && ${LedgerSMB::Sysconfig::latex}) {
  456. for (sort keys %{LedgerSMB::Sysconfig::printer}) { $media .= qq|
  457. <option value="$_">$_| }
  458. }
  459. if (${LedgerSMB::Sysconfig::latex}) {
  460. $form->{selectformat} .= qq|
  461. <option value="postscript">|.$locale->text('Postscript').qq|
  462. <option value="pdf">|.$locale->text('PDF');
  463. $media .= qq|<option value="queue">|.$locale->text('Queue');
  464. }
  465. $format = qq|<select name=format>$form->{selectformat}</select>|;
  466. $format =~ s/(<option value="\Q$form->{format}\E")/$1 selected/;
  467. $format .= qq|
  468. <input type=hidden name=selectformat value="|.$form->escape($form->{selectformat},1).qq|">|;
  469. $media .= qq|</select>|;
  470. $media =~ s/(<option value="\Q$form->{media}\E")/$1 selected/;
  471. print qq|
  472. <table width=100%>
  473. <tr>
  474. <td>$type</td>
  475. <td>$lang</td>
  476. <td>$format</td>
  477. <td>$media</td>
  478. <td align=right width=90%>
  479. |;
  480. if ($form->{printed} =~ /$form->{formname}/) {
  481. print $locale->text('Printed').qq|<br>|;
  482. }
  483. if ($form->{recurring}) {
  484. print $locale->text('Scheduled');
  485. }
  486. print qq|
  487. </td>
  488. </tr>
  489. </table>
  490. |;
  491. }
  492. sub print_and_post {
  493. $form->error($locale->text('Select postscript or PDF!')) if $form->{format} !~ /(postscript|pdf)/;
  494. $form->error($locale->text('Select a Printer!')) if $form->{media} eq 'screen';
  495. $form->{printandpost} = 1;
  496. $form->{display_form} = "post";
  497. &print;
  498. }