using System.Text;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using System;

namespace BeWo.BeWoDirekt
{
    public partial class InvoiceCustomerReport : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<InvoiceCustomerRO>
    {
        public InvoiceCustomerReport()
        {
            InitializeComponent();
        }

        public void SetReportDataSource(InvoiceCustomerRO pRO)
        {
			StringBuilder sb = new StringBuilder();
	        if (pRO.InvoiceItems.Count > 0)
	        {
		        foreach (var ii in pRO.InvoiceItems)
		        {
			        if (sb.Length > 0)
				        sb.Append("\n");
			        sb.Append(String.Format("{0:0.##} * {1} = {2}", ii.UnitCount, ii.UnitPrice, ii.AmountSum));
		        }
	        }
	        pRO.Notice = sb.ToString();

            this.bindingSource1.DataSource = pRO;
        }
    }
}
