private void xrLabel_Date_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            XRLabel label = (XRLabel)sender;

            label.Text = ConvertTo.DateFormatApp(label.Text);
        }
コード例 #2
0
        public void LoadAttendanceDataGrid()
        {
            //ProgramMasterModel programMaster = ProgramMasterData.GetProgramMasterModel(GlobalVariables.ProgCode);

            //DataSet ds = ProjectFunctions.GetDataSet("Select ProgProcName,ProgDesc from ProgramMaster Where ProgCode='" + GlobalVariables.ProgCode + "'");
            //string ProcedureName = ds.Tables[0].Rows[0]["ProgProcName"].ToString();

            PrintLogWin.PrintLog("LoadAttendanceDataGrid => GlobalVariables.ProgCode ******************** " + GlobalVariables.ProgCode);
            //PrintLogWin.PrintLog("LoadAttendanceDataGrid => ProcedureName Dapper ******************** " + programMaster.ProgProcName);
            //PrintLogWin.PrintLog("LoadAttendanceDataGrid => ProcedureName B ******************** " + ProcedureName);


            //List<AttendanceModel> att = ProgramMasterData.GetData<AttendanceModel>(GlobalVariables.ProgCode);
            //PrintLogWin.PrintLog("LoadAttendanceDataGrid => att ******************** " + att.Count);


            gridView_AttendanceData.Columns.Clear();

            string  _params = "'" + txtEmpCode.EditValue + "', '" + ConvertTo.DateTimeVal(DtStartDate.EditValue).ToString("yyyy-MM-dd") + "'";
            DataSet att_ds  = ProgramMasterData.GetData(GlobalVariables.ProgCode, _params, "_v2");

            if (ComparisonUtils.IsNotNull_DataSet(att_ds))
            {
                BindingList <object> binding_list = new BindingList <object>();

                foreach (DataRow dr in att_ds.Tables[0].Rows)

                {
                    var employeeAttendance = new
                    {
                        SerialId = dr[Col.EmployeeAttendance.serial_id],
                        //EntryDate = dr[Col.EmployeeAttendance.entry_date],
                        AttendanceDate = ConvertTo.DateFormatApp(dr[Col.EmployeeAttendance.attendance_date]),
                        EmployeeCode   = dr[Col.EmployeeAttendance.employee_code],
                        //Shift = dr[Col.DailyShifts.shift_name],
                        Status        = dr[Col.AttendanceStatus.status],
                        TimeIn_First  = ConvertTo.TimeSpanString(dr[Col.EmployeeAttendance.attendance_in_first]),
                        TimeOut_First = ConvertTo.TimeSpanString(dr[Col.EmployeeAttendance.attendance_out_first]),
                        TimeIn_Last   = ConvertTo.TimeSpanString(dr[Col.EmployeeAttendance.attendance_in_last]),
                        TimeOut_Last  = ConvertTo.TimeSpanString(dr[Col.EmployeeAttendance.attendance_out_last]),
                        WorkingHours  = dr[Col.EmployeeAttendance.working_hours],
                        OverTime      = dr[Col.EmployeeAttendance.ot_deducton_time],
                        OverTime_1    = ConvertTo.IntVal(dr[Col.EmployeeAttendance.ot_deducton_time_1]),
                        GatePassTime  = dr[Col.EmployeeAttendance.gate_pass_time],
                        Source        = dr[Col.AttendanceSource.source_name],
                        RowStyle      = dr[Col.GridStyle.Row_Style]
                    };
                    //ConvertTo.DateTimeVal(dr[Col.EmployeeAttendance.attendance_in_first]).ToString("hh:mm tt")

                    binding_list.Add(employeeAttendance);
                }

                gridControl_AttendanceData.DataSource = binding_list;
                if (gridView_AttendanceData.Columns["SerialId"] != null)
                {
                    gridView_AttendanceData.Columns["SerialId"].Visible = false;
                }
                if (gridView_AttendanceData.Columns["EmployeeCode"] != null)
                {
                    gridView_AttendanceData.Columns["EmployeeCode"].Visible = false;
                }
                if (gridView_AttendanceData.Columns["RowStyle"] != null)
                {
                    gridView_AttendanceData.Columns["RowStyle"].Visible = false;
                }
                if (gridView_AttendanceData.Columns["OverTime_1"] != null)
                {
                    gridView_AttendanceData.Columns["OverTime_1"].Visible = false;
                }

                if (binding_list.Count > 0)
                {
                    //GridColumnSummaryItem item1 = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Max, "GatePassTime", "MAX GatePassTime={0}");
                    //GridColumnSummaryItem item2 = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Min, "GatePassTime", "MIN GatePassTime={0}");
                    //gridView_AttendanceData.Columns["GatePassTime"].Summary.Add(item1);
                    //gridView_AttendanceData.Columns["GatePassTime"].Summary.Add(item2);

                    //gridView_AttendanceData.Columns["WorkingHours"].Summary.Add(DevExpress.Data.SummaryItemType.Average, "WorkingHours", "Avg={0:n2}");
                    //gridView_AttendanceData.Columns["WorkingHours"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "WorkingHours", "Sum={0}");
                    //GridColumnSummaryItem item = new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Max, "WorkingHours", "Max={0}");
                    //gridView_AttendanceData.Columns["WorkingHours"].Summary.Add(item);

                    //gridView_AttendanceData.Columns["OverTime"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "OverTime_1", "Total OverTime={0}",);

                    /*
                     *                  GridColumnSummaryItem item = new GridColumnSummaryItem();
                     *                  item.SummaryType = DevExpress.Data.SummaryItemType.Custom;
                     *
                     *                  item.Tag = "OverTime_Summary";
                     *                  gridView_AttendanceData.Columns["OverTime"].Summary.Add(item);
                     */
                    //item = new GridColumnSummaryItem();
                    //item.SummaryType = DevExpress.Data.SummaryItemType.Custom;
                    //item.Tag = "2";
                    //gridView_AttendanceData.Columns["OverTime"].Summary.Add(item);

                    gridView_AttendanceData.Columns["OverTime_1"].Summary.Add(DevExpress.Data.SummaryItemType.Sum, "OverTime_1", string.Empty);
                    gridView_AttendanceData.Columns["OverTime"].Summary.Add(DevExpress.Data.SummaryItemType.Custom);

                    gridView_AttendanceData.UpdateTotalSummary();
                }
            }
        }