1#===================================================================== 2# SQL-Ledger 3# Copyright (c) DWS Systems Inc. 4# 5# Author: DWS Systems Inc. 6# Web: http://www.sql-ledger.com 7# 8#====================================================================== 9# 10# Maintainance module 11# 12#====================================================================== 13 14use SL::SM; 15use SL::IS; 16use SL::IR; 17require "$form->{path}/js.pl"; 18 191; 20# end of main 21 22 23sub repost_invoices { 24 25 # enter a date for which to repost invoices 26 # reverse invoices and save in temporary tables 27 # post vendor invoices then sales invoices 28 29 $form->helpref("repost_invoices", $myconfig{countrycode}); 30 31 $form->{title} = $locale->text('Repost Invoices'); 32 33 $form->header; 34 35 &calendar; 36 37 print qq| 38<body> 39 40<form method="post" name="main" action="$form->{script}"> 41 42<table width=100%> 43 <tr class=listtop> 44 <th>$form->{helpref}$form->{title}</a></th> 45 </tr> 46 <tr height="5"></tr> 47 <tr> 48 <td> 49 <table> 50 <tr> 51 <th>|.$locale->text('Beginning date').qq|</th> 52 <td><input name="transdate" size="11" class="date" title="$myconfig{dateformat}">|.&js_calendar("main", "transdate").qq|</td> 53 </tr> 54 </table> 55 </td> 56 </tr> 57</table> 58 59<hr size=3 noshade> 60 61<br> 62<input class="submit" type="submit" name="action" value="|.$locale->text('Continue').qq|">|; 63 64 $form->{nextsub} = "do_repost_invoices"; 65 66 $form->hide_form(qw(nextsub path login)); 67 68 print qq| 69</form> 70 71</body> 72</html> 73|; 74 75} 76 77 78sub do_repost_invoices { 79 80 $form->isblank('transdate', $locale->text('Date missing!')); 81 82 $form->header; 83 print $locale->text('Reposting Invoices ... '); 84 if ($ENV{HTTP_USER_AGENT}) { 85 print "<blink><font color=red>".$locale->text('please wait')."</font></blink>\n"; 86 } else { 87 print $locale->text('please wait')."\n"; 88 } 89 90 $SIG{INT} = 'IGNORE'; 91 92 open(FH, ">$userspath/$myconfig{dbname}.LCK") or $form->error($!); 93 close(FH); 94 95 $err = SM->repost_invoices(\%myconfig, \%$form, $userspath); 96 97 unlink "$userspath/$myconfig{dbname}.LCK"; 98 99 if ($err == -1) { 100 $form->error($locale->text('AR account does not exist!')); 101 } 102 if ($err == -2) { 103 $form->error($locale->text('AP account does not exist!')); 104 } 105 106 print "... ".$locale->text('done')."\n"; 107 108} 109 110 111sub fld_config { 112 113# list formnames 114 115# pick one to edit 116 117 118} 119 120 121sub fld_edit { 122 123} 124 125 126sub fld_save { 127 128} 129 130 131sub continue { &{ $form->{nextsub} } }; 132 133 134