示例#1
0
 void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
 {
     if (Uploader)
     {
         HtmlDocument doc = this.webBrowser1.Document;
         //this.webBrowser1.Focus();
         SendKeys.Send("{TAB}" + "{TAB}" + VWA4Common.GlobalSettings.CurrentSiteName);
         //SendKeys.Send("{TAB}" + VWA4Common.GlobalSettings.PrimaryUserName);
         //SendKeys.Send("{TAB}" + VWA4Common.GlobalSettings.PrimaryUserEmail);
         SendKeys.Send("{TAB}" + VWA4Common.AppContext.DBPathName);
         webBrowser1.Show();
         HtmlElement textBox = doc.GetElementsByTagName("input")["f3"];
         //todo: need to set the attribute to the path name
         //textBox.SetAttribute("value", "c:\\temp\\");
         //textBox.SetAttribute("name", "name");
         //textBox.SetAttribute("text", "text");
         // Check the task complete
         VWA4Common.UtilitiesInstance utils = new VWA4Common.UtilitiesInstance();
         utils.setTaskCheck(DateTime.Parse(VWA4Common.GlobalSettings.StartDateOfSelectedWeek, CultureInfo.GetCultureInfo("en-US"), System.Globalization.DateTimeStyles.None), true, "uploadwastedata");
     }
     else
     {
         // Don't send any keys
         HtmlDocument doc = this.webBrowser1.Document;
         webBrowser1.Show();
     }
 }
示例#2
0
 private void viewer1_OnToolClick(object sender, DataDynamics.ActiveReports.Toolbar.ToolClickEventArgs e)
 {
     if (e.Tool.Caption == "&Print...")
     {
         if (_TaskName == "SWAT Agenda")
         {
             VWA4Common.UtilitiesInstance utils = new VWA4Common.UtilitiesInstance();
             utils.setTaskCheck(DateTime.Parse(VWA4Common.GlobalSettings.StartDateOfSelectedWeek), true, "printswatform");
         }
         else if (_TaskName == "Staff Mtg. Agenda")
         {
             VWA4Common.UtilitiesInstance utils = new VWA4Common.UtilitiesInstance();
             utils.setTaskCheck(DateTime.Parse(VWA4Common.GlobalSettings.StartDateOfSelectedWeek), true, "printmeetingscript");
         }
     }
 }
示例#3
0
        private void ultraGrid1_AfterRowUpdate(object sender, RowEventArgs e)
        {
            if (this.ultraGrid1.ActiveRow.IsAddRow)
            {
                return;
            }
            CellsCollection row = null;

            if (this.ultraGrid1.ActiveRow != null)
            {
                row = this.ultraGrid1.ActiveRow.Cells;
                row["SiteID"].Value           = VWA4Common.GlobalSettings.CurrentSiteID;
                row["PeriodUniqueName"].Value = "Month";
                if (row["PeriodStartDate"].Value == null)
                {
                    MessageBox.Show("Period start date is required.");
                    return;
                }
            }

            //ultraGrid1.UpdateData();
            if (row != null)
            {
                decimal fca = row["FoodCostActual"].Value != DBNull.Value ? Convert.ToDecimal(row["FoodCostActual"].Value) : Convert.ToDecimal(0.00);
                decimal fcb = row["FoodCostBudget"].Value != DBNull.Value ? Convert.ToDecimal(row["FoodCostBudget"].Value) : Convert.ToDecimal(0.00);
                decimal fra = row["FoodRevenueActual"].Value != DBNull.Value ? Convert.ToDecimal(row["FoodRevenueActual"].Value) : Convert.ToDecimal(0.00);
                decimal frb = row["FoodRevenueBudget"].Value != DBNull.Value ? Convert.ToDecimal(row["FoodRevenueBudget"].Value) : Convert.ToDecimal(0.00);
                int     mca = row["MealCountActual"].Value != DBNull.Value ? Convert.ToInt32(row["MealCountActual"].Value) : 0;
                int     mcb = row["MealCountBudget"].Value != DBNull.Value ? Convert.ToInt32(row["MealCountBudget"].Value) : 0;

                this.updateFinancialData(fca, fcb, fra, frb, mca, mcb, row["PeriodUniqueName"].Value.ToString(), DateTime.Parse(row["PeriodStartDate"].Value.ToString()));
            }

            if (this.ultraGrid1.ActiveRow != null && this.ultraGrid1.ActiveRow.Cells["ID"].Value != DBNull.Value)
            {
                ultraGrid1.DataSource = VWA4Common.DB.Retrieve(sql);
                Initialized           = true;
                ultraGrid1.Refresh();
            }

            // Check the task complete
            VWA4Common.UtilitiesInstance utils = new VWA4Common.UtilitiesInstance();
            utils.setTaskCheck(DateTime.Parse(VWA4Common.GlobalSettings.StartDateOfSelectedWeek), true, "entermonthlyfinancials");
        }
示例#4
0
        private void bSave_Click(object sender, EventArgs e)
        {
            // First check to see if there is already a record for this site/date

            //
            // Load SWAT minutes for current week
            //
            string sql = "SELECT * FROM SWATMinutes WHERE (WeekStart >= #"
                         + DateTime.Parse(VWA4Common.GlobalSettings.StartDateOfSelectedWeek).ToString("yyyy/MM/dd 00:00:00") + "#) AND (WeekStart < #"
                         + DateTime.Parse(VWA4Common.GlobalSettings.StartDateOfSelectedWeek).AddDays(7).ToString("yyyy/MM/dd 00:00:00") + "#) AND (SiteID = "
                         + VWA4Common.GlobalSettings.CurrentSiteID.ToString() + ")"
            ;
            DataTable dt_result = VWA4Common.DB.Retrieve(sql);

            if (dt_result.Rows.Count > 0)
            {             // An entry for this week exists - update it
                DataRow row = dt_result.Rows[0];
                _CurrentID = int.Parse(row["ID"].ToString());
                sql        = "UPDATE SWATMinutes SET "
                             + " SiteID=" + VWA4Common.GlobalSettings.CurrentSiteID.ToString() + ","
                             + " WeekStart=#" + VWA4Common.GlobalSettings.StartDateOfSelectedWeek + "#,"
                             + " AwardUserID='" + UserTypeID + "',"
                             + " AwardType='" + tePartAward.Text + "',"
                             + " ParticipationRating=" + (rgRateWeeklyPart.SelectedIndex + 1).ToString() + ","
                             + " GoalsRating=" + (rgRateProgressGoals.SelectedIndex + 1).ToString() + ","
                             + " Top10Review='" + teTop10ReviewNotes.Text + "',"
                             + " GoalsReview='" + teWhatCanWeDo.Text + "',"
                             + " KeySuccess='" + teKeySuccess.Text + "',"
                             + " AwardReason='" + teAwardReason.Text + "'"
                             + " WHERE ID=" + row["ID"].ToString();
                VWA4Common.DB.Update(sql);
            }
            else
            {             // No entry - insert one
                sql = "INSERT INTO SWATMinutes (SiteID,WeekStart,AwardUserID,"
                      + "AwardType,ParticipationRating,GoalsRating,Top10Review,"
                      + "GoalsReview,KeySuccess,AwardReason)"
                      + " VALUES('"
                      + VWA4Common.GlobalSettings.CurrentSiteID.ToString()
                      + "',#" + VWA4Common.GlobalSettings.StartDateOfSelectedWeek + "#"
                      + ",'" + UserTypeID + "'"
                      + ",'" + tePartAward.Text + "'"
                      + "," + (rgRateWeeklyPart.SelectedIndex + 1).ToString()
                      + "," + (rgRateProgressGoals.SelectedIndex + 1).ToString()
                      + ",'" + teTop10ReviewNotes.Text + "'"
                      + ",'" + teWhatCanWeDo.Text + "'"
                      + ",'" + teKeySuccess.Text + "'"
                      + ",'" + teAwardReason.Text + "'"
                      + ")"
                ;
                //sql = sql.Replace("\'", "\'\'");
                _CurrentID = VWA4Common.DB.Insert(sql);
            }
            bCancel.Hide();
            bSave.Hide();
            // Check the task complete
            VWA4Common.UtilitiesInstance utils = new VWA4Common.UtilitiesInstance();
            utils.setTaskCheck(DateTime.Parse(VWA4Common.GlobalSettings.StartDateOfSelectedWeek), true, "enterswatminutes");

            btnPrint.Visible = true;
            //commonEvents.TaskSheetKey = "dashboard";
        }
示例#5
0
        private void btnPrintReportSet_Click(object sender, EventArgs e)
        {
            VWA4Common.GlobalSettings.PrintViewReportsProgressCancelled = false;
            //get the count of selected rows and drop each starting at the dropIndex
            //this.Cursor = Cursors.WaitCursor;
            try
            {
                //pf = new VWA4Common.ProgressForm();
                //pf.SetupAndShow(this.ParentForm, "Printing Reports", "Creating Report List...", true, true);
                int pd_left = (this.Left + ParentForm.Left) + this.Width / 2;
                int pd_top  = (this.Top + ParentForm.Top) + this.Height / 2;



                VWA4Common.ProgressDialog.ShowProgressDialog("Looking for Reports' Names.", "", "", pd_left, pd_top);

                frmReportViewer frmReports   = new frmReportViewer();
                frmReportViewer frmViewWaste = new frmReportViewer();

                VWA4Common.ProgressDialog.SetLeadin("Report List created");
                VWA4Common.ProgressDialog.SetLeadin("Report List inited");
                bool isViewWaste = false, isReports = false;

                btnPrintReportSet.Enabled = false;

                int nRows = 0, nReports = 1;

                if (ultraGrid1.Selected.Rows.Count > 0)
                {
                    nRows = ultraGrid1.Selected.Rows.Count;
                }
                else
                {
                    nRows = ultraGrid1.Rows.Count;
                }

                double progressTick = (nRows > 0 ? 100 / nRows : 1);
                VWA4Common.ProgressDialog.SetLeadin("Generating Reports");
                try
                {
                    if (ultraGrid1.Selected.Rows.Count > 0)
                    {
                        foreach (UltraGridRow aRow in ultraGrid1.Selected.Rows)
                        {
                            VWA4Common.ProgressDialog.SetStatus("Generating report " + nReports + " of " + nRows, (int)(nReports * progressTick));
                            if (VWA4Common.ProgressDialog.CancelPressed)
                            {
                                VWA4Common.ProgressDialog.CancelPressed = false;

                                btnPrintReportSet.Enabled = true;
                                return;
                            }

                            int id = int.Parse(aRow.Cells["ReportMemorized.ID"].Value.ToString());
                            if (aRow.Cells["ReportType"].Value.ToString() == "View Waste")
                            {
                                frmViewWaste.AddPrint(id);
                                isViewWaste = true;
                            }
                            else
                            {
                                frmReports.AddPrint(id, true);
                                isReports = true;
                            }
                            nReports++;
                        }
                    }
                    else
                    {
                        foreach (UltraGridRow aRow in ultraGrid1.Rows)
                        {
                            VWA4Common.ProgressDialog.SetStatus("Generating report " + nReports + " of " + nRows, (int)(nReports * progressTick));

                            if (VWA4Common.ProgressDialog.CancelPressed)
                            {
                                VWA4Common.ProgressDialog.CancelPressed = false;

                                btnPrintReportSet.Enabled = true;
                                return;
                            }

                            int id = int.Parse(aRow.Cells["ReportMemorized.ID"].Value.ToString());
                            if (aRow.Cells["ReportType"].Value.ToString() == "View Waste")
                            {
                                frmViewWaste.AddPrint(id);
                                isViewWaste = true;
                            }
                            else
                            {
                                frmReports.AddPrint(id, true);
                                isReports = true;
                            }
                            nReports++;
                        }
                    }

                    //FinishProgress();
                }
                finally
                {
                    FinishProgress();
                    btnPrintReportSet.Enabled = true;
                }

                //this.Cursor = Cursors.Default;
                if (isReports)
                {
                    frmReports.Print();
                }
                if (isViewWaste)
                {
                    frmViewWaste.Print();
                }
                if (_IsWeekly)
                {
                    //set checkbox in task
                    VWA4Common.UtilitiesInstance utils = new VWA4Common.UtilitiesInstance();
                    utils.setTaskCheck(DateTime.Parse(VWA4Common.GlobalSettings.StartDateOfSelectedWeek), true, "printweeklyreports");
                }
            }
            catch (Exception ex)
            {
                //Note cancellation throws an exception
                MessageBox.Show(ex.Message);
            }
        }
示例#6
0
        //private void GenerateViewReports()
        //{
        //    frmReportViewer frmReports = new frmReportViewer();
        //    frmReportViewer frmViewWaste = new frmReportViewer();
        //    bool isReports = false;
        //    int nViewWaste = 0;
        //    pf.Visible = true;
        //    pf.Value = 0;
        //    //get the count of selected rows and drop each starting at the dropIndex
        //    if (ultraGrid1.Selected.Rows.Count > 0)
        //    {
        //        pf.Maximum = ultraGrid1.Selected.Rows.Count;
        //        foreach (UltraGridRow aRow in ultraGrid1.Selected.Rows)
        //        {

        //            int id = int.Parse(aRow.Cells["ReportMemorized.ID"].Value.ToString());
        //            if (aRow.Cells["ReportType"].Value.ToString() == "View Waste")
        //            {
        //                frmViewWaste.AddPDF(id);
        //                nViewWaste++;
        //            }
        //            else
        //            {
        //                frmReports.AddLoadParameters(id, true);
        //                isReports = true;
        //            }

        //            pf.PerformStep();
        //        }
        //    }
        //    else
        //    {
        //        pf.Maximum = ultraGrid1.Rows.Count;
        //        foreach (UltraGridRow aRow in ultraGrid1.Rows)
        //        {

        //            int id = int.Parse(aRow.Cells["ReportMemorized.ID"].Value.ToString());
        //            if (aRow.Cells["ReportType"].Value.ToString() == "View Waste")
        //            {
        //                frmViewWaste.AddPDF(id);
        //                nViewWaste++;
        //            }
        //            else
        //            {
        //                frmReports.AddLoadParameters(id, true);
        //                isReports = true;
        //            }

        //            pf.PerformStep();
        //        }
        //    }
        //    if (isReports)
        //    {
        //        frmReports.SetTitle(ultraGrid1.Rows[0].Cells["SerieName"].Value.ToString());
        //        frmReports.View();
        //        frmReports.Show();
        //    }
        //    if (nViewWaste > 0)
        //    {
        //        if (nViewWaste > 1)
        //        {
        //            DialogResult result = ShowSavePDF();
        //            if (result == DialogResult.Cancel)
        //                return;
        //            string fileName = this.saveFileDialog1.FileName;
        //            frmViewWaste.ShowPDF(fileName);
        //        }
        //        else
        //        {
        //            frmViewWaste.View();
        //            frmViewWaste.Show();
        //        }
        //    }
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show(ex.Message);
        //    }
        //}

        private void btnViewReportSet_Click(object sender, EventArgs e)
        {
            VWA4Common.GlobalSettings.PrintViewReportsProgressCancelled = false;
            try
            {
                //pf = new VWA4Common.ProgressForm();
                //pf.SetupAndShow(this.ParentForm, "Showing Reports", "Creating Report List...", true, true);
                int pd_left = (this.Left + ParentForm.Left) + this.Width / 2;
                int pd_top  = (this.Top + ParentForm.Top) + this.Height / 2;



                VWA4Common.ProgressDialog.ShowProgressDialog("Looking for Reports' Names.", "", "", pd_left, pd_top);
                frmReportViewer frmReports = new frmReportViewer();
                frmReportViewer frmViewWaste = new frmReportViewer();
                int             nRows = 0, nReports = 1;

                if (ultraGrid1.Selected.Rows.Count > 0)
                {
                    nRows = ultraGrid1.Selected.Rows.Count;
                }
                else
                {
                    nRows = ultraGrid1.Rows.Count;
                }


                btnViewReportSet.Enabled = false;


                VWA4Common.ProgressDialog.SetLeadin("Report List created");

                VWA4Common.ProgressDialog.SetLeadin("Report List created");
                bool isReports  = false;
                int  nViewWaste = 0;

                double progressTick = (nRows > 0 ? 100 / nRows : 1);
                VWA4Common.ProgressDialog.SetLeadin("Generating Reports");
                try
                {
                    VWA4Common.ProgressDialog.SetStatus("Generating report " + nReports + " of " + nRows, (int)(nReports * progressTick));
                    //get the count of selected rows and drop each starting at the dropIndex
                    if (ultraGrid1.Selected.Rows.Count > 0)
                    {
                        foreach (UltraGridRow aRow in ultraGrid1.Selected.Rows)
                        {
                            if (_progressCancelled)
                            {
                                btnViewReportSet.Enabled = true;
                                return;
                            }
                            VWA4Common.ProgressDialog.SetStatus("Generating report " + nReports + " of " + nRows, (int)(nReports * progressTick));
                            int id = int.Parse(aRow.Cells["ReportMemorized.ID"].Value.ToString());
                            if (aRow.Cells["ReportType"].Value.ToString() == "View Waste")
                            {
                                frmViewWaste.AddPDF(id);
                                nViewWaste++;
                            }
                            else
                            {
                                frmReports.AddLoadParameters(id, true);
                                isReports = true;
                            }
                            nReports++;
                        }
                    }
                    else
                    {
                        foreach (UltraGridRow aRow in ultraGrid1.Rows)
                        {
                            if (_progressCancelled)
                            {
                                btnViewReportSet.Enabled = true;
                                return;
                            }
                            VWA4Common.ProgressDialog.SetStatus("Generating report " + nReports + " of " + nRows, (int)(nReports * progressTick));
                            int id = int.Parse(aRow.Cells["ReportMemorized.ID"].Value.ToString());
                            if (aRow.Cells["ReportType"].Value.ToString() == "View Waste")
                            {
                                frmViewWaste.AddPDF(id);
                                nViewWaste++;
                            }
                            else
                            {
                                frmReports.AddLoadParameters(id, true);
                                isReports = true;
                            }
                            nReports++;
                        }
                    }
                }
                finally
                {
                    FinishProgress();
                    btnViewReportSet.Enabled = true;
                }
                //FinishProgress();

                //btnViewReportSet.Enabled = true;

                if (isReports)
                {
                    frmReports.SetTitle(ultraGrid1.Rows[0].Cells["SerieName"].Value.ToString());
                    frmReports.View();
                    frmReports.Show();
                }
                if (nViewWaste > 0)
                {
                    if (nViewWaste > 1)
                    {
                        DialogResult result = ShowSavePDF();
                        if (result == DialogResult.Cancel)
                        {
                            return;
                        }
                        string fileName = this.saveFileDialog1.FileName;
                        frmViewWaste.ShowPDF(fileName);
                    }
                    else
                    {
                        frmViewWaste.View();
                        frmViewWaste.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            if (!_IsWeekly)
            {
                //set checkbox in task
                VWA4Common.UtilitiesInstance utils = new VWA4Common.UtilitiesInstance();
                utils.setTaskCheck(DateTime.Parse(VWA4Common.GlobalSettings.StartDateOfSelectedWeek), true, "reviewreports");
            }
        }
示例#7
0
        private void btnViewReportSet_Click(object sender, EventArgs e)
        {
            SetReportOrder();
            frmReportViewer frmReports   = new frmReportViewer();
            frmReportViewer frmViewWaste = new frmReportViewer();
            bool            isReports    = false;
            int             nViewWaste   = 0;

            this.Cursor = Cursors.WaitCursor;

            bool isWeekly = false;

            //get the count of selected rows and drop each starting at the dropIndex
            foreach (UltraGridRow aRow in ultraGrid1.Selected.Rows)
            {
                isWeekly = Regex.IsMatch(aRow.Cells["SerieName"].Value.ToString(), "weekly", RegexOptions.IgnoreCase);
                if (aRow.Band.Key == "ReportSet")
                {
                    int id = int.Parse(aRow.Cells["ReportMemorized.ID"].Value.ToString());
                    if (aRow.Cells["ReportType"].Value.ToString() == "View Waste")
                    {
                        frmViewWaste.AddPDF(id);
                        nViewWaste++;
                    }
                    else
                    {
                        frmReports.AddLoadParameters(id, isWeekly);
                        isReports = true;
                    }
                }
                else
                {
                    DataView view = _ReportSeries.Tables["ReportSet"].DefaultView;
                    view.RowFilter = "ReportSeries.ID = " + aRow.Cells["ID"].Value;
                    view.Sort      = "Order";
                    foreach (DataRowView viewRow in view)
                    {
                        if (viewRow["ReportMemorized.ID"].ToString() != "")
                        {
                            int id = int.Parse(viewRow["ReportMemorized.ID"].ToString());
                            if (viewRow["ReportType"].ToString() == "View Waste")
                            {
                                frmViewWaste.AddPDF(id);
                                nViewWaste++;
                            }
                            else
                            {
                                frmReports.AddLoadParameters(id, isWeekly);
                                isReports = true;
                            }
                        }
                    }
                }
            }
            this.Cursor = Cursors.Default;
            if (isReports)
            {
                frmReports.SetTitle(ultraGrid1.Rows[0].Cells["SerieName"].Value.ToString());
                frmReports.View();
                frmReports.Show();
            }
            if (nViewWaste > 0)
            {
                if (nViewWaste > 1)
                {
                    DialogResult result = ShowSavePDF();
                    if (result == DialogResult.Cancel)
                    {
                        return;
                    }
                    string fileName = this.saveFileDialog1.FileName;
                    frmViewWaste.ShowPDF(fileName);
                }
                else
                {
                    frmViewWaste.View();
                    frmViewWaste.Show();
                }
            }

            // set task checkboxes
            VWA4Common.UtilitiesInstance utils = new VWA4Common.UtilitiesInstance();
            utils.setTaskCheck(DateTime.Parse(VWA4Common.GlobalSettings.StartDateOfSelectedWeek), true, "reviewreports");
        }