📄 monthlyshipmentsmade.jsp
字号:
<%--
Created by IntelliJ IDEA.
User: jtgao
Date: 2006-5-20
Time: 14:04:46
To change this template use File | Settings | File Templates. //
--%>
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="com.hexiesoft.are.sql.ASResultSet" %>
<%@ page import="com.hexiesoft.are.util.DataConvert" %>
<%@ page import="com.hexiesoft.utils.Consts" %>
<%@ page import="com.hexiesoft.utils.StringUtils" %>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFCell" %>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFRow" %>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFSheet" %>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFWorkbook" %>
<%@ include file="/IncludeBeginMD.jsp" %>
<%
String TITLE = (String) Configure.getConfigure(sIe_Language, "Shipping_MonthShipMent").get("TITLE");
String LABLE_1 = (String) Configure.getConfigure(sIe_Language, "Shipping_MonthShipMent").get("LABLE_1");
String LABLE_2 = (String) Configure.getConfigure(sIe_Language, "Shipping_MonthShipMent").get("LABLE_2");
String LABLE_3 = (String) Configure.getConfigure(sIe_Language, "Shipping_MonthShipMent").get("LABLE_3");
String LABLE_T1 = (String) Configure.getConfigure(sIe_Language, "Shipping_MonthShipMent").get("LABLE_T1");
String LABLE_T2 = (String) Configure.getConfigure(sIe_Language, "Shipping_MonthShipMent").get("LABLE_T2");
String LABLE_T3 = (String) Configure.getConfigure(sIe_Language, "Shipping_MonthShipMent").get("LABLE_T3");
String LABLE_R1 = (String) Configure.getConfigure(sIe_Language, "Shipping_MonthShipMent").get("LABLE_R1");
String LABLE_R2 = (String) Configure.getConfigure(sIe_Language, "Shipping_MonthShipMent").get("LABLE_R2");
String LABLE_R3 = (String) Configure.getConfigure(sIe_Language, "Shipping_MonthShipMent").get("LABLE_R3");
String LABLE_R4 = (String) Configure.getConfigure(sIe_Language, "Shipping_MonthShipMent").get("LABLE_R4");
String LABLE_C1 = (String) Configure.getConfigure(sIe_Language, "Shipping_MonthShipMent").get("LABLE_C1");
String LABLE_C2 = (String) Configure.getConfigure(sIe_Language, "Shipping_MonthShipMent").get("LABLE_C2");
String LABLE_C3 = (String) Configure.getConfigure(sIe_Language, "Shipping_MonthShipMent").get("LABLE_C3");
String slocation = DataConvert.toRealString(iPostChange, (String) CurPage.getParameter("location"));
String sStratDate = DataConvert.toRealString(iPostChange, (String) CurPage.getParameter("StratDate"));
String sEnddate = DataConvert.toRealString(iPostChange, (String) CurPage.getParameter("Enddate"));
//out.println(slocation);
// one table
double mtot = 0.0f;
double mtotb = 0.0f;
double mtotc = 0.0f;
double mcanc = 0.0f;
double musac = 0.0f;
double moseasc = 0.0f;
double mcanb = 0.0f;
double musab = 0.0f;
double moseasb = 0.0f;
double mtotg = 0.0f;
double mtotbg = 0.0f;
double mtotcg = 0.0f;
double mcancg = 0.0f;
double musacg = 0.0f;
double moseascg = 0.0f;
double mcanbg = 0.0f;
double musabg = 0.0f;
double moseasbg = 0.0f;
double mtotd = 0.0f;
double mtotbd = 0.0f;
double mtotcd = 0.0f;
double mcancd = 0.0f;
double musacd = 0.0f;
double moseascd = 0.0f;
double mcanbd = 0.0f;
double musabd = 0.0f;
double moseasbd = 0.0f;
double usrate = 0.0f;
double ukrate = 0.0f;
double eurate = 0.0f;
double rate = 0.0f;
double mcang = 0.0f;
double musag = 0.0f;
double moseasg = 0.0f;
double mcan = 0.0f;
double musa = 0.0f;
double moseas = 0.0f;
double mcand = 0.0f;
double musad = 0.0f;
double moseasd = 0.0f;
// get rate
String sqlstatement = "select top 1 usrate,ukrate,eurate from global";
ASResultSet rs = Sqlca.getASResultSet(sqlstatement);
if (rs.next()) {
usrate = rs.getFloat("usrate");
ukrate = rs.getFloat("ukrate");
eurate = rs.getFloat("eurate");
}
rs.close();
sqlstatement = " select ordertype,shiptype, alloy, account, subacct, loaded, net, islbs, invextend "
+ " from shipment where shipment.ordertype = 'REG ' and shipdt between '" + sStratDate + "' and '" + sEnddate + "' and plant = '" + slocation + "'";
sqlstatement = "select a.account, a.subacct,a.shiptype,a.alloy,a.loaded,a.net, islbs,a.invextend ,b.country,b.currency from (" + sqlstatement
+ ") a , customer b where a.account = b.account and a.subacct = b.subacct and b.country in('U','C','O') ";
//out.println(sqlstatement);
String prevcust = "";
String prevalloy = "";
String account = "";
String subacct = "";
String alloy = "";
float gross = 0.0f;
float loaded = 0.0f;
boolean itscopper = false;
int islbs = 0;
float net = 0.0f;
String country = "";
float nMetric = 2.2046f;
String CURRENCY = "";
float invextend = 0.0f;
rs = Sqlca.getASResultSet(sqlstatement);
while (rs.next()) {
account = rs.getString("account"); // m.account = account
subacct = rs.getString("subacct");// m.subacct = subacct
CURRENCY = rs.getString("currency");
alloy = rs.getString("alloy"); //
invextend = rs.getFloat("invextend");
if (prevalloy.equals(alloy)) { // IF prevalloy = alloy
} else { // ELSE
//out.println(alloy.substring(0, 1));
if (alloy.substring(0, 1) .equals("1") || alloy.substring(0, 1) .equals("C")) {
itscopper = true;
} else {
itscopper = false;
} // itscopper = (alloy)
prevalloy = alloy; // prevalloy = alloy
} // ENDIF (prevalloy = alloy)
//
if (prevcust == (account + subacct)) { // IF prevcust = account+subacct
} else { // ELSE
// SELECT customer && customer
// SEEK m.account+m.subacct
prevcust = account + subacct; // prevcust=account+subacct
// SELECT curShipment
} // ENDIF (prevcust # TRIM(account+subacct)) (prevcust = account+subacct)
loaded = rs.getFloat("loaded"); //
gross = loaded * (-1.0f); // gross = loaded*(-1)
islbs = rs.getInt("islbs");
net = rs.getFloat("net");
country = rs.getString("country");
if (islbs == 1) { // IF islbs
if (itscopper) { // IF itscopper
mtotc = mtotc + net; // mtotc = mtotc+net
mtotcg = mtotcg + gross; // mtotcg = mtotcg+gross
if (country.equals("C")) { // DO CASE
// CASE customer.country='C'
mcanc = mcanc + net; // mcanc=mcanc+net
mcancg = mcancg + gross;
} // mcancg=mcancg+gross
if (country.equals("U")) { // CASE customer.country='U'
musac = musac + net; // musac=musac+net
musacg = musacg + gross;
} // musacg=musacg+gross
if (country.equals("O")) { // CASE customer.country='O'
moseasc = moseasc + net; // moseasc=moseasc+net
moseascg = moseascg + gross;
} // moseascg=moseascg+gross
// ENDCASE
} //
else { // ELSE
mtotb = mtotb + net; // mtotb=mtotb+net
mtotbg = mtotbg + gross; // mtotbg=mtotbg+gross
// DO CASE
if (country.equals("C")) { // CASE customer.country='C'
mcanb = mcanb + net; // mcanb=mcanb+net
mcanbg = mcanbg + gross;
}// mcanbg=mcanbg+gross
if (country.equals("U")) { // CASE customer.country='U'
musab = musab + net; // musab=musab+net
musabg = musabg + gross;
} // musabg=musabg+gross
if (country.equals("O")) { // CASE customer.country='O'
moseasb = moseasb + net; // moseasb=moseasb+net
moseasbg = moseasbg + gross; // moseasbg=moseasbg+gross
} // ENDCASE
} //itscopper // ENDIF (itscopper)
} else { // ELSE && kgs weight conversion
//out.println(country + "ddd");
if (itscopper) { // IF itscopper
mtotc = mtotc + (net * nMetric); // mtotc=mtotc+ROUND((net*m.nMetric),0)
mtotcg = mtotcg + (gross * nMetric);// mtotcg=mtotcg+ROUND((gross*m.nMetric),0)
// DO CASE
if (country.trim().equals("C")) { // CASE customer.country='C'
mcanc = mcanc + (net * nMetric);// mcanc=mcanc+ROUND((net*m.nMetric),0)
mcancg = mcancg + (gross * nMetric);
}// mcancg=mcancg+ROUND((gross*m.nMetric),0)
if (country.trim().equals("U")) { // CASE customer.country='U'
musac = musac + (net * nMetric);// musac=musac+ROUND((net*m.nMetric),0)
musacg = musacg + (gross * nMetric);
}// musacg=musacg+ROUND((gross*m.nMetric),0)
if (country.trim().equals("O")) { // CASE customer.country='O'
moseasc = moseasc + (net * nMetric);// moseasc=moseasc+ROUND((net*m.nMetric),0)
moseascg = moseascg + (gross * nMetric);
} // moseascg=moseascg+ROUND((gross*m.nMetric),0)
// ENDCASE
} else { // ELSE
mtotb = mtotb + (net * nMetric); // mtotb=mtotb+ROUND((net*m.nMetric),0)
mtotbg = mtotbg + (gross * nMetric);// mtotbg=mtotbg+ROUND((gross*m.nMetric),0)
// DO CASE
if (country.equals("C")) { // CASE customer.country='C'
mcanb = mcanb + (net * nMetric); // mcanb=mcanb+ROUND((net*m.nMetric),0)
mcanbg = mcanbg + (gross * nMetric);
}// mcanbg=mcanbg+ROUND((gross*m.nMetric),0)
if (country.equals("U")) { // CASE customer.country='U'
musab = musab + (net * nMetric); // musab=musab+ROUND((net*m.nMetric),0)
musabg = musabg + (gross * nMetric);
}// musabg=musabg+ROUND((gross*m.nMetric),0)
if (country.equals("O")) { // CASE customer.country='O'
moseasb = moseasb + (net * nMetric); // moseasb=moseasb+ROUND((net*m.nMetric),0)
moseasbg = moseasbg + (gross * nMetric);
}// moseasbg=moseasbg+ROUND((gross*m.nMetric),0)
// ENDCASE
} // ENDIF (itscopper)
}//islbs==1 // ENDIF (islbs)
// DO CASE
if (CURRENCY.equals("US")) { // CASE customer.CURRENCY = 'US'
rate = usrate;
} // m.rate=m.usrate
if (CURRENCY.equals("UK")) { // CASE customer.CURRENCY = 'UK'
rate = ukrate;
} // m.rate=m.ukrate
if (CURRENCY.equals("EU")) { // CASE customer.CURRENCY = 'EU'
rate = eurate;
} // m.rate=m.eurate
// ENDCASE
//
if (CURRENCY.equals("CA")) { // IF customer.CURRENCY = 'CA'
if (itscopper) { // IF itscopper
mtotcd = mtotcd + invextend;// mtotcd=mtotcd+invextend
if (country.equals("C")) { // DO CASE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -