Esempio n. 1
0
        private void btnPRINT_Click(object sender, EventArgs e)
        {
            if (CARDHOLDERID == 0 || cboxCARDHOLDER.Text == "" || cboxCARDHOLDER.Text == "All")
            {
                List <AccessLogReport> ListaREP = _context.AccessLogs.Where(w => w.LocalTime >= dateTimePicker1.Value.Date && w.LocalTime <= dateTimePicker2.Value.Date).Select(s =>
                                                                                                                                                                                new AccessLogReport
                {
                    name     = s.Cardholder.Name,
                    checkIN  = s.Direction,
                    checkOUT = s.Direction,
                    date     = s.LocalTime.Value
                }).ToList();

                frmREPORT frmREPORT = new frmREPORT(ListaREP, "Check IN/OUT report");
                frmREPORT.ShowDialog();
            }
            else
            {
                List <AccessLogReport> ListaREP = _context.AccessLogs.Where(w => w.CardholderID == CARDHOLDERID && w.LocalTime >= dateTimePicker1.Value.Date && w.LocalTime <= dateTimePicker2.Value.Date).Select(s =>
                                                                                                                                                                                                                  new AccessLogReport
                {
                    name     = s.Cardholder.Name,
                    checkIN  = s.Direction,
                    checkOUT = s.Direction,
                    date     = s.LocalTime.Value
                }).ToList();

                frmREPORT frmREPORT = new frmREPORT(ListaREP, "Check IN/OUT report");
                frmREPORT.ShowDialog();
            }
        }
        private void btnPRINT_Click(object sender, EventArgs e)
        {
            if (cboxCARDHOLDER.Text == "" || cboxCARDHOLDER.Text == "All" || cboxCARDHOLDER.Text == "AcessLog" || cboxCARDHOLDER.Text == "New")
            {
                if (FIRMID != 0)
                {
                    List <LogExceptionReport> ListaREP = _context.LogExceptions.Where(w => w.Cardholder.FirmID == FIRMID && w.LogExceptionDate >= dateTimePicker1.Value.Date && w.LogExceptionDate <= dateTimePicker2.Value.Date).Select(s =>
                                                                                                                                                                                                                                         new LogExceptionReport
                    {
                        name     = s.Cardholder.Name,
                        date     = s.LogExceptionDate.Value,
                        worktime = s.Worktime,
                        imefirme = s.Cardholder.Firm.Name
                    }).ToList();

                    frmREPORT frmREPORT = new frmREPORT(ListaREP, "Time attendance report");
                    frmREPORT.ShowDialog();
                }
                else
                {
                    List <LogExceptionReport> ListaREP = _context.LogExceptions.Where(w => w.LogExceptionDate >= dateTimePicker1.Value.Date && w.LogExceptionDate <= dateTimePicker2.Value.Date).Select(s =>
                                                                                                                                                                                                        new LogExceptionReport
                    {
                        name     = s.Cardholder.Name,
                        date     = s.LogExceptionDate.Value,
                        worktime = s.Worktime,
                        imefirme = s.Cardholder.Firm.Name
                    }).OrderBy(o => o.name).ToList();

                    frmREPORT frmREPORT = new frmREPORT(ListaREP, "Time attendance report");
                    frmREPORT.ShowDialog();
                }
            }
            else
            {
                List <LogExceptionReport> ListaREP = _context.LogExceptions.Where(w => w.CardholderID == CARDHOLDERID && w.LogExceptionDate >= dateTimePicker1.Value.Date && w.LogExceptionDate <= dateTimePicker2.Value.Date).Select(s =>
                                                                                                                                                                                                                                      new LogExceptionReport
                {
                    name     = s.Cardholder.Name,
                    date     = s.LogExceptionDate.Value,
                    worktime = s.Worktime,
                    imefirme = s.Cardholder.Firm.Name
                }).ToList();

                frmREPORT frmREPORT = new frmREPORT(ListaREP, "Time attendance report");
                frmREPORT.ShowDialog();
            }
        }