Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 146 lines (120 sloc) 4.865 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
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)





Something went wrong with that request. Please try again.