private void print() { DataRow dr = gridGRVsView.GetFocusedDataRow(); String GRNString = dr["RefNo"].ToString(); BLL.Receipt receipt = new BLL.Receipt(ReceiptID); HCMIS.Desktop.Reports.PreviousCostPrintout xReportCostBuildUp = new HCMIS.Desktop.Reports.PreviousCostPrintout(); xReportCostBuildUp.DataSource = BLL.Receipt.GetPreviousStockforCostAnalysisPrintout(ReceiptID); HCMIS.Desktop.Reports.CostAnalysisSubReport xReportCostAnalysis = new HCMIS.Desktop.Reports.CostAnalysisSubReport(); xReportCostAnalysis.DataSource = GRV.CostAnalysis(GRNString); HCMIS.Desktop.Reports.CostCalculationPrintout xReportCostCalculationPrintOut = new HCMIS.Desktop.Reports.CostCalculationPrintout(); xReportCostCalculationPrintOut.DataSource = GRV.GRVSoundDetail; HCMIS.Desktop.Reports.CostReport xReportCostReport = new HCMIS.Desktop.Reports.CostReport(); xReportCostReport.DataSource = receipt.CostAnalysis(GRNString); xReportCostReport.xrDate.Text = EthiopianDate.EthiopianDate.GregorianToEthiopian(BLL.DateTimeHelper.ServerDateTime); xReportCostReport.xrCostedBy.Text = CurrentContext.LoggedInUserName; xReportCostReport.xrWarehouse.Text = receipt.GetWarehouse(); xReportCostReport.subReportCostCalculation.ReportSource = xReportCostCalculationPrintOut; xReportCostReport.xrSubreportCostBuildup.ReportSource = xReportCostBuildUp; xReportCostReport.xrSubreportCostAnalysis.ReportSource = xReportCostAnalysis; xReportCostReport.ShowPrintStatusDialog = true; xReportCostReport.CreateDocument(); xReportCostReport.PrintingSystem.Document.AutoFitToPagesWidth = 1; xReportCostReport.ShowPreviewDialog(); // LOG Cost Analysis printout in PDF Log MemoryStream stream = new MemoryStream(); xReportCostReport.ExportToPdf(stream); HCMIS.Core.Distribution.Services.PrintLogService.SavePrintLogNoWait(stream, "CostAnalysis", true, ReceiptID, CurrentContext.UserId, BLL.DateTimeHelper.ServerDateTime); }
public static XtraReport GetCostAnalysisPrintout(string GRNString, int ReceiptID) { BLL.Receipt receipt = new BLL.Receipt(ReceiptID); CostCalculator GRV = new CostCalculator(); GRV.LoadGRV(ReceiptID); GRV.LoadGRVForCostAnalysis(ReceiptID); HCMIS.Desktop.Reports.PreviousCostPrintout xReportCostBuildUp = new HCMIS.Desktop.Reports.PreviousCostPrintout(); xReportCostBuildUp.DataSource = GRV.PreviousStock; HCMIS.Desktop.Reports.CostAnalysisSubReport xReportCostAnalysis = new HCMIS.Desktop.Reports.CostAnalysisSubReport(); xReportCostAnalysis.DataSource = GRV.CostAnalysis(GRNString); HCMIS.Desktop.Reports.CostCalculationPrintout xReportCostCalculationPrintOut = new HCMIS.Desktop.Reports.CostCalculationPrintout(); xReportCostCalculationPrintOut.DataSource = GRV.GRVDetail; HCMIS.Desktop.Reports.CostReport xReportCostReport = new HCMIS.Desktop.Reports.CostReport(); xReportCostReport.DataSource = GRV.CostAnalysis(GRNString); xReportCostReport.xrDate.Text = EthiopianDate.EthiopianDate.GregorianToEthiopian(BLL.DateTimeHelper.ServerDateTime); ReceiveDocConfirmation receiveDocConfirmation = new ReceiveDocConfirmation(); DataTable Users = receiveDocConfirmation.GetUserNamebyReceipt(ReceiptID); if (Users.Rows.Count > 0) { xReportCostReport.xrCostedBy.Text = Users.Rows[0]["CostedBy"].ToString(); xReportCostReport.xrCheckedBy.Text = Users.Rows[0]["CheckedBy"].ToString(); } xReportCostReport.xrWarehouse.Text = receipt.GetWarehouse(); xReportCostReport.subReportCostCalculation.ReportSource = xReportCostCalculationPrintOut; xReportCostReport.xrSubreportCostBuildup.ReportSource = xReportCostBuildUp; xReportCostReport.xrSubreportCostAnalysis.ReportSource = xReportCostAnalysis; xReportCostReport.ShowPrintStatusDialog = true; xReportCostReport.CreateDocument(); xReportCostReport.PrintingSystem.Document.AutoFitToPagesWidth = 1; return(xReportCostReport); }