Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
Quotation Amendment
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
1
Merge Requests
1
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
khushal samadhan chavan
Quotation Amendment
Commits
96e91626
Commit
96e91626
authored
Jun 26, 2025
by
khushal samadhan chavan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
cd34272c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
168 additions
and
0 deletions
+168
-0
Quotation Amendment/CostDetails.java
Quotation Amendment/CostDetails.java
+168
-0
No files found.
Quotation Amendment/CostDetails.java
0 → 100644
View file @
96e91626
package
ibase
.
webitm
.
ejb
.
vhb
.
msq1
;
import
java.sql.*
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.Date
;
import
ibase.utility.*
;
import
ibase.webitm.ejb.ValidatorEJB
;
import
ibase.webitm.utility.ITMException
;
public
class
CostDetails
extends
ValidatorEJB
{
private
String
usersiteCode
=
""
;
private
E12GenericUtility
genericUtility
=
new
E12GenericUtility
();
public
CostDetails
(
UserInfoBean
userInfoBean
)
{
setUserInfo
(
userInfoBean
);
userInfoBean
=
getUserInfo
();
this
.
usersiteCode
=
userInfoBean
.
getSiteCode
();
}
public
Map
<
String
,
List
<
List
<
String
>>>
getItemDetails
(
String
itemCode
)
throws
Exception
{
Map
<
String
,
List
<
List
<
String
>>>
combinedMap
=
new
HashMap
<>();
combinedMap
.
put
(
"cost"
,
getCostDetails
(
itemCode
));
combinedMap
.
put
(
"price"
,
getPriceListDetails
(
itemCode
));
return
combinedMap
;
}
private
List
<
List
<
String
>>
getCostDetails
(
String
itemCode
)
throws
Exception
{
Connection
conn
=
null
;
PreparedStatement
pstmt
=
null
;
ResultSet
rs
=
null
;
String
sql
=
""
,
item
=
""
,
rmCost
=
""
,
pmCost
=
""
,
otherCosts
=
""
,
effFrom
=
""
,
validUpto
=
""
,
costPerUnit
=
""
;
List
<
List
<
String
>>
costList
=
new
ArrayList
<>();
try
{
conn
=
getConnection
();
sql
=
"SELECT item_code, rm_cost, pm_cost, other_costs, effective_from_date, valid_upto_date, cost_per_unit FROM costing_mst WHERE item_code = ? ORDER BY effective_from_date DESC"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
itemCode
.
trim
());
rs
=
pstmt
.
executeQuery
();
while
(
rs
.
next
())
{
item
=
checkNull
(
rs
.
getString
(
"item_code"
));
rmCost
=
checkNull
(
rs
.
getString
(
"rm_cost"
));
pmCost
=
checkNull
(
rs
.
getString
(
"pm_cost"
));
otherCosts
=
checkNull
(
rs
.
getString
(
"other_costs"
));
effFrom
=
checkNull
(
rs
.
getString
(
"effective_from_date"
));
validUpto
=
checkNull
(
rs
.
getString
(
"valid_upto_date"
));
costPerUnit
=
checkNull
(
rs
.
getString
(
"cost_per_unit"
));
// Formatting dates for better display
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
genericUtility
.
getDBDateFormat
());
Date
effFromDate
=
simpleDateFormat
.
parse
(
effFrom
);
Date
validUptoDate
=
simpleDateFormat
.
parse
(
validUpto
);
SimpleDateFormat
displayFormat
=
new
SimpleDateFormat
(
"dd/MM/yy"
);
String
formattedEffFrom
=
displayFormat
.
format
(
effFromDate
);
String
formattedValidUpto
=
displayFormat
.
format
(
validUptoDate
);
List
<
String
>
row
=
new
ArrayList
<>();
row
.
add
(
item
);
row
.
add
(
rmCost
);
row
.
add
(
pmCost
);
row
.
add
(
otherCosts
);
row
.
add
(
formattedEffFrom
);
row
.
add
(
formattedValidUpto
);
row
.
add
(
costPerUnit
);
costList
.
add
(
row
);
}
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Exception in getCostDetails: "
+
e
.
getMessage
());
throw
new
ITMException
(
e
);
}
finally
{
// Closing resources
if
(
rs
!=
null
)
{
rs
.
close
();
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
}
if
(
conn
!=
null
)
{
conn
.
close
();
}
}
return
costList
;
}
private
List
<
List
<
String
>>
getPriceListDetails
(
String
itemCode
)
throws
Exception
{
Connection
conn
=
null
;
PreparedStatement
pstmt
=
null
;
ResultSet
rs
=
null
;
String
sql
=
""
,
item
=
""
,
rate
=
""
,
currCode
=
""
,
effFrom
=
""
,
validUpto
=
""
,
prvNrv
=
""
;
List
<
List
<
String
>>
priceList
=
new
ArrayList
<>();
try
{
conn
=
getConnection
();
sql
=
"SELECT item_code, rate, eff_from, valid_upto, curr_code, previous_nrv FROM pricelisttt WHERE item_code = ? ORDER BY eff_from DESC"
;
pstmt
=
conn
.
prepareStatement
(
sql
);
pstmt
.
setString
(
1
,
itemCode
.
trim
());
rs
=
pstmt
.
executeQuery
();
while
(
rs
.
next
())
{
item
=
checkNull
(
rs
.
getString
(
"item_code"
));
rate
=
checkNull
(
rs
.
getString
(
"rate"
));
effFrom
=
checkNull
(
rs
.
getString
(
"eff_from"
));
validUpto
=
checkNull
(
rs
.
getString
(
"valid_upto"
));
currCode
=
checkNull
(
rs
.
getString
(
"curr_code"
));
prvNrv
=
checkNull
(
rs
.
getString
(
"previous_nrv"
));
// Formatting dates for better display
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
genericUtility
.
getDBDateFormat
());
Date
effFromDate
=
simpleDateFormat
.
parse
(
effFrom
);
Date
validUptoDate
=
simpleDateFormat
.
parse
(
validUpto
);
SimpleDateFormat
displayFormat
=
new
SimpleDateFormat
(
"dd/MM/yy"
);
String
formattedEffFrom
=
displayFormat
.
format
(
effFromDate
);
String
formattedValidUpto
=
displayFormat
.
format
(
validUptoDate
);
List
<
String
>
row
=
new
ArrayList
<>();
row
.
add
(
item
);
row
.
add
(
rate
);
row
.
add
(
formattedEffFrom
);
row
.
add
(
formattedValidUpto
);
row
.
add
(
currCode
);
row
.
add
(
prvNrv
);
priceList
.
add
(
row
);
}
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
getUserInfo
(),
null
,
"Exception in getPriceListDetails: "
+
e
.
getMessage
());
throw
new
ITMException
(
e
);
}
finally
{
// Closing resources
if
(
rs
!=
null
)
{
rs
.
close
();
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
}
if
(
conn
!=
null
)
{
conn
.
close
();
}
}
return
priceList
;
}
private
String
checkNull
(
String
str
)
{
return
(
str
==
null
)
?
""
:
str
;
}
}
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