Beispiel #1
0
 public ActionResult Index([Bind(Include = "ReportType,StartDate,EndDate,EmployeeName")] AdminReport adminreport)
 {
     if (adminreport.ReportType == reporttype.TOTALHOUR)
     {
         int hours = countHour(adminreport);
         if (hours == -1)
         {
             Response.Write("<script>alert('找不到该员工!')</script>");
             return(View(adminreport));
         }
         adminreport.TotalHour = hours;
         ADMINREPORT           = adminreport;
         return(RedirectToAction("HourReport"));
     }
     else
     {
         decimal salary = countSalary(adminreport);
         if (salary == -1)
         {
             Response.Write("<script>alert('找不到该员工!')</script>");
             return(View(adminreport));
         }
         adminreport.Salary = salary;
         adminreport.Year   = adminreport.EndDate.Year;
         ADMINREPORT        = adminreport;
         return(RedirectToAction("SalaryReport"));
     }
 }
Beispiel #2
0
        public ActionResult YearWiseReport(AdminReport report)
        {
            string category = report.category;

            int year = report.year;

            TempData["year"] = year;


            if (category == "Institution Scholarship Provided")
            {
                return(RedirectToAction("InstitutionScholarshipProvided", "Admin"));
            }
            else if (category == "Student Availing Scholarship Institution")
            {
                return(RedirectToAction("StudentAvailingScholarshipInstitution", "Admin"));
            }
            else if (category == "Scholarship Provider(NGO)")
            {
                return(RedirectToAction("ScholarshipProviderNGO", "Admin"));
            }
            else if (category == "Student Awaiting for Scholarship")
            {
                return(RedirectToAction("StudentAwaitingforScholarship", "Admin"));
            }
            else if (category == "Student Benefited (NGO)")
            {
                return(RedirectToAction("StudentBenefitedNGO", "Admin"));
            }
            return(View());
        }
Beispiel #3
0
        //计算年度累计薪水
        private decimal countSalary(AdminReport adminreport)
        {
            var myemail = from m in db.Employees
                          where m.Name == adminreport.EmployeeName
                          select m;

            if (myemail.Count() == 0)//找不到员工姓名,返回-1
            {
                return(-1);
            }
            string temp     = myemail.First().Email;
            var    payrolls = from p in db.PayRolls
                              where p.EmployeeName == temp
                              select p;
            decimal totalsalary = 0;

            foreach (PayRoll p in payrolls)
            {
                if (p.PayDate.Year == adminreport.EndDate.Year && DateTime.Compare(p.PayDate, adminreport.EndDate) <= 0)
                {
                    totalsalary += p.Salary;
                }
            }
            return(totalsalary);
        }
Beispiel #4
0
        //计算累计工时
        private int countHour(AdminReport adminreport)
        {
            var myemail = from m in db.Employees
                          where m.Name == adminreport.EmployeeName
                          select m;

            if (myemail.Count() == 0)//找不到员工姓名,返回-1
            {
                return(-1);
            }
            string temp      = myemail.First().Email;
            var    timecards = from t in db.Timecards
                               where t.EmployeeName == temp && t.isSubmitted != null
                               select t;
            int totalhour = 0;

            foreach (Timecard t in timecards)
            {
                if (DateTime.Compare(t.Date, adminreport.StartDate) >= 0 && DateTime.Compare(t.Date, adminreport.EndDate) <= 0)
                {
                    totalhour += t.Hours;
                }
            }
            return(totalhour);
        }
Beispiel #5
0
        private void showReportBbutton_Click(object sender, EventArgs e)
        {
            AdminReport adminReportForm = new AdminReport(_appointmentService);

            adminReportForm.Show();
            this.Hide();
            adminReportForm.FormClosed += Form_FormClosed;
        }
        public void generateReport(List <int> jenisPembayaran, List <int> kurir, List <int> kategori, List <int> promo, DateTime awal, DateTime akhir, int isofficial)
        {
            AdminReport     report = new AdminReport();
            ParameterValues pv     = new ParameterValues();
            ReportView      rv     = new ReportView(report);

            getKurir();
            getJenisPembayaran();
            getKategori();
            getPromo();
            //awal = awal.AddDays(-1);
            //akhir = akhir.AddDays(1);

            pv.Clear();
            foreach (int i in jenisPembayaran)
            {
                DataRow dr = dtJenisPembayaran.Rows[i];
                pv.Add(getParamVal(dr["ID"].ToString()));
            }
            rv.setParam("payment_Methods", pv);
            pv.Clear();
            foreach (int i in kurir)
            {
                DataRow dr = dtKurir.Rows[i];
                pv.Add(getParamVal(dr["ID"].ToString()));
            }
            rv.setParam("Kurirs", pv);
            pv.Clear();
            foreach (int i in kategori)
            {
                DataRow dr = dtKategori.Rows[i];
                pv.Add(getParamVal(dr["ID"].ToString()));
            }
            rv.setParam("Categories", pv);
            pv.Clear();
            //foreach (int i in promo)
            //{
            //    DataRow dr = dtPromo.Rows[i];
            //    pv.Add(getParamVal(dr["ID"].ToString()));
            //}
            //rv.setParam("Promos", pv);
            //pv.Clear();

            string path = (ImageHelper.getDebugPath() + "\\Resource\\Items\\");

            pv.Add(getParamVal(path));
            rv.setParam("imageParam", pv);

            ParameterRangeValue paramTanggal = new ParameterRangeValue();

            // Setup nilai start
            paramTanggal.StartValue = awal;
            // Setup nilai end
            paramTanggal.EndValue = akhir;
            // pasang paramter tanggal saya ke dalam rpt
            rv.setParam("DateBetween", paramTanggal);
            rv.setParam("awal", awal);
            rv.setParam("akhir", akhir);
            pv.Clear();
            if (isofficial == 0)
            {
                pv.Add(getParamVal("0"));
                pv.Add(getParamVal("1"));
            }
            else if (isofficial == 1)
            {
                pv.Add(getParamVal("1"));
            }
            else
            {
                pv.Add(getParamVal("0"));
            }

            rv.setParam("SellerTypes", pv);

            rv.ShowDialog();
        }
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            //Compare the results per account, and see if there is a difference
            if (!ParentWorkflow.InternalParameters.ContainsKey("CSVResults"))
            {
                throw new Exception("Could not find the results from the CSV file.");
            }

            if (!ParentWorkflow.InternalParameters.ContainsKey("OLTPResults"))
            {
                throw new Exception("Could not find the results from the OLTP database.");
            }

            Hashtable csv       = (Hashtable)ParentWorkflow.InternalParameters["CSVResults"];
            Hashtable oltp      = (Hashtable)ParentWorkflow.InternalParameters["OLTPResults"];
            Hashtable panorama  = null;
            Hashtable boResults = null;

            if (ParentWorkflow.InternalParameters.ContainsKey("PanoramaCSVResults"))
            {
                panorama = (Hashtable)ParentWorkflow.InternalParameters["PanoramaCSVResults"];
            }

            if (ParentWorkflow.InternalParameters.ContainsKey("BOResults"))
            {
                boResults = (Hashtable)ParentWorkflow.InternalParameters["BOResults"];
            }

            IDictionaryEnumerator ide = csv.GetEnumerator();

            while (ide.MoveNext())
            {
                AccountAllMeasures csvRecord = (AccountAllMeasures)ide.Value;

                //Get the account ID based on the name of the account from the CSV.
                int accountID = -1;
                try
                {
                    accountID = AccountAllMeasures.FromAccountName(ide.Key.ToString());
                }
                catch (Exception ex)
                {
                    ex.ToString();
                }

                if (accountID <= 0)
                {
                    continue;
                }

                if (!oltp.ContainsKey(accountID))
                {
                    //If we couldn't find this account in the OLTP, this means
                    //we have no data about it.
                    DifferenceFound = true;
                }
                else
                {
                    AccountAllMeasures oltpRecord = (AccountAllMeasures)oltp[accountID];

                    //Check if we have a difference. Since we generate the report anyway,
                    //it means that this repoert will be sent to more people.
                    try
                    {
                        if (csvRecord.Different(oltpRecord))
                        {
                            DifferenceFound = true;
                        }
                    }
                    catch (Exception ex)
                    {
                        ex.ToString();
                        continue;
                    }
                }
            }

            if (DifferenceFound)
            {
                string rndEmail = "*****@*****.**";
                if (ParentWorkflow.Parameters.ContainsKey("RNDEmail"))
                {
                    rndEmail = ParentWorkflow.Parameters["RNDEmail"].ToString();
                }
                ParentWorkflow.InternalParameters.Add("Emails", rndEmail);
            }
            else
            {
                string itEmail = "*****@*****.**";
                if (ParentWorkflow.Parameters.ContainsKey("ITEmail"))
                {
                    itEmail = ParentWorkflow.Parameters["ITEmail"].ToString();
                }
                ParentWorkflow.InternalParameters.Add("Emails", itEmail);
            }

            if (!ParentWorkflow.Parameters.ContainsKey("AdminAlertTemplate"))
            {
                throw new Exception("Could not find alert template file.");
            }

            string templateFile = ParentWorkflow.Parameters["AdminAlertTemplate"].ToString();

            try
            {
                DateTime reportDate = DateTime.Now.AddDays(-1);
                if (ParentWorkflow.InternalParameters.ContainsKey("ReportDate"))
                {
                    reportDate = Convert.ToDateTime(ParentWorkflow.InternalParameters["ReportDate"]);
                }

                //Generate the excel report.
                AdminReport ar = new AdminReport(csv, oltp, panorama);
                if (boResults != null)
                {
                    ar.BOResults = boResults;
                }

                ar.Generate(templateFile, reportDate);

                ParentWorkflow.InternalParameters.Add("AccountName", "Edge Administration");
                ParentWorkflow.InternalParameters.Add("MessageFileName", ar.GeneratedReportFile);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception while trying to generate report. Exception: " + ex.ToString());
            }

            return(ActivityExecutionStatus.Closed);
        }