Example #1
0
    private void Crew(int JobRno)
    {
        bool fFirst = true;

        string Sql =
            "Select * " +
            "From mcJobCrew Where JobRno = " + JobRno + " " +
            "Order By ReportTime, CrewSeq";

        try
        {
            DataTable dt = db.DataTable(Sql);
            foreach (DataRow dr in dt.Rows)
            {
                if (fFirst)
                {
                    fFirst = false;

                    Response.Write(
                        WebPage.HorizLine(6, "60%", 5) +
                        WebPage.Tabs(6) + WebPage.Table("width='300'") +
                        WebPage.Tabs(7) + "<tr>\n" +
                        WebPage.Tabs(8) + WebPage.Space(80, 1) +
                        WebPage.Tabs(8) + WebPage.Space(10, 1) +
                        WebPage.Tabs(8) + WebPage.Space(120, 1) +
                        WebPage.Tabs(8) + WebPage.Space(10, 1) +
                        WebPage.Tabs(8) + WebPage.Space(80, 1) +
                        WebPage.Tabs(7) + "</tr>\n" +
                        WebPage.Tabs(7) + "<tr><td colspan='5' align='left'><b>Crew Assignments</b></td></tr>\n"
                        );
                }

                string Html =
                    WebPage.Tabs(7) + "<tr>\n" +
                    WebPage.Tabs(8) + "<td align='right'>" + Fmt.Tm12Hr(DB.DtTm(dr["ReportTime"])) + "</td>\n" +
                    WebPage.Tabs(8) + "<td></td>\n" +
                    WebPage.Tabs(8) + "<td>" + DB.Str(dr["CrewMember"]) + "</td>\n" +
                    WebPage.Tabs(8) + "<td></td>\n" +
                    WebPage.Tabs(8) + "<td>" + DB.Str(dr["CrewAssignment"]) + "</td>\n" +
                    WebPage.Tabs(7) + "</tr>\n";

                string Note = DB.Str(dr["Note"]);
                if (Note.Length > 0)
                {
                    Html +=
                        WebPage.Tabs(7) + "<tr><td colspan='2'></td><td colspan='3' align='center'><i>" + Note + "</i></td></tr>\n";
                }

                Response.Write(Html);
            }
        }
        catch (Exception Ex)
        {
            Err Err = new Err(Ex, Sql);
            Response.Write(Err.Html());
        }

        Response.Write(
            WebPage.Tabs(6) + WebPage.TableEnd());
    }
Example #2
0
    public string FormatJob(DataRow dr)
    {
        string sReport     = Fmt.Tm12Hr(DB.DtTm(dr["ReportTime"]));
        string sReportNote = sReport;
        string sMeal       = Fmt.Tm12Hr(DB.DtTm(dr["MealTime"]));

        if (sReport.Length == 0)
        {
            if (sMeal.Length > 0)
            {
                sReport       = sMeal + "<sup>*</sup>";
                sReportNote   = sMeal;
                fNoReportTime = true;
            }
            else
            {
                sReport       = "N/A";
                sReportNote   = "N/A";
                fNoReportTime = false;
            }
        }


        string Html =
            WebPage.Tabs(3) + WebPage.Table("width='100%' class='NoBorder'") +
            WebPage.Tabs(4) + "<tr>\n" +
            WebPage.Tabs(5) + "<td><span class='CalMainTime'><a href='javascript:ShowJob(" + iJobNum + ");' title='Report Time: " + sReportNote + "\nMeal Time: " + sMeal + "\nClick to see details of this job.'>" + sReport + "</a></span></td>\n" +
            WebPage.Tabs(5) + "<td>&nbsp;</td>\n" +
            WebPage.Tabs(5) + "<td align='right'><span class='CalMinorTime'>" + sMeal + "</span></td>\n" +
            WebPage.Tabs(4) + "</tr>\n" +
            WebPage.Tabs(3) + WebPage.TableEnd() +
            WebPage.Tabs(3) + WebPage.Table("class='NoBorder'") +
            WebPage.Tabs(4) + WebPage.SpaceTr(10, 1) +
            (fMaster ? WebPage.Tabs(4) + "<tr><td colspan='2'><b>" + DB.Str(dr["CrewMember"]) + "</b></td></tr>\n" : "") +
            JobField(dr, "Customer") +
            JobField(dr, "CrewAssignment") +
            JobField(dr, "Note") +
            WebPage.Tabs(4) + "<tbody id='tblJob" + iJobNum + "' style='display: none;'>\n" +
            JobField(dr, "Location") +
            JobField(dr, "EventType") +
            JobField(dr, "ServiceType") +
            WebPage.Tabs(4) + "</tbody>\n" +
            WebPage.Tabs(3) + WebPage.TableEnd();

        iJobNum++;

        DateTime dtReport = DB.DtTm(dr["ReportTm"]);

        sReport = new DateTime(dtReport.Year, dtReport.Month, dtReport.Day, 0, 0, 0).ToString("M/d/yyyy");

        // if this date hasn't seen yet
        if (scDays.IndexOf(sReport) < 0)
        {
            scDays.Add(sReport);
            cDays++;
        }

        return(Html);
    }
Example #3
0
    private void JobInfo()
    {
        string Sql =
            "Select j.NumMenServing, j.NumWomenServing, j.NumChildServing, j.Status, j.EventType, j.ServiceType, j.Location, " +
            "j.PrintDirectionsFlg, j.LocationDirections, j.JobDate, j.MealTime, j.ArrivalTime, j.DepartureTime, j.PricePerPerson, " +
            "j.JobNotes, j." +
            "cu.Name as Customer, c.Name, c.Phone, c.Cell, c.Fax, c.Email, " +
            "From mcJobs j " +
            "Left Join Contacts c on j.ContactRno = c.ContactRno " +
            "Left Join Customers cu on c.CustomerRno = cu.CustomerRno " +
            "Where JobRno = " + JobRno;

        try
        {
            DataTable dt = db.DataTable(Sql);
            DataRow   r  = dt.Rows[0];

            Int32 cMen   = DB.Int32(r["NumMenServing"]);
            Int32 cWomen = DB.Int32(r["NumWomenServing"]);
            Int32 cChild = DB.Int32(r["NumChildServing"]);

            lblPrinted.Text   = String.Format("{0}", DateTime.Now);
            lblJobRno.Text    = JobRno.ToString();
            lblStatus.Text    = DB.Str(r["Status"]);
            lblCustomer.Text  = DB.Str(r["Customer"]);
            lblName.Text      = DB.Str(r["Name"]);
            lblPhone.Text     = DB.Str(r["Phone"]);
            lblCell.Text      = DB.Str(r["Cell"]);
            lblFax.Text       = DB.Str(r["Fax"]);
            lblEmail.Text     = DB.Str(r["Email"]);
            lblEventType.Text = DB.Str(r["EventType"]);
            lblServType.Text  = DB.Str(r["ServiceType"]);
            lblLocation.Text  = DB.Str(r["Location"]);
            if (DB.Bool(r["PrintDirectionsFlg"]))
            {
                lblDirections.Text = DB.Str(r["LocationDirections"]).Replace("\n", "<br>");
            }
            lblJobDate.Text         = Fmt.Dt(DB.DtTm(r["JobDate"]));
            lblMealTime.Text        = Fmt.Tm12Hr(DB.DtTm(r["MealTime"]));
            lblArrivalTime.Text     = Fmt.Tm12Hr(DB.DtTm(r["ArrivalTime"]));
            lblDepartureTime.Text   = Fmt.Tm12Hr(DB.DtTm(r["DepartureTime"]));
            lblNumServing.Text      = Fmt.Num(cMen + cWomen + cChild);
            lblNumMenServing.Text   = Fmt.Num(cMen);
            lblNumWomenServing.Text = Fmt.Num(cWomen);
            lblNumChildServing.Text = Fmt.Num(cChild);
            lblPricePerPerson.Text  = Fmt.Dollar(DB.Dec(r["PricePerPerson"]), false);
            lblJobNotes.Text        = DB.Str(r["JobNotes"]);
        }
        catch (Exception Ex)
        {
            Err Err = new Err(Ex, Sql);
            Response.Write(Err.Html());
        }
    }
Example #4
0
    private void JobInfo(int JobRno, DataRow dr)
    {
        int cMen      = DB.Int32(dr["NumMenServing"]);
        int cWomen    = DB.Int32(dr["NumWomenServing"]);
        int cChild    = DB.Int32(dr["NumChildServing"]);
        int cServings = cMen + cWomen + cChild;

        cJobServings = cServings;

        string sArrivalTime = Fmt.Tm12Hr(DB.DtTm(dr["ArrivalTime"]));
        string Demographics = DB.Str(dr["Demographics"]);
        string JobNotes     = DB.Str(dr["JobNotes"]);
        string ProdNotes    = DB.Str(dr["ProductionNotes"]);
        string Crew         = DB.Str(dr["Crew"]);

        Response.Write(
            //WebPage.Tabs(6) + WebPage.Table("width='300'") +
            WebPage.Tabs(6) + WebPage.Table() +
            WebPage.Tabs(7) + "<tr>\n" +
            WebPage.Tabs(8) + WebPage.NoSpace(60, 1) +
            WebPage.Tabs(8) + WebPage.NoSpace(8, 1) +
            WebPage.Tabs(8) + WebPage.NoSpace(130, 1) +
            WebPage.Tabs(7) + "</tr>\n" +
            Field(7, "Customer", DB.Str(dr["Customer"])) +
            Field(7, "Location", DB.Str(dr["Location"])) +
            Field(7, "Event Type", DB.Str(dr["EventType"])) +
            Field(7, WebPage.Span("Service Type", "RptNoticeTitle"), WebPage.Span(DB.Str(dr["ServiceType"]), "RptNotice")) +
            Field(7, WebPage.Span("Depart Time", "RptNoticeTitle"), WebPage.Span(Fmt.Tm12Hr(DB.DtTm(dr["DepartureTime"])), "RptNotice") + (sArrivalTime.Length > 0 ? "&nbsp;&nbsp; Arrival " + sArrivalTime : string.Empty)) +
            Field(7, "Guest Arrival", Fmt.Tm12Hr(DB.DtTm(dr["GuestArrivalTime"]))) +
            Field(7, "Meal Time", string.Format("{0} - {1}", Fmt.Tm12Hr(DB.DtTm(dr["MealTime"])), Fmt.Tm12Hr(DB.DtTm(dr["EndTime"])))) +
            //Field(7, WebPage.Span("# Servings", "RptNoticeTitle"), WebPage.Span(DB.Str(cServings), "RptNotice") + " (M " + cMen + ",  W " + cWomen + ",  C " + cChild + ")") +
            Field(7, WebPage.Span("# Servings", "RptNoticeTitle"), WebPage.Span(DB.Str(cServings), "RptNotice")) +
            (Demographics.Length > 0 ? Field(7, "Demographics", Demographics) : string.Empty) +
            Field(7, WebPage.Span("# Buffets", "RptNoticeTitle"), WebPage.Span(DB.Int32(dr["NumBuffets"]), "RptNotice")) +
            Field(7, "Job #", DB.Str(JobRno)) +
            //(JobNotes.Length > 0 ? Field(7, "Job Notes", JobNotes) : string.Empty) +
            (Crew.Length > 0 ? Field(7, "Crew", Crew) : string.Empty) +
            (ProdNotes.Length > 0 ? Field(7, "Prod Notes", ProdNotes) : string.Empty) +
            WebPage.Tabs(6) + WebPage.TableEnd()
            );
    }
Example #5
0
    protected void Crew()
    {
        string Sql =
            "Select * From mcJobCrew " +
            "Where JobRno = " + JobRno + " " +
            "Order By CrewSeq";

        try
        {
            DataTable dt = db.DataTable(Sql);
            foreach (DataRow r in dt.Rows)
            {
                string Html =
                    "<tr>\n" +
                    "\t<td valign=\"top\" class=\"JobItem\">" + DB.Str(r["CrewMember"]) + "</d>\n" +
                    "\t<td></td>\n" +
                    "\t<td valign=\"top\">" + DB.Str(r["CrewAssignment"]) + "</d>\n" +
                    "\t<td></td>\n" +
                    "\t<td valign=\"top\" align=\"right\">" + Fmt.Tm12Hr(DB.DtTm(r["ReportTime"])) + "</d>\n" +
                    "</tr>\n";

                string Note = DB.Str(r["Note"]);
                if (Note.Length > 0)
                {
                    Html +=
                        "<tr>\n" +
                        "\t<td colspan=\"5\" align=\"left\"><img width=\"20\" height=\"1\" src=\"Images/Space.gif\"><i>" + Note + "</i></td>\n" +
                        "</tr>\n";
                }
                Response.Write(Html);
            }
        }
        catch (Exception Ex)
        {
            Err Err = new Err(Ex, Sql);
            Response.Write(Err.Html());
        }
    }
Example #6
0
    protected void PrintJobs()
    {
        DateTime PrevDate = DateTime.MinValue;
        int      cDays    = 0;
        int      cJobs    = 0;
        int      cServ    = 0;

        string SqlWhere = "";

        SqlWhere = DB.And(SqlWhere, "CreatedDtTm Between " + DB.PutDtTm(dtBeg) + " And " + DB.PutDtTm(dtEnd));

        string Sql =
            "Select * From mcJobs " +
            "Where " + SqlWhere +
            " Order By CreatedDtTm";

        try
        {
            DataTable dt = db.DataTable(Sql);
            foreach (DataRow dr in dt.Rows)
            {
                JobRno = DB.Int32(dr["JobRno"]);

                int      cMen      = DB.Int32(dr["NumMenServing"]);
                int      cWomen    = DB.Int32(dr["NumWomenServing"]);
                int      cChild    = DB.Int32(dr["NumChildServing"]);
                int      cServings = cMen + cWomen + cChild;
                DateTime JobDate   = DB.DtTm(dr["JobDate"]);

                if (JobDate != PrevDate)
                {
                    cDays++;
                    PrevDate = JobDate;
                }

                cJobs++;
                cServ += cServings;

                Response.Write(
                    WebPage.Tabs(1) + "<tr>\n" +
                    WebPage.Tabs(2) + "<td align='right'>" + Fmt.Dt(DB.DtTm(dr["CreatedDtTm"])) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right'>" + Fmt.Tm12Hr(DB.DtTm(dr["CreatedDtTm"])) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right'>" + Fmt.Dt(JobDate) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right'>" + Fmt.Tm12Hr(DB.DtTm(dr["DepartureTime"])) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right'>" + Fmt.Tm12Hr(DB.DtTm(dr["MealTime"])) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td>" + DB.Str(dr["Customer"]) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td>" + DB.Str(dr["EventType"]) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td>" + DB.Str(dr["ServiceType"]) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right'>" + Fmt.Num(cServings, false) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right' class='SmallPrint'>" + Fmt.Num(cMen, false) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right' class='SmallPrint'>" + Fmt.Num(cWomen, false) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right' class='SmallPrint'>" + Fmt.Num(cChild, false) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right' class='SmallPrint'>" + JobRno + "</td>\n" +
                    WebPage.Tabs(1) + "</tr>\n"
                    );
            }

            if (dt.Rows.Count == 0)
            {
                Response.Write("<br><br><div class='JobSubTitle' align='center'>No Jobs Found to Print</div>\n");
            }
        }
        catch (Exception Ex)
        {
            Err Err = new Err(Ex, Sql);
            Response.Write(Err.Html());
        }

        Response.Write(WebPage.Tabs(0) + WebPage.TableEnd());

        string sTotals = "<b>" + cDays + "</b> Dates,&nbsp;&nbsp;<b>" + cJobs + "</b> Jobs,&nbsp;&nbsp;<b>" + Fmt.Num(cServ) + "</b> Servings";

        Response.Write("<script language='javascript'>oSetStr('Totals', '" + sTotals + "');</script>\n");
    }
Example #7
0
    public string FormatJob(DataRow dr)
    {
        string sDepart     = Fmt.Tm12Hr(DB.DtTm(dr["DepartureTime"]));
        string sDepartNote = sDepart;
        string sMeal       = Fmt.Tm12Hr(DB.DtTm(dr["MealTime"]));
        Int32  cMen        = DB.Int32(dr["NumMenServing"]);
        Int32  cWomen      = DB.Int32(dr["NumWomenServing"]);
        Int32  cChild      = DB.Int32(dr["NumChildServing"]);

        if (sDepart.Length == 0)
        {
            if (sMeal.Length > 0)
            {
                sDepart       = sMeal + "<sup>*</sup>";
                sDepartNote   = sMeal;
                fNoDepartTime = true;
            }
            else
            {
                sDepart     = "N/A";                    // + "<sup>*</sup>";
                sDepartNote = "N/A";
                //					fNoDepartTime = true;
            }
        }


        string Html =
            WebPage.Tabs(3) + WebPage.Table("width='100%' class='NoBorder'") +
            WebPage.Tabs(4) + "<tr>\n" +
            WebPage.Tabs(5) + "<td><span class='CalMainTime'><a href='javascript:ShowJob(" + iJobNum + ");' title='Departure Time: " + sDepartNote + "\nMeal Time: " + sMeal + "\nClick to see details of this job.'>" + sDepart + "</a></span></td>\n" +
            WebPage.Tabs(5) + "<td>&nbsp;</td>\n" +
            WebPage.Tabs(5) + "<td align='right'><span class='CalMinorTime'>" + sMeal + "</span></td>\n" +
            WebPage.Tabs(4) + "</tr>\n" +
            WebPage.Tabs(3) + WebPage.TableEnd() +
            WebPage.Tabs(3) + WebPage.Table("class='NoBorder'") +
            WebPage.Tabs(4) + WebPage.SpaceTr(10, 1) +
            JobField(dr, "Customer") +
            WebPage.Tabs(4) + "<tbody id='tblJob" + iJobNum + "' style='display: none;'>\n" +
            JobField(dr, "Location") +
            JobField(dr, "EventType") +
            JobField(dr, "ServiceType") +
            WebPage.Tabs(4) + "<tr>\n" +
            WebPage.Tabs(5) + "<td>&bull;</td>\n" +
            WebPage.Tabs(5) + "<td>" +
            Fmt.Num(cMen + cWomen + cChild) +
            "<span class='RptSmall'>&nbsp;&nbsp;(M " + cMen +
            ",&nbsp;&nbsp;W " + cWomen +
            ",&nbsp;&nbsp;C " + cChild + ")</span></td>\n" +
            WebPage.Tabs(4) + "</tr>\n" +
            WebPage.Tabs(4) + "</tbody>\n" +
            WebPage.Tabs(3) + WebPage.TableEnd();

        iJobNum++;

        DateTime dtDepart = DB.DtTm(dr["DepartTime"]);

        sDepart = new DateTime(dtDepart.Year, dtDepart.Month, dtDepart.Day, 0, 0, 0).ToString("M/d/yyyy");

        // if this date hasn't seen yet
        if (scDays.IndexOf(sDepart) < 0)
        {
            scDays.Add(sDepart);
            cDays++;
        }

        return(Html);
    }
Example #8
0
    protected async Task Jobs()
    {
        // connect to sling, retrieve all the shifts and orgainize shifts into jobs
        await SetupSlingShifts();

        string JobDate = (rdoDay.Checked
            ? string.Format("= {0}", DB.PutDtTm(dtBeg))
            : string.Format("Between {0} And {1}", DB.PutDtTm(dtBeg), DB.PutDtTm(dtEnd)));
        string Sql = string.Format(
            "Select JobRno, JobDate, MealTime, Coalesce(cu.Name, c.Name) as Customer " +
            "From mcJobs j " +
            "Inner Join Contacts c On j.ContactRno = c.ContactRno " +
            "Left Join Customers cu on c.CustomerRno = cu.CustomerRno " +
            "Where JobDate {0} And IsNull(Crew, '') > '' Order By JobDate, MealTime",
            JobDate);

        Collection <Job> cJobs = new Collection <Job>();

        try
        {
            // gather information on the jobs;
            DataTable dt = db.DataTable(Sql);
            foreach (DataRow dr in dt.Rows)
            {
                int      JobRno   = DB.Int32(dr["JobRno"]);
                DateTime Date     = DB.DtTm(dr["JobDate"]);
                DateTime Time     = DB.DtTm(dr["MealTime"]);
                string   Customer = DB.Str(dr["Customer"]);

                Job Job;
                cJobs.Add(Job = new Job()
                {
                    JobRno = JobRno, Date = Date, Time = Time, Customer = Customer
                });

                // find the shifts connected with this job
                foreach (Sling.CalendarEvent Shift in Sling.Shifts)
                {
                    if (Job.JobRno == Shift.JobRno)
                    {
                        Job.cShifts.Add(Shift);
                    }
                }

                // sort shifts within this job, job lead in first shift
                Sling.SortShiftCrew(Job.cShifts);
                if (Job.cShifts.Count > 0 && Job.cShifts[0].User != null && Job.cShifts[0].User.ID != 0)
                {
                    Job.JobLeadUserID = Job.cShifts[0].User.ID;
                }
            }

            // track who the job leads are
            Collection <int> JobLeads = new Collection <int>();

            int[] JobsToSend = SendNoticeJobs();

            // show the jobs and leads
            int Count = 0;
            foreach (Job Job in cJobs)
            {
                if (Job.JobLeadUserID == 0)
                {
                    continue;
                }

                Sling.User JobLead     = Job.cShifts[0].User;
                string     JobLeadName = FormatCrew(Job.cShifts[0]);

                string Link = string.Empty;
                if (JobLeadName.Length > 0)
                {
                    Link = string.Format("<a href='JobLeadJobs.aspx?userid={0}' target='JobLead'>Jobs</a>", JobLead.ID);
                }

                TableCell td;
                TableRow  tr = new TableRow();
                tblJobs.Rows.Add(tr);

                tr.Cells.Add(new TableCell()
                {
                    CssClass = "JobRno", Text = Job.JobRno.ToString()
                });
                tr.Cells.Add(new TableCell()
                {
                    CssClass = "Date", Text = Fmt.Dt(Job.Date)
                });
                tr.Cells.Add(new TableCell()
                {
                    CssClass = "Time", Text = Fmt.Tm12Hr(Job.Time)
                });
                tr.Cells.Add(new TableCell()
                {
                    CssClass = "Customer", Text = Job.Customer
                });
                tr.Cells.Add(new TableCell()
                {
                    CssClass = "Crew", Text = JobLeadName
                });

                tr.Cells.Add(td = new TableCell()
                {
                    CssClass = "Send"
                });
                td.Controls.Add(Job.chkSend = new CheckBox()
                {
                    ID = "chkSend" + ++Count
                });
                Job.chkSend.Checked = (!fSendNotices || SendToJob(JobsToSend, Job.JobRno));

                tr.Cells.Add(new TableCell()
                {
                    CssClass = "Link", Text = Link
                });
                tr.Cells.Add(td = new TableCell()
                {
                    CssClass = "Notice"
                });
                td.Controls.Add(Job.lblNotice = new Label());

                if (fSendNotices && Job.chkSend.Checked)
                {
                    AddJobLead(JobLeads, Job.JobLeadUserID);
                }
            }

            // send the actual notices
            if (fSendNotices)
            {
                // for each job lead
                foreach (int JobLeadUserID in JobLeads)
                {
                    bool   fFirst    = true;
                    string Note      = string.Empty;
                    string FirstName = string.Empty;
                    string LastName  = string.Empty;

                    // look through the jobs for this job lead
                    // put all the jobs for this job lead
                    foreach (Job Job in cJobs)
                    {
                        if (Job.JobLeadUserID == JobLeadUserID && Job.chkSend.Checked)
                        {
                            if (!fFirst)
                            {
                                Note += "----------------------------------------\n";
                            }
                            fFirst = false;
                            Note  += string.Format("Job #: {0}\\nDate: {1}\\nTime: {2}\\nCustomer: {3}\\n{4}://{5}{6}{7}?userid={8}",
                                                   Job.JobRno,
                                                   Fmt.Dt(Job.Date),
                                                   Fmt.Tm12Hr(Job.Time),
                                                   Job.Customer,
                                                   Request.Url.Scheme,
                                                   Request.Url.Host,
                                                   (Request.Url.Port == 80 || Request.Url.Port == 403 ? "" : ":" + Request.Url.Port),
                                                   ResolveUrl("~/JobLeadJobs.aspx"),
                                                   JobLeadUserID);
                            Job.lblNotice.Text = "Sent";

                            FirstName = Job.cShifts[0].User.FirstName;
                            LastName  = Job.cShifts[0].User.LastName;
                        }
                    }

                    string Msg = string.Format(
                        "{{" +
                        "\"content\": \"{0}\"," +
                        "\"name\": \"{1} {2}\"," +
                        "\"personas\": [{{" +
                        "\"id\": {3}," +
                        "\"type\": \"user\"" +
                        "}}]," +
                        "\"private\": true" +
                        "}}",
                        Note,
                        FirstName,
                        LastName,
                        JobLeadUserID);

                    // send the message
                    await Sling.AddToPrivateConversation(Msg);
                }
            }
        }
        catch (Exception Ex)
        {
            Err Err = new Err(Ex, Sql);
            Response.Write(Err.Html());
        }
    }
Example #9
0
    //protected void ReportData(FoodType eFoodType, ref DataTable dt)
    protected void ReportData(ref DataTable dt, int KitchenLocRno, string KitchenLocation)
    {
        //this.eFoodType = eFoodType;
        DateTime PrevDate       = DateTime.MinValue;
        DateTime PrevDepartTime = DateTime.MinValue;
        int      cDays          = 0;
        int      cJobs          = 0;
        int      cServ          = 0;

        foreach (DataRow dr in dt.Rows)
        {
            int      JobRno     = DB.Int32(dr["JobRno"]);
            DateTime JobDate    = DB.DtTm(dr["JobDate"]);
            DateTime DepartTime = DB.DtTm(dr["DepartTime"]);

            if (JobDate != PrevDate || DepartTime.Hour < 12 && !(PrevDepartTime.Hour < 12) || DepartTime.Hour >= 12 && !(PrevDepartTime.Hour >= 12))
            {
                if (JobDate != PrevDate)
                {
                    cDays++;
                    PrevDate = JobDate;
                }
                PrevDepartTime = DepartTime;

                if (!fSummaryOnly)
                {
                    DayHeader(JobDate, DepartTime.Hour < 12, DepartTime.Hour >= 12, KitchenLocation);
                }
            }

            if (fSummaryOnly)
            {
                //int JobRno = DB.Int32(dr["JobRno"]);
                int cMen      = DB.Int32(dr["NumMenServing"]);
                int cWomen    = DB.Int32(dr["NumWomenServing"]);
                int cChild    = DB.Int32(dr["NumChildServing"]);
                int cServings = cMen + cWomen + cChild;

                cJobs++;
                cServ += cServings;

                Response.Write(
                    WebPage.Tabs(1) + "<tr>\n" +
                    WebPage.Tabs(2) + "<td align='right'>" + Fmt.Dt(DB.DtTm(dr["JobDate"])) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right'>" + Fmt.Tm12Hr(DB.DtTm(dr["DepartureTime"])) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right'>" + Fmt.Tm12Hr(DB.DtTm(dr["MealTime"])) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td>" + DB.Str(dr["Customer"]) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td>" + DB.Str(dr["EventType"]) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td>" + DB.Str(dr["ServiceType"]) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right'>" + Fmt.Num(cServings, false) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right' class='SmallPrint'>" + Fmt.Num(cMen, false) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right' class='SmallPrint'>" + Fmt.Num(cWomen, false) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right' class='SmallPrint'>" + Fmt.Num(cChild, false) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right' class='SmallPrint'>" + JobRno + "</td>\n" +
                    WebPage.Tabs(1) + "</tr>\n"
                    );
            }
            else
            {
                //DayHeader(dtCurr);	//each job at the top of the page
                JobData(dr, KitchenLocRno);
            }
        }

        //if (dt.Rows.Count > 0)
        //{
        //    cDays++;
        //}


        if (fSummaryOnly)
        {
            Response.Write(WebPage.Tabs(0) + WebPage.TableEnd());

            string sTotals = "<b>" + cDays + "</b> Dates,&nbsp;&nbsp;<b>" + cJobs + "</b> Jobs,&nbsp;&nbsp;<b>" + Fmt.Num(cServ) + "</b> Servings";
            Response.Write("<script language='javascript'>oSetStr('Totals', '" + sTotals + "');</script>\n");
        }
    }
Example #10
0
    protected void GetShoppingList()
    {
        string Sql = String.Format(
            "Select i.Category, i.Name As Ingredient, " +
            "Coalesce(f.Qty, NumMenServing + NumWomenServing + NumChildServing) As Qty, " +
            "r.OneServQty, i.OrderUnits, j.JobDate, j.Customer, " +
            "Coalesce(j.MealTime, j.ArrivalTime, j.DepartureTime) As JobTime " +
            "From mcJobs j " +
            "Inner Join mcJobFood f On j.JobRno = f.JobRno " +
            "Inner Join mcJobMenuItems m On f.MenuItem = m.MenuItem " +
            "Inner Join Recipes r On m.MenuItemRno = r.MenuItemRno " +
            "Inner Join Ingredients i On r.IngredRno = i.IngredRno " +
            "Where JobDate Between {0} And {1} " +
            "And CancelledDtTm Is Null " +
            "Order By i.Category, i.Name, j.JobDate, JobTime, j.Customer",
            DB.PutDtTm(dtBeg),
            DB.PutDtTm(dtEnd));

        try
        {
            string PrevCategory   = null;
            string PrevIngredient = null;
            string FirstCategory  = "First";

            DataTable dt = db.DataTable(Sql);
            for (int iRow = 0; iRow < dt.Rows.Count; iRow++)
            {
                DataRow dr         = dt.Rows[iRow];
                string  Category   = DB.Str(dr["Category"]);
                string  Ingredient = GetIngredient(ref dr);

                int Qty;

                if (Ingredient != PrevIngredient)
                {
                    decimal PerServing = DB.Dec(dr["OneServQty"]);
                    string  Units      = DB.Str(dr["OrderUnits"]);

                    int iBeg  = iRow;
                    int cQty  = 0;
                    int cJobs = 0;

                    PrevIngredient = Ingredient;

                    while (Ingredient == PrevIngredient && iRow < dt.Rows.Count)
                    {
                        Qty = DB.Int32(dr["Qty"]);

                        cQty += Qty;
                        cJobs++;

                        if (++iRow < dt.Rows.Count)
                        {
                            dr         = dt.Rows[iRow];
                            Ingredient = GetIngredient(ref dr);
                        }
                    }

                    decimal PurchaseQty = cQty * PerServing;

                    string sClass    = (Category == PrevCategory ? "" : " class=\"" + FirstCategory + "RptCategory\"");
                    string sCategory = (Category == PrevCategory ? "" : "<b>" + Category + "</b>");

                    Response.Write(
                        WebPage.Tabs(1) + "<tr" + sClass + ">\n" +
                        WebPage.Tabs(2) + "<td>" + sCategory + "</td>\n" +
                        WebPage.Tabs(2) + "<td valign='top' align='right'><img src='Images/Diamond.gif' class='RptBullet'></td>\n" +
                        WebPage.Tabs(2) + "<td colspan='6' class='JobItem'><a href='javascript:ShowDtl(" + iDtl + ", " + (iDtl + cJobs - 1) + ");'>" + PrevIngredient + "</a></td>\n" +
                        WebPage.Tabs(2) + "<td></td>\n" +
                        WebPage.Tabs(2) + "<td align='right'>" + Fmt.Num(cJobs, false) + "</td>\n" +
                        WebPage.Tabs(2) + "<td></td>\n" +
                        WebPage.Tabs(2) + "<td align='right' class='RptNotice'>" + Fmt.Num(cQty, false) + "</td>\n" +
                        WebPage.Tabs(2) + "<td></td>\n" +
                        WebPage.Tabs(2) + "<td align='right'>" + Str.ShowFract(PerServing) + " " + Units + "</td>\n" +
                        WebPage.Tabs(2) + "<td></td>\n" +
                        WebPage.Tabs(2) + "<td align='right' class='RptNotice'>" + Fmt.Num((int)Math.Ceiling(PurchaseQty), false) + " " + Units + "</td>\n" +
                        WebPage.Tabs(2) + "<td></td>\n" +
                        WebPage.Tabs(2) + "<td class='StoreNote'>&nbsp;</td>\n" +
                        WebPage.Tabs(1) + "</tr>\n"
                        );

                    if (sClass != "")
                    {
                        FirstCategory = "";
                    }

                    iRow = iBeg;
                }

                dr         = dt.Rows[iRow];
                Ingredient = GetIngredient(ref dr);
                Qty        = DB.Int32(dr["Qty"]);

                Response.Write(
                    WebPage.Tabs(1) + "<tr id='Dtl" + iDtl++ + "' style='display: none;'>\n" +
                    WebPage.Tabs(2) + "<td colspan='3'></td>\n" +
                    WebPage.Tabs(2) + "<td>" + Fmt.Dt(DB.DtTm(dr["JobDate"])) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right'>" + Fmt.Tm12Hr(DB.DtTm(dr["JobTime"])) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td>" + DB.Str(dr["Customer"]) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right'>" + Fmt.Num(Qty, false) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right'></td>\n" +
                    WebPage.Tabs(1) + "</tr>\n"
                    );

                PrevIngredient = Ingredient;
                PrevCategory   = Category;
            }
        }
        catch (Exception Ex)
        {
            Err Err = new Err(Ex, Sql);
            Response.Write(Err.Html());
        }
    }
Example #11
0
    protected void MenuCategory(string Category)
    {
        //FoodCategories FoodCat = new FoodCategories();
        //string Sql = String.Format(
        //    "Select Category, MenuItem, JobDate, Customer, " +
        //    "Coalesce(MealTime, ArrivalTime, DepartureTime) As JobTime, " +
        //    "NumMenServing, NumWomenServing, NumChildServing, Qty " +
        //    "From mcJobs j Inner Join mcJobFood f On j.JobRno = f.JobRno " +
        //    "Where JobDate Between {0} And {1} " +
        //    "And Category {2} " +
        //    "And CancelledDtTm Is Null " +
        //    "Order By Category, MenuItem, JobDate, JobTime, Customer",
        //    DB.PutDtTm(dtBeg),
        //    DB.PutDtTm(dtEnd),
        //    (Category.Length > 0 ?
        //    "= " + DB.PutStr(Category) :
        //    //"Not In ('Meats', 'Soup', 'Pasta', 'Sandwich', 'Appetizers', 'Sides', 'Salads', 'Bread', 'Desserts', 'Drink')"));
        //    "Not In (" + FoodCat.SqlList(FoodCategories.Type.Hot) + ", " + FoodCat.SqlList(FoodCategories.Type.Cold) + ")"));
        string Sql = String.Format(
            "Select Category, MenuItem, JobDate, Coalesce(cu.Name, c.Name) as Customer, " +
            "Coalesce(MealTime, ArrivalTime, DepartureTime) As JobTime, " +
            "NumMenServing, NumWomenServing, NumChildServing, Qty " +
            "From mcJobs j " +
            "Inner Join Contacts c On j.ContactRno = c.ContactRno " +
            "Left Join Customers cu on c.CustomerRno = cu.CustomerRno " +
            "Inner Join mcJobFood f On j.JobRno = f.JobRno " +
            "Where JobDate Between {0} And {1} " +
            "And IsNull(ProposalFlg, 0) = 0 " +
            "And CancelledDtTm Is Null " +
            "And Trim(MenuItem) <> '' " +
            "Order By Category, MenuItem, JobDate, JobTime, Customer",
            DB.PutDtTm(dtBeg),
            DB.PutDtTm(dtEnd));

        try
        {
            string PrevCategory  = null;
            string PrevMenuItem  = null;
            string FirstCategory = "First";

            DataTable dt = db.DataTable(Sql);
            for (int iRow = 0; iRow < dt.Rows.Count; iRow++)
            {
                DataRow dr = dt.Rows[iRow];
                Category = DB.Str(dr["Category"]);
                string MenuItem = GetMenuItem(ref dr);

                int Men;
                int Women;
                int Child;
                int Servings;
                int Qty;

                if (MenuItem != PrevMenuItem)
                {
                    int iBeg = iRow;
                    //int cQty = 0;
                    int cServing = 0;
                    int cMen     = 0;
                    int cWomen   = 0;
                    int cChild   = 0;
                    int cJobs    = 0;

                    PrevMenuItem = MenuItem;

                    while (MenuItem == PrevMenuItem && iRow < dt.Rows.Count)
                    {
                        Qty   = DB.Int32(dr["Qty"]);
                        Men   = DB.Int32(dr["NumMenServing"]);
                        Women = DB.Int32(dr["NumWomenServing"]);
                        Child = DB.Int32(dr["NumChildServing"]);

                        cMen     += Men;
                        cWomen   += Women;
                        cChild   += Child;
                        cServing += (Qty != 0 ? Qty : Men + Women + Child);
                        //cQty += Qty;
                        cJobs++;

                        if (++iRow < dt.Rows.Count)
                        {
                            dr       = dt.Rows[iRow];
                            MenuItem = GetMenuItem(ref dr);
                        }
                    }

                    string sClass    = (Category == PrevCategory ? "" : " class=\"" + FirstCategory + "RptCategory\"");
                    string sCategory = (Category == PrevCategory ? "" : "<b>" + Category + "</b>");

                    Response.Write(
                        WebPage.Tabs(1) + "<tr" + sClass + ">\n" +
                        WebPage.Tabs(2) + "<td>" + sCategory + "</td>\n" +
                        WebPage.Tabs(2) + "<td valign='top' align='right'><img src='Images/Diamond.gif' class='RptBullet'></td>\n" +
                        WebPage.Tabs(2) + "<td colspan='6' class='JobItem'><a href='javascript:ShowDtl(" + iDtl + ", " + (iDtl + cJobs - 1) + ");'>" + PrevMenuItem + "</a></td>\n" +
                        WebPage.Tabs(2) + "<td></td>\n" +
                        WebPage.Tabs(2) + "<td align='right' class='RptNotice'>" + Fmt.Num(cServing, false) + "</td>\n" +
                        WebPage.Tabs(2) + "<td></td>\n" +
                        //WebPage.Tabs(2) + "<td align='right'>" + Fmt.Num(cMen, false) + "</td>\n" +
                        //WebPage.Tabs(2) + "<td></td>\n" +
                        //WebPage.Tabs(2) + "<td align='right'>" + Fmt.Num(cWomen, false) + "</td>\n" +
                        //WebPage.Tabs(2) + "<td></td>\n" +
                        //WebPage.Tabs(2) + "<td align='right'>" + Fmt.Num(cChild, false) + "</td>\n" +
                        //WebPage.Tabs(2) + "<td></td>\n" +
                        WebPage.Tabs(2) + "<td align='right' class='RptNotice'>" + Fmt.Num(cJobs, false) + "</td>\n" +
                        WebPage.Tabs(1) + "</tr>\n"
                        );

                    if (sClass != "")
                    {
                        FirstCategory = "";
                    }

                    iRow = iBeg;
                }

                dr       = dt.Rows[iRow];
                MenuItem = GetMenuItem(ref dr);
                Men      = DB.Int32(dr["NumMenServing"]);
                Women    = DB.Int32(dr["NumWomenServing"]);
                Child    = DB.Int32(dr["NumChildServing"]);
                Servings = Men + Women + Child;
                Qty      = DB.Int32(dr["Qty"]);

                Response.Write(
                    WebPage.Tabs(1) + "<tr id='Dtl" + iDtl++ + "' style='display: none;'>\n" +
                    WebPage.Tabs(2) + "<td colspan='3'></td>\n" +
                    WebPage.Tabs(2) + "<td>" + Fmt.Dt(DB.DtTm(dr["JobDate"])) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right'>" + Fmt.Tm12Hr(DB.DtTm(dr["JobTime"])) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td>" + DB.Str(dr["Customer"]) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right'>" + Fmt.Num((Qty != 0 ? Qty : Servings), false) + "</td>\n" +
                    WebPage.Tabs(2) + "<td></td>\n" +
                    //WebPage.Tabs(2) + "<td align='right' class='RptSmall'>" + Fmt.Num(Men, false) + "</td>\n" +
                    //WebPage.Tabs(2) + "<td></td>\n" +
                    //WebPage.Tabs(2) + "<td align='right' class='RptSmall'>" + Fmt.Num(Women, false) + "</td>\n" +
                    //WebPage.Tabs(2) + "<td></td>\n" +
                    //WebPage.Tabs(2) + "<td align='right' class='RptSmall'>" + Fmt.Num(Child, false) + "</td>\n" +
                    //WebPage.Tabs(2) + "<td></td>\n" +
                    WebPage.Tabs(2) + "<td align='right'></td>\n" +
                    WebPage.Tabs(1) + "</tr>\n"
                    );

                PrevMenuItem = MenuItem;
                PrevCategory = Category;
            }
        }
        catch (Exception Ex)
        {
            Err Err = new Err(Ex, Sql);
            Response.Write(Err.Html());
        }
    }
Example #12
0
    //private String FindTextBox(ref TableRow tr, String ID)
    //{
    //	String Text = "";

    //	try
    //	{
    //		Control Ctrl = tr.FindControl(ID);
    //		if (Ctrl != null)
    //		{
    //			TextBox txtBox = new TextBox();
    //			HtmlInputHidden txtHidden = new HtmlInputHidden();

    //			if (Ctrl.GetType() == txtBox.GetType())
    //			{
    //				txtBox = (TextBox)Ctrl;
    //				Text = txtBox.Text.Trim();
    //			}
    //			else
    //				if (Ctrl.GetType() == txtHidden.GetType())
    //				{
    //					txtHidden = (HtmlInputHidden)Ctrl;
    //					Text = txtHidden.Value.Trim();
    //				}
    //		}
    //	}
    //	catch (Exception Ex)
    //	{
    //		Err Err = new Err(Ex);
    //		Response.Write(Err.Html());
    //	}

    //	return Text;
    //}

    private void LoadCrew()
    {
        if (JobRno > 0)
        {
            String Sql = "";

            try
            {
                Sql =
                    "Select f1.CrewSeq " +
                    "From mcJobCrew f1 Inner Join mcJobCrew f2 " +
                    "On f1.JobRno = f2.JobRno And f1.CrewSeq <> f2.CrewSeq " +
                    "And f1.CrewMember = f2.CrewMember " +
                    "Where f1.JobRno = " + JobRno;
                DupSeq Dups = new DupSeq(db, Sql);

                Sql = "Select * From mcJobCrew Where JobRno = " + JobRno + " Order By CrewSeq";
                DataTable dt = db.DataTable(Sql);
                cCrew = dt.Rows.Count + 1;
                AddLines();

                int iRow = 0;
                foreach (DataRow dr in dt.Rows)
                {
                    iRow++;
                    TableRow tr = tblCrew.Rows[iRow];

                    HtmlInputHidden txtCrewSeq = (HtmlInputHidden)tr.FindControl("txtCrewSeq" + iRow);
                    txtCrewSeq.Value = DB.Str(dr["CrewSeq"]);

                    TextBox txtCrewMember     = (TextBox)tr.FindControl("txtCrewMember" + iRow);
                    TextBox txtOrigCrewMember = (TextBox)tr.FindControl("txtOrigCrewMember" + iRow);
                    txtCrewMember.Text         =
                        txtOrigCrewMember.Text = DB.Str(dr["CrewMember"]);
                    txtCrewMember.CssClass     = (Dups.In(DB.Int32(dr["CrewSeq"])) ? "Dup" : "") + "CrewMember";

                    TextBox txtAssignment     = (TextBox)tr.FindControl("txtAssignment" + iRow);
                    TextBox txtOrigAssignment = (TextBox)tr.FindControl("txtOrigAssignment" + iRow);
                    txtAssignment.Text         =
                        txtOrigAssignment.Text = DB.Str(dr["CrewAssignment"]);

                    TextBox txtReportTime     = (TextBox)tr.FindControl("txtReportTime" + iRow);
                    TextBox txtOrigReportTime = (TextBox)tr.FindControl("txtOrigReportTime" + iRow);
                    txtReportTime.Text         =
                        txtOrigReportTime.Text = Fmt.Tm12Hr(DB.DtTm(dr["ReportTime"]));

                    TextBox txtNote     = (TextBox)tr.FindControl("txtNote" + iRow);
                    TextBox txtOrigNote = (TextBox)tr.FindControl("txtOrigNote" + iRow);
                    txtNote.Text         =
                        txtOrigNote.Text = DB.Str(dr["Note"]);
                }
            }
            catch (Exception Ex)
            {
                Err Err = new Err(Ex, Sql);
                Response.Write(Err.Html());
            }
        }
        else
        {
            cCrew = 1;
            AddLines();
        }

        if (FocusField.Length == 0)
        {
            FocusField = "txtCrewMember" + cCrew;
        }
        else
        {
            FocusField += cCrew - 1;
        }
    }