#!/usr/bin/perl use vars qw(%config %form %globals $dbh %mon_val); use DBI; use CGI; use Time::Local; use Net::SMTP; if($ENV{'OS'} =~ /win/i) { use lib "/home3/indiamart/public_html/mycgi/jindalb2bportal/member"; }else { #use lib "/home3/indiamart/public_html/mycgi/test-jindalstainless/member"; use lib "/home3/indiamart/public_html/mycgi/jindalstainless/member"; } require "config.pl"; $q = new CGI; #-######################## # Main Program # #-######################## foreach $key($q->param()) { $form{$key} = $q->param($key); } if ($form{'action'} eq 'member_reg') { # require "procreg.pl"; } elsif ($form{'action'} eq 'member_login') { # require "login.pl"; } elsif ($form{'action'} eq 'member_login_catalog') { # require "login-catalog.pl"; } elsif ($form{'action'} eq 'check_login') { # require "check-login.pl"; } elsif ($form{'action'} eq 'logout') { # require "logout.pl"; } elsif ($form{'action'} eq 'show_profile') { # require "show_profile.pl"; } elsif ($form{'action'} eq 'update_profile') { # require "update_profile.pl"; } elsif ($form{'action'} eq 'lostpass') { require "lostpass.pl"; } elsif ($form{'action'} eq 'lostuid') { require "lostuid.pl"; } elsif ($form{'action'} eq 'proc_material') { # require "proc-material.pl"; } elsif ($form{'action'} eq 'start_rfq') { # require "proc-material.pl"; } elsif ($form{'action'} eq 'proc_gc') { # require "proc-material.pl"; } elsif ($form{'action'} eq 'proc_material_catalog') { # require "proc-material-catalog.pl"; } elsif ($form{'action'} eq 'proc_rfq') { # require "proc-rfq.pl"; } elsif ($form{'action'} eq 'proc_final_rfq') { # require "proc-rfq.pl"; } elsif ($form{'action'} eq 'proc_rfaq1') { # require "proc-material.pl"; } elsif ($form{'action'} eq 'proc_rfaq2') { # require "proc-material.pl"; } elsif ($form{'action'} eq 'confirm_mail') { # to get confirmation to send mail require "confirm_mail.pl"; } elsif ($form{'action'} eq 'track_enquiry') { # require "track-enquiry.pl"; } elsif ($form{'action'} eq 'track_enquiry_again') { # require "track-enquiry.pl"; } elsif ($form{'action'} eq 'track_order') { # require "track-order.pl"; } elsif ($form{'action'} eq 'track_order_again') { # require "track-order.pl"; } elsif ($form{'action'} eq 'track_order_login') { # require "track-order.pl"; } elsif ($form{'action'} eq 'view_enquiry_details') { # require "view-enquiry-details.pl"; } elsif ($form{'action'} eq 'view_ed') { # require "view-ed.pl"; } elsif ($form{'action'} eq 'show_ed') { # require "view-ed.pl"; } elsif ($form{'action'} eq 'send_query') { # require "send-query.pl"; } elsif ($form{'action'} eq 'submit_query') { # require "submit-query.pl"; } elsif ($form{'action'} eq 'negotiation_detail') { # require "negotiation-detail.pl"; } elsif ($form{'action'} eq 'view_offer_details') { # require "offer-details.pl"; } elsif ($form{'action'} eq 'reply_query') { # require "reply-query.pl"; } elsif ($form{'action'} eq 'submit_reply') { # require "submit-reply.pl"; } elsif ($form{'action'} eq 'send_purchase_order') { # require "send-po.pl"; } elsif ($form{'action'} eq 'submit_po') { # require "submit-po.pl"; } elsif ($form{'action'} eq 'view_po') { # require "view-po.pl"; } elsif ($form{'action'} eq 'view_oa') { # require "view-oa.pl"; } elsif ($form{'action'} eq 'cancel_enquiry') { # require "cancel-enquiry.pl"; } elsif ($form{'action'} eq 'view_invoice') { # require "view-invoice.pl"; } elsif ($form{'action'} eq 'consult_us') { # require "consult-us.pl"; } elsif ($form{'action'} eq 'view_po_status') { # require "view-po-status.pl"; } elsif ($form{'action'} eq 'submit_os_query') { # require "submit-os-query.pl"; } elsif ($form{'action'} eq 'view_os') { # require "view-os.pl"; } elsif ($form{'action'} eq 'get_grade') { # require "get-grade.pl"; } elsif ($form{'action'} eq 'view_seller_form') { # require "view-seller-form.pl"; } elsif ($form{'action'} eq 'submit_seller_form') { # require "submit-seller-form.pl"; } elsif ($form{'action'} eq 'procurement_form') { # require "procurement.pl"; } elsif ($form{'action'} eq 'show_grade_details') { # require "show-grade-details.pl"; } elsif ($form{'action'} eq 'show_catalog') { # require "show-catalog-new.pl"; } elsif ($form{'action'} eq 'show_catalog') { # require "show-catalog.pl"; } elsif ($form{'action'} eq 'show_catalog') { # require "show-catalog.pl"; } elsif ($form{'action'} eq 'show_mech') { # require "show-mech.pl"; } elsif ($form{'action'} eq 'show_chem') { # require "show-chem.pl"; } else { print "Location: index.html\n\n"; } ################################# # Describe Error of database # ################################# sub dataerror { &sendemail("mysqlerror\@indiamart.com", "MySQL Error at Jindal Stainless", "ALERT! Some error has occured in database jindalb2bportal due to file $_[1] on line $_[2].\n\n Message is $_[0] \n\n Please try to resolve it."); exit; } ############################################### # To get date in format : yyyy-mm-dd hh:mm:ss # ############################################### sub getDate { my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time); my $ampm = "a.m."; if ($hour eq 12) { $ampm = "p.m."; } if ($hour eq 0) { $hour = "12"; } if ($hour > 12) { $hour = ($hour - 12); $ampm = "p.m."; } if ($min < 10) { $min = "0$min"; } $year = 1900+$year; ##### as $ mon start from 0 for Janurary $mon = $mon + 1; $daydate = "$year-$mon-$mday"; #### $daydate1 = $daydate." "."$hour\:$min\:$sec"; return $daydate; } #-############################################# # Sub: Read Reg File (alias) # Reads a registration file sub read_reg_file { my $username = shift; return '' unless $username; # verify the user exists &oops('Your alias may not contain any non-word characters.') if $username =~ /\W/; &Db_connect(); my($st3, $sth3, $user_details, $no_user, $error_no); my $no_user = 0; my $error_no = 0; my $st3 = "select * from members where (username='$username' and user_status='TRUE')"; my $sth3 = $dbh->prepare($st3); if(!$sth3) { $error_no += 1; dataerror($dbh->errstr); } if(!($sth3->execute)) { $error_no += 1; dataerror($dbh->errstr); } if($user_details = $sth3->fetchrow_hashref){ $no_user += 1; } if($no_user != 1) { print "Content-type: text/html\n\n"; print "
Sorry, This username does not exist. Visit the Home Page to Sign Up.


Return to Index page"; exit; }# end if if($error_no != 0){ my $message = "Sorry! Some error has occured internally. Please try after some time."; print $message; exit; } $sth3->finish; &Db_disconnect(); return $user_details; } #-############################################# # Sub: Read User details sub read_user_file { my($st_user, $sth_user, $u_details, $no_user, $error_no); my $no_user = 0; my $error_no = 0; my $st_user = "select *,country_name from members,country where (userid = $_[0] and user_status='TRUE' and country_id=members.country)"; my $sth_user = $dbh->prepare($st_user); if(!$sth_user) { $error_no += 1; #print "$dbh->errstr"; #exit; dataerror($dbh->errstr,$_[1],$_[2]); } if(!($sth_user->execute)) { $error_no += 1; #print "$dbh->errstr"; #exit; dataerror($dbh->errstr,$_[1],$_[2]); } if($u_details = $sth_user->fetchrow_hashref){ $no_user += 1; } if($no_user != 1) { print "Content-type: text/html\n\n"; &print_filecontent($config{'headerfile'}); print "

Sorry, This User does not exist. Visit the Home Page to Sign Up.


Return to Index page

"; &print_filecontent($config{'footerfile'}); exit; }# end if if($error_no != 0){ my $message = "Sorry! Some error has occured internally. Please try after some time."; print $message; exit; } $sth_user->finish; if($u_details->{'country_id'} eq "IN") { my $state_name = &get_single_value("select state_name from state where state_id = '$u_details->{'state'}'"); $u_details->{'state_name'} = " ($state_name)"; } else { $u_details->{'state_name'} = " "; } return $u_details; } #-############################################# # Sub: Get cookie & info related to user sub read_cookie_info { $oldcookie = $q->cookie("$config{'cookiename'}"); if($oldcookie != "") { my ($st, $sth, %user_details, $no_user); $no_user = 0; &Db_connect(); ######## code to check whether y user of this name already exists or not. $st = "select * from members where userid = '$oldcookie' and (user_type = 'buyer' or user_type = 'seller' or user_type = 'both')"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st); } if (!($sth->execute)) { dataerror($dbh->errstr.$st); } if($user_details = $sth->fetchrow_hashref) { $no_user += 1; } $realname = $user_details->{'realname'}; $sth->finish; &Db_disconnect(); if($no_user != 1) { print "Content-type: text/html\n\n"; print "Location: index.html\n\n"; exit; }# end if } else { print "Content-type: text/html\n\n"; print "Location: index.html\n\n"; exit; }# end else return $user_details; } #-########################################### # Sub: Print the error message and exit sub oops { ##print "Content-type: text/html\n\n"; &print_filecontent($config{'headerfile'}); print "

$_[0]

"; print "

Please return to Previous Page.


"; &print_filecontent($config{'footerfile'}); exit; } #-########################################################## # Sub: Get cookie & check whether user is login or logout #-########################################################## sub check_cookie { $oldcookie = $q->cookie("$config{'cookiename'}"); if($oldcookie == "") { print "Location: index.html\n\n"; exit; }# end if return true; } ############################# # Code to send MAIL to Admin # ############################# sub sendemail { my ($email_from, $subject, $mail_message, $email_to, @split_email_to, $email_cc); $email_from = $_[0]; $subject = $_[1]; $mail_message = $_[2]; $email_cc=$_[5]; #### Breaking $email_to into two parts, so that we can create to & cc mail id. my @split_email_to = split(/,\s/,$_[3]); if($#split_email_to <= 0) { $email_to = $_[3]; } elsif($#split_email_to >= 1) { $email_to = $split_email_to[0]; for($i=1;$i<=$#split_email_to;$i++) { $email_cc .= $split_email_to[$i]; if($#split_email_to > $i) { $email_cc .= ", "; } } } if($ENV{'OS'} =~ /win/i) { $smtp = Net::SMTP->new($config{'mail_server'}); $smtp->mail($email_to); $smtp->to($email_to); if($#split_email_to >= 1) { $smtp->to($email_cc); } $smtp->to($config{'admin_address'}); $smtp->data(); $smtp->datasend("To: $email_to \n"); $smtp->datasend("Cc: $email_cc\n"); $smtp->datasend("From: www.jindalstainless.com <$email_from>\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n"); $smtp->datasend("$mail_message\n\n"); $smtp->dataend(); $smtp->quit; } else { $mailprog = "/usr/lib/sendmail -t"; open(MAIL, "|$mailprog") || print "Can't open $mailprog : $!"; print MAIL "To: $email_to \n"; if($#split_email_to >= 1) { print MAIL "Cc: $email_cc \n"; } print MAIL "Bcc: $config{'myaddress'} \n"; print MAIL "From: $email_from \n"; print MAIL "Subject: $subject \n\n"; print MAIL "$mail_message \n"; close(MAIL); } return true; } ### end code ############################# # Code to send MAIL to User # ############################# sub sendemail_user { my ($email, $subject, $mail_message); $email = $_[0]; $subject = $_[1]; $mail_message = $_[2]; if($ENV{'OS'} =~ /win/i) { $smtp = Net::SMTP->new($config{'mail_server'}); $smtp->mail($config{'admin_address'}); $smtp->to($email); $smtp->data(); $smtp->datasend("To: $email \n"); $smtp->datasend("From: www.jindalstainless.com <$config{'admin_address'}>\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n"); $smtp->datasend("$mail_message\n\n"); $smtp->dataend(); $smtp->quit; } else { $mailprog = "/usr/lib/sendmail -t"; open(MAIL, "|$mailprog") || print "Can't open $mailprog : $!"; print MAIL "To: $email \n"; print MAIL "From: $config{'admin_address'} \n"; print MAIL "Subject: $subject \n\n"; print MAIL "$mail_message \n"; close(MAIL); } return true; } ### end code ##################################################### # Read the file & store it in a variable & print it # ##################################################### sub print_filecontent { my @source; open(SOURCEFILE,$config{'rootpath'}.$_[0]) or die "Can't open file: $!"; undef $/; $source_val = ; close(SOURCEFILE); if ($ENV{'QUERY_STRING'} eq 'action=check_login') { $source_val =~ s/

Return to Main Menu<\/H4><\/A>//igs; } if (!$ENV{'QUERY_STRING'}) { $source_val =~ s/

Return to Main Menu<\/H4><\/A>//igs; } print $source_val; return true; } ######################################################### # get all grade from grades table to show in drop down # ######################################################### sub get_all_grade_html { my($st, $sth, %grade_details, $grade_html); $st = "select * from grades where (grade_status = 'yes' && $_[0] != '')"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st,$_[1],$_[2]); } if (!($sth->execute)) { dataerror($dbh->errstr.$st,$_[1],$_[2]); } $grade_html = ""; #print "$st

$grade_html
"; return $grade_html; } ######################################################### # get all grade country from grades table # ######################################################### sub get_grade_html { my($st, $sth, $grade_details, $grade_country_html); $st = "select * from grades where grade_status = 'yes'"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st,$_[0],$_[1]); } if (!($sth->execute)) { dataerror($dbh->errstr.$st,$_[0],$_[1]); } my $i=0; while($grade_details = $sth->fetchrow_hashref) { my $bgcolor; if($i % 2 ==0) { $bgcolor = "#FFFFE8"; } else { $bgcolor = "#ECE8CE"; } $grade_country_html .="
{'grade_id'}\" TARGET=\"_NEW\" OnMouseOver=\"Javascript: window.status='Grade Details'\" OnMouseOut=\"Javascript: window.status=''\">$grade_details->{'grade_jindal'}   $grade_details->{'grade_astm'}  $grade_details->{'grade_is_letter'}   $grade_details->{'grade_is_numeric'}   $grade_details->{'grade_uns'}   $grade_details->{'grade_germany'}   $grade_details->{'grade_japan'}   $grade_details->{'grade_ussr'}   "; $i++; } return $grade_country_html; } ######################################################### # get all grade country from grades table # ######################################################### sub get_grade_html_new { my($st, $sth, $grade_details, $grade_country_html); $st = "select * from grades where grade_status = 'yes'"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st,$_[0],$_[1]); } if (!($sth->execute)) { dataerror($dbh->errstr.$st,$_[0],$_[1]); } my $i=0; while($grade_details = $sth->fetchrow_hashref) { my $bgcolor; if($i % 2 ==0) { $bgcolor = "#EAF6FF"; } else { $bgcolor = "#B9E0FD"; } $grade_country_html .=" {'grade_id'}\" TARGET=\"_NEW\" OnMouseOver=\"Javascript: window.status='Grade Details'\" OnMouseOut=\"Javascript: window.status=''\">$grade_details->{'grade_jindal'}   $grade_details->{'grade_astm'}  $grade_details->{'grade_is_letter'}   $grade_details->{'grade_is_numeric'}   $grade_details->{'grade_uns'}   $grade_details->{'grade_germany'}   $grade_details->{'grade_japan'}   $grade_details->{'grade_ussr'}   "; $i++; } return $grade_country_html; } ############################################################################ # get all grade from grades table to show in drop down with selected grade # ############################################################################ sub get_selected_grade_html { my($st, $sth, $grade_details, $grade_html); $st = "select * from grades where grade_status = 'yes'"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st); } if (!($sth->execute)) { dataerror($dbh->errstr.$st); } $grade_html = ""; return $grade_html; } ############################################################ # get all product from products table to show in drop down # ############################################################ sub get_all_product_html { my($st, $sth, %product_details, $product_html, $pcount, @parr, @product_arr, %phash); $pcount = 0; $st = "select * from products where product_status = 'yes'"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st,$_[0],$_[1]); } if (!($sth->execute)) { dataerror($dbh->errstr.$st,$_[0],$_[1]); } ###$product_html = " "; while($product_details = $sth->fetchrow_hashref) { my $id = $product_details->{'product_id'}; my $pshape = $product_details->{'product_shape'}; $product_html .= ""; $parr[$pcount++] = $id; ###$phash{$id} = $pshape; } $sth->finish; $product_html .= ""; @product_arr = ($product_html, @parr); return @product_arr; } ################################################################################# # get all product from products table to show in drop down with selected option # ################################################################################# sub get_selected_product_html { my($st, $sth, $product_details, $product_html); $st = "select * from products where product_status = 'yes'"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st); } if (!($sth->execute)) { dataerror($dbh->errstr.$st); } if($_[1] ne "") { $product_html = ""; } $product_html .= ""; while($product_details = $sth->fetchrow_hashref) { my $id = $product_details->{'product_id'}; my $pshape = $product_details->{'product_shape'}; if($id == $_[0]) { if($_[1] ne "") { $product_html .= ""; } else { $product_html .= ""; } } else { if($_[1] ne "") { $product_html .= ""; } else { $product_html .= ""; } } } $sth->finish; $product_html .= ""; return $product_html; } #-####################################################### #- Get all grade_product_no for a temp_enq_no # #-####################################################### sub get_temp_rfq_record_html { my($temp_grade_product_details, $g_name, $p_name, $s_f_name, $e_c_name); my($temp_rfq_record_html, $check_html, $check_text_ns, $col_val, $dim_unit, $wt_unit); $temp_grade_product_details = &get_details("select * from temp_grade_product_enquiry where temp_grade_product_no = '$_[0]'",$_[7],$_[8]); if($temp_grade_product_details->{'grade_id'} != 0) { $g_name = &get_single_value("select $_[6] from grades where grade_id='$temp_grade_product_details->{'grade_id'}'",$_[7],$_[8]); } elsif($temp_grade_product_details->{'grade_id'} == 0) { $g_name = "-"; } $p_name = &get_single_value("select product_name from products where product_id='$temp_grade_product_details->{'product_id'}'",$_[7],$_[8]); my $s_f_name = &get_single_value("select surface_finish_name from surface_finish where surface_finish_id='$temp_grade_product_details->{'temp_surface_finish_id'}'",$_[7],$_[8]); $e_c_name = &get_single_value("select edge_cond_name from edge_condition where edge_cond_id='$temp_grade_product_details->{'temp_edge_cond_id'}'",$_[7],$_[8]); if($_[3] eq "metric") { $dim_unit = "mm"; $wt_unit = "MT" } elsif($_[3] eq "fps") { $dim_unit = "Inch"; $wt_unit = "Lbs" } if($_[4] eq "proc_rfq") { $check_html = ""; $check_text_ns = "Uncheck to delete"; $col_val = 13; } else { $col_val = 12; } if($_[1] eq "no") { $temp_rfq_record_html = qq~ $g_name $p_name $s_f_name $e_c_name $temp_grade_product_details->{'temp_thickness_nom'} $temp_grade_product_details->{'temp_thickness_tol'}  $temp_grade_product_details->{'temp_width_nom'} $temp_grade_product_details->{'temp_width_tol'}  $temp_grade_product_details->{'temp_length_nom'} $temp_grade_product_details->{'temp_length_tol'}  $temp_grade_product_details->{'temp_coil_weight'} $temp_grade_product_details->{'temp_quantity'} $check_html ~; } elsif($_[1] eq "yes") { $temp_rfq_record_html = qq~
Previous Record
Chemical Composition (In %)
C
(Max)
Mn
(Max)
P
(Max)
S
(Max)
Si
(Max)
Cr Ni Mo Nitrogen
(Max)
Cu/Other
(Min) (Max) (Min) (Max) (Min) (Max)
$temp_grade_product_details->{'temp_C_amt'}   $temp_grade_product_details->{'temp_Mn_amt'}   $temp_grade_product_details->{'temp_P_amt'}   $temp_grade_product_details->{'temp_S_amt'}   $temp_grade_product_details->{'temp_Si_amt'}   $temp_grade_product_details->{'temp_Cr_min_amt'}   $temp_grade_product_details->{'temp_Cr_amt'}   $temp_grade_product_details->{'temp_Ni_min_amt'}   $temp_grade_product_details->{'temp_Ni_amt'}   $temp_grade_product_details->{'temp_Mo_min_amt'}   $temp_grade_product_details->{'temp_Mo_amt'}   $temp_grade_product_details->{'temp_N_amt'}   $temp_grade_product_details->{'temp_Cu_other_amt'}  
Mechanical Composition
Tensile StrengthMpa(Min) Yield Strength Mpa(Min) % Age Elongation
in 50 mm gauge length
min
Hardness
BHN Rb
$temp_grade_product_details->{'temp_tensile_strength'}   $temp_grade_product_details->{'temp_yield_strength'}   $temp_grade_product_details->{'temp_elongation'}   $temp_grade_product_details->{'temp_hardness_bhn'}   $temp_grade_product_details->{'temp_hardness_rb'}  
$check_text_ns $check_html
Physical Composition
Grade Product Surface Finish Edge Condition Thickness ($dim_unit) Width ($dim_unit) Length ($dim_unit) Coil/Pallet Weight ($wt_unit) Quantity ($wt_unit)
Nom. Tol. Nom. Tol. Nom. Tol.
$g_name $p_name $s_f_name $e_c_name $temp_grade_product_details->{'temp_thickness_nom'} $temp_grade_product_details->{'temp_thickness_tol'}  $temp_grade_product_details->{'temp_width_nom'} $temp_grade_product_details->{'temp_width_tol'}  $temp_grade_product_details->{'temp_length_nom'} $temp_grade_product_details->{'temp_length_tol'}  $temp_grade_product_details->{'temp_coil_weight'} $temp_grade_product_details->{'temp_quantity'}

~; } #print "
$temp_rfq_record_html
"; return $temp_rfq_record_html; } ################################################ # get all the country list in select drop down # ################################################ sub get_country_list_cport { my($st, $sth, $country_details,$country_list_html_seat_port); $st = "select distinct country_id,country_name from country, sea_port where sea_port.fk_country_id = country.country_id order by country_no"; #$st = "select country_id,country_name from country order by country_no"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st); } if (!($sth->execute)) { dataerror($dbh->errstr.$st); } ###$country_list_html = " "; while($country_details = $sth->fetchrow_hashref) { my $cid = $country_details->{'country_id'}; $country_list_html_seat_port .= ""; } $country_list_html_seat_port .= ""; $sth->finish; $country_list_html_seat_port .= ""; return $country_list_html_seat_port; } ################################################ # get all the country list in select drop down # ################################################ sub get_country_list { my($st, $sth, $country_details); $st = "select * from country where (region_id != '' || country_id = 'IN') order by country_no"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st); } if (!($sth->execute)) { dataerror($dbh->errstr.$st); } ###$country_list_html = " "; while($country_details = $sth->fetchrow_hashref) { my $cid = $country_details->{'country_id'}; $country_list_html .= ""; } $sth->finish; $country_list_html .= ""; return $country_list_html; } ################################################ # get all the country list in select drop down # ################################################ sub get_selected_country_list { my($st, $sth, $selected_country_details); $st = "select * from country where (region_id != '' || country_id = 'IN') order by country_no"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st); } if (!($sth->execute)) { dataerror($dbh->errstr.$st); } ###$country_list_html = ""; while($selected_country_details = $sth->fetchrow_hashref) { my $cid = $selected_country_details->{'country_id'}; if($cid eq $_[0]) { $country_list_html .= ""; } else { $country_list_html .= ""; } } $sth->finish; $country_list_html .= ""; return $country_list_html; } ################################################ # get all the state list in select drop down # ################################################ sub get_state_list { my($st, $sth, $state_details); $st = "select * from state"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st); } if (!($sth->execute)) { dataerror($dbh->errstr.$st); } $state_list_html = " State* "; return $state_list_html; } ######################################################### # Get javascript code to show state for India # ######################################################### sub get_state_js { my ($state_html, %state_val, $state_id, $form_name); $form_name = $_[0]; %state_val = &get_indian_state(); $state_html = ""; return $state_html; } ################################################# # get all the state list # ################################################# sub get_indian_state { my($st, $sth, %state_val); $st = "select * from state order by state_name"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st); } if (!($sth->execute)) { dataerror($dbh->errstr.$st); } while($state_details = $sth->fetchrow_hashref) { my $sid = $state_details->{'state_id'}; my $sname = $state_details->{'state_name'}; $state_val{$sid} = $sname; } $sth->finish; return %state_val; } ################################################ # get all the price basis list in select drop down # ################################################ sub get_price_basis_list { my($st, $sth, $price_basis_details); $st = "select * from price_basis_options"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st); } if (!($sth->execute)) { dataerror($dbh->errstr.$st); } $price_basis_html = ""; return $price_basis_html; } #-############################################# # Sub: Get Region sub get_region { my($st, $sth, $region_id); if($_[0] ne "IN") { $st = "select region_id from country where country_id = '$_[0]'"; } elsif($_[0] eq "IN" && $_[1] ne "") { $st = "select region_id from state where state_id = '$_[1]'"; } $sth = $dbh->prepare($st); if(!$sth) { dataerror($dbh->errstr); } if(!($sth->execute)) { dataerror($dbh->errstr); } $region_id = $sth->fetchrow_array; $sth->finish; return $region_id; } ####################################################### #### Delete record from temp enquiry_record table #### ####################################################### sub delete_temp_rfq { my($st, $sth); $st = $_[0]; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st,$_[1],$_[2]); } if (!($sth->execute)) { dataerror($dbh->errstr.$st,$_[1],$_[2]); } $sth->finish; } ################################# #- Get Current Year # ################################# sub get_current_year { my $year_val = (gmtime)[5] + 1900; my $year_html = ""; return $year_html } ######################### #- Get Current Month # ######################### sub get_current_month_html { my ($mon, $mon_html); if($_[0] ne "") { $mon = $_[0]; } else { $mon = (gmtime)[4] + 1; } $mon_html = ""; return $mon_html } ################################################################ # preview for the inquiry existance & show accordingly # ################################################################ sub preview_temp_enq { my ($temp_enq_details, @temp_grade_product_array, $temp_rfq_preview_html, @return_preview_temp_enq); $temp_enq_details = &get_details("select * from temp_enquiry_record where (temp_enq_no='$_[0]' and temp_process_status='on')",__FILE__,__LINE__); if($temp_enq_details ne "") { @temp_grade_product_array = &get_id_array("select temp_grade_product_no from temp_enquiry_record_to_grade where temp_enq_no = '$_[0]' order by temp_grade_product_no",__FILE__,__LINE__); if($#temp_grade_product_array != -1) { my $i = 0; foreach $temp_grade_product_array (sort {$a <=> $b} @temp_grade_product_array) { ###$temp_rfq_preview_html .= &get_temp_rfq_record_html($temp_grade_product_array,$temp_enq_details->{'temp_grade_option'},$_[0],$temp_enq_details->{'temp_unit_type'},$_[1],$i,$temp_enq_details->{'temp_grade_country'}); $temp_rfq_preview_html .= &get_temp_rfqpreview_html($temp_grade_product_array,$temp_enq_details->{'temp_grade_option'},$_[0],$temp_enq_details->{'temp_unit_type'},$_[1],$i,$temp_enq_details->{'temp_grade_country'}); $i++; } } } @return_preview_temp_enq =($temp_enq_details,$#temp_grade_product_array,$temp_rfq_preview_html); #print "
$temp_rfq_preview_html
"; return @return_preview_temp_enq; } sub purchas_order_html{ my ($temp_enq_details, @temp_grade_product_array, $temp_rfq_preview_html,@return_preview_temp_enq); $temp_enq_details = &get_details("select * from temp_enquiry_record where (temp_enq_no='$_[0]' and temp_process_status='on')",__FILE__,__LINE__); if($temp_enq_details ne "") { @temp_grade_product_array = &get_id_array("select temp_grade_product_no from temp_enquiry_record_to_grade where temp_enq_no = '$_[0]' order by temp_grade_product_no",__FILE__,__LINE__); if($#temp_grade_product_array != -1) { my $i = 0; foreach $temp_grade_product_array (sort {$a <=> $b} @temp_grade_product_array) { ###$temp_rfq_preview_html .= &get_temp_rfq_record_html($temp_grade_product_array,$temp_enq_details->{'temp_grade_option'},$_[0],$temp_enq_details->{'temp_unit_type'},$_[1],$i,$temp_enq_details->{'temp_grade_country'}); $temp_rfq_preview_html .= &get_temp_rfqpreview_html($temp_grade_product_array,$temp_enq_details->{'temp_grade_option'},$_[0],$temp_enq_details->{'temp_unit_type'},$_[1],$i,$temp_enq_details->{'temp_grade_country'}); $i++; } } } @return_preview_temp_enq =($temp_enq_details,$#temp_grade_product_array,$temp_rfq_preview_html); #print "
$temp_rfq_preview_html
"; return @return_preview_temp_enq; } #-############################################# # Sub: Get single value #-############################################# sub get_single_value { my($st, $sth, $single_val); $st = $_[0]; $sth = $dbh->prepare($st); if(!$sth) { dataerror($dbh->errstr,$_[1],$_[2]); } if(!($sth->execute)) { dataerror($dbh->errstr,$_[1],$_[2]); } $single_val = $sth->fetchrow_array; $sth->finish; return $single_val; } #-############################################# # Sub: Get Details based on single value #-############################################# sub get_details{ my($st, $sth, $details_val); $st = $_[0]; $sth = $dbh->prepare($st); if(!$sth) { dataerror($dbh->errstr,$_[1],$_[2]); } if(!($sth->execute)) { #print "$dbh->errstr $_[0],$_[1] $_[2]"; dataerror($dbh->errstr,$_[1],$_[2]); } $details_val = $sth->fetchrow_hashref; $sth->finish; return $details_val; } ############################################################# # View for the inquiry existance & show accordingly # ############################################################# sub view_enq { my ($enq_details, @grade_product_array, $rfq_preview_html, @return_preview_enq); $enq_details = &get_details("select * from enquiry_record where enq_no = '$_[0]'"); if($enq_details ne "") { @grade_product_array = &get_id_array("select grade_product_no from enquiry_record_to_grade where enq_no = '$_[0]'",__FILE__,__LINE__); if($#grade_product_array != -1) { foreach $grade_product_array (@grade_product_array) { my $st = "select * from grade_product_enquiry where grade_product_no = '$grade_product_array'"; $rfq_view_html .= &get_rfq_record_html($st,$enq_details->{'grade_option'},$_[0],$enq_details->{'unit_type'},$_[1],$enq_details->{'grade_country'}); } } } @return_view_enq = ($enq_details,$#grade_product_array,$rfq_view_html); return @return_view_enq; } #-####################################################### #- Get all grade_product_no for a enq_no # #-####################################################### sub get_rfq_record_html { my($grade_product_details, $g_name, $p_name, $s_f_name, $price_val, $price_html, $cols,$gp_rfq_details); my($e_c_name, $rfq_record_html, $dim_unit, $wt_unit,$currency_type, $amt_val, $amt_value, $amt_html); $grade_product_details = &get_details($_[0],__FILE__,__LINE__); my $st_sum_qty="SELECT sum(quantity) as qty FROM `grade_product_offer` WHERE grade_product_no =$grade_product_details->{'grade_product_no'}"; $qty = &get_details($st_sum_qty,__FILE__,__LINE__); my $sum_qty=$qty->{'qty'}; #print "$sum_qty
" ; $gp_rfq_details = &get_details("select * from grade_product_enquiry where grade_product_no = '$grade_product_details->{'grade_product_no'}'",__FILE__,__LINE__); $p_name = &get_single_value("select product_name from products where product_id='$grade_product_details->{'product_id'}'",__FILE__,__LINE__); $s_f_name = &get_single_value("select surface_finish_name from surface_finish where surface_finish_id='$grade_product_details->{'surface_finish_id'}'",__FILE__,__LINE__); $e_c_name = &get_single_value("select edge_cond_name from edge_condition where edge_cond_id='$grade_product_details->{'edge_cond_id'}'",__FILE__,__LINE__); if($_[3] eq "metric") { $dim_unit = "mm"; $wt_unit = "MT" } elsif($_[3] eq "fps") { $dim_unit = "Inch"; $wt_unit = "Lbs" } if ((($_[8] ne "IN") && ($_[9] == 0))) { $currency_type = "USD"; } else { $currency_type = "Rs"; } if($_[4] eq "view_offer_details" || $_[4] eq "send_purchase_order" || $_[4] eq "view_po" || $_[4] eq "view_oa" || $_[4] eq "view_invoice") { $price_val = "$grade_product_details->{'price_mt'}"; $price_html = "Price ($currency_type/$wt_unit)"; $cols = 13; if($_[4] eq "view_invoice") { $amt_value = $grade_product_details->{'quantity'} * $grade_product_details->{'price_mt'}; $amt_val = "$amt_value "; $amt_html = "Amount ($currency_type)"; $cols = 14; } } else { $cols = 12; } if($grade_product_details->{'grade_id'} != 0) { $g_name = &get_single_value("select $_[5] from grades where grade_id='$grade_product_details->{'grade_id'}'",__FILE__,__LINE__); } else { $g_name = "-"; } ###- This is due to show value highlighted which are chaged from offer to RFQ ###- =========================================================== my (%key_hash_physical, @key_arr_physical, $key_arr_phy, $physical_html, @keys_of_hash_physical); @keys_of_hash_physical = ('grade_id','product_id','surface_finish_id','edge_cond_id'); %key_hash_physical = ( 'grade_id' => $g_name, 'product_id' => $p_name, 'surface_finish_id' => $s_f_name, 'edge_cond_id' => $e_c_name ); @key_arr_physical = (thickness_nom,thickness_tol,width_nom,width_tol,length_nom,length_tol,coil_weight,quantity); foreach $key_hash_phy (@keys_of_hash_physical) { if($_[4] eq "view_offer_details" && ($grade_product_details->{$key_hash_phy} != $gp_rfq_details->{$key_hash_phy}) ) { $physical_html .= "$key_hash_physical{$key_hash_phy}"; } else { $physical_html .= "$key_hash_physical{$key_hash_phy}"; } } foreach $key_arr_phy (@key_arr_physical) { if($key_arr_phy eq 'quantity'){ if($sum_qty > $gp_rfq_details->{'quantity'}){ $qty_msg=' ** Total Quantity of current offer and other offers for current RFQ is getting exceeded. '; } } if($_[4] eq "view_offer_details" && ($grade_product_details->{$key_arr_phy} ne $gp_rfq_details->{$key_arr_phy}) ) { $physical_html .= "$grade_product_details->{$key_arr_phy}  "; } else { $physical_html .= "$grade_product_details->{$key_arr_phy}  "; } } if($_[1] eq "no") { $rfq_record_html = " $physical_html $price_val \n $amt_val "; } elsif($_[1] eq "yes") { my (@key_arr_chemical, @key_arr_mechnical, $chemical_html, $key_arr_chem, $key_arr_mech, $mechnical_html); @key_arr_chemical = (C_amt,Mn_amt,P_amt,S_amt,Si_amt,Cr_min_amt,Cr_amt,Ni_min_amt,Ni_amt,Mo_min_amt,Mo_amt,N_amt,Cu_other_amt); @key_arr_mechnical = (tensile_strength,yield_strength,elongation,hardness_bhn,hardness_rb); foreach $key_arr_chem (@key_arr_chemical) { if($_[4] eq "view_offer_details" && ($grade_product_details->{$key_arr_chem} ne $gp_rfq_details->{$key_arr_chem}) ) { $chemical_html .= "$grade_product_details->{$key_arr_chem}  "; } else { $chemical_html .= "$grade_product_details->{$key_arr_chem}  "; } } foreach $key_arr_mech (@key_arr_mechnical) { if($_[4] eq "view_offer_details" && ($grade_product_details->{$key_arr_mech} ne $gp_rfq_details->{$key_arr_mech}) ) { $mechnical_html .= "$grade_product_details->{$key_arr_mech}  "; } else { $mechnical_html .= "$grade_product_details->{$key_arr_mech}  "; } } $rfq_record_html = qq~ ~; $rfq_record_html .= " $chemical_html
Chemical Composition (In %)
C
(Max)
Mn
(Max)
P
(Max)
S
(Max)
Si
(Max)
Cr Ni Mo Nitrogen
(Max)
Cu/Other
(Min) (Max) (Min) (Max) (Min) (Max)
"; $rfq_record_html .= qq~ ~; $rfq_record_html .= " $mechnical_html
Mechanical Composition
Tensile
StrengthMpa(Min)
Yield Strength
% Age Elongation
in 50 mm gauge
length min
Hardness
(BHN) (Rb)
"; $rfq_record_html .= qq~ $price_html $amt_html ~; $rfq_record_html .= " $physical_html $price_val \n $amt_val
Physical Composition
Grade Product Surface Finish Edge Condition Thickness ($dim_unit) Width ($dim_unit) Length ($dim_unit) Coil/Pallet Weight ($wt_unit) Quantity ($wt_unit)
Nom. Tol. Nom. Tol. Nom. Tol.

"; } return $rfq_record_html; } #-####################################################### #- Get all grade_product_no for a enq_no # #-####################################################### sub get_rfq_record_html1 { $count=$_[10]; my($grade_product_details, $g_name, $p_name, $s_f_name, $price_val, $price_html, $cols,$gp_rfq_details); my($e_c_name, $rfq_record_html, $dim_unit, $wt_unit,$currency_type, $amt_val, $amt_value, $amt_html); $grade_product_details = &get_details($_[0],__FILE__,__LINE__); if($_[4] eq "view_po") { my $stf ="SELECT * FROM `grade_product_offer` WHERE grade_product_offer_no = \"$grade_product_details->{'fk_grade_product_no'}\" "; $gp_offer = &get_details($stf,__FILE__,__LINE__); $gp_rfq_details = &get_details("select * from grade_product_po where grade_product_no = '$grade_product_details->{'grade_product_no'}'",__FILE__,__LINE__); $p_name = &get_single_value("select product_name from products where product_id='$grade_product_details->{'product_id'}'",__FILE__,__LINE__); $s_f_name = &get_single_value("select surface_finish_name from surface_finish where surface_finish_id='$grade_product_details->{'surface_finish_id'}'",__FILE__,__LINE__); $e_c_name = &get_single_value("select edge_cond_name from edge_condition where edge_cond_id='$grade_product_details->{'edge_cond_id'}'",__FILE__,__LINE__); }else{ $gp_rfq_details = &get_details("select * from grade_product_enquiry where grade_product_no = '$grade_product_details->{'grade_product_no'}'",__FILE__,__LINE__); $p_name = &get_single_value("select product_name from products where product_id='$grade_product_details->{'product_id'}'",__FILE__,__LINE__); $s_f_name = &get_single_value("select surface_finish_name from surface_finish where surface_finish_id='$grade_product_details->{'surface_finish_id'}'",__FILE__,__LINE__); $e_c_name = &get_single_value("select edge_cond_name from edge_condition where edge_cond_id='$grade_product_details->{'edge_cond_id'}'",__FILE__,__LINE__); #$grade_product_details = &get_details($_[0],__FILE__,__LINE__); $p_html = &get_selected_product_html($grade_product_details->{'product_id'},$count); $sf_html = &get_selected_sf_html($grade_product_details->{'product_id'},$grade_product_details->{'surface_finish_id'},$count); $ec_html = &get_selected_ec_html($grade_product_details->{'product_id'},$grade_product_details->{'edge_cond_id'},$count); } if($_[3] eq "metric") { $dim_unit = "mm"; $wt_unit = "MT" } elsif($_[3] eq "fps") { $dim_unit = "Inch"; $wt_unit = "Lbs" } if ((($_[8] ne "IN") && ($_[9] == 0))) { $currency_type = "USD"; } else { $currency_type = "Rs"; } if($_[4] eq "view_offer_details" || $_[4] eq "send_purchase_order" || $_[4] eq "view_invoice") { $price_val = " {'price_mt'}\">"; $price_html = "Price ($currency_type/$wt_unit)"; $cols = 13; if($_[4] eq "view_invoice") { $amt_value = $grade_product_details->{'quantity'} * $grade_product_details->{'price_mt'}; $amt_val = " $amt_value"; $amt_html = "Amount ($currency_type)"; $cols = 14; } if($_[4] eq "send_purchase_order"){ $price_val .= qq~ ~; } } elsif($_[4] eq "view_po") { if($grade_product_details->{'price_mt'} ne $gp_offer->{'price_mt'}) { $price_val = "$grade_product_details->{'price_mt'} "; } else{ $price_val = "$grade_product_details->{'price_mt'}"; } $price_html = "Price ($currency_type/$wt_unit)"; $cols = 13; if($_[4] eq "view_invoice") { $amt_value = $grade_product_details->{'quantity'} * $grade_product_details->{'price_mt'}; $amt_val = " $amt_value"; $amt_html = "Amount ($currency_type)"; $cols = 14; } } else { $cols = 12; } if($grade_product_details->{'grade_id'} != 0) { $g_name = &get_single_value("select $_[5] from grades where grade_id='$grade_product_details->{'grade_id'}'",__FILE__,__LINE__); } else { $g_name = "-"; } ###- This is due to show value highlighted which are chaged from offer to RFQ ###- =========================================================== my (%key_hash_physical, @key_arr_physical, $key_arr_phy, $physical_html, @keys_of_hash_physical); @keys_of_hash_physical = ('grade_id','product_id','surface_finish_id','edge_cond_id'); %key_hash_physical = ( 'grade_id' => $g_name, 'product_id' => $p_name, 'surface_finish_id' =>$s_f_name, 'edge_cond_id' => $e_c_name ); $grade_html1 = &get_grade_html1($grade_product_details->{'grade_id'},$count); @key_arr_physical = (thickness_nom,thickness_tol,width_nom,width_tol,length_nom,length_tol,coil_weight,quantity); if($_[4] eq 'view_po' ) { foreach $key_hash_phy (@keys_of_hash_physical) { if($grade_product_details->{$key_hash_phy} ne $gp_offer->{$key_hash_phy}) {$physical_html .= " $key_hash_physical{$key_hash_phy} "; } else{ $physical_html .= " $key_hash_physical{$key_hash_phy}"; } } } else { $physical_html .= qq~ $grade_html1 ~; $physical_html .= qq~ $p_html $sf_html $ec_html ~; #$physical_html .= " $get_selected_product_html "; #$physical_html .= qq~ ~; #$physical_html .= " "; } foreach $key_arr_phy (@key_arr_physical) { if($_[4] eq "view_po" ) { if($grade_product_details->{$key_arr_phy} ne $gp_offer->{$key_arr_phy}) { $physical_html .= " $grade_product_details->{$key_arr_phy} "; }else{ $physical_html .= "$grade_product_details->{$key_arr_phy} "; } } else { my $kname= $key_arr_phy.$count; if($key_arr_phy eq 'length_tol' || $key_arr_phy eq 'length_nom'){ $physical_html .= "{$key_arr_phy}\" OnFocus=get_dim_val() > "; } else{ $physical_html .= "{$key_arr_phy}\" > "; } } } if($_[1] eq "no") { $rfq_record_html = " $physical_html $price_val \n $amt_val "; } elsif($_[1] eq "yes") { my (@key_arr_chemical, @key_arr_mechnical, $chemical_html, $key_arr_chem, $key_arr_mech, $mechnical_html); @key_arr_chemical = (C_amt,Mn_amt,P_amt,S_amt,Si_amt,Cr_min_amt,Cr_amt,Ni_min_amt,Ni_amt,Mo_min_amt,Mo_amt,N_amt,Cu_other_amt); @key_arr_mechnical = (tensile_strength,yield_strength,elongation,hardness_bhn,hardness_rb); foreach $key_arr_chem (@key_arr_chemical) { if($_[4] eq 'view_po' ) { if($grade_product_details->{$key_arr_chem} ne $gp_offer->{$key_arr_chem}) { $chemical_html .= " $grade_product_details->{$key_arr_chem} "; } else{ $chemical_html .= "$grade_product_details->{$key_arr_chem}"; } } elsif($_[4] eq "view_offer_details" && ($grade_product_details->{$key_arr_chem} ne $gp_rfq_details->{$key_arr_chem}) ) { $chemical_html .= "$grade_product_details->{$key_arr_chem}  "; } else { my $kname= $key_arr_chem.$count; $chemical_html .= "{$key_arr_chem}\" > "; } } foreach $key_arr_mech (@key_arr_mechnical) { if($_[4] eq 'view_po' ) { if($grade_product_details->{$key_arr_mech} ne $gp_offer->{$key_arr_mech} ) { $mechnical_html .= " $grade_product_details->{$key_arr_mech} "; } else{ $mechnical_html .= "$grade_product_details->{$key_arr_mech}"; } } elsif($_[4] eq "view_offer_details" && ($grade_product_details->{$key_arr_mech} ne $gp_rfq_details->{$key_arr_mech}) ) { $mechnical_html .= "$grade_product_details->{$key_arr_mech}  "; } else { my $kname= $key_arr_mech.$count; $mechnical_html .= "{$key_arr_mech}\"> "; } } $rfq_record_html = qq~ ~; $rfq_record_html .= " $chemical_html
Chemical Composition (In %)
C
(Max)
Mn
(Max)
P
(Max)
S
(Max)
Si
(Max)
Cr Ni Mo Nitrogen
(Max)
Cu/Other
(Min) (Max) (Min) (Max) (Min) (Max)
"; $rfq_record_html .= qq~ ~; $rfq_record_html .= "$mechnical_html
Mechanical Composition
Tensile
StrengthMpa(Min)
Yield Strength
Mpa(Min)
% Age Elongation
in 50 mm gauge length min
Hardness
(BHN) (Rb)
"; $rfq_record_html .= qq~ $price_html $amt_html ~; $rfq_record_html .= " $physical_html $price_val \n $amt_val
"; } return $rfq_record_html; } sub get_rfq_record_html_oa { my($grade_product_details, $g_name, $p_name, $s_f_name, $price_val, $price_html, $cols,$gp_rfq_details); my($e_c_name, $rfq_record_html, $dim_unit, $wt_unit,$currency_type, $amt_val, $amt_value, $amt_html); $grade_product_details = &get_details($_[0],__FILE__,__LINE__); $gp_rfq_details = &get_details("select * from grade_product_enquiry where grade_product_no = '$grade_product_details->{'grade_product_no'}'",__FILE__,__LINE__); $p_name = &get_single_value("select product_name from products where product_id='$grade_product_details->{'product_id'}'",__FILE__,__LINE__); $s_f_name = &get_single_value("select surface_finish_name from surface_finish where surface_finish_id='$grade_product_details->{'surface_finish_id'}'",__FILE__,__LINE__); $e_c_name = &get_single_value("select edge_cond_name from edge_condition where edge_cond_id='$grade_product_details->{'edge_cond_id'}'",__FILE__,__LINE__); my $stp ="SELECT * FROM `grade_product_po` WHERE grade_product_po_no = \"$grade_product_details->{'fk_grade_product_po_no'}\" "; $gp_offer = &get_details($stp,__FILE__,__LINE__); if($_[3] eq "metric") { $dim_unit = "mm"; $wt_unit = "MT" } elsif($_[3] eq "fps") { $dim_unit = "Inch"; $wt_unit = "Lbs" } if ((($_[8] ne "IN") && ($_[9] == 0))) { $currency_type = "USD"; } else { $currency_type = "Rs"; } if($_[4] eq "view_offer_details" || $_[4] eq "send_purchase_order" || $_[4] eq "view_po" || $_[4] eq "view_oa" || $_[4] eq "view_invoice") { if($grade_product_details->{'price_mt'} ne $gp_offer->{'price_mt'}) { $price_val = ""; } else{ $price_val = ""; } $price_html = ""; $cols = 13; if($_[4] eq "view_invoice") { $amt_value = $grade_product_details->{'quantity'} * $grade_product_details->{'price_mt'}; $amt_val = ""; $amt_html = ""; $cols = 14; } } else { $cols = 12; } if($grade_product_details->{'grade_id'} != 0) { $g_name = &get_single_value("select $_[5] from grades where grade_id='$grade_product_details->{'grade_id'}'",__FILE__,__LINE__); } else { $g_name = "-"; } ###- This is due to show value highlighted which are chaged from offer to RFQ ###- =========================================================== my (%key_hash_physical, @key_arr_physical, $key_arr_phy, $physical_html, @keys_of_hash_physical); @keys_of_hash_physical = ('grade_id','product_id','surface_finish_id','edge_cond_id'); %key_hash_physical = ( 'grade_id' => $g_name, 'product_id' => $p_name, 'surface_finish_id' => $s_f_name, 'edge_cond_id' => $e_c_name ); @key_arr_physical = (thickness_nom,thickness_tol,width_nom,width_tol,length_nom,length_tol,coil_weight,quantity); foreach $key_hash_phy (@keys_of_hash_physical) { if($grade_product_details->{$key_hash_phy} ne $gp_offer->{$key_hash_phy}) {$physical_html .= ""; } else{ $physical_html .= ""; } } foreach $key_arr_phy (@key_arr_physical) { #### $physical_html .= ""; if($grade_product_details->{$key_arr_phy} ne $gp_offer->{$key_arr_phy}) { $physical_html .= ""; }else{ $physical_html .= ""; } } if($_[1] eq "no") { $rfq_record_html = " $physical_html $price_val \n $amt_val "; } elsif($_[1] eq "yes") { my (@key_arr_chemical, @key_arr_mechnical, $chemical_html, $key_arr_chem, $key_arr_mech, $mechnical_html); @key_arr_chemical = (C_amt,Mn_amt,P_amt,S_amt,Si_amt,Cr_min_amt,Cr_amt,Ni_min_amt,Ni_amt,Mo_min_amt,Mo_amt,N_amt,Cu_other_amt); @key_arr_mechnical = (tensile_strength,yield_strength,elongation,hardness_bhn,hardness_rb); foreach $key_arr_chem (@key_arr_chemical) { if($grade_product_details->{$key_arr_chem} ne $gp_offer->{$key_arr_chem}) { $chemical_html .= ""; } else{ $chemical_html .= ""; } #$chemical_html .= ""; } foreach $key_arr_mech (@key_arr_mechnical) { if($grade_product_details->{$key_arr_mech} ne $gp_offer->{$key_arr_mech} ) { $mechnical_html .= ""; } else{ $mechnical_html .= ""; } } $rfq_record_html = qq~
Physical Composition
Check to
include in
Purchase Order
Grade Product Surface Finish Edge Condition Thickness ($dim_unit) Width ($dim_unit) Length ($dim_unit) Coil/Pallet Weight ($wt_unit) Quantity ($wt_unit)
Nom. Tol. Nom. Tol. Nom. Tol.
$grade_product_details->{'price_mt'} $grade_product_details->{'price_mt'}Price ($currency_type/$wt_unit)$amt_value Amount ($currency_type) $key_hash_physical{$key_hash_phy} $key_hash_physical{$key_hash_phy}$grade_product_details->{$key_arr_phy}  $grade_product_details->{$key_arr_phy} $grade_product_details->{$key_arr_phy}
$grade_product_details->{$key_arr_chem} $grade_product_details->{$key_arr_chem}$grade_product_details->{$key_arr_chem}   $grade_product_details->{$key_arr_mech} $grade_product_details->{$key_arr_mech}
~; $rfq_record_html .= " $chemical_html
Chemical Composition (In %)
C
(Max)
Mn
(Max)
P
(Max)
S
(Max)
Si
(Max)
Cr Ni Mo Nitrogen
(Max)
Cu/Other
(Min) (Max) (Min) (Max) (Min) (Max)
"; $rfq_record_html .= qq~ ~; $rfq_record_html .= " $mechnical_html
Mechanical Composition
Tensile
StrengthMpa(Min)
Yield Strength
% Age Elongation
in 50 mm gauge
length min
Hardness
(BHN) (Rb)
"; $rfq_record_html .= qq~ $price_html $amt_html ~; $rfq_record_html .= " $physical_html $price_val \n $amt_val
Physical Composition
Grade Product Surface Finish Edge Condition Thickness ($dim_unit) Width ($dim_unit) Length ($dim_unit) Coil/Pallet Weight ($wt_unit) Quantity ($wt_unit)
Nom. Tol. Nom. Tol. Nom. Tol.

"; } return $rfq_record_html; } ########################################################## # Get javascript code to show S.F. & E.C. for a product # ######################################################### sub get_sf_ec_js { my ($related_val_html, $sf_html, $ec_html, $sf_html_back, $ec_html_back, $dim_html, $parr, %phash, $dimension_html); $related_val_html = ""; return $related_val_html; } ################################################################# ########################################################################### # Get javascript code to show S.F. & E.C. for a product in Offer form # ############################################################################ sub get_sf_ec_js1{ #get_offer_js { my ($offer_html, $sf_html, $ec_html, $sf_html_back, $ec_html_back, $dim_html, $parr, %phash, $dimension_html); $offer_html = ""; return $offer_html; } sub get_sf_ec_js111 { my ($related_val_html, $sf_html, $ec_html, $sf_html_back, $ec_html_back, $dim_html, $parr, %phash, $dimension_html); my $surface_finish_id='surface_finish_id'.$count; my $edge_cond_id ='edge_cond_id'.$count; my $product_id = 'product_id'.$count; my $length_nom = 'length_nom'.$count; my $length_tol ='length_tol'.$count; my $coil_weight='coil_weight'.$count; my $surface_finish_id='surface_finish_id'.$count; my $coil_weight='coil_weight'.$count; $related_val_html = ""; return $related_val_html; } ########################################################### # View for the offer existance & show accordingly # ########################################################### sub view_offer_user { my ($offer_details, $enq_details, @grade_product_offer_array, $offer_view_html, @return_view_offer); $offer_details = &get_details("select * from offer_record where offer_no = '$_[0]'",$_[2],$_[3]); $enq_details = &get_details("select * from enquiry_record where enq_no = '$offer_details->{'enq_no'}'",$_[2],$_[3]); if($offer_details ne "") { @grade_product_offer_array = &get_id_array("select grade_product_offer_no from offer_record_to_grade where offer_no = '$_[0]'",$_[2],$_[3]); if($#grade_product_offer_array != -1) { my $i = 0; foreach $grade_product_offer_array (@grade_product_offer_array) { my $st = "select * from grade_product_offer where grade_product_offer_no = '$grade_product_offer_array'"; $offer_view_html .= &get_rfq_record_html($st,$enq_details->{'grade_option'},$_[0],$enq_details->{'unit_type'},$_[1],$enq_details->{'grade_country'},$_[2],$_[3],$enq_details->{'country_id'},$enq_details->{'state_id'}); $i++; } } } @return_view_offer = ($offer_details,$#grade_product_offer_array,$offer_view_html); return @return_view_offer; } sub view_offer_user1 { my ($offer_details, $enq_details, @grade_product_offer_array, $offer_view_html, @return_view_offer); $offer_details = &get_details("select * from offer_record where offer_no = '$_[0]'",$_[2],$_[3]); $enq_details = &get_details("select * from enquiry_record where enq_no = '$offer_details->{'enq_no'}'",$_[2],$_[3]); if($offer_details ne "") { @grade_product_offer_array = &get_id_array("select grade_product_offer_no from offer_record_to_grade where offer_no = '$_[0]'",$_[2],$_[3]); if($#grade_product_offer_array != -1) { my $i = 0; foreach $grade_product_offer_array (@grade_product_offer_array) { my $st = "select * from grade_product_offer where grade_product_offer_no = '$grade_product_offer_array'"; $offer_view_html .= &get_rfq_record_html1($st, $enq_details->{'grade_option'}, $_[0], $enq_details->{'unit_type'}, $_[1], $enq_details->{'grade_country'}, $_[2], $_[3], $enq_details->{'country_id'}, $enq_details->{'state_id'}, $i); $i++; } } } @return_view_offer = ($offer_details,$#grade_product_offer_array,$offer_view_html); #print "
$offer_view_html
"; #exit; return @return_view_offer; } sub view_po { #my ($offer_details, $enq_details, @grade_product_offer_array, $offer_view_html, @return_view_offer); $offer_details = &get_details("select * from offer_record where offer_no =\'$po_details->{'offer_no'}\'",$_[2],$_[3]); $enq_details = &get_details("select * from enquiry_record where enq_no = '$offer_details->{'enq_no'}'",$_[2],$_[3]); if($offer_details ne "") { @grade_product_po_array = &get_id_array("select grade_product_po_no from po_record_to_grade where po_no = '$_[0]'",$_[2],$_[3]); #print "@grade_product_po_array select grade_product_po_no from po_record_to_grade where po_no = '$_[0]' ";exit; if($#grade_product_po_array != -1) { my $i = 0; foreach $grade_product_po_array (@grade_product_po_array) { my $st = "select * from grade_product_po where grade_product_po_no = '$grade_product_po_array'"; $offer_view_html .= &get_rfq_record_html1($st, $enq_details->{'grade_option'}, $_[0], $enq_details->{'unit_type'}, $_[1], $enq_details->{'grade_country'}, $_[2], $_[3], $enq_details->{'country_id'}, $enq_details->{'state_id'}, $i); $i++; } } } @return_view_offer = ($offer_details,$#grade_product_po_array,$offer_view_html); #print "
select * from offer_record where offer_no = '$po_details->{'offer_no'}
#$offer_details,
qqqqqq $#grade_product_po_array,
ssssss $offer_view_html

"; #exit; return @return_view_offer; } sub view_oa { my ($oa_details, $enq_details, @grade_product_oa_array, $oa_view_html, @return_view_oa); my $oa_details = &get_details("select * from order_acceptance where oa_no =\'$_[0]\'",$_[2],$_[3]); $details = &get_details("select offer_no from purchase_order where po_no =\'$oa_details->{'po_no'}\'",$_[2],$_[3]); $offer_details = &get_details("select * from offer_record where offer_no =\'$details->{'offer_no'}\'",$_[2],$_[3]); $enq_details = &get_details("select * from enquiry_record where enq_no = '$offer_details->{'enq_no'}'",$_[2],$_[3]); if($oa_details ne "") { @grade_product_oa_array = &get_id_array("select grade_product_oa_no from oa_record_to_grade where oa_no = '$_[0]'",$_[2],$_[3]); if($#grade_product_oa_array != -1) { my $i = 0; foreach $grade_product_oa_array (@grade_product_oa_array) { my $st = "select * from grade_product_oa where grade_product_oa_no = '$grade_product_oa_array'"; $oa_view_html .= &get_rfq_record_html_oa($st, $enq_details->{'grade_option'}, $_[0], $enq_details->{'unit_type'}, $_[1], $enq_details->{'grade_country'}, $_[2], $_[3], $enq_details->{'country_id'}, $enq_details->{'state_id'}, $i); $i++; } } } @return_view_oa = ($oa_details,$#grade_product_oa_array,$oa_view_html,$offer_details->{'enq_no'}); return @return_view_oa; } #-###################################### #- Get the all id's value of a table # #-###################################### sub get_id_array { my($st, $sth, $id_val, $i, @id_val_arr); $i = 0; $st = $_[0]; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st,$_[1],$_[2]); } if (!($sth->execute)) { dataerror($dbh->errstr.$st,$_[1],$_[2]); } while($id_val = $sth->fetchrow_array) { ### This check, i implemented for submit_po case in checking po_no for every offer. If any problem ### arises then check it again. if($id_val ne "") { $id_val_arr[$i++] = $id_val; } } $sth->finish; #print "
@id_val_arr
" ; return @id_val_arr; } ############################################## # Insert value in table & return created id # ############################################## sub insert_val { my ($st, $sth, $in_id); $st = $_[0]; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st,$_[1],$_[2]); } if (!($sth->execute)){ dataerror($dbh->errstr.$st,$_[1],$_[2]); } ##$in_id = $sth->{insertid}; $in_id = $dbh->{mysql_insertid}; $sth->finish; return $in_id; } ########################### # Update value in table # ########################### sub update_val { my ($st, $sth); $st = $_[0]; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st,$_[1],$_[2]); } if (!($sth->execute)){ dataerror($dbh->errstr.$st,$_[1],$_[2]); } $sth->finish; } ########################### # Change Date Format # ########################### sub change_date_format { my @date_arr = split(/-/,$_[0]); $date_arr[1] =~ s/^0//; my $new_date = "$date_arr[2]-$mon_val{$date_arr[1]}-$date_arr[0]"; return $new_date; } #-####################################################### #- Get all records from temp table to edit it in preview form # #-####################################################### sub get_temp_rfqpreview_html { my($temp_grade_product_details, $g_html, $p_html, $sf_html, $ec_html, @psf_ids, $psf_id, @pec_ids, $pec_id); my($temp_rfq_record_html, $check_html, $check_text_ns, $col_val, $dim_unit, $wt_unit); $temp_grade_product_details = &get_details("select * from temp_grade_product_enquiry where temp_grade_product_no = '$_[0]'",$_[7],$_[8]); $g_html = &get_selected_value_html("select * from grades where grade_status = 'yes'","grade_id","$_[6]","Grade",$temp_grade_product_details->{'grade_id'},"grade_id$_[5]",$_[7],$_[8]); ###$p_html = &get_selected_value_html("select * from products where product_status = 'yes'","product_id","product_name","Product",$temp_grade_product_details->{'product_id'},"product_id$_[5]",$_[7],$_[8]); $p_html = &get_selected_product_html($temp_grade_product_details->{'product_id'},$_[5]); @psf_ids = &get_id_array("select surface_finish_id from products_surface_finish where product_id='$temp_grade_product_details->{'product_id'}'",$_[7],$_[8]); $sf_html = ""; @pec_ids = &get_id_array("select edge_cond_id from products_edge_condition where product_id='$temp_grade_product_details->{'product_id'}'",$_[7],$_[8]); $ec_html = ""; if($_[3] eq "metric") { $dim_unit = "mm"; $wt_unit = "MT" } elsif($_[3] eq "fps") { $dim_unit = "Inch"; $wt_unit = "Lbs" } if($_[4] eq "proc_rfq") { $check_html = ""; $check_text_ns = "Uncheck to delete"; $col_val = 13; } else { $col_val = 12; } if($_[1] eq "no") { $temp_rfq_record_html = qq~ $g_html $p_html $sf_html $ec_html $check_html ~; } elsif($_[1] eq "yes") { $temp_rfq_record_html = qq~
Previous Record
Chemical Composition (In %)
C
(Max)
Mn
(Max)
P
(Max)
S
(Max)
Si
(Max)
Cr Ni Mo Nitrogen
(Max)
Cu/Other
(Min) (Max) (Min) (Max) (Min) (Max)
Mechanical Composition
Tensile StrengthMpa(Min) Yield Strength Mpa(Min) % Age Elongation
in 50 mm gauge
length min
Hardness
BHN Rb
$check_text_ns $check_html
Physical Composition
Grade Product Surface Finish Edge Condition Thickness ($dim_unit) Width ($dim_unit) Length ($dim_unit) Coil/Pallet Weight ($wt_unit) Quantity ($wt_unit)
Nom. Tol. Nom. Tol. Nom. Tol.
$g_html $p_html $sf_html $ec_html

~; } ##print "
$temp_rfq_record_html
"; return $temp_rfq_record_html; } ############################################################################ # get all values from any table to show in drop down with selected particular value # ############################################################################ sub get_selected_value_html { my($st, $sth, $value_details, $value_html); $st = $_[0]; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st,$_[6],$_[7]); } if (!($sth->execute)) { dataerror($dbh->errstr.$st,$_[6],$_[7]); } $value_html = ""; return $value_html; } sub get_selected_value_html1 { my($st, $sth, $value_details, $value_html); $st = $_[0]; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st,$_[6],$_[7]); } if (!($sth->execute)) { dataerror($dbh->errstr.$st,$_[6],$_[7]); } $value_html = ""; return $value_html; } #################### # Get the date selected #################### sub get_selected_date { my ($dt, $date_html); $date_html = ""; return $date_html; } ############################################################################ # Get javascript code to show S.F. & E.C. for a product in preview form # ############################################################################ sub get_preview_js { my ($preview_html, $sf_html, $ec_html, $sf_html_back, $ec_html_back, $dim_html, $parr, %phash, $dimension_html); $preview_html = ""; return $preview_html; } ########################### # Get Date Difference # ########################### sub get_date_diff { ##- Dates are in YYYY-MM-DD format my @date0 = split(/-/,$_[0]); my @date1 = split(/-/,$_[1]); ##- Deduct 1 from month naumber, as we are inserting & fetching month number in (1 - 12) fromat ##- while these function takes from 0-11. my $mon0 = $date0[1] - 1; my $mon1= $date1[1] - 1; my $date0_sec = timegm(0,0,0,$date0[2],$mon0,$date0[0]); my $date1_sec = timegm(0,0,0,$date1[2],$mon1,$date1[0]); my $date_diff = $date0_sec - $date1_sec; return $date_diff; } ##################################################################################### # get_drop_down # Function to print the drop down for given set of values # Input # - File Name # - Line Number # - Table Name # - The field whose values will be the actual values of each option in dropwown # - The fields whose values will be displayed # The field is a string and its value can be field1,field2,.. # - Default text, as the first displayable TEXT in dropdown # - The id of the value that has to be displayed as SELECTED # - name of the dropwown # - If passed, SELECT text in first element of dropwown will NOT be printed # - where clause(part of query) # - $dbh # - If any function is to call for select # (__FILE__,__LINE__,"state","state_id","state_name","State","$user_details->{'state'}","state","","",$dbh,$select_function) # Returns # - Prepared code for the dropwown ##################################################################################### sub get_drop_down { my($st, $sth, $field_details, $field_list_html, $dbh, $select_name, $table, $id_name, $name, $default_text, $select_value, @name, $if_not_print_select, $where, $file, $line, $select_function); $file = $_[0]; $line = $_[1]; $table = $_[2]; $id_name = $_[3]; $name = $_[4]; $default_text = $_[5]; $select_value = $_[6]; $select_name = $_[7]; $if_not_print_select = $_[8]; $where = $_[9]; $dbh = $_[10]; $select_function = $_[11]; if ($name =~ /,/) { @name=split(/,/,$name); } $st = "select * from $table"; if($where){ $st .= ' ' . $where; } $sth = $dbh->prepare($st); if (!($sth)) { &dataerror($dbh->errstr.$st,$_[0],$_[1]); } if (!($sth->execute)) { &dataerror($dbh->errstr.$st,$_[0],$_[1]); } $field_list_html = "\n"; return $field_list_html; } #-########################################################## # Sub: Check user cookie, if not send to login page #-########################################################## sub check_login { my $oldcookie = $q->cookie("$config{'cookiename'}"); if(!$oldcookie) { print "Content-type: text/html\n\n"; &print_filecontent($config{'headerfile'}); print qq~


~; foreach my $keys(keys %form) { print qq~~; } print qq~
Login Form
User Id
Password
Lost User Id or Password


~; &print_filecontent($config{'footerfile'}); exit; } ##- end if return true; } #-########################################################## # Sub: Validate username/password, finally send it to proper action page #-########################################################## sub validate_login { my $user = $_[0]; my $pass = $_[1]; &oops('You must enter an user id that consists of alphanumeric characters only.') if $user =~ /\W/ or !($user); &oops('You must enter a password.') unless ($form{'password'}); &oops('You must enter a password that consists of alphanumeric characters only.') if $pass =~ /\W/ ; ######## code to check whether any user of this name already exists or not. my $st = "select userid from members where (username='$user' and password = '$pass' and (user_type = 'buyer' or user_type = 'both'))"; my $login_details = &get_details($st,__FILE__,__LINE__); if($login_details eq "") { print "Content-type: text/html\n\n"; &print_filecontent($config{'headerfile'}); print "

Your login encountered the following problem :
     Either Invalid username and password Or You don't have buyer's permission.
     Please try again.

Return to Index page

"; &print_filecontent($config{'footerfile'}); exit; }# end if my $jcookie = $login_details->{'userid'}; my $packed_cookie = $q->cookie( -NAME => "$config{'cookiename'}",-VALUE => "$jcookie"); print $q->header(-COOKIE => $packed_cookie); return $jcookie; } ##================================================= ##- Main Program ##================================================= sub main_user { my $field = $_[0]; my $user = $_[1]; my $pass = $_[2]; my $key_match = 0; foreach my $keys(keys %form) { if ($keys eq $field) { $key_match = 1; last; } } if ($key_match != 1) { &check_login(); } &Db_connect(); ##=============================================================== ##- Check whether use is valid or not for a given password & username my $loginid; if ($key_match == 1) { $loginid = &validate_login($user,$pass); } ##=============================================================== return $loginid; } sub get_grade_html1 { my $grade_id=shift; my $count=shift; my($st, $sth, %grade_details, $grade_html); #$st = "select * from grades where (grade_status = 'yes' && $_[0] != '')"; $st = "select * from grades where grade_status = 'yes' "; $sth = $dbh->prepare($st); if (!($sth)) { print "$dbh->errstr.$st"; #dataerror($dbh->errstr.$st,$_[1],$_[2]); } if (!($sth->execute)) { #dataerror($dbh->errstr.$st,$_[1],$_[2]); print "$dbh->errstr.$st"; } $grade_html = ""; return $grade_html; } ##################################################################################### # get all S.F. from SF table corr. to pid to show in drop down with selected option # ##################################################################################### sub get_selected_sf_html { my(@psf_arr, $sf_html); @psf_arr = &get_id_array("select surface_finish_id from products_surface_finish where product_id = '$_[0]'"); $sf_html = ""; return $sf_html; } ##################################################################################### # get all E.C. from EC table corr. to pid to show in drop down with selected option # ##################################################################################### sub get_selected_ec_html { my($st, $sth, @pec_arr, $ec_html); @pec_arr = &get_id_array("select edge_cond_id from products_edge_condition where product_id = '$_[0]'"); $ec_html = ""; return $ec_html; } ############################################## # Insert value in table & return created id # ############################################## ##################################################################### # # Function to make the HTML code for dropdown having numeric values # Input # - Class Name (undefault) /blank # - Name of the dropdown # - What is to be shown at the top/start of dropdown # - Default value # - Initial value # - Final value # - Step # Returns # - Dropdown for the values according to passed parameters ###################################################################### sub count_dropdown { my($st,$sth,$dbh,$class,$dropdown_name,$default_text,$default_value,$initial_value,$final_value,$dropdown_html,$i,$step); $dropdown_name = $_[1]; $default_text = $_[2]; $default_value = $_[3]; $initial_value = $_[4]; $final_value = $_[5]; if (!($default_text)) { $default_text = "Select"; } $dropdown_html = "\n"; return $dropdown_html; } ##################################################################################### ######################################################### # Get javascript code to show state for India # ######################################################### sub get_cport_js { my ($cport_html, %state_val, $state_id, $form_name); $form_name = $_[0]; my($st, $sth, %state_val, %ctry); $st = "select * from sea_port order by sea_port_name"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st); } if (!($sth->execute)) { dataerror($dbh->errstr.$st); } while($state_details = $sth->fetchrow_hashref) { my $sid = $state_details->{'sea_port_id'}; my $sname = $state_details->{'sea_port_name'}; $state_val{$sid} = $sname; $ctry{$sid} = $state_details->{'fk_country_id'}; } $sth->finish; $cport_html = ""; return $cport_html; } ################################################ # get all the country list in select drop down # ################################################ sub get_selected_country_list_cport { my($st, $sth, $selected_country_details); $st = "select distinct country_id,country_name from country, sea_port where sea_port.fk_country_id = country.country_id order by country_no"; $sth = $dbh->prepare($st); if (!($sth)) { dataerror($dbh->errstr.$st); } if (!($sth->execute)) { dataerror($dbh->errstr.$st); } ###$country_list_html = ""; while($selected_country_details = $sth->fetchrow_hashref) { my $cid = $selected_country_details->{'country_id'}; if($cid eq $_[0] ) { $country_list_html_cport .= ""; } else { $country_list_html_cport .= ""; } } if ($_[0] eq 'other') { $country_list_html_cport .= ""; }else { $country_list_html_cport .= ""; } #$country_list_html_cport .= ""; $sth->finish; $country_list_html_cport .= ""; return $country_list_html_cport; }