Beispiel #1
0
        public FeeDeviationView ConvertFeeDeviation(BCFeeDeviation input)
        {
            FeeDeviationView output = new FeeDeviationView();
            output.Amount = input.Amount;
            output.Description = input.Description;
            output.EndDate = input.EndDate.ToString("dd MMM yyyy");
            output.Id = input.Id;
            output.IsAddition = input.isAddition;
            output.Name = input.Name;
            output.StartDate = input.StartDate.ToString("dd MMM yyyy");

            return output;
        }
 public virtual BCFeeDeviation GetAssociatedFeeDeviation()
 {
     BCFeeDeviation result = new BCFeeDeviation();
     result.Id = IdFeeDeviation;
     result.LoadData();
     return result;
 }
    protected void grdPaymentHistory_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        //0         1           2           3               4
        //ID        Term        Date        Recepit No.     Payment Mode
        //5             6           7
        //Amount        Credit      Remark
        if (e.Row.RowType == DataControlRowType.Header)
        {
            amtT = 0;
            creditT = 0;
            transitionRow = null;
            prevIdTC = -1;
            partitionSize = 0;
        }
        else if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //PaymentId
            int pId = Convert.ToInt32(
                e.Row.Cells[0].Text
                );

            //Date, Term
            DateTime tempDate = Convert.ToDateTime(e.Row.Cells[2].Text);
            wsvTermCalendar.TermCalendar dbTC = new wsvTermCalendar.TermCalendar();
            wsvTermCalendar.CTerm objT =
                dbTC.GetTermOf(tempDate);

            e.Row.Cells[2].Text = tempDate.ToString("dd MMM yyyy"); //date
            //term
            if (objT == null)
            {
                e.Row.Cells[1].Text = "Nil";
            }
            else
            {
                BCTerm objBCT = new BCTerm();
                objBCT.TransferFromWsv(objT);
                e.Row.Cells[1].Text = objBCT.ToString();
            }

            //do rowspan of Term column
            int curIdTC = (objT == null) ? -1 : objT.Id;
            if (transitionRow == null)
            {
                //first row
                transitionRow = e.Row;
                partitionSize = 1;
                prevIdTC = curIdTC;
            }
            else
            {
                if (prevIdTC == curIdTC)
                {
                    partitionSize++;
                    e.Row.Cells[1].Visible = false;
                    transitionRow.Cells[1].RowSpan = partitionSize;

                }
                else
                {
                    //"close" previous transition row
                    transitionRow.Cells[0].RowSpan = partitionSize;

                    transitionRow = e.Row;
                    partitionSize = 1;
                    prevIdTC = curIdTC;
                }
            }

            //Recepit No
            BCPayment objBCPayment = new BCPayment();
            objBCPayment.Id = pId;
            e.Row.Cells[3].Text = objBCPayment.GetReceiptNumber();

            //Amount
            amtT += Convert.ToDouble(e.Row.Cells[5].Text);
            e.Row.Cells[5].Text = "$" + e.Row.Cells[5].Text;

            //credit
            creditT += Convert.ToInt32(e.Row.Cells[6].Text);

            //Remark. Display fee deviations
            string temp = "";
            BCFeeDeviation oFD = new BCFeeDeviation();
            BCFeeDeviation[] aryFD = oFD.getFeeDeviationByPayment(pId);
            if (aryFD != null)
            {
                temp = "Includes:";
                foreach (BCFeeDeviation objFD in aryFD)
                {
                    objFD.LoadData();
                    temp += "<br>"+ objFD.Description + "<br>";
                    if (objFD.isAddition)
                    {
                        temp += "(+$" + objFD.Amount +")";
                    }
                    else
                    {
                        temp += "(-$" + objFD.Amount+")";
                    }
                }
            }

            e.Row.Cells[7].Text = temp;

        }
        else if (e.Row.RowType == DataControlRowType.Footer)
        {
            e.Row.Cells[5].Text = "$" + amtT;
            e.Row.Cells[6].Text = Convert.ToString(creditT);
        }
    }