Commit 9e616fdc authored by msaggam's avatar msaggam

Purchase order - New standing order type for channel partner to be created and...

Purchase order - New standing order type for channel partner to be created and there should be a flag to indicate whether same item can be repeated in the order, based on that validation to be done

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@202678 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 912ffcd8
......@@ -292,7 +292,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errFields.add(childNodeName.toLowerCase());
}
if (errcode == null || errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
sql = "select count(1) as cnt from pordertype where ORDER_TYPE = ?";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, pordType);
......@@ -309,7 +311,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errList.add(errcode);
errFields.add(childNodeName.toLowerCase());
}
}
//}
}
if (childNodeName.equalsIgnoreCase("purc_order")) {
purcOrder = checkNull(genericUtility.getColumnValue(
......@@ -1046,7 +1050,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errFields.add(childNodeName.toLowerCase());
}
if (errcode.length() == 0) {
//if (errcode.length() == 0) {
if ("P".equalsIgnoreCase(pordType)) {
sql = "select count(*) from porder where pord_type = 'P' and ind_no = ?";
pStmt = conn.prepareStatement(sql);
......@@ -1068,9 +1073,13 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.toLowerCase());
}
}
//}
}
}
if (errcode.length() == 0) {
//if (errcode.length() == 0) {
quotNo = checkNull(genericUtility
.getColumnValue("quot_no", dom));
......@@ -1114,9 +1123,12 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
}
}
if (errcode.trim().length() == 0) {
//}
//if (errcode.trim().length() == 0) {
itemSer = checkNull(genericUtility
.getColumnValue("item_ser", dom));
......@@ -1140,9 +1152,11 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errList.add(errcode);
errFields.add(childNodeName.toLowerCase());
}
//}
}
}
if (errcode == null || errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
sql = "select indent_opt from item where item_code = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, itemCode);
......@@ -1169,7 +1183,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errFields.add(childNodeName.toLowerCase());
}
}
}
//}
}
if (childNodeName.equalsIgnoreCase("accept_criteria")) {
acceptCriteria = checkNull(genericUtility
......@@ -1220,7 +1236,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errFields.add(childNodeName.toLowerCase());
}
if (errcode == null || errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
sql = "select status, from_date , valid_upto from insurance where policy_no = ?";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, policyNo);
......@@ -1246,7 +1264,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errList.add(errcode);
errFields.add(childNodeName.toLowerCase());
}
}
//}
}
}
if (childNodeName.equalsIgnoreCase("bank_code__pay")) {
......@@ -1448,6 +1467,13 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
//Variables added by Mahesh Saggam on 24-June-2019 [Start]
NodeList itemNodeList = null,lineNoList = null,detail2List = null,childDetilList = null;
Node itemNode = null,lineNoNode = null,detailNode = null,chidDetailNode = null;
String uniqueItem = "", itemCode1 = "", pOrderType = "";
//Variables added by Mahesh Saggam on 24-June-2019 [End]
String lineValue = "", updateFlag = "";
int lineNoInt = 0, lineValueInt = 0;
int cnt1 = 0;
for (ctr = 0; ctr < childNodeListLength; ctr++) {
childNode = childNodeList.item(ctr);
......@@ -1460,7 +1486,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
"site_code__dlv", dom1));
if (!siteCode.equalsIgnoreCase(siteCodeDlv)) {
if (errcode == null || errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
// errcode = nvo_dis.gbf_site(mval,transer)
errcode = isSiteCode(siteCode,"P-ORD"); //Changed By PriyankaC on 04Jan18
if (errcode != null
......@@ -1468,7 +1494,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errList.add(errcode);
errFields.add(childNodeName.toLowerCase());
}
}
//}
}
}
if (childNodeName.equalsIgnoreCase("ind_no")) {
......@@ -1561,7 +1587,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
// }
if (errcode.length() == 0) {
//if (errcode.length() == 0) {
quotNo = checkNull(genericUtility
.getColumnValue("quot_no", dom1));
......@@ -1601,7 +1629,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
}
}
}
//}
purcOrder = checkNull(genericUtility
.getColumnValue("purc_order", dom1));
sql = "select quantity__stduom from indent where ind_no = ? ";
......@@ -1719,7 +1748,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
}
if (errcode == null || errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
typeAllowProjbudgtList = distComm.getDisparams(
"999999", "TYPE_ALLOW_PROJBUDGET", conn);
......@@ -1770,7 +1801,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
ordflag = true;
}
}
}
//}
if (ordflag == true) {
if (projCode == null
......@@ -1779,7 +1811,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errList.add(errcode);
errFields.add(childNodeName.toLowerCase());
}
if (errcode == null || errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
sql = "select sum(a.tot_amt * b.exch_rate) from porddet a, porder b where ( a.purc_order = b.purc_order )"
+ "and b.confirmed = 'Y' and a.proj_code = ? and a.purc_order <> ? and b.status <> 'X' and a.status <> 'C' ";
pStmt = conn.prepareStatement(sql);
......@@ -1949,8 +1982,12 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.toLowerCase());
}
}
}
if (errcode == null || errcode.trim().length() == 0) {
//}
//if (errcode == null || errcode.trim().length() == 0) {
sql = "select count(*) from project where proj_code = ? ";
pStmt = conn.prepareStatement(sql);
......@@ -1970,8 +2007,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errList.add(errcode);
errFields.add(childNodeName.toLowerCase());
}
if (errcode == null
|| errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
sql = "select count(*) from project where proj_code = ? "
+ " and ( ? between start_date and end_date "
+ " or ? between start_date and ext_end_date )";
......@@ -1994,8 +2032,10 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errFields.add(childNodeName
.toLowerCase());
}
}
}
//}
//}
else if (ordflag = false) {
if (projCode != null
......@@ -2125,7 +2165,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errFields.add(childNodeName.toLowerCase());
}
if (errcode == null || errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
cnt1 = 0;
sql = "Select channel_partner,site_code__ch from site_supplier where site_code = ? and supp_code = ? ";
pStmt = conn.prepareStatement(sql);
......@@ -2156,7 +2196,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
pStmt = null;
}
if (errcode == null || errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
if (cp != null
&& "Y".equalsIgnoreCase(cp.trim()
.toUpperCase())) {
......@@ -2180,9 +2220,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
*
* }
*/
}
//}
if (errcode.length() == 0) {
//if (errcode.length() == 0) {
sql = "select oth_series from itemser where item_ser = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, itemSer);
......@@ -2228,8 +2268,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.toLowerCase());
}
}
}
if (errcode.length() == 0) {
//}
//if (errcode.length() == 0) {
quotNo = checkNull(genericUtility
.getColumnValue("quot_no", dom));
......@@ -2262,8 +2302,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
pStmt.close();
pStmt = null;
}
}
if (errcode.length() == 0) {
//}
//if (errcode.length() == 0) {
quotNo = checkNull(genericUtility
.getColumnValue("quot_no", dom));
itemCode = checkNull(genericUtility
......@@ -2293,8 +2333,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.toLowerCase());
}
}
}
if (errcode == null || errcode.length() == 0) {
//}
//if (errcode == null || errcode.length() == 0) {
proviTranid = checkNull(genericUtility
.getColumnValue("provi_tran_id", dom));
......@@ -2328,8 +2368,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.toLowerCase());
}
}
}
if (errcode.length() == 0 || errcode == null) {
//}
//if (errcode.length() == 0 || errcode == null) {
sql = "select indent_opt from item where item_code = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, itemCode);
......@@ -2358,9 +2398,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.toLowerCase());
}
}
}
//}
if (errcode.length() == 0 || errcode == null) {
//if (errcode.length() == 0 || errcode == null) {
sql = "select quot_opt from item where item_code = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, itemCode);
......@@ -2373,8 +2413,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
pStmt.close();
pStmt = null;
if (errcode == null
|| errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
if ("M".equalsIgnoreCase(quotOpt)) {
if (quotNo == null
|| quotNo.trim().length() == 0) {
......@@ -2384,10 +2423,10 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.toLowerCase());
}
}
}
//}
}
if (errcode.length() == 0 || errcode == null) {
//}
//if (errcode.length() == 0 || errcode == null) {
taskCode = checkNull(genericUtility
.getColumnValue("task_code", dom));
if (taskCode != null
......@@ -2410,9 +2449,89 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errcode = "VTTASK4";
}
}
//}
//}
// Added by Mahesh Saggam on 24-June-2019 [Start]
detail2List = dom2.getElementsByTagName("Detail2");
itemCode1 = genericUtility.getColumnValue("item_code",dom);
pOrderType = checkNull(genericUtility.getColumnValue("pord_type", dom1));
lineNo = genericUtility.getColumnValue("line_no",dom);
sql = "select unique_item from pordertype where order_type = ?";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, pOrderType);
rs = pStmt.executeQuery();
if(rs.next())
{
uniqueItem = rs.getString(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
uniqueItem = uniqueItem == null ? "N":uniqueItem.trim();
System.out.println("Unique item = "+uniqueItem);
System.out.println("Detail 2 List "+detail2List.getLength());
if(lineNo != null && lineNo.trim().length() > 0)
{
lineNoInt = Integer.parseInt(lineNo.trim());
}
if("Y".equalsIgnoreCase(uniqueItem))
{
for(int t =0; t < detail2List.getLength(); t++ )
{
detailNode = detail2List.item(t);
childDetilList = detailNode.getChildNodes();
for(int p =0; p < childDetilList.getLength(); p++ )
{
chidDetailNode = childDetilList.item(p);
System.out.println("current child node>>>>>>>>>> " + chidDetailNode.getNodeName() );
if(chidDetailNode.getNodeName().equalsIgnoreCase("line_no") )
{
System.out.println("line node found >>>>>" + chidDetailNode.getNodeName());
if(chidDetailNode.getFirstChild() != null )
{
lineValue = chidDetailNode.getFirstChild().getNodeValue();
if(lineValue != null && lineValue.trim().length() > 0)
{
lineValueInt = Integer.parseInt(lineValue.trim());
}
}
}
if(chidDetailNode.getNodeName().equalsIgnoreCase("attribute") )
{
System.out.println("operation node found >>>>>" + chidDetailNode.getNodeName());
updateFlag = chidDetailNode.getAttributes().getNamedItem("updateFlag").getNodeValue();
System.out.println("Update flag is......."+updateFlag);
}
if(chidDetailNode.getNodeName().equalsIgnoreCase("item_code"))
{
if(chidDetailNode.getFirstChild() != null)
{
itemCode = chidDetailNode.getFirstChild().getNodeValue();
if(lineNoInt != lineValueInt && !updateFlag.equalsIgnoreCase("D") && itemCode.trim().equalsIgnoreCase(itemCode1.trim()))
{
System.out.println("Item is unique it cannot be repeated");
errcode = "VTDUPITEM ";
errList.add( errcode );
errFields.add( childNodeName.toLowerCase() );
}
}
}
}
}
}
// Added by Mahesh Saggam on 24-June-2019 [End]
}
if (childNodeName.equalsIgnoreCase("quantity")) {
qty = checkNull(genericUtility.getColumnValue(
"quantity", dom));
......@@ -2450,7 +2569,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
}
}
if (errcode.length() == 0 && quotNo.length() > 0) {
if (quotNo.length() > 0) {
itemCode = checkNull(genericUtility
.getColumnValue("item_code", dom));
......@@ -2533,6 +2654,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.toLowerCase());
}
}
}
indNo = checkNull(genericUtility.getColumnValue(
......@@ -2540,7 +2662,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
taskCode = checkNull(genericUtility.getColumnValue(
"task_code", dom));
if (errcode == null || errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
if (taskCode != null
&& taskCode.trim().length() > 0) {
lsitemCode = checkNull(genericUtility
......@@ -2637,7 +2760,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.toLowerCase());
}
}
}
//}
}
}
if (childNodeName.equalsIgnoreCase("unit")) {
......@@ -2769,7 +2894,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
discount = "0";
}
if (errcode == null || errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
if (taskCode != null
&& taskCode.trim().length() > 0) {
itemCodels = checkNull(genericUtility
......@@ -2796,7 +2922,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errFields.add(childNodeName.toLowerCase());
}
}
}
//}
rate = rate == "" ? "0" : rate ;
if (rate != null && Double.parseDouble(rate) > 0) {
indNo = checkNull(genericUtility.getColumnValue(
......@@ -2868,7 +2995,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
}
if (errcode == null || errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
if (priceList.trim().length() == 0
|| priceList == null) {
sql = "select var_value from disparm where prd_code = '999999' and var_name = 'REGULATED_PRICE_LIST'";
......@@ -2895,7 +3023,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.toLowerCase());
}
}
}
//}
}
}
......@@ -3093,7 +3223,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errList.add(errcode);
errFields.add(childNodeName.toLowerCase());
}
if (errcode == null || errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
// errcode =
// nvo_dis.gbf_acct_type(acctCodeDr,"", "O")
......@@ -3106,7 +3238,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errList.add(errcode);
errFields.add(childNodeName.toLowerCase());
}
}
//}
}
if (childNodeName.equalsIgnoreCase("acct_code__ap_adv")) {
acctCodeApadv = checkNull(genericUtility
......@@ -3168,7 +3301,9 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errList.add(errcode);
errFields.add(childNodeName.toLowerCase());
}
if (errcode == null || errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
invAcctPorcp = finCommon.getFinparams("999999",
"INV_ACCT_PORCP", conn);
// invAcctPorcp =
......@@ -3217,8 +3352,11 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
}
}
}
if (errcode == null || errcode.trim().length() == 0) {
//}
//if (errcode == null || errcode.trim().length() == 0) {
String acctCodeCrTemp = "";
parentNodeList1 = dom2
......@@ -3262,7 +3400,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
}
}
//}
}
if (childNodeName.equalsIgnoreCase("cctr_code__dr"))
{
......@@ -3407,7 +3546,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errFields.add(childNodeName.toLowerCase());
}
}
if (errcode.trim().length() == 0) {
//if (errcode.trim().length() == 0) {
if (contractNo.trim().length() > 0) {
sql = "select contract_fromdate,contract_todate "
+ " from pcontract_hdr where contract_no = ?";
......@@ -3435,7 +3575,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errFields.add(childNodeName.toLowerCase());
}
}
}
//}
}
if (childNodeName.equalsIgnoreCase("bom_code")) {
pordType = checkNull(genericUtility.getColumnValue(
......@@ -3772,8 +3913,8 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
.toLowerCase());
}
}
if (errcode == null
|| errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
errcode = finCommon
.isAcctType(acctCodeProvDr,
suppCode, "O", conn);
......@@ -3783,9 +3924,11 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errFields.add(childNodeName
.toLowerCase());
}
} else {
/*} else {
errcode = "VTPROVACCT ";
}
}*/
}
}
}
......@@ -3832,7 +3975,7 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errFields.add(childNodeName.toLowerCase());
}
}
if (errcode == null || errcode.trim().length() == 0) {
//if (errcode == null || errcode.trim().length() == 0) {
// errcode =
// nvo_dis.gbf_acct_type(mVal,ls_supp_code, "S")
errcode = finCommon.isAcctType(acctCodeProvCr,
......@@ -3842,11 +3985,11 @@ public class POrderIC extends ValidatorEJB implements POrderICRemote,
errList.add(errcode);
errFields.add(childNodeName.toLowerCase());
}
} else {
/*} else {
errcode = "VTPROVACCT ";
errList.add(errcode);
errFields.add(childNodeName.toLowerCase());
}
}*/
}
}
}
......
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