def make_interests(self, cancel=0):
     make_posting_date = compose(
         partial(min, getdate(self.posting_date)),
         getdate,
         partial(add_days, days=1),
         pick("end_date"),
     )
     return compose(
         list,
         partial(
             map,
             partial(
                 _create_or_update_interest,
                 update=cancel,
                 submit=self.loan_type == "EMI",
             ),
         ),
         partial(
             map,
             compose(
                 update({"loan": self.loan}),
                 lambda x: {
                     "posting_date": make_posting_date(x),
                     "period": x.period_label,
                     "start_date": x.start_date,
                     "end_date": x.end_date,
                     "billed_amount": x.billed_amount,
                     "paid_amount": x.allocated_amount,
                 },
             ),
         ),
     )(self.periods)
Example #2
0
 def make_interests(self, cancel=0):
     make_posting_date = compose(
         partial(min, getdate(self.posting_date)),
         getdate,
         partial(add_days, days=1),
         pick('end_date'),
     )
     return compose(
         partial(
             map,
             partial(_create_or_update_interest, update=cancel),
         ),
         partial(
             map,
             compose(
                 update({
                     'loan': self.loan,
                 }), lambda x: {
                     'posting_date': make_posting_date(x),
                     'period': x.period_label,
                     'start_date': x.start_date,
                     'end_date': x.end_date,
                     'billed_amount': x.billed_amount,
                     'paid_amount': x.allocated_amount,
                 }),
         ),
     )(self.periods)
Example #3
0
def _make_list_item(row):
    fine_wrote_off = get_fine_write_off(
        row.name) > 0 if row.fine_amount else False
    return update({
        "outstanding_amount":
        max(row.billed_amount - row.paid_amount, 0),
        "fine_wrote_off":
        fine_wrote_off,
    })(row)
Example #4
0
 def change_status(row):
     start_date = row.get('start_date')
     status = 'Clear' \
         if is_not_sys_mgr \
         and getdate(effective_date) > getdate(start_date) \
         else row.get('status')
     return update({
         'status': status,
     })(row)
Example #5
0
 def change_status(row):
     start_date = row.get("start_date")
     status = ("Clear" if is_not_sys_mgr
               and getdate(effective_date) > getdate(start_date) else
               row.get("status"))
     return update({"status": status})(row)