protected void ModData(List <ReportSaleMonthDTO> lst, List <MasValueList> lstVal) { try { MasValueList o = new MasValueList(); string bill = "", pay = ""; int OldHeader = 0, CurrHeader = 0; int i = 0; double Summary = 0; foreach (ReportSaleMonthDTO item in lst) { bill = !string.IsNullOrEmpty(item.BillTypeID) ? item.BillTypeID : ""; pay = !string.IsNullOrEmpty(item.PayTypeID) ? item.PayTypeID : ""; item.BillType = bill.Equals("Vat") ? "Vat" : "Cash"; o = lstVal.FirstOrDefault(w => w.CODE.Equals(pay)); if (o != null) { item.PayType = o.DESCRIPTION; } CurrHeader = item.HeaderID; //if (!string.IsNullOrEmpty(item.Tel)) // item.CustomerName = item.CustomerName + "(" + item.Tel + ")"; if (i > 0 && CurrHeader == OldHeader) { item.CustomerName = ""; item.ReceivedDate = null; item.SaleNumber = ""; item.Tel = ""; item.VisImgBtn = "false"; } OldHeader = CurrHeader; Summary = Summary + item.Total; i++; } lbSummary.Text = Summary.ToString("###,##0.00"); } catch (Exception ex) { } }
protected List <ReportSummarySaleMonthDTO> ModData(List <ReportSaleMonthDTO> lstSource, List <MasValueList> lstVal) { List <ReportSummarySaleMonthDTO> lstResult = new List <ReportSummarySaleMonthDTO>(); try { ReportSummarySaleMonthDTO oRPT = new ReportSummarySaleMonthDTO(); MasValueList o = new MasValueList(); int OldHeader = 0, CurrHeader = 0; int i = 0; string bill = "", pay = ""; double Summary = 0; foreach (ReportSaleMonthDTO itemSource in lstSource) { bill = !string.IsNullOrEmpty(itemSource.BillTypeID) ? itemSource.BillTypeID : ""; pay = !string.IsNullOrEmpty(itemSource.PayTypeID) ? itemSource.PayTypeID : ""; itemSource.BillType = bill.Equals("Vat") ? "Vat" : "Cash"; o = lstVal.FirstOrDefault(w => w.CODE.Equals(pay)); if (o != null) { itemSource.PayType = o.DESCRIPTION; } Summary = Summary + itemSource.Total; } lbSummary.Text = Summary.ToString("###,##0.00"); foreach (ReportSaleMonthDTO itemSource in lstSource) { CurrHeader = itemSource.HeaderID; if (i > 0 && CurrHeader == OldHeader) { oRPT = lstResult.FirstOrDefault(w => w.HeaderID.Equals(CurrHeader)); if (oRPT != null) { oRPT.Total = oRPT.Total + itemSource.Total; oRPT.TotalPrice = oRPT.TotalPrice + itemSource.TotalPrice; oRPT.TotalExVat = oRPT.TotalExVat + itemSource.TotalExVat; oRPT.VATAmount = oRPT.VATAmount + itemSource.VATAmount; } } else { oRPT = new ReportSummarySaleMonthDTO(); oRPT.HeaderID = itemSource.HeaderID; oRPT.SaleNumber = itemSource.SaleNumber; oRPT.SaleName = itemSource.SaleName; oRPT.ReceivedDate = itemSource.ReceivedDate; oRPT.CustomerName = itemSource.CustomerName; oRPT.Total = itemSource.Total; oRPT.TotalPrice = itemSource.TotalPrice; oRPT.TotalExVat = itemSource.TotalExVat; oRPT.VATAmount = itemSource.VATAmount; oRPT.BillType = itemSource.BillType; oRPT.PayType = itemSource.PayType; oRPT.AccountTransfer = itemSource.AccountTransfer; oRPT.Installment = itemSource.Installment; oRPT.ConsignmentNo = itemSource.ConsignmentNo; oRPT.Remark = itemSource.Remark; lstResult.Add(oRPT); } OldHeader = CurrHeader; i++; } } catch (Exception ex) { } return(lstResult); }