/// <summary> /// method wich works when the user press on "make spcific order report" button /// the method will make pdf report on desktop with the spcific chosen order detail /// </summary> private void btnOrderReport_Click(object sender, EventArgs e) { if (dgvOrderLines.Rows.Count > 0) { doc = new Document(); string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); PdfWriter.GetInstance(doc, new FileStream(path + @"\" + "Order_Number_" + selectedOrderDetails.OrderID + "_report.pdf", FileMode.Create)); doc.Open(); PdfReports pdfReports = new PdfReports(doc); pdfReports.MakeDocHeader("דו''ח עבור הזמנה מספר " + selectedOrderDetails.OrderID.ToString() + " : "); pdfReports.LineDown(10); pdfReports.MakeCenterHeader(dtpEndDate.Value.ToShortDateString() + " - " + dtpStartDate.Value.ToShortDateString(), 15); pdfReports.LineDown(15); pdfReports.MakeRightHeader("מלצר מבצע: " + selectedOrderEmployeeDetails.FirstName + " " + selectedOrderEmployeeDetails.LastName, 15); pdfReports.LineDown(5); pdfReports.MakeRightHeader((selectedOrderCustomerDetails == null) ? "לקוח מבצע: לא נבחר לקוח" : "לקוח מבצע: " + selectedOrderCustomerDetails.GetFullName(), 15); pdfReports.LineDown(10); float[] widthCell = new float[4]; widthCell[0] = 5; widthCell[1] = 5; widthCell[2] = 20; widthCell[3] = 5; string[,] detailsMat = OrderDetailsToStrings(selctedOrderLines); pdfReports.MakeCenterTable(4, widthCell, detailsMat, selctedOrderLines.Length); pdfReports.LineDown(20); pdfReports.MakeRightHeader("מספר שורות בהזמנה: " + selctedOrderLines.Length, 15); pdfReports.LineDown(10); pdfReports.MakeRightHeader("סך ההזמנה: " + ordersTotalPrice + "ש\"ח ", 15); doc.Close();//close file MessageBox.Show("דוח עבור הזמנה ספציפית בוצע בהצלחה!"); } }
/// <summary> /// method wich works when the user press on "make orders report" button /// the method will make pdf report on desktop with all the orders detail /// </summary> private void btnOrdersReport_Click(object sender, EventArgs e) { if (dgvOrderList.Rows.Count > 0) { doc = new Document(); string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); PdfWriter.GetInstance(doc, new FileStream(path + @"\" + "Orders_report.pdf", FileMode.Create)); doc.Open(); PdfReports pdfReports = new PdfReports(doc); pdfReports.MakeDocHeader("דו''ח הזמנות בין התאריכים:"); pdfReports.LineDown(5); pdfReports.MakeCenterHeader(dtpEndDate.Value.ToShortDateString() + " - " + dtpStartDate.Value.ToShortDateString(), 15); pdfReports.LineDown(15); float[] widthCell = new float[5]; widthCell[0] = 25; widthCell[1] = 25; widthCell[2] = 40; widthCell[3] = 22; widthCell[4] = 25; string[,] detailsMat = OrdersDetailsToStrings(orders); pdfReports.MakeCenterTable(5, widthCell, detailsMat, orders.Length); pdfReports.LineDown(20); pdfReports.MakeRightHeader("סכ''ה הזמנות: " + orders.Length, 15); pdfReports.LineDown(10); pdfReports.MakeRightHeader("סכום הזמנות כולל: " + ordersTotalPrice, 15); doc.Close();//close file MessageBox.Show("דוח הזמנות בוצע בהצלחה!"); } }
/// <summary> /// method wich make pdf report from the chosen stock details /// </summary> /// <param name="reportHeader">the header of the report</param> private void MakePdfReport(string reportHeader) { doc = new Document(); string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); PdfWriter.GetInstance(doc, new FileStream(path + @"\" + "Stock_report.pdf", FileMode.Create)); doc.Open(); PdfReports pdfReports = new PdfReports(doc); pdfReports.MakeDocHeader("דו''ח כמויות"); pdfReports.LineDown(5); pdfReports.MakeCenterHeader(reportHeader, 15); pdfReports.LineDown(15); float[] widthCell = new float[3]; widthCell[0] = 10; widthCell[1] = 30; widthCell[2] = 10; string[,] detailsMat = StockDetailsToStrings(stock); pdfReports.MakeCenterTable(3, widthCell, detailsMat, stock.Length); pdfReports.LineDown(20); doc.Close();//close file MessageBox.Show("דוח המלאי בוצע בהצלחה!"); }