public frmPaymentDetails(Transaction assessment, frmAssessment mainWindow) { InitializeComponent(); this.assessment = assessment; this.schedule = assessment.Schedule; this.mainWindow = mainWindow; }
public Schedule GetAssessmentSchedule(string assessmentNo, Transaction_Type sopType) { Schedule sked = new Schedule(); try { using (SqlConnection conn = new SqlConnection(connString)) using (SqlCommand comm = new SqlCommand("usp_GetAssessmentScheduleByDocID", conn)) { comm.CommandType = CommandType.StoredProcedure; comm.Parameters.Clear(); comm.Parameters.Add(new SqlParameter("@AssessmentNo", assessmentNo)); comm.Parameters.Add(new SqlParameter("@SOPType", (int)sopType)); conn.Open(); using (SqlDataReader dr = comm.ExecuteReader()) { while (dr.Read()) { Due due = new Due(); due.Date = Convert.ToDateTime(dr["Due Date"]); due.Amount = Convert.ToDecimal(dr["Amount"]); sked.Add(due); } } } } catch (Exception ex) { sked = null; log.Error(ex); throw; } return sked; }
/// <summary> /// Recompute totals/installment fee first before calculating payment schedule. /// </summary> public void RecalculatePaymentSchedules() { Schedule sked = new Schedule(); decimal netAmount = this.subtotal - this.totalDiscounts; decimal totalComputed = 0.00M; Due due; DateTime instalmentDate = documentDate; if (plan.Breakdown != null) { for (int i = 0; i <= plan.NoOfPayments - 2; i++) { due = new Due(); due = plan.Breakdown.GetDue(i); //Original //due.Amount = netAmount * (due.Percent / 100); //Edited - 5/4/12 due.Amount = (netAmount + installmentFee) * (due.Percent / 100); totalComputed += due.Amount; sked.Add(due); } due = new Due(); due = plan.Breakdown.GetDue(plan.Breakdown.Count - 1); //Original //due.Amount = netAmount - totalComputed; //Edited - 5/4/12 due.Amount = (netAmount + installmentFee) - totalComputed; sked.Add(due); } else { for (int i = 0; i <= plan.NoOfPayments - 2; i++) { due = new Due(); if (i == 0) { instalmentDate = instalmentDate.AddDays(plan.DaysFromFirstPayment); } due.Date = instalmentDate; //Original //due.Amount = netAmount / plan.NoOfPayments; //Edited - 5/4/12 due.Amount = (netAmount + installmentFee) / plan.NoOfPayments; totalComputed += due.Amount; sked.Add(due); instalmentDate = instalmentDate.AddDays(plan.Cadence); } due = new Due(); due.Date = instalmentDate; //Original //due.Amount = netAmount - totalComputed; //Edited - 5/4/12 due.Amount = (netAmount + installmentFee) - totalComputed; if (plan.NoOfPayments == 1) { due.Date = instalmentDate.AddDays(plan.DaysFromFirstPayment); } sked.Add(due); } //add installment fee to the first payment //Original //sked.GetDue(0).Amount += this.installmentFee; //Edited - 5/4/12 this.schedule = sked; }
public frmViewPaymentDetails(Transaction transaction) { InitializeComponent(); this.assessment = transaction; this.schedule = assessment.Schedule; }
public Schedule GetPlanSchedule(string planID) { Schedule sked = null; try { using (SqlConnection conn = new SqlConnection(connString)) using (SqlCommand comm = new SqlCommand("usp_GetPlanBreakdown", conn)) { comm.CommandType = CommandType.StoredProcedure; comm.Parameters.Clear(); comm.Parameters.Add(new SqlParameter("@Plan_ID", planID)); conn.Open(); using (SqlDataReader dr = comm.ExecuteReader()) { if (dr.HasRows) { sked = new Schedule(); } while (dr.Read()) { Due d = new Due(); d.Date = Convert.ToDateTime(dr["Due Date"]); d.Percent = Convert.ToDecimal(dr["Percentage"]); sked.Add(d); } } } } catch (Exception ex) { log.Error(ex); throw; } return sked; }
public void UpdatePaymentSchedule(Schedule sked) { transaction.Schedule = sked; cboPlan.Enabled = true; }