Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Component Sharing
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gagandeep Singh Bhatia
Component Sharing
Commits
924dddbb
Commit
924dddbb
authored
Apr 14, 2026
by
Mohammed Dohadwala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified SQA to add old_rate (rate_o).
Modified SCAFSQ to add validation in the loop.
parent
379ff131
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2352 additions
and
22 deletions
+2352
-22
Mohammed/Quotation Stockist/SalesQuotationAmdIC.java
Mohammed/Quotation Stockist/SalesQuotationAmdIC.java
+2296
-0
Mohammed/Sales Contract1/SalesContractAMDFromSalesQuotAMD.java
...med/Sales Contract1/SalesContractAMDFromSalesQuotAMD.java
+56
-22
No files found.
Mohammed/Quotation Stockist/SalesQuotationAmdIC.java
0 → 100644
View file @
924dddbb
package
ibase
.
webitm
.
ejb
.
dis
;
/**
* AUTHOR : Gagandeep Bhatia 13-MAR-2026
* COMPONENT : VALIDATION AND ITEMCHANGE OF SALES QUOTATION AMENDMENT
**/
import
java.rmi.RemoteException
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.Timestamp
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
javax.ejb.Stateless
;
import
org.w3c.dom.CDATASection
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.Node
;
import
org.w3c.dom.NodeList
;
import
ibase.utility.BaseLogger
;
import
ibase.utility.E12GenericUtility
;
import
ibase.webitm.ejb.ITMDBAccessEJB
;
import
ibase.webitm.ejb.ValidatorEJB
;
import
ibase.webitm.ejb.ValidatorLocal
;
import
ibase.webitm.ejb.ValidatorRemote
;
import
ibase.webitm.ejb.fin.FinCommon
;
import
ibase.webitm.ejb.sys.UtilMethods
;
import
ibase.webitm.utility.ITMException
;
@Stateless
public
class
SalesQuotationAmdIC
extends
ValidatorEJB
implements
ValidatorLocal
,
ValidatorRemote
{
ITMDBAccessEJB
itmDBAccessEJB
=
new
ITMDBAccessEJB
();
E12GenericUtility
genericUtility
=
new
E12GenericUtility
();
DistCommon
distCommon
=
new
DistCommon
();
FinCommon
finCommon
=
new
FinCommon
();
public
String
wfValData
(
String
xmlString
,
String
xmlString1
,
String
xmlString2
,
String
objContext
,
String
editFlag
,
String
xtraParams
)
throws
RemoteException
,
ITMException
{
String
retString
=
""
;
Document
dom
=
null
;
Document
dom1
=
null
;
Document
dom2
=
null
;
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"xmlString............."
+
xmlString
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"xmlString1............"
+
xmlString1
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"xmlString2............"
+
xmlString2
);
try
{
if
(
xmlString
!=
null
&&
xmlString
.
trim
().
length
()
!=
0
)
{
dom
=
genericUtility
.
parseString
(
xmlString
);
}
if
(
xmlString1
!=
null
&&
xmlString1
.
trim
().
length
()
!=
0
)
{
dom1
=
genericUtility
.
parseString
(
xmlString1
);
}
if
(
xmlString2
!=
null
&&
xmlString2
.
trim
().
length
()
!=
0
)
{
dom2
=
genericUtility
.
parseString
(
xmlString2
);
}
retString
=
wfValData
(
dom
,
dom1
,
dom2
,
objContext
,
editFlag
,
xtraParams
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"ErrString :"
+
retString
);
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Exception --["
+
e
.
getMessage
()+
"]"
);
e
.
printStackTrace
();
throw
new
ITMException
(
e
);
}
return
retString
;
}
public
String
wfValData
(
Document
dom
,
Document
dom1
,
Document
dom2
,
String
objContext
,
String
editFlag
,
String
xtraParams
)
throws
RemoteException
,
ITMException
{
NodeList
parentList
=
null
;
Node
parentNode
=
null
;
NodeList
childList
=
null
;
Node
childNode
=
null
;
String
childNodeName
=
""
;
String
userId
=
""
;
Connection
conn
=
null
;
int
currentFormNo
=
0
;
int
ctr
=
0
;
int
cnt
=
0
;
String
siteCode
=
""
,
modName
=
""
;
String
custCode
=
""
,
currCode
=
""
,
empCodeConf
=
""
,
itemCode
=
""
,
unit
=
""
,
unitRate
=
""
,
crTerm
=
""
,
dlvTerm
=
""
,
packCode
=
""
;
String
taxClass
=
""
,
taxChap
=
""
,
taxEnv
=
""
,
quotNo
=
""
;
Timestamp
quotDate
=
null
;
SimpleDateFormat
dateFormat
=
null
;
UtilMethods
utilMethods
=
new
UtilMethods
();
DistCommon
disCommon
=
new
DistCommon
();
FinCommon
finCommon
=
new
FinCommon
();
String
sql
=
""
,
salesPers
=
""
,
opprId
=
""
;
PreparedStatement
pstmt
=
null
;
ResultSet
rs
=
null
;
String
errCode
=
""
,
errString
=
""
,
errorType
=
""
;
ArrayList
<
String
>
errList
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
errFields
=
new
ArrayList
<
String
>();
StringBuffer
errStringXml
=
new
StringBuffer
(
"<?xml version = \"1.0\"?> \r\n <Root> <Errors>"
);
try
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Inside wfValdata ***********"
);
conn
=
getConnection
();
dateFormat
=
new
SimpleDateFormat
(
genericUtility
.
getApplDateFormat
());
userId
=
checkNull
(
genericUtility
.
getValueFromXTRA_PARAMS
(
xtraParams
,
"loginCode"
));
if
(
objContext
!=
null
&&
objContext
.
trim
().
length
()
>
0
)
{
currentFormNo
=
Integer
.
parseInt
(
objContext
);
}
switch
(
currentFormNo
)
{
case
1
:
{
parentList
=
dom
.
getElementsByTagName
(
"Detail1"
);
parentNode
=
parentList
.
item
(
0
);
childList
=
parentNode
.
getChildNodes
();
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Inside childList ***********"
+
childList
);
for
(
ctr
=
0
;
ctr
<
childList
.
getLength
();
ctr
++)
{
childNode
=
childList
.
item
(
ctr
);
childNodeName
=
childNode
.
getNodeName
();
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Inside childNodeName ***********"
+
childNodeName
);
if
(
childNodeName
.
equalsIgnoreCase
(
"quot_no"
))
{
quotNo
=
genericUtility
.
getColumnValue
(
"quot_no"
,
dom
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"quotNo ["
+
quotNo
+
"]"
);
if
(
quotNo
==
null
||
quotNo
.
trim
().
length
()
==
0
)
{
errCode
=
"VTINVQNO"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
else
{
sql
=
"SELECT COUNT(*) FROM SALES_QUOT WHERE QUOT_NO = ? AND CONFIRMED = 'Y'"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
quotNo
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VTINVQNO"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
else
if
(
childNodeName
.
equalsIgnoreCase
(
"cust_code"
))
{
custCode
=
genericUtility
.
getColumnValue
(
"cust_code"
,
dom
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"custCode<<<< ["
+
custCode
+
"]"
);
if
(
custCode
==
null
||
custCode
.
trim
().
length
()
==
0
)
{
errCode
=
"VMCUSTCD1"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
else
{
sql
=
"select count(*) from customer where cust_code=? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
custCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VTCUSTCD1"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
else
if
(
childNodeName
.
equalsIgnoreCase
(
"curr_code"
))
{
currCode
=
genericUtility
.
getColumnValue
(
"curr_code"
,
dom
);
if
(
currCode
==
null
||
currCode
.
trim
().
length
()==
0
)
{
errCode
=
"VECUR2"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
else
{
sql
=
"select count(*) from currency where curr_code=? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
currCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VTCURRCD1"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
else
if
(
childNodeName
.
equalsIgnoreCase
(
"emp_code__conf"
))
{
empCodeConf
=
genericUtility
.
getColumnValue
(
"em_code__conf"
,
dom
);
if
(
empCodeConf
!=
null
&&
empCodeConf
.
trim
().
length
()
>
0
)
{
sql
=
"select count(*) from employee where emp_code=? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
empCodeConf
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VMEMP1"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
else
if
(
childNodeName
.
equalsIgnoreCase
(
"cr_term"
))
{
crTerm
=
genericUtility
.
getColumnValue
(
"cr_term"
,
dom
);
if
(
crTerm
!=
null
&&
crTerm
.
trim
().
length
()>
0
)
{
sql
=
"select count(*) from crterm where cr_term = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
crTerm
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VTCRTERM1"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
else
if
(
childNodeName
.
equalsIgnoreCase
(
"item_ser"
))
{
String
itemSer
=
genericUtility
.
getColumnValue
(
"item_ser"
,
dom
);
if
(
itemSer
==
null
||
itemSer
.
trim
().
length
()
==
0
)
{
errCode
=
"VTITEMSER5"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
else
{
sql
=
"select count(*) from itemser where item_ser = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
itemSer
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VTITMSER1"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
else
if
(
childNodeName
.
equalsIgnoreCase
(
"dlv_term"
))
{
dlvTerm
=
genericUtility
.
getColumnValue
(
"dlv_term"
,
dom
);
if
(
dlvTerm
!=
null
&&
dlvTerm
.
trim
().
length
()>
0
)
{
sql
=
"select count(*) from delivery_term where dlv_term = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
dlvTerm
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VMDLVTERM1"
;
//new message defined
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
else
if
(
childNodeName
.
equalsIgnoreCase
(
"sales_pers"
))
{
salesPers
=
genericUtility
.
getColumnValue
(
"sales_pers"
,
dom
);
if
(
salesPers
!=
null
&&
salesPers
.
trim
().
length
()
>
0
)
{
sql
=
"select count(*) from sales_pers where sales_pers= ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
salesPers
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VTSALPRN"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
else
if
(
childNodeName
.
equalsIgnoreCase
(
"oppr_id"
))
{
opprId
=
genericUtility
.
getColumnValue
(
"oppr_id"
,
dom
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"opprId 362 ["
+
opprId
+
"]"
);
if
(
opprId
!=
null
&&
opprId
.
trim
().
length
()
>
0
)
{
sql
=
"select count(*) from opportunity where oppr_id= ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
opprId
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VTOPPRID"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
//Added By Sakshi P on 29/Oct/2025
// tax_class
else
if
(
childNodeName
.
equalsIgnoreCase
(
"tax_class"
))
{
taxClass
=
checkNull
(
genericUtility
.
getColumnValue
(
"tax_class"
,
dom
));
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"taxClass: "
+
taxClass
);
if
(
taxClass
.
trim
().
length
()
!=
0
)
{
if
(!(
isExist
(
conn
,
"taxclass"
,
"tax_class"
,
taxClass
)))
{
errCode
=
"VTTCLASS1"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Tax class not define in tax class master."
);
}
}
}
// tax_chap
else
if
(
childNodeName
.
equalsIgnoreCase
(
"tax_chap"
))
{
taxChap
=
checkNull
(
genericUtility
.
getColumnValue
(
"tax_chap"
,
dom
));
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"taxChap: "
+
taxChap
);
if
(
taxChap
.
trim
().
length
()
>
0
)
{
if
(!(
isExist
(
conn
,
"taxchap"
,
"tax_chap"
,
taxChap
)))
{
errCode
=
"VTTCHAP1"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Tax chapter not define in tax chapter master"
);
}
}
}
// tax_env
else
if
(
childNodeName
.
equalsIgnoreCase
(
"tax_env"
))
{
taxEnv
=
checkNull
(
genericUtility
.
getColumnValue
(
"tax_env"
,
dom
));
String
quotDateStr
=
genericUtility
.
getColumnValue
(
"quot_date"
,
dom
);
if
(
quotDateStr
!=
null
&&
quotDateStr
.
trim
().
length
()
>
0
)
{
quotDate
=
Timestamp
.
valueOf
(
genericUtility
.
getValidDateString
(
quotDateStr
,
genericUtility
.
getApplDateFormat
(),
genericUtility
.
getDBDateFormat
()
)
+
" 00:00:00.0"
);
}
else
{
quotDate
=
null
;
// or handle default value
}
if
(
taxEnv
.
trim
().
length
()
!=
0
)
{
if
(!(
isExist
(
conn
,
"taxenv"
,
"tax_env"
,
taxEnv
)))
{
errCode
=
"VTTENV1"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"TAX ENVIRONMENT NOT DEFINED"
);
}
else
{
errCode
=
distCommon
.
getCheckTaxEnvStatus
(
taxEnv
,
quotDate
,
"S"
,
conn
);
if
(
errCode
!=
null
&&
errCode
.
trim
().
length
()
>
0
)
{
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"TAX ENVIRONMENT NOT DEFINED"
);
}
}
}
}
}
// end for
}
// End of Case 1
break
;
case
2
:
{
parentList
=
dom
.
getElementsByTagName
(
"Detail"
+
currentFormNo
);
parentNode
=
parentList
.
item
(
0
);
childList
=
parentNode
.
getChildNodes
();
for
(
ctr
=
0
;
ctr
<
childList
.
getLength
();
ctr
++)
{
childNode
=
childList
.
item
(
ctr
);
childNodeName
=
childNode
.
getNodeName
();
if
(
childNodeName
.
equalsIgnoreCase
(
"item_code"
))
{
itemCode
=
genericUtility
.
getColumnValue
(
"item_code"
,
dom
);
if
(
itemCode
==
null
||
itemCode
.
trim
().
length
()==
0
)
{
errCode
=
"VITMCODE"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
else
{
sql
=
"select count(*) from item where item_code = ?"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
itemCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VTITEM1"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
else
if
(
childNodeName
.
equalsIgnoreCase
(
"unit"
))
{
unit
=
genericUtility
.
getColumnValue
(
"unit"
,
dom
);
if
(
unit
==
null
||
unit
.
trim
().
length
()==
0
)
{
errCode
=
"VMUNIT"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
else
{
sql
=
"select count(*) from uom where unit = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
unit
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VTUNIT1"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
else
if
(
childNodeName
.
equalsIgnoreCase
(
"unit__rate"
))
{
unitRate
=
genericUtility
.
getColumnValue
(
"unit__rate"
,
dom
);
if
(
unitRate
==
null
||
unitRate
.
trim
().
length
()==
0
)
{
//errCode = "VMBUSUNI01";
errCode
=
"VMUNIT"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
else
{
sql
=
"select count(*) from uom where unit = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
unitRate
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VTUNIT1"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
else
if
(
childNodeName
.
equalsIgnoreCase
(
"cr_term"
))
{
crTerm
=
genericUtility
.
getColumnValue
(
"cr_term"
,
dom
);
if
(
crTerm
!=
null
&&
crTerm
.
trim
().
length
()>
0
)
{
sql
=
"select count(*) from crterm where cr_term = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
crTerm
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VTCRTERM1"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
else
if
(
childNodeName
.
equalsIgnoreCase
(
"dlv_term"
))
{
dlvTerm
=
genericUtility
.
getColumnValue
(
"dlv_term"
,
dom
);
if
(
dlvTerm
!=
null
&&
dlvTerm
.
trim
().
length
()>
0
)
{
sql
=
"select count(*) from delivery_term where dlv_term = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
dlvTerm
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VMDLVTERM1"
;
//new message defined
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
else
if
(
childNodeName
.
equalsIgnoreCase
(
"pack_code"
))
{
packCode
=
genericUtility
.
getColumnValue
(
"pack_code"
,
dom
);
if
(
packCode
!=
null
&&
packCode
.
trim
().
length
()>
0
)
{
sql
=
"select count(*) from packing where pack_code = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
packCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
cnt
=
rs
.
getInt
(
1
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
cnt
==
0
)
{
errCode
=
"VTPKCD1"
;
errList
.
add
(
errCode
);
errFields
.
add
(
childNodeName
.
toLowerCase
());
}
}
}
}
//end for
}
//end case 2
break
;
}
//end switch
int
errListSize
=
errList
.
size
();
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"errListSize::::::::::"
+
errListSize
);
int
count
=
0
;
String
errFldName
=
null
;
if
(
errList
!=
null
&&
errListSize
>
0
)
{
for
(
count
=
0
;
count
<
errListSize
;
count
++)
{
errCode
=
errList
.
get
(
count
);
errFldName
=
errFields
.
get
(
count
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
" testing :errCode .:"
+
errCode
+
"errString>>>>>>>>>"
+
errString
);
errString
=
getErrorString
(
errFldName
,
errCode
,
userId
);
errorType
=
errorType
(
conn
,
errCode
);
if
(
errString
.
length
()
>
0
)
{
String
bifurErrString
=
errString
.
substring
(
errString
.
indexOf
(
"<Errors>"
)
+
8
,
errString
.
indexOf
(
"<trace>"
));
bifurErrString
=
bifurErrString
+
errString
.
substring
(
errString
.
indexOf
(
"</trace>"
)
+
8
,
errString
.
indexOf
(
"</Errors>"
));
errStringXml
.
append
(
bifurErrString
);
errString
=
""
;
}
if
(
errorType
.
equalsIgnoreCase
(
"E"
))
{
break
;
}
}
errList
.
clear
();
errList
=
null
;
errFields
.
clear
();
errFields
=
null
;
errStringXml
.
append
(
"</Errors> </Root> \r\n"
);
}
//end of if for errList
else
{
errStringXml
=
new
StringBuffer
(
""
);
}
errString
=
errStringXml
.
toString
();
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Exception --["
+
e
.
getMessage
()+
"]"
);
e
.
printStackTrace
();
throw
new
ITMException
(
e
);
}
finally
{
try
{
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
conn
!=
null
)
{
conn
.
close
();
conn
=
null
;
}
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Exception --["
+
e
.
getMessage
()+
"]"
);
e
.
printStackTrace
();
throw
new
ITMException
(
e
);
}
}
errString
=
errStringXml
.
toString
();
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"testing : final errString : "
+
errString
);
return
errString
;
}
public
String
itemChanged
(
String
xmString
,
String
xmString1
,
String
xmString2
,
String
objContext
,
String
currentColumn
,
String
editFlag
,
String
xtraParams
)
throws
RemoteException
,
ITMException
{
Document
dom
=
null
;
Document
dom1
=
null
;
Document
dom2
=
null
;
String
errString
=
null
;
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"currFrmXmlStr::"
+
xmString
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"hdrFrmXmlStr::"
+
xmString1
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"allFrmXmlStr::"
+
xmString2
);
try
{
if
(
xmString
!=
null
&&
xmString
.
trim
().
length
()!=
0
)
{
dom
=
genericUtility
.
parseString
(
xmString
);
}
if
(
xmString1
!=
null
&&
xmString1
.
trim
().
length
()!=
0
)
{
dom1
=
genericUtility
.
parseString
(
xmString1
);
}
if
(
xmString2
!=
null
&&
xmString2
.
trim
().
length
()!=
0
)
{
dom2
=
genericUtility
.
parseString
(
xmString2
);
}
errString
=
itemChanged
(
dom
,
dom1
,
dom2
,
objContext
,
currentColumn
,
editFlag
,
xtraParams
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"ErrString :"
+
errString
);
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Exception : ItemChanged(String,String):"
+
e
.
getMessage
());
e
.
printStackTrace
();
throw
new
ITMException
(
e
);
}
return
errString
;
}
public
String
itemChanged
(
Document
dom
,
Document
dom1
,
Document
dom2
,
String
objContext
,
String
currentColumn
,
String
editFlag
,
String
xtraParams
)
throws
RemoteException
,
ITMException
{
NodeList
parentNodeList
=
null
,
detailNodeList
=
null
;
NodeList
childNodeList
=
null
;
Node
parentNode
=
null
;
Node
childNode
=
null
;
String
childNodeName
=
null
;
int
ctr
=
0
;
int
childNodeListLength
=
0
;
String
columnValue
=
""
;
StringBuffer
valueXmlString
=
new
StringBuffer
();
Connection
conn
=
null
;
PreparedStatement
pstmt
=
null
;
ResultSet
rs
=
null
;
String
sql
=
""
;
int
currentFormNo
=
0
;
SimpleDateFormat
sdf
=
null
;
FinCommon
finCommon
=
new
FinCommon
();
String
currentDateTime
=
""
,
loginSite
=
""
,
loginCode
=
""
;
String
custCode
=
""
,
contPers
=
""
,
currCode
=
""
,
currCodeFinEnt
=
""
,
currDescr
=
""
,
empCode
=
""
,
empFname
=
""
,
empLname
=
""
,
salesPers
=
""
,
salesPersDescr
=
""
,
custDescr
=
""
,
contPrefix
=
""
;
String
detCntStr
=
""
,
quotNo
=
""
,
unit
=
""
,
itemCode
=
""
,
itemDescr
=
""
,
unitRate
=
""
;
String
samplQty
=
""
,
unitSampl
=
""
,
schDate
=
""
,
schDateUpto
=
""
;
String
crTerm
=
""
,
dlvAt
=
""
,
dlvTerm
=
""
,
packCode
=
""
,
packingDescr
=
""
,
packInstr
=
""
,
remarks
=
""
;
String
itemSpec
=
""
,
specDescr
=
""
,
expectedResult
=
""
;
String
siteCode
=
""
,
siteDescr
=
""
,
stockistCode
=
""
,
stockistName
=
""
;
int
linecnt
=
0
;
double
exchRate
=
0
;
try
{
conn
=
getConnection
();
loginSite
=
genericUtility
.
getValueFromXTRA_PARAMS
(
xtraParams
,
"loginSiteCode"
);
loginCode
=
genericUtility
.
getValueFromXTRA_PARAMS
(
xtraParams
,
"loginCode"
);
sdf
=
new
SimpleDateFormat
(
genericUtility
.
getApplDateFormat
());
Timestamp
todaysDate
=
new
java
.
sql
.
Timestamp
(
System
.
currentTimeMillis
());
currentDateTime
=
sdf
.
format
(
todaysDate
);
if
(
objContext
!=
null
&&
objContext
.
trim
().
length
()
>
0
)
{
currentFormNo
=
Integer
.
parseInt
(
objContext
);
}
valueXmlString
.
append
(
"<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header>\r\n<editFlag>"
);
valueXmlString
.
append
(
editFlag
).
append
(
"</editFlag>\r\n</Header>\r\n"
);
switch
(
currentFormNo
)
{
case
1
:
{
valueXmlString
.
append
(
"<Detail1>"
);
parentNodeList
=
dom
.
getElementsByTagName
(
"Detail1"
);
parentNode
=
parentNodeList
.
item
(
0
);
childNodeList
=
parentNode
.
getChildNodes
();
childNodeListLength
=
childNodeList
.
getLength
();
do
{
childNode
=
childNodeList
.
item
(
ctr
);
childNodeName
=
childNode
.
getNodeName
();
if
(
childNodeName
.
equals
(
currentColumn
))
{
childNode
.
getFirstChild
();
}
ctr
++;
}
while
((
ctr
<
childNodeListLength
)
&&
(!
childNodeName
.
equals
(
currentColumn
)));
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"CURRENT COLUMN ["
+
currentColumn
+
"]"
);
if
(
currentColumn
.
equalsIgnoreCase
(
"itm_default"
))
{
valueXmlString
.
append
(
"<quot_date>"
).
append
(
"<![CDATA["
+
currentDateTime
+
"]]>"
).
append
(
"</quot_date>"
);
valueXmlString
.
append
(
"<inq_date>"
).
append
(
"<![CDATA["
+
currentDateTime
+
"]]>"
).
append
(
"</inq_date>"
);
valueXmlString
.
append
(
"<status_date>"
).
append
(
"<![CDATA["
+
currentDateTime
+
"]]>"
).
append
(
"</status_date>"
);
valueXmlString
.
append
(
"<confirmed>"
).
append
(
"<![CDATA[N]]>"
).
append
(
"</confirmed>"
);
}
// Changes by Gagan B. on 9-APR-26 to resolve the Data or Application error because AMD_NO was passed as blank while editing and finishing -- START
else
if
(
currentColumn
.
trim
().
equalsIgnoreCase
(
"itm_defaultedit"
))
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Item Default Edit form 1+++++"
);
quotNo
=
checkNull
(
genericUtility
.
getColumnValue
(
"quot_no"
,
dom
));
String
amdNoEdit
=
checkNull
(
genericUtility
.
getColumnValue
(
"amd_no"
,
dom
));
valueXmlString
.
append
(
"<quot_no>"
).
append
(
"<![CDATA["
+
quotNo
+
"]]>"
).
append
(
"</quot_no>"
);
valueXmlString
.
append
(
"<amd_no>"
).
append
(
"<![CDATA["
+
amdNoEdit
+
"]]>"
).
append
(
"</amd_no>"
);
}
// Changes by Gagan B. on 9-APR-26 to resolve the Data or Application error because AMD_NO was passed as blank while editing and finishing -- END
else
if
(
currentColumn
.
equalsIgnoreCase
(
"cust_code"
))
{
String
lsItemser
=
""
,
lsSiteCode
=
""
,
taxChapHdr
=
""
,
taxClassHdr
=
""
,
taxEnvHdr
=
""
;
String
custTaxOpt
=
""
,
orderType
=
""
,
stanCodeFr
=
""
,
custCodeTax
=
""
,
custCodeBill
=
""
,
stanCodeTo
=
""
,
lsCustCodeDlv
=
""
;
custCode
=
genericUtility
.
getColumnValue
(
"cust_code"
,
dom
);
lsItemser
=
checkNull
(
genericUtility
.
getColumnValue
(
"item_ser"
,
dom
));
lsSiteCode
=
checkNull
(
genericUtility
.
getColumnValue
(
"site_code"
,
dom
));
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"custCode ::::::: "
+
custCode
+
"\t"
+
"lsItemser ::::::"
+
lsItemser
);
sql
=
"select cust_name,cont_pers,cont_pfx,curr_code,sales_pers,cr_term,dlv_term from customer where cust_code= ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
custCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
custDescr
=
rs
.
getString
(
"cust_name"
);
contPers
=
rs
.
getString
(
"cont_pers"
);
contPrefix
=
rs
.
getString
(
"cont_pfx"
);
currCode
=
rs
.
getString
(
"curr_code"
);
salesPers
=
rs
.
getString
(
"sales_pers"
);
crTerm
=
rs
.
getString
(
"cr_term"
);
dlvTerm
=
rs
.
getString
(
"dlv_term"
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
valueXmlString
.
append
(
"<cust_name>"
).
append
(
"<![CDATA["
+
custDescr
+
"]]>"
).
append
(
"</cust_name>"
);
valueXmlString
.
append
(
"<cont_pers>"
).
append
(
"<![CDATA["
+
contPers
+
"]]>"
).
append
(
"</cont_pers>"
);
valueXmlString
.
append
(
"<sales_pers>"
).
append
(
"<![CDATA["
+
salesPers
+
"]]>"
).
append
(
"</sales_pers>"
);
valueXmlString
.
append
(
"<cr_term>"
).
append
(
"<![CDATA["
+
crTerm
+
"]]>"
).
append
(
"</cr_term>"
);
valueXmlString
.
append
(
"<dlv_term>"
).
append
(
"<![CDATA["
+
dlvTerm
+
"]]>"
).
append
(
"</dlv_term>"
);
sql
=
"select sp_name from sales_pers where sales_pers= ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
salesPers
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
salesPersDescr
=
rs
.
getString
(
"sp_name"
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
valueXmlString
.
append
(
"<sp_name>"
).
append
(
"<![CDATA["
+
salesPersDescr
+
"]]>"
).
append
(
"</sp_name>"
);
if
(
currCode
!=
null
&&
currCode
.
trim
().
length
()>
0
)
{
valueXmlString
.
append
(
"<curr_code>"
).
append
(
"<![CDATA["
+
currCode
+
"]]>"
).
append
(
"</curr_code>"
);
}
sql
=
"select curr_code from finent f, site s "
+
" where f.fin_entity=s.fin_entity and s.site_code =? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
loginSite
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
currCodeFinEnt
=
rs
.
getString
(
"curr_code"
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
currCodeFinEnt
.
equalsIgnoreCase
(
currCode
))
{
valueXmlString
.
append
(
"<exch_rate protect = \"1\" >"
).
append
(
"<![CDATA["
+
1
+
"]]>"
).
append
(
"</exch_rate>"
);
}
else
{
exchRate
=
finCommon
.
getDailyExchRateSellBuy
(
currCode
,
currCodeFinEnt
,
loginSite
,
currentDateTime
,
"S"
,
conn
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"exch rate by calling fincommon method>>"
+
exchRate
);
valueXmlString
.
append
(
"<exch_rate protect = \"0\" >"
).
append
(
"<![CDATA["
+
exchRate
+
"]]>"
).
append
(
"</exch_rate>"
);
}
//Added by Sakshi.P on 15/Oct/2025
sql
=
"select stan_code from site where site_code = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
lsSiteCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
stanCodeFr
=
rs
.
getString
(
"stan_code"
);
}
rs
.
close
();
rs
=
null
;
pstmt
.
close
();
pstmt
=
null
;
sql
=
"select stan_code from customer where cust_code = ?"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
custCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
stanCodeTo
=
rs
.
getString
(
"stan_code"
);
}
rs
.
close
();
rs
=
null
;
pstmt
.
close
();
pstmt
=
null
;
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"stanCodeFr======["
+
stanCodeFr
+
"]"
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"stanCodeTo====== ["
+
stanCodeTo
+
"]"
);
taxChapHdr
=
distCommon
.
getTaxChap
(
""
,
lsItemser
,
"C"
,
custCode
,
lsSiteCode
,
conn
);
taxClassHdr
=
distCommon
.
getTaxClass
(
"C"
,
custCode
,
""
,
lsSiteCode
,
conn
);
sql
=
" select tax_env from site_customer where site_code = ? and cust_code = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
lsSiteCode
);
pstmt
.
setString
(
2
,
custCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
taxEnvHdr
=
rs
.
getString
(
"tax_env"
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
taxEnvHdr
==
null
||
taxEnvHdr
.
trim
().
length
()==
0
)
{
sql
=
" select tax_env from customer where cust_code = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
custCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
taxEnvHdr
=
rs
.
getString
(
"tax_env"
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
taxEnvHdr
==
null
||
taxEnvHdr
.
trim
().
length
()==
0
)
{
taxEnvHdr
=
distCommon
.
getTaxEnv
(
stanCodeFr
,
stanCodeTo
,
taxChapHdr
,
taxClassHdr
,
lsSiteCode
,
conn
);
}
}
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"tax class======["
+
taxClassHdr
+
"]"
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"tax chap======["
+
taxChapHdr
+
"]"
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"tax env 11111::taxChapHdr["
+
taxEnvHdr
+
"]"
);
valueXmlString
.
append
(
"<tax_class>"
).
append
(
"<![CDATA["
+
taxClassHdr
+
"]]>"
).
append
(
"</tax_class>"
);
setNodeValue
(
dom
,
"tax_class"
,
getAbsString
(
taxClassHdr
));
valueXmlString
.
append
(
"<tax_chap>"
).
append
(
"<![CDATA["
+
taxChapHdr
+
"]]>"
).
append
(
"</tax_chap>"
);
setNodeValue
(
dom
,
"tax_chap"
,
getAbsString
(
taxChapHdr
));
valueXmlString
.
append
(
"<tax_env>"
).
append
(
"<![CDATA["
+
taxEnvHdr
+
"]]>"
).
append
(
"</tax_env>"
);
setNodeValue
(
dom
,
"tax_env"
,
getAbsString
(
taxEnvHdr
));
//end
}
else
if
(
currentColumn
.
equalsIgnoreCase
(
"sales_pers"
))
{
salesPers
=
genericUtility
.
getColumnValue
(
"sales_pers"
,
dom
);
sql
=
"select sp_name from sales_pers where sales_pers= ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
salesPers
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
salesPersDescr
=
rs
.
getString
(
"sp_name"
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
valueXmlString
.
append
(
"<sp_name>"
).
append
(
"<![CDATA["
+
salesPersDescr
+
"]]>"
).
append
(
"</sp_name>"
);
}
else
if
(
currentColumn
.
equalsIgnoreCase
(
"curr_code"
))
{
currCode
=
genericUtility
.
getColumnValue
(
"curr_code"
,
dom
);
// 2. Exchange Rate Logic
sql
=
"select curr_code from finent f, site s "
+
"where f.fin_entity = s.fin_entity and s.site_code = ?"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
loginSite
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
currCodeFinEnt
=
rs
.
getString
(
"curr_code"
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
currCodeFinEnt
!=
null
&&
currCodeFinEnt
.
equalsIgnoreCase
(
currCode
))
{
valueXmlString
.
append
(
"<exch_rate protect=\"1\">"
)
.
append
(
"<![CDATA[1]]>"
)
.
append
(
"</exch_rate>"
);
}
else
{
exchRate
=
finCommon
.
getDailyExchRateSellBuy
(
currCode
,
currCodeFinEnt
,
loginSite
,
currentDateTime
,
"S"
,
conn
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"exch rate by calling fincommon method>>"
+
exchRate
);
valueXmlString
.
append
(
"<exch_rate protect=\"0\">"
)
.
append
(
"<![CDATA["
+
exchRate
+
"]]>"
)
.
append
(
"</exch_rate>"
);
}
}
else
if
(
currentColumn
.
equalsIgnoreCase
(
"quot_no"
))
{
String
quotType
=
""
,
inqSource
=
""
,
empCodeConf1
=
""
,
status1
=
""
,
enqNo
=
""
,
sampleRef
=
""
,
termTable
=
""
;
String
stockistCodeDlv
=
""
,
dlvLocation
=
""
,
priceList1
=
""
,
itemSer1
=
""
,
parentQuotNo
=
""
;
String
custName
=
""
,
opprId
=
""
,
origQuotRed
=
""
,
locationDescr
=
""
;
String
taxClassHdr
=
""
,
taxChapHdr
=
""
,
taxEnvHdr
=
""
,
siteCode1
=
""
;
Timestamp
quotDateTs
=
null
,
inqDateTs
=
null
,
effDateTs
=
null
,
validUptoTs
=
null
,
statusDateTs
=
null
;
double
freight1
=
0
,
exchRate1
=
0
,
vat1
=
0
,
quotationCost1
=
0
;
int
prnpQuot1
=
0
,
supplyLeadtime1
=
0
;
String
errString
=
""
;
quotNo
=
checkNull
(
genericUtility
.
getColumnValue
(
"quot_no"
,
dom
));
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"INSIDE IC quot_no .... "
+
quotNo
);
if
(
currentColumn
.
equalsIgnoreCase
(
"quot_no"
)
&&
quotNo
.
length
()
>
0
)
{
sql
=
"select sq.quot_date, sq.quot_type, sq.cust_code, sq.inq_date, sq.inq_source, sq.eff_date ,sq.valid_upto, "
+
" sq.emp_code__conf, sq.status_date, sq.curr_code, sq.exch_rate, sq.cont_pers, sq.sales_pers, "
+
" sq.enq_no, sq.sample_ref, sq.freight, sq.cr_term, sq.dlv_term, sq.term_table, "
+
" sq.stockist_code__dlv, sq.dlv_location, sq.location_descr, sq.site_code, sq.price_list, sq.supply_leadtime, sq.item_ser, "
+
" sq.tax_class, sq.tax_chap, sq.tax_env, sq.parent_quot_no, sq.prnp_quot, sq.vat, sq.quotation_cost, "
+
" sq.oppr_id, sq.orig_quot_ref, "
+
// NEW FIELDS
" e.emp_fname, e.emp_lname, "
+
" c.descr as curr_descr, "
+
" cust.cust_name as stockist_name, "
+
" s.descr as site_descr "
+
" from SALES_QUOT sq "
+
" left join employee e on sq.emp_code__conf = e.emp_code "
+
" left join currency c on sq.curr_code = c.curr_code "
+
" left join customer cust on sq.stockist_code__dlv = cust.cust_code "
+
" left join site s on sq.site_code = s.site_code "
+
" where sq.quot_no = ?"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
quotNo
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
quotDateTs
=
rs
.
getTimestamp
(
"quot_date"
);
quotType
=
checkNull
(
rs
.
getString
(
"quot_type"
));
custCode
=
checkNull
(
rs
.
getString
(
"cust_code"
));
inqDateTs
=
rs
.
getTimestamp
(
"inq_date"
);
inqSource
=
checkNull
(
rs
.
getString
(
"inq_source"
));
effDateTs
=
rs
.
getTimestamp
(
"eff_date"
);
validUptoTs
=
rs
.
getTimestamp
(
"valid_upto"
);
empCodeConf1
=
checkNull
(
rs
.
getString
(
"emp_code__conf"
));
// status1 = checkNull(rs.getString("status"));
statusDateTs
=
rs
.
getTimestamp
(
"status_date"
);
currCode
=
checkNull
(
rs
.
getString
(
"curr_code"
));
exchRate1
=
rs
.
getDouble
(
"exch_rate"
);
contPers
=
checkNull
(
rs
.
getString
(
"cont_pers"
));
salesPers
=
checkNull
(
rs
.
getString
(
"sales_pers"
));
enqNo
=
checkNull
(
rs
.
getString
(
"enq_no"
));
sampleRef
=
checkNull
(
rs
.
getString
(
"sample_ref"
));
freight1
=
rs
.
getDouble
(
"freight"
);
crTerm
=
checkNull
(
rs
.
getString
(
"cr_term"
));
dlvTerm
=
checkNull
(
rs
.
getString
(
"dlv_term"
));
termTable
=
checkNull
(
rs
.
getString
(
"term_table"
));
stockistCodeDlv
=
checkNull
(
rs
.
getString
(
"stockist_code__dlv"
));
dlvLocation
=
checkNull
(
rs
.
getString
(
"dlv_location"
));
locationDescr
=
checkNull
(
rs
.
getString
(
"location_descr"
));
siteCode1
=
checkNull
(
rs
.
getString
(
"site_code"
));
priceList1
=
checkNull
(
rs
.
getString
(
"price_list"
));
supplyLeadtime1
=
rs
.
getInt
(
"supply_leadtime"
);
itemSer1
=
checkNull
(
rs
.
getString
(
"item_ser"
));
taxClassHdr
=
checkNull
(
rs
.
getString
(
"tax_class"
));
taxChapHdr
=
checkNull
(
rs
.
getString
(
"tax_chap"
));
taxEnvHdr
=
checkNull
(
rs
.
getString
(
"tax_env"
));
parentQuotNo
=
checkNull
(
rs
.
getString
(
"parent_quot_no"
));
prnpQuot1
=
rs
.
getInt
(
"prnp_quot"
);
vat1
=
rs
.
getDouble
(
"vat"
);
quotationCost1
=
rs
.
getDouble
(
"quotation_cost"
);
opprId
=
checkNull
(
rs
.
getString
(
"oppr_id"
));
origQuotRed
=
checkNull
(
rs
.
getString
(
"orig_quot_ref"
));
// New
empFname
=
checkNull
(
rs
.
getString
(
"emp_fname"
));
empLname
=
checkNull
(
rs
.
getString
(
"emp_lname"
));
currDescr
=
checkNull
(
rs
.
getString
(
"curr_descr"
));
stockistName
=
checkNull
(
rs
.
getString
(
"stockist_name"
));
siteDescr
=
checkNull
(
rs
.
getString
(
"site_descr"
));
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
// Fetch customer name
sql
=
"select cust_name from customer where cust_code = ?"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
custCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
custName
=
checkNull
(
rs
.
getString
(
"cust_name"
));
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
// Fetch sales person name
sql
=
"select sp_name from sales_pers where sales_pers = ?"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
salesPers
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
salesPersDescr
=
checkNull
(
rs
.
getString
(
"sp_name"
));
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
// Set header fields from original quotation
if
(
quotDateTs
!=
null
)
{
valueXmlString
.
append
(
"<quot_date>"
).
append
(
"<![CDATA["
+
sdf
.
format
(
quotDateTs
)+
"]]>"
).
append
(
"</quot_date>"
);
}
valueXmlString
.
append
(
"<quot_type>"
).
append
(
"<![CDATA["
+
quotType
+
"]]>"
).
append
(
"</quot_type>"
);
valueXmlString
.
append
(
"<cust_code>"
).
append
(
"<![CDATA["
+
custCode
+
"]]>"
).
append
(
"</cust_code>"
);
valueXmlString
.
append
(
"<cust_name>"
).
append
(
"<![CDATA["
+
custName
+
"]]>"
).
append
(
"</cust_name>"
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"inqDateTs 1293>>"
+
inqDateTs
);
if
(
inqDateTs
!=
null
)
{
valueXmlString
.
append
(
"<inq_date>"
).
append
(
"<![CDATA["
+
sdf
.
format
(
inqDateTs
)+
"]]>"
).
append
(
"</inq_date>"
);
}
valueXmlString
.
append
(
"<inq_source>"
).
append
(
"<![CDATA["
+
inqSource
+
"]]>"
).
append
(
"</inq_source>"
);
if
(
effDateTs
!=
null
)
{
valueXmlString
.
append
(
"<eff_date_o>"
).
append
(
"<![CDATA["
+
sdf
.
format
(
effDateTs
)+
"]]>"
).
append
(
"</eff_date_o>"
);
valueXmlString
.
append
(
"<eff_date>"
).
append
(
"<![CDATA["
+
sdf
.
format
(
effDateTs
)+
"]]>"
).
append
(
"</eff_date>"
);
}
if
(
validUptoTs
!=
null
)
{
valueXmlString
.
append
(
"<valid_upto_o>"
).
append
(
"<![CDATA["
+
sdf
.
format
(
validUptoTs
)+
"]]>"
).
append
(
"</valid_upto_o>"
);
valueXmlString
.
append
(
"<valid_upto>"
).
append
(
"<![CDATA["
+
sdf
.
format
(
validUptoTs
)+
"]]>"
).
append
(
"</valid_upto>"
);
}
valueXmlString
.
append
(
"<emp_code__conf>"
).
append
(
"<![CDATA["
+
empCodeConf1
+
"]]>"
).
append
(
"</emp_code__conf>"
);
valueXmlString
.
append
(
"<emp_fname>"
).
append
(
"<![CDATA["
+
empFname
+
"]]>"
).
append
(
"</emp_fname>"
);
valueXmlString
.
append
(
"<emp_lname>"
).
append
(
"<![CDATA["
+
empLname
+
"]]>"
).
append
(
"</emp_lname>"
);
// valueXmlString.append("<status>").append("<![CDATA["+status1+"]]>").append("</status>");
if
(
statusDateTs
!=
null
)
{
valueXmlString
.
append
(
"<status_date>"
).
append
(
"<![CDATA["
+
sdf
.
format
(
statusDateTs
)+
"]]>"
).
append
(
"</status_date>"
);
}
valueXmlString
.
append
(
"<curr_code>"
).
append
(
"<![CDATA["
+
currCode
+
"]]>"
).
append
(
"</curr_code>"
);
valueXmlString
.
append
(
"<currency_descr>"
).
append
(
"<![CDATA["
+
currDescr
+
"]]>"
).
append
(
"</currency_descr>"
);
valueXmlString
.
append
(
"<exch_rate>"
).
append
(
"<![CDATA["
+
exchRate1
+
"]]>"
).
append
(
"</exch_rate>"
);
valueXmlString
.
append
(
"<cont_pers>"
).
append
(
"<![CDATA["
+
contPers
+
"]]>"
).
append
(
"</cont_pers>"
);
valueXmlString
.
append
(
"<sales_pers>"
).
append
(
"<![CDATA["
+
salesPers
+
"]]>"
).
append
(
"</sales_pers>"
);
valueXmlString
.
append
(
"<sp_name>"
).
append
(
"<![CDATA["
+
salesPersDescr
+
"]]>"
).
append
(
"</sp_name>"
);
valueXmlString
.
append
(
"<enq_no>"
).
append
(
"<![CDATA["
+
enqNo
+
"]]>"
).
append
(
"</enq_no>"
);
valueXmlString
.
append
(
"<sample_ref>"
).
append
(
"<![CDATA["
+
sampleRef
+
"]]>"
).
append
(
"</sample_ref>"
);
valueXmlString
.
append
(
"<freight>"
).
append
(
"<![CDATA["
+
freight1
+
"]]>"
).
append
(
"</freight>"
);
valueXmlString
.
append
(
"<cr_term>"
).
append
(
"<![CDATA["
+
crTerm
+
"]]>"
).
append
(
"</cr_term>"
);
valueXmlString
.
append
(
"<dlv_term>"
).
append
(
"<![CDATA["
+
dlvTerm
+
"]]>"
).
append
(
"</dlv_term>"
);
valueXmlString
.
append
(
"<term_table>"
).
append
(
"<![CDATA["
+
termTable
+
"]]>"
).
append
(
"</term_table>"
);
valueXmlString
.
append
(
"<stockist_code__dlv>"
).
append
(
"<![CDATA["
+
stockistCodeDlv
+
"]]>"
).
append
(
"</stockist_code__dlv>"
);
valueXmlString
.
append
(
"<stockist_cust_name>"
).
append
(
"<![CDATA["
+
stockistName
+
"]]>"
).
append
(
"</stockist_cust_name>"
);
valueXmlString
.
append
(
"<dlv_location>"
).
append
(
"<![CDATA["
+
dlvLocation
+
"]]>"
).
append
(
"</dlv_location>"
);
valueXmlString
.
append
(
"<site_code>"
).
append
(
"<![CDATA["
+
siteCode1
+
"]]>"
).
append
(
"</site_code>"
);
valueXmlString
.
append
(
"<site_descr>"
).
append
(
"<![CDATA["
+
siteDescr
+
"]]>"
).
append
(
"</site_descr>"
);
valueXmlString
.
append
(
"<price_list>"
).
append
(
"<![CDATA["
+
priceList1
+
"]]>"
).
append
(
"</price_list>"
);
valueXmlString
.
append
(
"<supply_leadtime>"
).
append
(
"<![CDATA["
+
supplyLeadtime1
+
"]]>"
).
append
(
"</supply_leadtime>"
);
valueXmlString
.
append
(
"<item_ser>"
).
append
(
"<![CDATA["
+
itemSer1
+
"]]>"
).
append
(
"</item_ser>"
);
valueXmlString
.
append
(
"<tax_class>"
).
append
(
"<![CDATA["
+
taxClassHdr
+
"]]>"
).
append
(
"</tax_class>"
);
setNodeValue
(
dom
,
"tax_class"
,
getAbsString
(
taxClassHdr
));
valueXmlString
.
append
(
"<tax_chap>"
).
append
(
"<![CDATA["
+
taxChapHdr
+
"]]>"
).
append
(
"</tax_chap>"
);
setNodeValue
(
dom
,
"tax_chap"
,
getAbsString
(
taxChapHdr
));
valueXmlString
.
append
(
"<tax_env>"
).
append
(
"<![CDATA["
+
taxEnvHdr
+
"]]>"
).
append
(
"</tax_env>"
);
setNodeValue
(
dom
,
"tax_env"
,
getAbsString
(
taxEnvHdr
));
valueXmlString
.
append
(
"<parent_quot_no>"
).
append
(
"<![CDATA["
+
parentQuotNo
+
"]]>"
).
append
(
"</parent_quot_no>"
);
valueXmlString
.
append
(
"<prnp_quot>"
).
append
(
"<![CDATA["
+
prnpQuot1
+
"]]>"
).
append
(
"</prnp_quot>"
);
valueXmlString
.
append
(
"<vat>"
).
append
(
"<![CDATA["
+
vat1
+
"]]>"
).
append
(
"</vat>"
);
valueXmlString
.
append
(
"<quotation_cost>"
).
append
(
"<![CDATA["
+
quotationCost1
+
"]]>"
).
append
(
"</quotation_cost>"
);
valueXmlString
.
append
(
"<oppr_id>"
).
append
(
"<![CDATA["
+
opprId
+
"]]>"
).
append
(
"</oppr_id>"
);
valueXmlString
.
append
(
"<orig_quot_ref>"
).
append
(
"<![CDATA["
+
origQuotRed
+
"]]>"
).
append
(
"</orig_quot_ref>"
);
valueXmlString
.
append
(
"<confirmed>"
).
append
(
"<![CDATA[N]]>"
).
append
(
"</confirmed>"
);
valueXmlString
.
append
(
"<location_descr>"
).
append
(
"<![CDATA["
+
locationDescr
+
"]]>"
).
append
(
"</location_descr>"
);
}
else
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"quot_no cleared, resetting fields"
);
valueXmlString
.
append
(
"<quot_no><![CDATA[]]></quot_no>"
);
valueXmlString
.
append
(
"<quot_date><![CDATA[]]></quot_date>"
);
valueXmlString
.
append
(
"<quot_type><![CDATA[]]></quot_type>"
);
valueXmlString
.
append
(
"<cust_code><![CDATA[]]></cust_code>"
);
valueXmlString
.
append
(
"<cust_name><![CDATA[]]></cust_name>"
);
valueXmlString
.
append
(
"<inq_date><![CDATA[]]></inq_date>"
);
valueXmlString
.
append
(
"<inq_source><![CDATA[]]></inq_source>"
);
valueXmlString
.
append
(
"<valid_upto><![CDATA[]]></valid_upto>"
);
valueXmlString
.
append
(
"<valid_upto_o><![CDATA[]]></valid_upto_o>"
);
valueXmlString
.
append
(
"<eff_date><![CDATA[]]></eff_date>"
);
valueXmlString
.
append
(
"<eff_date_o><![CDATA[]]></eff_date_o>"
);
valueXmlString
.
append
(
"<emp_code__conf><![CDATA[]]></emp_code__conf>"
);
valueXmlString
.
append
(
"<status><![CDATA[]]></status>"
);
valueXmlString
.
append
(
"<status_date><![CDATA[]]></status_date>"
);
valueXmlString
.
append
(
"<curr_code><![CDATA[]]></curr_code>"
);
valueXmlString
.
append
(
"<exch_rate><![CDATA[]]></exch_rate>"
);
valueXmlString
.
append
(
"<cont_pers><![CDATA[]]></cont_pers>"
);
valueXmlString
.
append
(
"<sales_pers><![CDATA[]]></sales_pers>"
);
valueXmlString
.
append
(
"<sp_name><![CDATA[]]></sp_name>"
);
valueXmlString
.
append
(
"<enq_no><![CDATA[]]></enq_no>"
);
valueXmlString
.
append
(
"<sample_ref><![CDATA[]]></sample_ref>"
);
valueXmlString
.
append
(
"<freight><![CDATA[]]></freight>"
);
valueXmlString
.
append
(
"<cr_term><![CDATA[]]></cr_term>"
);
valueXmlString
.
append
(
"<dlv_term><![CDATA[]]></dlv_term>"
);
valueXmlString
.
append
(
"<term_table><![CDATA[]]></term_table>"
);
valueXmlString
.
append
(
"<stockist_code__dlv><![CDATA[]]></stockist_code__dlv>"
);
valueXmlString
.
append
(
"<dlv_location><![CDATA[]]></dlv_location>"
);
valueXmlString
.
append
(
"<site_code><![CDATA[]]></site_code>"
);
valueXmlString
.
append
(
"<price_list><![CDATA[]]></price_list>"
);
valueXmlString
.
append
(
"<supply_leadtime><![CDATA[]]></supply_leadtime>"
);
valueXmlString
.
append
(
"<item_ser><![CDATA[]]></item_ser>"
);
valueXmlString
.
append
(
"<tax_class><![CDATA[]]></tax_class>"
);
valueXmlString
.
append
(
"<tax_chap><![CDATA[]]></tax_chap>"
);
valueXmlString
.
append
(
"<tax_env><![CDATA[]]></tax_env>"
);
valueXmlString
.
append
(
"<parent_quot_no><![CDATA[]]></parent_quot_no>"
);
valueXmlString
.
append
(
"<prnp_quot><![CDATA[]]></prnp_quot>"
);
valueXmlString
.
append
(
"<vat><![CDATA[]]></vat>"
);
valueXmlString
.
append
(
"<quotation_cost><![CDATA[]]></quotation_cost>"
);
valueXmlString
.
append
(
"<oppr_id><![CDATA[]]></oppr_id>"
);
valueXmlString
.
append
(
"<orig_quot_ref><![CDATA[]]></orig_quot_ref>"
);
valueXmlString
.
append
(
"<location_descr><![CDATA[]]></location_descr>"
);
valueXmlString
.
append
(
"<confirmed><![CDATA[N]]></confirmed>"
);
}
}
valueXmlString
.
append
(
"</Detail1>"
);
// Set quot_no in second form as protected (uneditable)
if
(
quotNo
!=
null
&&
quotNo
.
trim
().
length
()
>
0
)
{
String
amdNo1
=
checkNull
(
genericUtility
.
getColumnValue
(
"amd_no"
,
dom
));
valueXmlString
.
append
(
"<Detail2>"
);
valueXmlString
.
append
(
"<quot_no protect=\"1\">"
).
append
(
"<![CDATA["
+
quotNo
+
"]]>"
).
append
(
"</quot_no>"
);
valueXmlString
.
append
(
"<amd_no protect=\"1\">"
).
append
(
"<![CDATA["
+
amdNo1
+
"]]>"
).
append
(
"</amd_no>"
);
valueXmlString
.
append
(
"</Detail2>"
);
valueXmlString
.
append
(
"<Detail3>"
);
valueXmlString
.
append
(
"<quot_no protect=\"1\">"
).
append
(
"<![CDATA["
+
quotNo
+
"]]>"
).
append
(
"</quot_no>"
);
valueXmlString
.
append
(
"<amd_no protect=\"1\">"
).
append
(
"<![CDATA["
+
amdNo1
+
"]]>"
).
append
(
"</amd_no>"
);
valueXmlString
.
append
(
"</Detail3>"
);
}
else
{
valueXmlString
.
append
(
"<Detail2>"
);
valueXmlString
.
append
(
"<quot_no protect=\"1\">"
).
append
(
"<![CDATA[]]>"
).
append
(
"</quot_no>"
);
valueXmlString
.
append
(
"<amd_no protect=\"1\">"
).
append
(
"<![CDATA[]]>"
).
append
(
"</amd_no>"
);
valueXmlString
.
append
(
"</Detail2>"
);
valueXmlString
.
append
(
"<Detail3>"
);
valueXmlString
.
append
(
"<quot_no protect=\"1\">"
).
append
(
"<![CDATA[]]>"
).
append
(
"</quot_no>"
);
valueXmlString
.
append
(
"<amd_no protect=\"1\">"
).
append
(
"<![CDATA[]]>"
).
append
(
"</amd_no>"
);
valueXmlString
.
append
(
"</Detail3>"
);
}
}
break
;
case
2
:
{
parentNodeList
=
dom
.
getElementsByTagName
(
"Detail2"
);
parentNode
=
parentNodeList
.
item
(
0
);
childNodeList
=
parentNode
.
getChildNodes
();
valueXmlString
.
append
(
"<Detail2>"
);
childNodeListLength
=
childNodeList
.
getLength
();
do
{
childNode
=
childNodeList
.
item
(
ctr
);
childNodeName
=
childNode
.
getNodeName
();
if
(
childNodeName
.
equals
(
currentColumn
))
{
if
(
childNode
.
getFirstChild
()
!=
null
)
{
columnValue
=
childNode
.
getFirstChild
().
getNodeValue
().
trim
();
}
}
ctr
++;
}
while
((
ctr
<
childNodeListLength
)
&&
(!
childNodeName
.
equals
(
currentColumn
)));
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"CURRENT COLUMN ["
+
currentColumn
+
"]"
);
if
(
currentColumn
.
trim
().
equalsIgnoreCase
(
"itm_defaultedit"
))
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Item Default Edit+++++"
);
quotNo
=
checkNull
(
genericUtility
.
getColumnValue
(
"quot_no"
,
dom1
));
String
amdNoEdit
=
checkNull
(
genericUtility
.
getColumnValue
(
"amd_no"
,
dom1
));
valueXmlString
.
append
(
"<quot_no>"
).
append
(
"<![CDATA["
+
quotNo
+
"]]>"
).
append
(
"</quot_no>"
);
valueXmlString
.
append
(
"<amd_no>"
).
append
(
"<![CDATA["
+
amdNoEdit
+
"]]>"
).
append
(
"</amd_no>"
);
String
lcrate1
=
""
,
lcQty1
=
""
,
taxAmtStr
=
""
,
discountStr
=
""
;
double
lcrate
=
0
,
lcQty
=
0
,
taxamt
=
0
,
discount
=
0
,
netAmount
=
0.0
;
lcrate1
=
checkNull
(
genericUtility
.
getColumnValue
(
"rate"
,
dom
));
lcrate
=
(
lcrate1
==
null
||
lcrate1
.
trim
().
length
()
==
0
)
?
0
:
Double
.
parseDouble
(
lcrate1
);
lcQty1
=
checkNull
(
genericUtility
.
getColumnValue
(
"quantity"
,
dom
));
lcQty
=
(
lcQty1
==
null
||
lcQty1
.
trim
().
length
()
==
0
)
?
0
:
Double
.
parseDouble
(
lcQty1
);
taxAmtStr
=
checkNull
(
genericUtility
.
getColumnValue
(
"tax_amt"
,
dom
,
"2"
));
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"taxAmtStr----)["
+
taxAmtStr
+
"]"
);
taxamt
=
(
taxAmtStr
==
null
||
taxAmtStr
.
trim
().
length
()
==
0
)
?
0
:
Double
.
parseDouble
(
taxAmtStr
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Quantity["
+
lcQty
+
"]"
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Rate["
+
lcrate
+
"]"
);
netAmount
=
(
lcQty
*
lcrate
)+
taxamt
;
netAmount
=
finCommon
.
getRequiredDecimal
(
netAmount
,
2
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Net Amount(lcQty*lcrate)+taxamt-discount)["
+
netAmount
+
"]"
);
valueXmlString
.
append
(
"<net_amt>"
).
append
(
"<![CDATA["
+
netAmount
+
"]]>"
).
append
(
"</net_amt>"
);
}
else
if
(
currentColumn
.
equalsIgnoreCase
(
"itm_default"
))
{
quotNo
=
checkNull
(
genericUtility
.
getColumnValue
(
"quot_no"
,
dom1
));
String
amdNoD2
=
checkNull
(
genericUtility
.
getColumnValue
(
"amd_no"
,
dom1
));
detCntStr
=
genericUtility
.
getValueFromXTRA_PARAMS
(
xtraParams
,
"detCnt"
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Values of detCntStr ["
+
detCntStr
+
"]"
);
detailNodeList
=
dom2
.
getElementsByTagName
(
"Detail2"
);
linecnt
=
detailNodeList
.
getLength
();
valueXmlString
.
append
(
"<quot_no>"
).
append
(
"<![CDATA["
+
quotNo
+
"]]>"
).
append
(
"</quot_no>"
);
valueXmlString
.
append
(
"<amd_no>"
).
append
(
"<![CDATA["
+
amdNoD2
+
"]]>"
).
append
(
"</amd_no>"
);
// above commented pb code migrated to the following
if
(
linecnt
>
1
)
{
Node
currDetail
=
detailNodeList
.
item
(
linecnt
-
1
);
unit
=
genericUtility
.
getColumnValueFromNode
(
"unit"
,
currDetail
);
itemCode
=
genericUtility
.
getColumnValueFromNode
(
"item_code"
,
currDetail
);
itemDescr
=
genericUtility
.
getColumnValueFromNode
(
"item_descr"
,
currDetail
);
unitRate
=
genericUtility
.
getColumnValueFromNode
(
"unit__rate"
,
currDetail
);
samplQty
=
genericUtility
.
getColumnValueFromNode
(
"sampl_qty"
,
currDetail
);
unitSampl
=
genericUtility
.
getColumnValueFromNode
(
"unit__sampl"
,
currDetail
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"before getting dom"
);
schDate
=
checkNull
(
genericUtility
.
getColumnValueFromNode
(
"sch_date"
,
currDetail
));
schDateUpto
=
checkNull
(
genericUtility
.
getColumnValueFromNode
(
"sch_date_upto"
,
currDetail
));
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"schdate>>>"
+
schDate
+
" "
+
"sch date upto>>>>"
+
schDateUpto
);
crTerm
=
genericUtility
.
getColumnValueFromNode
(
"cr_term"
,
currDetail
);
dlvAt
=
genericUtility
.
getColumnValueFromNode
(
"dlv_at"
,
currDetail
);
dlvTerm
=
genericUtility
.
getColumnValueFromNode
(
"dlv_term"
,
currDetail
);
packCode
=
genericUtility
.
getColumnValueFromNode
(
"pack_code"
,
currDetail
);
packInstr
=
genericUtility
.
getColumnValueFromNode
(
"pack_instr"
,
currDetail
);
remarks
=
genericUtility
.
getColumnValueFromNode
(
"remarks"
,
currDetail
);
itemSpec
=
genericUtility
.
getColumnValueFromNode
(
"item_spec"
,
currDetail
);
valueXmlString
.
append
(
"<unit>"
).
append
(
"<![CDATA["
+
unit
+
"]]>"
).
append
(
"</unit>"
);
valueXmlString
.
append
(
"<item_code>"
).
append
(
"<![CDATA["
+
itemCode
+
"]]>"
).
append
(
"</item_code>"
);
valueXmlString
.
append
(
"<item_descr>"
).
append
(
"<![CDATA["
+
itemDescr
+
"]]>"
).
append
(
"</item_descr>"
);
valueXmlString
.
append
(
"<unit__rate>"
).
append
(
"<![CDATA["
+
unitRate
+
"]]>"
).
append
(
"</unit__rate>"
);
valueXmlString
.
append
(
"<sampl_qty>"
).
append
(
"<![CDATA["
+
samplQty
+
"]]>"
).
append
(
"</sampl_qty>"
);
valueXmlString
.
append
(
"<unit__sampl>"
).
append
(
"<![CDATA["
+
unitSampl
+
"]]>"
).
append
(
"</unit__sampl>"
);
valueXmlString
.
append
(
"<sch_date>"
).
append
(
"<![CDATA["
+
schDate
+
"]]>"
).
append
(
"</sch_date>"
);
valueXmlString
.
append
(
"<sch_date_upto>"
).
append
(
"<![CDATA["
+
schDateUpto
+
"]]>"
).
append
(
"</sch_date_upto>"
);
valueXmlString
.
append
(
"<dlv_at>"
).
append
(
"<![CDATA["
+
dlvAt
+
"]]>"
).
append
(
"</dlv_at>"
);
valueXmlString
.
append
(
"<pack_code>"
).
append
(
"<![CDATA["
+
packCode
+
"]]>"
).
append
(
"</pack_code>"
);
valueXmlString
.
append
(
"<pack_instr>"
).
append
(
"<![CDATA["
+
packInstr
+
"]]>"
).
append
(
"</pack_instr>"
);
valueXmlString
.
append
(
"<remarks>"
).
append
(
"<![CDATA["
+
remarks
+
"]]>"
).
append
(
"</remarks>"
);
valueXmlString
.
append
(
"<item_spec>"
).
append
(
"<![CDATA["
+
itemSpec
+
"]]>"
).
append
(
"</item_spec>"
);
valueXmlString
.
append
(
"<cr_term>"
).
append
(
"<![CDATA["
+
crTerm
+
"]]>"
).
append
(
"</cr_term>"
);
valueXmlString
.
append
(
"<dlv_term>"
).
append
(
"<![CDATA["
+
dlvTerm
+
"]]>"
).
append
(
"</dlv_term>"
);
}
else
{
crTerm
=
genericUtility
.
getColumnValue
(
"cr_term"
,
dom1
);
dlvTerm
=
genericUtility
.
getColumnValue
(
"dlv_term"
,
dom1
);
valueXmlString
.
append
(
"<cr_term>"
).
append
(
"<![CDATA["
+
crTerm
+
"]]>"
).
append
(
"</cr_term>"
);
valueXmlString
.
append
(
"<dlv_term>"
).
append
(
"<![CDATA["
+
dlvTerm
+
"]]>"
).
append
(
"</dlv_term>"
);
}
}
else
if
(
currentColumn
.
equalsIgnoreCase
(
"item_code"
))
{
itemCode
=
genericUtility
.
getColumnValue
(
"item_code"
,
dom
);
sql
=
"select i.descr as item_descr, i.unit, p.descr as packing_descr "
+
"from item i "
+
"left join packing p on p.pack_code = ? "
+
"where i.item_code = ?"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
packCode
);
pstmt
.
setString
(
2
,
itemCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
itemDescr
=
checkNull
(
rs
.
getString
(
"item_descr"
));
unit
=
checkNull
(
rs
.
getString
(
"unit"
));
packingDescr
=
checkNull
(
rs
.
getString
(
"packing_descr"
));
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
valueXmlString
.
append
(
"<item_descr>"
).
append
(
"<![CDATA["
+
itemDescr
+
"]]>"
).
append
(
"</item_descr>"
);
valueXmlString
.
append
(
"<packing_descr>"
).
append
(
"<![CDATA["
+
packingDescr
+
"]]>"
).
append
(
"</packing_descr>"
);
valueXmlString
.
append
(
"<unit>"
).
append
(
"<![CDATA["
+
unit
+
"]]>"
).
append
(
"</unit>"
);
valueXmlString
.
append
(
"<unit__rate>"
).
append
(
"<![CDATA["
+
unit
+
"]]>"
).
append
(
"</unit__rate>"
);
valueXmlString
.
append
(
"<unit__sampl>"
).
append
(
"<![CDATA["
+
unit
+
"]]>"
).
append
(
"</unit__sampl>"
);
sql
=
"Select a.spec_descr, b.expected_result "
+
" from qc_tabledet b, "
+
" qlty_specs a "
+
" where a.spec_code = b.spec_code and "
+
" b.qc_tableno = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
itemCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
specDescr
=
rs
.
getString
(
"spec_descr"
);
expectedResult
=
rs
.
getString
(
"expected_result"
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
itemSpec
=
itemSpec
+
specDescr
+
" "
+
expectedResult
;
//str1 = str1 + s1 + ' ' + s2 + space(101 - len(s1+s2))
valueXmlString
.
append
(
"<item_spec>"
).
append
(
"<![CDATA["
+
itemSpec
+
"]]>"
).
append
(
"</item_spec>"
);
// Fetch original quotation detail data for the selected item_code
String
quotNoHdr
=
checkNull
(
genericUtility
.
getColumnValue
(
"quot_no"
,
dom1
));
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"quotNoHdr for SALES_QUOTDET fetch: ["
+
quotNoHdr
+
"] itemCode: ["
+
itemCode
+
"]"
);
if
(
quotNoHdr
!=
null
&&
quotNoHdr
.
trim
().
length
()
>
0
&&
itemCode
!=
null
&&
itemCode
.
trim
().
length
()
>
0
)
{
double
detQuantity
=
0
,
detRate
=
0
,
detRateClg
=
0
,
detSamplQty
=
0
,
detPackQty
=
0
;
String
detUnitRate
=
""
,
detUnitSampl
=
""
,
detRemarks
=
""
,
detPackInstr
=
""
,
detCrTerm
=
""
,
detDlvTerm
=
""
;
String
detPackCode
=
""
,
detDlvAt
=
""
,
detSpecRef
=
""
,
detItemSpec
=
""
;
Timestamp
detSchDate
=
null
,
detSchDateUpto
=
null
;
sql
=
" select quantity, rate, rate__clg, unit__rate, sch_date, sampl_qty, unit__sampl, "
+
" remarks, pack_instr, cr_term, dlv_term, item_spec, pack_code, "
+
" sch_date_upto, pack_qty, dlv_at, spec_ref "
+
" from SALES_QUOTDET where quot_no = ? and item_code = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
quotNoHdr
);
pstmt
.
setString
(
2
,
itemCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
detQuantity
=
rs
.
getDouble
(
"quantity"
);
detRate
=
rs
.
getDouble
(
"rate"
);
detRateClg
=
rs
.
getDouble
(
"rate__clg"
);
detUnitRate
=
checkNull
(
rs
.
getString
(
"unit__rate"
));
detSchDate
=
rs
.
getTimestamp
(
"sch_date"
);
detSamplQty
=
rs
.
getDouble
(
"sampl_qty"
);
detUnitSampl
=
checkNull
(
rs
.
getString
(
"unit__sampl"
));
detRemarks
=
checkNull
(
rs
.
getString
(
"remarks"
));
detPackInstr
=
checkNull
(
rs
.
getString
(
"pack_instr"
));
detCrTerm
=
checkNull
(
rs
.
getString
(
"cr_term"
));
detDlvTerm
=
checkNull
(
rs
.
getString
(
"dlv_term"
));
detItemSpec
=
checkNull
(
rs
.
getString
(
"item_spec"
));
detPackCode
=
checkNull
(
rs
.
getString
(
"pack_code"
));
detSchDateUpto
=
rs
.
getTimestamp
(
"sch_date_upto"
);
detPackQty
=
rs
.
getDouble
(
"pack_qty"
);
detDlvAt
=
checkNull
(
rs
.
getString
(
"dlv_at"
));
detSpecRef
=
checkNull
(
rs
.
getString
(
"spec_ref"
));
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
valueXmlString
.
append
(
"<quantity_o>"
).
append
(
"<![CDATA["
+
detQuantity
+
"]]>"
).
append
(
"</quantity_o>"
);
valueXmlString
.
append
(
"<quantity>"
).
append
(
"<![CDATA["
+
detQuantity
+
"]]>"
).
append
(
"</quantity>"
);
valueXmlString
.
append
(
"<rate_o>"
).
append
(
"<![CDATA["
+
detRate
+
"]]>"
).
append
(
"</rate_o>"
);
valueXmlString
.
append
(
"<rate>"
).
append
(
"<![CDATA["
+
detRate
+
"]]>"
).
append
(
"</rate>"
);
valueXmlString
.
append
(
"<rate__clg>"
).
append
(
"<![CDATA["
+
detRateClg
+
"]]>"
).
append
(
"</rate__clg>"
);
if
(
detUnitRate
!=
null
&&
detUnitRate
.
trim
().
length
()
>
0
)
{
valueXmlString
.
append
(
"<unit__rate_o>"
).
append
(
"<![CDATA["
+
detUnitRate
+
"]]>"
).
append
(
"</unit__rate_o>"
);
valueXmlString
.
append
(
"<unit__rate>"
).
append
(
"<![CDATA["
+
detUnitRate
+
"]]>"
).
append
(
"</unit__rate>"
);
}
if
(
detSchDate
!=
null
)
{
valueXmlString
.
append
(
"<sch_date>"
).
append
(
"<![CDATA["
+
sdf
.
format
(
detSchDate
)+
"]]>"
).
append
(
"</sch_date>"
);
}
valueXmlString
.
append
(
"<sampl_qty>"
).
append
(
"<![CDATA["
+
detSamplQty
+
"]]>"
).
append
(
"</sampl_qty>"
);
if
(
detUnitSampl
!=
null
&&
detUnitSampl
.
trim
().
length
()
>
0
)
{
valueXmlString
.
append
(
"<unit__sampl>"
).
append
(
"<![CDATA["
+
detUnitSampl
+
"]]>"
).
append
(
"</unit__sampl>"
);
}
valueXmlString
.
append
(
"<remarks>"
).
append
(
"<![CDATA["
+
detRemarks
+
"]]>"
).
append
(
"</remarks>"
);
valueXmlString
.
append
(
"<pack_instr>"
).
append
(
"<![CDATA["
+
detPackInstr
+
"]]>"
).
append
(
"</pack_instr>"
);
valueXmlString
.
append
(
"<cr_term>"
).
append
(
"<![CDATA["
+
detCrTerm
+
"]]>"
).
append
(
"</cr_term>"
);
valueXmlString
.
append
(
"<dlv_term>"
).
append
(
"<![CDATA["
+
detDlvTerm
+
"]]>"
).
append
(
"</dlv_term>"
);
if
(
detItemSpec
!=
null
&&
detItemSpec
.
trim
().
length
()
>
0
)
{
valueXmlString
.
append
(
"<item_spec>"
).
append
(
"<![CDATA["
+
detItemSpec
+
"]]>"
).
append
(
"</item_spec>"
);
}
valueXmlString
.
append
(
"<pack_code>"
).
append
(
"<![CDATA["
+
detPackCode
+
"]]>"
).
append
(
"</pack_code>"
);
if
(
detSchDateUpto
!=
null
)
{
valueXmlString
.
append
(
"<sch_date_upto>"
).
append
(
"<![CDATA["
+
sdf
.
format
(
detSchDateUpto
)+
"]]>"
).
append
(
"</sch_date_upto>"
);
}
valueXmlString
.
append
(
"<pack_qty>"
).
append
(
"<![CDATA["
+
detPackQty
+
"]]>"
).
append
(
"</pack_qty>"
);
valueXmlString
.
append
(
"<dlv_at>"
).
append
(
"<![CDATA["
+
detDlvAt
+
"]]>"
).
append
(
"</dlv_at>"
);
valueXmlString
.
append
(
"<spec_ref>"
).
append
(
"<![CDATA["
+
detSpecRef
+
"]]>"
).
append
(
"</spec_ref>"
);
}
if
(
itemCode
==
null
||
itemCode
.
trim
().
length
()
==
0
)
{
valueXmlString
.
append
(
"<item_code><![CDATA[]]></item_code>"
);
valueXmlString
.
append
(
"<item_descr><![CDATA[]]></item_descr>"
);
valueXmlString
.
append
(
"<unit><![CDATA[]]></unit>"
);
valueXmlString
.
append
(
"<unit__rate><![CDATA[]]></unit__rate>"
);
valueXmlString
.
append
(
"<unit__sampl><![CDATA[]]></unit__sampl>"
);
valueXmlString
.
append
(
"<item_spec><![CDATA[]]></item_spec>"
);
valueXmlString
.
append
(
"<quantity><![CDATA[0]]></quantity>"
);
valueXmlString
.
append
(
"<quantity_o><![CDATA[0]]></quantity_o>"
);
valueXmlString
.
append
(
"<rate_o><![CDATA[0]]></rate_o>"
);
valueXmlString
.
append
(
"<rate><![CDATA[0]]></rate>"
);
valueXmlString
.
append
(
"<rate__clg><![CDATA[0]]></rate__clg>"
);
valueXmlString
.
append
(
"<sampl_qty><![CDATA[0]]></sampl_qty>"
);
valueXmlString
.
append
(
"<pack_qty><![CDATA[0]]></pack_qty>"
);
valueXmlString
.
append
(
"<remarks><![CDATA[]]></remarks>"
);
valueXmlString
.
append
(
"<pack_instr><![CDATA[]]></pack_instr>"
);
valueXmlString
.
append
(
"<cr_term><![CDATA[]]></cr_term>"
);
valueXmlString
.
append
(
"<dlv_term><![CDATA[]]></dlv_term>"
);
valueXmlString
.
append
(
"<pack_code><![CDATA[]]></pack_code>"
);
valueXmlString
.
append
(
"<dlv_at><![CDATA[]]></dlv_at>"
);
valueXmlString
.
append
(
"<spec_ref><![CDATA[]]></spec_ref>"
);
valueXmlString
.
append
(
"<tax_class><![CDATA[]]></tax_class>"
);
valueXmlString
.
append
(
"<tax_chap><![CDATA[]]></tax_chap>"
);
valueXmlString
.
append
(
"<tax_env><![CDATA[]]></tax_env>"
);
}
//Added by Sakshi.P on 27/Oct/2025
String
lsTaxChapHdr
=
""
,
lsTaxClassHdr
=
""
,
lsTaxEnvHdr
=
""
,
lsSiteCode
=
""
,
stanCodeFr
=
""
,
stanCodeTo
=
""
,
lsItemser
=
""
;
String
taxChapHdr
=
""
,
taxClassHdr
=
""
,
taxEnvHdr
=
""
,
custCode1
=
""
;
lsTaxChapHdr
=
checkNull
(
genericUtility
.
getColumnValue
(
"tax_chap"
,
dom1
));
lsTaxClassHdr
=
checkNull
(
genericUtility
.
getColumnValue
(
"tax_class"
,
dom1
));
lsTaxEnvHdr
=
checkNull
(
genericUtility
.
getColumnValue
(
"tax_env"
,
dom1
));
lsSiteCode
=
checkNull
(
genericUtility
.
getColumnValue
(
"site_code"
,
dom1
));
lsItemser
=
checkNull
(
genericUtility
.
getColumnValue
(
"item_ser"
,
dom1
));
custCode1
=
genericUtility
.
getColumnValue
(
"cust_code"
,
dom1
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"lsTaxChapHdr dom1:["
+
lsTaxChapHdr
+
"] lsTaxClassHdr dom1 ["
+
lsTaxClassHdr
+
"]lsTaxEnvHdr dom1"
+
lsTaxEnvHdr
);
sql
=
"select stan_code from site where site_code = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
lsSiteCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
stanCodeFr
=
rs
.
getString
(
"stan_code"
);
}
rs
.
close
();
rs
=
null
;
pstmt
.
close
();
pstmt
=
null
;
sql
=
"select stan_code from customer where cust_code = ?"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
custCode1
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
stanCodeTo
=
rs
.
getString
(
"stan_code"
);
}
rs
.
close
();
rs
=
null
;
pstmt
.
close
();
pstmt
=
null
;
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"stanCodeFr======["
+
stanCodeFr
+
"]"
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"stanCodeTo====== ["
+
stanCodeTo
+
"]"
);
taxChapHdr
=
distCommon
.
getTaxChap
(
itemCode
,
lsItemser
,
"C"
,
custCode1
,
lsSiteCode
,
conn
);
taxClassHdr
=
distCommon
.
getTaxClass
(
"C"
,
custCode1
,
itemCode
,
lsSiteCode
,
conn
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"lsTaxChap from method ["
+
taxChapHdr
+
"]lsTaxClass"
+
taxClassHdr
);
if
(
lsTaxEnvHdr
==
null
||
lsTaxEnvHdr
.
trim
().
length
()
==
0
)
{
sql
=
" select tax_env from site_customer where site_code = ? and cust_code = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
lsSiteCode
);
pstmt
.
setString
(
2
,
custCode1
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
taxEnvHdr
=
rs
.
getString
(
"tax_env"
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
taxEnvHdr
==
null
||
taxEnvHdr
.
trim
().
length
()==
0
)
{
sql
=
" select tax_env from customer where cust_code = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
custCode1
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
taxEnvHdr
=
rs
.
getString
(
"tax_env"
);
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
taxEnvHdr
==
null
||
taxEnvHdr
.
trim
().
length
()==
0
)
{
taxEnvHdr
=
distCommon
.
getTaxEnv
(
stanCodeFr
,
stanCodeTo
,
taxChapHdr
,
taxClassHdr
,
lsSiteCode
,
conn
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"tax ENV From discommon["
+
taxEnvHdr
+
"]"
);
}
}
}
else
{
taxEnvHdr
=
lsTaxEnvHdr
;
}
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"tax class222======["
+
taxClassHdr
+
"]"
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"tax chap222======["
+
taxChapHdr
+
"]"
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"tax env2222 taxChapHdr["
+
taxEnvHdr
+
"]"
);
valueXmlString
.
append
(
"<tax_class>"
).
append
(
"<![CDATA["
+
taxClassHdr
+
"]]>"
).
append
(
"</tax_class>"
);
setNodeValue
(
dom
,
"tax_class"
,
getAbsString
(
taxClassHdr
));
valueXmlString
.
append
(
"<tax_chap>"
).
append
(
"<![CDATA["
+
taxChapHdr
+
"]]>"
).
append
(
"</tax_chap>"
);
setNodeValue
(
dom
,
"tax_chap"
,
getAbsString
(
taxChapHdr
));
valueXmlString
.
append
(
"<tax_env>"
).
append
(
"<![CDATA["
+
taxEnvHdr
+
"]]>"
).
append
(
"</tax_env>"
);
setNodeValue
(
dom
,
"tax_env"
,
getAbsString
(
taxEnvHdr
));
}
else
if
(
currentColumn
.
equalsIgnoreCase
(
"pack_code"
))
{
packCode
=
genericUtility
.
getColumnValue
(
"pack_code"
,
dom
);
if
(
packCode
!=
null
&&
packCode
.
trim
().
length
()
>
0
)
{
sql
=
"select descr from packing where pack_code = ?"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
packCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
packInstr
=
checkNull
(
rs
.
getString
(
"descr"
));
packingDescr
=
checkNull
(
rs
.
getString
(
"descr"
));
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
}
valueXmlString
.
append
(
"<pack_instr>"
).
append
(
"<![CDATA["
+
packInstr
+
"]]>"
).
append
(
"</pack_instr>"
);
valueXmlString
.
append
(
"<packing_descr>"
).
append
(
"<![CDATA["
+
packingDescr
+
"]]>"
).
append
(
"</packing_descr>"
);
}
else
if
(
currentColumn
.
equalsIgnoreCase
(
"rate"
))
{
//Added by Sakshi p on 16/Oct/2025
valueXmlString
=
(
gbfIcRate
(
valueXmlString
,
dom
,
dom1
,
dom2
,
editFlag
,
xtraParams
,
objContext
,
conn
));
}
valueXmlString
.
append
(
"</Detail2>"
);
// Set quot_no and amd_no in third form as protected (uneditable)
quotNo
=
checkNull
(
genericUtility
.
getColumnValue
(
"quot_no"
,
dom1
));
String
amdNo2
=
checkNull
(
genericUtility
.
getColumnValue
(
"amd_no"
,
dom1
));
valueXmlString
.
append
(
"<Detail3>"
);
valueXmlString
.
append
(
"<quot_no protect=\"1\">"
).
append
(
"<![CDATA["
+
quotNo
+
"]]>"
).
append
(
"</quot_no>"
);
valueXmlString
.
append
(
"<amd_no protect=\"1\">"
).
append
(
"<![CDATA["
+
amdNo2
+
"]]>"
).
append
(
"</amd_no>"
);
valueXmlString
.
append
(
"</Detail3>"
);
}
break
;
case
3
:
{
parentNodeList
=
dom
.
getElementsByTagName
(
"Detail3"
);
parentNode
=
parentNodeList
.
item
(
0
);
childNodeList
=
parentNode
.
getChildNodes
();
valueXmlString
.
append
(
"<Detail3>"
);
childNodeListLength
=
childNodeList
.
getLength
();
do
{
childNode
=
childNodeList
.
item
(
ctr
);
childNodeName
=
childNode
.
getNodeName
();
if
(
childNodeName
.
equals
(
currentColumn
))
{
if
(
childNode
.
getFirstChild
()
!=
null
)
{
columnValue
=
childNode
.
getFirstChild
().
getNodeValue
().
trim
();
}
}
ctr
++;
}
while
((
ctr
<
childNodeListLength
)
&&
(!
childNodeName
.
equals
(
currentColumn
)));
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"CURRENT COLUMN CASE 3 ["
+
currentColumn
+
"]"
);
if
(
currentColumn
.
equalsIgnoreCase
(
"itm_defaultedit"
))
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Item Default Edit Form 3+++++"
);
quotNo
=
checkNull
(
genericUtility
.
getColumnValue
(
"quot_no"
,
dom1
));
String
amdNoF3Edit
=
checkNull
(
genericUtility
.
getColumnValue
(
"amd_no"
,
dom1
));
custCode
=
checkNull
(
genericUtility
.
getColumnValue
(
"cust_code"
,
dom1
));
valueXmlString
.
append
(
"<quot_no>"
).
append
(
"<![CDATA["
+
quotNo
+
"]]>"
).
append
(
"</quot_no>"
);
valueXmlString
.
append
(
"<amd_no>"
).
append
(
"<![CDATA["
+
amdNoF3Edit
+
"]]>"
).
append
(
"</amd_no>"
);
valueXmlString
.
append
(
"<cust_code>"
).
append
(
"<![CDATA["
+
custCode
+
"]]>"
).
append
(
"</cust_code>"
);
}
else
if
(
currentColumn
.
equalsIgnoreCase
(
"itm_default"
))
{
quotNo
=
checkNull
(
genericUtility
.
getColumnValue
(
"quot_no"
,
dom1
));
String
amdNo3
=
checkNull
(
genericUtility
.
getColumnValue
(
"amd_no"
,
dom1
));
custCode
=
checkNull
(
genericUtility
.
getColumnValue
(
"cust_code"
,
dom1
));
valueXmlString
.
append
(
"<quot_no>"
).
append
(
"<![CDATA["
+
quotNo
+
"]]>"
).
append
(
"</quot_no>"
);
valueXmlString
.
append
(
"<amd_no>"
).
append
(
"<![CDATA["
+
amdNo3
+
"]]>"
).
append
(
"</amd_no>"
);
valueXmlString
.
append
(
"<cust_code>"
).
append
(
"<![CDATA["
+
custCode
+
"]]>"
).
append
(
"</cust_code>"
);
// Fetch stockist data from original quotation table SALES_QUOT_STOCKIST
if
(
quotNo
!=
null
&&
quotNo
.
trim
().
length
()
>
0
)
{
String
custCodeStk
=
""
;
String
custCodeDist
=
""
;
String
stkName
=
""
;
String
distName
=
""
;
String
custNameMain
=
""
;
detailNodeList
=
dom2
.
getElementsByTagName
(
"Detail3"
);
linecnt
=
detailNodeList
.
getLength
();
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Detail3 linecnt ["
+
linecnt
+
"]"
);
valueXmlString
.
append
(
"<line_no>"
).
append
(
"<![CDATA["
+
linecnt
+
"]]>"
).
append
(
"</line_no>"
);
sql
=
" select cust_code__stk, cust_code__dist from SALES_QUOT_STOCKIST "
+
" where quot_no = ? and line_no = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
quotNo
);
pstmt
.
setInt
(
2
,
linecnt
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
custCodeStk
=
checkNull
(
rs
.
getString
(
"cust_code__stk"
));
custCodeDist
=
checkNull
(
rs
.
getString
(
"cust_code__dist"
));
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
// customer name
if
(
custCode
!=
null
&&
custCode
.
trim
().
length
()
>
0
)
{
sql
=
"select cust_name from customer where cust_code = ?"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
custCode
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
custNameMain
=
checkNull
(
rs
.
getString
(
"cust_name"
));
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
}
// Fetch stockist name
if
(
custCodeStk
.
length
()
>
0
)
{
sql
=
"select cust_name from customer where cust_code = ?"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
custCodeStk
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
stkName
=
checkNull
(
rs
.
getString
(
"cust_name"
));
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
}
// Fetch distributor name
if
(
custCodeDist
.
length
()
>
0
)
{
sql
=
"select cust_name from customer where cust_code = ?"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
custCodeDist
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
distName
=
checkNull
(
rs
.
getString
(
"cust_name"
));
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
}
valueXmlString
.
append
(
"<cust_name>"
).
append
(
"<![CDATA["
+
custNameMain
+
"]]>"
).
append
(
"</cust_name>"
);
valueXmlString
.
append
(
"<cust_code__stk>"
).
append
(
"<![CDATA["
+
custCodeStk
+
"]]>"
).
append
(
"</cust_code__stk>"
);
valueXmlString
.
append
(
"<stockist_name>"
).
append
(
"<![CDATA["
+
stkName
+
"]]>"
).
append
(
"</stockist_name>"
);
valueXmlString
.
append
(
"<cust_code__dist>"
).
append
(
"<![CDATA["
+
custCodeDist
+
"]]>"
).
append
(
"</cust_code__dist>"
);
valueXmlString
.
append
(
"<distibutor_name>"
).
append
(
"<![CDATA["
+
distName
+
"]]>"
).
append
(
"</distibutor_name>"
);
}
}
valueXmlString
.
append
(
"</Detail3>"
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"itemchange final XML string: ["
+
valueXmlString
+
"]"
);
}
break
;
}
//end switch
valueXmlString
.
append
(
"</Root>\r\n"
);
}
//end try
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Exception from itemchanged method --["
+
e
.
getMessage
()+
"]"
);
e
.
printStackTrace
();
throw
new
ITMException
(
e
);
}
finally
{
try
{
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
if
(
conn
!=
null
)
{
conn
.
close
();
conn
=
null
;
}
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Exception from itemchanged finally --["
+
e
.
getMessage
()+
"]"
);
e
.
printStackTrace
();
throw
new
ITMException
(
e
);
}
}
return
valueXmlString
.
toString
();
}
private
Timestamp
checkNull
(
Timestamp
timestamp
)
{
// TODO Auto-generated method stub
return
null
;
}
public
String
checkNull
(
String
inputStr
)
throws
ITMException
{
try
{
if
(
inputStr
!=
null
&&
inputStr
.
trim
().
length
()
>
0
)
{
return
inputStr
.
trim
();
}
else
{
return
""
;
}
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Exception in checknull--["
+
e
.
getMessage
()+
"]"
);
e
.
printStackTrace
();
throw
new
ITMException
(
e
);
}
}
private
static
void
setNodeValue
(
Document
dom
,
String
nodeName
,
String
nodeVal
)
throws
Exception
{
Node
tempNode
=
dom
.
getElementsByTagName
(
nodeName
).
item
(
0
);
if
(
tempNode
!=
null
)
{
if
(
tempNode
.
getFirstChild
()
==
null
)
{
CDATASection
cDataSection
=
dom
.
createCDATASection
(
nodeVal
);
tempNode
.
appendChild
(
cDataSection
);
}
else
{
tempNode
.
getFirstChild
().
setNodeValue
(
nodeVal
);
}
}
tempNode
=
null
;
}
private
static
String
getAbsString
(
String
str
)
{
return
(
str
==
null
||
str
.
trim
().
length
()
==
0
||
"null"
.
equalsIgnoreCase
(
str
.
trim
())
?
""
:
str
.
trim
());
}
private
StringBuffer
gbfIcRate
(
StringBuffer
valueXmlString
,
Document
dom
,
Document
dom1
,
Document
dom2
,
String
editFlag
,
String
xtraParams
,
String
objContext
,
Connection
conn
)
throws
ITMException
{
PreparedStatement
pstmt
=
null
;
ResultSet
rs
=
null
;
double
ldRate
=
0.00
,
mQty
=
0.00
;
try
{
ldRate
=
Double
.
parseDouble
(
checkDouble
(
genericUtility
.
getColumnValue
(
"rate"
,
dom
)));
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"@ Rate is:"
+
ldRate
);
mQty
=
Double
.
parseDouble
(
checkDouble
(
genericUtility
.
getColumnValue
(
"quantity"
,
dom
)));
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"mQty>>>>>"
+
mQty
);
double
netAmount
=
0.0
,
taxamt
=
0.0
;
String
taxAmtStr
=
""
;
taxAmtStr
=
checkNull
(
genericUtility
.
getColumnValue
(
"tax_amt"
,
dom
));
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"taxAmtStr----)["
+
taxAmtStr
+
"]"
);
taxamt
=
(
taxAmtStr
==
null
||
taxAmtStr
.
trim
().
length
()
==
0
)
?
0
:
Double
.
parseDouble
(
taxAmtStr
);
netAmount
=
(
mQty
*
ldRate
);
netAmount
=
finCommon
.
getRequiredDecimal
(
netAmount
,
2
);
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Net Amount(mQty*ldRate)["
+
netAmount
+
"]"
);
valueXmlString
.
append
(
"<net_amt>"
).
append
(
"<![CDATA["
+
netAmount
+
"]]>"
).
append
(
"</net_amt>"
);
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
();
throw
e
;
}
catch
(
ITMException
e
)
{
e
.
printStackTrace
();
throw
e
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
ITMException
(
e
);
}
return
valueXmlString
;
}
public
double
checkNullForDouble
(
String
inputStr
)
throws
ITMException
{
double
retVal
=
0.0
;
try
{
if
(
inputStr
==
null
||
inputStr
.
trim
().
length
()
==
0
)
{
retVal
=
0.0
;
}
else
{
retVal
=
Double
.
parseDouble
(
inputStr
);
}
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Exception in checknull--["
+
e
.
getMessage
()+
"]"
);
e
.
printStackTrace
();
retVal
=
0.0
;
throw
new
ITMException
(
e
);
}
return
retVal
;
}
private
String
checkDouble
(
String
input
)
{
if
(
input
==
null
||
input
.
trim
().
length
()
==
0
)
{
input
=
"0"
;
}
return
input
;
}
private
String
errorType
(
Connection
conn
,
String
errorCode
)
{
String
msgType
=
""
;
PreparedStatement
pstmt
=
null
;
ResultSet
rs
=
null
;
try
{
String
sql
=
"SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ?"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
errorCode
);
rs
=
pstmt
.
executeQuery
();
while
(
rs
.
next
())
{
msgType
=
rs
.
getString
(
"MSG_TYPE"
);
}
rs
.
close
();
rs
=
null
;
pstmt
.
close
();
pstmt
=
null
;
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
finally
{
try
{
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
return
msgType
;
}
private
boolean
isExist
(
Connection
conn
,
String
tableName
,
String
columnName
,
String
value
)
throws
ITMException
,
RemoteException
{
PreparedStatement
pstmt
=
null
;
ResultSet
rs
=
null
;
String
sql
=
""
;
boolean
status
=
false
;
try
{
sql
=
"SELECT count(*) from "
+
tableName
+
" where "
+
columnName
+
" = ? "
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
value
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
if
(
rs
.
getBoolean
(
1
))
{
status
=
true
;
}
}
rs
.
close
();
rs
=
null
;
pstmt
.
close
();
pstmt
=
null
;
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Exception in isExist "
);
e
.
printStackTrace
();
throw
new
ITMException
(
e
);
}
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"returning String from isExist "
);
return
status
;
}
}
\ No newline at end of file
Mohammed/Sales Contract1/SalesContractAMDFromSalesQuotAMD.java
View file @
924dddbb
...
...
@@ -36,30 +36,39 @@ public class SalesContractAMDFromSalesQuotAMD extends ActionHandlerEJB
// Detail1
public
String
generateTransXMLForHeader
(
String
tranID
,
UserInfoBean
userInfo
)
public
String
generateTransXMLForHeader
(
String
tranID
,
String
custCodeStk
,
String
custCodeDist
,
UserInfoBean
userInfo
)
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"generateTransXMLForHeader called. amd_no=["
+
tranID
+
"]"
);
StringBuffer
transXML
=
new
StringBuffer
();
String
quotNo
=
""
;
String
validUpto
=
""
;
String
contractNo
=
""
;
String
fromDate
=
""
;
String
validUpto
=
""
;
String
validUptoO
=
""
;
String
effDate
=
""
;
String
effDateO
=
""
;
try
{
quotNo
=
dbAccessEJB
.
getDBColumnValue
(
"sales_quot_amd"
,
"quot_no"
,
"amd_no = '"
+
tranID
+
"'"
,
userInfo
.
getTransDB
());
BaseLogger
.
log
(
"3"
,
null
,
null
,
"quotNo=["
+
quotNo
+
"]"
);
contractNo
=
dbAccessEJB
.
getDBColumnValue
(
"scontract"
,
"contract_no"
,
"quot_no = '"
+
quotNo
+
"'"
,
userInfo
.
getTransDB
());
BaseLogger
.
log
(
"3"
,
null
,
null
,
"contractNo=["
+
contractNo
+
"]"
);
effDate
=
dbAccessEJB
.
getDBColumnValue
(
"sales_quot_amd"
,
"eff_date"
,
"amd_no = '"
+
tranID
+
"'"
,
userInfo
.
getTransDB
());
BaseLogger
.
log
(
"3"
,
null
,
null
,
"fromDate=["
+
effDate
+
"]"
);
effDateO
=
dbAccessEJB
.
getDBColumnValue
(
"sales_quot_amd"
,
"eff_date_o"
,
"amd_no = '"
+
tranID
+
"'"
,
userInfo
.
getTransDB
());
BaseLogger
.
log
(
"3"
,
null
,
null
,
"fromDate=["
+
effDate
+
"]"
);
validUpto
=
dbAccessEJB
.
getDBColumnValue
(
"sales_quot_amd"
,
"valid_upto"
,
"amd_no = '"
+
tranID
+
"'"
,
userInfo
.
getTransDB
());
BaseLogger
.
log
(
"3"
,
null
,
null
,
"validUpto=["
+
validUpto
+
"]"
);
contractNo
=
dbAccessEJB
.
getDBColumnValue
(
"scontract"
,
"contract_no"
,
"quot_no = '"
+
quotNo
+
"'"
,
userInfo
.
getTransDB
());
BaseLogger
.
log
(
"3"
,
null
,
null
,
"
contractNo=["
+
contractNo
+
"]"
);
validUptoO
=
dbAccessEJB
.
getDBColumnValue
(
"sales_quot_amd"
,
"valid_upto_o"
,
"amd_no = '"
+
tranID
+
"'"
,
userInfo
.
getTransDB
());
BaseLogger
.
log
(
"3"
,
null
,
null
,
"
validUpto=["
+
validUptoO
+
"]"
);
fromDate
=
dbAccessEJB
.
getDBColumnValue
(
"sales_quot_amd"
,
"from_date"
,
"amd_no = '"
+
tranID
+
"'"
,
userInfo
.
getTransDB
());
BaseLogger
.
log
(
"3"
,
null
,
null
,
"fromDate=["
+
fromDate
+
"]"
);
}
catch
(
RemoteException
|
ITMException
e
)
...
...
@@ -72,9 +81,15 @@ public class SalesContractAMDFromSalesQuotAMD extends ActionHandlerEJB
}
// transXML.append("<amd_no><![CDATA[" + tranID + "]]></amd_no>");
transXML
.
append
(
"<valid_upto_o><![CDATA["
+
dateFormatter
(
validUptoO
)
+
"]]></valid_upto_o>"
);
transXML
.
append
(
"<valid_upto><![CDATA["
+
dateFormatter
(
validUpto
)
+
"]]></valid_upto>"
);
transXML
.
append
(
"<eff_from><![CDATA["
+
dateFormatter
(
fromDate
)
+
"]]></eff_from>"
);
transXML
.
append
(
"<eff_from_o><![CDATA["
+
dateFormatter
(
effDateO
)
+
"]]></eff_from_o>"
);
transXML
.
append
(
"<eff_from><![CDATA["
+
dateFormatter
(
effDate
)
+
"]]></eff_from>"
);
transXML
.
append
(
"<contract_no><![CDATA["
+
contractNo
+
"]]></contract_no>"
);
transXML
.
append
(
"<cust_code><![CDATA["
+
custCodeStk
+
"]]></cust_code>"
);
transXML
.
append
(
"<cust_code__dlv><![CDATA["
+
custCodeStk
+
"]]></cust_code__dlv>"
);
transXML
.
append
(
"<cust_code__bil><![CDATA["
+
custCodeStk
+
"]]></cust_code__bil>"
);
System
.
out
.
println
(
"SalesContractAMD transXMLHeader ["
+
transXML
+
"]"
);
...
...
@@ -94,8 +109,11 @@ public class SalesContractAMDFromSalesQuotAMD extends ActionHandlerEJB
String
itemCode
=
""
;
String
quantity
=
""
;
String
quantityO
=
""
;
String
unitRate
=
""
;
String
unitRateO
=
""
;
// String unitRate = "";
// String unitRateO = "";
String
rate
=
""
;
String
rateO
=
""
;
String
lineNoContract
=
""
;
java
.
sql
.
Connection
detailConn
=
null
;
...
...
@@ -112,7 +130,7 @@ public class SalesContractAMDFromSalesQuotAMD extends ActionHandlerEJB
detailConn
=
connDriver
.
getConnectDB
(
userInfo
.
getTransDB
());
pstmt
=
detailConn
.
prepareStatement
(
"SELECT line_no, item_code, quantity, quantity_o,
unit__rate, unit__
rate_o FROM sales_quotdet_amd WHERE quot_no = ? AND amd_no = ?"
);
"SELECT line_no, item_code, quantity, quantity_o,
rate,
rate_o FROM sales_quotdet_amd WHERE quot_no = ? AND amd_no = ?"
);
pstmt
.
setString
(
1
,
quotNo
);
pstmt
.
setString
(
2
,
tranID
);
rs
=
pstmt
.
executeQuery
();
...
...
@@ -123,10 +141,13 @@ public class SalesContractAMDFromSalesQuotAMD extends ActionHandlerEJB
itemCode
=
checkNull
(
rs
.
getString
(
"item_code"
));
quantity
=
checkNull
(
rs
.
getString
(
"quantity"
));
quantityO
=
checkNull
(
rs
.
getString
(
"quantity_o"
));
unitRate
=
checkNull
(
rs
.
getString
(
"unit__rate"
));
unitRateO
=
checkNull
(
rs
.
getString
(
"unit__rate_o"
));
// unitRate = checkNull(rs.getString("unit__rate"));
// unitRateO = checkNull(rs.getString("unit__rate_o"));
rate
=
checkNull
(
rs
.
getString
(
"rate"
));
rateO
=
checkNull
(
rs
.
getString
(
"rate_o"
));
BaseLogger
.
log
(
"3"
,
null
,
null
,
"lineNo=["
+
lineNo
+
"] itemCode=["
+
itemCode
+
"] quantity=["
+
quantity
+
"] quantity=["
+
quantityO
+
"] unit__rate=["
+
unitRate
+
"] unit__rate=["
+
unitRateO
+
"]"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"lineNo=["
+
lineNo
+
"] itemCode=["
+
itemCode
+
"] "
+
"quantity=["
+
quantity
+
"] quantity=["
+
quantityO
+
"] rate=["
+
rate
+
"] rateO=["
+
rateO
+
"]"
);
// lineNoContract = dbAccessEJB.getDBColumnValue("scontractamddet",
// "line_no__contract",
...
...
@@ -141,8 +162,8 @@ public class SalesContractAMDFromSalesQuotAMD extends ActionHandlerEJB
transXML
.
append
(
"<item_code><![CDATA["
+
itemCode
+
"]]></item_code>"
);
transXML
.
append
(
"<quantity><![CDATA["
+
quantity
+
"]]></quantity>"
);
transXML
.
append
(
"<quantity_o><![CDATA["
+
quantityO
+
"]]></quantity_o>"
);
transXML
.
append
(
"<
unit__rate><![CDATA["
+
unitRate
+
"]]></unit__
rate>"
);
transXML
.
append
(
"<
unit__rate_o><![CDATA["
+
unitRate
+
"]]></unit__
rate_o>"
);
transXML
.
append
(
"<
rate><![CDATA["
+
rate
+
"]]></
rate>"
);
transXML
.
append
(
"<
rate_o><![CDATA["
+
rateO
+
"]]></
rate_o>"
);
transXML
.
append
(
"<line_no__contract><![CDATA["
+
lineNo
+
"]]></line_no__contract>"
);
transXML
.
append
(
"</Detail2>"
);
}
...
...
@@ -213,7 +234,7 @@ public class SalesContractAMDFromSalesQuotAMD extends ActionHandlerEJB
processDynXmlString
.
append
(
"</Header0></group0></DocumentRoot>"
);
String
xmlString
=
processDynXmlString
.
toString
();
BaseLogger
.
log
(
"3"
,
null
,
null
,
"
Xml String.. "
+
xmlString
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"
createSCA Xml String.. ["
+
xmlString
+
"]"
);
MasterStatefulLocal
masterStateful
=
(
MasterStatefulLocal
)
initialContext
.
lookup
(
"ibase/MasterStatefulEJB/local"
);
...
...
@@ -250,7 +271,7 @@ public class SalesContractAMDFromSalesQuotAMD extends ActionHandlerEJB
public
String
confirmCreateSalesContractAMD
(
String
tranID
,
String
xtraParams
,
Connection
conn
)
throws
ITMException
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"===
confirmCreateSalesContractAMD
START 10th april ==="
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"===
SalesContractAMDFromSalesQuot
START 10th april ==="
);
String
result
=
""
;
PreparedStatement
pstmt
=
null
;
ResultSet
rs
=
null
;
...
...
@@ -267,7 +288,8 @@ public class SalesContractAMDFromSalesQuotAMD extends ActionHandlerEJB
ibase
.
ejb
.
CommonDBAccessEJB
commonDBAccessEJB
=
new
ibase
.
ejb
.
CommonDBAccessEJB
();
UserInfoBean
userInfo
=
commonDBAccessEJB
.
createUserInfo
(
userCode
);
String
sql
=
"SELECT LINE_NO FROM sales_quot_stockist_amd WHERE amd_NO=? ORDER BY LINE_NO"
;
String
sql
=
"SELECT LINE_NO, CUST_CODE__STK, CUST_CODE__DIST "
+
"FROM sales_quot_stockist_amd WHERE amd_NO=? ORDER BY LINE_NO"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
tranID
);
...
...
@@ -278,13 +300,25 @@ public class SalesContractAMDFromSalesQuotAMD extends ActionHandlerEJB
while
(
rs
.
next
())
// Loop
{
String
lineNo
=
E12GenericUtility
.
checkNull
(
rs
.
getString
(
"LINE_NO"
));
String
custCodeStk
=
E12GenericUtility
.
checkNull
(
rs
.
getString
(
"CUST_CODE__STK"
));
String
custCodeDist
=
E12GenericUtility
.
checkNull
(
rs
.
getString
(
"CUST_CODE__DIST"
));
BaseLogger
.
log
(
"3"
,
null
,
null
,
"confirmCreateSalesContractAMD called. amd_no=["
+
tranID
+
"]"
);
if
(
custCodeStk
.
trim
().
length
()
==
0
||
custCodeDist
.
trim
().
length
()
==
0
)
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Skipping LINE_NO="
+
lineNo
+
" بسبب empty cust_code__stk or cust_code__dist"
);
continue
;
}
String
transXMLHeader
=
generateTransXMLForHeader
(
tranID
,
userInfo
);
String
transXMLHeader
=
generateTransXMLForHeader
(
tranID
,
custCodeStk
,
custCodeDist
,
userInfo
);
String
transXMLDetail
=
generateTransXMLForDetail
(
tranID
,
userInfo
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"DEBUG: Iter="
+
iteration
+
" | tranID="
+
tranID
+
" | lineNo="
+
lineNo
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"AMD Iter="
+
iteration
+
" LINE_NO="
+
lineNo
+
" STK="
+
custCodeStk
+
" DIST="
+
custCodeDist
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"\n\n===\n"
+
"ITERATION: "
+
iteration
+
"\n"
+
"DETAIL1 \n"
+
"===\n"
+
transXMLHeader
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"\n\n===\n"
+
"ITERATION: "
+
iteration
+
"\n"
+
"DETAIL2 \n"
+
"===\n"
+
transXMLDetail
);
...
...
@@ -302,7 +336,7 @@ public class SalesContractAMDFromSalesQuotAMD extends ActionHandlerEJB
try
{
if
(
rs
!=
null
)
rs
.
close
();
}
catch
(
Exception
e
){}
try
{
if
(
pstmt
!=
null
)
pstmt
.
close
();
}
catch
(
Exception
e
){}
}
BaseLogger
.
log
(
"3"
,
null
,
null
,
"===
confirmCreateSalesContractAMD
END ==="
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"===
SalesContractAMDFromSalesQuot
END ==="
);
return
result
;
}
...
...
@@ -324,4 +358,4 @@ public class SalesContractAMDFromSalesQuotAMD extends ActionHandlerEJB
return
inputDate
;
}
}
}
\ No newline at end of file
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment