Esempio n. 1
0
        public void MakeReport(DLJoinView jview, CalendarMonthInfo calmt, string title,
                               ERoportType roporttype, MyStyleDefs mystyldDefs)
        {
            HeaderHolyDay    = mystyldDefs.HeaderHolyDayBack;
            HeaderWeekEndDay = mystyldDefs.HeaderWeekEndBack;
            VacationDay      = mystyldDefs.VacationBack;
            SickDay          = mystyldDefs.SickDayBack;
            FreeDay          = mystyldDefs.FreeDayBack;
            HolyDay          = mystyldDefs.HolyDayBack;

            MakeReportA(jview, calmt);
            if (ReportRows.Count == 0)
            {
                return;
            }

            var period = string.Format("{0}. gada {1}",
                                       calmt.Year, Utils.MonthNames[calmt.Month - 1]);

            ReportViewerData rd = new ReportViewerData();

            if (roporttype == ERoportType.Simple)
            {
                rd.FileName = "ReportA_DarbaLaiks_1";
            }
            else
            {
                rd.FileName = "ReportA_DarbaLaiks_1k";
            }
            rd.Sources["DataSet1"] = ReportRows;
            rd.AddReportParameters(new string[]
            {
                "CompanyName", MyData.Params.CompNameX,
                "RPerson", "",
                "RPeriod", period,
                "RLastVisibleDay", calmt.DaysInMonth.ToString(),
                "RTitle", title,
                "RRemark", ""
            });
            rd.AddReportParameter("RHeaders", Headers);
            if (roporttype == ERoportType.WithColors)
            {
                rd.AddReportParameter("RHeaderColors", HeaderColors);
            }
            MyData.MyMainForm.ShowReport(rd);
        }
Esempio n. 2
0
        public void MakeReportA(DLJoinView jview, CalendarMonthInfo calmt)
        {
            ReportRows = new List <TimeReportRow1>();
            int nringroup = 0, idxprev = int.MinValue, idxcur;

            MakeColumnHeadersA(calmt);

            for (int i = 0; i < jview.Count; i++)
            {
                var jr = jview.List[i];
                var dr = jr.BaseRow.Row as KlonsADataSet.TIMESHEETRow;
                var jo = jr.AddedObject as AddToDLJoinViewRow;
                var tr = new TimeReportRow1();
                idxcur = jo.IDX;
                if (idxcur == idxprev)
                {
                    nringroup++;
                }
                else
                {
                    nringroup = 0;
                    idxprev   = idxcur;
                }

                if (nringroup == 0)
                {
                    tr.Caption = jo.Name;
                }
                else if (nringroup == 1)
                {
                    tr.Caption = "  " + jo.Position;
                }

                if (nringroup == 0)
                {
                    tr.BottomBorderVisible = false;
                    if (ReportRows.Count > 2)
                    {
                        ReportRows[ReportRows.Count - 1].BottomBorderVisible = true;
                    }
                }
                else
                {
                    tr.BottomBorderVisible = false;
                    tr.TopBorderVisible    = false;
                }
                if (i == jview.Count - 1)
                {
                    tr.BottomBorderVisible = true;
                }

                tr.Type = SomeDataDefs.DarbaLaiksK1[dr.KIND1].Val;

                int dk = MyData.DataSetKlons.TIMESHEET.D1Column.Ordinal;
                for (int j = 0; j < 31; j++)
                {
                    short daycode = (short)dr[dk + j];
                    float v       = dr.Vx[j];
                    tr.DX[j] = FormatCell(v, daycode, dr.XKind1);
                    var col = ColorCell(v, daycode, dr.XKind1);
                    tr.CX[j] = ColorTranslator.ToHtml(col);
                }

                tr.K1 = dr.K1.ToString();
                ReportRows.Add(tr);
            }
        }