private string PrintReport(List<DatewiseTotal> datewiseTotals) { string strBody = ""; StringPrintFormater stringPrintFormater = new StringPrintFormater(172); ViewReport aReport = new ViewReport(); string header = aReport.GetPrintDecorationText(PrintDecoration.HEADER); printReportLogoType = 1; string[] lines = null; char[] param = { '\n' }; if (header != null && header.Length > 0) lines = header.Split(param); int i = 0; char[] trimParam = { '\r' }; string TotalHader = ""; if (lines != null && lines.Length > 0) foreach (string s in lines) { TotalHader += stringPrintFormater.CenterTextWithWhiteSpace(s.TrimEnd(trimParam)) + "\r\n"; } strBody += TotalHader; // strBody += "\r\n"; strBody += "\r\n"; strBody += "\r\n" + stringPrintFormater.CenterTextWithWhiteSpace("Total Monthly Report"); strBody += "\r\n" + stringPrintFormater.CreateDashedLine(); double total = (from Total in datewiseTotals select Total.TotalIncV).Sum(); double totalvat = (from tvat in datewiseTotals select tvat.VatTotal).Sum(); strBody += "\r\n" + stringPrintFormater.ItemLabeledText( "Total Paid (IncVat): " + total.ToString("F02"),""); strBody += "\r\n" + stringPrintFormater.ItemLabeledText("Total Vat: "+totalvat.ToString("F02"),""); // strBody += "\r\n" + stringPrintFormater.ItemLabeledText("", "Total Cost: " + cost.ToString("F02")); strBody += "\r\n" + stringPrintFormater.CreateDashedLine(); strBody += "\r\n" + stringPrintFormater.GridCell("Date", 25, false); strBody += stringPrintFormater.GridCell("Order Total", 14, false); strBody += stringPrintFormater.GridCell("Cash", 12, false); strBody += stringPrintFormater.GridCell("Card", 12, false); strBody += stringPrintFormater.GridCell("Due", 12, false); strBody += stringPrintFormater.GridCell("Vat", 12, false); strBody += stringPrintFormater.GridCell("Food Total", 12, false); strBody += stringPrintFormater.GridCell("NonF Total", 12, false); strBody += stringPrintFormater.GridCell("Ser.Charge", 12, false); strBody += stringPrintFormater.GridCell("Discount", 12, false); // strBody += stringPrintFormater.GridCell("ExV Total", 12, true); strBody += stringPrintFormater.GridCell("IncV Total", 12, false); strBody += stringPrintFormater.GridCell("Covers", 12, false); //strBody += stringPrintFormater.GridCell("Cash", 12, true); //strBody += stringPrintFormater.GridCell("EFT", 12, true); //strBody += stringPrintFormater.GridCell("EFT Card", 16, false); strBody += "\r\n" + stringPrintFormater.CreateDashedLine(); foreach (DatewiseTotal item in datewiseTotals) { strBody += "\r\n" + stringPrintFormater.GridCell(item.Date.ToString(), 25, false); // strBody += stringPrintFormater.GridCell(item.SerialNumber.ToString(), 14, false); strBody += stringPrintFormater.GridCell(item.OrderTotal.ToString("F02"), 14, false); strBody += stringPrintFormater.GridCell(item.CashTotal.ToString("F02"), 12, false); strBody += stringPrintFormater.GridCell(item.EFTTotal.ToString("F02"), 12, false); strBody += stringPrintFormater.GridCell(item.DueTotal.ToString("F02"), 12, false); strBody += stringPrintFormater.GridCell(item.VatTotal.ToString("F02"), 12, false); strBody += stringPrintFormater.GridCell(item.FoodTotal.ToString("F02"), 12, false); strBody += stringPrintFormater.GridCell(item.NoonFoodTotal.ToString("F02"), 12, false); strBody += stringPrintFormater.GridCell(item.ServiceChargeTotal.ToString("F02"), 12, false); strBody += stringPrintFormater.GridCell(item.DiscountTotal.ToString("F02"), 12, false); strBody += stringPrintFormater.GridCell(item.TotalIncV.ToString("F02"), 12, false); strBody += stringPrintFormater.GridCell(item.Covers.ToString(), 12, false); strBody += "\r\n" + stringPrintFormater.CreateDashedLine(); // Change by Mithu ( Date to Date Seperate will be) // strBody += stringPrintFormater.GridCell(item.OrderTotal.ToString(), 12, true); // strBody += stringPrintFormater.GridCell(item.TotalPaidExcludingVat.ToString(), 12, true); //strBody += stringPrintFormater.GridCell(item.CashPaid.ToString(), 12, true); //strBody += stringPrintFormater.GridCell(item.EFTCardName.ToString(), 16, false); //strBody += "\r\n" + stringPrintFormater.CreateDashedLine(); } // strBody += "\r\n" + stringPrintFormater.CreateDashedLine(); strBody += "\r\n"; strBody += "\r\n" + stringPrintFormater.CenterTextWithDashed("END REPORT"); strBody += "\r\n\r\n\r\n" + " --------------------" + " --------------------- "; strBody += "\r\n" + " Checked By" + " Prepared By "; return strBody; }
private void ViewReportButton_Click(object sender, EventArgs e) { ViewReport tempViewReportForm = new ViewReport(); tempViewReportForm.Show(); CFormManager.Forms.Push(this); this.Hide(); /* CViewReportForm tempViewReportForm = new CViewReportForm(); tempViewReportForm.Show(); CFormManager.Forms.Push(this); this.Hide(); */ }