summaryrefslogtreecommitdiff
path: root/bin/arapprn.pl
blob: 0bada33c486d970a2220caa524dfcecd5d0ab9a9 (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. $form->{OUT} = ">${LedgerSMB::Sysconfig::spool}/$filename";
  105. $form->{queued} .= " $form->{formname} $filename";
  106. $form->{queued} =~ s/^ //;
  107. $printform = new Form;
  108. for (keys %$form){
  109. $printform->{$_} = $form->{$_};
  110. }
  111. if ($form->{printandpost}){
  112. &post;
  113. } else {
  114. &{ "print_$form->{formname}" }($old_form, 1);
  115. }
  116. }
  117. sub print_check {
  118. my ($old_form, $i) = @_;
  119. $display_form = ($form->{display_form}) ? $form->{display_form} : "display_form";
  120. if ($form->{"paid_$i"}) {
  121. @a = ();
  122. if (exists $form->{longformat}) {
  123. $form->{"datepaid_$i"} = $locale->date(\%myconfig, $form->{"datepaid_$i"}, $form->{longformat});
  124. }
  125. push @a, "source_$i", "memo_$i";
  126. $form->format_string(@a);
  127. }
  128. $form->{amount} = $form->{"paid_$i"};
  129. if (($form->{formname} eq 'check' && $form->{vc} eq 'customer') ||
  130. ($form->{formname} eq 'receipt' && $form->{vc} eq 'vendor')) {
  131. $form->{amount} =~ s/-//g;
  132. }
  133. for (qw(datepaid source memo)) { $form->{$_} = $form->{"${_}_$i"} }
  134. &{ "$form->{vc}_details" };
  135. @a = qw(name address1 address2 city state zipcode country);
  136. foreach $item (qw(invnumber ordnumber)) {
  137. $temp{$item} = $form->{$item};
  138. delete $form->{$item};
  139. push(@{ $form->{$item} }, $temp{$item});
  140. }
  141. push(@{ $form->{invdate} }, $form->{transdate});
  142. push(@{ $form->{due} }, $form->format_amount(\%myconfig, $form->{oldinvtotal}, 2));
  143. push(@{ $form->{paid} }, $form->{"paid_$i"});
  144. use LedgerSMB::CP;
  145. $c = CP->new(($form->{language_code}) ? $form->{language_code} : $myconfig{countrycode});
  146. $c->init;
  147. ($whole, $form->{decimal}) = split /\./, $form->parse_amount(\%myconfig, $form->{amount});
  148. $form->{decimal} .= "00";
  149. $form->{decimal} = substr($form->{decimal}, 0, 2);
  150. $form->{text_decimal} = $c->num2text($form->{decimal} * 1);
  151. $form->{text_amount} = $c->num2text($whole);
  152. $form->{integer_amount} = $form->format_amount($myconfig, $whole);
  153. ($form->{employee}) = split /--/, $form->{employee};
  154. $form->{notes} =~ s/^\s+//g;
  155. push @a, "notes";
  156. for (qw(company address tel fax businessnumber)) { $form->{$_} = $myconfig{$_} }
  157. $form->{address} =~ s/\\n/\n/g;
  158. push @a, qw(company address tel fax businessnumber text_amount text_decimal);
  159. $form->format_string(@a);
  160. $form->{templates} = "$myconfig{templates}";
  161. $form->{IN} = ($form->{formname} eq 'transaction') ? lc $form->{ARAP} . "_$form->{formname}.html" : "$form->{formname}.html";
  162. if ($form->{format} =~ /(postscript|pdf)/) {
  163. $form->{IN} =~ s/html$/tex/;
  164. }
  165. if ($form->{media} eq 'queue') {
  166. # save status
  167. $form->update_status(\%myconfig);
  168. $form->{queued} = $form->{queued};
  169. %audittrail = ( tablename => ($order) ? 'oe' : lc $ARAP,
  170. reference => $form->{"${inv}number"},
  171. formname => $form->{formname},
  172. action => 'queued',
  173. id => $form->{id} );
  174. $form->{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail);
  175. $form->{OUT} = ">${LedgerSMB::Sysconfig::spool}/$filename";
  176. $form->{queued} .= " $form->{formname} $filename";
  177. $form->{queued} =~ s/^ //;
  178. }
  179. if ($form->{media} !~ /(screen|queue)/) {
  180. %queued = split / /, $form->{queued};
  181. $form->{OUT} = "| ${LedgerSMB::Sysconfig::printer}{$form->{media}}";
  182. if ($form->{printed} !~ /$form->{formname}/) {
  183. $form->{printed} .= " $form->{formname}";
  184. $form->{printed} =~ s/^ //;
  185. $form->update_status(\%myconfig);
  186. }
  187. %audittrail = ( tablename => lc $form->{ARAP},
  188. reference => $form->{invnumber},
  189. formname => $form->{formname},
  190. action => 'printed',
  191. id => $form->{id} );
  192. %status = ();
  193. for (qw(printed audittrail)) { $status{$_} = $form->{$_} }
  194. $status{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail);
  195. }
  196. $form->{fileid} = $invnumber;
  197. $form->{fileid} =~ s/(\s|\W)+//g;
  198. $form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
  199. if ($form->{previousform}) {
  200. $previousform = $form->unescape($form->{previousform});
  201. for (keys %$form) { delete $form->{$_} }
  202. foreach $item (split /&/, $previousform) {
  203. ($key, $value) = split /=/, $item, 2;
  204. $value =~ s/%26/&/g;
  205. $form->{$key} = $value;
  206. }
  207. for (qw(exchangerate creditlimit creditremaining)) { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
  208. for (1 .. $form->{rowcount}) { $form->{"amount_$_"} = $form->parse_amount(\%myconfig, $form->{"amount_$_"}) }
  209. for (split / /, $form->{taxaccounts}) { $form->{"tax_$_"} = $form->parse_amount(\%myconfig, $form->{"tax_$_"}) }
  210. for $i (1 .. $form->{paidaccounts}) {
  211. for (qw(paid exchangerate)) { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) }
  212. }
  213. for (qw(printed audittrail)) { $form->{$_} = $status{$_} }
  214. &{ "$display_form" };
  215. }
  216. }
  217. sub print_receipt {
  218. my ($old_form, $i) = @_;
  219. &print_check($old_form, $i);
  220. }
  221. sub print_transaction {
  222. my ($old_form) = @_;
  223. $display_form = ($form->{display_form}) ? $form->{display_form} : "display_form";
  224. &{ "$form->{vc}_details" };
  225. @a = qw(name address1 address2 city state zipcode country);
  226. $form->{invtotal} = 0;
  227. foreach $i (1 .. $form->{rowcount} - 1) {
  228. ($form->{tempaccno}, $form->{tempaccount}) = split /--/, $form->{"$form->{ARAP}_amount_$i"};
  229. ($form->{tempprojectnumber}) = split /--/, $form->{"projectnumber_$i"};
  230. $form->{tempdescription} = $form->{"description_$i"};
  231. $form->format_string(qw(tempaccno tempaccount tempprojectnumber tempdescription));
  232. push(@{ $form->{accno} }, $form->{tempaccno});
  233. push(@{ $form->{account} }, $form->{tempaccount});
  234. push(@{ $form->{description} }, $form->{tempdescription});
  235. push(@{ $form->{projectnumber} }, $form->{tempprojectnumber});
  236. push(@{ $form->{amount} }, $form->{"amount_$i"});
  237. $form->{subtotal} += $form->parse_amount(\%myconfig, $form->{"amount_$i"});
  238. }
  239. foreach $accno (split / /, $form->{taxaccounts}) {
  240. if ($form->{"tax_$accno"}) {
  241. $form->format_string("${accno}_description");
  242. $tax += $form->parse_amount(\%myconfig, $form->{"tax_$accno"});
  243. $form->{"${accno}_tax"} = $form->{"tax_$accno"};
  244. push(@{ $form->{tax} }, $form->{"tax_$accno"});
  245. push(@{ $form->{taxdescription} }, $form->{"${accno}_description"});
  246. $form->{"${accno}_taxrate"} = $form->format_amount($myconfig, $form->{"${accno}_rate"} * 100);
  247. push(@{ $form->{taxrate} }, $form->{"${accno}_taxrate"});
  248. push(@{ $form->{taxnumber} }, $form->{"${accno}_taxnumber"});
  249. }
  250. }
  251. $tax = 0 if $form->{taxincluded};
  252. push @a, $form->{ARAP};
  253. $form->format_string(@a);
  254. $form->{paid} = 0;
  255. for $i (1 .. $form->{paidaccounts} - 1) {
  256. if ($form->{"paid_$i"}) {
  257. @a = ();
  258. $form->{paid} += $form->parse_amount(\%myconfig, $form->{"paid_$i"});
  259. if (exists $form->{longformat}) {
  260. $form->{"datepaid_$i"} = $locale->date(\%myconfig, $form->{"datepaid_$i"}, $form->{longformat});
  261. }
  262. push @a, "$form->{ARAP}_paid_$i", "source_$i", "memo_$i";
  263. $form->format_string(@a);
  264. ($accno, $account) = split /--/, $form->{"$form->{ARAP}_paid_$i"};
  265. push(@{ $form->{payment} }, $form->{"paid_$i"});
  266. push(@{ $form->{paymentdate} }, $form->{"datepaid_$i"});
  267. push(@{ $form->{paymentaccount} }, $account);
  268. push(@{ $form->{paymentsource} }, $form->{"source_$i"});
  269. push(@{ $form->{paymentmemo} }, $form->{"memo_$i"});
  270. }
  271. }
  272. $form->{invtotal} = $form->{subtotal} + $tax;
  273. $form->{total} = $form->{invtotal} - $form->{paid};
  274. use LedgerSMB::CP;
  275. $c = CP->new(($form->{language_code}) ? $form->{language_code} : $myconfig{countrycode});
  276. $c->init;
  277. ($whole, $form->{decimal}) = split /\./, $form->{invtotal};
  278. $form->{decimal} .= "00";
  279. $form->{decimal} = substr($form->{decimal}, 0, 2);
  280. $form->{text_decimal} = $c->num2text($form->{decimal} * 1);
  281. $form->{text_amount} = $c->num2text($whole);
  282. $form->{integer_amount} = $form->format_amount($myconfig, $whole);
  283. for (qw(invtotal subtotal paid total)) { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 2) }
  284. ($form->{employee}) = split /--/, $form->{employee};
  285. if (exists $form->{longformat}) {
  286. for (qw(duedate transdate)) { $form->{$_} = $locale->date(\%myconfig, $form->{$_}, $form->{longformat}) }
  287. }
  288. $form->{notes} =~ s/^\s+//g;
  289. @a = ("invnumber", "transdate", "duedate", "notes");
  290. for (qw(company address tel fax businessnumber)) { $form->{$_} = $myconfig{$_} }
  291. $form->{address} =~ s/\\n/\n/g;
  292. push @a, qw(company address tel fax businessnumber text_amount text_decimal);
  293. $form->format_string(@a);
  294. $form->{invdate} = $form->{transdate};
  295. $form->{templates} = "$myconfig{templates}";
  296. $form->{IN} = ($form->{formname} eq 'transaction') ? lc $form->{ARAP} . "_$form->{formname}.html" : "$form->{formname}.html";
  297. if ($form->{format} =~ /(postscript|pdf)/) {
  298. $form->{IN} =~ s/html$/tex/;
  299. }
  300. if ($form->{media} eq 'queue') {
  301. %queued = split / /, $form->{queued};
  302. if ($filename = $queued{$form->{formname}}) {
  303. $form->{queued} =~ s/$form->{formname} $filename//;
  304. unlink "${LedgerSMB::Sysconfig::spool}/$filename";
  305. $filename =~ s/\..*$//g;
  306. } else {
  307. $filename = time;
  308. $filename .= $$;
  309. }
  310. $filename .= ($form->{format} eq 'postscript') ? '.ps' : '.pdf';
  311. $form->{OUT} = ">${LedgerSMB::Sysconfig::spool}/$filename";
  312. $form->{queued} .= " $form->{formname} $filename";
  313. $form->{queued} =~ s/^ //;
  314. # save status
  315. $form->update_status(\%myconfig);
  316. $old_form->{queued} = $form->{queued};
  317. %audittrail = ( tablename => ($order) ? 'oe' : lc $ARAP,
  318. reference => $form->{"${inv}number"},
  319. formname => $form->{formname},
  320. action => 'queued',
  321. id => $form->{id} );
  322. $old_form->{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail);
  323. }
  324. if ($form->{media} !~ /(queue|screen)/) {
  325. $form->{OUT} = "| ${LedgerSMB::Sysconfig::printer}{$form->{media}}";
  326. if ($form->{printed} !~ /$form->{formname}/) {
  327. $form->{printed} .= " $form->{formname}";
  328. $form->{printed} =~ s/^ //;
  329. $form->update_status(\%myconfig);
  330. }
  331. $old_form->{printed} = $form->{printed} if %$old_form;
  332. %audittrail = ( tablename => lc $form->{ARAP},
  333. reference => $form->{"invnumber"},
  334. formname => $form->{formname},
  335. action => 'printed',
  336. id => $form->{id} );
  337. $old_form->{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail) if %$old_form;
  338. }
  339. $form->{fileid} = $form->{invnumber};
  340. $form->{fileid} =~ s/(\s|\W)+//g;
  341. $form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
  342. if (%$old_form) {
  343. $old_form->{invnumber} = $form->{invnumber};
  344. $old_form->{invtotal} = $form->{invtotal};
  345. for (keys %$form) { delete $form->{$_} }
  346. for (keys %$old_form) { $form->{$_} = $old_form->{$_} }
  347. if (! $form->{printandpost}) {
  348. for (qw(exchangerate creditlimit creditremaining)) { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
  349. for (1 .. $form->{rowcount}) { $form->{"amount_$_"} = $form->parse_amount(\%myconfig, $form->{"amount_$_"}) }
  350. for (split / /, $form->{taxaccounts}) { $form->{"tax_$_"} = $form->parse_amount(\%myconfig, $form->{"tax_$_"}) }
  351. for $i (1 .. $form->{paidaccounts}) {
  352. for (qw(paid exchangerate)) { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) }
  353. }
  354. }
  355. &{ "$display_form" };
  356. }
  357. }
  358. sub vendor_details { IR->vendor_details(\%myconfig, \%$form) };
  359. sub customer_details { IS->customer_details(\%myconfig, \%$form) };
  360. sub select_payment {
  361. @column_index = ("ndx", "datepaid", "source", "memo", "paid", "$form->{ARAP}_paid");
  362. # list payments with radio button on a form
  363. $form->header;
  364. $title = $locale->text('Select payment');
  365. $column_data{ndx} = qq|<th width=1%>&nbsp;</th>|;
  366. $column_data{datepaid} = qq|<th>|.$locale->text('Date').qq|</th>|;
  367. $column_data{source} = qq|<th>|.$locale->text('Source').qq|</th>|;
  368. $column_data{memo} = qq|<th>|.$locale->text('Memo').qq|</th>|;
  369. $column_data{paid} = qq|<th>|.$locale->text('Amount').qq|</th>|;
  370. $column_data{"$form->{ARAP}_paid"} = qq|<th>|.$locale->text('Account').qq|</th>|;
  371. print qq|
  372. <body>
  373. <form method=post action=$form->{script}>
  374. <table width=100%>
  375. <tr>
  376. <th class=listtop>$title</th>
  377. </tr>
  378. <tr space=5></tr>
  379. <tr>
  380. <td>
  381. <table width=100%>
  382. <tr class=listheading>|;
  383. for (@column_index) { print "\n$column_data{$_}" }
  384. print qq|
  385. </tr>
  386. |;
  387. $checked = "checked";
  388. foreach $i (1 .. $form->{paidaccounts} - 1) {
  389. for (@column_index) { $column_data{$_} = qq|<td>$form->{"${_}_$i"}</td>| }
  390. $paid = $form->{"paid_$i"};
  391. $ok = 1;
  392. $column_data{ndx} = qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
  393. $column_data{paid} = qq|<td align=right>$paid</td>|;
  394. $checked = "";
  395. $j++; $j %= 2;
  396. print qq|
  397. <tr class=listrow$j>|;
  398. for (@column_index) { print "\n$column_data{$_}" }
  399. print qq|
  400. </tr>
  401. |;
  402. }
  403. print qq|
  404. </table>
  405. </td>
  406. </tr>
  407. <tr>
  408. <td><hr size=3 noshade></td>
  409. </tr>
  410. </table>
  411. |;
  412. for (qw(action nextsub)) { delete $form->{$_} }
  413. $form->hide_form;
  414. print qq|
  415. <br>
  416. <input type=hidden name=nextsub value=payment_selected>
  417. |;
  418. if ($ok) {
  419. print qq|
  420. <button class="submit" type="submit" name="action" value="continue">|.$locale->text('Continue').qq|</button>|;
  421. }
  422. print qq|
  423. </form>
  424. </body>
  425. </html>
  426. |;
  427. }
  428. sub payment_selected {
  429. &{ "print_$form->{formname}" }($form->{oldform}, $form->{ndx});
  430. }
  431. sub print_options {
  432. if ($form->{selectlanguage}) {
  433. $form->{"selectlanguage"} = $form->unescape($form->{"selectlanguage"});
  434. $form->{"selectlanguage"} =~ s/ selected//;
  435. $form->{"selectlanguage"} =~ s/(<option value="\Q$form->{language_code}\E")/$1 selected/;
  436. $lang = qq|<select name=language_code>$form->{selectlanguage}</select>
  437. <input type=hidden name=selectlanguage value="|.
  438. $form->escape($form->{selectlanguage},1).qq|">|;
  439. }
  440. $form->{selectformname} = $form->unescape($form->{selectformname});
  441. $form->{selectformname} =~ s/ selected//;
  442. $form->{selectformname} =~ s/(<option value="\Q$form->{formname}\E")/$1 selected/;
  443. $type = qq|<select name=formname>$form->{selectformname}</select>
  444. <input type=hidden name=selectformname value="|.$form->escape($form->{selectformname},1).qq|">|;
  445. $media = qq|<select name=media>
  446. <option value="screen">|.$locale->text('Screen');
  447. $form->{selectformat} = qq|<option value="html">html\n|;
  448. if (%{LedgerSMB::Sysconfig::printer} && ${LedgerSMB::Sysconfig::latex}) {
  449. for (sort keys %{LedgerSMB::Sysconfig::printer}) { $media .= qq|
  450. <option value="$_">$_| }
  451. }
  452. if (${LedgerSMB::Sysconfig::latex}) {
  453. $form->{selectformat} .= qq|
  454. <option value="postscript">|.$locale->text('Postscript').qq|
  455. <option value="pdf">|.$locale->text('PDF');
  456. $media .= qq|<option value="queue">|.$locale->text('Queue');
  457. }
  458. $format = qq|<select name=format>$form->{selectformat}</select>|;
  459. $format =~ s/(<option value="\Q$form->{format}\E")/$1 selected/;
  460. $format .= qq|
  461. <input type=hidden name=selectformat value="|.$form->escape($form->{selectformat},1).qq|">|;
  462. $media .= qq|</select>|;
  463. $media =~ s/(<option value="\Q$form->{media}\E")/$1 selected/;
  464. print qq|
  465. <table width=100%>
  466. <tr>
  467. <td>$type</td>
  468. <td>$lang</td>
  469. <td>$format</td>
  470. <td>$media</td>
  471. <td align=right width=90%>
  472. |;
  473. if ($form->{printed} =~ /$form->{formname}/) {
  474. print $locale->text('Printed').qq|<br>|;
  475. }
  476. if ($form->{recurring}) {
  477. print $locale->text('Scheduled');
  478. }
  479. print qq|
  480. </td>
  481. </tr>
  482. </table>
  483. |;
  484. }
  485. sub print_and_post {
  486. $form->error($locale->text('Select postscript or PDF!')) if $form->{format} !~ /(postscript|pdf)/;
  487. $form->error($locale->text('Select a Printer!')) if $form->{media} eq 'screen';
  488. $form->{printandpost} = 1;
  489. $form->{display_form} = "post";
  490. &print;
  491. }