#!/usr/local/bin/perl
#
###############################################################################
#
#       Name    : pickModNum.pl
#       Author	: Bryan R. Cummings
#       Date    : Thursday, December 20, 1998 
#       Path    : 
#	Version : 1.0
#	Platform: Unix and Oraperl with Perl5.0004 installed.
#       Email   : bcummings@clearmark.com
#	Notes   : A script to let the user pick a valid model number in Oracle 7.3
#
#       Coded and Designed for Carrier Corporation, for the Carrier IWCP Project
# 
#	Copyright (C) 1998,  ClearMark Incorporated, All Rights Reserved.
#
#       
#
################################################################################
#
#
$DEBUG = 0;
require 'getopts.pl';

use Oraperl;

#path will change when migrating to sunrise

require '/project/clearmark/iwcp/cgi-bin/pl/user_specs.pl'; 
require '/project/clearmark/iwcp/cgi-bin/pl/cookie.lib';
require '/project/clearmark/iwcp/cgi-bin/pl/iwcp.lib';
# ===== HTML setup ======
print "Content-type: text/html\n";
# ===== HTML setup ======

# ===== oraperl setup ========
  &oracle_login;
# ===== oraperl setup ========  

# =================== body of program ========================   
&formParse;

if($FORM{org_group} eq 'DI')
{       
    $enteredByDistributor="Y";
}       
else
{
    $enteredByDistributor="N";
}

$INSERT_INTO_WC = "INSERT INTO WARRENTYCLAIMS (CLAIM_NUM, REC_TYPE, 
                   PROCESSDATE, PROCESSTIME, DEALER_NUM, Dealer_Name, DISTRIBUTOR_NUM, 
		   WARRENTY_STATUS, Web_DealerStatus, Web_DealerAction, EnteredByDistributor)
           VALUES ('$FORM{claim_num}','1','$FORM{date}','$FORM{time}','$FORM{dealer_num}',
		  '$FORM{dealer_name}','$FORM{distributor_num}','$FORM{warranty_status}',
                  'INCOMPLETE','HOLD','$enteredByDistributor')";
                
&ora_do($lda, $INSERT_INTO_WC);
&ora_commit($lda);
                
if ($FORM{org_group} eq "WA")
{       
    &SetCookies('sca_num', $FORM{claim_num}, 'serial_num', $FORM{serial_num}, 
'model_num',$FORM{model_num},'warrantyStatus', $FORM{warrantyStatus},'comp_equip',
$FORM{comp_equip},'contract_num', $FORM{contract_num});

    print "\n";
    &claimEntryFormWA;
}    
elsif ($FORM{org_group} eq 'DL')
{
    &SetCookies('sca_num', $FORM{claim_num}, 'serial_num', $FORM{serial_num}, 'model_num',
$FORM{model_num},'warrantyStatus', $FORM{warrantyStatus},'comp_equip',
$FORM{comp_equip},'contract_num',$FORM{contract_num});
    print "\n";
    &claimEntryFormDL;
}
else
{
   &SetCookies('sca_num', $FORM{claim_num}, 'serial_num', $FORM{serial_num}, 'model_num',
$FORM{model_num},'warrantyStatus', $FORM{warrantyStatus}, 'comp_equip', $FORM{comp_equip},
'contract_num',$FORM{contract_num});
    print "\n";
    &claimEntryFormDI;
}
# ================= oraperl cleanup ========================
# log out of the database (this is ESSENTIAL!)
  do ora_logoff($lda)                           || die $ora_errstr;
# ==============  end of oraperl cleanup ==========================
exit;
#=================== start of subroutines ================================
sub claimEntryFormWA
{
        print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n";
        print "<HTML>";
        print "<HEAD>";
        print "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html;CHARSET=iso-8859-1\">\n";
        print "<TITLE>Claim New Entry</TITLE>";
        print "</HEAD>";
        print "<FRAMESET   COLS = \"140,100% \"   BORDER=\"8\" FRAMESPACING=\"8\" FRAMEBORDER=\"YES\">";
     print "<FRAME SRC=\"$baseurl/claim_new_entry_wa/dialog_content.html\" NAME=\"dialogContent\" RESIZE>";
        print "<FRAME SRC=\"$baseurl/claim_new_entry_wa/form_10.html\" NAME=\"formContent\" RESIZE>";
        print "</FRAMESET>\n";
        print "<NOFRAMES>\n";
        print "<BODY bgcolor=#FFFFFF>\n";
        print "<P></BODY>\n";
        print "</NOFRAMES>\n";
        print "</HTML>\n";
}
sub claimEntryFormDL
{
        print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n";
        print "<HTML>";
        print "<HEAD>";
        print "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html;CHARSET=iso-8859-1\">\n";
        print "<TITLE>Claim New Entry DL</TITLE>";
        print "</HEAD>";
        print "<FRAMESET   COLS = \"140,100% \"   BORDER=\"8\" FRAMESPACING=\"8\" FRAMEBORDER=\"YES\">";
     print "<FRAME SRC=\"$baseurl/claim_new_entry_dl/dialog_content.html\" NAME=\"dialogContent\" RESIZE>";
        print "<FRAME SRC=\"$baseurl/claim_new_entry_dl/form_10.html\" NAME=\"formContent\" RESIZE>";
        print "</FRAMESET>\n";
        print "<NOFRAMES>\n";
        print "<BODY bgcolor=#FFFFFF>\n";
        print "<font color=\"red\">You must have a frames capable browser to properly view the contents of this site.</font>\n"; 
        print "<P></BODY>\n";
        print "</NOFRAMES>\n";
        print "</HTML>\n";
        
}
sub claimEntryFormDI
{
        print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n";
        print "<HTML>";
        print "<HEAD>";
        print "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html;CHARSET=iso-8859-1\">\n";
        print "<TITLE>Claim New Entry</TITLE>";
        print "</HEAD>";
        print "<FRAMESET   COLS = \"140,100% \"   BORDER=\"8\" FRAMESPACING=\"8\" FRAMEBORDER=\"YES\">";
     print "<FRAME SRC=\"$baseurl/claim_new_entry_DI/dialog_content.html\" NAME=\"dialogContent\" RESIZE>";
        print "<FRAME SRC=\"$baseurl/claim_new_entry_DI/form_10.html\" NAME=\"formContent\" RESIZE>";
        print "</FRAMESET>\n";
        print "<NOFRAMES>\n";
        print "<BODY bgcolor=#FFFFFF>\n";
        print "<P></BODY>\n";
        print "</NOFRAMES>\n";
        print "</HTML>\n";
}
