##-----------------------------------------------------------##
## INSERT AUDIT TRAIL.                                       ##
##-----------------------------------------------------------##

sub insert_audit_trail {

$SYSDT1   = `date +%Y/%m/%d`;
chop($SYSDT1);
$SYSDT2   = `date +%T`;
chop($SYSDT2);

$SYSDATE = $SYSDT1." ".$SYSDT2;

$sql_stmt = "
 insert into genfin_dbo.tces_audit  
      ( ldapid
      , script_name
      , broker
      , entry_nbr
      , image_name
      , ship_date
      , import_date
      , export_date
      , ctry_exp   
      , import_port
      , doc_type
      , entry_class
      , duty_type
      , import_acct_nbr
      , lead_tracking_nbr
      , ship_nbr
      , folder_name
      , db_upd_d
      , f_rpt_c 
      , f_srt_c 
      )
 values 
      ( '$LOGON'
      , '$SCRIPT'
      , '$input{'BRK'}'
      , '$input{'CCN'}'
      , '$input{'KEY1'}'
      , '$input{'SHD'}'
      , '$input{'IMD'}'
      , '$input{'EXD'}'
      , '$input{'EC2'}'
      , '$input{'IPP'}'
      , '$input{'DT1'}'
      , '$input{'EC1'}'
      , '$input{'DT2'}'
      , '$input{'IAN'}'
      , '$input{'LTN'}'
      , '$input{'SHP'}'
      , '$CDNBR'
      , '$SYSDATE'
      , '$input{'RPT'}'
      , '$input{'MT1'}'
        )
    ";

#print "<PRE>CMD:",$sql_stmt;

$stmt = $dbh->prepare("
     $sql_stmt
      ") or DBI::errstr;

$stmt->execute() ;

##$stmt->finish;

##-----------------------------------------------##
##  END OF SUB-ROUTINE.         
##-----------------------------------------------##

 }

1;
