Esempio n. 1
0
        public static void ApplyEmployeeDayStyle(XRControl control, StoreDay storeDay, EmployeeDay employeeDay, long worldID, IRecordingContext context)
        {
            control.BackColor = Color.Transparent;

            ApplyStoreDayStyle(control, storeDay);

            if (employeeDay != null)
            {
                if (employeeDay.CountDailyAdditionalCharges > 0)
                {
                    control.BackColor = Color.Yellow;
                }
                else if (employeeDay.StoreWorldId != worldID || employeeDay.HasLongAbsence || !employeeDay.HasRelation)
                {
                    control.BackColor = Color.Gray;

                    if (employeeDay.HasLongAbsence)
                    {
                        int? color = context.LongAbsences.GetColor(employeeDay.LongAbsenceId);
                        if (color.HasValue)
                            control.BackColor = Color.FromArgb(color.Value);
                        //control.ForeColor = Color.Black;
                    }
                }
            }
        }
Esempio n. 2
0
        public static void DrawCell(long storeid, IRecordingContext context, EmployeeDay epd, GraphicsCache cache, Rectangle rect, bool bFocused)
        {
            if (context == null) return;
            if (epd == null) return;
            if (cache == null) return;

            StoreDay sd = context.StoreDays[epd.Date];
            DrawBackgroundWeekDayCell(storeid,sd, epd, cache, rect, context.StoreWorldId, bFocused, context.LongAbsences.GetColor (epd.LongAbsenceId ));
            DrawWeekDayContent(sd, epd, cache, rect, context);
        }
        public void Init(IRecordingContext recordingContext, DateTime startDate, bool printPlannedValues, bool hideSums)
        {
            _recordingContext   = recordingContext;
            _printPlannedValues = printPlannedValues;
            _hideSums           = hideSums;

            XRTableRow captionRow    = tbl_DetailsCaption.Rows[0];
            XRTableRow firstDataRow  = tbl_WeekPlanningData.Rows[0];
            XRTableRow secondDataRow = tbl_WeekPlanningData.Rows[1];

            if (_hideSums)
            {
                while (captionRow.Cells.Count > 8)
                {
                    captionRow.Cells.RemoveAt(8);
                    firstDataRow.Cells.RemoveAt(8);
                    secondDataRow.Cells.RemoveAt(8);
                }

                int tblWidth  = tbl_DetailsCaption.Width;
                int cellWidth = Convert.ToInt32(tblWidth / 8.5);

                lbCell_Sunday.Width    = fieldCell_Sunday.Width = fieldCell_SundayPlanned.Width = cellWidth;
                lbCell_Friday.Width    = fieldCell_Friday.Width = fieldCell_FridayPlanned.Width = lbCell_Saturday.Right - lbCell_Friday.Left - cellWidth;
                lbCell_Thursday.Width  = fieldCell_Thursday.Width = fieldCell_ThursdayPlanned.Width = lbCell_Friday.Right - lbCell_Thursday.Left - cellWidth;
                lbCell_Wednesday.Width = fieldCell_Wednesday.Width = fieldCell_WednesdayPlanned.Width = lbCell_Thursday.Right - lbCell_Wednesday.Left - cellWidth;
                lbCell_Tuesday.Width   = fieldCell_Tuesday.Width = fieldCell_TuesdayPlanned.Width = lbCell_Wednesday.Right - lbCell_Tuesday.Left - cellWidth;
                lbCell_Monday.Width    = fieldCell_Monday.Width = fieldCell_MondayPlanned.Width = lbCell_Tuesday.Right - lbCell_Monday.Left - cellWidth;

                lbCell_Employee.Width    = tblWidth - cellWidth * 7;
                fieldCell_FullName.Width = fieldCell_FullName1.Width = lbCell_Employee.Width;
            }

            if (!_printPlannedValues)
            {
                tbl_WeekPlanningData.Rows.RemoveAt(0);
                Detail.Height = tbl_WeekPlanningData.Height;
            }

            lbCell_Monday.Tag    = fieldCell_Monday.Tag = fieldCell_MondayPlanned.Tag = startDate;
            lbCell_Tuesday.Tag   = fieldCell_Tuesday.Tag = fieldCell_TuesdayPlanned.Tag = startDate.AddDays(1);
            lbCell_Wednesday.Tag = fieldCell_Wednesday.Tag = fieldCell_WednesdayPlanned.Tag = startDate.AddDays(2);
            lbCell_Thursday.Tag  = fieldCell_Thursday.Tag = fieldCell_ThursdayPlanned.Tag = startDate.AddDays(3);
            lbCell_Friday.Tag    = fieldCell_Friday.Tag = fieldCell_FridayPlanned.Tag = startDate.AddDays(4);
            lbCell_Saturday.Tag  = fieldCell_Saturday.Tag = fieldCell_SaturdayPlanned.Tag = startDate.AddDays(5);
            lbCell_Sunday.Tag    = fieldCell_Sunday.Tag = fieldCell_SundayPlanned.Tag = startDate.AddDays(6);

            foreach (XRTableCell cell in new XRTableCell[] { lbCell_Monday, lbCell_Tuesday,
                                                             lbCell_Wednesday, lbCell_Thursday,
                                                             lbCell_Friday, lbCell_Saturday, lbCell_Sunday })
            {
                cell.Text = string.Format("{0}\n{1}", cell.Text, ((DateTime)cell.Tag).ToShortDateString());
            }
        }
        public void Init(IRecordingContext recordingContext, DateTime startDate, bool printPlannedValues, bool hideSums)
        {
            _recordingContext = recordingContext;
            _printPlannedValues = printPlannedValues;
            _hideSums = hideSums;

            XRTableRow captionRow = tbl_DetailsCaption.Rows[0];
            XRTableRow firstDataRow = tbl_WeekPlanningData.Rows[0];
            XRTableRow secondDataRow = tbl_WeekPlanningData.Rows[1];

            if (_hideSums)
            {
                while (captionRow.Cells.Count > 8)
                {
                    captionRow.Cells.RemoveAt(8);
                    firstDataRow.Cells.RemoveAt(8);
                    secondDataRow.Cells.RemoveAt(8);
                }

                int tblWidth = tbl_DetailsCaption.Width;
                int cellWidth = Convert.ToInt32(tblWidth / 8.5);

                lbCell_Sunday.Width = fieldCell_Sunday.Width = fieldCell_SundayPlanned.Width = cellWidth;
                lbCell_Friday.Width = fieldCell_Friday.Width = fieldCell_FridayPlanned.Width = lbCell_Saturday.Right - lbCell_Friday.Left - cellWidth;
                lbCell_Thursday.Width = fieldCell_Thursday.Width = fieldCell_ThursdayPlanned.Width = lbCell_Friday.Right - lbCell_Thursday.Left - cellWidth;
                lbCell_Wednesday.Width = fieldCell_Wednesday.Width = fieldCell_WednesdayPlanned.Width = lbCell_Thursday.Right - lbCell_Wednesday.Left - cellWidth;
                lbCell_Tuesday.Width = fieldCell_Tuesday.Width = fieldCell_TuesdayPlanned.Width = lbCell_Wednesday.Right - lbCell_Tuesday.Left - cellWidth;
                lbCell_Monday.Width = fieldCell_Monday.Width = fieldCell_MondayPlanned.Width = lbCell_Tuesday.Right - lbCell_Monday.Left - cellWidth;

                lbCell_Employee.Width = tblWidth - cellWidth * 7;
                fieldCell_FullName.Width = fieldCell_FullName1.Width = lbCell_Employee.Width;
            }

            if (!_printPlannedValues)
            {
                tbl_WeekPlanningData.Rows.RemoveAt(0);
                Detail.Height = tbl_WeekPlanningData.Height;
            }

            lbCell_Monday.Tag = fieldCell_Monday.Tag = fieldCell_MondayPlanned.Tag = startDate;
            lbCell_Tuesday.Tag = fieldCell_Tuesday.Tag = fieldCell_TuesdayPlanned.Tag = startDate.AddDays(1);
            lbCell_Wednesday.Tag = fieldCell_Wednesday.Tag = fieldCell_WednesdayPlanned.Tag = startDate.AddDays(2);
            lbCell_Thursday.Tag = fieldCell_Thursday.Tag = fieldCell_ThursdayPlanned.Tag = startDate.AddDays(3);
            lbCell_Friday.Tag = fieldCell_Friday.Tag = fieldCell_FridayPlanned.Tag = startDate.AddDays(4);
            lbCell_Saturday.Tag = fieldCell_Saturday.Tag = fieldCell_SaturdayPlanned.Tag = startDate.AddDays(5);
            lbCell_Sunday.Tag = fieldCell_Sunday.Tag = fieldCell_SundayPlanned.Tag = startDate.AddDays(6);

            foreach (XRTableCell cell in new XRTableCell[] { lbCell_Monday, lbCell_Tuesday,
                                                             lbCell_Wednesday, lbCell_Thursday,
                                                             lbCell_Friday, lbCell_Saturday, lbCell_Sunday })
                cell.Text = string.Format("{0}\n{1}", cell.Text, ((DateTime)cell.Tag).ToShortDateString());
        }
Esempio n. 5
0
        public static void DrawCell(long storeid, IRecordingContext context, EmployeeDay epd, GraphicsCache cache, Rectangle rect, bool bFocused)
        {
            if (context == null)
            {
                return;
            }
            if (epd == null)
            {
                return;
            }
            if (cache == null)
            {
                return;
            }

            StoreDay sd = context.StoreDays[epd.Date];

            DrawBackgroundWeekDayCell(storeid, sd, epd, cache, rect, context.StoreWorldId, bFocused, context.LongAbsences.GetColor(epd.LongAbsenceId));
            DrawWeekDayContent(sd, epd, cache, rect, context);
        }
Esempio n. 6
0
        public static void DrawWeekDayContent(StoreDay storeday, EmployeeDay epd, GraphicsCache cache, Rectangle rect, IRecordingContext context)
        {
            Font cellfont = _cellFont;
            Rectangle cellBound = Rectangle.Inflate(rect, -1, -1);
            Brush cellbrush = Brushes.Black ;
            StringFormat sformat = null;
            if (epd.HasLongAbsence)
            {
                string s = context.LongAbsences.GetAbbreviation(epd.LongAbsenceId);
                if (String.IsNullOrEmpty(s)) return;
                sformat = new StringFormat ();
                sformat.Alignment = StringAlignment.Center;
                sformat.LineAlignment = StringAlignment.Center;
                cache.DrawString(s, cellfont, cellbrush, cellBound, sformat);
            }
            else
            {
                List<string> lstValues = new List<string>();

                List<EmployeeTimeRange> lst = epd.TimeList;

                if (lst != null && lst.Count > 0)
                {
                    sformat = new StringFormat(StringFormatFlags.MeasureTrailingSpaces |
                                            StringFormatFlags.NoWrap);
                    //sformat.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces |
                    //                        StringFormatFlags.NoWrap;

                    //cellbrush = Brushes.Black ;
                    Brush absenceBrush = null;
                    string str = String.Empty;
                    int heightCell = (int)(cellBound.Height);// / 2);
                    foreach (EmployeeTimeRange range in lst)
                    {
                        str = range.ToString();//TextParser.EmployeeTimeToString(range);

                        Size sf = cache.CalcTextSize(str, cellfont, sformat, 10000).ToSize ();

                        if (range.Absence == null)
                        {
                            cache.DrawString(str, cellfont, cellbrush, cellBound, sformat);
                        }
                        else
                        {
                            absenceBrush = cache.GetSolidBrush(Color.FromArgb(range.Absence.Color));
                            cache.DrawString(str, cellfont, absenceBrush, cellBound, sformat);

                        }

                        cellBound.Y += sf.Height + 2;
                        heightCell -= (sf.Height + 2);
                        if ((heightCell < 0)) break;//  - (sf.Height + 2)) < 0) break;
                        //if ((cellBound.Y + sf.Height) > (rect.Y + rect.Width)) break;
                    }

                }
            }
        }
Esempio n. 7
0
        public static void ApplyEmployeeDayStyle(XRControl control, StoreDay storeDay, EmployeeDay employeeDay, long worldID, IRecordingContext context)
        {
            control.BackColor = Color.Transparent;

            ApplyStoreDayStyle(control, storeDay);

            if (employeeDay != null)
            {
                if (employeeDay.CountDailyAdditionalCharges > 0)
                {
                    control.BackColor = Color.Yellow;
                }
                else if (employeeDay.StoreWorldId != worldID || employeeDay.HasLongAbsence || !employeeDay.HasRelation)
                {
                    control.BackColor = Color.Gray;

                    if (employeeDay.HasLongAbsence)
                    {
                        int?color = context.LongAbsences.GetColor(employeeDay.LongAbsenceId);
                        if (color.HasValue)
                        {
                            control.BackColor = Color.FromArgb(color.Value);
                        }
                        //control.ForeColor = Color.Black;
                    }
                }
            }
        }
Esempio n. 8
0
        public static void PrintDayCellValues(XRControl container, EmployeeDay employeeDay, IRecordingContext recordingContext)
        {
            if (employeeDay != null)
            {
                if (employeeDay.HasLongAbsence)
                {
                    string s = recordingContext.LongAbsences.GetAbbreviation(employeeDay.LongAbsenceId);
                    if (!String.IsNullOrEmpty(s))
                    {
                        XRLabel label = AddLabelLine(container, s, Color.Black, 0, false);
                        label.TextAlignment = TextAlignment.MiddleCenter;
                    }
                    return;
                }

                if (employeeDay.TimeList != null)
                {
                    int y = 0;

                    foreach (EmployeeTimeRange range in employeeDay.TimeList)
                    {
                        XRLabel label = AddLabelLine(container, TextParser.EmployeeTimeToString(range), range.Absence == null ? Color.Black : Color.FromArgb(range.Absence.Color), y, false);
                        y = y + label.Height + 1;
                    }
                }
            }
        }
Esempio n. 9
0
        public static void DrawWeekDayContent(StoreDay storeday, EmployeeDay epd, GraphicsCache cache, Rectangle rect, IRecordingContext context)
        {
            Font         cellfont  = _cellFont;
            Rectangle    cellBound = Rectangle.Inflate(rect, -1, -1);
            Brush        cellbrush = Brushes.Black;
            StringFormat sformat   = null;

            if (epd.HasLongAbsence)
            {
                string s = context.LongAbsences.GetAbbreviation(epd.LongAbsenceId);
                if (String.IsNullOrEmpty(s))
                {
                    return;
                }
                sformat               = new StringFormat();
                sformat.Alignment     = StringAlignment.Center;
                sformat.LineAlignment = StringAlignment.Center;
                cache.DrawString(s, cellfont, cellbrush, cellBound, sformat);
            }
            else
            {
                List <string> lstValues = new List <string>();

                List <EmployeeTimeRange> lst = epd.TimeList;

                if (lst != null && lst.Count > 0)
                {
                    sformat = new StringFormat(StringFormatFlags.MeasureTrailingSpaces |
                                               StringFormatFlags.NoWrap);
                    //sformat.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces |
                    //                        StringFormatFlags.NoWrap;

                    //cellbrush = Brushes.Black ;
                    Brush  absenceBrush = null;
                    string str          = String.Empty;
                    int    heightCell   = (int)(cellBound.Height);// / 2);
                    foreach (EmployeeTimeRange range in lst)
                    {
                        str = range.ToString();//TextParser.EmployeeTimeToString(range);

                        Size sf = cache.CalcTextSize(str, cellfont, sformat, 10000).ToSize();

                        if (range.Absence == null)
                        {
                            cache.DrawString(str, cellfont, cellbrush, cellBound, sformat);
                        }
                        else
                        {
                            absenceBrush = cache.GetSolidBrush(Color.FromArgb(range.Absence.Color));
                            cache.DrawString(str, cellfont, absenceBrush, cellBound, sformat);
                        }

                        cellBound.Y += sf.Height + 2;
                        heightCell  -= (sf.Height + 2);
                        if ((heightCell < 0))
                        {
                            break;                  //  - (sf.Height + 2)) < 0) break;
                        }
                        //if ((cellBound.Y + sf.Height) > (rect.Y + rect.Width)) break;
                    }
                }
            }
        }
Esempio n. 10
0
        public static void PrintDayCellValues(XRControl container, EmployeeDay employeeDay, IRecordingContext recordingContext)
        {
            if (employeeDay != null)
            {
                if (employeeDay.HasLongAbsence)
                {
                    string s = recordingContext.LongAbsences.GetAbbreviation(employeeDay.LongAbsenceId);
                    if (!String.IsNullOrEmpty(s))
                    {
                        XRLabel label = AddLabelLine(container, s, Color.Black, 0, false);
                        label.TextAlignment = TextAlignment.MiddleCenter;
                    }
                    return;
                }

                if(employeeDay.TimeList != null)
                {
                    int y = 0;

                    foreach (EmployeeTimeRange range in employeeDay.TimeList)
                    {
                        XRLabel label = AddLabelLine(container, TextParser.EmployeeTimeToString(range), range.Absence == null ? Color.Black : Color.FromArgb(range.Absence.Color), y, false);
                        y = y + label.Height + 1;
                    }
                }
            }
        }