%@ page import="allaire.taglib.*" %>
<%@ page import="java.text.NumberFormat,java.math.BigDecimal" %>
<%@ taglib uri="jruntags" prefix="jrun" %>
<%@ include file="header.html" %>
<%@ include file="global_vars_query.jsp" %>
<%-- **** IMPORT SUPPLIERS QUERY ********************************* --%>
select IMPORTS_DIGEST_5YR_CSC_QTR.CTRYNAME,
Sum(decode(YEAR, , CUSTOMS_VALUE,0))
AS YEAR_1,
Sum(decode(YEAR, , CUSTOMS_VALUE,0))
AS YEAR_2,
Sum(decode(YEAR, ,
decode(MONTH,'12',CUSTOMS_VALUE,0),0)) AS YEAR_3,
Sum(decode(YEAR, ,
decode(MONTH,'12',0,CUSTOMS_VALUE),0)) AS LAST_YTD,
Sum(decode(YEAR, ,
CUSTOMS_VALUE,0)) AS THIS_YTD
from
IMPORTS_DIGEST_5YR_CSC_QTR,
CTRY_GROUPS
where
CTRY_GROUPS.COUNTRY_CODE = IMPORTS_DIGEST_5YR_CSC_QTR.COUNTRY_CODE and
groups='SUB_SAHARA' and
RPCODE='99' and
CSC='4'
group by
IMPORTS_DIGEST_5YR_CSC_QTR.CTRYNAME
order by
YEAR_3 desc
<%-- *** DISPLAY TABLE ****************************************** --%>
|
U.S. International Trade Commission
Sub-Saharan Africa: Major U.S. import suppliers under
the Generalized System of Preferences, annual and year-to-date from
Jan - <%= current_month_abbrev %>
|
<%
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(1);
int rank = 0;
double year_1, year_2, year_3, last_ytd, this_ytd;
double top_ten_total_1 = 0;
double top_ten_total_2 = 0;
double top_ten_total_3 = 0;
double top_ten_total_last_ytd = 0;
double top_ten_total_this_ytd = 0;
double all_others_total_1 = 0;
double all_others_total_2 = 0;
double all_others_total_3 = 0;
double all_others_total_last_ytd = 0;
double all_others_total_this_ytd = 0;
double grand_total_1 = 0;
double grand_total_2 = 0;
double grand_total_3 = 0;
double grand_total_last_ytd = 0;
double grand_total_this_ytd = 0;
%>
(Million dollars, Customs value)
Rank |
Country |
<%= y1 %> |
<%= y2 %> |
<%= y3 %> |
<%= y3 %> YTD |
<%= y4 %> YTD |
<%
rank++;
year_1 = new BigDecimal(q1.get("YEAR_1")).doubleValue();
year_2 = new BigDecimal(q1.get("YEAR_2")).doubleValue();
year_3 = new BigDecimal(q1.get("YEAR_3")).doubleValue();
last_ytd = new BigDecimal(q1.get("LAST_YTD")).doubleValue();
this_ytd = new BigDecimal(q1.get("THIS_YTD")).doubleValue();
grand_total_1 += year_1;
grand_total_2 += year_2;
grand_total_3 += year_3;
grand_total_last_ytd += last_ytd;
grand_total_this_ytd += this_ytd;
if ( rank <= 10 ) {
top_ten_total_1 += year_1;
top_ten_total_2 += year_2;
top_ten_total_3 += year_3;
top_ten_total_last_ytd += last_ytd;
top_ten_total_this_ytd += this_ytd;
%>
<%= rank %> |
<%= q1.get("CTRYNAME") %> |
<%= nf.format(year_1 / 1000000) %> |
<%= nf.format(year_2 / 1000000) %> |
<%= nf.format(year_3 / 1000000) %> |
<%= nf.format(last_ytd / 1000000) %> |
<%= nf.format(this_ytd / 1000000) %> |
<% } else {
all_others_total_1 += year_1;
all_others_total_2 += year_2;
all_others_total_3 += year_3;
all_others_total_last_ytd += last_ytd;
all_others_total_this_ytd += this_ytd;
} %>
| Subtotal |
<%= nf.format(top_ten_total_1 / 1000000) %> |
<%= nf.format(top_ten_total_2 / 1000000) %> |
<%= nf.format(top_ten_total_3 / 1000000) %> |
<%= nf.format(top_ten_total_last_ytd / 10000000) %> |
<%= nf.format(top_ten_total_last_ytd / 10000000) %> |
| All other |
<%= nf.format(all_others_total_1 / 1000000) %> |
<%= nf.format(all_others_total_2 / 1000000) %> |
<%= nf.format(all_others_total_3 / 1000000) %> |
<%= nf.format(all_others_total_last_ytd / 10000000) %> |
<%= nf.format(all_others_total_this_ytd / 10000000) %> |
| Total |
<%= nf.format(grand_total_1 / 1000000) %> |
<%= nf.format(grand_total_2 / 1000000) %> |
<%= nf.format(grand_total_3 / 1000000) %> |
<%= nf.format(grand_total_last_ytd / 1000000) %> |
<%= nf.format(grand_total_this_ytd / 1000000) %> |
Note -- Because of rounding, figures may not add to the totals shown.
Source: Compiled by the U.S. International Trade Commission from
official statistics of the U.S. Department of Commerce
Back to Menu