/
debtors-batch-proc.php
executable file
·642 lines (559 loc) · 25.6 KB
/
debtors-batch-proc.php
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
<?
#This program is copyright by Andre Coetzee email: ac@main.me
#and is licensed under the GPL v3
#
#
#
#
#Please add yourself to: http://www.accounting-123.com
#Developers, Software Vendors, Support, Accountants, Users
#
#
#The full software license can be found here:
#http://www.accounting-123.com/a.php?a=153/GPLv3
#
#
#
#
#
#
#
#
#
#
#
# get settings
require("settings.php");
require("core-settings.php");
# decide what to do
if (isset($_POST["key"])) {
switch ($_POST["key"]) {
case "write":
$OUTPUT = write($_POST);
break;
case "confirm":
$OUTPUT = confirm($_POST);
break;
case "writerem":
$OUTPUT = writerem($_POST);
break;
default:
if(isset($_POST['proc'])){
# Process
$OUTPUT = det($_POST);
}elseif(isset($_POST['rem'])){
# Remove
$OUTPUT = rembat($_POST);
}else{
$OUTPUT = "<li class=err> Invalid use of module.";
}
}
} else {
if(isset($_POST['proc'])){
# Process
$OUTPUT = det($_POST);
}elseif(isset($_POST['rem'])){
# Remove
$OUTPUT = rembat($_POST);
}else{
$OUTPUT = "<li class=err> Invalid use of module.";
}
}
# get templete
require("template.php");
# Confirm
function det($_POST)
{
# Get vars
foreach ($_POST as $key => $value) {
$$key = $value;
}
# validate input
require_lib("validate");
$v = new validate ();
if(isset($ord)){
foreach($ord as $key => $value){
$v->isOk ($ord[$key], "num", 1, 50, "Invalid batch No.");
}
}else{
return "<li> - No Credit Purchases Seleted. Please select at least one entry.";
}
# display errors, if any
if ($v->isError ()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>".$e["msg"];
}
$confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
$refnum = getrefnum();
/*refnum*/
# connect to core
core_Connect();
$pay = "";
# Debtors
foreach($ord as $key => $value){
db_connect();
$sql = "SELECT * FROM debtors_batch WHERE batchid = '$ord[$key]'";
$batRslt = db_exec($sql);
$bat = pg_fetch_array($batRslt);
# Get all the details
$sql = "SELECT cusname, orddate, invdate FROM credit_invoices WHERE ordnum = '$bat[ordnum]'";
$invRslt = db_exec($sql) or errDie("Unable to access database.");
if (pg_numrows ($invRslt) < 1) {
return "<li class=err> - Invalid Invoice Number. 1";
}
$inv = pg_fetch_array($invRslt);
# Get debt invoice info
$sql = "SELECT amount,terms FROM debtors WHERE ordnum ='$bat[ordnum]'";
$dtRslt = db_exec ($sql) or errDie ("Unable to retrieve invoice details from database.");
if (pg_numrows ($dtRslt) < 1) {
return "<li class=err> - Invalid Invoice Number. 2";
}
$dt = pg_fetch_array($dtRslt);
foreach($inv as $keys => $values){
$$keys = $values;
}
# get paid account name
core_connect();
$sql = "SELECT accname FROM accounts WHERE accid = '$bat[accpaid]'";
$accRslt = db_exec($sql);
$acc = pg_fetch_array($accRslt);
foreach($inv as $keys => $values){
$$keys = $values;
}
$pay .= "<tr class='bg-odd'>
<td><input type=hidden size=20 name=ord[] value='$bat[ordnum]'>
<input type=hidden size=20 name=bat[] value='$bat[batchid]'>$cusname</td>
<td align=center>$orddate</td>
<td align=center>$invdate</td>
<td align=center>".CUR." $dt[amount]</td>
<td align=center>$dt[terms] days</td>
<td align=center>".CUR." <input type=text name='paidamt[]' size=7 value='$bat[paidamt]'></td>
<td align=center><input type=hidden name='accpaid[]' value='$bat[accpaid]'>$acc[accname]</td>
</tr>";
}
$det =
"<center>
<h3>Process Debtors Batch Entries</h3>
<form action='".SELF."' method=post>
<input type=hidden name=key value=confirm>
<table border=0 cellpadding='".TMPL_tblCellPadding."' cellspacing='".TMPL_tblCellSpacing."'>
<tr><th>Customer Name</th><th>Order Date</th><th>Invoice Date</th><th>Outstanding Amount</th><th>Terms</th><th>Amount Paid</th><th>Account Paid</th></tr>
$pay
<tr><td><br></td></tr>
<tr><td align=right colspan=6><input type=button value='« Back' onClick='javascript:history.back()'></td><td align=right colspan=1><input type=submit value='Confirm Transactions »'></td></tr>
</form></table>
<table border=0 cellpadding='2' cellspacing='1' width=15%>
<tr><th>Quick Links</th></tr>
<tr bgcolor='#88BBFF'><td><a href='debtors-batch-view.php'>View Debtors batch</a></td></tr>
<tr bgcolor='#88BBFF'><td><a href='debtors-view.php'>View Debtors</a></td></tr>
<script>document.write(getQuicklinkSpecial());</script>
<tr bgcolor='#88BBFF'><td><a href='main.php'>Main Menu</a></td></tr>
</table>";
return $det;
}
# Confirm
function confirm($_POST)
{
# Get vars
foreach ($_POST as $key => $value) {
$$key = $value;
}
# validate input
require_lib("validate");
$v = new validate ();
foreach($ord as $key => $value){
$v->isOk ($ord[$key], "num", 1, 50, "Invalid order No. [$key]");
$v->isOk ($bat[$key], "num", 1, 50, "Invalid batch No. [$key]");
$v->isOk ($paidamt[$key], "float", 1, 20, "Invalid amount to be paid. [$key]");
$v->isOk ($accpaid[$key], "num", 1, 255, "Invalid account paid to. [$key]");
}
# display errors, if any
if ($v->isError ()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>".$e["msg"];
}
$confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
# connect to core
core_Connect();
$pay = "";
$tot = 0;
# Debtors
foreach($ord as $key => $value){
db_connect();
# Get all the details
$sql = "SELECT * FROM credit_invoices WHERE ordnum = '$ord[$key]'";
$invRslt = db_exec($sql) or errDie("Unable to access database.");
if (pg_numrows ($invRslt) < 1) {
return "<li class=err> - Invalid ord number $ord[$key].";
}
$inv = pg_fetch_array($invRslt);
# Get debt invoice info
$sql = "SELECT * FROM debtors WHERE ordnum ='$ord[$key]'";
$dtRslt = db_exec ($sql) or errDie ("Unable to retrieve invoice details from database.");
if (pg_numrows ($dtRslt) < 1) {
return "<li class=err>Invalid Invoice Number.";
}
$dt = pg_fetch_array($dtRslt);
foreach($inv as $keys => $values){
$$keys = $values;
}
# get paid account name
core_connect();
$sql = "SELECT accname FROM accounts WHERE accid = '$accpaid[$key]'";
$accRslt = db_exec($sql);
$acc = pg_fetch_array($accRslt);
foreach($inv as $keys => $values){
$$keys = $values;
}
$pay .= "<tr class='bg-odd'>
<td><input type=hidden size=20 name=ord[] value='$ord[$key]'>
<input type=hidden size=20 name=bat[] value='$bat[$key]'>$cusname</td>
<td align=center>$orddate</td>
<td align=center>$invdate</td>
<td align=center>".CUR." $dt[amount]</td>
<td align=center>$dt[terms] days</td>
<td align=center>".CUR." <input type=hidden name='paidamt[]' value='$paidamt[$key]'>$paidamt[$key]</td>
<td align=center><input type=hidden name='accpaid[]' value='$accpaid[$key]'>$acc[accname]</td>
</tr>";
$tot += $paidamt[$key];
}
$confirm =
"<center>
<h3>Process Debtors Batch Entries</h3>
<form action='".SELF."' method=post>
<input type=hidden name=key value=write>
<table border=0 cellpadding='".TMPL_tblCellPadding."' cellspacing='".TMPL_tblCellSpacing."'>
<tr><th>Customer Name</th><th>Order Date</th><th>Invoice Date</th><th>Outstanding Amount</th><th>Terms</th><th>Amount Paid</th><th>Account Paid</th></tr>
$pay
<tr><td><br></td></tr>
<tr class='bg-even'><td colspan=5>Total Amount Received</td><td colspan=2>".CUR." ".round($tot, 2)."</td></tr>
<tr><td align=right colspan=6><input type=button value='« Back' onClick='javascript:history.back()'></td><td align=right colspan=1><input type=submit value='Confirm »'></td></tr>
</form></table>
<table border=0 cellpadding='2' cellspacing='1' width=15%>
<tr><th>Quick Links</th></tr>
<tr bgcolor='#88BBFF'><td><a href='debtors-batch-view.php'>View Debtors batch</a></td></tr>
<tr bgcolor='#88BBFF'><td><a href='debtors-view.php'>View Debtors</a></td></tr>
<script>document.write(getQuicklinkSpecial());</script>
<tr bgcolor='#88BBFF'><td><a href='main.php'>Main Menu</a></td></tr>
</table>";
return $confirm;
}
# Write
function write($_POST)
{
# Get vars
foreach ($_POST as $key => $value) {
$$key = $value;
}
# validate input
require_lib("validate");
$v = new validate ();
foreach($ord as $key => $value){
$v->isOk ($ord[$key], "num", 1, 50, "Invalid order No. [$key]");
$v->isOk ($bat[$key], "num", 1, 50, "Invalid batch No. [$key]");
$v->isOk ($paidamt[$key], "float", 1, 20, "Invalid amount to be paid.[$key]");
$v->isOk ($accpaid[$key], "num", 1, 255, "Invalid account paid to.[$key]");
}
# display errors, if any
if ($v->isError ()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>".$e["msg"];
}
$confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
$pay = "";
# Debtors
foreach($ord as $key => $value){
db_connect();
# Get all the details
$sql = "SELECT * FROM credit_invoices WHERE ordnum = '$ord[$key]'";
$invRslt = db_exec($sql) or errDie("Unable to access database.");
if (pg_numrows ($invRslt) < 1) {
return "<li class=err> - Invalid ord number $ord[$key].";
}
$inv = pg_fetch_array($invRslt);
# Get debt invoice info
$sql = "SELECT * FROM debtors WHERE ordnum ='$ord[$key]'";
$dtRslt = db_exec ($sql) or errDie ("Unable to retrieve invoice details from database.");
if (pg_numrows ($dtRslt) < 1) {
return "<li class=err>Invalid Invoice Number.";
}
$dt = pg_fetch_array($dtRslt);
foreach($inv as $keys => $values){
$$keys = $values;
}
# get paid account name
core_connect();
$sql = "SELECT accname FROM accounts WHERE accid = '$accpaid[$key]'";
$accRslt = db_exec($sql);
$acc = pg_fetch_array($accRslt);
foreach($inv as $keys => $values){
$$keys = $values;
}
db_connect();
# reduce the money that has been paid
$sql = "UPDATE debtors SET amount = (amount - cast(float8 '$paidamt[$key]' as numeric)) WHERE ordnum = '$ord[$key]'";
$payRslt = db_exec($sql) or errDie("Unable to update debtors information in Cubit.",SELF);
$sql = "UPDATE debtors_batch SET proc='yes' WHERE batchid = '$bat[$key]'";
$Rs = db_exec($sql);
# get debtors account
$debtorsacc = gethook("accnum", "salesacc", "name", "Debtors");
$refnum = getrefnum();
/*refnum*/
# credit acc used debit acc paid
writetrans($accpaid[$key], $debtorsacc, date("d-m-Y"), $refnum, $paidamt[$key], "Payment received from debtor $cusname.");
$pay .= "<tr class='bg-odd'>
<td>$cusname</td>
<td align=center>$orddate</td>
<td align=center>$invdate</td>
<td align=center>".CUR." $dt[amount]</td>
<td align=center>$dt[terms] days</td>
<td align=center>".CUR." $paidamt[$key]</td>
<td align=center>$acc[accname]</td>
</tr>";
}
$write =
"<center>
<h3>Debtors Batch Entries Processed</h3>
<table border=0 cellpadding='".TMPL_tblCellPadding."' cellspacing='".TMPL_tblCellSpacing."'>
<tr><th>Customer Name</th><th>Order Date</th><th>Invoice Date</th><th>Outstanding Amount</th><th>Terms</th><th>Amount Paid</th><th>Account Paid</th></tr>
$pay
</table>
<br><br><br>
<table border=0 cellpadding='2' cellspacing='1' width=15%>
<tr><th>Quick Links</th></tr>
<tr bgcolor='#88BBFF'><td><a href='debtors-batch-view.php'>View Debtors batch</a></td></tr>
<tr bgcolor='#88BBFF'><td><a href='debtors-view.php'>View Debtors</a></td></tr>
<script>document.write(getQuicklinkSpecial());</script>
<tr bgcolor='#88BBFF'><td><a href='main.php'>Main Menu</a></td></tr>
</table>";
return $write;
}
# Write Trans(debit_account_id, credit_account_id, date, refnum, amount_[11111.00], details)
function writetrans($dtacc, $ctacc, $date, $refnum, $amount, $details)
{
# validate input
require_lib("validate");
$v = new validate ();
$v->isOk ($ctacc, "num", 1, 50, "Invalid Account to be Credited.");
$v->isOk ($dtacc, "num", 1, 50, "Invalid Account to be Debited.");
$v->isOk ($date, "date", 1, 14, "Invalid date.");
$v->isOk ($refnum, "num", 1, 50, "Invalid reference number.");
$v->isOk ($amount, "float", 1, 20, "Invalid Amount.");
$v->isOk ($details, "string", 0, 255, "Invalid Details.");
# display errors, if any
if ($v->isError ()) {
$write = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$write .= "<li class=err>".$e["msg"];
}
$write .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $write;
}
# date format
$date = explode("-", $date);
$date = $date[2]."-".$date[1]."-".$date[0];
# begin sql transaction
# pglib_transaction ("BEGIN") or errDie("Unable to start a database transaction.",SELF);
// Insert the records into the transect table
db_conn(PRD_DB);
$sql = "INSERT INTO transect(debit, credit, date, refnum, amount, author, details) VALUES('$dtacc', '$ctacc', '$date', '$refnum', '$amount', '".USER_NAME."', '$details')";
$transRslt = db_exec($sql) or errDie("Unable to insert Transaction details to database",SELF);
// Update the balances by adding appropriate values to the trial_bal Table
core_connect();
$ctbal = "UPDATE trial_bal SET credit = (credit + '$amount') WHERE accid = '$ctacc'";
$dtbal = "UPDATE trial_bal SET debit = (debit + '$amount') WHERE accid = '$dtacc'";
$ctbalRslt = db_exec($ctbal) or errDie("Unable to update credit balance for credited account.",SELF);
$dtbalRslt = db_exec($dtbal) or errDie("Unable to update debit balance for debited account.",SELF);
# commit sql transaction
# pglib_transaction ("COMMIT") or errDie("Unable to finish a database transaction.",SELF);
}
# Confirm
function rembat($_POST)
{
# Get vars
foreach ($_POST as $key => $value) {
$$key = $value;
}
# validate input
require_lib("validate");
$v = new validate ();
if(isset($ord)){
foreach($ord as $key => $value){
$v->isOk ($ord[$key], "num", 1, 50, "Invalid Batch No.");
}
}else{
return "<li> - No Credit Purchases Seleted. Please select at least one entry.";
}
# display errors, if any
if ($v->isError ()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>".$e["msg"];
}
$confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
# connect to core
core_Connect();
$pay = "";
# Debtors
foreach($ord as $key => $value){
db_connect();
$sql = "SELECT * FROM debtors_batch WHERE batchid = '$ord[$key]'";
$batRslt = db_exec($sql);
$bat = pg_fetch_array($batRslt);
# Get all the details
$sql = "SELECT cusname, orddate, invdate FROM credit_invoices WHERE ordnum = '$bat[ordnum]'";
$invRslt = db_exec($sql) or errDie("Unable to access database.");
if (pg_numrows ($invRslt) < 1) {
return "<li class=err> - Invalid Invoice Number. 1";
}
$inv = pg_fetch_array($invRslt);
# Get debt invoice info
$sql = "SELECT amount,terms FROM debtors WHERE ordnum ='$bat[ordnum]'";
$dtRslt = db_exec ($sql) or errDie ("Unable to retrieve invoice details from database.");
if (pg_numrows ($dtRslt) < 1) {
return "<li class=err> - Invalid Invoice Number. 2";
}
$dt = pg_fetch_array($dtRslt);
foreach($inv as $keys => $values){
$$keys = $values;
}
# get paid account name
core_connect();
$sql = "SELECT accname FROM accounts WHERE accid = '$bat[accpaid]'";
$accRslt = db_exec($sql);
$acc = pg_fetch_array($accRslt);
foreach($inv as $keys => $values){
$$keys = $values;
}
$pay .= "<tr class='bg-odd'>
<td><input type=hidden name=bats[] value='$bat[batchid]'>$cusname</td>
<td align=center>$orddate</td>
<td align=center>$invdate</td>
<td align=center>".CUR." $dt[amount]</td>
<td align=center>$dt[terms] days</td>
<td align=center>".CUR." $bat[paidamt]</td>
<td align=center>$acc[accname]</td>
</tr>";
}
$det =
"<center>
<h3>Remove Debtors Batch Entries</h3>
<form action='".SELF."' method=post>
<input type=hidden name=key value=writerem>
<table border=0 cellpadding='".TMPL_tblCellPadding."' cellspacing='".TMPL_tblCellSpacing."'>
<tr><th>Customer Name</th><th>Order Date</th><th>Invoice Date</th><th>Outstanding Amount</th><th>Terms</th><th>Amount Paid</th><th>Account Paid</th></tr>
$pay
<tr><td><br></td></tr>
<tr><td align=right colspan=6><input type=button value='« Back' onClick='javascript:history.back()'></td><td align=right colspan=1><input type=submit value='Confirm Transactions »'></td></tr>
</form></table>
<table border=0 cellpadding='2' cellspacing='1' width=15%>
<tr><th>Quick Links</th></tr>
<tr bgcolor='#88BBFF'><td><a href='debtors-batch-view.php'>View Debtors batch</a></td></tr>
<tr bgcolor='#88BBFF'><td><a href='debtors-view.php'>View Debtors</a></td></tr>
<script>document.write(getQuicklinkSpecial());</script>
<tr bgcolor='#88BBFF'><td><a href='main.php'>Main Menu</a></td></tr>
</table>";
return $det;
}
# Write
function writerem($_POST)
{
# Get vars
foreach ($_POST as $key => $value) {
$$key = $value;
}
# validate input
require_lib("validate");
$v = new validate ();
foreach($bats as $key => $value){
$v->isOk ($bats[$key], "num", 1, 50, "Invalid batch No.");
}
# display errors, if any
if ($v->isError ()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>".$e["msg"];
}
$confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
# connect to core
core_Connect();
$pay = "";
# Debtors
foreach($bats as $key => $value){
db_connect();
$sql = "SELECT * FROM debtors_batch WHERE batchid = '$bats[$key]'";
$batRslt = db_exec($sql);
$bat = pg_fetch_array($batRslt);
# Get all the details
$sql = "SELECT cusname, orddate, invdate FROM credit_invoices WHERE ordnum = '$bat[ordnum]'";
$invRslt = db_exec($sql) or errDie("Unable to access database.");
if (pg_numrows ($invRslt) < 1) {
return "<li class=err> - Invalid Invoice Number. 1";
}
$inv = pg_fetch_array($invRslt);
# Get debt invoice info
$sql = "SELECT amount,terms FROM debtors WHERE ordnum ='$bat[ordnum]'";
$dtRslt = db_exec ($sql) or errDie ("Unable to retrieve invoice details from database.");
if (pg_numrows ($dtRslt) < 1) {
return "<li class=err> - Invalid Invoice Number. 2";
}
$dt = pg_fetch_array($dtRslt);
foreach($inv as $keys => $values){
$$keys = $values;
}
# get paid account name
core_connect();
$sql = "SELECT accname FROM accounts WHERE accid = '$bat[accpaid]'";
$accRslt = db_exec($sql);
$acc = pg_fetch_array($accRslt);
foreach($inv as $keys => $values){
$$keys = $values;
}
db_connect();
$sql = "DELETE FROM debtors_batch WHERE batchid = '$bat[batchid]'";
$Rs = db_exec($sql);
$pay .= "<tr class='bg-odd'>
<td>$cusname</td>
<td align=center>$orddate</td>
<td align=center>$invdate</td>
<td align=center>".CUR." $dt[amount]</td>
<td align=center>$dt[terms] days</td>
<td align=center>".CUR." $bat[paidamt]</td>
<td align=center>$acc[accname]</td>
</tr>";
}
$det = "<center><h3>Debtors Batch Entries Removed</h3>
<table border=0 cellpadding='".TMPL_tblCellPadding."' cellspacing='".TMPL_tblCellSpacing."'>
<tr><th>Customer Name</th><th>Order Date</th><th>Invoice Date</th><th>Outstanding Amount</th><th>Terms</th><th>Amount Paid</th><th>Account Paid</th></tr>
$pay
</table>
<br><br><br>
<table border=0 cellpadding='2' cellspacing='1' width=15%>
<tr><th>Quick Links</th></tr>
<tr bgcolor='#88BBFF'><td><a href='debtors-batch-view.php'>View Debtors batch</a></td></tr>
<tr bgcolor='#88BBFF'><td><a href='debtors-view.php'>View Debtors</a></td></tr>
<script>document.write(getQuicklinkSpecial());</script>
<tr bgcolor='#88BBFF'><td><a href='main.php'>Main Menu</a></td></tr>
</table>";
return $det;
}
?>