#!/usr/bin/perl

print "Content-type: text/html\n\n";

BEGIN { use lib '/usr/home/cfg' ; require push_inc ; }
    
require cfg ;

&today ;

#------------------------------------------------------------------------------------------

use DBI;
use CGI::Carp qw(fatalsToBrowser);

&admin_db_clients_table ;

exit ;

#------------------------------------------------------------------------------------------

sub admin_db_clients_table {

&db_open_ro ;

my $sql = qq(SELECT * FROM ffwaypls_filmfreight.clients ORDER BY client) ;

my $sth = $dbh->prepare($sql) ;

$sth -> execute() or die "Could not execute SQL statement $sql ... maybe invalid? $!";
$clients_array_ref = $sth->fetchall_arrayref();

$sth->finish();

&db_close_conn ;

foreach $row (@$clients_array_ref) {

    $cl_client          = @$row[0] ;
    $cl_accno           = @$row[1] ;
    $cl_branc           = @$row[2] ;     
    $cl_postal_address  = @$row[20] ;     
    $cl_contact1        = @$row[21] ;     
    $cl_email1          = @$row[23] ;     
    
    $line = qq(<br>$cl_client, $cl_accno, $cl_branc, $cl_postal_address, $cl_contact1, $cl_email1) ;
    
    if ($done{$cl_client}) { print $done{$cl_client} . $line . "<br>" ; }
    $done{$cl_client} = $line ;    
    
    # if ($done{$cl_accno}) { print "DUPLICATE" . $done{$cl_accno} . $line ; }    
    # $done{$cl_accno} = $line ;     
    }
    


} #------------------------------------------------------------------------------------------

use db ;
use today ;

1;