Commit f346318f authored by ngadkari's avatar ngadkari

Migration Of Consumption Issue Confirm and Accounting effects for taxes not...

Migration Of Consumption Issue Confirm and Accounting effects for taxes not taking place on confirmation of consumption Issue.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@186482 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 51c9350e
...@@ -296,7 +296,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo ...@@ -296,7 +296,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo
errString = itmDBAccessEJB.getErrorString("", "GPNOERR", "", "", conn); errString = itmDBAccessEJB.getErrorString("", "GPNOERR", "", "", conn);
return errString; return errString;
} else { } else {
gpDate = getCurrtDate(); gpDate = new java.sql.Timestamp(System.currentTimeMillis());
sql = "update consume_iss set gp_no = ?, gp_date = ? where cons_issue = ? "; sql = "update consume_iss set gp_no = ?, gp_date = ? where cons_issue = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, gpno); pstmt.setString(1, gpno);
...@@ -326,7 +326,6 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo ...@@ -326,7 +326,6 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo
System.out.println("@@@@@@@@@@@118:::::::::::confirm record successfully........"); System.out.println("@@@@@@@@@@@118:::::::::::confirm record successfully........");
errString = itmDBAccessEJB.getErrorString("","CONFSUCC",""); errString = itmDBAccessEJB.getErrorString("","CONFSUCC","");
} }
} }
...@@ -424,6 +423,11 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo ...@@ -424,6 +423,11 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo
if (rs1.next()) { if (rs1.next()) {
keyFld = rs1.getString("cons_issue"); keyFld = rs1.getString("cons_issue");
} }
else
{
errString = itmDBAccessEJB.getErrorString("","VTLCKERR","","",conn);
return errString;
}
rs1.close(); rs1.close();
rs1 = null; rs1 = null;
pstmt1.close(); pstmt1.close();
...@@ -435,7 +439,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo ...@@ -435,7 +439,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo
pstmt = null; pstmt = null;
sql = "select cons_issue, issue_date, dept_code, item_ser,site_code__req,available_yn," sql = "select cons_issue, issue_date, dept_code, item_ser,site_code__req,available_yn,"
+ "curr_code,tran_type from consume_iss where cons_issue= ? and ( tran_type = 'I' )"; + "curr_code,tran_type from consume_iss where cons_issue= ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, consIssue); pstmt.setString(1, consIssue);
...@@ -464,7 +468,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo ...@@ -464,7 +468,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo
consIssHdrMap.put("tran_type", mtranType); consIssHdrMap.put("tran_type", mtranType);
consIssHdrMap.put("available_yn", avail); consIssHdrMap.put("available_yn", avail);
consIssHdrList.add(consIssHdrMap);
sql = " select cons_issue,line_no,cons_order,line_no__ord,item_code,quantity,unit,rate," sql = " select cons_issue,line_no,cons_order,line_no__ord,item_code,quantity,unit,rate,"
+ "acct_code,cctr_code,loc_code,lot_no,lot_sl,quantity__std,unit__std," + "acct_code,cctr_code,loc_code,lot_no,lot_sl,quantity__std,unit__std,"
...@@ -473,7 +477,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo ...@@ -473,7 +477,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, consIssue); pstmt.setString(1, consIssue);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { while (rs.next()) {
detconsIssue = rs.getString("cons_issue"); detconsIssue = rs.getString("cons_issue");
lineNo = rs.getString("line_no"); lineNo = rs.getString("line_no");
consOrder = rs.getString("cons_order"); consOrder = rs.getString("cons_order");
...@@ -493,6 +497,29 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo ...@@ -493,6 +497,29 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo
acctCodeInv = rs.getString("acct_code__inv"); acctCodeInv = rs.getString("acct_code__inv");
cctrCodeInv = rs.getString("cctr_code__inv"); cctrCodeInv = rs.getString("cctr_code__inv");
noArt = rs.getInt("no_art"); noArt = rs.getInt("no_art");
consIssDetMap = new HashMap();
consIssDetMap.put("cons_issue", detconsIssue);
consIssDetMap.put("line_no", lineNo);
consIssDetMap.put("cons_order", consOrder);
consIssDetMap.put("line_no__ord", lineNoOrd);
consIssDetMap.put("item_code", itemCode);
consIssDetMap.put("quantity", quantity);
consIssDetMap.put("unit", unit);
consIssDetMap.put("rate", rate);
consIssDetMap.put("acct_code", acctCode);
consIssDetMap.put("cctr_code", cctrCode);
consIssDetMap.put("loc_code", locCode);
consIssDetMap.put("lot_no", lotNo);
consIssDetMap.put("lot_sl", lotSl);
consIssDetMap.put("quantity__std", quantityStd);
consIssDetMap.put("unit__std", unitStd);
consIssDetMap.put("qc_reqd", qcReqd);
consIssDetMap.put("acct_code__inv", acctCodeInv);
consIssDetMap.put("cctr_code__inv", cctrCodeInv);
consIssDetMap.put("no_art", noArt);
consIssDetList.add(consIssDetMap);
} }
rs.close(); rs.close();
...@@ -500,30 +527,9 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo ...@@ -500,30 +527,9 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
consIssDetMap = new HashMap();
consIssDetMap.put("cons_issue", detconsIssue);
consIssDetMap.put("line_no", lineNo); errString = gbfPostConsIss(consIssHdrMap, consIssDetList, tranSer, xtraParams, conn);
consIssDetMap.put("cons_order", consOrder);
consIssDetMap.put("line_no__ord", lineNoOrd);
consIssDetMap.put("item_code", itemCode);
consIssDetMap.put("quantity", quantity);
consIssDetMap.put("unit", unit);
consIssDetMap.put("rate", rate);
consIssDetMap.put("acct_code", acctCode);
consIssDetMap.put("cctr_code", cctrCode);
consIssDetMap.put("loc_code", locCode);
consIssDetMap.put("lot_no", lotNo);
consIssDetMap.put("lot_sl", lotSl);
consIssDetMap.put("quantity__std", quantityStd);
consIssDetMap.put("unit__std", unitStd);
consIssDetMap.put("qc_reqd", qcReqd);
consIssDetMap.put("acct_code__inv", acctCodeInv);
consIssDetMap.put("cctr_code__inv", cctrCodeInv);
consIssDetMap.put("no_art", noArt);
consIssDetList.add(consIssDetMap);
errString = gbfPostConsIss(consIssHdrList, consIssDetList, tranSer, xtraParams, conn);
if (errString != null && errString.trim().length() > 0) { if (errString != null && errString.trim().length() > 0) {
return errString; return errString;
} }
...@@ -556,7 +562,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo ...@@ -556,7 +562,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo
} }
private String gbfPostConsIss(ArrayList consIssHdrList, ArrayList consIssDetList, String tranSer, String xtraParams, private String gbfPostConsIss(HashMap consIssHdrMap, ArrayList consIssDetList, String tranSer, String xtraParams,
Connection conn) throws RemoteException, ITMException { Connection conn) throws RemoteException, ITMException {
String consIss = "", tranType = "",tranTypeStk="", unit = "", acctCodeOrd = "", cctrCodeOrd = "", locCode = "", lotNo = "",locCodeIss="", String consIss = "", tranType = "",tranTypeStk="", unit = "", acctCodeOrd = "", cctrCodeOrd = "", locCode = "", lotNo = "",locCodeIss="",
temp = "", ret = "", invlink = "", invStat = "", sundryType = "",qOrderType=""; temp = "", ret = "", invlink = "", invStat = "", sundryType = "",qOrderType="";
...@@ -590,7 +596,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo ...@@ -590,7 +596,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo
StockUpdate stkUpd ; StockUpdate stkUpd ;
InvHoldGen invHoldGen = new InvHoldGen(); InvHoldGen invHoldGen = new InvHoldGen();
HashMap consIssHdrMap = null, consIssDetMap = null, updConsiss = null,lstrQOrd = null,stkUpdMap= null; HashMap consIssDetMap = null, updConsiss = null,lstrQOrd = null,stkUpdMap= null;
HashMap stockQtyMap = new HashMap(); HashMap stockQtyMap = new HashMap();
ArrayList<HashMap<String, String>> stockList = new ArrayList<HashMap<String, String>>(); ArrayList<HashMap<String, String>> stockList = new ArrayList<HashMap<String, String>>();
boolean rateChanged = false; boolean rateChanged = false;
...@@ -601,11 +607,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo ...@@ -601,11 +607,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo
/* /*
* temp="confirmed object"; sql ="select :ls_temp into :ls_temp from dual"; * temp="confirmed object"; sql ="select :ls_temp into :ls_temp from dual";
*/ */
//header Data
for (int ctr = 0; ctr < consIssHdrList.size(); ctr++) {
consIssHdrMap = new HashMap();
consIssHdrMap = (HashMap) consIssHdrList.get(ctr);
hdrconsIssue = (String) consIssHdrMap.get("cons_issue"); hdrconsIssue = (String) consIssHdrMap.get("cons_issue");
issueDate = (Timestamp)consIssHdrMap.get("issue_date"); issueDate = (Timestamp)consIssHdrMap.get("issue_date");
sundryCode = (String) consIssHdrMap.get("dept_code"); sundryCode = (String) consIssHdrMap.get("dept_code");
...@@ -615,7 +617,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo ...@@ -615,7 +617,7 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo
tranType = (String) consIssHdrMap.get("tran_type"); tranType = (String) consIssHdrMap.get("tran_type");
avail=(String) consIssHdrMap.get("available_yn"); avail=(String) consIssHdrMap.get("available_yn");
/* taxAmt =Double.parseDouble(detListMap.get("tax_amt").toString()); */ /* taxAmt =Double.parseDouble(detListMap.get("tax_amt").toString()); */
}
for (int ctr = 0; ctr < consIssDetList.size(); ctr++) { for (int ctr = 0; ctr < consIssDetList.size(); ctr++) {
consIssDetMap = new HashMap(); consIssDetMap = new HashMap();
...@@ -641,765 +643,766 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo ...@@ -641,765 +643,766 @@ public class ConsumeIssueConf extends ActionHandlerEJB implements ConsumeIssueCo
acctCodeInv = (String) consIssDetMap.get("acct_code__inv"); acctCodeInv = (String) consIssDetMap.get("acct_code__inv");
cctrCodeInv = (String) consIssDetMap.get("cctr_code__inv"); cctrCodeInv = (String) consIssDetMap.get("cctr_code__inv");
noArt = Integer.parseInt(consIssDetMap.get("no_art").toString()); noArt = Integer.parseInt(consIssDetMap.get("no_art").toString());
}
// pb Code is not migrated // pb Code is not migrated
/* /*
* ls_costctr_as_loccode = gf_getenv_dis('999999','CCENTER_AS_LOCATION') if * ls_costctr_as_loccode = gf_getenv_dis('999999','CCENTER_AS_LOCATION') if
* ls_costctr_as_loccode <> "NULLFOUND" and ls_costctr_as_loccode = 'Y' THEN if * ls_costctr_as_loccode <> "NULLFOUND" and ls_costctr_as_loccode = 'Y' THEN if
* ls_trantype = 'I' then ls_sitecode = * ls_trantype = 'I' then ls_sitecode =
* lds_hdr.getitemstring(1,"site_code__req") for ll_ctr = 1 to ll_rows * lds_hdr.getitemstring(1,"site_code__req") for ll_ctr = 1 to ll_rows
* ls_cons_iss = lds_det.getitemstring(ll_ctr,"cons_issue") ll_cons_line = * ls_cons_iss = lds_det.getitemstring(ll_ctr,"cons_issue") ll_cons_line =
* lds_det.getitemnumber(ll_ctr,"line_no") ls_co = * lds_det.getitemnumber(ll_ctr,"line_no") ls_co =
* lds_det.getitemstring(ll_ctr,"cons_order") ll_co_line = * lds_det.getitemstring(ll_ctr,"cons_order") ll_co_line =
* lds_det.getitemnumber(ll_ctr,"line_no__ord") ls_itemcode = * lds_det.getitemnumber(ll_ctr,"line_no__ord") ls_itemcode =
* lds_det.getitemstring(ll_ctr,"item_code") ls_loccodeiss = * lds_det.getitemstring(ll_ctr,"item_code") ls_loccodeiss =
* lds_det.getitemstring(ll_ctr,"loc_code") ls_lotno = * lds_det.getitemstring(ll_ctr,"loc_code") ls_lotno =
* lds_det.getitemstring(ll_ctr,"lot_no") ls_lotsl = * lds_det.getitemstring(ll_ctr,"lot_no") ls_lotsl =
* lds_det.getitemstring(ll_ctr,"lot_sl") lc_quantity = * lds_det.getitemstring(ll_ctr,"lot_sl") lc_quantity =
* lds_det.getitemnumber(ll_ctr,"quantity") ls_acct_ord = * lds_det.getitemnumber(ll_ctr,"quantity") ls_acct_ord =
* lds_det.getitemstring(ll_ctr,"acct_code") ls_cctr_ord = * lds_det.getitemstring(ll_ctr,"acct_code") ls_cctr_ord =
* lds_det.getitemstring(ll_ctr,"cctr_code") ls_acct_iss = * lds_det.getitemstring(ll_ctr,"cctr_code") ls_acct_iss =
* lds_det.getitemstring(ll_ctr,"acct_code__inv") ls_cctr_iss = * lds_det.getitemstring(ll_ctr,"acct_code__inv") ls_cctr_iss =
* lds_det.getitemstring(ll_ctr,"cctr_code__inv") if isnull(ls_acct_iss) or * lds_det.getitemstring(ll_ctr,"cctr_code__inv") if isnull(ls_acct_iss) or
* len(trim(ls_acct_iss)) = 0 then //prince 30-03-05 convert in case when // * len(trim(ls_acct_iss)) = 0 then //prince 30-03-05 convert in case when //
* select nvl(acct_code__inv,' '), nvl(cctr_code__inv,' ') // into :ls_acct_iss, * select nvl(acct_code__inv,' '), nvl(cctr_code__inv,' ') // into :ls_acct_iss,
* :ls_cctr_iss // from stock // where item_code = :ls_itemcode and // site_code * :ls_cctr_iss // from stock // where item_code = :ls_itemcode and // site_code
* = :ls_sitecode and // loc_code = :ls_loccodeiss and // lot_no = :ls_lotno and * = :ls_sitecode and // loc_code = :ls_loccodeiss and // lot_no = :ls_lotno and
* // lot_sl = :ls_lotsl ; select when acct_code__inv is null then ' ' * // lot_sl = :ls_lotsl ; select when acct_code__inv is null then ' '
* else acct_code__inv end), (case when cctr_code__inv is null then ' ' else * else acct_code__inv end), (case when cctr_code__inv is null then ' ' else
* cctr_code__inv end) into :ls_acct_iss, :ls_cctr_iss from stock where * cctr_code__inv end) into :ls_acct_iss, :ls_cctr_iss from stock where
* item_code = :ls_itemcode and site_code = :ls_sitecode and loc_code = * item_code = :ls_itemcode and site_code = :ls_sitecode and loc_code =
* :ls_loccodeiss and lot_no = :ls_lotno and lot_sl = :ls_lotsl ; end if * :ls_loccodeiss and lot_no = :ls_lotno and lot_sl = :ls_lotsl ; end if
* *
* //// Added on 16/04/2k5 by Ruchira if ( ( isnull(ls_acct_iss) or * //// Added on 16/04/2k5 by Ruchira if ( ( isnull(ls_acct_iss) or
* trim(ls_acct_iss) = '' ) OR & ( isnull(ls_cctr_iss) or trim(ls_cctr_iss) = '' * trim(ls_acct_iss) = '' ) OR & ( isnull(ls_cctr_iss) or trim(ls_cctr_iss) = ''
* ) ) then ls_ret = * ) ) then ls_ret =
* nvo_acct_code_inv.gbf_acct_detr_ttype(ls_itemcode,ls_item_ser,'IN', * nvo_acct_code_inv.gbf_acct_detr_ttype(ls_itemcode,ls_item_ser,'IN',
* ls_trantype) if left(ls_ret,5) = 'DS000' then ls_acct_iss = ' ' ls_cctr_iss = * ls_trantype) if left(ls_ret,5) = 'DS000' then ls_acct_iss = ' ' ls_cctr_iss =
* ' ' else ls_acct_iss = f_get_token(ls_ret,'~t') ls_cctr_iss = ls_ret end if * ' ' else ls_acct_iss = f_get_token(ls_ret,'~t') ls_cctr_iss = ls_ret end if
* end if //// End of Added on 16/04/2k5 by Ruchira * end if //// End of Added on 16/04/2k5 by Ruchira
* *
* if trim(ls_cctr_ord) <> trim(ls_cctr_iss) then // create a stock transfer * if trim(ls_cctr_ord) <> trim(ls_cctr_iss) then // create a stock transfer
* entry * entry
* *
* if isnull(ls_acct_ord) or len(trim(ls_acct_ord)) = 0 then ls_invlink = * if isnull(ls_acct_ord) or len(trim(ls_acct_ord)) = 0 then ls_invlink =
* gf_getfinparm('999999', 'INV_ACCT_CISS') // if ls_invlink = 'NULLFOUND' then * gf_getfinparm('999999', 'INV_ACCT_CISS') // if ls_invlink = 'NULLFOUND' then
* // ls_errcode = 'VTFINPARM~tVariabe INV_ACCT_CISS not defined under Financial * // ls_errcode = 'VTFINPARM~tVariabe INV_ACCT_CISS not defined under Financial
* Variables' // goto errfound // end if // // ls_invlink = * Variables' // goto errfound // end if // // ls_invlink =
* left(trim(ls_invlink), 1) // if pos('Y_N', ls_inv_online) = 0 then // * left(trim(ls_invlink), 1) // if pos('Y_N', ls_inv_online) = 0 then //
* ls_errcode = 'VTFINPARM1~tVariabe INV_ACCT_CISS value should be Y or N under * ls_errcode = 'VTFINPARM1~tVariabe INV_ACCT_CISS value should be Y or N under
* Financial Variables' // goto errfound // end if // ls_invlink = * Financial Variables' // goto errfound // end if // ls_invlink =
* trim(ls_invlink) * trim(ls_invlink)
* *
* if ls_inv_online = 'Y' then ls_errcode = "INVACCT~tInventory A/c not defined" * if ls_inv_online = 'Y' then ls_errcode = "INVACCT~tInventory A/c not defined"
* goto errfound end if end if * goto errfound end if end if
* *
* lds_transfer.reset() ll_newrow = lds_transfer.insertrow(0) //prince 30-03-05 * lds_transfer.reset() ll_newrow = lds_transfer.insertrow(0) //prince 30-03-05
* convert in case when Select (case when rate is null then 0 else rate end), * convert in case when Select (case when rate is null then 0 else rate end),
* (case when gross_rate is null then 0 else gross_rate end),pack_instr, * (case when gross_rate is null then 0 else gross_rate end),pack_instr,
* dimension,supp_code__mfg,acct_code__inv, * dimension,supp_code__mfg,acct_code__inv,
* cctr_code__inv,rate__oh,acct_code__oh,cctr_code__oh, * cctr_code__inv,rate__oh,acct_code__oh,cctr_code__oh,
* pack_code,site_code__mfg, grade, batch_no, unit__alt, potency_perc, mfg_date, * pack_code,site_code__mfg, grade, batch_no, unit__alt, potency_perc, mfg_date,
* exp_date, retest_date, conv__qty_stduom, alloc_qty into :lc_rate, * exp_date, retest_date, conv__qty_stduom, alloc_qty into :lc_rate,
* :lc_grossrate,:ls_packinstr,:ls_dimension,:ls_suppcodemfg,:s_update. * :lc_grossrate,:ls_packinstr,:ls_dimension,:ls_suppcodemfg,:s_update.
* acctcodecr, :s_update.cctrcodecr,:ld_rateoh,:ls_acctcodeoh,:ls_cctrcodeoh, * acctcodecr, :s_update.cctrcodecr,:ld_rateoh,:ls_acctcodeoh,:ls_cctrcodeoh,
* :ls_packcode,:ls_sitecodemfg, :ls_grade, :ls_batchno, :ls_unitalt, * :ls_packcode,:ls_sitecodemfg, :ls_grade, :ls_batchno, :ls_unitalt,
* :lc_potencyperc,:ldt_mfgdate, :ldt_expdate, :ldt_retestdt, :lc_conv, * :lc_potencyperc,:ldt_mfgdate, :ldt_expdate, :ldt_retestdt, :lc_conv,
* :lc_allocqty from stock where item_code = :ls_itemcode and site_code = * :lc_allocqty from stock where item_code = :ls_itemcode and site_code =
* :ls_sitecode and loc_code = :ls_loccodeiss and lot_no = :ls_lotno and lot_sl * :ls_sitecode and loc_code = :ls_loccodeiss and lot_no = :ls_lotno and lot_sl
* = :ls_lotsl ; if get_sqlcode() < 0 then ls_errcode = "DS000" + * = :ls_lotsl ; if get_sqlcode() < 0 then ls_errcode = "DS000" +
* string(sqlca.sqldbcode) + "~t" + sqlca.sqlerrtext goto errfound elseif * string(sqlca.sqldbcode) + "~t" + sqlca.sqlerrtext goto errfound elseif
* get_sqlcode() = 100 then ls_errcode = "~tInvalid Stock, not exist" goto * get_sqlcode() = 100 then ls_errcode = "~tInvalid Stock, not exist" goto
* errfound end if // rahul changed on 18-07-03 for stock allocation trace // * errfound end if // rahul changed on 18-07-03 for stock allocation trace //
* update stock set alloc_qty = alloc_qty - :lc_allocqty // where item_code = * update stock set alloc_qty = alloc_qty - :lc_allocqty // where item_code =
* :ls_itemcode and // site_code = :ls_sitecode and // loc_code = :ls_loccodeiss * :ls_itemcode and // site_code = :ls_sitecode and // loc_code = :ls_loccodeiss
* and // lot_no = :ls_lotno and // lot_sl = :ls_lotsl ; // if get_sqlcode() < 0 * and // lot_no = :ls_lotno and // lot_sl = :ls_lotsl ; // if get_sqlcode() < 0
* then // ls_errcode = "DS000" + string(sqlca.sqldbcode) + "~t" + * then // ls_errcode = "DS000" + string(sqlca.sqldbcode) + "~t" +
* sqlca.sqlerrtext // goto errfound // end if ls_temp='inv allocate start * sqlca.sqlerrtext // goto errfound // end if ls_temp='inv allocate start
* '+string(lc_allocqty) select :ls_temp into :ls_temp from dual; * '+string(lc_allocqty) select :ls_temp into :ls_temp from dual;
* *
* *
* if isnull(lc_allocqty) then lc_allocqty = 0.000 lstr_allocate.tran_date = * if isnull(lc_allocqty) then lc_allocqty = 0.000 lstr_allocate.tran_date =
* datetime(today()) lstr_allocate.ref_ser = as_transer lstr_allocate.ref_id = * datetime(today()) lstr_allocate.ref_ser = as_transer lstr_allocate.ref_id =
* ls_cons_iss lstr_allocate.ref_line = string(ll_cons_line) * ls_cons_iss lstr_allocate.ref_line = string(ll_cons_line)
* lstr_allocate.site_code = ls_sitecode lstr_allocate.item_code = ls_itemcode * lstr_allocate.site_code = ls_sitecode lstr_allocate.item_code = ls_itemcode
* lstr_allocate.loc_code = ls_loccodeiss lstr_allocate.lot_no = ls_lotno * lstr_allocate.loc_code = ls_loccodeiss lstr_allocate.lot_no = ls_lotno
* lstr_allocate.lot_sl = ls_lotsl lstr_allocate.alloc_qty = -1 * lc_allocqty * lstr_allocate.lot_sl = ls_lotsl lstr_allocate.alloc_qty = -1 * lc_allocqty
* lstr_allocate.chg_user = userid lstr_allocate.chg_term = termid * lstr_allocate.chg_user = userid lstr_allocate.chg_term = termid
* lstr_allocate.chg_win = "W_CONSUME_ISSUE" ls_errcode = * lstr_allocate.chg_win = "W_CONSUME_ISSUE" ls_errcode =
* lnvo_allocate.gbf_upd_alloc_trace(lstr_allocate) * lnvo_allocate.gbf_upd_alloc_trace(lstr_allocate)
* *
* ls_temp='inv allocate 1 error code '+ls_errcode select :ls_temp into :ls_temp * ls_temp='inv allocate 1 error code '+ls_errcode select :ls_temp into :ls_temp
* from dual; * from dual;
* *
* if (not isnull(ls_errcode)) and (len(trim(ls_errcode)) > 0) then ls_temp='inv * if (not isnull(ls_errcode)) and (len(trim(ls_errcode)) > 0) then ls_temp='inv
* allocate 1 exit got error code '+ls_errcode select :ls_temp into :ls_temp * allocate 1 exit got error code '+ls_errcode select :ls_temp into :ls_temp
* from dual; exit end if ls_temp='transfer set quantity '+string(lc_quantity) * from dual; exit end if ls_temp='transfer set quantity '+string(lc_quantity)
* select :ls_temp into :ls_temp from dual; * select :ls_temp into :ls_temp from dual;
* *
* *
* //18-07-03 lds_transfer.setitem(ll_newrow,"ref_id",ls_cons_iss) * //18-07-03 lds_transfer.setitem(ll_newrow,"ref_id",ls_cons_iss)
* lds_transfer.setitem(ll_newrow,"ref_ser",'XFRX') * lds_transfer.setitem(ll_newrow,"ref_ser",'XFRX')
* lds_transfer.setitem(ll_newrow,"item_code",ls_itemcode) * lds_transfer.setitem(ll_newrow,"item_code",ls_itemcode)
* lds_transfer.setitem(ll_newrow,"site_code__fr",ls_sitecode) * lds_transfer.setitem(ll_newrow,"site_code__fr",ls_sitecode)
* lds_transfer.setitem(ll_newrow,"site_code__to",ls_sitecode) * lds_transfer.setitem(ll_newrow,"site_code__to",ls_sitecode)
* lds_transfer.setitem(ll_newrow,"tran_date",lds_hdr.getitemdatetime(1, * lds_transfer.setitem(ll_newrow,"tran_date",lds_hdr.getitemdatetime(1,
* "issue_date")) lds_transfer.setitem(ll_newrow,"reas_code","XFRX") * "issue_date")) lds_transfer.setitem(ll_newrow,"reas_code","XFRX")
* lds_transfer.setitem(ll_newrow,"remarks","Auto transfer C-ISS") * lds_transfer.setitem(ll_newrow,"remarks","Auto transfer C-ISS")
* lds_transfer.setitem(ll_newrow,"ref_ser__for",'XFRX') * lds_transfer.setitem(ll_newrow,"ref_ser__for",'XFRX')
* lds_transfer.setitem(ll_newrow,"ref_id__for",ls_cons_iss) * lds_transfer.setitem(ll_newrow,"ref_id__for",ls_cons_iss)
* lds_transfer.setitem(ll_newrow,"loc_code__fr",ls_loccodeiss) * lds_transfer.setitem(ll_newrow,"loc_code__fr",ls_loccodeiss)
* lds_transfer.setitem(ll_newrow,"lot_no__fr",ls_lotno) * lds_transfer.setitem(ll_newrow,"lot_no__fr",ls_lotno)
* lds_transfer.setitem(ll_newrow,"lot_no__to",ls_lotno) * lds_transfer.setitem(ll_newrow,"lot_no__to",ls_lotno)
* lds_transfer.setitem(ll_newrow,"lot_sl__fr",ls_lotsl) * lds_transfer.setitem(ll_newrow,"lot_sl__fr",ls_lotsl)
* lds_transfer.setitem(ll_newrow,"lot_sl__to",ls_lotsl) * lds_transfer.setitem(ll_newrow,"lot_sl__to",ls_lotsl)
* *
* // Ashok on 30/11/02 The loc needs to changes so that the cctr to which // * // Ashok on 30/11/02 The loc needs to changes so that the cctr to which //
* the material is issued is inserted in stock table // This will be reqd. while * the material is issued is inserted in stock table // This will be reqd. while
* CITN // lds_transfer.setitem(ll_newrow,"loc_code__to",ls_loccodeiss) // // * CITN // lds_transfer.setitem(ll_newrow,"loc_code__to",ls_loccodeiss) // //
* check the variable if required set cost center code as loc. code * check the variable if required set cost center code as loc. code
* *
* if ls_costctr_as_loccode <> "NULLFOUND" and ls_costctr_as_loccode = 'Y' THEN * if ls_costctr_as_loccode <> "NULLFOUND" and ls_costctr_as_loccode = 'Y' THEN
* lds_transfer.setitem(ll_newrow,"loc_code__to",ls_cctr_ord) else * lds_transfer.setitem(ll_newrow,"loc_code__to",ls_cctr_ord) else
* lds_transfer.setitem(ll_newrow,"loc_code__to",ls_loccodeiss) end if // * lds_transfer.setitem(ll_newrow,"loc_code__to",ls_loccodeiss) end if //
* 30/11/02 * 30/11/02
* lds_transfer.setitem(ll_newrow,"unit",lds_det.getitemstring(ll_ctr,"unit")) * lds_transfer.setitem(ll_newrow,"unit",lds_det.getitemstring(ll_ctr,"unit"))
* lds_transfer.setitem(ll_newrow,"quantity",lc_quantity ) * lds_transfer.setitem(ll_newrow,"quantity",lc_quantity )
* lds_transfer.setitem(ll_newrow,"mfg_date",ldt_mfgdate) * lds_transfer.setitem(ll_newrow,"mfg_date",ldt_mfgdate)
* lds_transfer.setitem(ll_newrow,"site_code__mfg",ls_sitecodemfg) * lds_transfer.setitem(ll_newrow,"site_code__mfg",ls_sitecodemfg)
* lds_transfer.setitem(ll_newrow,"potency_perc",lc_potencyperc) * lds_transfer.setitem(ll_newrow,"potency_perc",lc_potencyperc)
* lds_transfer.setitem(ll_newrow,"pack_code",ls_packcode) * lds_transfer.setitem(ll_newrow,"pack_code",ls_packcode)
* lds_transfer.setitem(ll_newrow,"acct_code__dr",ls_acct_iss) * lds_transfer.setitem(ll_newrow,"acct_code__dr",ls_acct_iss)
* lds_transfer.setitem(ll_newrow,"cctr_code__dr",ls_cctr_ord) * lds_transfer.setitem(ll_newrow,"cctr_code__dr",ls_cctr_ord)
* lds_transfer.setitem(ll_newrow,"acct_code__cr",ls_acct_iss) * lds_transfer.setitem(ll_newrow,"acct_code__cr",ls_acct_iss)
* lds_transfer.setitem(ll_newrow,"cctr_code__cr",ls_cctr_iss) * lds_transfer.setitem(ll_newrow,"cctr_code__cr",ls_cctr_iss)
* *
* ls_errcode = * ls_errcode =
* lnvo_trf.gbf_transfer_stock(lds_transfer.describe("datawindow.data")) * lnvo_trf.gbf_transfer_stock(lds_transfer.describe("datawindow.data"))
* ls_temp='describe data transfer * ls_temp='describe data transfer
* data'+string(lds_transfer.describe("datawindow.data")) select :ls_temp into * data'+string(lds_transfer.describe("datawindow.data")) select :ls_temp into
* :ls_temp from dual; if not isnull(ls_errcode) and len(trim(ls_errcode)) > 0 * :ls_temp from dual; if not isnull(ls_errcode) and len(trim(ls_errcode)) > 0
* then goto errfound end if // Ashok alloc_qty needs to be increased from loc * then goto errfound end if // Ashok alloc_qty needs to be increased from loc
* where stock is transferred // it will be reduced from stock update function * where stock is transferred // it will be reduced from stock update function
* // rahul on 18-07-03 for stock allocation trace // update stock set alloc_qty * // rahul on 18-07-03 for stock allocation trace // update stock set alloc_qty
* = alloc_qty + :lc_allocqty // where item_code = :ls_itemcode and // site_code * = alloc_qty + :lc_allocqty // where item_code = :ls_itemcode and // site_code
* = :ls_sitecode and // loc_code = :ls_cctr_ord and // lot_no = :ls_lotno and * = :ls_sitecode and // loc_code = :ls_cctr_ord and // lot_no = :ls_lotno and
* // lot_sl = :ls_lotsl ; // if get_sqlcode() < 0 then // ls_errcode = "DS000" * // lot_sl = :ls_lotsl ; // if get_sqlcode() < 0 then // ls_errcode = "DS000"
* + string(sqlca.sqldbcode) + "~t" + sqlca.sqlerrtext // goto errfound // end * + string(sqlca.sqldbcode) + "~t" + sqlca.sqlerrtext // goto errfound // end
* if if isnull(lc_allocqty) then lc_allocqty = 0.000 lstr_allocate.tran_date = * if if isnull(lc_allocqty) then lc_allocqty = 0.000 lstr_allocate.tran_date =
* datetime(today()) lstr_allocate.ref_ser = as_transer lstr_allocate.ref_id = * datetime(today()) lstr_allocate.ref_ser = as_transer lstr_allocate.ref_id =
* ls_cons_iss lstr_allocate.ref_line = string(ll_cons_line) * ls_cons_iss lstr_allocate.ref_line = string(ll_cons_line)
* lstr_allocate.site_code = ls_sitecode lstr_allocate.item_code = ls_itemcode * lstr_allocate.site_code = ls_sitecode lstr_allocate.item_code = ls_itemcode
* lstr_allocate.loc_code = ls_loccodeiss lstr_allocate.lot_no = ls_lotno * lstr_allocate.loc_code = ls_loccodeiss lstr_allocate.lot_no = ls_lotno
* lstr_allocate.lot_sl = ls_lotsl lstr_allocate.alloc_qty = lc_allocqty * lstr_allocate.lot_sl = ls_lotsl lstr_allocate.alloc_qty = lc_allocqty
* lstr_allocate.chg_user = userid lstr_allocate.chg_term = termid * lstr_allocate.chg_user = userid lstr_allocate.chg_term = termid
* lstr_allocate.chg_win = "W_CONSUME_ISSUE" * lstr_allocate.chg_win = "W_CONSUME_ISSUE"
* *
* ls_temp='inv allocate before code '+string(lstr_allocate.alloc_qty) select * ls_temp='inv allocate before code '+string(lstr_allocate.alloc_qty) select
* :ls_temp into :ls_temp from dual; * :ls_temp into :ls_temp from dual;
* *
* ls_errcode = lnvo_allocate.gbf_upd_alloc_trace(lstr_allocate) * ls_errcode = lnvo_allocate.gbf_upd_alloc_trace(lstr_allocate)
* *
* ls_temp='inv allocate 2 error code '+ls_errcode select :ls_temp into :ls_temp * ls_temp='inv allocate 2 error code '+ls_errcode select :ls_temp into :ls_temp
* from dual; * from dual;
* *
* *
* if (not isnull(ls_errcode)) and (len(trim(ls_errcode)) > 0) then ls_temp='inv * if (not isnull(ls_errcode)) and (len(trim(ls_errcode)) > 0) then ls_temp='inv
* allocate 2 got exit error code '+ls_errcode select :ls_temp into :ls_temp * allocate 2 got exit error code '+ls_errcode select :ls_temp into :ls_temp
* from dual; exit end if * from dual; exit end if
* *
* //18-07-03 // if ls_invlink = 'Y' then // inventory accounting posting * //18-07-03 // if ls_invlink = 'Y' then // inventory accounting posting
* ls_errcode = * ls_errcode =
* lnvo_fin.gbf_stk_transfer_post(lds_transfer.describe("datawindow.data")) * lnvo_fin.gbf_stk_transfer_post(lds_transfer.describe("datawindow.data"))
* *
* ls_temp='stock transfer describe * ls_temp='stock transfer describe
* '+string(lds_transfer.describe("datawindow.data")) select :ls_temp into * '+string(lds_transfer.describe("datawindow.data")) select :ls_temp into
* :ls_temp from dual; * :ls_temp from dual;
* *
* if not isnull(ls_errcode) and len(trim(ls_errcode)) > 0 then goto errfound * if not isnull(ls_errcode) and len(trim(ls_errcode)) > 0 then goto errfound
* end if // end if // update consumption issue detail with the new // Ashok on * end if // end if // update consumption issue detail with the new // Ashok on
* 30/11 the loc_code should be updated to the cost center to which the // * 30/11 the loc_code should be updated to the cost center to which the //
* material is issued otherwise the stock will be removed twice from the cctr * material is issued otherwise the stock will be removed twice from the cctr
* issuing the // material update consume_iss_det set cctr_code__inv = * issuing the // material update consume_iss_det set cctr_code__inv =
* :ls_cctr_ord,loc_code = :ls_cctr_ord where cons_issue = :ls_cons_iss and * :ls_cctr_ord,loc_code = :ls_cctr_ord where cons_issue = :ls_cons_iss and
* line_no = :ll_cons_line ; if get_sqlcode() <> 0 then errcode = "DS000" + * line_no = :ll_cons_line ; if get_sqlcode() <> 0 then errcode = "DS000" +
* string(sqlca.sqldbcode) + * string(sqlca.sqldbcode) +
* "~t Error updating issue detail (gbf_post_cons_iss()) " + sqlca.sqlerrtext * "~t Error updating issue detail (gbf_post_cons_iss()) " + sqlca.sqlerrtext
* goto errfound end if end if * goto errfound end if end if
* *
* next ////////////////////////////////////////// // retrieve the data again * next ////////////////////////////////////////// // retrieve the data again
* because the inventory A/c , cctr // might be changed now lds_hdr.reset() * because the inventory A/c , cctr // might be changed now lds_hdr.reset()
* lds_det.reset() lds_hdr.retrieve(cons_iss) ll_rows = * lds_det.reset() lds_hdr.retrieve(cons_iss) ll_rows =
* lds_det.retrieve(cons_iss) end if end if * lds_det.retrieve(cons_iss) end if end if
*/ */
///////// 18/03/02 transfer of stock //////////////////////// ///////// 18/03/02 transfer of stock ////////////////////////
rateChanged = false; rateChanged = false;
tranId=detconsIssue; tranId=detconsIssue;
if ("R".equalsIgnoreCase(tranType.trim())) { if ("R".equalsIgnoreCase(tranType.trim())) {
tranSer = "C-IRTN"; tranSer = "C-IRTN";
} else { } else {
tranSer = "C-ISS"; tranSer = "C-ISS";
} }
if ("R".equalsIgnoreCase(tranType.trim())) { if ("R".equalsIgnoreCase(tranType.trim())) {
tranTypeStk = tranType; tranTypeStk = tranType;
} else { } else {
tranTypeStk = "ID"; tranTypeStk = "ID";
} }
sql = "select inv_stat from location where loc_code = ?"; sql = "select inv_stat from location where loc_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, locCode);
rs = pstmt.executeQuery();
if (rs.next()) {
invStat = rs.getString("inv_stat");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (lotSl == null || lotSl.trim().length() == 0) {
lotSl = " ";
}
if (lotNo == null || lotNo.trim().length() == 0) {
lotNo = " ";
}
sundryType = "D";
if ("R".equalsIgnoreCase(tranType.trim()))
{
sql = "select a.loc_code from consume_iss_det a, consume_iss b where a.cons_issue = b.cons_issue "
+ " and b.cons_order = ? and a.line_no__ord = ? and b.tran_type = ? "
+ " and b.confirmed = ? and a.lot_no = ? and a.lot_sl = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, consOrder); pstmt.setString(1, locCode);
pstmt.setInt(2, lineNoOrd);
pstmt.setString(3, "I");
pstmt.setString(4, "Y");
pstmt.setString(5, lotNo);
pstmt.setString(5, lotSl);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next()) {
locCodeIss = rs.getString("loc_code"); invStat = rs.getString("inv_stat");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
}
else
{
locCodeIss=locCode;
}
sql = "Select (case when rate is null then 0 else rate end) as rate,(case when gross_rate is null then 0 else gross_rate end) as gross_rate ,"
+ "pack_instr, dimension,supp_code__mfg,acct_code__inv, "
+ "cctr_code__inv,rate__oh,acct_code__oh,cctr_code__oh, pack_code,site_code__mfg, grade,mfg_date,exp_date,retest_date,"
+ "conv__qty_stduom,unit__alt,actual_rate from stock where item_code = ? and site_code = ? and loc_code =? "
+ "and lot_no = ? and lot_sl = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
pstmt.setString(2,siteCodeReq);
pstmt.setString(3,locCodeIss);
pstmt.setString(4,lotNo);
pstmt.setString(5,lotSl);
rs = pstmt.executeQuery();
if (rs.next()) {
rate= rs.getDouble("rate");
grossRate=rs.getDouble("gross_rate");
packinStr=rs.getString("pack_instr");
dimension=rs.getString("dimension");
suppCodeMfg=rs.getString("supp_code__mfg");
acctcodeCR=rs.getString("acct_code__inv");
cctrCodeCR=rs.getString("cctr_code__inv");
rateoh=rs.getDouble("rate__oh");
acctCodeOh=rs.getString("acct_code__oh");
cctrCodeOh=rs.getString("cctr_code__oh");
packCode=rs.getString("pack_code");
siteCodeMfg=rs.getString("site_code__mfg");
grade =rs.getString("grade");
mfgDate=rs.getTimestamp("mfg_date");
expDate =rs.getTimestamp("exp_date");
retestDt =rs.getTimestamp("retest_date");
conv =rs.getDouble("conv__qty_stduom");
unitAlt =rs.getString("unit__alt");
actualRate=rs.getDouble("actual_rate");
} if (lotSl == null || lotSl.trim().length() == 0) {
rs.close(); lotSl = " ";
rs = null;
pstmt.close();
pstmt = null;
if((acctcodeCR== null ||acctcodeCR.trim().length()==0) ||(cctrCodeCR== null ||cctrCodeCR.trim().length()==0 ) )
{
ret=finCommon.getAcctDetrTtype(itemCode, itemSer, "IN", tranType,conn);
System.out.println("retResult :"+ret);
if (ret.substring(ret.length()-5).equals("DS000"))
{
acctcodeCR = " ";
cctrCodeCR = " ";
} }
else if (lotNo == null || lotNo.trim().length() == 0) {
{ lotNo = " ";
acctCodeCRArrLst = genericUtility.getTokenList(ret, ",");
System.out.println("acctCodeCRArrLst.size :"+acctCodeCRArrLst.size());
System.out.println("acctCodeCRArrLst.get(1) :"+(String)acctCodeCRArrLst.get(1));
acctcodeCR = (String)acctCodeCRArrLst.get(0);
System.out.println("acctCodeCR :"+acctcodeCR);
cctrCodeCR = (String)acctCodeCRArrLst.get(1);
System.out.println("cctrCodeCR :"+cctrCodeCR);
} }
} sundryType = "D";
if(acctcodeCR== null ||acctcodeCR.trim().length()==0) if ("R".equalsIgnoreCase(tranType.trim()))
{
invOnline = finCommon.getFinparams("999999","INV_ACCT_CISS",conn);
if("NULLFOUND".equalsIgnoreCase(invOnline))
{ {
errString = itmDBAccessEJB.getErrorString("","VTFINPARM","","",conn); sql = "select a.loc_code from consume_iss_det a, consume_iss b where a.cons_issue = b.cons_issue "
return errString; + " and b.cons_order = ? and a.line_no__ord = ? and b.tran_type = ? "
} + " and b.confirmed = ? and a.lot_no = ? and a.lot_sl = ?";
invOnline = invOnline.trim();
if("Y".equalsIgnoreCase(invOnline))
{
errString = itmDBAccessEJB.getErrorString("","INVACCT","","",conn);
return errString;
}
}
acctCodeInv=acctcodeCR;
cctrCodeInv=cctrCodeCR;
acctcodeCR = acctCodeOrd;
cctrCodeCR = cctrCodeOrd;
if ("R".equalsIgnoreCase(tranType.trim()))
{
gsRunMode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "gs_run_mode");
if ("R".equalsIgnoreCase(qcReqd.trim()) && "I".equalsIgnoreCase(gsRunMode))
{
lstrQOrd = new HashMap();
qOrderDate = getCurrtDate();
tranSer="C-IRTN";
qOrderType= "I";
tranId=detconsIssue;
sql = " select supp_code,supp_code__mfg, mfg_date,exp_date from item_lot_info "
+ "where item_code = ? and lot_no = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode); pstmt.setString(1, consOrder);
pstmt.setString(2, lotNo); pstmt.setInt(2, lineNoOrd);
pstmt.setString(3, "I");
pstmt.setString(4, "Y");
pstmt.setString(5, lotNo);
pstmt.setString(5, lotSl);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next()) {
suppCode = rs.getString("supp_code"); locCodeIss = rs.getString("loc_code");
qSuppCodeMfg = rs.getString("supp_code__mfg");
qMfgDate = rs.getTimestamp("mfg_date");
qExpDate = rs.getTimestamp("exp_date");
sql1 = "select c.exp_date , c.mfg_date, c.supp_code__mfg from consume_iss_det a, consume_iss b, stock c "
+ "where a.cons_issue = b.cons_issue and c.item_code = ? and c.item_code = a.item_code "
+ "and c.lot_no = ? and c.site_code = ? and a.cons_order = ? and a.line_no__ord =? "
+ "and b.confirmed = 'Y' and b.tran_type = 'I' and c.exp_date is not null";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, itemCode);
pstmt1.setString(2, lotNo);
pstmt1.setString(3, siteCodeReq);
pstmt1.setString(4, consOrder);
pstmt1.setInt(5, lineNoOrd);
rs1 = pstmt1.executeQuery();
if (rs1.next()) {
qExpDate = rs1.getTimestamp("exp_date");
qMfgDate = rs1.getTimestamp("mfg_date");
suppCodeMfg = rs1.getString("supp_code__mfg");
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
String expdate = (qExpDate == null) ? null : sdf.format(qExpDate);
String mfgdate = (qMfgDate == null) ? null : sdf.format(qMfgDate);
lstrQOrd.put("supp_code", suppCode);
lstrQOrd.put("supp_code__mfg", qSuppCodeMfg);
lstrQOrd.put("qorder_type", qOrderType);
lstrQOrd.put("qorder_date", qOrderDate);
lstrQOrd.put("site_code", siteCodeReq);
lstrQOrd.put("item_code", itemCode);
lstrQOrd.put("quantity", quantity);
lstrQOrd.put("lot_no", lotNo);
lstrQOrd.put("lot_sl", lotSl);
lstrQOrd.put("loc_code",locCode);
lstrQOrd.put("tran_id", tranId);
lstrQOrd.put("batch_no",lotNo);
lstrQOrd.put("qc_create_type", "A");
lineNo= " "+lineNo;
lineNo = lineNo.substring(lineNo.length()-3, lineNo.length());
lstrQOrd.put("line_no", lineNo);
lstrQOrd.put("unit", unit);
lstrQOrd.put("qc_create_type", "A");
lstrQOrd.put("transer", tranSer);
lstrQOrd.put("expiry_date", qExpDate);
lstrQOrd.put("mfg_date", qMfgDate);
lstrQOrd.put("route_code", null);
errString = createQc(lstrQOrd, xtraParams, conn) ;
if (errString != null && errString.trim().length() > 0)
{
return errString;
}
//ls_qcord_no[upperbound(ls_qcord_no) + 1] =lstr_qord.qcorder_no ------PB code not migrated
} }
} else
if ("I".equalsIgnoreCase(tranType.trim())) {
{ locCodeIss=locCode;
sql = "select (case when a.quantity is null then 0 else a.quantity end)as quantity from stock a, invstat b where a.inv_stat = b.inv_stat and" }
+ " a.site_code = ? and a.item_code =? and a.loc_code = ? and a.lot_no = ? and a.lot_sl = ? and b.available = ? " ; sql = "Select (case when rate is null then 0 else rate end) as rate,(case when gross_rate is null then 0 else gross_rate end) as gross_rate ,"
+ "pack_instr, dimension,supp_code__mfg,acct_code__inv, "
+ "cctr_code__inv,rate__oh,acct_code__oh,cctr_code__oh, pack_code,site_code__mfg, grade,mfg_date,exp_date,retest_date,"
+ "conv__qty_stduom,unit__alt,actual_rate from stock where item_code = ? and site_code = ? and loc_code =? "
+ "and lot_no = ? and lot_sl = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCodeReq); pstmt.setString(1,itemCode);
pstmt.setString(2, itemCode); pstmt.setString(2,siteCodeReq);
pstmt.setString(3, locCode); pstmt.setString(3,locCodeIss);
pstmt.setString(4, lotNo); pstmt.setString(4,lotNo);
pstmt.setString(5, lotSl); pstmt.setString(5,lotSl);
pstmt.setString(6, avail);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next()) {
{ rate= rs.getDouble("rate");
stkQty = checkDoubleNull(rs.getString("quantity")); grossRate=rs.getDouble("gross_rate");
packinStr=rs.getString("pack_instr");
dimension=rs.getString("dimension");
suppCodeMfg=rs.getString("supp_code__mfg");
acctcodeCR=rs.getString("acct_code__inv");
cctrCodeCR=rs.getString("cctr_code__inv");
rateoh=rs.getDouble("rate__oh");
acctCodeOh=rs.getString("acct_code__oh");
cctrCodeOh=rs.getString("cctr_code__oh");
packCode=rs.getString("pack_code");
siteCodeMfg=rs.getString("site_code__mfg");
grade =rs.getString("grade");
mfgDate=rs.getTimestamp("mfg_date");
expDate =rs.getTimestamp("exp_date");
retestDt =rs.getTimestamp("retest_date");
conv =rs.getDouble("conv__qty_stduom");
unitAlt =rs.getString("unit__alt");
actualRate=rs.getDouble("actual_rate");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if (stkQty < quantity ) if((acctcodeCR== null ||acctcodeCR.trim().length()==0) ||(cctrCodeCR== null ||cctrCodeCR.trim().length()==0 ) )
{ {
errString = itmDBAccessEJB.getErrorString("", "VTSTOCK1", "", "", conn); ret=finCommon.getAcctDetrTtype(itemCode, itemSer, "IN", tranType,conn);
return errString; System.out.println("retResult :"+ret);
if (ret.substring(ret.length()-5).equals("DS000"))
{
acctcodeCR = " ";
cctrCodeCR = " ";
}
else
{
acctCodeCRArrLst = genericUtility.getTokenList(ret, ",");
System.out.println("acctCodeCRArrLst.size :"+acctCodeCRArrLst.size());
System.out.println("acctCodeCRArrLst.get(1) :"+(String)acctCodeCRArrLst.get(1));
acctcodeCR = (String)acctCodeCRArrLst.get(0);
System.out.println("acctCodeCR :"+acctcodeCR);
cctrCodeCR = (String)acctCodeCRArrLst.get(1);
System.out.println("cctrCodeCR :"+cctrCodeCR);
}
} }
} if(acctcodeCR== null ||acctcodeCR.trim().length()==0)
stkUpdMap = new HashMap();
stkUpdMap.put("gross_rate", Double.toString(grossRate));
stkUpdMap.put("qty_stduom", Double.toString(quantityStd));
stkUpdMap.put("item_code", itemCode);
stkUpdMap.put("no_art", Double.toString(noArt));
stkUpdMap.put("site_code", siteCodeReq);
stkUpdMap.put("loc_code", locCode);
stkUpdMap.put("lot_no", lotNo);
stkUpdMap.put("lot_sl", lotSl);
stkUpdMap.put("unit", unit);
stkUpdMap.put("unit__alt", unitAlt);
stkUpdMap.put("tran_type", tranTypeStk);
tranDate=getCurrtDate();
stkUpdMap.put("tran_date", tranDate);
stkUpdMap.put("tran_ser", tranSer);
stkUpdMap.put("tran_id", tranId);
stkUpdMap.put("acct_code__dr", acctCodeOrd);
stkUpdMap.put("cctr_code__dr", cctrCodeOrd);
stkUpdMap.put("acct_code__cr", acctcodeCR);
stkUpdMap.put("cctr_code__cr", cctrCodeCR);
stkUpdMap.put("acct_code_inv", acctcodeCR);
stkUpdMap.put("cctr_code_inv", cctrCodeCR);
stkUpdMap.put("line_no", lineNo);
stkUpdMap.put("rate", Double.toString(rate));
stkUpdMap.put("actual_rate", Double.toString(actualRate));
stkUpdMap.put("site_code__mfg", siteCodeMfg);
stkUpdMap.put("supp_code__mfg", suppCodeMfg);
stkUpdMap.put("pack_code", packCode);
stkUpdMap.put("mfg_date", mfgDate);
stkUpdMap.put("exp_date", expDate);
stkUpdMap.put("inv_stat", invStat);
stkUpdMap.put("retest_date", retestDt);
stkUpdMap.put("grade", grade);
stkUpdMap.put("conv__qty_stduom", Double.toString(conv));
stkUpdMap.put("batch_no", lotNo);
stkUpd = new StockUpdate();
errString = stkUpd.updateStock(stkUpdMap, xtraParams, conn);
if (errString == null || errString.trim().length() == 0)
{
if("Y".equalsIgnoreCase(qcReqd))
{ {
quarLockCode=distCommon.getDisparams("999999", "QUARNTINE_LOCKCODE", conn);
System.out.println("quarLockCode:::::::"+quarLockCode); invOnline = finCommon.getFinparams("999999","INV_ACCT_CISS",conn);
if("NULLFOUND".equalsIgnoreCase(quarLockCode)) if("NULLFOUND".equalsIgnoreCase(invOnline))
{ {
quarLockCode=" "; errString = itmDBAccessEJB.getErrorString("","VTFINPARM","","",conn);
return errString;
} }
if (quarLockCode != null && quarLockCode.trim().length() > 0) invOnline = invOnline.trim();
if("Y".equalsIgnoreCase(invOnline))
{ {
sql = "select count(*) from consume_iss_det where cons_issue = ? and line_no = ? " ; errString = itmDBAccessEJB.getErrorString("","INVACCT","","",conn);
pstmt = conn.prepareStatement(sql); return errString;
pstmt.setString(1, detconsIssue); }
pstmt.setString(2, lineNo);
}
acctCodeInv=acctcodeCR;
cctrCodeInv=cctrCodeCR;
acctcodeCR = acctCodeOrd;
cctrCodeCR = cctrCodeOrd;
if ("R".equalsIgnoreCase(tranType.trim()))
{
gsRunMode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "gs_run_mode");
if ("R".equalsIgnoreCase(qcReqd.trim()) && "I".equalsIgnoreCase(gsRunMode))
{
lstrQOrd = new HashMap();
qOrderDate = getCurrtDate();
tranSer="C-IRTN";
qOrderType= "I";
tranId=detconsIssue;
sql = " select supp_code,supp_code__mfg, mfg_date,exp_date from item_lot_info "
+ "where item_code = ? and lot_no = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
pstmt.setString(2, lotNo);
rs = pstmt.executeQuery();
if (rs.next()) {
suppCode = rs.getString("supp_code");
qSuppCodeMfg = rs.getString("supp_code__mfg");
qMfgDate = rs.getTimestamp("mfg_date");
qExpDate = rs.getTimestamp("exp_date");
rs = pstmt.executeQuery(); sql1 = "select c.exp_date , c.mfg_date, c.supp_code__mfg from consume_iss_det a, consume_iss b, stock c "
if (rs.next()) + "where a.cons_issue = b.cons_issue and c.item_code = ? and c.item_code = a.item_code "
{ + "and c.lot_no = ? and c.site_code = ? and a.cons_order = ? and a.line_no__ord =? "
cnt = rs.getInt(1); + "and b.confirmed = 'Y' and b.tran_type = 'I' and c.exp_date is not null";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, itemCode);
pstmt1.setString(2, lotNo);
pstmt1.setString(3, siteCodeReq);
pstmt1.setString(4, consOrder);
pstmt1.setInt(5, lineNoOrd);
rs1 = pstmt1.executeQuery();
if (rs1.next()) {
qExpDate = rs1.getTimestamp("exp_date");
qMfgDate = rs1.getTimestamp("mfg_date");
suppCodeMfg = rs1.getString("supp_code__mfg");
} }
rs.close(); rs1.close();
rs = null; rs1 = null;
pstmt.close(); pstmt1.close();
pstmt = null; pstmt1 = null;
if(cnt > 0) }
{ rs.close();
sql = "select b.site_code__req,a.item_code,a.loc_code,a.lot_no,a.lot_sl from consume_iss b, consume_iss_det a" rs = null;
+"where a.cons_issue = b.cons_issue and b.cons_order = ? " pstmt.close();
+ "and a.line_no__ord = ? and b.cons_issue = ?" ; pstmt = null;
String expdate = (qExpDate == null) ? null : sdf.format(qExpDate);
String mfgdate = (qMfgDate == null) ? null : sdf.format(qMfgDate);
lstrQOrd.put("supp_code", suppCode);
lstrQOrd.put("supp_code__mfg", qSuppCodeMfg);
lstrQOrd.put("qorder_type", qOrderType);
lstrQOrd.put("qorder_date", qOrderDate);
lstrQOrd.put("site_code", siteCodeReq);
lstrQOrd.put("item_code", itemCode);
lstrQOrd.put("quantity", quantity);
lstrQOrd.put("lot_no", lotNo);
lstrQOrd.put("lot_sl", lotSl);
lstrQOrd.put("loc_code",locCode);
lstrQOrd.put("tran_id", tranId);
lstrQOrd.put("batch_no",lotNo);
lstrQOrd.put("qc_create_type", "A");
lineNo= " "+lineNo;
lineNo = lineNo.substring(lineNo.length()-3, lineNo.length());
lstrQOrd.put("line_no", lineNo);
lstrQOrd.put("unit", unit);
lstrQOrd.put("qc_create_type", "A");
lstrQOrd.put("transer", tranSer);
lstrQOrd.put("expiry_date", qExpDate);
lstrQOrd.put("mfg_date", qMfgDate);
lstrQOrd.put("route_code", null);
errString = createQc(lstrQOrd, xtraParams, conn) ;
if (errString != null && errString.trim().length() > 0)
{
return errString;
}
//ls_qcord_no[upperbound(ls_qcord_no) + 1] =lstr_qord.qcorder_no ------PB code not migrated
}
}
if ("I".equalsIgnoreCase(tranType.trim()))
{
sql = "select (case when a.quantity is null then 0 else a.quantity end)as quantity from stock a, invstat b where a.inv_stat = b.inv_stat and"
+ " a.site_code = ? and a.item_code =? and a.loc_code = ? and a.lot_no = ? and a.lot_sl = ? and b.available = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCodeReq);
pstmt.setString(2, itemCode);
pstmt.setString(3, locCode);
pstmt.setString(4, lotNo);
pstmt.setString(5, lotSl);
pstmt.setString(6, avail);
rs = pstmt.executeQuery();
if (rs.next())
{
stkQty = checkDoubleNull(rs.getString("quantity"));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (stkQty < quantity )
{
errString = itmDBAccessEJB.getErrorString("", "VTSTOCK1", "", "", conn);
return errString;
}
}
stkUpdMap = new HashMap();
stkUpdMap.put("gross_rate", Double.toString(grossRate));
stkUpdMap.put("qty_stduom", Double.toString(quantityStd));
stkUpdMap.put("item_code", itemCode);
stkUpdMap.put("no_art", Double.toString(noArt));
stkUpdMap.put("site_code", siteCodeReq);
stkUpdMap.put("loc_code", locCode);
stkUpdMap.put("lot_no", lotNo);
stkUpdMap.put("lot_sl", lotSl);
stkUpdMap.put("unit", unit);
stkUpdMap.put("unit__alt", unitAlt);
stkUpdMap.put("tran_type", tranTypeStk);
tranDate=getCurrtDate();
stkUpdMap.put("tran_date", tranDate);
stkUpdMap.put("tran_ser", tranSer);
stkUpdMap.put("tran_id", tranId);
stkUpdMap.put("acct_code__dr", acctCodeOrd);
stkUpdMap.put("cctr_code__dr", cctrCodeOrd);
stkUpdMap.put("acct_code__cr", acctcodeCR);
stkUpdMap.put("cctr_code__cr", cctrCodeCR);
stkUpdMap.put("acct_code_inv", acctcodeCR);
stkUpdMap.put("cctr_code_inv", cctrCodeCR);
stkUpdMap.put("line_no", lineNo);
stkUpdMap.put("rate", Double.toString(rate));
stkUpdMap.put("actual_rate", Double.toString(actualRate));
stkUpdMap.put("site_code__mfg", siteCodeMfg);
stkUpdMap.put("supp_code__mfg", suppCodeMfg);
stkUpdMap.put("pack_code", packCode);
stkUpdMap.put("mfg_date", mfgDate);
stkUpdMap.put("exp_date", expDate);
stkUpdMap.put("inv_stat", invStat);
stkUpdMap.put("retest_date", retestDt);
stkUpdMap.put("grade", grade);
stkUpdMap.put("conv__qty_stduom", Double.toString(conv));
stkUpdMap.put("batch_no", lotNo);
stkUpd = new StockUpdate();
errString = stkUpd.updateStock(stkUpdMap, xtraParams, conn);
if (errString == null || errString.trim().length() == 0)
{
if("Y".equalsIgnoreCase(qcReqd))
{
quarLockCode=distCommon.getDisparams("999999", "QUARNTINE_LOCKCODE", conn);
System.out.println("quarLockCode:::::::"+quarLockCode);
if("NULLFOUND".equalsIgnoreCase(quarLockCode))
{
quarLockCode=" ";
}
if (quarLockCode != null && quarLockCode.trim().length() > 0)
{
sql = "select count(*) from consume_iss_det where cons_issue = ? and line_no = ? " ;
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, consOrder); pstmt.setString(1, detconsIssue);
pstmt.setInt(2, lineNoOrd); pstmt.setString(2, lineNo);
pstmt.setString(3, detconsIssue);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
siteCodeReq = rs.getString("site_code__req"); cnt = rs.getInt(1);
itemCode = rs.getString("item_code");
locCode = rs.getString("loc_code");
lotNo = rs.getString("lot_no");
lotSl = rs.getString("lot_sl");
stockQtyMap.put( "site_code", siteCodeReq );
stockQtyMap.put( "item_code", itemCode );
stockQtyMap.put( "loc_code", locCode );
stockQtyMap.put( "lot_no", lotNo );
stockQtyMap.put( "lot_sl", lotSl );
stockList.add( stockQtyMap );
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} if(cnt > 0)
errString = invHoldGen.generateHoldTrans(quarLockCode, detconsIssue, "C-IRTN", siteCodeReq, stockList, xtraParams, conn); {
sql = "select b.site_code__req,a.item_code,a.loc_code,a.lot_no,a.lot_sl from consume_iss b, consume_iss_det a"
+"where a.cons_issue = b.cons_issue and b.cons_order = ? "
+ "and a.line_no__ord = ? and b.cons_issue = ?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, consOrder);
pstmt.setInt(2, lineNoOrd);
pstmt.setString(3, detconsIssue);
rs = pstmt.executeQuery();
if (rs.next())
{
siteCodeReq = rs.getString("site_code__req");
itemCode = rs.getString("item_code");
locCode = rs.getString("loc_code");
lotNo = rs.getString("lot_no");
lotSl = rs.getString("lot_sl");
stockQtyMap.put( "site_code", siteCodeReq );
stockQtyMap.put( "item_code", itemCode );
stockQtyMap.put( "loc_code", locCode );
stockQtyMap.put( "lot_no", lotNo );
stockQtyMap.put( "lot_sl", lotSl );
stockList.add( stockQtyMap );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
errString = invHoldGen.generateHoldTrans(quarLockCode, detconsIssue, "C-IRTN", siteCodeReq, stockList, xtraParams, conn);
}
} }
} }
} if ("I".equalsIgnoreCase(tranType.trim()))
if ("I".equalsIgnoreCase(tranType.trim()))
{
sql = "update consume_ord_det set issue_qty = (case when issue_qty is null then 0 else issue_qty end) + ? where cons_order = ? and line_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, quantity);
pstmt.setString(2, consOrder);
pstmt.setInt(3, lineNoOrd);
cnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
else
{
sql = "update consume_ord_det set issue_qty = (case when issue_qty is null then 0 else issue_qty end) - ? where cons_order = ? and line_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, quantity);
pstmt.setString(2, consOrder);
pstmt.setInt(3, lineNoOrd);
cnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
if (cnt < 0) {
errString = itmDBAccessEJB.getErrorString("", "DS000", "", "", conn);
return errString;
}
if ("I".equalsIgnoreCase(tranType.trim()))
{
sql = "select sum(case when quantity is null then 0 else quantity end) as quantity,SUM(case when issue_qty is null then 0 else issue_qty end) as issue_qty " +
" from consume_ord_det where cons_order = ? and line_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, consOrder);
pstmt.setInt(2, lineNoOrd);
rs = pstmt.executeQuery();
if (rs.next())
{ {
totOrder = rs.getDouble("quantity"); sql = "update consume_ord_det set issue_qty = (case when issue_qty is null then 0 else issue_qty end) + ? where cons_order = ? and line_no = ? ";
totIssue = rs.getDouble("issue_qty"); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, quantity);
pstmt.setString(2, consOrder);
pstmt.setInt(3, lineNoOrd);
cnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
} }
rs.close(); else
rs = null;
pstmt.close();
pstmt = null;
if(totOrder > 0 && totOrder == totIssue )
{ {
sql = "update consume_ord_det set status = 'D',status_date = ? where cons_order =? and line_no = ? "; sql = "update consume_ord_det set issue_qty = (case when issue_qty is null then 0 else issue_qty end) - ? where cons_order = ? and line_no = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, tranDate); pstmt.setDouble(1, quantity);
pstmt.setString(2, consOrder); pstmt.setString(2, consOrder);
pstmt.setInt(3, lineNoOrd); pstmt.setInt(3, lineNoOrd);
cnt = pstmt.executeUpdate(); cnt = pstmt.executeUpdate();
if (cnt < 0) {
errString = itmDBAccessEJB.getErrorString("", "DS000", "", "", conn);
return errString;
}
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
}
if (oldRate != rate)
{
rateChanged=true;
/* gs_taxstring = gf_batch_tax_data('C-ISS',ls_cons_iss,ldw_dummy,right(' ' + string(ll_cons_line),3), 1)
lc_taxamt = gf_calc_tax_ds(lds_detedit,lds_tax,'C-ISS',ls_cons_iss,ldt_taxdate,"rate","quantity__std",0,ls_curr_code,'2')
if lc_taxamt = -999999999 then
ls_errcode = "DSTAXERR"
goto errfound
end if
lc_qty = lds_det.getitemnumber(ll_ctr,"quantity")
lc_totamt = (lc_qty * lc_rate)
Update consume_iss_det
set rate = :lc_rate,
net_amt = :lc_totamt + :lc_taxamt,
amount = :lc_totamt,
tax_amt = :lc_taxamt
where cons_issue = :ls_cons_iss
and line_no = :ll_cons_line;
if get_sqlcode() <> 0 then
ls_errcode = 'DS000' + trim(string(sqlca.sqldbcode))+ '~t'+ sqlca.sqlerrtext
goto errfound
end if*/
//pb code not migrated
/*totAmt=quantity * rate;
sql = "Update consume_iss_det set rate= ?, net_amt = ?, amount =?, tax_amt = ? where cons_issue =? and line_no=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, rate);
pstmt.setString(2, consOrder);
pstmt.setInt(3, lineNoOrd);
cnt = pstmt.executeUpdate();
if (cnt < 0) { if (cnt < 0) {
errString = itmDBAccessEJB.getErrorString("", "DS000", "", "", conn); errString = itmDBAccessEJB.getErrorString("", "DS000", "", "", conn);
return errString; return errString;
} }
pstmt.close(); if ("I".equalsIgnoreCase(tranType.trim()))
pstmt = null;*/
}
if ("I".equalsIgnoreCase(tranType.trim())&& errString.trim().length() == 0)
{
sql = "select count(*) from consume_ord_det where cons_order = ? and "
+ "(case when status is null then 'P' else status end) <> 'D'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, consOrder);
rs = pstmt.executeQuery();
if (rs.next())
{ {
cnt = rs.getInt(1); sql = "select sum(case when quantity is null then 0 else quantity end) as quantity,SUM(case when issue_qty is null then 0 else issue_qty end) as issue_qty " +
" from consume_ord_det where cons_order = ? and line_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, consOrder);
pstmt.setInt(2, lineNoOrd);
rs = pstmt.executeQuery();
if (rs.next())
{
totOrder = rs.getDouble("quantity");
totIssue = rs.getDouble("issue_qty");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(totOrder > 0 && totOrder == totIssue )
{
sql = "update consume_ord_det set status = 'D',status_date = ? where cons_order =? and line_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, tranDate);
pstmt.setString(2, consOrder);
pstmt.setInt(3, lineNoOrd);
cnt = pstmt.executeUpdate();
if (cnt < 0) {
errString = itmDBAccessEJB.getErrorString("", "DS000", "", "", conn);
return errString;
}
pstmt.close();
pstmt = null;
}
} }
rs.close(); if (oldRate != rate)
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0)
{ {
sql = "update consume_ord set status = 'D',status_date = ? where cons_order =?"; rateChanged=true;
/* gs_taxstring = gf_batch_tax_data('C-ISS',ls_cons_iss,ldw_dummy,right(' ' + string(ll_cons_line),3), 1)
lc_taxamt = gf_calc_tax_ds(lds_detedit,lds_tax,'C-ISS',ls_cons_iss,ldt_taxdate,"rate","quantity__std",0,ls_curr_code,'2')
if lc_taxamt = -999999999 then
ls_errcode = "DSTAXERR"
goto errfound
end if
lc_qty = lds_det.getitemnumber(ll_ctr,"quantity")
lc_totamt = (lc_qty * lc_rate)
Update consume_iss_det
set rate = :lc_rate,
net_amt = :lc_totamt + :lc_taxamt,
amount = :lc_totamt,
tax_amt = :lc_taxamt
where cons_issue = :ls_cons_iss
and line_no = :ll_cons_line;
if get_sqlcode() <> 0 then
ls_errcode = 'DS000' + trim(string(sqlca.sqldbcode))+ '~t'+ sqlca.sqlerrtext
goto errfound
end if*/
//pb code not migrated
/*totAmt=quantity * rate;
sql = "Update consume_iss_det set rate= ?, net_amt = ?, amount =?, tax_amt = ? where cons_issue =? and line_no=? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, today); pstmt.setDouble(1, rate);
pstmt.setString(2, consOrder); pstmt.setString(2, consOrder);
pstmt.setInt(3, lineNoOrd);
cnt = pstmt.executeUpdate(); cnt = pstmt.executeUpdate();
if (cnt < 0) { if (cnt < 0) {
errString = itmDBAccessEJB.getErrorString("", "DS000", "", "", conn); errString = itmDBAccessEJB.getErrorString("", "DS000", "", "", conn);
return errString; return errString;
} }
pstmt.close(); pstmt.close();
pstmt = null;*/
}
if ("I".equalsIgnoreCase(tranType.trim())&& errString.trim().length() == 0)
{
sql = "select count(*) from consume_ord_det where cons_order = ? and "
+ "(case when status is null then 'P' else status end) <> 'D'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, consOrder);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null; pstmt = null;
if (cnt == 0)
{
sql = "update consume_ord set status = 'D',status_date = ? where cons_order =?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, today);
pstmt.setString(2, consOrder);
cnt = pstmt.executeUpdate();
if (cnt < 0) {
errString = itmDBAccessEJB.getErrorString("", "DS000", "", "", conn);
return errString;
}
pstmt.close();
pstmt = null;
}
} }
} /*if lb_ratechanged then
/*if lb_ratechanged then //prince 30-03-05 convert in case when
//prince 30-03-05 convert in case when // select sum(nvl(tax_amt,0)), sum(nvl(amount,0)), sum(nvl(net_amt,0))
// select sum(nvl(tax_amt,0)), sum(nvl(amount,0)), sum(nvl(net_amt,0)) // into :lc_taxamt, :lc_totamt, :lc_netamt
// into :lc_taxamt, :lc_totamt, :lc_netamt // from consume_iss_det where cons_issue = :ls_cons_iss;
// from consume_iss_det where cons_issue = :ls_cons_iss; select sum(case when tax_amt is null then 0 else tax_amt end),
select sum(case when tax_amt is null then 0 else tax_amt end), sum(case when amount is null then 0 else amount end),
sum(case when amount is null then 0 else amount end), sum(case when net_amt is null then 0 else net_amt end)
sum(case when net_amt is null then 0 else net_amt end) into :lc_taxamt, :lc_totamt, :lc_netamt
into :lc_taxamt, :lc_totamt, :lc_netamt from consume_iss_det where cons_issue = :ls_cons_iss;
from consume_iss_det where cons_issue = :ls_cons_iss;
if get_sqlcode() <> 0 then
ls_errcode = "DS000" + string(sqlca.sqldbcode) + "~t" + sqlca.sqlerrtext
else
// select nvl(exch_rate,0) into :lc_exchrate
// from consume_iss where cons_issue = :ls_cons_iss;
//prince 30-03-05 convert in case when
select (case when exch_rate is null then 0 else exch_rate end)
into :lc_exchrate
from consume_iss
where cons_issue = :ls_cons_iss;
update consume_iss set amount = :lc_totamt, tax_amt = :lc_taxamt, net_amt = :lc_netamt,
net_amt__bc = :lc_netamt * :lc_exchrate
where cons_issue = :ls_cons_iss;
if get_sqlcode() <> 0 then if get_sqlcode() <> 0 then
ls_errcode = "DS000" + string(sqlca.sqldbcode) + "~t" + sqlca.sqlerrtext ls_errcode = "DS000" + string(sqlca.sqldbcode) + "~t" + sqlca.sqlerrtext
else
// select nvl(exch_rate,0) into :lc_exchrate
// from consume_iss where cons_issue = :ls_cons_iss;
//prince 30-03-05 convert in case when
select (case when exch_rate is null then 0 else exch_rate end)
into :lc_exchrate
from consume_iss
where cons_issue = :ls_cons_iss;
update consume_iss set amount = :lc_totamt, tax_amt = :lc_taxamt, net_amt = :lc_netamt,
net_amt__bc = :lc_netamt * :lc_exchrate
where cons_issue = :ls_cons_iss;
if get_sqlcode() <> 0 then
ls_errcode = "DS000" + string(sqlca.sqldbcode) + "~t" + sqlca.sqlerrtext
end if
end if end if
end if end if*/ //pb code no migrated
end if*/ //pb code no migrated System.out.println("errString after : "+errString);
System.out.println("errString after : "+errString);
if (errString == null || errString.trim().length() == 0)
{
sql = "update consume_iss set confirmed = 'Y', conf_date =?, emp_code__aprv = ? where cons_issue =?";
System.out.println("SQL : "+sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, today);
pstmt.setString(2, empCodeAprv);
pstmt.setString(3, detconsIssue);
cnt = pstmt.executeUpdate();
if (cnt < 0) {
errString = itmDBAccessEJB.getErrorString("", "DS000", "", "", conn);
return errString;
}
pstmt.close();
pstmt = null;
/*ls_errcode = nvo_inv_acct.gbf_ud_accountposting('w_consume_issue', 'C-ISS', '', 2 , &
lds_hdr.describe("datawindow.syntax") &
+ '~r' + lds_hdr.describe("datawindow.syntax.data"), &
lds_det.describe("datawindow.syntax") + &
'~r' + lds_det.describe("datawindow.syntax.data"), '','', '', '', '')
ls_acctmethod = f_get_token(ls_errcode,',')
if len(trim(ls_errcode)) <> 0 then
goto errfound
end if
*/ //pb code not migrated
errString = invacct.consumeIssPost(detconsIssue, tranSer,conn); if (errString == null || errString.trim().length() == 0)
if (errString != null && errString.trim().length() > 0)
{ {
return errString; sql = "update consume_iss set confirmed = 'Y', conf_date =?, emp_code__aprv = ? where cons_issue =?";
System.out.println("SQL : "+sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, today);
pstmt.setString(2, empCodeAprv);
pstmt.setString(3, detconsIssue);
cnt = pstmt.executeUpdate();
if (cnt < 0) {
errString = itmDBAccessEJB.getErrorString("", "DS000", "", "", conn);
return errString;
}
pstmt.close();
pstmt = null;
/*ls_errcode = nvo_inv_acct.gbf_ud_accountposting('w_consume_issue', 'C-ISS', '', 2 , &
lds_hdr.describe("datawindow.syntax") &
+ '~r' + lds_hdr.describe("datawindow.syntax.data"), &
lds_det.describe("datawindow.syntax") + &
'~r' + lds_det.describe("datawindow.syntax.data"), '','', '', '', '')
ls_acctmethod = f_get_token(ls_errcode,',')
if len(trim(ls_errcode)) <> 0 then
goto errfound
end if
*/ //pb code not migrated
errString = invacct.consumeIssPost(detconsIssue, tranSer,conn);
if (errString != null && errString.trim().length() > 0)
{
return errString;
}
} }
} }
} // try } // try
catch (Exception e) { catch (Exception e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment