Beispiel #1
0
        private void loadDataRevenue(AdminwsOfCloudPOS unitofwork, ChartValues <decimal> ValueExpense)
        {
            decimal totalMonthAmount1  = 0;
            decimal totalMonthAmount2  = 0;
            decimal totalMonthAmount3  = 0;
            decimal totalMonthAmount4  = 0;
            decimal totalMonthAmount5  = 0;
            decimal totalMonthAmount6  = 0;
            decimal totalMonthAmount7  = 0;
            decimal totalMonthAmount8  = 0;
            decimal totalMonthAmount9  = 0;
            decimal totalMonthAmount10 = 0;
            decimal totalMonthAmount11 = 0;
            decimal totalMonthAmount12 = 0;

            var valueM1  = unitofwork.OrderRepository.Get(c => c.Ordertime.Month == 1);
            var valueM2  = unitofwork.OrderRepository.Get(c => c.Ordertime.Month == 2);
            var valueM3  = unitofwork.OrderRepository.Get(c => c.Ordertime.Month == 3);
            var valueM4  = unitofwork.OrderRepository.Get(c => c.Ordertime.Month == 4);
            var valueM5  = unitofwork.OrderRepository.Get(c => c.Ordertime.Month == 5);
            var valueM6  = unitofwork.OrderRepository.Get(c => c.Ordertime.Month == 6);
            var valueM7  = unitofwork.OrderRepository.Get(c => c.Ordertime.Month == 7);
            var valueM8  = unitofwork.OrderRepository.Get(c => c.Ordertime.Month == 8);
            var valueM9  = unitofwork.OrderRepository.Get(c => c.Ordertime.Month == 9);
            var valueM10 = unitofwork.OrderRepository.Get(c => c.Ordertime.Month == 10);
            var valueM11 = unitofwork.OrderRepository.Get(c => c.Ordertime.Month == 11);
            var valueM12 = unitofwork.OrderRepository.Get(c => c.Ordertime.Month == 12);

            FindValueInMonthOrderNote(ValueExpense, valueM1, totalMonthAmount1, valueM2, totalMonthAmount2, valueM3, totalMonthAmount3, valueM4, totalMonthAmount4, valueM5, totalMonthAmount5, valueM6, totalMonthAmount6, valueM7, totalMonthAmount7, valueM8, totalMonthAmount8, valueM9, totalMonthAmount9, valueM10, totalMonthAmount10, valueM11, totalMonthAmount11, valueM12, totalMonthAmount12);
        }
Beispiel #2
0
        public LiveChartReceiptPage(AdminwsOfCloudPOS unitofwork)
        {
            _unitofwork = unitofwork;
            InitializeComponent();

            DispatcherTimer RefreshTimer = new DispatcherTimer();

            RefreshTimer.Tick    += Refresh_Tick;
            RefreshTimer.Interval = new TimeSpan(0, 5, 0);
            RefreshTimer.Start();
            Loaded += LiveChartReceiptPage_Load;


            Average2     = new ChartValues <decimal>();
            Average1     = new ChartValues <decimal>();
            ValueExpense = new ChartValues <decimal>();
            ValueRevenue = new ChartValues <decimal>();

            SeriesCollection = new SeriesCollection
            {
                new ColumnSeries
                {
                    Title  = "Expense",
                    Values = ValueExpense
                }
            };
            Formatter = value => value.ToString();

            DataContext = this;
            Labels      = new[] { "Jan", "Feb", "Mar", "Apr", "May ", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" };
        }
 public ProductDetailPage(AdminwsOfCloudPOS unitofwork)
 {
     InitializeComponent();
     _unitofwork = unitofwork;
     InitializeComponent();
     this.Loaded += ProductDetailPage_Loaded;
 }
Beispiel #4
0
        public ReceiptNotePage(AdminwsOfCloudPOS unitofwork, AdminRe admin)
        {
            _unitofwork = unitofwork;
            InitializeComponent();
            _relist = _unitofwork.ReceiptNoteRepository.Get(includeProperties: "Employee").ToList();
            _relist = _relist.Where(x => x.Employee.Manager.Equals(admin.AdId)).ToList();
            lvReceptNote.ItemsSource = _relist;
            _rnlist = _unitofwork.ReceiptNoteDsetailsRepository.Get(includeProperties: "Ingredient").ToList();
            List <ReceiptNoteDetail> _rnTempList = new List <ReceiptNoteDetail>();

            foreach (var receiptdetails in _rnlist)
            {
                bool found = false;
                foreach (var receiptnote in _relist)
                {
                    if (receiptdetails.RnId.Equals(receiptnote.RnId))
                    {
                        found = true;
                        break;
                    }
                }
                if (found)
                {
                    _rnTempList.Add(receiptdetails);
                }
            }
            _rnlist = _rnTempList;
            lvReceiptNoteDetail.ItemsSource = _rnlist;

            this.Loaded += ReceiptNotePage_Loaded;
        }
        public IngredientPage(AdminwsOfCloudPOS unitofwork, List <Ingredient> IngdList)
        {
            _unitofwork = unitofwork;
            InitializeComponent();

            lvItem.ItemsSource = IngdList;
        }
Beispiel #6
0
        public OrderNotePage(AdminwsOfCloudPOS unitofwork, AdminRe admin)
        {
            _unitofwork = unitofwork;
            InitializeComponent();
            _ordernotelist          = _unitofwork.OrderRepository.Get(includeProperties: "Employee,Customer").ToList();
            _ordernotelist          = _ordernotelist.Where(x => x.Employee.Manager.Equals(admin.AdId)).ToList();
            lvOrderNote.ItemsSource = _ordernotelist;
            _ordernotedetailslist   = _unitofwork.OrderNoteDetailsRepository.Get(includeProperties: "Product").ToList();
            List <OrderNoteDetail> _orderdetailsTempList = new List <OrderNoteDetail>();

            foreach (var orderdetails in _ordernotedetailslist)
            {
                bool found = false;
                foreach (var order in _ordernotelist)
                {
                    if (orderdetails.OrdernoteId.Equals(order.OrdernoteId))
                    {
                        found = true;
                        break;
                    }
                }

                if (found)
                {
                    _orderdetailsTempList.Add(orderdetails);
                }
            }
            _ordernotedetailslist          = _orderdetailsTempList;
            lvOrderNoteDetails.ItemsSource = _ordernotedetailslist;

            this.Loaded += OrderNotePage_Loaded;
        }
Beispiel #7
0
 public AdminChangePass(AdminwsOfCloudPOS unitofwork, AdminRe admin)
 {
     _unitofwork = unitofwork;
     InitializeComponent();
     _admin           = admin;
     this.WindowStyle = WindowStyle.SingleBorderWindow;
     this.ResizeMode  = ResizeMode.NoResize;
 }
Beispiel #8
0
        public EmployeeListPage(AdminwsOfCloudPOS unitofork, AdminRe ad)
        {
            _unitofork = unitofork;
            InitializeComponent();
            admin = ad;

            this.Loaded += EmployeeListPage_Loaded;
        }
        public SalaryPage(AdminwsOfCloudPOS unitofwork, AdminRe curAdmin)
        {
            InitializeComponent();
            _unitofwork = unitofwork;
            admin       = curAdmin;

            Loaded += SalaryPage_Loaded;
        }
        public HomePage(AdminwsOfCloudPOS unitofwork)
        {
            InitializeComponent();
            _unitofwork = unitofwork;
            // init datasource for Time PieChart
            SeriesCollectionTime = new SeriesCollection();
            PriceList            = new List <decimal>();
            FirstPieSeries       = new PieSeries()
            {
                Title = "0h-12h"
            };
            SecondPieSeries = new PieSeries()
            {
                Title = "12h-18h"
            };
            ThirdPieSeries = new PieSeries()
            {
                Title = "18h-0h"
            };
            SeriesCollectionTime.Add(FirstPieSeries);
            SeriesCollectionTime.Add(SecondPieSeries);
            SeriesCollectionTime.Add(ThirdPieSeries);


            // init datasource for Employee PieChart
            SeriesCollection = new SeriesCollection();
            EmpPieSeries     = new List <PieSeries>();
            foreach (var item in _unitofwork.EmployeeRepository.Get(x => x.Deleted.Equals(0)))
            {
                EmpPieSeries.Add(new PieSeries()
                {
                    Title = item.EmpId + ": " + item.Name
                });
            }
            foreach (var item in EmpPieSeries)
            {
                SeriesCollection.Add(item);
            }

            //init datasource for ColumnChart
            Values           = new ChartValues <decimal>();
            SerieColumnChart = new SeriesCollection
            {
                new ColumnSeries
                {
                    Title  = "revenue",
                    Values = Values
                }
            };
            Labels    = new List <string>();
            Formatter = value => value.ToString();


            // fill chart at first time
            ColumnChartDatafilling(FILL_ALL);
            ChartDataFilling(FILL_ALL);
            ChartDataFillingByTime(FILL_ALL);
        }
 public AdminDetailWindow(AdminwsOfCloudPOS unitofwork, AdminRe ad)
 {
     _unitofwork = unitofwork;
     InitializeComponent();
     admin     = ad;
     empwithad = _unitofwork.EmployeeRepository.Get(x => x.Manager.Equals(admin.AdId) && x.Deleted.Equals(0)).ToList();
     lvDataEmployee.ItemsSource = empwithad;
     loadAdData();
 }
 public EmployeeAddOrUpdateDialog(AdminwsOfCloudPOS unitofwork)
 {
     _unitofwork = unitofwork;
     _emp        = new Employee();
     InitializeComponent();
     initControlAdd();
     this.WindowStyle = WindowStyle.SingleBorderWindow;
     this.ResizeMode  = ResizeMode.NoResize;
 }
Beispiel #13
0
        public AddNewAdminDialog(AdminwsOfCloudPOS unitofwork)
        {
            InitializeComponent();

            _unitofwork = unitofwork;
            _admin      = new AdminRe();
            initControlAdd();
            this.WindowStyle = WindowStyle.SingleBorderWindow;
            this.ResizeMode  = ResizeMode.NoResize;
        }
Beispiel #14
0
        public ReportOptionDialog(IListPdfReport reportHelper, AdminwsOfCloudPOS unitofwork)
        {
            InitializeComponent();

            _unitofwork   = unitofwork;
            _reportHelper = reportHelper;

            DpFrom.SelectedDate = DateTime.Now;
            DpTo.SelectedDate   = DateTime.Now;
        }
        public ProductCreatorPage(AdminwsOfCloudPOS unitofwork)
        {
            _unitofwork = unitofwork;
            InitializeComponent();

            this.Loaded += ProductCreatorPage_Loaded;

            _currentProduct = new Product();

            initComboBox();
        }
Beispiel #16
0
 public CustomerPage(AdminwsOfCloudPOS unitofwork)
 {
     _unitofwork = unitofwork;
     InitializeComponent();
     allcus = _unitofwork.CustomerRepository.Get(x => x.Deleted.Equals(0)).ToList();
     lvDataCustomer.ItemsSource = allcus;
     for (int i = 0; i <= 100; i++)
     {
         cbodiscount.Items.Add(i.ToString());
     }
 }
Beispiel #17
0
        public CustomerAddOrUpdateDialog(AdminwsOfCloudPOS unitofwork, Customer cus)
        {
            _unitofwork = unitofwork;
            if (cus != null)
            {
                _cus = cus;
            }
            InitializeComponent();

            initData();
        }
        public ProductUpdatePage(AdminwsOfCloudPOS unitofwork, Product pro)
        {
            _unitofwork     = unitofwork;
            _currentProduct = pro;
            _proDe          = _unitofwork.ProductDetailsRepository.Get(x => x.ProductId.Equals(_currentProduct.ProductId)).ToList();
            InitializeComponent();

            this.Loaded += ProductCreatorPage_Loaded;

            PDTempData.pdtList.Clear();

            initComboBox();
            initDataCurrentProduct();
        }
Beispiel #19
0
        public IngredientAddOrUpdateDialog(AdminwsOfCloudPOS unitofwork, Ingredient ingre)
        {
            _unitofwork = unitofwork;
            _ingre      = ingre;
            InitializeComponent();

            initComboBox();
            if (_ingre != null)
            {
                initUpdateData();
            }

            this.WindowStyle = WindowStyle.SingleBorderWindow;
            this.ResizeMode  = ResizeMode.NoResize;
        }
Beispiel #20
0
        public AdminWindow()
        {
            InitializeComponent();
            _unitofwork = new AdminwsOfCloudPOS();

            try
            {
                var getLoginAdmin = App.Current.Properties["AdLogin"] as AdminRe;
                curAdmin = _unitofwork.AdminreRepository.Get(x => x.AdId.Equals(getLoginAdmin.AdId)).FirstOrDefault();
                if (curAdmin == null)
                {
                    this.Close();
                }
                cUser.Content = curAdmin.Name;

                if (curAdmin.AdRole == (int)AdminReRole.SoftwareAd)
                {
                    btnCreateAdmin.Visibility = Visibility.Visible;
                }

                empListPage               = new EmployeeListPage(_unitofwork, curAdmin);
                salarypage                = new SalaryPage(_unitofwork, curAdmin);
                liveChartReceipt          = new LiveChartReceiptPage(_unitofwork);
                productdetals             = new ProductDetailPage(_unitofwork);
                ctmP                      = new CustomerPage(_unitofwork);
                ordernotepage             = new OrderNotePage(_unitofwork, curAdmin);
                receiptnotepage           = new ReceiptNotePage(_unitofwork, curAdmin);
                FoodPage                  = new statisticsFoodPage(_unitofwork);
                statisticsWorkingHourPage = new StatisticsWorkingHourPage(_unitofwork);
                homePage                  = new HomePage(_unitofwork);
                productCreator            = new ProductCreatorPage(_unitofwork);
                myframe.Navigate(homePage);

                DispatcherTimer RefreshTimer = new DispatcherTimer();
                RefreshTimer.Tick    += Refresh_Tick;
                RefreshTimer.Interval = new TimeSpan(0, 2, 0);
                RefreshTimer.Start();

                Closing += AdminWindow_Closing;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong: \n" + ex.Message);
                AppLog.Error(ex);
            }
        }
        public WareHouseWindow()
        {
            InitializeComponent();

            try
            {
                _unitofwork = new AdminwsOfCloudPOS();
                IngdList    = _unitofwork.IngredientRepository
                              .Get(c => c.Deleted.Equals(0), includeProperties: "WareHouse").ToList();

                _innIngredientPage  = new IngredientPage(_unitofwork, IngdList);
                _lvChartReceiptPage = new LiveChartReceiptPage(_unitofwork);



                if (App.Current.Properties["AdLogin"] != null)
                {
                    AdminRe        getAdmin = App.Current.Properties["AdLogin"] as AdminRe;
                    List <AdminRe> adList   = _unitofwork.AdminreRepository.Get().ToList();
                    curAdmin = adList.FirstOrDefault(x =>
                                                     x.Username.Equals(getAdmin.Username) && x.DecryptedPass.Equals(getAdmin.DecryptedPass));
                    CUserChip.Content = curAdmin.Name;
                }
                else
                {
                    Employee        getEmp  = App.Current.Properties["EmpLogin"] as Employee;
                    List <Employee> empList = _unitofwork.EmployeeRepository.Get().ToList();
                    curEmp = empList.FirstOrDefault(x =>
                                                    x.Username.Equals(getEmp.Username) && x.DecryptedPass.Equals(getEmp.DecryptedPass));
                    CUserChip.Content = curEmp.Name;
                    _inputReceipt     = new InputReceiptNote(_unitofwork, IngdList);
                }


                DispatcherTimer RefreshTimer = new DispatcherTimer();
                RefreshTimer.Tick    += Refresh_Tick;
                RefreshTimer.Interval = new TimeSpan(0, 1, 0);
                RefreshTimer.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong: \n" + ex.Message);
                AppLog.Error(ex);
            }
        }
Beispiel #22
0
        public InputReceiptNote(AdminwsOfCloudPOS unitofwork, List <Ingredient> ingdList)
        {
            _unitofwork = unitofwork;
            InitializeComponent();

            this.IngdList = ingdList;
            lvDataIngredient.ItemsSource = IngdList;

            ReceiptDetailsList = new List <ReceiptNoteDetail>();
            CurrentReceipt     = new ReceiptNote()
            {
                EmpId = (App.Current.Properties["EmpLogin"] as Employee).EmpId,
                ReceiptNoteDetails = ReceiptDetailsList
            };
            lvDataReceipt.ItemsSource = ReceiptDetailsList;

            LoadReceiptData();
        }
Beispiel #23
0
        public StatisticsWorkingHourPage(AdminwsOfCloudPOS unitofwork)
        {
            _unitofwork = unitofwork;
            InitializeComponent();

            curAdmin = App.Current.Properties["AdLogin"] as AdminRe;

            Values = new ChartValues <double>();


            SeriesCollection = new SeriesCollection
            {
                new ColumnSeries
                {
                    Title  = "Working Hour",
                    Values = Values
                }
            };
            Labels    = new List <string>();
            Formatter = value => value.ToString();
            WHList    = new Dictionary <string, double>();
            ChartDataFilling(false);
        }
Beispiel #24
0
        public statisticsFoodPage(AdminwsOfCloudPOS unitofwork)
        {
            // init data
            _unitofwork      = unitofwork;
            Values           = new ChartValues <int>();
            SeriesCollection = new SeriesCollection
            {
                new ColumnSeries
                {
                    Title  = "amount",
                    Values = Values
                }
            };
            Labels    = new List <string>();
            Formatter = value => value.ToString();
            CountList = new Dictionary <string, int>();

            // init UI
            InitializeComponent();

            // Fill data to chart
            ChartDataFilling(false);
        }
        public LiveChartReceiptPage(AdminwsOfCloudPOS unitofwork)
        {
            _unitofwork = unitofwork;
            InitializeComponent();
            Loaded += LiveChartReceiptPage_Load;


            Average2     = new ChartValues <decimal>();
            Average1     = new ChartValues <decimal>();
            ValueExpense = new ChartValues <decimal>();
            ValueRevenue = new ChartValues <decimal>();

            SeriesCollection = new SeriesCollection
            {
                new ColumnSeries
                {
                    Title  = "Revenue",
                    Values = ValueRevenue
                }, new ColumnSeries
                {
                    Title  = "Expense",
                    Values = ValueExpense
                }, new LineSeries
                {
                    Title  = "Average Revenue",
                    Values = Average2
                }, new LineSeries
                {
                    Title  = "Average Expense",
                    Values = Average1
                }
            };
            Formatter = value => value.ToString();

            DataContext = this;
            Labels      = new[] { "Jan", "Feb", "Mar", "Apr", "May ", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" };
        }
        public IPdfReportData CreateDayPdfReport(AdminwsOfCloudPOS unitofwork, string folderName)
        {
            return(new PdfReport().DocumentPreferences(doc =>
            {
                doc.RunDirection(PdfRunDirection.LeftToRight);
                doc.Orientation(PageOrientation.Landscape);
                doc.PageSize(PdfPageSize.A4);
                doc.DocumentMetadata(new DocumentMetadata {
                    Author = "Asowell Restaurant", Application = "Asowell POS", Keywords = "IList Rpt.", Subject = "Report", Title = "Input Storage Report"
                });
                doc.Compression(new CompressionSettings
                {
                    EnableCompression = true,
                    EnableFullCompression = true
                });
                doc.PrintingPreferences(new PrintingPreferences
                {
                    ShowPrintDialogAutomatically = true
                });
            })
                   .DefaultFonts(fonts =>
            {
                fonts.Path(System.IO.Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), "fonts\\arial.ttf"),
                           System.IO.Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), "fonts\\verdana.ttf"));
                fonts.Size(9);
                fonts.Color(System.Drawing.Color.Black);
            })
                   .PagesFooter(footer =>
            {
                footer.DefaultFooter(DateTime.Now.ToString("MM/dd/yyyy"));
            })
                   .PagesHeader(header =>
            {
                header.CacheHeader(cache: true); // It's a default setting to improve the performance.
                header.DefaultHeader(defaultHeader =>
                {
                    defaultHeader.RunDirection(PdfRunDirection.LeftToRight);
                    defaultHeader.ImagePath(System.IO.Path.Combine(AppPath.ApplicationPath, "Images\\logo.png"));
                    defaultHeader.Message("INPUT STORAGE REPORT (" + DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year + ")");
                });
            })
                   .MainTableTemplate(template =>
            {
                template.BasicTemplate(BasicTemplate.BlackAndBlue1Template);
            })
                   .MainTablePreferences(table =>
            {
                table.ColumnsWidthsType(TableColumnWidthType.Relative);
                //table.NumberOfDataRowsPerPage(5);
            })
                   .MainTableDataSource(dataSource =>
            {
                var receiptWithTimeList = unitofwork.ReceiptNoteRepository.Get(x => x.Inday.Day == DateTime.Now.Day &&
                                                                               x.Inday.Month == DateTime.Now.Month && x.Inday.Year == DateTime.Now.Year);

                dataSource.StronglyTypedList(receiptWithTimeList);
            })
                   .MainTableSummarySettings(summarySettings =>
            {
                summarySettings.OverallSummarySettings("Summary");
                summarySettings.PreviousPageSummarySettings("Previous Page Summary");
                summarySettings.PageSummarySettings("Page Summary");
            })
                   .MainTableColumns(columns =>
            {
                columns.AddColumn(column =>
                {
                    column.PropertyName("rowNo");
                    column.IsRowNumber(true);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(0);
                    column.Width(1);
                    column.HeaderCell("#");
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <ReceiptNote>(x => x.RnId);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(1);
                    column.Width(3);
                    column.HeaderCell("ID", horizontalAlignment: HorizontalAlignment.Left);
                    column.Font(font =>
                    {
                        font.Size(10);
                        font.Color(System.Drawing.Color.Brown);
                    });
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <ReceiptNote>(x => x.EmpId);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(2);
                    column.Width(2);
                    column.HeaderCell("Emp");
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <ReceiptNote>(x => x.Employee.Name);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(3);
                    column.Width(2);
                    column.HeaderCell("Emp Name");
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <ReceiptNote>(x => x.Inday);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(4);
                    column.Width(2);
                    column.HeaderCell("Time");
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <ReceiptNote>(x => x.TotalAmount);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Right);
                    column.IsVisible(true);
                    column.Order(5);
                    column.Width(2);
                    column.HeaderCell("Total Amount (kVND)");
                    column.ColumnItemsTemplate(template =>
                    {
                        template.TextBlock();
                        template.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString())
                                                            ? string.Empty : string.Format("{0:n0}", obj));
                    });
                    column.AggregateFunction(aggregateFunction =>
                    {
                        aggregateFunction.NumericAggregateFunction(AggregateFunction.Sum);
                        aggregateFunction.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString())
                                                            ? string.Empty : string.Format("{0:n0}", obj));
                    });
                });
            })
                   .MainTableEvents(events =>
            {
                events.DataSourceIsEmpty(message: "There is no data available to display.");
            })
                   .Export(export =>
            {
                export.ToExcel();
                export.ToCsv();
                export.ToXml();
            })
                   .Generate(data => data.AsPdfFile(string.Format("{0}\\InStorage-Report-{1}.pdf", folderName, Guid.NewGuid().ToString("N")))));
        }
        public IPdfReportData CreateYearPdfReport(AdminwsOfCloudPOS unitofwork, string folderName)
        {
            return(new PdfReport().DocumentPreferences(doc =>
            {
                doc.RunDirection(PdfRunDirection.LeftToRight);
                doc.Orientation(PageOrientation.Landscape);
                doc.PageSize(PdfPageSize.A4);
                doc.DocumentMetadata(new DocumentMetadata {
                    Author = "Asowell Restaurant", Application = "Asowell POS", Keywords = "IList Rpt.", Subject = "Report", Title = "Salary Report"
                });
                doc.Compression(new CompressionSettings
                {
                    EnableCompression = true,
                    EnableFullCompression = true
                });
                doc.PrintingPreferences(new PrintingPreferences
                {
                    ShowPrintDialogAutomatically = true
                });
            })
                   .DefaultFonts(fonts =>
            {
                fonts.Path(System.IO.Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), "fonts\\arial.ttf"),
                           System.IO.Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), "fonts\\verdana.ttf"));
                fonts.Size(9);
                fonts.Color(System.Drawing.Color.Black);
            })
                   .PagesFooter(footer =>
            {
                footer.DefaultFooter(DateTime.Now.ToString("MM/dd/yyyy"));
            })
                   .PagesHeader(header =>
            {
                header.CacheHeader(cache: true); // It's a default setting to improve the performance.
                header.DefaultHeader(defaultHeader =>
                {
                    defaultHeader.RunDirection(PdfRunDirection.LeftToRight);
                    defaultHeader.ImagePath(System.IO.Path.Combine(AppPath.ApplicationPath, "Images\\logo.png"));
                    defaultHeader.Message("SALARY REPORT (" + DateTime.Now.Year + ")");
                });
            })
                   .MainTableTemplate(template =>
            {
                template.BasicTemplate(BasicTemplate.BlackAndBlue1Template);
            })
                   .MainTablePreferences(table =>
            {
                table.ColumnsWidthsType(TableColumnWidthType.Relative);
                //table.NumberOfDataRowsPerPage(5);
            })
                   .MainTableDataSource(dataSource =>
            {
                var monthQuery =
                    unitofwork.SalaryNoteRepository.Get(x => x.ForYear == DateTime.Now.Year).ToList();

                List <SalaryNoteForReport> salaryReportList = new List <SalaryNoteForReport>();
                foreach (var salary in monthQuery)
                {
                    var salaryRpt = new SalaryNoteForReport()
                    {
                        SnId = salary.SnId,
                        EmpId = salary.EmpId,
                        EmpName = salary.Employee.Name,
                        DatePay = (salary.DatePay == null) ? "" : salary.DatePay.ToString(),
                        SalaryValue = salary.SalaryValue,
                        WorkHour = salary.WorkHour,
                        ForMonth = salary.ForMonth,
                        ForYear = salary.ForYear,
                        IsPaid = (salary.IsPaid == 1) ? "Yes" : "No"
                    };
                    salaryReportList.Add(salaryRpt);
                }

                dataSource.StronglyTypedList(salaryReportList);
            })
                   .MainTableSummarySettings(summarySettings =>
            {
                summarySettings.OverallSummarySettings("Summary");
                summarySettings.PreviousPageSummarySettings("Previous Page Summary");
                summarySettings.PageSummarySettings("Page Summary");
            })
                   .MainTableColumns(columns =>
            {
                columns.AddColumn(column =>
                {
                    column.PropertyName("rowNo");
                    column.IsRowNumber(true);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(0);
                    column.Width(1);
                    column.HeaderCell("#");
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <SalaryNoteForReport>(x => x.SnId);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(1);
                    column.Width(3);
                    column.HeaderCell("ID", horizontalAlignment: HorizontalAlignment.Left);
                    column.Font(font =>
                    {
                        font.Size(10);
                        font.Color(System.Drawing.Color.Blue);
                    });
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <SalaryNoteForReport>(x => x.EmpId);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(2);
                    column.Width(3);
                    column.HeaderCell("ID", horizontalAlignment: HorizontalAlignment.Left);
                    column.Font(font =>
                    {
                        font.Size(10);
                        font.Color(System.Drawing.Color.Crimson);
                    });
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <SalaryNoteForReport>(x => x.EmpName);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(3);
                    column.Width(2);
                    column.HeaderCell("Emp Name");
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <SalaryNoteForReport>(x => x.DatePay);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(4);
                    column.Width(2);
                    column.HeaderCell("Date Pay");
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <SalaryNoteForReport>(x => x.IsPaid);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(5);
                    column.Width(2);
                    column.HeaderCell("Is Paid");
                });


                columns.AddColumn(column =>
                {
                    column.PropertyName <SalaryNoteForReport>(x => x.ForMonth);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(6);
                    column.Width(2);
                    column.HeaderCell("For Month");
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <SalaryNoteForReport>(x => x.ForYear);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(7);
                    column.Width(2);
                    column.HeaderCell("For Year");
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <SalaryNoteForReport>(x => x.WorkHour);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Right);
                    column.IsVisible(true);
                    column.Order(8);
                    column.Width(2);
                    column.HeaderCell("Hour (h)");
                    column.ColumnItemsTemplate(template =>
                    {
                        template.TextBlock();
                        template.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString())
                            ? string.Empty : string.Format("{0:n0}", obj));
                    });
                    column.AggregateFunction(aggregateFunction =>
                    {
                        aggregateFunction.NumericAggregateFunction(AggregateFunction.Sum);
                        aggregateFunction.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString())
                            ? string.Empty : string.Format("{0:n0}", obj));
                    });
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <SalaryNoteForReport>(x => x.SalaryValue);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Right);
                    column.IsVisible(true);
                    column.Order(9);
                    column.Width(2);
                    column.HeaderCell("Salary Value (kVND)");
                    column.ColumnItemsTemplate(template =>
                    {
                        template.TextBlock();
                        template.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString())
                                                            ? string.Empty : string.Format("{0:n0}", obj));
                    });
                    column.AggregateFunction(aggregateFunction =>
                    {
                        aggregateFunction.NumericAggregateFunction(AggregateFunction.Sum);
                        aggregateFunction.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString())
                                                            ? string.Empty : string.Format("{0:n0}", obj));
                    });
                });
            })
                   .MainTableEvents(events =>
            {
                events.DataSourceIsEmpty(message: "There is no data available to display.");
            })
                   .Export(export =>
            {
                export.ToExcel();
                export.ToCsv();
                export.ToXml();
            })
                   .Generate(data => data.AsPdfFile(string.Format("{0}\\Salary-Report-{1}.pdf", folderName, Guid.NewGuid().ToString("N")))));
        }
 public IPdfReportData CreateDayPdfReport(AdminwsOfCloudPOS unitofwork, string folderName)
 {
     throw new NotImplementedException();
 }
        public IPdfReportData CreateEntityPdfReport(AdminwsOfCloudPOS unitofwork, DateTime startTime, DateTime endTime, string folderName)
        {
            return(new PdfReport().DocumentPreferences(doc =>
            {
                doc.RunDirection(PdfRunDirection.LeftToRight);
                doc.Orientation(PageOrientation.Landscape);
                doc.PageSize(PdfPageSize.A4);
                doc.DocumentMetadata(new DocumentMetadata {
                    Author = "Asowell Restaurant", Application = "Asowell POS", Keywords = "IList Rpt.", Subject = "Report", Title = "Salary Entities Report"
                });
                doc.Compression(new CompressionSettings
                {
                    EnableCompression = true,
                    EnableFullCompression = true
                });
                doc.PrintingPreferences(new PrintingPreferences
                {
                    ShowPrintDialogAutomatically = true
                });
            })
                   .DefaultFonts(fonts =>
            {
                fonts.Path(System.IO.Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), "fonts\\arial.ttf"),
                           System.IO.Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), "fonts\\verdana.ttf"));
                fonts.Size(9);
                fonts.Color(System.Drawing.Color.Black);
            })
                   .PagesFooter(footer =>
            {
                footer.DefaultFooter(DateTime.Now.ToString("MM/dd/yyyy"));
            })
                   .PagesHeader(header =>
            {
                header.CacheHeader(cache: true); // It's a default setting to improve the performance.
                header.DefaultHeader(defaultHeader =>
                {
                    defaultHeader.RunDirection(PdfRunDirection.LeftToRight);
                    defaultHeader.ImagePath(System.IO.Path.Combine(AppPath.ApplicationPath, "Images\\logo.png"));
                    defaultHeader.Message("SALARY ENTITIES REPORT (" + startTime.ToShortDateString() + " - " + endTime.ToShortDateString() + ")");
                });
            })
                   .MainTableTemplate(template =>
            {
                template.BasicTemplate(BasicTemplate.BlackAndBlue2Template);
            })
                   .MainTablePreferences(table =>
            {
                table.ColumnsWidthsType(TableColumnWidthType.Relative);
                //table.NumberOfDataRowsPerPage(5);
            })
                   .MainTableDataSource(dataSource =>
            {
                var queryWithYear =
                    unitofwork.SalaryNoteRepository.Get(x =>
                                                        x.ForYear >= startTime.Year && x.ForYear <= endTime.Year).ToList();

                var queryWithStartTimeMonth =
                    queryWithYear.Where(x => (x.ForMonth >= startTime.Month && x.ForYear == startTime.Year) ||
                                        x.ForYear > startTime.Year).ToList();

                var queryWithEndTimeMonth =
                    queryWithStartTimeMonth.Where(x => (x.ForMonth <= endTime.Month && x.ForYear == endTime.Year) ||
                                                  x.ForYear < endTime.Year).ToList();

                List <SalaryEntityForReport> salaryEntityReportList = new List <SalaryEntityForReport>();
                foreach (var emp in unitofwork.EmployeeRepository.Get().ToList())
                {
                    var queryWithEmployee = queryWithEndTimeMonth.Where(x => x.EmpId.Equals(emp.EmpId));

                    double totalWorkHour = 0;
                    decimal totalSalary = 0;
                    foreach (var salNote in queryWithEmployee)
                    {
                        totalWorkHour += salNote.WorkHour;
                        totalSalary += salNote.SalaryValue;
                    }

                    var salaryEntity = new SalaryEntityForReport()
                    {
                        Id = emp.EmpId,
                        Name = emp.Name,
                        WorkHour = totalWorkHour,
                        Salary = totalSalary
                    };


                    salaryEntityReportList.Add(salaryEntity);
                }

                dataSource.StronglyTypedList(salaryEntityReportList);
            })
                   .MainTableSummarySettings(summarySettings =>
            {
                summarySettings.OverallSummarySettings("Summary");
                summarySettings.PreviousPageSummarySettings("Previous Page Summary");
                summarySettings.PageSummarySettings("Page Summary");
            })
                   .MainTableColumns(columns =>
            {
                columns.AddColumn(column =>
                {
                    column.PropertyName("rowNo");
                    column.IsRowNumber(true);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(0);
                    column.Width(1);
                    column.HeaderCell("#");
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <SalaryEntityForReport>(x => x.Id);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(1);
                    column.Width(3);
                    column.HeaderCell("ID", horizontalAlignment: HorizontalAlignment.Left);
                    column.Font(font =>
                    {
                        font.Size(10);
                        font.Color(System.Drawing.Color.Blue);
                    });
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <SalaryEntityForReport>(x => x.Name);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(2);
                    column.Width(3);
                    column.HeaderCell("Name", horizontalAlignment: HorizontalAlignment.Left);
                    column.Font(font =>
                    {
                        font.Size(10);
                        font.Color(System.Drawing.Color.Crimson);
                    });
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <SalaryEntityForReport>(x => x.WorkHour);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Right);
                    column.IsVisible(true);
                    column.Order(8);
                    column.Width(2);
                    column.HeaderCell("Work Hour(h)");
                    column.ColumnItemsTemplate(template =>
                    {
                        template.TextBlock();
                        template.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString())
                            ? string.Empty : string.Format("{0:n0}", obj));
                    });
                    //column.AggregateFunction(aggregateFunction =>
                    //{
                    //    aggregateFunction.NumericAggregateFunction(AggregateFunction.Sum);
                    //    aggregateFunction.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString())
                    //        ? string.Empty : string.Format("{0:n0}", obj));
                    //});
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <SalaryEntityForReport>(x => x.Salary);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Right);
                    column.IsVisible(true);
                    column.Order(9);
                    column.Width(2);
                    column.HeaderCell("Salary (kVND)");
                    column.ColumnItemsTemplate(template =>
                    {
                        template.TextBlock();
                        template.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString())
                                                            ? string.Empty : string.Format("{0:n0}", obj));
                    });
                    column.AggregateFunction(aggregateFunction =>
                    {
                        aggregateFunction.NumericAggregateFunction(AggregateFunction.Sum);
                        aggregateFunction.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString())
                                                            ? string.Empty : string.Format("{0:n0}", obj));
                    });
                });
            })
                   .MainTableEvents(events =>
            {
                events.DataSourceIsEmpty(message: "There is no data available to display.");
            })
                   .Export(export =>
            {
                export.ToExcel();
                export.ToCsv();
                export.ToXml();
            })
                   .Generate(data => data.AsPdfFile(string.Format("{0}\\Salary-EntityReport-{1}.pdf", folderName, Guid.NewGuid().ToString("N")))));
        }
        public IPdfReportData CreateDetailsPdfReport(AdminwsOfCloudPOS unitofwork, DateTime startTime, DateTime endTime, string folderName)
        {
            return(new PdfReport().DocumentPreferences(doc =>
            {
                doc.RunDirection(PdfRunDirection.LeftToRight);
                doc.Orientation(PageOrientation.Landscape);
                doc.PageSize(PdfPageSize.A4);
                doc.DocumentMetadata(new DocumentMetadata {
                    Author = "Asowell Restaurant", Application = "Asowell POS", Keywords = "IList Rpt.", Subject = "Report", Title = "Salary Detail Report"
                });
                doc.Compression(new CompressionSettings
                {
                    EnableCompression = true,
                    EnableFullCompression = true
                });
                doc.PrintingPreferences(new PrintingPreferences
                {
                    ShowPrintDialogAutomatically = true
                });
            })
                   .DefaultFonts(fonts =>
            {
                fonts.Path(System.IO.Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), "fonts\\arial.ttf"),
                           System.IO.Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), "fonts\\verdana.ttf"));
                fonts.Size(9);
                fonts.Color(System.Drawing.Color.Black);
            })
                   .PagesFooter(footer =>
            {
                footer.DefaultFooter(DateTime.Now.ToString("MM/dd/yyyy"));
            })
                   .PagesHeader(header =>
            {
                header.CacheHeader(cache: true); // It's a default setting to improve the performance.
                header.DefaultHeader(defaultHeader =>
                {
                    defaultHeader.RunDirection(PdfRunDirection.LeftToRight);
                    defaultHeader.ImagePath(System.IO.Path.Combine(AppPath.ApplicationPath, "Images\\logo.png"));
                    defaultHeader.Message("Salary DETAILS REPORT (" + startTime.ToShortDateString() + " - " + endTime.ToShortDateString() + ")");
                });
            })
                   .MainTableTemplate(template =>
            {
                template.BasicTemplate(BasicTemplate.BlackAndBlue2Template);
            })
                   .MainTablePreferences(table =>
            {
                table.ColumnsWidthsType(TableColumnWidthType.Relative);
                //table.NumberOfDataRowsPerPage(20);
            })
                   .MainTableDataSource(dataSource =>
            {
                var queryWithYear =
                    unitofwork.WorkingHistoryRepository.Get(x =>
                                                            x.SalaryNote.ForYear >= startTime.Year && x.SalaryNote.ForYear <= endTime.Year).ToList();

                var queryWithStartTimeMonth =
                    queryWithYear.Where(x => (x.SalaryNote.ForMonth >= startTime.Month && x.SalaryNote.ForYear == startTime.Year) ||
                                        x.SalaryNote.ForYear > startTime.Year).ToList();

                var queryWithEndTimeMonth =
                    queryWithStartTimeMonth.Where(x => (x.SalaryNote.ForMonth <= endTime.Month && x.SalaryNote.ForYear == endTime.Year) ||
                                                  x.SalaryNote.ForYear < endTime.Year).ToList();

                dataSource.StronglyTypedList(queryWithEndTimeMonth);
            })
                   .MainTableSummarySettings(summarySettings =>
            {
                summarySettings.OverallSummarySettings("Summary");
                summarySettings.PreviousPageSummarySettings("Previous Page Summary");
                summarySettings.PageSummarySettings("Page Summary");
            })
                   .MainTableColumns(columns =>
            {
                columns.AddColumn(column =>
                {
                    column.PropertyName("rowNo");
                    column.IsRowNumber(true);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(0);
                    column.Width(1);
                    column.HeaderCell("#");
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <WorkingHistory>(x => x.WhId);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(1);
                    column.Width(3);
                    column.HeaderCell("WorkHistory ID", horizontalAlignment: HorizontalAlignment.Left);
                    column.Font(font =>
                    {
                        font.Size(10);
                        font.Color(System.Drawing.Color.Blue);
                    });
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <WorkingHistory>(x => x.ResultSalary);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(2);
                    column.Width(3);
                    column.HeaderCell("Salary ID", horizontalAlignment: HorizontalAlignment.Left);
                    column.Font(font =>
                    {
                        font.Size(10);
                        font.Color(System.Drawing.Color.Crimson);
                    });
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <WorkingHistory>(x => x.EmpId);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(3);
                    column.Width(3);
                    column.HeaderCell("Emp ID", horizontalAlignment: HorizontalAlignment.Left);
                    column.Font(font =>
                    {
                        font.Size(10);
                        font.Color(System.Drawing.Color.Crimson);
                    });
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <WorkingHistory>(x => x.Employee.Name);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Left);
                    column.IsVisible(true);
                    column.Order(4);
                    column.Width(3);
                    column.HeaderCell("Emp Name");
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <WorkingHistory>(x => x.StartTime);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(5);
                    column.Width(2);
                    column.HeaderCell("Start Time");
                });

                columns.AddColumn(column =>
                {
                    column.PropertyName <WorkingHistory>(x => x.EndTime);
                    column.CellsHorizontalAlignment(HorizontalAlignment.Center);
                    column.IsVisible(true);
                    column.Order(6);
                    column.Width(2);
                    column.HeaderCell("End Time");
                });
            })
                   .MainTableEvents(events =>
            {
                events.DataSourceIsEmpty(message: "There is no data available to display.");
            })
                   .Export(export =>
            {
                export.ToExcel();
                export.ToCsv();
                export.ToXml();
            })
                   .Generate(data => data.AsPdfFile(string.Format("{0}\\Salary-DetailsReport-{1}.pdf", folderName, Guid.NewGuid().ToString("N")))));
        }