Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

146 lines (120 sloc) 4.865 kb
1) Todays Loan Officers and Centers-:
<LoanOfficers>
{
for $loanOfficer in //CollectionSheet[date='2011-02-23']/LoanOfficers/LoanOfficer
order by $loanOfficer
return <LoanOfficer>
<name>{$loanOfficer/name/text()}</name>
<personnelId>{$loanOfficer/personnelId/text()}</personnelId>
<Centers>
{
for $center in $loanOfficer/Centers/Center
where empty($center/status/node())
return
<Center>
<name>{$center/name/text()}</name>
<centerId>{$center/centerId/text()}</centerId>
</Center>
}
</Centers>
</LoanOfficer>
}
</LoanOfficers>
2) Unsynched Dates loan officers and centers-:
<CollectionSheets>
{
for $collectionSheet in (//CollectionSheet[date < '2011-03-23'])
order by $collectionSheet/date
return
<CollectionSheet date="{$collectionSheet/date}">
<LoanOfficers>
{
for $todayLoanOfficers in distinct-values($collectionSheet/LoanOfficers/LoanOfficer/name)
let $loanOfficer := $collectionSheet/LoanOfficers/LoanOfficer[name/text() = $todayLoanOfficers]
order by $loanOfficer
return <LoanOfficer>
<name>{$todayLoanOfficers}</name>
<personnelId>{$loanOfficer/personnelId/text()}</personnelId>
<Centers>
{
for $center in $loanOfficer/Centers/Center
return
if(empty($center/status/node()))
then
<Center>
<name>{$center/name/text()}</name>
<centerId>{$center/centerId/text()}</centerId>
</Center>
else
null
}
</Centers>
</LoanOfficer>
}
</LoanOfficers>
</CollectionSheet>
}
</CollectionSheets>
3)Synched dates loan officers and centers
<CollectionSheets>
{
for $collectionSheet in (//CollectionSheet[date < '2011-03-23'])
order by $collectionSheet/date
return
<CollectionSheet date="{$collectionSheet/date}">
<LoanOfficers>
{
for $todayLoanOfficers in distinct-values($collectionSheet/LoanOfficers/LoanOfficer/name)
let $loanOfficer := $collectionSheet/LoanOfficers/LoanOfficer[name/text() = $todayLoanOfficers]
order by $loanOfficer
return <LoanOfficer>
<name>{$todayLoanOfficers}</name>
<personnelId>{$loanOfficer/personnelId/text()}</personnelId>
<Centers>
{
for $center in $loanOfficer/Centers/Center
return
if($center/status/text()="synched")
then
<Center>
<name>{$center/name/text()}</name>
<syncedDate>{$center/synchedDate/text()}</synchedDate>
<centerId>{$center/centerId/text()}</centerId>
<interestDemand>{sum($center/Groups/Group/Members/Member/LoanAccounts/LoanAccount/interestDemand)}</interestDemand>
<principalDemand>{sum($center/Groups/Group/Members/Member/LoanAccounts/LoanAccount/principalDemand)}</principalDemand>
<collectedAmount>{sum($center/Groups/Group/Members/Member/LoanAccounts/LoanAccount/amountRepaid)}</collectedAmount>
<miscCollections>{sum($center/Groups/Group/Members/Member/LoanAccounts/LoanAccount/miscCollection)}</miscCollections>
</Center>
else
null
}
</Centers>
</LoanOfficer>
}
</LoanOfficers>
</CollectionSheet>
}
</CollectionSheets>
4) Delete synced centers
for $center in //CollectionSheets/CollectionSheet/LoanOfficers/LoanOfficer/Centers/Center
where $center/centerId =" + "'" + settings.centerid + "'" + "and $center/../../../../date='2011-02-23+05:30'
return (
delete node $center
)
5) Check if collection sheet for a given date exists (XPATH)
boolean(//CollectionSheet[date="2011-03-18"])
6) Check if record for a feild executive with selected personnel Id for a given day exists
boolean(//CollectionSheet[date="2011-03-18"]/LoanOfficers/LoanOfficer[personnelId=1])
7) Update modified center xml
for $center in //CollectionSheets/CollectionSheet/LoanOfficers/LoanOfficer/Centers/Center where $center/centerId ='3'
and $center/../../../../date='2010-03-11'
return ( delete node $center,
insert node "centerXML" as first into $center/..);
8) Add a new CollectionSheet (for a particular day)
for $collectionSheets in //CollectionSheets
return (insert node <CollectionSheet><date>2011-03-18</date><branchName>Gulbarga</branchName><LoanOfficers><LoanOfficer><name>Sathish K</name><personnelId>1</personnelId></LoanOfficer></LoanOfficers></CollectionSheet>
as first into $collectionSheets)
9) Add a new Loan Officer for a Collection Sheet
for $loanOfficers in //CollectionSheet[date="2011-03-18"]/LoanOfficers
return (insert node <LoanOfficer><name>VishwasBabu</name><personnelId>2</personnelId></LoanOfficer>
as first into $loanOfficers)
Jump to Line
Something went wrong with that request. Please try again.