private void DisbursalProcess(ref LoanContractScheduleDS ds, BNEWNORMALLOAN normalLoanEntryM, ref DateTime? disbursalDate)
        {
            LoanDisbursalScheduleRespository facade = new LoanDisbursalScheduleRespository();
            var disbursalIts = facade.FindLoanDisbursalByCode(normalLoanEntryM.Code);
            DateTime? disbursalDrawdawnDate;
            if (disbursalIts != null)
            {
                foreach (B_LOAN_DISBURSAL_SCHEDULE dis in disbursalIts)
                {
                    disbursalDrawdawnDate = dis.DrawdownDate == null ? dis.DisbursalDate : dis.DrawdownDate;

                    if (disbursalDrawdawnDate == null)
                    {
                        continue;
                    }
                    DataRow dr = findInstallmantRow((DateTime)disbursalDrawdawnDate, ds);
                    if (dr == null)
                    {
                        dr = ds.DtItems.NewRow();
                        dr[ds.Cl_dueDate] = disbursalDrawdawnDate;
                        dr[ds.Cl_isInterestedRow] = false;
                        dr[ds.Cl_isPeriodicAutomaticRow] = false;
                        dr[ds.Cl_isPaymentRow] = false;
                        dr[ds.Cl_principle] = 0;
                        dr[ds.Cl_PrintOs] = 0;
                        ds.DtItems.Rows.Add(dr);
                    }

                    dr[ds.Cl_DisbursalAmount] = dis.DisbursalAmount;
                    dr[ds.Cl_isDisbursalRow] = true;

                }
            }

            ds.DtItems.DefaultView.Sort = "DueDate asc";
            ds.DtItems = ds.DtItems.DefaultView.ToTable();
            decimal currentProcessAmount = 0;

            if (ds.DtItems != null && ds.DtItems.Rows.Count > 0)
            {
                disbursalDate = (DateTime)ds.DtItems.Rows[0][ds.Cl_dueDate.ColumnName];
            }

            foreach (DataRow dr in ds.DtItems.Rows)
            {
                if ((decimal)dr[ds.Cl_PrintOs.ColumnName] != 0)
                {
                    currentProcessAmount = (decimal)dr[ds.Cl_PrintOs.ColumnName];
                }
                else
                {
                    dr[ds.Cl_PrintOs.ColumnName] = currentProcessAmount;
                }

            }

            //Process update disbursal amount to prinos
            currentProcessAmount = 0;
            foreach (DataRow dr in ds.DtItems.Rows)
            {
                if (normalLoanEntryM.RepaymentTimes > 0)
                {
                    currentProcessAmount = getCurrentLoanAmount(normalLoanEntryM, normalLoanEntryM.RepaymentTimes);
                }
                else
                {
                    currentProcessAmount = currentProcessAmount + (decimal)dr[ds.Cl_DisbursalAmount.ColumnName];
                }
                dr[ds.Cl_PrintOs.ColumnName] = (decimal)dr[ds.Cl_PrintOs.ColumnName] + currentProcessAmount;
            }
        }
 private void LoadDataTolvLoanDisbursalSchedule()
 {
     CalcRemainDisbursalLoanAmount();
     LoanDisbursalScheduleRespository facade = new LoanDisbursalScheduleRespository();
     var db = facade.FindLoanDisbursalByCode(tbNewNormalLoan.Text);
 }