def createcusdebit(vUser, vLoan_date, vAmount, vRate,vCycle,vLoan_type,vNote): try: vtoday = date.today() cd = CusDebit() cd.cus_id = vUser cd.month = vLoan_date cd.debit = vAmount cd.total_debit = vAmount cd.payment = 0.00 cd.create_date = vtoday cd.loan_date = vLoan_date cd.loan_type = vLoan_type cd.rate = vRate cd.cycle = vCycle cd.status = 1 cd.note =vNote cd.save() createcusdebitdetail(vUser,cd,vLoan_date,vAmount,vRate) except Exception as ex: print("createcusdebit: "+ex)