Ejemplo n.º 1
0
        private void FormatPage(object sender, PrintPageEventArgs e)
        {
            graphics = e.Graphics;
            Font minifont   = new Font("Arial", 5);
            Font itemfont   = new Font("Arial", 6);
            Font smallfont  = new Font("Arial", 10);
            Font mediumfont = new Font("Arial", 14);
            Font largefont  = new Font("Arial", 16);

            int Offset = 10;
            int smallinc = 10, mediuminc = 12, largeinc = 17;

            //Getting Receipt data
            List <DetailedDailyReportModel> detailedDailyReportModels = new List <DetailedDailyReportModel>();

            ReportViewModel reportViewModel = new ReportViewModel();

            detailedDailyReportModels = reportViewModel.GetDetailedDailyByDate(FromDate, Todate);

            Offset = Offset + Offset;
            graphics.DrawString(LoginDetail.ClientName, smallfont, new SolidBrush(Color.Black), 14, Offset);
            Offset = Offset + mediuminc;

            InsertItemList(LoginDetail.OutletName, "", Offset, 5);
            Offset = Offset + mediuminc;
            Offset = Offset + mediuminc;

            //InsertItemList("DETAILED DAILY REPORT", "", Offset, 5);
            //Offset = Offset + mediuminc;
            //Offset = Offset + mediuminc;

            //InsertItemList("DATE: " + FromDate, "", Offset, 5);
            //Offset = Offset + mediuminc;

            foreach (var item in detailedDailyReportModels)
            {
                InsertItemList(item.RegisterTitle.ToString(), "", Offset, 5);
                InsertItemList(item.RegisterValue.ToString(), "", Offset, 175 + (50 - (item.RegisterValue.ToString().Length * 4)));
                Offset = Offset + mediuminc;
            }
            Offset = Offset + mediuminc;

            Offset = Offset + mediuminc;
        }
Ejemplo n.º 2
0
        private void btnDetailedDailyExcel_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DateTime dtFrom = new DateTime();
                DateTime dtTo   = new DateTime();

                dtFrom = (DateTime)dpDetailedDailyFromDate.Value;
                dtTo   = (DateTime)dpDetailedDailyToDate.Value;


                List <DetailedDailyReportModel> detailedDailyReportModels = new List <DetailedDailyReportModel>();
                ReportViewModel reportViewModel = new ReportViewModel();

                detailedDailyReportModels = reportViewModel.GetDetailedDailyByDate(dtFrom.ToString("yyyy-MM-dd HH:mi:ss"), dtTo.ToString("yyyy-MM-dd HH:mi:ss"));

                CommonMethods commonMethods = new CommonMethods();
                string        path = string.Empty, firstLine = string.Empty;

                string fileName       = "DetailedDailyReport_" + DateTime.Now.ToString("MM-dd-yyyy_HHmmss");
                var    saveFileDialog = new SaveFileDialog
                {
                    FileName   = fileName != "" ? fileName : "gpmfca-exportedDocument",
                    DefaultExt = ".xlsx",
                    Filter     = "Common Seprated Documents (.xlsx)|*.xlsx"
                };

                if (saveFileDialog.ShowDialog() == true)
                {
                    path = saveFileDialog.FileName;
                    DataTable table = new DataTable();

                    table     = commonMethods.ConvertToDataTable(detailedDailyReportModels);
                    firstLine = "Detailed Daily List for " + dtFrom.ToString("yyyy-MM-dd HH:mi:ss") + " to " + dtTo.ToString("yyyy-MM-dd HH:mi:ss");
                    commonMethods.WriteExcelDetailDailySalesFile(table, path, firstLine);
                }
            }
            catch (Exception ex)
            {
                SystemError.Register(ex);
            }
        }