//printing document private void printDayEndReportDocs_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { //DateTime currentDate = DateTime.UtcNow.Date; DateTime currentDate = DateTime.Parse("2018-12-09 20:44:02.3033333"); // for testing List <TOrder> listOfOrdersWithinCurrentDay = Helper.GetAllOrdersForDayEnd(currentDate); int x = e.MarginBounds.Left; int y = e.MarginBounds.Top; int nxtLineIncrement = 20; Graphics g = e.Graphics; var font = new Font("Arial", 16); var brush = new SolidBrush(Color.Black); g.DrawString("\tDay End Summary Report", font, brush, x, y); g.DrawString("\t--------------------------------------", font, brush, x, y += nxtLineIncrement); g.DrawString("\tDate : " + currentDate.ToLongDateString(), font, brush, x, y += nxtLineIncrement); g.DrawString("\tTotal Orders : " + TotalOrder.ToString(), font, brush, x, y += nxtLineIncrement); g.DrawString("\tTotal Items : " + TotalItems.ToString(), font, brush, x, y += nxtLineIncrement); g.DrawString("\tTotal Income By Card : " + TotalIncomeByCard.ToString(), font, brush, x, y += nxtLineIncrement); g.DrawString("\tTotal Income By Cash : " + TotalIncomeByCash.ToString(), font, brush, x, y += nxtLineIncrement); g.DrawString("\tTotal Redeem Points Fee : " + TotalReedemsPoints.ToString(), font, brush, x, y += nxtLineIncrement); g.DrawString("\tTotal Income : " + TotalIncome.ToString(), font, brush, x, y += nxtLineIncrement); g.DrawString("\tStarting Cash : " + StartingCash.ToString(), font, brush, x, y += nxtLineIncrement); g.DrawString("\tTotal Till Balance : " + ActualCashInTill.ToString(), font, brush, x, y += nxtLineIncrement); g.DrawString("\tVariance : " + Variance.ToString(), font, brush, x, y += nxtLineIncrement); }
//showing calculated values on form private void DisplayReportData() { labelCurrentDate.Text = CurrentDate.ToLongDateString(); labelTotalOrders.Text = TotalOrder.ToString() + " orders."; labelTotalItems.Text = TotalItems.ToString() + " items."; labelTotalByCard.Text = "$ " + TotalIncomeByCard.ToString(); labelTotalByCash.Text = "$ " + TotalIncomeByCash.ToString(); labelTotalRedeems.Text = "$ " + TotalReedemsPoints.ToString(); labelTotalIncome.Text = "$ " + TotalIncome.ToString(); labelStartingCash.Text = "$ " + StartingCash.ToString(); labelTotalActualTillIncome.Text = "$ " + ActualCashInTill.ToString(); labelVariance.Text = "$ " + Variance.ToString(); }
//exporting file in debug folder private void btnExportData_Click(object sender, EventArgs e) { try { using (StreamWriter writer = new StreamWriter(Helper.FILE_PATH_DAYEND_REPORT)) { writer.WriteLine("\t\t\t" + "--------DAY END SUMMARY REPORT-----------"); writer.WriteLine("\t" + "Date: " + CurrentDate.ToLongDateString()); writer.WriteLine("\t" + "Total Orders: " + TotalOrder.ToString()); writer.WriteLine("\t" + "Total Items: " + TotalItems.ToString()); writer.WriteLine("\t" + "Total Income By Card: " + TotalIncomeByCard.ToString()); writer.WriteLine("\t" + "Total Income By Cash: " + TotalIncomeByCash.ToString()); writer.WriteLine("\t" + "Total Redeems Fee: " + TotalReedemsPoints.ToString()); writer.WriteLine("\t" + "Total Income: " + TotalIncome.ToString()); writer.WriteLine("\t" + "Variance: " + Variance.ToString()); } MessageBox.Show("Day end report is saved successfully."); } catch (Exception) { MessageBox.Show("The report isn't saved successfully. Try again."); } }
public override string ToString() { return(TotalIncome.ToString()); }