//info RelatedTimesheets;
totalHours = 0.0;
totalPay = 0.0;
totalBonus = 0.0;
totalReward = 0.0;
for each ele in RelatedTimesheets
{
tsHours = ifnull(ele.get("Approved_Hours"),"0.0").toDecimal();
totalHours = totalHours + tsHours;
tsPay = ifnull(ele.get("Pay"),"0.0").toDecimal();
totalPay = totalPay + tsPay;
tsBonus = ifnull(ele.get("Bonus"),"0.0").toDecimal();
totalBonus = totalBonus + tsBonus;
tsReward = ifnull(ele.get("Reward"),"0.0").toDecimal();
totalReward = totalReward + tsReward;
}
mp = Map();
mp.put("Total_Hours",totalHours);
mp.put("Total_Pay",totalPay);
mp.put("Total_Bonuses",totalBonus);
mp.put("Total_Rewards",totalReward);
update = zoho.crm.updateRecord("Pay_Periods",payperiodId.toLong(),mp);
info mp;
info update;