1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
|
#=====================================================================
# SQL-Ledger ERP
# Copyright (c) 2009
#
# Author: DWS Systems Inc.
# Web: http://www.sql-ledger.com
#
#======================================================================
#
# Maintainance module
#
#======================================================================
use SL::SM;
use SL::IS;
use SL::IR;
1;
# end of main
sub repost_invoices {
# enter a date for which to repost invoices
# reverse invoices and save in temporary tables
# post vendor invoices then sales invoices
$form->helpref("repost_invoices", $myconfig{countrycode});
$form->{title} = $locale->text('Repost Invoices');
$form->header;
print qq|
<body>
<form method=post action=$form->{script}>
<table width=100%>
<tr class=listtop>
<th>$form->{helpref}$form->{title}</a></th>
</tr>
<tr height="5"></tr>
<tr>
<td>
<table>
<tr>
<td>|.$locale->text('Beginning date').qq|
<td><input name="transdate" size="11" class="date" title="$myconfig{dateformat}"></td>
</tr>
</table>
</td>
</tr>
</table>
<hr size=3 noshade>
<br>
<input class="submit" type="submit" name="action" value="|.$locale->text('Continue').qq|">|;
$form->{nextsub} = "do_repost_invoices";
$form->hide_form(qw(nextsub path login));
print qq|
</form>
</body>
</html>
|;
}
sub do_repost_invoices {
$form->isblank('transdate', $locale->text('Date missing'));
$form->header;
print "Reposting Invoices ... ";
if ($ENV{HTTP_USER_AGENT}) {
print "<blink><font color=red>please wait</font></blink>\n";
} else {
print "please wait\n";
}
$SIG{INT} = 'IGNORE';
open(FH, ">$userspath/$myconfig{dbname}.LCK") or $form->error($!);
close(FH);
$err = SM->repost_invoices(\%myconfig, \%$form, $userspath);
unlink "$userspath/$myconfig{dbname}.LCK";
if ($err == -1) {
$form->error('AR account does not exist!');
}
if ($err == -2) {
$form->error('AP account does not exist!');
}
print "... done\n";
}
sub delete_invoices {
$form->{title} = $locale->text('Delete Open Invoices');
$form->helpref("delete_open_invoices", $myconfig{countrycode});
$form->header;
print qq|
<body>
<form method=post action=$form->{script}>
<table width=100%>
<tr class=listtop>
<th>$form->{helpref}$form->{title}</a></th>
</tr>
<tr height="5"></tr>
<tr>
<td>
<table>
<tr>
<td>|.$locale->text('From').qq|
<td><input name="transdatefrom" size="11" class="date" title="$myconfig{dateformat}"></td>
<td>|.$locale->text('To').qq|
<td><input name="transdateto" size="11" class="date" title="$myconfig{dateformat}"></td>
</tr>
</table>
</td>
</tr>
</table>
<hr size=3 noshade>
<br>
<input class="submit" type="submit" name=action value="|.$locale->text('Continue').qq|">|;
$form->{nextsub} = "do_delete_invoices";
$form->hide_form(qw(nextsub path login));
print qq|
</form>
</body>
</html>
|;
}
sub do_delete_invoices {
$form->header;
print $locale->text('Deleting Invoices ... ');
if ($ENV{HTTP_USER_AGENT}) {
print "<blink><font color=red>".$locale->text('please wait')."</font></blink>\n";
} else {
print $locale->text('please wait')."\n";
}
$SIG{INT} = 'IGNORE';
IS->delete_invoices(\%myconfig, \%$form, $spool);
print "... ".$locale->text('done');
}
sub continue { &{ $form->{nextsub} } };
|